This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: Standard headers give compile-time error at -O2
- To: austern at sgi dot com
- Subject: Re: Standard headers give compile-time error at -O2
- From: "Martin v. Loewis" <martin at loewis dot home dot cs dot tu-berlin dot de>
- Date: Thu, 23 Dec 1999 11:32:40 +0100
- CC: gcc-bugs at gcc dot gnu dot org, lo at cthulhu dot engr dot sgi dot com, arutz at cthulhu dot engr dot sgi dot com, jfw at cthulhu dot engr dot sgi dot com, austern at isolde dot engr dot sgi dot com
- References: <9912221753.ZM22569@isolde.engr.sgi.com>
> 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