From 743a9cf79aee4f5a645991a9fda20e15050d32f3 Mon Sep 17 00:00:00 2001 From: Senthil Kumar Selvaraj Date: Wed, 5 Oct 2016 17:11:22 +0000 Subject: [PATCH] Fix pr69941.c test failure for avr The test assumes ints are atleast 32 bits wide. For the avr target, ints are 16 bits wide. This leads VRP to conclude that a right shift by 9 followed by an equality comparison to 0x74 can never be true. VRP eliminates the conditional, and the code ends up unconditionally calling __builtin_abort. Fixed the testcase to use __INT32_TYPE__ for targets with less than 32 bit wide integers, wherever the size happens to be significant. gcc/testsuite/ChangeLog 2016-10-05 Senthil Kumar Selvaraj * gcc.dg/torture/pr69941.c: Use __INT32_TYPE__ instead of int if __SIZEOF_INT__ is less than 4 bytes. From-SVN: r240795 --- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/torture/pr69941.c | 10 ++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 947e84cbc6f..722fb8219e8 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-10-05 Senthil Kumar Selvaraj + + * gcc.dg/torture/pr69941.c: Use __INT32_TYPE__ instead + of int if __SIZEOF_INT__ is less than 4 bytes. + 2016-10-05 Jerry DeLisle * gfortran.dg/dtio_15.f90: Fix spaces in dg-do. diff --git a/gcc/testsuite/gcc.dg/torture/pr69941.c b/gcc/testsuite/gcc.dg/torture/pr69941.c index f15d41a819f..7d097caf268 100644 --- a/gcc/testsuite/gcc.dg/torture/pr69941.c +++ b/gcc/testsuite/gcc.dg/torture/pr69941.c @@ -1,11 +1,17 @@ /* { dg-do run } */ + +#if __SIZEOF_INT__ < 4 +__extension__ typedef __INT32_TYPE__ int32_t; +#else +typedef int int32_t; +#endif int a = 0; int b = 0; int c = 0; -int e = 0; +int32_t e = 0; int f = 0; -int *g = &e; +int32_t *g = &e; int fn1() { return b ? a : b; } -- 2.30.2