GCC 7 warnings

From: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: GCC 7 warnings
Date: 2017-04-10 15:03:23
Message-ID: dd7e5c64-86ec-9e96-e682-a57d1cb9bcc2@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

The release of GCC 7 is approaching [0], and the number of warnings in
PostgreSQL has gone up since we last looked [1]. Output attached. (My
version is 7.0.1 20170408.)

Most of the issues have to do with concatenating two or more strings of
potential size MAXPGPATH into another buffer of size MAXPGPATH, which
could lead to truncation.

Possible fixes:

a) Ignore, hoping GCC will change before final release. (unlikely at
this point)

b) Add compiler option to disable this particular warning, worry about
it later. (Might be an option for backpatching.)

c) Expand the target buffer sizes until the warning goes away. (Sample
patch attached.)

d) Replace most of the problematic code with psprintf() and dynamically
sized buffers.

Comments?

[0]: https://gcc.gnu.org/ml/gcc/2017-03/msg00066.html
[1]:
https://www.postgresql.org/message-id/CAFj8pRA=xV0_-aDF5UtGVY8HGvg+ovA_js_P8z4jLHxvX0Wa=A@mail.gmail.com

--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

Attachment Content-Type Size
gcc-7-warnings.txt text/plain 25.1 KB
0001-Fix-various-new-warnings-from-gcc-7.patch invalid/octet-stream 24.1 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2017-04-10 15:14:03 contrib/bloom wal-check not run by default
Previous Message Jeevan Ladhe 2017-04-10 14:51:32 Re: Adding support for Default partition in partitioning