[patch] PR 26789, PR 26790: ICE with -fmudflap

Volker Reichelt reichelt@igpm.rwth-aachen.de
Wed Apr 19 21:16:00 GMT 2006


PR 26789 and PR 26790 are two ice-on-invalid-code bugs that are
triggered with -fmudflap.

I posted patches for each problem in March:
http://gcc.gnu.org/ml/gcc-patches/2006-03/msg01355.html
http://gcc.gnu.org/ml/gcc-patches/2006-03/msg01356.html

Alas, I confused both patches and attached the wrong ones to the mails.
The patch to mudflap_finish_file actually fixes PR 26789 and
the patch to mf_xform_derefs_1 fixes PR 26790.

The patches were approved anyways :-) and committed to mainline.
(I'll fix the ChangeLog entry soon.)
Sorry for the confusion!

I'm bringing this up again because PR 26789 is a regression that is
also present on the 4.1 branch and should be fixed there.

So here's the corrected description:

Compiling the following testcase with "g++ -fmudflap" yields
an ICE since GCC 4.1.0 (i.e. this is a regression):

  struct A;
  A a;

bug.cc:2: error: aggregate 'A a' has incomplete type and cannot be defined
bug.cc:2: internal compiler error: tree check: expected class 'type', have 'exceptional' (error_mark) in mudflap_finish_file, at tree-mudflap.c:1265
Please submit a full bug report, [etc.]

The attached patch fixes that by skipping objects whose TREE_TYPE is
error_mark_node in mudflap_finish_file from tree-mudflap.c.

Bootstrapped and regtested on x86_64-unknown-linux-gnu.
Ok for the 4.1 branch?


In addition the testcases are still missing because I wasn't sure how
to write and where to put testcases that use "-fmudflap".
But now I came up with the attached testcases.

Bootstrapped and regtested on x86_64-unknown-linux-gnu.
Are they OK for mainline?
Is the first one also Ok for the 4.1 branch?

Regards,
Volker


2006-04-19  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>

	PR mudflap/26789
	* tree-mudflap.c (mudflap_finish_file): Skip erroneous objects.

===================================================================
--- gcc/gcc/tree-mudflap.c	(revision 112238)
+++ gcc/gcc/tree-mudflap.c	(working copy)
@@ -1252,6 +1256,9 @@ mudflap_finish_file (void)
         {
           gcc_assert (DECL_P (obj));
 
+          if (TREE_TYPE (obj) == error_mark_node)
+	    continue;
+
           if (mf_marked_p (obj))
             continue;
 
===================================================================


2006-04-19  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>

	PR mudflap/26789
	* testsuite/libmudflap.c++/error1-frag.cxx: New test.

======================================================================
--- gcc/libmudflap/testsuite/libmudflap.c++/error1-frag.cxx	2003-09-23 19:59:22 +0200
+++ gcc/libmudflap/testsuite/libmudflap.c++/error1-frag.cxx	2006-03-22 17:23:50 +0100
@@ -0,0 +1,5 @@
+// PR 26789
+// { dg-do compile }
+
+struct A;
+A a; // { dg-error "incomplete" }
======================================================================


2006-04-19  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>

	PR mudflap/26790
	* testsuite/libmudflap.c++/error2-frag.cxx: New test.

======================================================================
--- gcc/libmudflap/testsuite/libmudflap.c++/error2-frag.cxx	2003-09-23 19:59:22 +0200
+++ gcc/libmudflap/testsuite/libmudflap.c++/error2-frag.cxx	2006-03-22 17:23:50 +0100
@@ -0,0 +1,10 @@
+// PR 26790
+// { dg-do compile }
+
+struct A;
+
+A foo()  // { dg-error "incomplete" }
+{
+    A a; // { dg-error "incomplete" }
+    return a;
+}
======================================================================




More information about the Gcc-patches mailing list