This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug middle-end/29919] New: constant propogation around comparison operators breaks things on underflow


There seems to be some constant propogation around comparison operators going
on, even with no optimization turned on which produces different behavior that
it used to with gcc-3.4.4 and different than what happens if you do some
casting.
#include <stdio.h>
int main(int argc, char *argv[])
{
int i = atoi(argv[1]);
if (0 <= (i - 1))
    printf("no casting true\n");
else
    printf("no casting false\n");
if (0 <= (signed int)((unsigned int)i - 1))
    printf("casting true\n");
else
    printf("casting false\n");
return 0;
}

produces different answers for the two comparisons if you give it INT_MIN
(-2147483647) because of over/underflow.


-- 
           Summary: constant propogation around comparison operators breaks
                    things on underflow
           Product: gcc
           Version: 4.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: bardwell at curl dot com
 GCC build triplet: gcc version 4.1.1 20061011 (Red Hat 4.1.1-30)
  GCC host triplet: i686-redhat-linux
GCC target triplet: i686-redhat-linux


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]