Fix 3.823 constructor core dump on Debian, bug401.
This commit is contained in:
parent
734400fd37
commit
1f2b40cff1
2
Changes
2
Changes
|
|
@ -8,6 +8,8 @@ indicates the contributor was also the author of the fix; Thanks!
|
||||||
|
|
||||||
*** Fix "always @ (* )", bug403, bug404. [Walter Lavino]
|
*** Fix "always @ (* )", bug403, bug404. [Walter Lavino]
|
||||||
|
|
||||||
|
**** Fix 3.823 constructor core dump on Debian, bug401. [Ahmed El-Mahmoudy]
|
||||||
|
|
||||||
|
|
||||||
* Verilator 3.823 2011/10/20
|
* Verilator 3.823 2011/10/20
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -34,11 +34,6 @@
|
||||||
//======================================================================
|
//======================================================================
|
||||||
// Statics
|
// Statics
|
||||||
|
|
||||||
map<string,int> FileLine::s_namemap;
|
|
||||||
deque<string> FileLine::s_names;
|
|
||||||
// s_defaultFileLine must be after s_name* initializer and in same .cpp file
|
|
||||||
FileLine FileLine::s_defaultFileLine = FileLine(EmptySecret());
|
|
||||||
|
|
||||||
int V3Error::s_errCount = 0;
|
int V3Error::s_errCount = 0;
|
||||||
int V3Error::s_warnCount = 0;
|
int V3Error::s_warnCount = 0;
|
||||||
int V3Error::s_debugDefault = 0;
|
int V3Error::s_debugDefault = 0;
|
||||||
|
|
@ -69,13 +64,28 @@ V3ErrorCode::V3ErrorCode(const char* msgp) {
|
||||||
m_e = V3ErrorCode::EC_ERROR;
|
m_e = V3ErrorCode::EC_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//######################################################################
|
||||||
|
// FileLineSingleton class functions
|
||||||
|
|
||||||
|
int FileLineSingleton::nameToNumber(const string& filename) {
|
||||||
|
// Convert filenames to a filenameno
|
||||||
|
// This lets us assign a nice small identifier for debug messages, but more
|
||||||
|
// importantly lets us use a 4 byte int instead of 8 byte pointer in every FileLine.
|
||||||
|
map<string,int>::const_iterator iter = m_namemap.find(filename);
|
||||||
|
if (VL_LIKELY(iter != m_namemap.end())) return iter->second;
|
||||||
|
int num = m_names.size();
|
||||||
|
m_names.push_back(filename);
|
||||||
|
m_namemap.insert(make_pair(filename,num));
|
||||||
|
return num;
|
||||||
|
}
|
||||||
|
|
||||||
//######################################################################
|
//######################################################################
|
||||||
// FileLine class functions
|
// FileLine class functions
|
||||||
|
|
||||||
FileLine::FileLine(FileLine::EmptySecret) {
|
FileLine::FileLine(FileLine::EmptySecret) {
|
||||||
// Sort of a singleton
|
// Sort of a singleton
|
||||||
m_lineno=0;
|
m_lineno=0;
|
||||||
m_filenameno=nameToNumber("AstRoot");
|
m_filenameno=singleton().nameToNumber("AstRoot");
|
||||||
|
|
||||||
m_warnOn=0;
|
m_warnOn=0;
|
||||||
for (int codei=V3ErrorCode::EC_MIN; codei<V3ErrorCode::_ENUM_MAX; codei++) {
|
for (int codei=V3ErrorCode::EC_MIN; codei<V3ErrorCode::_ENUM_MAX; codei++) {
|
||||||
|
|
@ -84,18 +94,6 @@ FileLine::FileLine(FileLine::EmptySecret) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int FileLine::nameToNumber(const string& filename) {
|
|
||||||
// Convert filenames to a filenameno
|
|
||||||
// This lets us assign a nice small identifier for debug messages, but more
|
|
||||||
// importantly lets us use a 4 byte int instead of 8 byte pointer in every FileLine.
|
|
||||||
map<string,int>::const_iterator iter = s_namemap.find(filename);
|
|
||||||
if (VL_LIKELY(iter != s_namemap.end())) return iter->second;
|
|
||||||
int num = s_names.size();
|
|
||||||
s_names.push_back(filename);
|
|
||||||
s_namemap.insert(make_pair(filename,num));
|
|
||||||
return num;
|
|
||||||
}
|
|
||||||
|
|
||||||
const string FileLine::filenameLetters() const {
|
const string FileLine::filenameLetters() const {
|
||||||
const int size = 1 + (64 / 4); // Each letter retires more than 4 bits of a > 64 bit number
|
const int size = 1 + (64 / 4); // Each letter retires more than 4 bits of a > 64 bit number
|
||||||
char out[size];
|
char out[size];
|
||||||
|
|
@ -291,8 +289,7 @@ void FileLine::deleteAllRemaining() {
|
||||||
// Eventually the list will be empty and terminate the loop.
|
// Eventually the list will be empty and terminate the loop.
|
||||||
}
|
}
|
||||||
fileLineLeakChecks.clear();
|
fileLineLeakChecks.clear();
|
||||||
s_names.clear();
|
FileLineSingleton::clear();
|
||||||
s_namemap.clear();
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -252,8 +252,17 @@ inline uint32_t cvtToHash(void* vp) {
|
||||||
class FileLine;
|
class FileLine;
|
||||||
|
|
||||||
class FileLineSingleton {
|
class FileLineSingleton {
|
||||||
|
map<string,int> m_namemap; // filenameno for each filename
|
||||||
|
deque<string> m_names; // filename text for each filenameno
|
||||||
|
// COSNTRUCTORS
|
||||||
|
FileLineSingleton() { }
|
||||||
|
~FileLineSingleton() { }
|
||||||
protected:
|
protected:
|
||||||
friend class FileLine;
|
friend class FileLine;
|
||||||
|
// METHODS
|
||||||
|
int nameToNumber(const string& filename);
|
||||||
|
string numberToName(int filenameno) { return m_names[filenameno]; }
|
||||||
|
void clear() { m_namemap.clear(); m_names.clear(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
class FileLine {
|
class FileLine {
|
||||||
|
|
@ -263,31 +272,33 @@ class FileLine {
|
||||||
bitset<V3ErrorCode::_ENUM_MAX> m_warnOn;
|
bitset<V3ErrorCode::_ENUM_MAX> m_warnOn;
|
||||||
// Consider moving opt.language() into here, so can know language per-node
|
// Consider moving opt.language() into here, so can know language per-node
|
||||||
|
|
||||||
static map<string,int> s_namemap; // filenameno for each filename
|
private:
|
||||||
static deque<string> s_names; // filename text for each filenameno
|
|
||||||
static FileLine s_defaultFileLine;
|
|
||||||
|
|
||||||
static int nameToNumber(const string& filename);
|
|
||||||
static string numberToName(int filenameno) { return s_names[filenameno]; }
|
|
||||||
|
|
||||||
struct EmptySecret {};
|
struct EmptySecret {};
|
||||||
|
inline static FileLineSingleton& singleton() {
|
||||||
|
static FileLineSingleton s;
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
inline static FileLine& defaultFileLine() {
|
||||||
|
static FileLine* defFilelinep = new FileLine(FileLine::EmptySecret());
|
||||||
|
return *defFilelinep;
|
||||||
|
}
|
||||||
protected:
|
protected:
|
||||||
// User routines should never need to change line numbers
|
// User routines should never need to change line numbers
|
||||||
// We are storing pointers, so we CAN'T change them after initial reading.
|
// We are storing pointers, so we CAN'T change them after initial reading.
|
||||||
|
friend class FileLineSingleton;
|
||||||
friend class V3ParseImp;
|
friend class V3ParseImp;
|
||||||
friend class V3PreLex;
|
friend class V3PreLex;
|
||||||
friend class V3PreProcImp;
|
friend class V3PreProcImp;
|
||||||
void lineno(int num) { m_lineno = num; }
|
void lineno(int num) { m_lineno = num; }
|
||||||
void filename(const string& name) { m_filenameno = nameToNumber(name); }
|
void filename(const string& name) { m_filenameno = singleton().nameToNumber(name); }
|
||||||
void lineDirective(const char* textp, int& enterExitRef);
|
void lineDirective(const char* textp, int& enterExitRef);
|
||||||
void linenoInc() { m_lineno++; }
|
void linenoInc() { m_lineno++; }
|
||||||
void linenoIncInPlace() { m_lineno++; }
|
void linenoIncInPlace() { m_lineno++; }
|
||||||
FileLine* copyOrSameFileLine();
|
FileLine* copyOrSameFileLine();
|
||||||
public:
|
public:
|
||||||
FileLine (const string& filename, int lineno) {
|
FileLine (const string& filename, int lineno) {
|
||||||
m_lineno=lineno; m_filenameno = nameToNumber(filename);
|
m_lineno=lineno; m_filenameno = singleton().nameToNumber(filename);
|
||||||
m_warnOn=s_defaultFileLine.m_warnOn; }
|
m_warnOn=defaultFileLine().m_warnOn; }
|
||||||
FileLine (FileLine* fromp) {
|
FileLine (FileLine* fromp) {
|
||||||
m_lineno=fromp->m_lineno; m_filenameno = fromp->m_filenameno; m_warnOn=fromp->m_warnOn; }
|
m_lineno=fromp->m_lineno; m_filenameno = fromp->m_filenameno; m_warnOn=fromp->m_warnOn; }
|
||||||
FileLine (EmptySecret);
|
FileLine (EmptySecret);
|
||||||
|
|
@ -302,7 +313,7 @@ public:
|
||||||
|
|
||||||
int lineno () const { return m_lineno; }
|
int lineno () const { return m_lineno; }
|
||||||
string ascii() const;
|
string ascii() const;
|
||||||
const string filename () const { return numberToName(m_filenameno); }
|
const string filename () const { return singleton().numberToName(m_filenameno); }
|
||||||
const string filenameLetters() const;
|
const string filenameLetters() const;
|
||||||
const string filebasename () const;
|
const string filebasename () const;
|
||||||
const string filebasenameNoExt () const;
|
const string filebasenameNoExt () const;
|
||||||
|
|
@ -315,7 +326,7 @@ public:
|
||||||
void warnLintOff(bool flag);
|
void warnLintOff(bool flag);
|
||||||
void warnStyleOff(bool flag);
|
void warnStyleOff(bool flag);
|
||||||
void warnStateFrom(const FileLine& from) { m_warnOn=from.m_warnOn; }
|
void warnStateFrom(const FileLine& from) { m_warnOn=from.m_warnOn; }
|
||||||
void warnResetDefault() { warnStateFrom(s_defaultFileLine); }
|
void warnResetDefault() { warnStateFrom(defaultFileLine()); }
|
||||||
|
|
||||||
// Specific flag ACCESSORS/METHODS
|
// Specific flag ACCESSORS/METHODS
|
||||||
bool coverageOn() const { return m_warnOn.test(V3ErrorCode::I_COVERAGE); }
|
bool coverageOn() const { return m_warnOn.test(V3ErrorCode::I_COVERAGE); }
|
||||||
|
|
@ -325,13 +336,13 @@ public:
|
||||||
|
|
||||||
// METHODS - Global
|
// METHODS - Global
|
||||||
static void globalWarnLintOff(bool flag) {
|
static void globalWarnLintOff(bool flag) {
|
||||||
s_defaultFileLine.warnLintOff(flag); }
|
defaultFileLine().warnLintOff(flag); }
|
||||||
static void globalWarnStyleOff(bool flag) {
|
static void globalWarnStyleOff(bool flag) {
|
||||||
s_defaultFileLine.warnStyleOff(flag); }
|
defaultFileLine().warnStyleOff(flag); }
|
||||||
static void globalWarnOff(V3ErrorCode code, bool flag) {
|
static void globalWarnOff(V3ErrorCode code, bool flag) {
|
||||||
s_defaultFileLine.warnOff(code, flag); }
|
defaultFileLine().warnOff(code, flag); }
|
||||||
static bool globalWarnOff(const string& code, bool flag) {
|
static bool globalWarnOff(const string& code, bool flag) {
|
||||||
return s_defaultFileLine.warnOff(code, flag); }
|
return defaultFileLine().warnOff(code, flag); }
|
||||||
|
|
||||||
// METHODS - Called from netlist
|
// METHODS - Called from netlist
|
||||||
// Merge warning disables from another fileline
|
// Merge warning disables from another fileline
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue