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

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).