Bug 123547 - C++ crash with segmentation violation
Summary: C++ crash with segmentation violation
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Enterprise Linux 3
Classification: Red Hat
Component: gcc
Version: 3.0
Hardware: i386
OS: Linux
low
medium
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2004-05-19 09:47 UTC by Göran Uddeborg
Modified: 2007-11-30 22:07 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2005-01-04 13:20:54 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
Test case triggering the crash. (265 bytes, text/plain)
2004-05-19 09:50 UTC, Göran Uddeborg
no flags Details

Description Göran Uddeborg 2004-05-19 09:47:52 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.4.2)
Gecko/20040301

Description of problem:
When compiling the test case, the compiler crashes with an internal
error/segmentation fault.

Version-Release number of selected component (if applicable):
gcc-c++-3.2.3-34

How reproducible:
Always

Steps to Reproduce:
1. c++ -c an.cc

Additional info:

Comment 1 Göran Uddeborg 2004-05-19 09:50:58 UTC
Created attachment 100323 [details]
Test case triggering the crash.

Comment 2 Jakub Jelinek 2004-05-25 09:22:11 UTC
This is crash on invalid input, so lowering priority.

Comment 3 Göran Uddeborg 2004-05-25 10:00:46 UTC
> This is crash on invalid input

True.  In the original case it was quite hard to see what was invalid
though! :-)

Comment 4 Jakub Jelinek 2005-01-04 13:20:54 UTC
Self-contained testcase:
struct A { void foo (); };
struct B {
  enum E { EE };
  struct C { A c; void foo () { c.foo(); }; };
  E bar ();
}

B::E B::bar () {}

This is really fixed for good just with the new parser in GCC 3.4+.  Particular problem is lastiddecl handling and that in case of syntax errors it gets out
of sync from the actual identifier node.
A quick hack like:
--- gcc/cp/semantics.c     2005-01-04 10:25:30.000000000 +0100
+++ gcc/cp/semantics.c 2005-01-04 14:06:56.385999603 +0100
@@ -1965,6 +1965,8 @@ enter_scope_of (sr)
 {
   tree scope = TREE_OPERAND (sr, 0);

+  if (scope == NULL || scope == error_mark_node)
+    return;
   if (TREE_CODE (scope) == NAMESPACE_DECL)
     {
       push_decl_namespace (scope);

gets rid of the ICE, but is IMHO not suitable for RHEL3.


Note You need to log in before you can comment on or make changes to this bug.