g++ fails to compile source includes <cstdio> when set pedantic and O option. % cat a.cpp #include <cstdio> int main() { return 0; } [OK]% g++ a.cpp [OK]% g++ -pedantic a.cpp [OK]% g++ -O a.cpp [NG]% g++ -pedantic -O a.cpp In file included from /usr/include/stdio.h:827, from /usr/include/c++/3.2.3/cstdio:52, from a.cpp:1: /usr/include/bits/stdio.h: In function `int getchar()': /usr/include/bits/stdio.h:42: declaration of `int getchar() throw ()' throws different exceptions /usr/include/stdio.h:444: than previous declaration `int getchar()' /usr/include/bits/stdio.h: In function `int getc_unlocked(FILE*)': /usr/include/bits/stdio.h:51: declaration of `int getc_unlocked(FILE*) throw () ' throws different exceptions /usr/include/stdio.h:456: than previous declaration `int getc_unlocked(FILE*)' /usr/include/bits/stdio.h: In function `int getchar_unlocked()': /usr/include/bits/stdio.h:58: declaration of `int getchar_unlocked() throw ()' throws different exceptions /usr/include/stdio.h:457: than previous declaration `int getchar_unlocked()' /usr/include/bits/stdio.h: In function `int putchar(int)': /usr/include/bits/stdio.h:67: declaration of `int putchar(int) throw ()' throws different exceptions /usr/include/stdio.h:483: than previous declaration `int putchar(int)' /usr/include/bits/stdio.h: In function `int fputc_unlocked(int, FILE*)': /usr/include/bits/stdio.h:76: declaration of `int fputc_unlocked(int, FILE*) throw ()' throws different exceptions /usr/include/stdio.h:497: than previous declaration `int fputc_unlocked(int, FILE*)' /usr/include/bits/stdio.h: In function `int putc_unlocked(int, FILE*)': /usr/include/bits/stdio.h:86: declaration of `int putc_unlocked(int, FILE*) throw ()' throws different exceptions /usr/include/stdio.h:505: than previous declaration `int putc_unlocked(int, FILE*)' /usr/include/bits/stdio.h: In function `int putchar_unlocked(int)': /usr/include/bits/stdio.h:93: declaration of `int putchar_unlocked(int) throw ()' throws different exceptions /usr/include/stdio.h:506: than previous declaration `int putchar_unlocked(int)' /usr/include/bits/stdio.h: In function `__ssize_t getline(char**, size_t*, FILE*)': /usr/include/bits/stdio.h:103: declaration of `__ssize_t getline(char**, size_t*, FILE*) throw ()' throws different exceptions /usr/include/stdio.h:573: than previous declaration `__ssize_t getline(char**, size_t*, FILE*)' % rpm -q gcc gcc-3.2.3-0vl2 % gcc -v Reading specs from /usr/lib/gcc-lib/i386-vine-linux/3.2.3/specs Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --with-system-zlib --enable-__cxa_atexit --host=i386-vine-linux Thread model: posix gcc version 3.2.3
This is not a gcc bug because it does not provide the headers for stdio.h, that means this is glibc bug, also I do not see the bug on glibc 2.2.5 or glibc 2.3.1 with gcc 3.2.3 or the mainline (20030615).
Thanks. My glibc is 2.3.2. I'll check glibc. % rpm -q glibc glibc-2.3.2-37vl2