mirror of
https://gcc.gnu.org/git/gcc.git
synced 2024-11-24 03:14:08 +08:00
re PR middle-end/90095 (wrong code with -Os -fno-tree-bit-ccp)
PR middle-end/90095 * internal-fn.c (expand_mul_overflow): Don't set SUBREG_PROMOTED_VAR_P on lowpart SUBREGs. * gcc.dg/pr90095-1.c: New test. * gcc.dg/pr90095-2.c: New test. From-SVN: r270410
This commit is contained in:
parent
02c9b9ccff
commit
0764a0d275
@ -1,3 +1,9 @@
|
||||
2019-04-17 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR middle-end/90095
|
||||
* internal-fn.c (expand_mul_overflow): Don't set SUBREG_PROMOTED_VAR_P
|
||||
on lowpart SUBREGs.
|
||||
|
||||
2019-04-17 Claudiu Zissulescu <claziss@synopsys.com>
|
||||
|
||||
* config/arc/arc.c (arc_init): Format diagnostic string.
|
||||
|
@ -1753,22 +1753,9 @@ expand_mul_overflow (location_t loc, tree lhs, tree arg0, tree arg1,
|
||||
/* If both op0 and op1 are sign (!uns) or zero (uns) extended from
|
||||
hmode to mode, the multiplication will never overflow. We can
|
||||
do just one hmode x hmode => mode widening multiplication. */
|
||||
rtx lopart0s = lopart0, lopart1s = lopart1;
|
||||
if (GET_CODE (lopart0) == SUBREG)
|
||||
{
|
||||
lopart0s = shallow_copy_rtx (lopart0);
|
||||
SUBREG_PROMOTED_VAR_P (lopart0s) = 1;
|
||||
SUBREG_PROMOTED_SET (lopart0s, uns ? SRP_UNSIGNED : SRP_SIGNED);
|
||||
}
|
||||
if (GET_CODE (lopart1) == SUBREG)
|
||||
{
|
||||
lopart1s = shallow_copy_rtx (lopart1);
|
||||
SUBREG_PROMOTED_VAR_P (lopart1s) = 1;
|
||||
SUBREG_PROMOTED_SET (lopart1s, uns ? SRP_UNSIGNED : SRP_SIGNED);
|
||||
}
|
||||
tree halfstype = build_nonstandard_integer_type (hprec, uns);
|
||||
ops.op0 = make_tree (halfstype, lopart0s);
|
||||
ops.op1 = make_tree (halfstype, lopart1s);
|
||||
ops.op0 = make_tree (halfstype, lopart0);
|
||||
ops.op1 = make_tree (halfstype, lopart1);
|
||||
ops.code = WIDEN_MULT_EXPR;
|
||||
ops.type = type;
|
||||
rtx thisres
|
||||
|
@ -1,3 +1,9 @@
|
||||
2019-04-17 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR middle-end/90095
|
||||
* gcc.dg/pr90095-1.c: New test.
|
||||
* gcc.dg/pr90095-2.c: New test.
|
||||
|
||||
2019-04-17 Thomas Schwinge <thomas@codesourcery.com>
|
||||
|
||||
PR fortran/90048
|
||||
|
18
gcc/testsuite/gcc.dg/pr90095-1.c
Normal file
18
gcc/testsuite/gcc.dg/pr90095-1.c
Normal file
@ -0,0 +1,18 @@
|
||||
/* PR middle-end/90095 */
|
||||
/* { dg-do run } */
|
||||
/* { dg-options "-Os -fno-tree-bit-ccp" } */
|
||||
|
||||
unsigned long long a;
|
||||
unsigned int b;
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
unsigned int c = 255, d = c |= b;
|
||||
if (__CHAR_BIT__ != 8 || __SIZEOF_INT__ != 4 || __SIZEOF_LONG_LONG__ != 8)
|
||||
return 0;
|
||||
d = __builtin_mul_overflow (-(unsigned long long) d, (unsigned char) - c, &a);
|
||||
if (d != 0)
|
||||
__builtin_abort ();
|
||||
return 0;
|
||||
}
|
5
gcc/testsuite/gcc.dg/pr90095-2.c
Normal file
5
gcc/testsuite/gcc.dg/pr90095-2.c
Normal file
@ -0,0 +1,5 @@
|
||||
/* PR middle-end/90095 */
|
||||
/* { dg-do run } */
|
||||
/* { dg-options "-Os -fno-tree-bit-ccp -fno-split-wide-types" } */
|
||||
|
||||
#include "pr90095-1.c"
|
Loading…
Reference in New Issue
Block a user