re PR c++/70336 (Incorrect Wconversion warning)
PR c++/70336 * match.pd (nested int casts): Limit to GIMPLE. * c-c++-common/pr70336.c: New test. * gcc.dg/torture/builtin-isinf_sign-1.c (foo): Guard tests no longer optimized away at -O0 with #ifndef __OPTIMIZE__. From-SVN: r234764
This commit is contained in:
parent
84278ed9e8
commit
1d510e046c
5 changed files with 53 additions and 1 deletions
|
@ -1,3 +1,8 @@
|
|||
2016-04-05 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR c++/70336
|
||||
* match.pd (nested int casts): Limit to GIMPLE.
|
||||
|
||||
2016-04-05 Jan Hubicka <hubicka@ucw.cz>
|
||||
|
||||
PR ipa/66223
|
||||
|
|
|
@ -1554,7 +1554,8 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
|
|||
|
||||
/* A truncation to an unsigned type (a zero-extension) should be
|
||||
canonicalized as bitwise and of a mask. */
|
||||
(if (final_int && inter_int && inside_int
|
||||
(if (GIMPLE /* PR70366: doing this in GENERIC breaks -Wconversion. */
|
||||
&& final_int && inter_int && inside_int
|
||||
&& final_prec == inside_prec
|
||||
&& final_prec > inter_prec
|
||||
&& inter_unsignedp)
|
||||
|
|
|
@ -1,3 +1,10 @@
|
|||
2016-04-05 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR c++/70336
|
||||
* c-c++-common/pr70336.c: New test.
|
||||
* gcc.dg/torture/builtin-isinf_sign-1.c (foo): Guard tests
|
||||
no longer optimized away at -O0 with #ifndef __OPTIMIZE__.
|
||||
|
||||
2016-04-05 Jan Hubicka <hubicka@ucw.cz>
|
||||
|
||||
PR ipa/66223
|
||||
|
|
37
gcc/testsuite/c-c++-common/pr70336.c
Normal file
37
gcc/testsuite/c-c++-common/pr70336.c
Normal file
|
@ -0,0 +1,37 @@
|
|||
/* PR c++/70336 */
|
||||
/* { dg-do compile } */
|
||||
/* { dg-options "-Wconversion" } */
|
||||
|
||||
void
|
||||
f1 (unsigned char * x, int y, int z)
|
||||
{
|
||||
x[z / 8] |= (unsigned char) (0x80 >> y); /* { dg-bogus "may alter its value" } */
|
||||
}
|
||||
|
||||
unsigned char
|
||||
f2 (unsigned char x, int y)
|
||||
{
|
||||
x = x | (unsigned char) (0x80 >> y); /* { dg-bogus "may alter its value" } */
|
||||
return x;
|
||||
}
|
||||
|
||||
unsigned char
|
||||
f3 (unsigned char x, int y)
|
||||
{
|
||||
x = x | (unsigned char) (y & 255); /* { dg-bogus "may alter its value" } */
|
||||
return x;
|
||||
}
|
||||
|
||||
unsigned char
|
||||
f4 (unsigned char x, unsigned char y)
|
||||
{
|
||||
x = x | (unsigned char) (y & 255); /* { dg-bogus "may alter its value" } */
|
||||
return x;
|
||||
}
|
||||
|
||||
unsigned char
|
||||
f5 (unsigned char x, int y)
|
||||
{
|
||||
x = (unsigned char) (y & 255); /* { dg-bogus "may alter its value" } */
|
||||
return x;
|
||||
}
|
|
@ -24,6 +24,7 @@ foo (float f, double d, long double ld)
|
|||
!= (__builtin_isinf(ld) ? (__builtin_signbitl(ld) ? -1 : 1) : 0))
|
||||
link_error (__LINE__);
|
||||
|
||||
#ifdef __OPTIMIZE__
|
||||
/* In boolean contexts, GCC will fold the inner conditional
|
||||
expression to 1. So isinf_sign folds to plain isinf. */
|
||||
|
||||
|
@ -33,6 +34,7 @@ foo (float f, double d, long double ld)
|
|||
link_error (__LINE__);
|
||||
if ((_Bool)__builtin_isinf_sign(ld) != (__builtin_isinf(ld) != 0))
|
||||
link_error (__LINE__);
|
||||
#endif
|
||||
|
||||
if ((__builtin_isinf_sign(f) != 0) != (__builtin_isinf(f) != 0))
|
||||
link_error (__LINE__);
|
||||
|
|
Loading…
Add table
Reference in a new issue