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

--- Comment #4 from Vittorio Zecca <zeccav at gmail dot com> ---
I am having the same problem in 5.2.0:
/* must be compiled with -O[1] -funroll-loops -foptimize-sibling-calls
-finline-small-functions */
/* target x86_64-unknown-linux-gnu */
/* Fedora 21 */
/*gcc-5.2.0/gcc/loop-iv.c:2670:25: runtime error: signed integer overflow: 123
- -9223372036854775808 cannot be represented in type 'long int'*/
/* source line "max = (uint64_t) (up - down) / inc + 1;" */
long level = 0;
extern long foo (void);
extern long bar (void);


long
foo (void)
{
  long tmp = ++level;
  return bar () + tmp;
}

long
bar (void)
{
  long tmp = level;
  return tmp > 123 ? -42 - tmp : foo () - tmp;
}

Reply via email to