Jump to content

Recommended Posts

Hi everybody,

I have some trouble understanding why sc_interface.h in systemc 2.3 contains:

private:
static sc_event m_never_notified;
#if __SUNPRO_CC == 0x520
// Workaround for a bug in the Sun WorkShop 6 update 2 compiler.
// An empty virtual base class can cause the optimizer to
// generate wrong code.
char dummy;
#endif
};

and nobody ran into this issue? Should __SUNPRO_CC be defined by default by the compiler on any platform?

with the right set of flags I get with gcc:

systemc-2.3.0/include/sysc/communication/sc_interface.h:72: error: "__SUNPRO_CC" is not defined

Is it an already reported bug?

To me the right code would be

private:
static sc_event m_never_notified;
#if defined(__SUNPRO_CC) && (__SUNPRO_CC == 0x520)
// Workaround for a bug in the Sun WorkShop 6 update 2 compiler.
// An empty virtual base class can cause the optimizer to
// generate wrong code.
char dummy;
#endif
};

Best regards,

Alexandre

Share this post


Link to post
Share on other sites

with the right set of flags I get with gcc:

The "right set of flags" obviously include (explicitly or implicitly) "-Wundef -Werror".

From the C(++) preprocessor standard point of view, it is not a bug. All undefined symbols are supposed to be interpreted as 0:

After all replacements due to macro expansion and the defined unary operator have been performed, all remaining identifiers (including those lexically identical to keywords) are replaced with the pp-number 0

Side note: When using strict GCC compiler flags in your models (which is a very good idea!), you might want to include third-party libraries like SystemC as "system headers" to avoid such problems coming from external sources:

 $(CXX) $(CXXFLAGS) -isystem $(SYSTEMC_HOME)/include ...

It is probably still a good idea to explicitly check for __SUNPRO_CC in sc_interface.h first.

Thanks for reporting.

Greetings from Oldenburg,

Philipp

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×