From: | Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com> |
---|---|
To: | pgsql-hackers(at)postgresql(dot)org |
Subject: | xloginsert.c hole_length warning on gcc 4.8.3 |
Date: | 2015-03-13 23:39:30 |
Message-ID: | 55037532.7050101@2ndquadrant.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi there,
with gcc 4.8.3, I'm getting this warning in xloginsert.c:
-------------------------
xloginsert.c: In function ‘XLogInsert’:
xloginsert.c:668:20: warning: ‘hole_length’ may be used uninitialized in
this function [-Wmaybe-uninitialized]
if (hole_length != 0 && is_compressed)
^
xloginsert.c:497:10: note: ‘hole_length’ was declared here
uint16 hole_length;
-------------------------
The compiler seems to be confused probably because the code is
structured like this:
{
uint16 hole_length;
uint16 hole_offset;
if (needs_backup)
{
... initialize hole_length/hole_offset ...
}
if (needs_data)
{
...
}
if (needs_backup)
{
... use hole_length/hole_offset ...
}
}
and does not realize the two blocks referencing the variables use the
same condition.
Initializing the variables at the very beginning (and simplifying the
first block a bit) seems like a good fix - patch attached.
--
Tomas Vondra http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
Attachment | Content-Type | Size |
---|---|---|
xloginsert-hole.patch | text/x-diff | 1.2 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2015-03-14 00:02:03 | Re: Custom/Foreign-Join-APIs (Re: [v9.5] Custom Plan API) |
Previous Message | Josh Berkus | 2015-03-13 23:29:40 | Re: Regarding pg_stat_statements |