From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16945 invoked by alias); 21 Oct 2010 04:39:42 -0000 Received: (qmail 16748 invoked by uid 22791); 21 Oct 2010 04:39:39 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00,TW_BJ,TW_CX,TW_DC,TW_GX X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 21 Oct 2010 04:38:53 +0000 From: "aleksey.covacevice at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug pch/46110] New: Precompiled headers: GCC fails to properly locate include files X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: pch X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: aleksey.covacevice at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Date: Thu, 21 Oct 2010 04:39:00 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2010-10/txt/msg01743.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46110 Summary: Precompiled headers: GCC fails to properly locate include files Product: gcc Version: 4.4.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: pch AssignedTo: unassigned@gcc.gnu.org ReportedBy: aleksey.covacevice@gmail.com Created attachment 22102 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=22102 Test case script GCC fails to properly locate include files when using precompiled headers that are located in a deeper directory in the search path. This problem happens when a file "z.h" includes two other files, "x.h" and "y.h", such that "y.h" also includes "x.h", and they are all located in another directory in the include path (yielding include lines such as '#include "dir/x.h"'). The issue is much better explained through a test case. The following command sequence is a simple test case that yields the symptom: == #!/bin/sh mkdir -p include/dir pch/dir touch include/dir/x.h echo "#include \"dir/x.h\"" > include/dir/y.h echo "#include \"dir/x.h\"" > include/dir/z.h echo "#include \"dir/y.h\"" >> include/dir/z.h gcc -I pch -I include include/dir/x.h -o pch/dir/x.h.gch gcc -I pch -I include include/dir/y.h -o pch/dir/y.h.gch gcc -I pch -I include include/dir/z.h -o pch/dir/z.h.gch == The output is the following: == In file included from include/dir/z.h:2: include/dir/y.h:1:19: error: pch/dir/x.h: No such file or directory == If the include path "-I pch" is ommited from the above commands (i.e., removing the precompiled headers from the search path), everything runs fine. Also, if the subdirectory "dir/" is properly removed from every place above, everything runs fine. Now, if the include path "-I include" is ommited, the output is: == include/dir/z.h:2:19: error: dir/y.h: No such file or directory == although the precompiled header "pch/dir/y.h.gch" already exists (there should be no reason to avoid using it, "-Winvalid-pch" does not report anything and the compilation for "y.h", which is pretty similar, proceeds fine). The snippet above should also help generate proper ".i" files for further investigation. Running GCC on a Ubuntu 9.10 x86 host. Output of gcc -v: Using built-in specs. Target: i486-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.4.1-4ubuntu9' --with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared --enable-multiarch --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.4 --program-suffix=-4.4 --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc --enable-targets=all --disable-werror --with-arch-32=i486 --with-tune=generic --enable-checking=release --build=i486-linux-gnu --host=i486-linux-gnu --target=i486-linux-gnu Thread model: posix gcc version 4.4.1 (Ubuntu 4.4.1-4ubuntu9) Cheers, Alek