Re: Record comparison compiler warning - Mailing list pgsql-hackers
From | Kevin Grittner |
---|---|
Subject | Re: Record comparison compiler warning |
Date | |
Msg-id | 1383249113.26825.YahooMailNeo@web162902.mail.bf1.yahoo.com Whole thread Raw |
In response to | Re: Record comparison compiler warning (Bruce Momjian <bruce@momjian.us>) |
Responses |
Re: Record comparison compiler warning
(Stefan Kaltenbrunner <stefan@kaltenbrunner.cc>)
|
List | pgsql-hackers |
Bruce Momjian <bruce@momjian.us> wrote: > On Wed, Oct 16, 2013 at 11:49:13AM -0700, Kevin Grittner wrote: >> Bruce Momjian <bruce@momjian.us> wrote: >> >>> I am seeing this compiler warning in git head: >>> >>> rowtypes.c: In function 'record_image_cmp': >>> rowtypes.c:1433: warning: 'cmpresult' may be used >>> uninitialized in this function rowtypes.c:1433: note: 'cmpresult' was declared here >> >> I had not gotten a warning under either gcc or clang, but that was >> probably because I was doing assert-enabled builds, and the >> Assert(false) saved me. That seemed a little marginal anyway, so >> how about this?: > > Would you please send the file as ASCII, e.g. not: > > <A0><A0><A0><A0><A0><A0><A0><A0><A0><A0><A0><A0><A0><A0><A0><A0><A0><A0><A0> default: Huh, I did not see anything remotely like that in my email or in the archives: http://www.postgresql.org/message-id/1381949353.78943.YahooMailNeo@web162902.mail.bf1.yahoo.com ... however, I'm attaching it rather than pasting it this time. It is warning-recimgcmp.diff. I'm also attaching the other warnings (outside of the well-known yyg parser warning) which I get from a compile using Ubuntu clang version 3.0-6ubuntu3. The one in pg_standby seems completely legitimate -- what is the point of comparing to see whether an unsigned integer is >= 0? The other one would be nice to quiet down, but I would understand if people would prefer to leave it alone and hope the compiler writers fix it. Warnings those fix below: catcache.c:571:12: warning: variable 'cl' is uninitialized when used here [-Wuninitialized] Assert(cl->cl_magic == CL_MAGIC); ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~ ../../../../src/include/c.h:625:10: note: expanded from: Trap(!(condition), "FailedAssertion") ^ ../../../../src/include/c.h:607:28: note: expanded from: if ((assert_enabled) && (condition)) \ ^~~~~~~~~ catcache.c:569:5: note: variable 'cl' is declared here CatCList *cl = dlist_container(CatCList, cache_elem, iter.cur); ^ catcache.c:585:13: warning: variable 'ct' is uninitialized when used here [-Wuninitialized] Assert(ct->ct_magic == CT_MAGIC); ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~ ../../../../src/include/c.h:625:10: note: expanded from: Trap(!(condition), "FailedAssertion") ^ ../../../../src/include/c.h:607:28: note: expanded from: if ((assert_enabled) && (condition)) \ ^~~~~~~~~ catcache.c:583:6: note: variable 'ct' is declared here CatCTup *ct = dlist_container(CatCTup, cache_elem, iter.cur); ^ 2 warnings generated. pg_standby.c:348:22: warning: comparison of unsigned expression >= 0 is always true [-Wtautological-compare] if (tli > 0 && log >= 0 && seg > 0) ~~~ ^ ~ 1 warning generated. None of these seem particularly urgent, so I'll leave them for comment for maybe a week before taking any action. -- Kevin Grittner EDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company
Attachment
pgsql-hackers by date: