re PR middle-end/56420 (Arithmetic error in computation with compile time unsigned...
authorJakub Jelinek <jakub@redhat.com>
Thu, 21 Feb 2013 21:29:29 +0000 (22:29 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Thu, 21 Feb 2013 21:29:29 +0000 (22:29 +0100)
commitbe63b77d8b202a77d7699311fa4a9aba4521b425
treed1030e594d863fd4319e656fd16f5fbba7cd2f74
parentd7fde18c2a76c55f544a2f4afa6ac39c195f0392
re PR middle-end/56420 (Arithmetic error in computation with compile time unsigned __int128 constant)

PR middle-end/56420
* expmed.c (EXACT_POWER_OF_2_OR_ZERO_P): Do subtraction in uhwi, to
avoid signed wrapping.
(expand_mult): Handle properly multiplication by
((dword_type) -1) << (BITS_PER_WORD - 1).  Improve multiplication by
((dword_type) 1) << (BITS_PER_WORD - 1).  Avoid undefined behavior
in the compiler if coeff is HOST_WIDE_INT_MIN.
(expand_divmod): Don't make ext_op1 static, change it's type to
uhwi.  Avoid undefined behavior in -INTVAL (op1).

* gcc.dg/torture/pr56420.c: New test.

From-SVN: r196215
gcc/ChangeLog
gcc/expmed.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/torture/pr56420.c [new file with mode: 0644]