[committed] Fix up pr90478.c testcase (was Re: [PATCH] Check for overflow in tree-switch-conversion (PR middle-end/90478).)

Message ID 20190515224524.GQ19695@tucnak
State New
Headers show
Series
  • [committed] Fix up pr90478.c testcase (was Re: [PATCH] Check for overflow in tree-switch-conversion (PR middle-end/90478).)
Related show

Commit Message

Jakub Jelinek May 15, 2019, 10:45 p.m.
On Wed, May 15, 2019 at 12:20:42PM +0200, Martin Liška wrote:
> 2019-05-15  Martin Liska  <mliska@suse.cz>

> 

> 	PR middle-end/90478

> 	* tree-switch-conversion.c (jump_table_cluster::can_be_handled):

> 	Check for overflow.

> 

> gcc/testsuite/ChangeLog:

> 

> 2019-05-15  Martin Liska  <mliska@suse.cz>

> 

> 	PR middle-end/90478

> 	* gcc.dg/tree-ssa/pr90478-2.c: New test.

> 	* gcc.dg/tree-ssa/pr90478.c: New test.


The pr90478.c test fails on i686-linux:
FAIL: gcc.dg/tree-ssa/pr90478.c (test for excess errors)
Excess errors:
/home/jakub/src/gcc/gcc/testsuite/gcc.dg/tree-ssa/pr90478.c:14:3: error: integer constant is too large for 'long' type [-Wlong-long]
/home/jakub/src/gcc/gcc/testsuite/gcc.dg/tree-ssa/pr90478.c:14:3: warning: overflow in conversion from 'long long int' to 'long int' changes value from '2057594037927936' to '-239534080' [-Woverflow]
/home/jakub/src/gcc/gcc/testsuite/gcc.dg/tree-ssa/pr90478.c:16:3: error: integer constant is too large for 'long' type [-Wlong-long]
/home/jakub/src/gcc/gcc/testsuite/gcc.dg/tree-ssa/pr90478.c:16:3: warning: overflow in conversion from 'long long int' to 'long int' changes value from '4611686018427387904' to '0' [-Woverflow]
/home/jakub/src/gcc/gcc/testsuite/gcc.dg/tree-ssa/pr90478.c:16:3: error: duplicate case value

Fixed thusly, tested on x86_64-linux with -m32/-m64, committed to trunk as
obvious:

2019-05-16  Jakub Jelinek  <jakub@redhat.com>

	PR middle-end/90478
	* gcc.dg/tree-ssa/pr90478.c: Add empty dg-options.  Use long long type
	instead of long.



	Jakub

Comments

Martin Liška May 16, 2019, 7:31 a.m. | #1
On 5/16/19 12:45 AM, Jakub Jelinek wrote:
> Fixed thusly, tested on x86_64-linux with -m32/-m64, committed to trunk as

> obvious:


Thank you Jakub.

Patch

--- gcc/testsuite/gcc.dg/tree-ssa/pr90478.c.jj	2019-05-15 23:36:44.476116559 +0200
+++ gcc/testsuite/gcc.dg/tree-ssa/pr90478.c	2019-05-16 00:41:58.088087596 +0200
@@ -1,7 +1,8 @@ 
 /* { dg-do compile } */
+/* { dg-options "" } */
 
 typedef struct {
-  long a;
+  long long a;
 } c;
 
 void e();