This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[patch] Re: GCC 2.95 Solaris7 i86pc compilation fail with -g generates internal compiler error


On Aug  2, 1999, Chris McKay <chris.mckay@solipsys.com> wrote:

> 	Test.C:38: Internal compiler error in `fundamental_type_code', at
> dwarfout.c:1416

Here's a patch.  Tested in both mainline and 2.95 branch.  Ok to
install?

Index: gcc/cp/ChangeLog
from  Alexandre Oliva  <oliva@dcc.unicamp.br>
	
	* pt.c (tsubst): Set array domain's precision to sizetype's.
	Fixes g++.oliva/dwarf1.C.
	* decl.c (grokdeclarator): Likewise, just for consistency, as it
	doesn't seem to trigger the bug without it.
	
Index: gcc/cp/decl.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/decl.c,v
retrieving revision 1.389
diff -u -r1.389 decl.c
--- gcc/cp/decl.c	1999/08/03 07:03:03	1.389
+++ gcc/cp/decl.c	1999/08/03 10:15:16
@@ -10053,6 +10053,9 @@
 		    TYPE_MIN_VALUE (itype) = size_zero_node;
 		    TYPE_MAX_VALUE (itype) = build_min
 		      (MINUS_EXPR, sizetype, size, integer_one_node);
+		    /* If the precision is not set,
+                       dwarfout.c:fundamental_type_code will abort. */
+		    TYPE_PRECISION (itype) = TYPE_PRECISION (sizetype);
 		    goto dont_grok_size;
 		  }
 
Index: gcc/cp/pt.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/pt.c,v
retrieving revision 1.318
diff -u -r1.318 pt.c
--- gcc/cp/pt.c	1999/08/03 01:37:47	1.318
+++ gcc/cp/pt.c	1999/08/03 10:15:19
@@ -6196,6 +6196,9 @@
 	    TYPE_MIN_VALUE (itype) = size_zero_node;
 	    TYPE_MAX_VALUE (itype) = build_min (MINUS_EXPR, sizetype, max,
 						integer_one_node);
+	    /* If the precision is not set,
+	       dwarfout.c:fundamental_type_code will abort. */
+	    TYPE_PRECISION (itype) = TYPE_PRECISION (sizetype);
 	    return itype;
 	  }
 
Index: gcc/testsuite/g++.old-deja/g++.oliva/ChangeLog
from  Alexandre Oliva  <oliva@dcc.unicamp.br>
	
	* dwarf1.C, dwarf2.C: New tests.
	
Index: gcc/testsuite/g++.old-deja/g++.oliva/dwarf1.C
===================================================================
RCS file: dwarf1.C
diff -N dwarf1.C
--- gcc/testsuite/g++.old-deja/g++.oliva/dwarf1.C	Sat Dec  5 20:30:03 1998
+++ gcc/testsuite/g++.old-deja/g++.oliva/dwarf1.C	Tue Aug  3 03:15:43 1999
@@ -0,0 +1,17 @@
+// Build don't link:
+
+// Copyright (C) 1999 Free Software Foundation
+
+// by Alexandre Oliva <oliva@dcc.unicamp.br>
+// based on bug report by Chris McKay <chris.mckay@solipsys.com>
+
+// This used to crash with -gdwarf
+
+// crash test
+
+template <class T = void>
+struct foo {
+  static const int ELEMENTS = 1;
+  int bar[ELEMENTS];
+};
+foo<> bar;

-- 
Alexandre Oliva http://www.dcc.unicamp.br/~oliva IC-Unicamp, Bra[sz]il
oliva@{dcc.unicamp.br,guarana.{org,com}} aoliva@{acm.org,computer.org}
oliva@{gnu.org,kaffe.org,{egcs,sourceware}.cygnus.com,samba.org}
** I may forward mail about projects to mailing lists; please use them

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]