public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "mvanier at cs dot caltech dot edu" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c/37995] New: using <stdio.h> fails if gcc invoked in a directory which has a subdirectory called "gcc" Date: Sun, 02 Nov 2008 08:49:00 -0000 [thread overview] Message-ID: <bug-37995-6219@http.gcc.gnu.org/bugzilla/> (raw) [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1: Type: text/plain, Size: 4966 bytes --] I tried to compile the following trivial program, called 'hello.c': #include <stdio.h> int main(void) { printf("hello, world!\n"); return 0; } using gcc, in a directory which had a subdirectory called "gcc". This caused the compile to fail with the following output: > gcc hello.c In file included from hello.c:1: /usr/include/stdio.h:34:21: error: stddef.h: No such file or directory In file included from /usr/include/stdio.h:75, from hello.c:1: /usr/include/libio.h:53:21: error: stdarg.h: No such file or directory In file included from /usr/include/stdio.h:75, from hello.c:1: /usr/include/libio.h:332: error: expected specifier-qualifier-list before size_t /usr/include/libio.h:364: error: expected declaration specifiers or ... before size_t /usr/include/libio.h:373: error: expected declaration specifiers or ... before size_t /usr/include/libio.h:489: error: expected declaration specifiers or ... before __gnuc_va_list /usr/include/libio.h:491: error: expected declaration specifiers or ... before __gnuc_va_list /usr/include/libio.h:493: error: expected =, ,, ;, asm or __attribute__ before _IO_sgetn In file included from hello.c:1: /usr/include/stdio.h:312: error: expected declaration specifiers or ... before size_t /usr/include/stdio.h:319: error: expected declaration specifiers or ... before size_t /usr/include/stdio.h:347: error: expected declaration specifiers or ... before __gnuc_va_list /usr/include/stdio.h:352: error: expected declaration specifiers or ... before __gnuc_va_list /usr/include/stdio.h:355: error: expected declaration specifiers or ... before __gnuc_va_list /usr/include/stdio.h:361: error: expected declaration specifiers or ... before size_t /usr/include/stdio.h:363: error: format string argument not a string type /usr/include/stdio.h:365: error: expected declaration specifiers or ... before size_t /usr/include/stdio.h:366: error: expected declaration specifiers or ... before __gnuc_va_list /usr/include/stdio.h:367: error: format string argument not a string type /usr/include/stdio.h:678: error: expected =, ,, ;, asm or __attribute__ before fread /usr/include/stdio.h:684: error: expected =, ,, ;, asm or __attribute__ before fwrite /usr/include/stdio.h:706: error: expected =, ,, ;, asm or __attribute__ before fread_unlocked /usr/include/stdio.h:708: error: expected =, ,, ;, asm or __attribute__ before fwrite_unlocked The compile works fine if there is no subdirectory called "gcc". Although this seems trivial, some programs' source code do indeed have subdirectories called "gcc" and this causes them to fail to compile. I don't know if this is intended behavior or not, but I can't find any information about it in the gcc documentation. This compile was on an up-to-date Arch Linux system with gcc 4.2.3 which I compiled myself from source. I have tried it on a Mac Pro using gcc 4.0.1 and the problem does not manifest in that version. gcc 4.2.3 was built with standard compilation options; the only non-standard configure option was --enable-languages=c,c++,objc and there were no options used for make or make install. If the -save-temps option is passed to gcc: > gcc -save-temps hello.c the result is: > gcc -save-temps hello.c In file included from hello.c:1: /usr/include/stdio.h:34:21: error: stddef.h: No such file or directory In file included from /usr/include/stdio.h:75, from hello.c:1: /usr/include/libio.h:53:21: error: stdarg.h: No such file or directory and when gcc is run on hello.i, the errors output are the same as those above. Interestingly, when I manually invoke cpp to generate hello.i: > cpp hello.c > hello.i > gcc hello.i there are no errors and the a.out file generated works as intended. This is with cpp version 4.2.3, created in the same compile as that which created gcc. However, substituting gcc -E for cpp doesn't work: > gcc -E hello.c > hello.i In file included from hello.c:1: /usr/include/stdio.h:34:21: error: stddef.h: No such file or directory In file included from /usr/include/stdio.h:75, from hello.c:1: /usr/include/libio.h:53:21: error: stdarg.h: No such file or directory -- Summary: using <stdio.h> fails if gcc invoked in a directory which has a subdirectory called "gcc" Product: gcc Version: 4.3.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: mvanier at cs dot caltech dot edu GCC build triplet: i686-pc-linux-gnu GCC host triplet: i686-pc-linux-gnu GCC target triplet: i686-pc-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37995
next reply other threads:[~2008-11-02 8:49 UTC|newest] Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top 2008-11-02 8:49 mvanier at cs dot caltech dot edu [this message] 2008-11-02 11:04 ` [Bug c/37995] " rguenth at gcc dot gnu dot org 2008-11-03 7:39 ` mvanier at cs dot caltech dot edu 2008-11-03 7:39 ` mvanier at cs dot caltech dot edu 2008-11-03 23:24 ` brian at dessent dot net 2008-11-04 11:08 ` mvanier at cs dot caltech dot edu 2008-11-04 11:09 ` mvanier at cs dot caltech dot edu 2008-11-15 0:41 ` pinskia at gcc dot gnu dot org 2008-11-15 0:51 ` mvanier at cs dot caltech dot edu 2008-11-15 0:55 ` pinskia at gcc dot gnu dot org 2008-11-15 1:03 ` mvanier at cs dot caltech dot edu 2008-11-15 1:40 ` Andrew Thomas Pinski 2008-11-15 1:42 ` pinskia at gmail dot com 2008-12-21 13:05 ` dfeldstern at fastimap dot com 2009-01-26 19:24 ` pinskia at gcc dot gnu dot org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-37995-6219@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).