diff mbox

Fix gcc.c-torture/execute/20101011-1.c on 64-bit Niagara

Message ID 2274492.VkOA7UxnmJ@polaris
State New
Headers show

Commit Message

Eric Botcazou June 14, 2017, 10:40 a.m. UTC
This fixes

FAIL: gcc.c-torture/execute/20101011-1.c   -O2  execution test
FAIL: gcc.c-torture/execute/20101011-1.c   -O2 -flto -fno-use-linker-plugin -
flto-partition=none  execution test
FAIL: gcc.c-torture/execute/20101011-1.c   -O2 -flto -fuse-linker-plugin -fno-
fat-lto-objects  execution test
FAIL: gcc.c-torture/execute/20101011-1.c   -O3 -g  execution test
FAIL: gcc.c-torture/execute/20101011-1.c   -Os  execution test

on 64-bit SPARC with -mcpu=niagara.  There is exactly the same guard a few 
lines below for the DIV case.

Tested on SPARC64/Linux and x86-64/Linux, applied on the mainline.


2017-06-14  Eric Botcazou  <ebotcazou@adacore.com>

	* simplify-rtx.c (simplify_binary_operation_1) <UDIV>: Do not simplify
	a division of 0 if non-call exceptions are enabled.

Comments

David Miller June 14, 2017, 4:27 p.m. UTC | #1
From: Eric Botcazou <ebotcazou@adacore.com>
Date: Wed, 14 Jun 2017 12:40:57 +0200

> This fixes
> 
> FAIL: gcc.c-torture/execute/20101011-1.c   -O2  execution test
> FAIL: gcc.c-torture/execute/20101011-1.c   -O2 -flto -fno-use-linker-plugin -
> flto-partition=none  execution test
> FAIL: gcc.c-torture/execute/20101011-1.c   -O2 -flto -fuse-linker-plugin -fno-
> fat-lto-objects  execution test
> FAIL: gcc.c-torture/execute/20101011-1.c   -O3 -g  execution test
> FAIL: gcc.c-torture/execute/20101011-1.c   -Os  execution test
> 
> on 64-bit SPARC with -mcpu=niagara.  There is exactly the same guard a few 
> lines below for the DIV case.
> 
> Tested on SPARC64/Linux and x86-64/Linux, applied on the mainline.

Thanks for fixing this.
diff mbox

Patch

Index: simplify-rtx.c
===================================================================
--- simplify-rtx.c	(revision 249091)
+++ simplify-rtx.c	(working copy)
@@ -3194,7 +3194,8 @@  simplify_binary_operation_1 (enum rtx_co
 
     case UDIV:
       /* 0/x is 0 (or x&0 if x has side-effects).  */
-      if (trueop0 == CONST0_RTX (mode))
+      if (trueop0 == CONST0_RTX (mode)
+	  && !cfun->can_throw_non_call_exceptions)
 	{
 	  if (side_effects_p (op1))
 	    return simplify_gen_binary (AND, mode, op1, trueop0);