While trying to compile PPL using a gcc that targets Win64, an autoconf test
for a "remainder" bug fails.  The test basically tries to compute INT_MIN % -1.
 The program compiles cleanly, but execution results in a crash with exit code
149.  The compile line is without any -O optimization, and with a single -f
option:

g++ -frounding-math a.cpp

 The test is as follows:

#include <climits>

int minus_one(int n) {
   return (n+1)*(n-1)-n*n;
}

int p(int x, int y) {
   int z = x % y;
   return z;
}

int main(int argc, char** argv) {
   if (p(INT_MIN, minus_one(argc)) != 0)
     return 1;
   else
     return 0;
}


-- 
           Summary: autoconf detects g++ as having a remainder bug
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: nightstrike at gmail dot com


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

Reply via email to