diff mbox

[testsuite] : Fix gcc.dg/ipa/ipcp-3.c

Message ID 4E64BBB2.20602@gjlay.de
State New
Headers show

Commit Message

Georg-Johann Lay Sept. 5, 2011, 12:08 p.m. UTC
This test case contains expression 1 << 18 which leads to FAIL for targets with
sizeof(int) < 4.

The mask seems not to be relevant for the test and can be set to, e.g. 14.

Ok?

testsuite/
	* gcc.dg/ipa/ipcp-3.c (mark_cell): Use mask 1 << 14 instead of 1 << 18.

Comments

Martin Jambor Sept. 5, 2011, 12:41 p.m. UTC | #1
Hi,

On Mon, Sep 05, 2011 at 02:08:18PM +0200, Georg-Johann Lay wrote:
> This test case contains expression 1 << 18 which leads to FAIL for targets with
> sizeof(int) < 4.
> 
> The mask seems not to be relevant for the test and can be set to, e.g. 14.
> 

I have created the testcase by modifying the one for PR 43835
(testsuite/gcc.c-torture/execute/pr43835.c), the shift could probably
be removed from the test altogether (but of course shift by 14 is also
fine with me, though I cannot approve anything).  I'm just wondering
what kind of failure this causes (a compile time one?) and why that
same failure does not take place with the aforementioned pr43835.c
testcase...

BTW, unfortunately I have recently also added a bunch of such shifts
in testsuite/gcc.c-torture/execute/pr49886.c, are they OK?

Thanks,

Martin


> Ok?
> 
> testsuite/
> 	* gcc.dg/ipa/ipcp-3.c (mark_cell): Use mask 1 << 14 instead of 1 << 18.
> 
> 
> 
> Index: gcc.dg/ipa/ipcp-3.c
> ===================================================================
> --- gcc.dg/ipa/ipcp-3.c (revision 178527)
> +++ gcc.dg/ipa/ipcp-3.c (working copy)
> @@ -34,7 +34,7 @@ static void
>  mark_cell(int * interp, Pcc_cell *c)
>  {
>    if (c && c->type == 4 && c->p
> -      && !(c->p->flags & (1<<18)))
> +      && !(c->p->flags & (1<<14)))
>      never_ever(interp, c->p);
>  }
>
Georg-Johann Lay Sept. 5, 2011, 1:55 p.m. UTC | #2
Martin Jambor schrieb:
> Hi,
> 
> On Mon, Sep 05, 2011 at 02:08:18PM +0200, Georg-Johann Lay wrote:
>> This test case contains expression 1 << 18 which leads to FAIL for targets with
>> sizeof(int) < 4.
>>
>> The mask seems not to be relevant for the test and can be set to, e.g. 14.
>>
> 
> I have created the testcase by modifying the one for PR 43835
> (testsuite/gcc.c-torture/execute/pr43835.c), the shift could probably
> be removed from the test altogether (but of course shift by 14 is also
> fine with me, though I cannot approve anything).  I'm just wondering
> what kind of failure this causes (a compile time one?) and why that

It's a warning that leads to test fail:

gcc/testsuite/gcc.dg/ipa/ipcp-3.c: In function 'mark_cell':
gcc/testsuite/gcc.dg/ipa/ipcp-3.c:37:7: warning: left shift count >= width of
type [enabled by default]
output is:
gcc/testsuite/gcc.dg/ipa/ipcp-3.c: In function 'mark_cell':
gcc/testsuite/gcc.dg/ipa/ipcp-3.c:37:7: warning: left shift count >= width of
type [enabled by default]

FAIL: gcc.dg/ipa/ipcp-3.c (test for excess errors)
Excess errors:
gcc/testsuite/gcc.dg/ipa/ipcp-3.c:37:7: warning: left shift count >= width of
type [enabled by default]

> same failure does not take place with the aforementioned pr43835.c
> testcase...

I had a look at the test results and there is no warning for shift >= width of
type for pr43835.c. Strange...

> BTW, unfortunately I have recently also added a bunch of such shifts
> in testsuite/gcc.c-torture/execute/pr49886.c, are they OK?

As mentioned above, such shifts lead to respective warning and the unexpected
output to test fail. So either the test case has to be flexible enough to treat
also small targets with sizeof(int) = 16 or add some gate like

/* { dg-require-effective-target int32plus } */

because if a test case actually uses a bit >= 16 on such a target it will very
likely show malfunction anyway which is not intended for these kind of tests.

> Thanks,
> 
> Martin
> 
> 
>> Ok?
>>
>> testsuite/
>> 	* gcc.dg/ipa/ipcp-3.c (mark_cell): Use mask 1 << 14 instead of 1 << 18.
>>
>>
>>
>> Index: gcc.dg/ipa/ipcp-3.c
>> ===================================================================
>> --- gcc.dg/ipa/ipcp-3.c (revision 178527)
>> +++ gcc.dg/ipa/ipcp-3.c (working copy)
>> @@ -34,7 +34,7 @@ static void
>>  mark_cell(int * interp, Pcc_cell *c)
>>  {
>>    if (c && c->type == 4 && c->p
>> -      && !(c->p->flags & (1<<18)))
>> +      && !(c->p->flags & (1<<14)))
>>      never_ever(interp, c->p);
>>  }
>>
Georg-Johann Lay Sept. 5, 2011, 2:02 p.m. UTC | #3
Committed as obvious.

http://gcc.gnu.org/viewcvs?view=revision&revision=178545


Martin Jambor schrieb:
> Hi,
> 
> On Mon, Sep 05, 2011 at 02:08:18PM +0200, Georg-Johann Lay wrote:
>> This test case contains expression 1 << 18 which leads to FAIL for targets with
>> sizeof(int) < 4.
>>
>> The mask seems not to be relevant for the test and can be set to, e.g. 14.
>>
> 
> I have created the testcase by modifying the one for PR 43835
> (testsuite/gcc.c-torture/execute/pr43835.c), the shift could probably
> be removed from the test altogether (but of course shift by 14 is also
> fine with me, though I cannot approve anything).  I'm just wondering
> what kind of failure this causes (a compile time one?) and why that
> same failure does not take place with the aforementioned pr43835.c
> testcase...
> 
> BTW, unfortunately I have recently also added a bunch of such shifts
> in testsuite/gcc.c-torture/execute/pr49886.c, are they OK?
> 
> Thanks,
> 
> Martin
> 
> 
>> Ok?
>>
>> testsuite/
>> 	* gcc.dg/ipa/ipcp-3.c (mark_cell): Use mask 1 << 14 instead of 1 << 18.
>>
>>
>>
>> Index: gcc.dg/ipa/ipcp-3.c
>> ===================================================================
>> --- gcc.dg/ipa/ipcp-3.c (revision 178527)
>> +++ gcc.dg/ipa/ipcp-3.c (working copy)
>> @@ -34,7 +34,7 @@ static void
>>  mark_cell(int * interp, Pcc_cell *c)
>>  {
>>    if (c && c->type == 4 && c->p
>> -      && !(c->p->flags & (1<<18)))
>> +      && !(c->p->flags & (1<<14)))
>>      never_ever(interp, c->p);
>>  }
>>
diff mbox

Patch

Index: gcc.dg/ipa/ipcp-3.c
===================================================================
--- gcc.dg/ipa/ipcp-3.c (revision 178527)
+++ gcc.dg/ipa/ipcp-3.c (working copy)
@@ -34,7 +34,7 @@  static void
 mark_cell(int * interp, Pcc_cell *c)
 {
   if (c && c->type == 4 && c->p
-      && !(c->p->flags & (1<<18)))
+      && !(c->p->flags & (1<<14)))
     never_ever(interp, c->p);
 }