]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR lto/60319 (wrong code (that hangs) by LTO at -Os and above on x86_64-linux...
authorRichard Biener <rguenther@suse.de>
Tue, 25 Feb 2014 08:57:42 +0000 (08:57 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Tue, 25 Feb 2014 08:57:42 +0000 (08:57 +0000)
2014-02-25  Richard Biener  <rguenther@suse.de>

PR lto/60319
* lto-opts.c (lto_write_options): Output non-explicit conservative
-fwrapv, -fno-trapv and -fno-strict-overflow.
* lto-wrapper.c (merge_and_complain): Handle merging those options.
(run_gcc): And pass them through.

From-SVN: r208112

gcc/ChangeLog
gcc/lto-opts.c
gcc/lto-wrapper.c

index 385179b9c76aa3474038346c375c1e4503b2a2d0..a7efc6528a6e1e2e62460f29365ec3f14938904e 100644 (file)
@@ -1,3 +1,11 @@
+2014-02-25  Richard Biener  <rguenther@suse.de>
+
+       PR lto/60319
+       * lto-opts.c (lto_write_options): Output non-explicit conservative
+       -fwrapv, -fno-trapv and -fno-strict-overflow.
+       * lto-wrapper.c (merge_and_complain): Handle merging those options.
+       (run_gcc): And pass them through.
+
 2014-02-25  Andrey Belevantsev  <abel@ispras.ru>
        
        * sel-sched.c (calculate_new_fences): New parameter ptime.
index 3f6757287d41997f6af21d07f29ed50223d6a116..06796d62a3eef47860a02d753bbd98ca23001816 100644 (file)
@@ -117,6 +117,18 @@ lto_write_options (void)
       default:
        gcc_unreachable ();
       }
+  /* We need to merge -f[no-]strict-overflow, -f[no-]wrapv and -f[no-]trapv
+     conservatively, so stream out their defaults.  */
+  if (!global_options_set.x_flag_wrapv
+      && global_options.x_flag_wrapv)
+    append_to_collect_gcc_options (&temporary_obstack, &first_p, "-fwrapv");
+  if (!global_options_set.x_flag_trapv
+      && !global_options.x_flag_trapv)
+    append_to_collect_gcc_options (&temporary_obstack, &first_p, "-fno-trapv");
+  if (!global_options_set.x_flag_strict_overflow
+      && !global_options.x_flag_strict_overflow)
+    append_to_collect_gcc_options (&temporary_obstack, &first_p,
+                              "-fno-strict-overflow");
 
   /* Output explicitly passed options.  */
   for (i = 1; i < save_decoded_options_count; ++i)
index 5798a81f95808cba07d98fd3f74035cb9f26f68a..b17945a2ffea8f7ddd7436a5bfc8fbac42afd1a2 100644 (file)
@@ -422,6 +422,8 @@ merge_and_complain (struct cl_decoded_option **decoded_options,
            append_option (decoded_options, decoded_options_count, foption);
          break;
 
+       case OPT_ftrapv:
+       case OPT_fstrict_overflow:
        case OPT_ffp_contract_:
          /* For selected options we can merge conservatively.  */
          for (j = 0; j < *decoded_options_count; ++j)
@@ -429,11 +431,25 @@ merge_and_complain (struct cl_decoded_option **decoded_options,
              break;
          if (j == *decoded_options_count)
            append_option (decoded_options, decoded_options_count, foption);
-         /* FP_CONTRACT_OFF < FP_CONTRACT_ON < FP_CONTRACT_FAST.  */
+         /* FP_CONTRACT_OFF < FP_CONTRACT_ON < FP_CONTRACT_FAST,
+            -fno-trapv < -ftrapv,
+            -fno-strict-overflow < -fstrict-overflow  */
          else if (foption->value < (*decoded_options)[j].value)
            (*decoded_options)[j] = *foption;
          break;
 
+       case OPT_fwrapv:
+         /* For selected options we can merge conservatively.  */
+         for (j = 0; j < *decoded_options_count; ++j)
+           if ((*decoded_options)[j].opt_index == foption->opt_index)
+             break;
+         if (j == *decoded_options_count)
+           append_option (decoded_options, decoded_options_count, foption);
+         /* -fwrapv > -fno-wrapv.  */
+         else if (foption->value > (*decoded_options)[j].value)
+           (*decoded_options)[j] = *foption;
+         break;
+
        case OPT_freg_struct_return:
        case OPT_fpcc_struct_return:
          for (j = 0; j < *decoded_options_count; ++j)
@@ -591,6 +607,9 @@ run_gcc (unsigned argc, char *argv[])
        case OPT_freg_struct_return:
        case OPT_fpcc_struct_return:
        case OPT_ffp_contract_:
+       case OPT_fwrapv:
+       case OPT_ftrapv:
+       case OPT_fstrict_overflow:
          break;
 
        default: