This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


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

Re: Standard headers give compile-time error at -O2


> This isn't really an optimizer bug.  -O2 makes a difference
> only because it defines a couple of macros and changes the
> preprocessed source.

Thanks for your bug report. I would claim that it is not a bug in GCC,
either. Please have a look at the cited places in glibc:

/usr/include/stdlib.h:474
extern __ptr_t malloc __P ((size_t __size));

/usr/include/malloc.h:116 (line number is for glibc 2.1.2
extern __malloc_ptr_t malloc __MALLOC_P ((size_t __size));

Now, both __P and __MALLOC_P should expand to include throw() if
compiled with gcc. I guess this is not the case in your copy of glibc,
which must be missing the following change

1999-05-23  Andreas Jaeger  <aj@arthur.rhein-neckar.de>

        * malloc/malloc.h: Add __THROW for __MALLOC_P to synch with usage
        of __P in the rest of glibc; define __MALLOC_PMT and use it.
        Reported by Stephan Kulow <coolo@kde.org>.

If both declarations differ in their exception specification, g++
should (and now does) diagnose that. Please note that an
implementation is not required to put exception specs to the standard
C functions; if glibc does so, it should do so consistently.

Apparently, glibc 2.1.x with x>=1 has that fixed; I recommend to
upgrade.

Regards,
Martin


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