[Bug c++/69641] New: invalid int32 comparison

vvsed at hotmail dot com gcc-bugzilla@gcc.gnu.org
Tue Feb 2 22:53:00 GMT 2016


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69641

            Bug ID: 69641
           Summary: invalid int32 comparison
           Product: gcc
           Version: 5.1.0
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: vvsed at hotmail dot com
  Target Milestone: ---

The program prints 0 1 instead of 1 1.
Same behavior with gcc 4.8 and 5.1, with both -m64 and -m32.

/*
D:\Tools\MinGW64\bin\g++.exe -m64 -O2 -Wall -save-temps gcerr.cpp -ovx_class_gc

Compiler: http://tdm-gcc.tdragon.net/about

invalid int32 comparison
*/

#include <stdio.h>

int main(int argc, const char *argv[])
{
        int     i = 0x7F800000;

        fprintf(stdout, "%d \n", 0 > (int)(i + 0x00800000));
        fprintf(stdout, "%d \n", 0 > (int)0x80000000);

        fprintf(stdout, "press Enter");
        getc(stdin);
        return 0;
}


More information about the Gcc-bugs mailing list