public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/18700] New: Infinite loop with ranged for() loop
@ 2004-11-28  5:21 sa2c at sa2c dot net
  2004-11-28  5:27 ` [Bug c/18700] " pinskia at gcc dot gnu dot org
  0 siblings, 1 reply; 2+ messages in thread
From: sa2c at sa2c dot net @ 2004-11-28  5:21 UTC (permalink / raw)
  To: gcc-bugs

the code:
void foo()
{
	int i;
	for (i = 0; i <= 0x7fffffff; i++)
		;
}
compiled with "-O -S" procudes the following assembly.
foo:
	pushl	%ebp
	movl	%esp, %ebp
.L2:
	jmp	.L2

-- 
           Summary: Infinite loop with ranged for() loop
           Product: gcc
           Version: 3.4.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: sa2c at sa2c dot net
                CC: gcc-bugs at gcc dot gnu dot org,sa2c at sa2c dot net
 GCC build triplet: i386-unknown-freebsd5.3
  GCC host triplet: i386-unknown-freebsd5.3
GCC target triplet: i386-unknown-freebsd5.3


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


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

* [Bug c/18700] Infinite loop with ranged for() loop
  2004-11-28  5:21 [Bug c/18700] New: Infinite loop with ranged for() loop sa2c at sa2c dot net
@ 2004-11-28  5:27 ` pinskia at gcc dot gnu dot org
  0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-11-28  5:27 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-11-28 05:27 -------
In C, ((int)INT_MAX) + 1 is undefined and int does not wrap.  
For 3.4.0 and above if you want int to wrap use the flap -fwrapv.
Otherwise use unsigned where wrapping is defined.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


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


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

end of thread, other threads:[~2004-11-28  5:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-11-28  5:21 [Bug c/18700] New: Infinite loop with ranged for() loop sa2c at sa2c dot net
2004-11-28  5:27 ` [Bug c/18700] " pinskia at gcc dot gnu dot org

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).