Bug 37033 - [4.4 Regression] Revision 138733 breaks -g vs -g0 for PCH
Summary: [4.4 Regression] Revision 138733 breaks -g vs -g0 for PCH
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 4.4.0
: P2 normal
Target Milestone: 4.4.0
Assignee: Not yet assigned to anyone
URL: http://gcc.gnu.org/ml/gcc-patches/200...
Keywords: patch
Depends on:
Blocks:
 
Reported: 2008-08-05 22:41 UTC by H.J. Lu
Modified: 2008-12-10 17:31 UTC (History)
5 users (show)

See Also:
Host:
Target: dwarf2 targets
Build:
Known to work:
Known to fail:
Last reconfirmed: 2008-11-17 12:27:05


Attachments
A testcase (574 bytes, application/octet-stream)
2008-08-07 18:58 UTC, H.J. Lu
Details

Note You need to log in before you can comment on or make changes to this bug.
Description H.J. Lu 2008-08-05 22:41:21 UTC
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
Comment 1 H.J. Lu 2008-08-07 18:58:57 UTC
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.
Comment 2 H.J. Lu 2008-08-07 19:09:59 UTC
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.
Comment 3 Richard Henderson 2008-08-07 20:07:59 UTC
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

Comment 4 Richard Henderson 2008-08-07 20:11:01 UTC
Fixed.
Comment 5 H.J. Lu 2008-08-09 15:15:26 UTC
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]$
Comment 6 Andrew Pinski 2008-08-10 07:28:23 UTC
>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.
Comment 7 H.J. Lu 2008-08-10 16:56:47 UTC
(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?
Comment 8 Janis Johnson 2008-09-09 21:25:33 UTC
Geoff, is test valid-1b.c still valid, given that it uses -g0 with PCH?  If not I'll remove it.
Comment 9 Uroš Bizjak 2008-11-17 12:27:05 UTC
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
Comment 10 Geoff Keating 2008-11-28 07:34:54 UTC
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.
Comment 11 Alexandre Oliva 2008-12-05 06:56:35 UTC
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

Comment 12 Alexandre Oliva 2008-12-10 17:31:43 UTC
Fixed.
Comment 13 Alexandre Oliva 2008-12-10 17:32:43 UTC
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