Re: Erroneous -Werror=missing-braces on old GCC

From: Japin Li <japinli(at)hotmail(dot)com>
To: Richard Guo <guofenglinux(at)gmail(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Erroneous -Werror=missing-braces on old GCC
Date: 2023-12-25 03:48:37
Message-ID: ME3P282MB316636114C997909F6A1595CB699A@ME3P282MB3166.AUSP282.PROD.OUTLOOK.COM
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On Mon, 25 Dec 2023 at 10:42, Richard Guo <guofenglinux(at)gmail(dot)com> wrote:
> I came across the 'missing braces' warning again when building master
> (0a93f803f4) on old GCC (4.8.5).
>
> blkreftable.c: In function ‘BlockRefTableSetLimitBlock’:
> blkreftable.c:268:2: warning: missing braces around initializer
> [-Wmissing-braces]
> BlockRefTableKey key = {0}; /* make sure any padding is zero */
> ^
>

I doubt if `key = {0}` equals `key = {{0}}`, since the second only
initialize the first field in `key`, it may depend on compiler to
initialize other fields (include padding).

> This has popped up a few times in the past, and it seems to be GCC bug
> 53119. We previously used the {{...}} approach to suppress it. Should
> we do the same here, like attached?
>
> FWIW, in the same file we initialize BlockRefTableSerializedEntry
> variables also with {{0}}.
>
> Thanks
> Richard

--
Regrads,
Japin Li
ChengDu WenWu Information Technology Co., Ltd.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2023-12-25 03:57:33 Re: Erroneous -Werror=missing-braces on old GCC
Previous Message Richard Guo 2023-12-25 02:42:43 Erroneous -Werror=missing-braces on old GCC