Bug#1135526: Possible miscompilation at -O2

David Bremner <[email protected]> Sun, 03 May 2026 20:17:20 +0900
Newsgroups gmane.linux.debian.devel.gcc
Message-ID <8734083fpb.fsf__41581.2084147305$1777807178$gmane$org@tethera.net>
Matthias Klose <[email protected]> writes:

>>>
>> 
>> I learned that declaring this array as static const seems to fix the
>> initialization, although I'm not really sure how to interpret that.
>
> just for my understanding: -16 (20260321) doesn't show this behavior, 
> but -17 (20260423) does?

That is correct.

> Do you have a test case smaller than building 
> the whoole notmuch package?
>
> Probably needs bisecting the upstream commits (git-updates.diff) to find 
> the offending patch.

Unfortunately I don't have a smaller test case at this time.  For what
it is worth I can narrow down the test after notmuch is built; the
attach script should show the segfault if run in test/ after building.
for-gcc.sh (application/x-sh, 789 B)
#!/usr/bin/env bash
test_description="\"notmuch reply\" in several variations"
. $(dirname "$0")/test-lib.sh || exit 1

add_message '[from]="Sender <[email protected]>"' \
	     [to][email protected] \
	     [subject]=notmuch-reply-test \
	    '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
	    '[body]="basic reply test"'

cat <<EOF > basic.expected
From: Notmuch Test Suite <[email protected]>
Subject: Re: notmuch-reply-test
To: Sender <[email protected]>
In-Reply-To: <${gen_msg_id}>
References: <${gen_msg_id}>

On Tue, 05 Jan 2010 15:43:56 -0000, Sender <[email protected]> wrote:
> basic reply test
OK
EOF

test_begin_subtest "Basic reply"
notmuch reply id:${gen_msg_id} >OUTPUT 2>&1 && echo OK >> OUTPUT
test_expect_equal_file basic.expected OUTPUT

test_done