Revision 138733 has: if (flag_dwarf2_cfi_asm && dwarf2out_do_frame ()) cpp_define (pfile, "__GCC_HAVE_DWARF2_CFI_ASM"); It doesn't work with PCH: /export/gnu/import/svn/gcc-test/src/gcc/testsuite/gcc.dg/pch/valid-1b.c:3: warning: ./valid-1b.h.gch: not used because `__GCC_HAVE_DWARF2_CFI_ASM' not defined /export/gnu/import/svn/gcc-test/src/gcc/testsuite/gcc.dg/pch/valid-1b.c:3: error: valid-1b.h: No such file or directory /export/gnu/import/svn/gcc-test/src/gcc/testsuite/gcc.dg/pch/valid-1b.c:3: error: one or more PCH files were found, but they were invalid
Created attachment 16037 [details] A testcase /export/build/gnu/gcc-work/build-x86_64-linux/gcc/xgcc -B/export/build/gnu/gcc-work/build-x86_64-linux/gcc/ -S -m32 -O0 -g -I. -save-temps -Winvalid-pch -o save-temps-1.s save-temps-1.c save-temps-1.c:2:26: warning: save-temps-1.h.gch: not used because `__GCC_HAVE_DWARF2_CFI_ASM' not defined save-temps-1.c:2:26: warning: ./save-temps-1.h.gch: not used because `__GCC_HAVE_DWARF2_CFI_ASM' not defined save-temps-1.c:2:26: error: save-temps-1.h: No such file or directory save-temps-1.c:2:26: error: one or more PCH files were found, but they were invalid save-temps-1.c:4:2: error: #error T not defined make: *** [save-temps-1.s] Error 1 [hjl@gnu-6 pch-1]$ The key here is -save-temps. Without it, it works.
The problem is -E never generates any debug info. So __GCC_HAVE_DWARF2_CFI_ASM won't be defined for -E and PCH gets a mismatch.
Subject: Bug 37033 Author: rth Date: Thu Aug 7 20:06:36 2008 New Revision: 138850 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=138850 Log: PR debug/37033 * gcc.c (cpp_options): Pass along -g*. Modified: trunk/gcc/ChangeLog trunk/gcc/gcc.c
Fixed.
It doesn't work on gcc.dg/pch/valid-1b.c since it explicitly tests -g vs -g0: [hjl@gnu-6 testsuite]$ cat gcc.dg/pch/valid-1b.c /* { dg-options "-I. -Winvalid-pch -g0" } */ #include "valid-1b.h" int x; [hjl@gnu-6 testsuite]$
>It doesn't work on gcc.dg/pch/valid-1b.c since it explicitly tests -g vs -g0: I don't think valid-1b.c is valid any more in general, You have to supply -g to get a valid PCH now that works with -g.
(In reply to comment #6) > >It doesn't work on gcc.dg/pch/valid-1b.c since it explicitly tests -g vs -g0: > > I don't think valid-1b.c is valid any more in general, You have to supply -g > to get a valid PCH now that works with -g. > Should it be removed or updated?
Geoff, is test valid-1b.c still valid, given that it uses -g0 with PCH? If not I'll remove it.
We can add -fno-dwarf2-cfi-asm to gcc.dg/pch/valid-1b.hs to suppress definition of __GCC_HAVE_DWARF2_CFI_ASM in -g case. Patch at http://gcc.gnu.org/ml/gcc-patches/2008-11/msg00807.html
Yes, the test is still valid. It is reporting a real problem. I will suggest a change to __GCC_HAVE_DWARF2_CFI_ASM that permits the testcase to continue working.
Subject: Bug 37033 Author: aoliva Date: Fri Dec 5 06:55:12 2008 New Revision: 142459 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=142459 Log: ChangeLog.vta: PR target/37033 * libcpp/pch.c (cpp_valid_state): Improve message for poisoned symbols. Allow for differences in __GCC_HAVE_DWARF2_CFI_ASM. gcc/ChangeLog.vta: PR target/37033 * dwarf2out.c (saved_do_cfi_asm): New. (dwarf2out_do_frame): Take it into account. (dwarf2out_d_cfi_asm): Likewise. Set it when appropriate. Modified: branches/var-tracking-assignments-branch/ChangeLog.vta branches/var-tracking-assignments-branch/gcc/ChangeLog.vta branches/var-tracking-assignments-branch/gcc/dwarf2out.c branches/var-tracking-assignments-branch/libcpp/pch.c
Subject: Bug 37033 Author: aoliva Date: Wed Dec 10 17:31:07 2008 New Revision: 142652 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=142652 Log: gcc/ChangeLog: PR target/37033 * dwarf2out.c (saved_do_cfi_asm): New. (dwarf2out_do_frame): Take it into account. (dwarf2out_d_cfi_asm): Likewise. Set it when appropriate. libcpp/ChangeLog: PR target/37033 * pch.c (cpp_valid_state): Improve message for poisoned symbols. Allow for differences in __GCC_HAVE_DWARF2_CFI_ASM. Modified: trunk/gcc/ChangeLog trunk/gcc/dwarf2out.c trunk/libcpp/ChangeLog trunk/libcpp/pch.c