* [Patch, testsuite] Fix failing overflow-1.c for avr
@ 2017-03-21 12:08 Senthil Kumar Selvaraj
2017-03-21 12:31 ` Georg-Johann Lay
0 siblings, 1 reply; 3+ messages in thread
From: Senthil Kumar Selvaraj @ 2017-03-21 12:08 UTC (permalink / raw)
To: gcc-patches
Hi,
The test assumes 32 bit ints, and expects a constant in the
dump that is only valid for 32 bit ints. This trivial patch
fixes that by explicitly specifying __UINT32_TYPE__ as the type.
Committed as obvious.
Regards
Senthil
gcc/testsuite/ChangeLog
2017-03-21 Senthil Kumar Selvaraj <senthil_kumar.selvaraj@atmel.com>
* gcc.dg/tree-ssa/overflow-1.c: Use __UINT32_TYPE__ for targets
with sizeof(int) < 4.
diff --git gcc/testsuite/gcc.dg/tree-ssa/overflow-1.c gcc/testsuite/gcc.dg/tree-ssa/overflow-1.c
index e126609c53d9..b664d0f120aa 100644
--- gcc/testsuite/gcc.dg/tree-ssa/overflow-1.c
+++ gcc/testsuite/gcc.dg/tree-ssa/overflow-1.c
@@ -1,14 +1,20 @@
/* { dg-do compile } */
/* { dg-options "-O -fdump-tree-optimized" } */
-int f(unsigned a){
- unsigned b=5;
- unsigned c=a-b;
+#if __SIZEOF_INT__ < 4
+ __extension__ typedef __UINT32_TYPE__ uint32_t;
+#else
+ typedef unsigned uint32_t;
+#endif
+
+int f(uint32_t a){
+ uint32_t b=5;
+ uint32_t c=a-b;
return c>a;
}
-int g(unsigned a){
- unsigned b=32;
- unsigned c=a+b;
+int g(uint32_t a){
+ uint32_t b=32;
+ uint32_t c=a+b;
return c<a;
}
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Patch, testsuite] Fix failing overflow-1.c for avr
2017-03-21 12:08 [Patch, testsuite] Fix failing overflow-1.c for avr Senthil Kumar Selvaraj
@ 2017-03-21 12:31 ` Georg-Johann Lay
2017-03-21 12:34 ` Georg-Johann Lay
0 siblings, 1 reply; 3+ messages in thread
From: Georg-Johann Lay @ 2017-03-21 12:31 UTC (permalink / raw)
To: Senthil Kumar Selvaraj; +Cc: gcc-patches
On 21.03.2017 13:07, Senthil Kumar Selvaraj wrote:
>
> Hi,
>
> The test assumes 32 bit ints, and expects a constant in the
> dump that is only valid for 32 bit ints. This trivial patch
> fixes that by explicitly specifying __UINT32_TYPE__ as the type.
>
> Committed as obvious.
>
> Regards
> Senthil
>
> gcc/testsuite/ChangeLog
>
> 2017-03-21 Senthil Kumar Selvaraj <senthil_kumar.selvaraj@atmel.com>
>
> * gcc.dg/tree-ssa/overflow-1.c: Use __UINT32_TYPE__ for targets
> with sizeof(int) < 4.
>
> diff --git gcc/testsuite/gcc.dg/tree-ssa/overflow-1.c gcc/testsuite/gcc.dg/tree-ssa/overflow-1.c
> index e126609c53d9..b664d0f120aa 100644
> --- gcc/testsuite/gcc.dg/tree-ssa/overflow-1.c
> +++ gcc/testsuite/gcc.dg/tree-ssa/overflow-1.c
> @@ -1,14 +1,20 @@
> /* { dg-do compile } */
> /* { dg-options "-O -fdump-tree-optimized" } */
>
> -int f(unsigned a){
> - unsigned b=5;
> - unsigned c=a-b;
> +#if __SIZEOF_INT__ < 4
> + __extension__ typedef __UINT32_TYPE__ uint32_t;
> +#else
> + typedef unsigned uint32_t;
Dunno if this matters, but it changes the test for 64-bit int.
Johann
> +#endif
> +
> +int f(uint32_t a){
> + uint32_t b=5;
> + uint32_t c=a-b;
> return c>a;
> }
> -int g(unsigned a){
> - unsigned b=32;
> - unsigned c=a+b;
> +int g(uint32_t a){
> + uint32_t b=32;
> + uint32_t c=a+b;
> return c<a;
> }
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Patch, testsuite] Fix failing overflow-1.c for avr
2017-03-21 12:31 ` Georg-Johann Lay
@ 2017-03-21 12:34 ` Georg-Johann Lay
0 siblings, 0 replies; 3+ messages in thread
From: Georg-Johann Lay @ 2017-03-21 12:34 UTC (permalink / raw)
To: Senthil Kumar Selvaraj; +Cc: gcc-patches
On 21.03.2017 13:31, Georg-Johann Lay wrote:
> On 21.03.2017 13:07, Senthil Kumar Selvaraj wrote:
>>
>> Hi,
>>
>> The test assumes 32 bit ints, and expects a constant in the
>> dump that is only valid for 32 bit ints. This trivial patch
>> fixes that by explicitly specifying __UINT32_TYPE__ as the type.
>>
>> Committed as obvious.
>>
>> Regards
>> Senthil
>>
>> gcc/testsuite/ChangeLog
>>
>> 2017-03-21 Senthil Kumar Selvaraj <senthil_kumar.selvaraj@atmel.com>
>>
>> * gcc.dg/tree-ssa/overflow-1.c: Use __UINT32_TYPE__ for targets
>> with sizeof(int) < 4.
>>
>> diff --git gcc/testsuite/gcc.dg/tree-ssa/overflow-1.c
>> gcc/testsuite/gcc.dg/tree-ssa/overflow-1.c
>> index e126609c53d9..b664d0f120aa 100644
>> --- gcc/testsuite/gcc.dg/tree-ssa/overflow-1.c
>> +++ gcc/testsuite/gcc.dg/tree-ssa/overflow-1.c
>> @@ -1,14 +1,20 @@
>> /* { dg-do compile } */
>> /* { dg-options "-O -fdump-tree-optimized" } */
>>
>> -int f(unsigned a){
>> - unsigned b=5;
>> - unsigned c=a-b;
>> +#if __SIZEOF_INT__ < 4
>> + __extension__ typedef __UINT32_TYPE__ uint32_t;
>> +#else
>> + typedef unsigned uint32_t;
>
> Dunno if this matters, but it changes the test for 64-bit int.
argh, forget my comment :-)
>
> Johann
>
>> +#endif
>> +
>> +int f(uint32_t a){
>> + uint32_t b=5;
>> + uint32_t c=a-b;
>> return c>a;
>> }
>> -int g(unsigned a){
>> - unsigned b=32;
>> - unsigned c=a+b;
>> +int g(uint32_t a){
>> + uint32_t b=32;
>> + uint32_t c=a+b;
>> return c<a;
>> }
>>
>>
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-03-21 12:34 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-21 12:08 [Patch, testsuite] Fix failing overflow-1.c for avr Senthil Kumar Selvaraj
2017-03-21 12:31 ` Georg-Johann Lay
2017-03-21 12:34 ` Georg-Johann Lay
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).