Nicholas Nethercote wrote:
Hi,

I've been looking at the gcc.c-torture tests, it seems some of them rely on undefined behaviour. For example, 920612-1.c looks like this:

  f(j)int j;{return++j>0;}
  main(){if(f((~0U)>>1))abort();exit(0);}

AIUI, this passes the largest possible positive integer to f(), which then increments it, causing signed overflow, the result of which is undefined. The test passes if signed overflow wraps.

930529-1.c is similar -- again the maximum positive integer is incremented.

i think it is fine 2 have these tests. ant gcc version failing them is 
suspicious

Reply via email to