public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/51350] New: [4.7 Regression] Bogus -Wstrict-overflow warning: assuming signed overflow does not occur when assuming that (X + c) < X is always false
@ 2011-11-29 22:57 burnus at gcc dot gnu.org
2011-12-05 14:12 ` [Bug c++/51350] " rguenth at gcc dot gnu.org
2011-12-05 15:17 ` rguenth at gcc dot gnu.org
0 siblings, 2 replies; 3+ messages in thread
From: burnus at gcc dot gnu.org @ 2011-11-29 22:57 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51350
Bug #: 51350
Summary: [4.7 Regression] Bogus -Wstrict-overflow warning:
assuming signed overflow does not occur when assuming
that (X + c) < X is always false
Classification: Unclassified
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: burnus@gcc.gnu.org
Host: x86_64-unknown-linux-gnu
When compiling the following code with g++ -Wall -O2 test.cc, one gets with GCC
4.7.0 20111129. [GCC 4.6.2 does not print a warning.]
test.cc:9:3: Warnung: assuming signed overflow does not occur when assuming
that (X + c) < X is always false [-Wstrict-overflow]
However, I fail to see why one has (X + c) < X for the general case; it should
only occur if (start >= pattern_length), but as the value for "start" is not
known at compile time ...
void PopulateBoyerMooreTable(int pattern_length, int start,
int * shift_table, int* suffix_table,
int length)
{
int suffix = pattern_length + 1;
int i = pattern_length;
while (i > start)
suffix_table[--i] = --suffix;
if (suffix < pattern_length)
for (int j = start; j <= pattern_length; j++)
shift_table[j] = suffix - start;
}
Original file:
http://code.google.com/p/v8/source/browse/branches/bleeding_edge/src/string-search.h#150
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-12-05 15:17 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-29 22:57 [Bug c++/51350] New: [4.7 Regression] Bogus -Wstrict-overflow warning: assuming signed overflow does not occur when assuming that (X + c) < X is always false burnus at gcc dot gnu.org
2011-12-05 14:12 ` [Bug c++/51350] " rguenth at gcc dot gnu.org
2011-12-05 15:17 ` rguenth at gcc dot gnu.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).