public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/42688] New: gcc 4.3.3 with -O2 thinks a often non-zero expression is always zero
@ 2010-01-11 14:11 mnemo at minimum dot se
2010-01-12 9:11 ` [Bug c/42688] " rguenth at gcc dot gnu dot org
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: mnemo at minimum dot se @ 2010-01-11 14:11 UTC (permalink / raw)
To: gcc-bugs
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1294 bytes --]
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
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c/42688] gcc 4.3.3 with -O2 thinks a often non-zero expression is always zero
2010-01-11 14:11 [Bug c/42688] New: gcc 4.3.3 with -O2 thinks a often non-zero expression is always zero mnemo at minimum dot se
@ 2010-01-12 9:11 ` rguenth at gcc dot gnu dot org
2010-01-17 15:34 ` mnemo at minimum dot se
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2010-01-12 9:11 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from rguenth at gcc dot gnu dot org 2010-01-12 09:10 -------
Please attach preprocessed source of the offending file.
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |WAITING
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42688
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c/42688] gcc 4.3.3 with -O2 thinks a often non-zero expression is always zero
2010-01-11 14:11 [Bug c/42688] New: gcc 4.3.3 with -O2 thinks a often non-zero expression is always zero mnemo at minimum dot se
2010-01-12 9:11 ` [Bug c/42688] " rguenth at gcc dot gnu dot org
@ 2010-01-17 15:34 ` mnemo at minimum dot se
2010-01-17 15:39 ` mnemo at minimum dot se
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: mnemo at minimum dot se @ 2010-01-17 15:34 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from mnemo at minimum dot se 2010-01-17 15:34 -------
Using gcc 4.4.1, I see this:
1. "gcc -O2 sqlite3.c" repros the bug
2. "gcc -E sqlite3.c > pp.c" followed by "gcc -O2 pp.c" does _NOT_ repro the
bug
However, still using gcc 4.4.1, if I do:
1. "gcc -O2 -E sqlite3.c > ppo.c" followed by "gcc -O2 ppo.c" does repro the
bug
Finally, I also tried to upgrade to Ubuntu Lucid today which gave me gcc 4.4.3
and there I can't get the bug to repro at all.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42688
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c/42688] gcc 4.3.3 with -O2 thinks a often non-zero expression is always zero
2010-01-11 14:11 [Bug c/42688] New: gcc 4.3.3 with -O2 thinks a often non-zero expression is always zero mnemo at minimum dot se
2010-01-12 9:11 ` [Bug c/42688] " rguenth at gcc dot gnu dot org
2010-01-17 15:34 ` mnemo at minimum dot se
@ 2010-01-17 15:39 ` mnemo at minimum dot se
2010-02-07 20:05 ` [Bug middle-end/42688] " pinskia at gcc dot gnu dot org
2010-02-07 21:34 ` mnemo at minimum dot se
4 siblings, 0 replies; 6+ messages in thread
From: mnemo at minimum dot se @ 2010-01-17 15:39 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from mnemo at minimum dot se 2010-01-17 15:39 -------
I tried to attach the output of "gcc -E -O2 sqlite3.c" but it's 1.5MB and
bugzilla rejects anything bigger than 1KB. Even the unmodified source is larger
than this limit, even though you can download it via the sqlite.org URL I
posted.
Since this doesn't repro on gcc 4.4.3, maybe the bug should be closed though?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42688
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug middle-end/42688] gcc 4.3.3 with -O2 thinks a often non-zero expression is always zero
2010-01-11 14:11 [Bug c/42688] New: gcc 4.3.3 with -O2 thinks a often non-zero expression is always zero mnemo at minimum dot se
` (2 preceding siblings ...)
2010-01-17 15:39 ` mnemo at minimum dot se
@ 2010-02-07 20:05 ` pinskia at gcc dot gnu dot org
2010-02-07 21:34 ` mnemo at minimum dot se
4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2010-02-07 20:05 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from pinskia at gcc dot gnu dot org 2010-02-07 20:04 -------
You can gzip the preprocessed source if needed. Also It might be the case we
are jump threading in one case and not in the other which causes the zero
expression to show up and that causes glibc's headers to produce the warning
...
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Component|c |middle-end
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42688
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug middle-end/42688] gcc 4.3.3 with -O2 thinks a often non-zero expression is always zero
2010-01-11 14:11 [Bug c/42688] New: gcc 4.3.3 with -O2 thinks a often non-zero expression is always zero mnemo at minimum dot se
` (3 preceding siblings ...)
2010-02-07 20:05 ` [Bug middle-end/42688] " pinskia at gcc dot gnu dot org
@ 2010-02-07 21:34 ` mnemo at minimum dot se
4 siblings, 0 replies; 6+ messages in thread
From: mnemo at minimum dot se @ 2010-02-07 21:34 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from mnemo at minimum dot se 2010-02-07 21:34 -------
The gzipped output is also too big for this bugzilla instance to handle. It
should be easy for you to download the *.tar.gz from the description and just
run "gcc -E -O2" on it.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42688
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2010-02-07 21:34 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-01-11 14:11 [Bug c/42688] New: gcc 4.3.3 with -O2 thinks a often non-zero expression is always zero mnemo at minimum dot se
2010-01-12 9:11 ` [Bug c/42688] " rguenth at gcc dot gnu dot org
2010-01-17 15:34 ` mnemo at minimum dot se
2010-01-17 15:39 ` mnemo at minimum dot se
2010-02-07 20:05 ` [Bug middle-end/42688] " pinskia at gcc dot gnu dot org
2010-02-07 21:34 ` mnemo at minimum dot se
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).