Commit 0764a0d2 by Jakub Jelinek Committed by Jakub Jelinek

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
parent 02c9b9cc
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> 2019-04-17 Claudiu Zissulescu <claziss@synopsys.com>
* config/arc/arc.c (arc_init): Format diagnostic string. * 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, ...@@ -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 /* If both op0 and op1 are sign (!uns) or zero (uns) extended from
hmode to mode, the multiplication will never overflow. We can hmode to mode, the multiplication will never overflow. We can
do just one hmode x hmode => mode widening multiplication. */ 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); tree halfstype = build_nonstandard_integer_type (hprec, uns);
ops.op0 = make_tree (halfstype, lopart0s); ops.op0 = make_tree (halfstype, lopart0);
ops.op1 = make_tree (halfstype, lopart1s); ops.op1 = make_tree (halfstype, lopart1);
ops.code = WIDEN_MULT_EXPR; ops.code = WIDEN_MULT_EXPR;
ops.type = type; ops.type = type;
rtx thisres rtx thisres
......
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> 2019-04-17 Thomas Schwinge <thomas@codesourcery.com>
PR fortran/90048 PR fortran/90048
......
/* 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;
}
/* PR middle-end/90095 */
/* { dg-do run } */
/* { dg-options "-Os -fno-tree-bit-ccp -fno-split-wide-types" } */
#include "pr90095-1.c"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment