Patchwork Handle -fwrapv -ftrapv (PR tree-optimization/48766)

login
register
mail settings
Submitter Jakub Jelinek
Date Jan. 14, 2013, 8:52 p.m.
Message ID <20130114205218.GS7269@tucnak.redhat.com>
Download mbox | patch
Permalink /patch/211896/
State New
Headers show

Comments

Jakub Jelinek - Jan. 14, 2013, 8:52 p.m.
Hi!

With this patch, -fno-[wt]rapv cancels corresponding -f[wt]rapv if any as
before, and later -f[wt]rapv disables -f[tw]rapv, which is IMHO better
behavior than if we use Negative(f[tw]rapv) on f[wt]rapv in common.opt.

Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

2013-01-14  Jakub Jelinek  <jakub@redhat.com>

	PR tree-optimization/48766
	* opts.c (common_handle_option): For -fwrapv disable -ftrapv, for
	-ftrapv disable -fwrapv.


	Jakub
Joseph S. Myers - Jan. 14, 2013, 10:24 p.m.
On Mon, 14 Jan 2013, Jakub Jelinek wrote:

> Hi!
> 
> With this patch, -fno-[wt]rapv cancels corresponding -f[wt]rapv if any as
> before, and later -f[wt]rapv disables -f[tw]rapv, which is IMHO better
> behavior than if we use Negative(f[tw]rapv) on f[wt]rapv in common.opt.
> 
> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
> 
> 2013-01-14  Jakub Jelinek  <jakub@redhat.com>
> 
> 	PR tree-optimization/48766
> 	* opts.c (common_handle_option): For -fwrapv disable -ftrapv, for
> 	-ftrapv disable -fwrapv.

OK.

Patch

--- gcc/opts.c.jj	2013-01-11 09:02:48.000000000 +0100
+++ gcc/opts.c	2013-01-14 15:06:54.822968095 +0100
@@ -1755,6 +1755,16 @@  common_handle_option (struct gcc_options
       /* No-op. Used by the driver and passed to us because it starts with f.*/
       break;
 
+    case OPT_fwrapv:
+      if (value)
+	opts->x_flag_trapv = 0;
+      break;
+
+    case OPT_ftrapv:
+      if (value)
+	opts->x_flag_wrapv = 0;
+      break;
+
     default:
       /* If the flag was handled in a standard way, assume the lack of
 	 processing here is intentional.  */