Re: New string-truncation warnings from GCC 15 - Mailing list pgsql-hackers

From Tom Lane
Subject Re: New string-truncation warnings from GCC 15
Date
Msg-id 1788984.1758141536@sss.pgh.pa.us
Whole thread Raw
In response to Re: New string-truncation warnings from GCC 15  (Peter Eisentraut <peter@eisentraut.org>)
Responses Re: New string-truncation warnings from GCC 15
List pgsql-hackers
Peter Eisentraut <peter@eisentraut.org> writes:
> On 17.09.25 00:48, Tom Lane wrote:
>> Several of the buildfarm animals seem to have been updated to
>> GCC 15 over the past week or so.  They are now moaning about
>> various places where we're intentionally omitting a string
>> terminator, eg these warnings from scorpion:
>>
>> scorpion      | 2025-09-16 18:39:03 | ../pgsql/src/backend/commands/copyfromparse.c:139:41: warning:
initializer-stringfor array of 'char' truncates NUL terminator but destination lacks 'nonstring' attribute (12 chars
into11 available) [-Wunterminated-string-initialization] 

> Note that this is not a default warning option in gcc or an option put
> in by PostgreSQL.  This comes from -Wextra, which that buildfarm member
> has added by itself.  So there is also an option C in having that
> buildfarm member turn off that option.

Oh!  Hmm... I am not sure that we want to commit to being -Wextra
clean across-the-board.  The reason those warnings aren't in -Wall
is precisely that they are not always reasonable to suppress.
(The gcc manual used to say that in more-or-less so many words,
although I see they've removed that helpful bit of advice.)

I'm quite willing to just start ignoring
-Wunterminated-string-initialization in my warning-scraping script.

            regards, tom lane



pgsql-hackers by date:

Previous
From: David Rowley
Date:
Subject: Re: REPACK and naming
Next
From: Bruce Momjian
Date:
Subject: Re: PG 18 release notes draft committed