First Last Prev Next    No search results available      Search page      Enter new bug
Bug#: 31899
Product:  
Component:  
Status: RESOLVED
Resolution: FIXED
Assigned To: Richard Guenther <rguenth@gcc.gnu.org>
Host:
Reported against  
Priority:  
Severity:  
Target Milestone:  
 
 
Target:
Reporter: zak.kipling@cantab.net
Add CC:
CC:
Remove selected CCs
Build:
URL:
Summary:
Keywords:
Known to work:
Known to fail:

Attachment Description Type Created Size Actions
diffs-31899.txt Proposed fix for SEGV problem in dwarf2out.c in bug 31899 patch 2007-07-27 20:54 917 bytes Edit | Diff
fix-pr31899 patch patch 2007-10-02 17:05 677 bytes Edit | Diff
Create a New Attachment (proposed patch, testcase, etc.) View All

Bug 31899 depends on: Show dependency tree
Show dependency graph
Bug 31899 blocks: 30700

Additional Comments:






View Bug Activity   |   Format For Printing   |   Clone This Bug


Description:   Last confirmed: 2007-10-02 17:12 Opened: 2007-05-11 14:09
The following code, compiled with -g, causes an ICE on 4.2.0 RC3 (20070501) and
on my most recent 4.3.0 snapshot build (20070427):

---------------------
namespace NS {
  int x = 0;
  int &ref = x;
}

using NS::ref;
---------------------

test/ice.cc:6: internal compiler error: in reference_to_unused, at
dwarf2out.c:10128


This compiles cleanly with both 4.1.2 and 4.2.0 RC1 (20070316), suggesting that
this was exposed by a fairly recent patch.


Note that, in particular, this impacts code using Boost.Lambda in the following
style:

#include <boost/lambda/lambda.hpp>
using boost::lambda::_1;
...

------- Comment #1 From David Fang 2007-05-11 18:53 -------
On your test case, 
$ g++-4 -g -c pr31899.cc -o pr31899.o
also works for me with 4.2.0 20070430 (prerelease), which was 4.2's RC2.

Configured with: ../gcc-4.2.0-20070430/configure --prefix=/sw
--prefix=/sw/lib/gcc4.2 --mandir=/sw/share/man --infodir=/sw/share/info
--enable-languages=c,c++,fortran,objc,java --host=powerpc-apple-darwin8
--with-gmp=/sw --with-libiconv-prefix=/sw --with-system-zlib
--x-includes=/usr/X11R6/include --x-libraries=/usr/X11R6/lib

------- Comment #2 From David Fang 2007-05-11 18:58 -------
Ooops, strike that last comment, forgot -gdwarf-2:

g++-4 -gdwarf-2 -c pr31899.cc -o pr31899.o
ICEs with:
internal compiler error: in reference_to_unused, at dwarf2out.c:10010

(same compiler version, 4.2 RC2)

------- Comment #3 From Andrew Pinski 2007-05-12 14:50 -------
Confirmed, this was caused by the patch for PR 30700.

------- Comment #4 From Mark Mitchell 2007-05-14 22:26 -------
Will not be fixed in 4.2.0; retargeting at 4.2.1.

------- Comment #5 From Doug Kwan 2007-07-27 20:54 -------
Created an attachment (id=13989) [edit]
Proposed fix for SEGV problem in dwarf2out.c in bug 31899

------- Comment #6 From Andrew Pinski 2007-08-08 18:58 -------
*** Bug 33026 has been marked as a duplicate of this bug. ***

------- Comment #7 From Andrew Pinski 2007-10-02 16:21 -------
*** Bug 33625 has been marked as a duplicate of this bug. ***

------- Comment #8 From Andrew Pinski 2007-10-02 16:21 -------
*** Bug 33580 has been marked as a duplicate of this bug. ***

------- Comment #9 From Richard Guenther 2007-10-02 16:55 -------
  else if (!cgraph_global_info_ready
           && (TREE_CODE (*tp) == VAR_DECL || TREE_CODE (*tp) ==
FUNCTION_DECL))
    gcc_unreachable ();

the problem is that the C++ FE emits debug info for global using decls from
parsing:

...
#9  0x082a825e in cp_emit_debug_info_for_using (t=0xb7d6705c, context=0x0)
    at /home/richard/src/trunk/gcc/cp/name-lookup.c:5223
---Type <return> to continue, or q <return> to quit---
#10 0x0829f5ef in do_toplevel_using_decl (decl=0xb7d61870, scope=0xb7d61798, 
    name=0xb7d66708) at /home/richard/src/trunk/gcc/cp/name-lookup.c:3360
#11 0x081bca90 in cp_parser_using_declaration (parser=0xb7cd22a4, 
    access_declaration_p=0 '\0')
    at /home/richard/src/trunk/gcc/cp/parser.c:11695
...

via the imported_module_or_decl debug hook.  I guess we should simply queue
these with the varpool.  Or probably invent a new pool for just this use.
Or just weaken the sanity check.

------- Comment #10 From Richard Guenther 2007-10-02 17:05 -------
Created an attachment (id=14286) [edit]
patch

Different patch.

------- Comment #11 From Richard Guenther 2007-10-03 10:02 -------
Subject: Bug 31899

Author: rguenth
Date: Wed Oct  3 10:01:43 2007
New Revision: 128978

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=128978
Log:
2007-10-03  Doug Kwan  <dougkwan@google.com>
        Richard Guenther  <rguenther@suse.de>

        PR debug/31899
        * dwarf2out.c (reference_to_unused): Disable sanity checking,
        be conservative instead.

        * g++.dg/debug/using3.C: New testcase.

Added:
    trunk/gcc/testsuite/g++.dg/debug/using3.C
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/dwarf2out.c
    trunk/gcc/testsuite/ChangeLog

------- Comment #12 From Richard Guenther 2007-10-03 10:04 -------
Fixed on the trunk, queued for 4.2.3.

------- Comment #13 From Richard Guenther 2007-10-05 12:14 -------
*** Bug 33668 has been marked as a duplicate of this bug. ***

------- Comment #14 From Richard Guenther 2007-10-10 09:29 -------
Subject: Bug 31899

Author: rguenth
Date: Wed Oct 10 09:29:13 2007
New Revision: 129199

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=129199
Log:
2007-10-10  Richard Guenther  <rguenther@suse.de>

        Backport from mainline
        2007-10-03  Doug Kwan  <dougkwan@google.com>
                Richard Guenther  <rguenther@suse.de>

        PR debug/31899
        * dwarf2out.c (reference_to_unused): Disable sanity checking,
        be conservative instead.

        * g++.dg/debug/using3.C: New testcase.

Added:
    branches/gcc-4_2-branch/gcc/testsuite/g++.dg/debug/using3.C
      - copied unchanged from r128978,
trunk/gcc/testsuite/g++.dg/debug/using3.C
Modified:
    branches/gcc-4_2-branch/gcc/ChangeLog
    branches/gcc-4_2-branch/gcc/dwarf2out.c
    branches/gcc-4_2-branch/gcc/testsuite/ChangeLog

------- Comment #15 From Richard Guenther 2007-10-10 09:29 -------
Fixed.

------- Comment #16 From Richard Guenther 2008-02-27 13:23 -------
*** Bug 35391 has been marked as a duplicate of this bug. ***

First Last Prev Next    No search results available      Search page      Enter new bug