This should improve the situation a bit, avoiding ICEs and
irritating "Please submit a full bug report" messages.

It restricts the command-line options to the set of supported
languages and rejects compiling with -flto -fmudflap
(we then silently drop -fmudflap if you choose to only apply
it at link time).

I'm giving this some testing and will apply it if that succeeds.

In reality mudflap needs to stop doing the split approach and
finish itself before we write out LTO IL.

Richard.

2012-01-05  Richard Guenther  <rguent...@suse.de>

        PR middle-end/51764
        * common.opt (Wmudflap, fmudflap, fmudflapth, fmudflapir): Move
        to c.opt.
        * toplev.c (process_options): Reject combining mudflap and LTO.
        * tree-nomudflap.c (nogo): Use sorry instead of internal_error.

        c-family/
        * c.opt (Wmudflap, fmudflap, fmudflapth, fmudflapir): Move here
        from common.opt.

Index: gcc/common.opt
===================================================================
--- gcc/common.opt      (revision 182908)
+++ gcc/common.opt      (working copy)
@@ -570,10 +570,6 @@ Wmissing-noreturn
 Common Var(warn_missing_noreturn) Warning
 Warn about functions which might be candidates for __attribute__((noreturn))
 
-Wmudflap
-Common Var(warn_mudflap) Init(1) Warning
-Warn about constructs not instrumented by -fmudflap
-
 Woverflow
 Common Var(warn_overflow) Init(1) Warning
 Warn about overflow in arithmetic expressions
@@ -1465,18 +1461,6 @@ fmove-loop-invariants
 Common Report Var(flag_move_loop_invariants) Init(1) Optimization
 Move loop invariant computations out of loops
 
-fmudflap
-Common RejectNegative Report Var(flag_mudflap)
-Add mudflap bounds-checking instrumentation for single-threaded program
-
-fmudflapth
-Common RejectNegative Report Var(flag_mudflap,2)
-Add mudflap bounds-checking instrumentation for multi-threaded program
-
-fmudflapir
-Common RejectNegative Report Var(flag_mudflap_ignore_reads)
-Ignore read operations when inserting mudflap instrumentation
-
 fdce
 Common Var(flag_dce) Init(1) Optimization
 Use the RTL dead code elimination pass
Index: gcc/c-family/c.opt
===================================================================
--- gcc/c-family/c.opt  (revision 182908)
+++ gcc/c-family/c.opt  (working copy)
@@ -489,6 +489,10 @@ Wmissing-prototypes
 C ObjC Var(warn_missing_prototypes) Warning
 Warn about global functions without prototypes
 
+Wmudflap
+C ObjC C++ ObjC++ Var(warn_mudflap) Init(1) Warning
+Warn about constructs not instrumented by -fmudflap
+
 Wmultichar
 C ObjC C++ ObjC++ Warning
 Warn about use of multi-character character constants
@@ -865,6 +869,18 @@ fms-extensions
 C ObjC C++ ObjC++ Var(flag_ms_extensions)
 Don't warn about uses of Microsoft extensions
 
+fmudflap
+C ObjC C++ ObjC++ RejectNegative Report Var(flag_mudflap)
+Add mudflap bounds-checking instrumentation for single-threaded program
+
+fmudflapth
+C ObjC C++ ObjC++ RejectNegative Report Var(flag_mudflap,2)
+Add mudflap bounds-checking instrumentation for multi-threaded program
+
+fmudflapir
+C ObjC C++ ObjC++ RejectNegative Report Var(flag_mudflap_ignore_reads)
+Ignore read operations when inserting mudflap instrumentation
+
 fname-mangling-version-
 C++ ObjC++ Joined Ignore Warn(switch %qs is no longer supported)
 
Index: gcc/toplev.c
===================================================================
--- gcc/toplev.c        (revision 182908)
+++ gcc/toplev.c        (working copy)
@@ -1325,6 +1325,9 @@ process_options (void)
           "and -ftree-loop-linear)");
 #endif
 
+  if (flag_mudflap && flag_lto)
+    sorry ("mudflap cannot be used together with link-time optimization");
+
   /* One region RA really helps to decrease the code size.  */
   if (flag_ira_region == IRA_REGION_AUTODETECT)
     flag_ira_region
Index: gcc/tree-nomudflap.c
===================================================================
--- gcc/tree-nomudflap.c        (revision 182908)
+++ gcc/tree-nomudflap.c        (working copy)
@@ -44,7 +44,7 @@ along with GCC; see the file COPYING3.
 static void
 nogo (void)
 {
-  internal_error ("mudflap: this language is not supported");
+  sorry ("mudflap: this language is not supported");
 }
 
 void

Reply via email to