This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/42688] New: gcc 4.3.3 with -O2 thinks a often non-zero expression is always zero
- From: "mnemo at minimum dot se" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 11 Jan 2010 14:11:36 -0000
- Subject: [Bug c/42688] New: gcc 4.3.3 with -O2 thinks a often non-zero expression is always zero
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
When you build sqlite using GCC and "-O2" parameter you get the following
warning. During runtime "EXPR_FULLSIZE-nSize" is mostly non-zero so it seems
that the GCC optimizer makes some assumptions that doesn't not always hold
true.
In function ?memset?,
inlined from ?exprDup? at sqlite3.c:61011:
/usr/include/bits/string3.h:82: warning: call to ?__warn_memset_zero_len?
declared with attribute warning: memset used with constant zero length
parameter; this could be due to transposed parameters
Repro steps:
0. install GCC 4.3.3
1. fetch and unpack sqlite from this URL:
http://www.sqlite.org/sqlite-amalgamation-3.6.22.tar.gz
2. run "gcc -O2 sqlite3.c"
Background: this issue was originally posted to the sqlite project as a sqlite
bug but they dismissed it as a GCC bug instead (which I believe is correct):
http://www.sqlite.org/src/tktview?name=f51d950180
--
Summary: gcc 4.3.3 with -O2 thinks a often non-zero expression is
always zero
Product: gcc
Version: 4.3.3
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: mnemo at minimum dot se
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42688