Re: New compiler warnings in buildfarm

From: Peter Eisentraut <peter(at)eisentraut(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: New compiler warnings in buildfarm
Date: 2024-07-31 05:37:53
Message-ID: 3f876695-b2ac-443b-8d2f-9a26b54727d7@eisentraut.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 30.07.24 18:19, Tom Lane wrote:
> Sometime in the last month or so, flaviventris's bleeding-edge
> version of gcc has started whining[1] about truncation of a
> string literal's implicit trailing '\0' in contexts like this:
>
> ../pgsql/src/backend/commands/copyto.c:106:41: warning:
> initializer-string for array of 'char' is too long
> [-Wunterminated-string-initialization]
> 106 | static const char BinarySignature[11] = "PGCOPY\n\377\r\n\0";
> | ^~~~~~~~~~~~~~~~~~~~
>
> ../pgsql/src/backend/utils/adt/numutils.c:29:1: warning:
> initializer-string for array of 'char' is too long
> [-Wunterminated-string-initialization]
> 29 | "00" "01" "02" "03" "04" "05" "06" "07" "08" "09"
> | ^~~~
>
> Presumably this'll appear in less-bleeding-edge releases in a
> few months' time.

According to the gcc documentation, this warning is part of -Wextra.
And indeed flaviventris runs with -Wextra:

'CFLAGS' => '-O1 -ggdb -g3 -fno-omit-frame-pointer -Wall -Wextra
-Wno-unused-parameter -Wno-sign-compare -Wno-missing-field-initializers
-O0',

So I think the appropriate fix here for now is to add
-Wno-unterminated-string-initialization to this buildfarm configuration.

Maybe we find this warning useful, in which case we should add
-Wunterminated-string-initialization to the standard set of warning
options before undertaking code changes. But gcc-15 is still about a
year away from being released, so it seems too early for that.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Shlok Kyal 2024-07-31 05:47:00 Re: long-standing data loss bug in initial sync of logical replication
Previous Message shveta malik 2024-07-31 05:35:36 Re: Conflict detection and logging in logical replication