diff mbox

Go patch committed: Turn off -fisolate-erroneous-paths for Go

Message ID mcr38n9h89y.fsf@iant-glaptop.roam.corp.google.com
State New
Headers show

Commit Message

Ian Lance Taylor Nov. 6, 2013, 3:14 p.m. UTC
As discussed at the thread at
http://gcc.gnu.org/ml/gcc-patches/2013-11/msg00505.html , the new
-fisolate-erroneous-paths option does not work for Go.  The option
can change nil pointer deferences into a trap, but for Go we want those
to consistently be a panic.  This patch disables the option for Go.

If the option changes in a way that lets Go work, such as by disabling
the option when using -fnon-call-exceptions, then this patch can be
reverted.

Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu.
Committed to mainline.

Ian


2013-11-06  Ian Lance Taylor  <iant@google.com>

	* go-lang.c (go_langhook_post_options): If
	-fisolate-erroneous-paths was turned on by an optimization option,
	turn it off.
diff mbox

Patch

Index: go-lang.c
===================================================================
--- go-lang.c	(revision 204430)
+++ go-lang.c	(working copy)
@@ -268,6 +268,12 @@  go_langhook_post_options (const char **p
   if (flag_excess_precision_cmdline == EXCESS_PRECISION_DEFAULT)
     flag_excess_precision_cmdline = EXCESS_PRECISION_STANDARD;
 
+  /* The isolate_erroneous_paths optimization can change a nil
+     dereference from a panic to a trap, so we have to disable it for
+     Go, even though it is normally enabled by -O2.  */
+  if (!global_options_set.x_flag_isolate_erroneous_paths)
+    global_options.x_flag_isolate_erroneous_paths = 0;
+
   /* Returning false means that the backend should be used.  */
   return false;
 }