public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/45649] New: -Wunsafe-loop-optimizations fail to recognize finite loop
@ 2010-09-11 17:49 dimhen at gmail dot com
0 siblings, 0 replies; only message in thread
From: dimhen at gmail dot com @ 2010-09-11 17:49 UTC (permalink / raw)
To: gcc-bugs
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1124 bytes --]
gcc version 4.6.0 20100911 (experimental) [trunk revision 164213] (GCC)
FAIL with up cycle bound 35 and PASS with 34.
# gcc -Wunsafe-loop-optimizations -O3 -c unsafe_loop.c
unsafe_loop.c: In function foo_35:
unsafe_loop.c:14:5: warning: cannot optimize loop, the loop counter may
overflow [-Wunsafe-loop-optimizations]
# cat unsafe_loop.c
void
foo_34(char *ptr, unsigned size)
{
unsigned i;
for(i=0; i*2 < size && i*2 < 34; i++ ) {
*ptr++ = 0;
}
}
foo_35(char *ptr, unsigned size)
{
unsigned i;
for(i=0; i*2 < size && i*2 < 35; i++ ) {
*ptr++ = 0;
}
}
--
Summary: -Wunsafe-loop-optimizations fail to recognize finite
loop
Product: gcc
Version: 4.6.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: dimhen at gmail dot com
GCC build triplet: i686-redhat-linux
GCC host triplet: i686-redhat-linux
GCC target triplet: i686-redhat-linux
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45649
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2010-09-11 17:49 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-09-11 17:49 [Bug c/45649] New: -Wunsafe-loop-optimizations fail to recognize finite loop dimhen at gmail dot com
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).