This is the mail archive of the ecos-devel@sources.redhat.com mailing list for the eCos 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: GCC 3.4 issue


On Fri, 2004-02-27 at 10:14, Andrew Lunn wrote:
> On Fri, Feb 27, 2004 at 09:11:02AM -0700, Gary Thomas wrote:
> > On Fri, 2004-02-27 at 08:53, Andrew Lunn wrote:
> > > On Fri, Feb 27, 2004 at 08:37:46AM -0700, Gary Thomas wrote:
> > > > Just for grins, I thought I'd give 3.4 (pre-release) a spin.  Lo and behold,
> > > > there are problems (PPC at least):
> > > > 
> > > > powerpc-eabi-gcc -c  -I/work/moab/t/install/include -I/work2/ecos/packages/io/fileio/current -I/work2/ecos/packages/io/fileio/current/src -I/work2/ecos/packages/io/fileio/current/tests -I. -I/work2/ecos/packages/io/fileio/current/src/ -msoft-float -mcpu=405 -Wall -Wpointer-arith -Wstrict-prototypes -Winline -Wundef -Woverloaded-virtual -g -O2 -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions   -Wp,-MD,src/file.tmp -o src/io_fileio_file.o /work2/ecos/packages/io/fileio/current/src/file.cxx
> > > > cc1plus: warning: command line option "-Wstrict-prototypes" is valid for C/ObjC but not for C++
> > > > /tmp/cchuPi8h.s: Assembler messages:
> > > > /tmp/cchuPi8h.s:105: Error: symbol `__cygvar_discard_me__' is already defined
> > > > 
> > > > This comes from use of this macro:
> > > > 
> > > > // -------------------------------------------------------------------------
> > > > // Reference a symbol without explicitly making use of it. Ensures that
> > > > // the object containing the symbol will be included when linking.
> > > > 
> > > > #define CYG_REFERENCE_OBJECT(__object__)                                 \
> > > >      CYG_MACRO_START                                                     \
> > > >      static void *__cygvar_discard_me__ __attribute__ ((unused)) =       \
> > > >                                                           &(__object__); \
> > > >      CYG_MACRO_END
> > > 
> > > Have you looked at the assembly code to work out what is going on? 
> > > 
> > > Im guessing there are multiple invocations of CYG_REFERENCE_OBJECT()
> > > and its not respecting the static keyword. If thats true its a bug in
> > > GCC which should be fixed.
> > 
> > I think __attribute__((unused)) isn't having any effect.  What happens 
> > is if the same file has more than one call to CYG_REFERENCE_OBJECT, then
> > you end up with multiple declarations of __cygvar_discard_me__.
> 
> I don't think thats correct. The __attribute__((unused)) is to tell
> the compiler not to warn about a variable that is assigned but then
> never used.
> 
> The code intends to have multiple declarations of
> __cygvar_discard_me__.  But since CYG_MACRO_START is something like {
> and CYG_MACRO_END is something like }, they are all in different
> scope. So there should not be an problems with multiple
> declarations. It looks like something is going wrong with the scope of
> static variables.

Indeed, as I have reported to the GCC folks.  They have already verified
it as a regression from 3.3.x.  I don't know how long it might take them
to fix it though :-(

In the meantime, I have a [crude] workaround.  I still have other issues
with 3.4 to check out.

-- 
Gary Thomas <gary@mlbassoc.com>
MLB Associates


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