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]
Other format: [Raw text]

[patch] Fix PR26789: ICE on incomplete struct with -fmudflap


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 following patch fixes that by returning early on error_mark_node
in mf_xform_derefs_1 from tree-mudflap.c.

I don't know where to put a testcase, though:
The testsuite for libmudflap only contains run-tests, so this
doesn't seem to be the right place.
OTOH there's not a single test with "-fmudflap" in g++.dg.
Would it be OK to place a testcase there? Is "-fmudflap"
available on every target or would that need additional tweaks?

Bootstrapped and regtested on x86_64-unknown-linux-gnu.
Ok for mainline and 4.1 branch (apart from the testcase question)?


Regards,
Volker

:ADDPATCH mudflap:


2006-03-21  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>

	PR c++/26789
	* tree-mudflap.c (mf_xform_derefs_1): Return early on error_mark_node.

===================================================================
--- gcc/gcc/tree-mudflap.c	(revision 112238)
+++ gcc/gcc/tree-mudflap.c	(working copy)
@@ -728,6 +728,10 @@ mf_xform_derefs_1 (block_stmt_iterator *iter,
 
   t = *tp;
   type = TREE_TYPE (t);
+
+  if (type == error_mark_node)
+    return;
+
   size = TYPE_SIZE_UNIT (type);
 
   switch (TREE_CODE (t))
===================================================================



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