This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: assertion with --enable-libgcj-debug


Gabriel Dos Reis writes:
 > Gabriel Dos Reis <gdr@integrable-solutions.net> writes:
 > 
 > | Anthony Green <green@redhat.com> writes:
 > | 
 > | | Hi,
 > | | 
 > | | I wanted to poke at Azureus again, so I built a 4.0 branch toolchain with
 > | | --enable-libgcj-debug.  I had to apply the following hack in order for libgcj
 > | | to compile cleanly, since we have some assertions that try to read non-public
 > | | fields.
 > | | 
 > | | Index: gcj/javaprims.h
 > | | ===================================================================
 > | | RCS file: /cvs/gcc/gcc/libjava/gcj/javaprims.h,v
 > | | retrieving revision 1.55
 > | | diff -u -p -r1.55 javaprims.h
 > | | --- gcj/javaprims.h     23 Feb 2005 17:36:24 -0000      1.55
 > | | +++ gcj/javaprims.h     3 Jul 2005 07:00:50 -0000
 > | | @@ -535,6 +535,9 @@ typedef unsigned int _Jv_ulong __attribu
 > | | 
 > | |  class _Jv_Utf8Const
 > | |  {
 > | | +#ifdef DEBUG
 > | | +  public:
 > | | +#endif
 > | 
 > | Notice this results in ODR violation between DEBUG and non-DEBUG mode.
 > | How serious it is  I don't know (I would say low, until GCC starts
 > | taking access specifiers into account), but it definitely goes in the
 > | undefined behaviour land.
 > 
 > I looked at the class definition, and the ODR violation here is pretty
 > serious. Basically, it makes _Jv_Utf8Const a POD in DEBUG mode and a
 > non-POD in non-DEBUG mode.  The immediate consequence is that it
 > changes the ABI of the class,

Yeah, this is nasty.  Anthony, this class is shared with the compiler,
so it has to match the compiler's understanding of the world: you
can't change visibility in this way because the layout may change.
Can you add friends instead?

TIA,
Andrew.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]