Possible Compiler bug?
Hi,
I get the following error message:
CC -c -I../../include -I../../build/debug/include -DBM_CORE_API_EXPORTS -I.. -mt +p -library=stlport4 -features=extensions -features=tmplife -features=tmplrefstatic -Qoption ccfe -complextmplexp -xldscope=hidden +w -erroff=hidef -g -xarch=amd64 -KPIC Column.cpp
>> Assertion:(../lnk/exprparse.cc, line 1412)
while processing Column.cpp at line 0.
My source is at the moment about 6000 LoC.
Until my last changes it compiled ok.
Has anyone seen this already?
Does somebody know, what it means, and
how to fix my code?
Many thanks for all comments.
Markus
[672 byte] By [
quisam] at [2007-11-26 10:48:14]

# 1
An "Assertion" from the compiler is always a compiler. bug.
It is not possible to tell whether it is a known bug without a test case.
First, get the current patches for you compiler from the Sun Studio patch page:
http://developers.sun.com/prodtech/cc/downloads/patches/index.html
Update the compiler and see if that fixes the problem.
If not, please file a bug at bugs.sun.com, including a test case that demonstrates the problem.
# 2
My machine has all available patches installed (smpatch analyze).
I don't know how to build a testcase for it.
The assertion goes away if I deactivate following trace macros via -DNTRACE.
#ifndef NTRACE
#define BM_TRACE \
bm_util::Trace _trace (__FILE__, __LINE__, __func__)
#define BM_TRACE_RETURN(V)\
do { _trace.setLine(__LINE__); return V; } while (0)
#define BM_TRACE_RETURN_VOID \
do { _trace.setLine(__LINE__); return;} while (0)
#define BM_TRACE_IMMEDIATE_RETURN(V)\
do { bm_util::Trace (__FILE__, __LINE__, __func__); return V; } while (0)
#define BM_TRACE_IMMEDIATE_RETURN_VOID \
do { bm_util::Trace (__FILE__, __LINE__, __func__); return;} while (0)
#else
#define BM_TRACE
#define BM_TRACE_RETURN(V)return V
#define BM_TRACE_RETURN_VOIDreturn
#define BM_TRACE_IMMEDIATE_RETURN(V)return V
#define BM_TRACE_IMMEDIATE_RETURN_VOIDreturn
#endif
I'm using this macros all over my code. Until now they always have worked. In a small testcase they are also working.
I only can reproduce it with my complete source tree :-(
Markus
# 3
1. Try to remove -Qoption ccfe -complextmplexp.2. You have five BM_TRACE macros. Try to disable them one by one.3. I took a look at the compiler code. The problem related to __func__ macros. I do not know a workaround but this information might help you to find it.
# 4
1. Try to remove -Qoption ccfe -complextmplexp.
That does not help.
2. You have five BM_TRACE macros. Try to disable them one by one.
Very good idea. The following macro causes the problem:
#define BM_TRACE_IMMEDIATE_RETURN_VOID \
do { bm_util::Trace (__FILE__, __LINE__, __func__); return;} while (0)
The following code works:
#ifndef BM_CORE_INDEX_H_
#define BM_CORE_INDEX_H_
#include <BmCore/Config.h>
#include <BmCore/SearchResult.h>
#include <BmUtil/Trace.h>
namespace bm_core
{
template<class _T_DataType> class BM_CORE_API Index
{
public:
Index() {
//BM_TRACE_IMMEDIATE_RETURN_VOID; // <= CRASH
}
virtual ~Index() {
//BM_TRACE_IMMEDIATE_RETURN_VOID; // <= CRASH
}
};
template<> class BM_CORE_API Index<UnicodeString>
{
public:
Index() {
BM_TRACE_IMMEDIATE_RETURN_VOID;
}
virtual ~Index() {
//BM_TRACE_IMMEDIATE_RETURN_VOID; // <= CRASH
}
};
}
If I remove the comment at one of the three commented BM_TRACE_IMMEDIATE_RETURN_VOID macros, the compiler crashes. Curiosly the forth always works.
#endif /* BM_CORE_INDEX_H_*/
3. I took a look at the compiler code. The problem related to __func__ macros. I do not know a workaround but this information might help you to find it.
Thank you for this information and your help.
Markus
