This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH, testsuite] Fix PR37033, gcc.dg/pch/valid-1b.c failures
- From: Alexandre Oliva <aoliva at redhat dot com>
- To: Ian Lance Taylor <iant at google dot com>
- Cc: Geoffrey Keating <geoffk at geoffk dot org>, gcc-patches at gcc dot gnu dot org
- Date: Wed, 10 Dec 2008 15:30:18 -0200
- Subject: Re: [PATCH, testsuite] Fix PR37033, gcc.dg/pch/valid-1b.c failures
- References: <5787cf470811170339s295c4524md47de90456238157@mail.gmail.com> <1226955425.6289.4.camel@janis-laptop> <5787cf470811180020y340df3a0u88be3436e42c44ae@mail.gmail.com> <Pine.LNX.4.64.0811181633470.30737@digraph.polyomino.org.uk> <49230B97.3010809@gmail.com> <20081118185135.GS17496@tyan-ft48-01.lab.bos.redhat.com> <orod0334tp.fsf@livre.oliva.athome.lsd.ic.unicamp.br> <m263m77emv.fsf@localhost.localdomain> <orskp33yf8.fsf@livre.oliva.athome.lsd.ic.unicamp.br> <m38wqu1vur.fsf@google.com> <orabb47kvm.fsf@livre.oliva.athome.lsd.ic.unicamp.br> <m3prk0obwb.fsf@google.com>
On Dec 10, 2008, Ian Lance Taylor <iant@google.com> wrote:
> Alexandre Oliva <aoliva@redhat.com> writes:
>> On Dec 5, 2008, Ian Lance Taylor <iant@google.com> wrote:
>>> Please write this as two lines.
>>> saved_do_cfi_asm = true;
>>> return true;
>> Fixed, thanks.
>>> With that change this is OK when mainline returns to stage 1.
>> Err... I thought it wasn't too late to fix regressions like this. Is
>> it?
> Sorry, you're right, this is OK for mainline.
Thanks, here's the patch I'm checking in. The only difference from
the one I posted before is the style fix Jakub and you suggested.
I've just re-tested it on i686-pc-linux-gnu, confirming it makes the
valid-1b.c regression go away. Checking in... :-)
for gcc/ChangeLog
from Alexandre Oliva <aoliva@redhat.com>
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.
for libcpp/ChangeLog
from Alexandre Oliva <aoliva@redhat.com>
PR target/37033
* pch.c (cpp_valid_state): Improve message for poisoned symbols.
Allow for differences in __GCC_HAVE_DWARF2_CFI_ASM.
Index: gcc/dwarf2out.c
===================================================================
--- gcc/dwarf2out.c.orig 2008-12-05 04:57:21.000000000 -0200
+++ gcc/dwarf2out.c 2008-12-10 15:21:31.000000000 -0200
@@ -110,6 +110,9 @@ static void dwarf2out_source_line (unsig
#define DWARF2_FRAME_REG_OUT(REGNO, FOR_EH) (REGNO)
#endif
+/* Save the result of dwarf2out_do_frame across PCH. */
+static GTY(()) bool saved_do_cfi_asm = 0;
+
/* Decide whether we want to emit frame unwind information for the current
translation unit. */
@@ -121,7 +124,7 @@ dwarf2out_do_frame (void)
we're not going to output frame or unwind info. */
return (write_symbols == DWARF2_DEBUG
|| write_symbols == VMS_AND_DWARF2_DEBUG
- || DWARF2_FRAME_INFO
+ || DWARF2_FRAME_INFO || saved_do_cfi_asm
#ifdef DWARF2_UNWIND_INFO
|| (DWARF2_UNWIND_INFO
&& (flag_unwind_tables
@@ -142,7 +145,7 @@ dwarf2out_do_cfi_asm (void)
#endif
if (!flag_dwarf2_cfi_asm || !dwarf2out_do_frame ())
return false;
- if (!eh_personality_libfunc)
+ if (saved_do_cfi_asm || !eh_personality_libfunc)
return true;
if (!HAVE_GAS_CFI_PERSONALITY_DIRECTIVE)
return false;
@@ -156,6 +159,7 @@ dwarf2out_do_cfi_asm (void)
if ((enc & 0x70) != 0 && (enc & 0x70) != DW_EH_PE_pcrel)
return false;
+ saved_do_cfi_asm = true;
return true;
}
Index: libcpp/pch.c
===================================================================
--- libcpp/pch.c.orig 2008-12-05 04:57:21.000000000 -0200
+++ libcpp/pch.c 2008-12-10 15:21:31.000000000 -0200
@@ -1,5 +1,5 @@
/* Part of CPP library. (Precompiled header reading/writing.)
- Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005
+ Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2008
Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify it
@@ -477,11 +477,32 @@ cpp_valid_state (cpp_reader *r, const ch
h = cpp_lookup (r, namebuf, m.name_length);
if (m.flags & NODE_POISONED
- || h->type != NT_MACRO
|| h->flags & NODE_POISONED)
{
if (CPP_OPTION (r, warn_invalid_pch))
cpp_error (r, CPP_DL_WARNING_SYSHDR,
+ "%s: not used because `%.*s' is poisoned",
+ name, m.name_length, namebuf);
+ goto fail;
+ }
+
+ if (h->type != NT_MACRO)
+ {
+ /* It's ok if __GCC_HAVE_DWARF2_CFI_ASM becomes undefined,
+ as in, when the PCH file is created with -g and we're
+ attempting to use it without -g. Restoring the PCH file
+ is supposed to bring in this definition *and* enable the
+ generation of call frame information, so that precompiled
+ definitions that take this macro into accout, to decide
+ what asm to emit, won't issue .cfi directives when the
+ compiler doesn't. */
+ if (!(h->flags & NODE_USED)
+ && m.name_length == sizeof ("__GCC_HAVE_DWARF2_CFI_ASM") - 1
+ && !memcmp (namebuf, "__GCC_HAVE_DWARF2_CFI_ASM", m.name_length))
+ continue;
+
+ if (CPP_OPTION (r, warn_invalid_pch))
+ cpp_error (r, CPP_DL_WARNING_SYSHDR,
"%s: not used because `%.*s' not defined",
name, m.name_length, namebuf);
goto fail;
--
Alexandre Oliva http://www.lsd.ic.unicamp.br/~oliva/
You must be the change you wish to see in the world. -- Gandhi
Be Free! -- http://FSFLA.org/ FSF Latin America board member
Free Software Evangelist Red Hat Brazil Compiler Engineer