[Bug middle-end/56420] [4.8 Regression] Arithmetic error in computation with compile time unsigned __int128 constant

jakub at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Feb 21 21:29:00 GMT 2013


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56420

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> 2013-02-21 21:29:33 UTC ---
Author: jakub
Date: Thu Feb 21 21:29:29 2013
New Revision: 196215

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=196215
Log:
    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.

Added:
    trunk/gcc/testsuite/gcc.dg/torture/pr56420.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/expmed.c
    trunk/gcc/testsuite/ChangeLog



More information about the Gcc-bugs mailing list