Skip to content

Commit 9e7e76a

Browse files
committed
At least I got it to compile with g++ 10.2 and LLVM 10.
It still instantly segfaults with: Process 3464178 launched: '/code/contribs/corvus/build/frontend/corvus' (x86_64) Process 3464178 stopped * thread weyrick#1, name = 'corvus', stop reason = signal SIGSEGV: invalid address (fault address: 0x8) frame #0: 0x00007ffff7e96868 libcorvus.so`llvm::MemoryBuffer::getBufferStart() const + 12 libcorvus.so`llvm::MemoryBuffer::getBufferStart: -> 0x7ffff7e96868 <+12>: movq 0x8(%rax), %rax 0x7ffff7e9686c <+16>: popq %rbp 0x7ffff7e9686d <+17>: retq
1 parent c03e348 commit 9e7e76a

File tree

8 files changed

+26
-22
lines changed

8 files changed

+26
-22
lines changed

3rdparty/lexertl/parser/tokeniser/re_tokeniser_state.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ struct basic_re_tokeniser_state
6363
assign (rhs_);
6464
}
6565

66-
void assign (const basic_re_tokeniser_state &rhs_)
66+
auto assign (const basic_re_tokeniser_state &rhs_)
6767
{
6868
_start = rhs_._start;
6969
_end = rhs_._end;

CMakeLists.txt

+7-3
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,13 @@ MESSAGE( STATUS "CMAKE_SYSTEM_PROCESSOR: " ${CMAKE_SYSTEM_PROCESSOR} )
2929

3030
Find_Package(Boost REQUIRED)
3131

32-
IF( Boost_VERSION LESS ${BOOST_MIN_VERSION} )
33-
MESSAGE(FATAL_ERROR "Boost version ${Boost_VERSION} too old, please install ${BOOST_MIN_VERSION_TEXT} or greater!")
34-
ENDIF( Boost_VERSION LESS ${BOOST_MIN_VERSION} )
32+
#IF( Boost_VERSION LESS ${BOOST_MIN_VERSION} )
33+
# MESSAGE(FATAL_ERROR "Boost version ${Boost_VERSION} too old, please install ${BOOST_MIN_VERSION_TEXT} or greater!")
34+
#ENDIF( Boost_VERSION LESS ${BOOST_MIN_VERSION} )
35+
36+
set(NEEDED_Boost_VERSION 1.69.0)
37+
find_package(Boost ${NEEDED_Boost_VERSION} REQUIRED COMPONENTS mpi serialization system filesystem)
38+
set(Boost_LIBS ${Boost_LIBRARIES})
3539

3640
Find_Package(LLVM REQUIRED)
3741
Find_Package(Sqlite3 REQUIRED)

corvus/pConfig.cpp

+4-5
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212

1313
#include <iostream>
1414

15-
#include <llvm/ADT/OwningPtr.h>
16-
1715
#if (LLVM_VERSION >= 3003000)
1816
#include <llvm/IR/Value.h> // isa
1917
#else
@@ -23,18 +21,19 @@
2321
#include <llvm/Support/SourceMgr.h>
2422
#include <llvm/Support/YAMLParser.h>
2523
#include <llvm/Support/MemoryBuffer.h>
26-
#include <llvm/Support/system_error.h>
2724
#include <llvm/ADT/APInt.h>
2825

26+
#include <system_error> // for error_code
27+
2928
namespace corvus {
3029

3130
bool pConfigMgr::read(const llvm::Twine &file, pConfig &c) {
3231

3332
llvm::SmallString<128> path_storage;
3433
llvm::StringRef fName = file.toStringRef(path_storage);
3534

36-
llvm::OwningPtr<llvm::MemoryBuffer> contents;
37-
if (llvm::MemoryBuffer::getFile(fName, contents)) {
35+
std::unique_ptr<llvm::MemoryBuffer> contents;
36+
if (llvm::MemoryBuffer::getFile(fName)) {
3837
return false;
3938
}
4039

corvus/pParseContext.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,9 @@ class pParseContext {
5858
void *allocate(size_t size, size_t align = 8) {
5959
return allocator_.Allocate(size, align);
6060
}
61-
void deallocate(void* Ptr) {
61+
void deallocate(void* Ptr, size_t Size = 4096) {
6262
// note this is a NOOP for bumpptr
63-
allocator_.Deallocate(Ptr);
63+
allocator_.Deallocate(Ptr, Size);
6464
}
6565

6666
llvm::StringPool& idPool(void) { return idPool_; }

corvus/pParser.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ void parseSourceFile(pSourceModule* pMod, bool debug=false) {
149149
countNewlines(context, match, lastNL);
150150
break;
151151
}
152-
case ~0: // npos
152+
case std::numeric_limits<int>::max(): // npos
153153
{
154154
// if state is HTML, collect characters for INLINE HTML token
155155
if (match.state == 0) {

corvus/pSourceFile.cpp

+2-3
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,15 @@
1212
#include "corvus/pParseError.h"
1313
#include "corvus/pSourceLoc.h"
1414

15-
#include <llvm/Support/system_error.h>
16-
15+
#include <system_error> // for error_code
1716

1817
namespace corvus {
1918

2019
pSourceFile::pSourceFile(pStringRef file):
2120
file_(file)
2221
{
2322

24-
if (llvm::MemoryBuffer::getFile(file, contents_)) {
23+
if (llvm::MemoryBuffer::getFile(file)) {
2524
throw pParseError("couldn't open file [" + file_ + "]", pSourceLoc(file, 0, 0));
2625
}
2726

corvus/pSourceFile.h

+5-3
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,18 @@
1414
#include "corvus/pTypes.h"
1515

1616
#include <string>
17-
#include <llvm/ADT/OwningPtr.h>
17+
#include <llvm/Support/ErrorOr.h>
1818
#include <llvm/Support/MemoryBuffer.h>
1919

20+
using llvm::MemoryBuffer;
21+
2022
namespace corvus {
2123

2224
class pSourceFile {
2325

2426
private:
2527
std::string file_;
26-
llvm::OwningPtr<llvm::MemoryBuffer> contents_;
28+
std::unique_ptr<MemoryBuffer> contents_;
2729

2830
public:
2931

@@ -32,7 +34,7 @@ class pSourceFile {
3234
const std::string& fileName(void) const {
3335
return file_;
3436
}
35-
const llvm::MemoryBuffer* contents(void) const { return contents_.get(); }
37+
const MemoryBuffer* contents(void) const { return contents_.get(); }
3638

3739
};
3840

corvus/pSourceManager.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,15 @@
2525
#include "corvus/passes/ModelChecker.h"
2626
#include "corvus/passes/TypeAnalysis.h"
2727

28-
#include <llvm/Support/PathV2.h>
28+
#include <llvm/Support/Path.h>
2929
#include <llvm/Support/FileSystem.h>
30-
#include <llvm/Support/system_error.h>
3130
#include <llvm/ADT/SmallVector.h>
3231

3332
#include <sqlite3.h>
3433

3534
#include <stdlib.h>
3635
#include <assert.h>
36+
#include <system_error> // for error_code
3737

3838
namespace corvus {
3939

@@ -219,7 +219,7 @@ void pSourceManager::addSourceDir(pStringRef name, pStringRef exts) {
219219
llvm::SmallVector<pStringRef, 8> extList;
220220
exts.split(extList, ",");
221221

222-
llvm::error_code ec;
222+
std::error_code ec;
223223
for (llvm::sys::fs::recursive_directory_iterator dir(name, ec), dirEnd;
224224
dir != dirEnd && !ec; dir.increment(ec)) {
225225

@@ -326,7 +326,7 @@ void pSourceManager::addIncludeDir(pStringRef name, pStringRef exts) {
326326
llvm::SmallVector<pStringRef, 8> extList;
327327
exts.split(extList, ",", 8);
328328

329-
llvm::error_code ec;
329+
std::error_code ec;
330330
for (llvm::sys::fs::recursive_directory_iterator dir(name, ec), dirEnd;
331331
dir != dirEnd && !ec; dir.increment(ec)) {
332332

0 commit comments

Comments
 (0)