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

            Bug ID: 66940
           Summary: ifcvt.c:1907 signed integer overflow
           Product: gcc
           Version: 5.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zeccav at gmail dot com
  Target Milestone: ---

/* must be compiled with -O */
/* in noce_get_alt_condition */
/*gcc-5.2.0/gcc/ifcvt.c:1907: runtime error: signed integer overflow:
9223372036854775807 + 1 cannot be represented in type 'long int'*/
/* gcc source line "if (actual_val == desired_val + 1)"*/
/* double check with "gcc_assert(desired_val+1>desired_val);" immediately
before*/
long foo(void)
{
 long ival = 0;
 int cp ;
 if (cp) ival = -1;
 if (ival < 0)   return -0x7fffffffffffffffL - 1;     
 return 0x7fffffffffffffffL;
}

Reply via email to