Linux Btrfs filesystem development
 help / color / mirror / Atom feed
From: Sam James <sam@gentoo.org>
To: Alejandro Colomar <alx@kernel.org>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: Build failure with trunk GCC 15 in fs/btrfs/print-tree.c (-Wunterminated-string-initialization)
Date: Fri, 19 Jul 2024 07:08:55 +0100	[thread overview]
Message-ID: <87y15xykug.fsf@gentoo.org> (raw)
In-Reply-To: <5mnphkdvheudccjtiatrbjbkqtw54s2wkpeqevj3rqthdqlwyw@sjvn4wn52qki> (Alejandro Colomar's message of "Fri, 19 Jul 2024 00:26:44 +0200")

[-- Attachment #1: Type: text/plain, Size: 1707 bytes --]

Alejandro Colomar <alx@kernel.org> writes:

> Hi Sam!
>
> On Thu, Jul 18, 2024 at 10:54:40PM GMT, Sam James wrote:
>> GCC 15 introduces a new warning -Wunterminated-string-initialization
>> which causes, with the kernel's -Werror=..., the following:
>> ```
>> /var/tmp/portage/sys-kernel/gentoo-kernel-6.6.41/work/linux-6.6/fs/btrfs/print-tree.c:29:49: error: initializer-string for array of ‘char’ is too long [-Werror=unterminated-string-initialization]
>>    29 |         { BTRFS_BLOCK_GROUP_TREE_OBJECTID,      "BLOCK_GROUP_TREE"      },
>>       |
>>       ^~~~~~~~~~~~~~~~~~
>> ```
>> 
>> It was introduced in https://gcc.gnu.org/PR115185. I don't have time
>> today to check the case to see what the best fix is, but CCing Alex who
>> wrote the warning implementation in case he has a chance.
>
> Thanks for forwarding the report.  It looks like a legit diagnostic.  It
> seems like a bug.

Thank you for analysing it so quickly! I normally try to for bug reports
but I'd already hit an unrelated kernel issue I was debugging so I
didn't want to worry about it for now.

> [...]

> The fix would be to add at least one byte to that array size.  Possibly
> make it 32 for alignment.  But I don't know if that array size is fixed
> by any ABI, so the maintainer will be better placed to find the suitable
> fix.
>
> The only alternatives I see are
>
> -  Use a larger number of elements for that array (1 would be enough).
> -  Use a shorter string so that it fits the 16 bytes.
>
> Have a lovely night!

You too :)

It might be worth making a list of "real bugs the warning found" as
stuff gets ported over the next few months.

> Alex

thanks,
sam

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 377 bytes --]

  parent reply	other threads:[~2024-07-19  6:08 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-18 21:54 Build failure with trunk GCC 15 in fs/btrfs/print-tree.c (-Wunterminated-string-initialization) Sam James
2024-07-18 22:26 ` Alejandro Colomar
2024-07-19  1:19   ` Qu Wenruo
2024-07-19  8:39     ` Alejandro Colomar
2024-07-19  8:47       ` Alejandro Colomar
2024-07-19  8:49         ` Alejandro Colomar
2024-07-19  6:08   ` Sam James [this message]
2024-07-19  8:41     ` Alejandro Colomar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87y15xykug.fsf@gentoo.org \
    --to=sam@gentoo.org \
    --cc=alx@kernel.org \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox