Bug 16301

Summary: [3.4 regression] ICE with strong using
Product: gcc Reporter: Wolfgang Bangerth <bangerth>
Component: c++Assignee: Andrew Pinski <pinskia>
Status: RESOLVED FIXED    
Severity: minor CC: gcc-bugs, reichelt
Priority: P2 Keywords: error-recovery, ice-checking, ice-on-invalid-code, monitored, patch
Version: 4.0.0   
Target Milestone: 3.4.3   
Host: Target:
Build: Known to work: 3.3.4 4.0.0
Known to fail: 3.4.0 Last reconfirmed: 2004-06-30 20:00:24

Description Wolfgang Bangerth 2004-06-30 17:42:05 UTC
Not important, but maybe worth fixing sometime anyway: 
------------------ 
namespace NS2 
{ 
  using namespace NS1 __attribute__ ((strong)); 
} 
------------------ 
 
g/x> /home/bangerth/bin/gcc-3.4-pre/bin/c++ -c y.cc 
y.cc:3: error: expected namespace-name before "__attribute__" 
y.cc:3: error: `<type error>' is not a namespace 
y.cc:3: internal compiler error: tree check: expected namespace_decl, have 
error_mark in parse_using_directive, at cp/name-lookup.c:3409 
Please submit a full bug report, 
with preprocessed source if appropriate. 
See <URL:http://gcc.gnu.org/bugs.html> for instructions. 
 
W.
Comment 1 Andrew Pinski 2004-07-01 01:20:34 UTC
hmm, I do not know if I could call this a regression but ..

Confirmed.
And this patch fixes at this the first ICE (I do not know if another comes up):
Index: name-lookup.c
===============================================================
====
RCS file: /cvs/gcc/gcc/gcc/cp/name-lookup.c,v
retrieving revision 1.62
diff -u -d -b -w -u -p -r1.62 name-lookup.c
--- name-lookup.c       26 Jun 2004 21:11:19 -0000      1.62
+++ name-lookup.c       1 Jul 2004 01:19:39 -0000
@@ -3432,7 +3432,7 @@ parse_using_directive (tree namespace, t
        {
          if (!toplevel_bindings_p ())
            error ("strong using only meaningful at namespace scope");
-         else
+         else if (namespace != error_mark_node)
            DECL_NAMESPACE_ASSOCIATIONS (namespace)
              = tree_cons (current_namespace, 0,
                           DECL_NAMESPACE_ASSOCIATIONS (namespace));
Comment 2 Mark Mitchell 2004-08-02 18:53:52 UTC
Assigned to Jason, as the inventor of "strong using".
Comment 3 Mark Mitchell 2004-08-29 18:06:22 UTC
Postponed all ice-on-invalid bugs to GCC 3.4.3.
Comment 4 Andrew Pinski 2004-10-14 23:58:03 UTC
Okay, my fix is only thing which is needed I will submit it then.
Comment 5 Andrew Pinski 2004-10-15 00:25:08 UTC
I posted the patch here: <http://gcc.gnu.org/ml/gcc-patches/2004-10/msg01236.html>.
Comment 6 GCC Commits 2004-10-15 14:30:42 UTC
Subject: Bug 16301

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	pinskia@gcc.gnu.org	2004-10-15 14:30:31

Modified files:
	gcc/cp         : name-lookup.c ChangeLog 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/g++.dg/lookup: strong-using-4.C 

Log message:
	2004-10-13  Andrew Pinski  <pinskia@physics.uc.edu>
	
	PR c++/16301
	* name-lookup.c (parse_using_directive): If we have a
	error_mark_node, do not set the decl namespace associations
	on it.
	
	2004-10-14  Andrew Pinski  <pinskia@physics.uc.edu>
	
	PR c++/16301
	* g++.dg/lookup/strong-using-4.C: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/name-lookup.c.diff?cvsroot=gcc&r1=1.86&r2=1.87
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.4434&r2=1.4435
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/lookup/strong-using-4.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.4455&r2=1.4456

Comment 7 Andrew Pinski 2004-10-15 14:32:13 UTC
I will apply the patch to 3.4 branch after some more testing.
Fixed on the mainline.
Comment 8 Andrew Pinski 2004-10-17 17:40:46 UTC
Fixed.
Comment 9 GCC Commits 2004-10-17 17:41:05 UTC
Subject: Bug 16301

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_4-branch
Changes by:	pinskia@gcc.gnu.org	2004-10-17 17:41:01

Modified files:
	gcc/testsuite  : ChangeLog 
	gcc/cp         : ChangeLog name-lookup.c 
Added files:
	gcc/testsuite/g++.dg/lookup: strong-using-4.C 

Log message:
	2004-10-17  Andrew Pinski  <pinskia@physics.uc.edu>
	
	PR c++/16301
	* namelookup.c (parse_using_directive): If we have a
	error_mark_node, do not set the decl namespace associations
	on it.
	
	2004-10-17  Andrew Pinski  <pinskia@physics.uc.edu>
	
	PR c++/16301
	* g++.dg/lookup/strong-using-4.C: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.3389.2.291&r2=1.3389.2.292
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.3892.2.170&r2=1.3892.2.171
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/name-lookup.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.34.2.17&r2=1.34.2.18
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/lookup/strong-using-4.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=NONE&r2=1.1.2.1