public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/26566] New: Invalid code: loop optimization removes exit condition
@ 2006-03-05 9:55 steffen dot list dot account at gmail dot com
2006-03-05 10:06 ` [Bug c/26566] " falk at debian dot org
0 siblings, 1 reply; 2+ messages in thread
From: steffen dot list dot account at gmail dot com @ 2006-03-05 9:55 UTC (permalink / raw)
To: gcc-bugs
With -O2 or higher, the following little C loop does not terminate:
short i;
for (i=-1; i; i--) ;
The generated assembler code is:
.L2:
jmp .L2
which means that the exit condition has been completely eliminated.
The same loop works as expected (terminates after 0xffff iterations) with
gcc-4.0 or earlier, with -O1 or lower, and with unsigned types.
This is an i386 style system with a P4 2.8 GHz, running Debian SID/i386 with
gcc-4.1 1:4.1.0-0 from Debian experimental.
--
Summary: Invalid code: loop optimization removes exit condition
Product: gcc
Version: 4.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: steffen dot list dot account at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26566
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug c/26566] Invalid code: loop optimization removes exit condition
2006-03-05 9:55 [Bug c/26566] New: Invalid code: loop optimization removes exit condition steffen dot list dot account at gmail dot com
@ 2006-03-05 10:06 ` falk at debian dot org
0 siblings, 0 replies; 2+ messages in thread
From: falk at debian dot org @ 2006-03-05 10:06 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from falk at debian dot org 2006-03-05 10:06 -------
Signed integer overflow is undefined in C. Use -fwrapv to force twos-complement
semantics.
--
falk at debian dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26566
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2006-03-05 10:06 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-03-05 9:55 [Bug c/26566] New: Invalid code: loop optimization removes exit condition steffen dot list dot account at gmail dot com
2006-03-05 10:06 ` [Bug c/26566] " falk at debian 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).