[Bug middle-end/22429] [4.1 Regression] -1073741824 <= n && n <= 1073741823 is true where n is 1073741824

pinskia at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Tue Jul 12 07:04:00 GMT 2005


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-07-12 06:54 -------
4.0 produced:
  D.1463 = n - -1073741824;
  if (D.1463 >= 0)

Which is wrong as overflow is undefined.

4.1 produces:
(n >= -1073741824)
as overflow is undefined.

This was exposed by:
2005-07-02  Andrew Pinski  <pinskia@physics.uc.edu>

        PR middle-end/14490
        * fold-const.c (fold_binary): Handle the return value of
        fold_to_nonsharp_ineq_using_bound if we get back the same operand back.
        Implement "X +- C1 CMP C2" folding to "X CMP C2 -+ C1".

Which means I have to look into it since I exposed it.  We should be subtracting using unsigned mode.


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pinskia at gcc dot gnu dot
                   |                            |org
             Status|UNCONFIRMED                 |NEW
          Component|c                           |middle-end
     Ever Confirmed|                            |1
 GCC target triplet|i686-pc-linux-gnu           |
           Keywords|                            |wrong-code
      Known to fail|                            |4.1.0
      Known to work|                            |4.0.2
   Last reconfirmed|0000-00-00 00:00:00         |2005-07-12 06:54:16
               date|                            |
            Summary|-1073741824 <= n && n <=    |[4.1 Regression] -1073741824
                   |1073741823 is true where n  |<= n && n <= 1073741823 is
                   |is 1073741824               |true where n is 1073741824
   Target Milestone|---                         |4.1.0


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



More information about the Gcc-bugs mailing list