re PR middle-end/80100 (simplify-rtx.c sanitizer detects undefined behaviour with optimization)
PR middle-end/80100 * simplify-rtx.c (simplify_binary_operation_1) <case IOR>: Perform left shift in unsigned HOST_WIDE_INT type. * gcc.dg/pr80100.c: New test. From-SVN: r246851
This commit is contained in:
parent
8585103f05
commit
df1c878ec2
|
@ -1,5 +1,9 @@
|
|||
2017-04-11 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR middle-end/80100
|
||||
* simplify-rtx.c (simplify_binary_operation_1) <case IOR>: Perform
|
||||
left shift in unsigned HOST_WIDE_INT type.
|
||||
|
||||
PR rtl-optimization/80385
|
||||
* simplify-rtx.c (simplify_unary_operation_1): Don't transform
|
||||
(not (neg X)) into (plus X -1) for complex or non-integral modes.
|
||||
|
|
|
@ -2742,7 +2742,7 @@ simplify_binary_operation_1 (enum rtx_code code, machine_mode mode,
|
|||
&& INTVAL (XEXP (op0, 1)) < HOST_BITS_PER_WIDE_INT)
|
||||
{
|
||||
int count = INTVAL (XEXP (op0, 1));
|
||||
HOST_WIDE_INT mask = INTVAL (trueop1) << count;
|
||||
HOST_WIDE_INT mask = UINTVAL (trueop1) << count;
|
||||
|
||||
if (mask >> count == INTVAL (trueop1)
|
||||
&& trunc_int_for_mode (mask, mode) == mask
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
2017-04-11 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR middle-end/80100
|
||||
* gcc.dg/pr80100.c: New test.
|
||||
|
||||
PR rtl-optimization/80385
|
||||
* g++.dg/opt/pr80385.C: New test.
|
||||
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
/* PR middle-end/80100 */
|
||||
/* { dg-do compile } */
|
||||
/* { dg-options "-O2" } */
|
||||
|
||||
long int
|
||||
foo (long int x)
|
||||
{
|
||||
return 2L | ((x - 1L) >> (__SIZEOF_LONG__ * __CHAR_BIT__ - 1));
|
||||
}
|
Loading…
Reference in New Issue