public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Can gcc.dg/torture/pr67828.c be an infinite loop?
@ 2021-09-24  8:03 Aldy Hernandez
  2021-09-24  8:08 ` Richard Biener
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Aldy Hernandez @ 2021-09-24  8:03 UTC (permalink / raw)
  To: GCC Mailing List

Hi folks.

My upcoming threading improvements turn the test below into an infinite 
runtime loop:

int a, b;
short c;

int
main ()
{
   int j, d = 1;
   for (; c >= 0; c++)
     {
BODY:
       a = d;
       d = 0;
       if (b)
	{
	  xprintf (0);
	  if (j)
	    xprintf (0);
	}
     }
   xprintf (d);
   exit (0);
}

On the false edge out of if(b) we thread directly to BODY, eliding the 
loop conditional, because we know that c>=0 because it could never overflow.

Since B is globally initialized to 0, this has the effect of turning the 
test into an infinite loop.

Is this correct, or did I miss something?
Aldy


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2021-09-24 11:41 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-24  8:03 Can gcc.dg/torture/pr67828.c be an infinite loop? Aldy Hernandez
2021-09-24  8:08 ` Richard Biener
2021-09-24  8:59   ` Aldy Hernandez
2021-09-24 11:30     ` David Brown
2021-09-24  9:29 ` Andrew Pinski
2021-09-24  9:35   ` Aldy Hernandez
2021-09-24  9:38     ` Andrew Pinski
2021-09-24 10:49       ` Aldy Hernandez
2021-09-24 11:33       ` David Brown
2021-09-24 11:08   ` Richard Earnshaw
2021-09-24 11:37 ` David Brown
2021-09-24 11:41   ` Aldy Hernandez

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).