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

2013-02-21 Thread jakub at gcc dot gnu.org


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



Jakub Jelinek jakub at gcc dot gnu.org changed:



   What|Removed |Added



 Status|UNCONFIRMED |NEW

   Last reconfirmed||2013-02-21

  Component|c++ |middle-end

 CC||jakub at gcc dot gnu.org

 Ever Confirmed|0   |1

Summary|Arithmetic error in |[4.8 Regression] Arithmetic

   |computation with compile|error in computation with

   |time unsigned __int128  |compile time unsigned

   |constant|__int128 constant

   Target Milestone|--- |4.8.0



--- Comment #1 from Jakub Jelinek jakub at gcc dot gnu.org 2013-02-21 
16:00:56 UTC ---

Started with http://gcc.gnu.org/viewcvs?root=gccview=revrev=188786

I'll have a look.


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

2013-02-21 Thread jakub at gcc dot gnu.org


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



Jakub Jelinek jakub at gcc dot gnu.org changed:



   What|Removed |Added



 Status|NEW |ASSIGNED

 AssignedTo|unassigned at gcc dot   |jakub at gcc dot gnu.org

   |gnu.org |



--- Comment #2 from Jakub Jelinek jakub at gcc dot gnu.org 2013-02-21 
18:32:40 UTC ---

Created attachment 29519

  -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=29519

gcc48-pr56420.patch



Untested fix.


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

2013-02-21 Thread jakub at gcc dot gnu.org


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=gccview=revrev=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


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

2013-02-21 Thread jakub at gcc dot gnu.org


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



Jakub Jelinek jakub at gcc dot gnu.org changed:



   What|Removed |Added



 Status|ASSIGNED|RESOLVED

 Resolution||FIXED



--- Comment #4 from Jakub Jelinek jakub at gcc dot gnu.org 2013-02-21 
21:36:57 UTC ---

Fixed.


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

2013-02-21 Thread st at quanttec dot com


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



--- Comment #5 from Stephan Tolksdorf st at quanttec dot com 2013-02-21 
21:38:27 UTC ---

That was fast, thanks!