Hi, I have opened https://forge.sourceware.org/gcc/gcc/pulls/237 to resolve this matter.
Kind regards, Jonas Hansen > On 1 Oct 2026, at 22.40, Torbjorn SVENSSON <[email protected]> > wrote: > > Hi, > > This change appears to cause a regression for arm-none-eabi (only using > Cortex-M0 as an example here, other targets also fail): > > Testing tree-ssa/ssa-dse-1.C, > doing compile > Executing on host: /build/r17-4750-ga382bed036aa5f/bin/arm-none-eabi-g++ > /build/gcc_src/gcc/testsuite/g++.dg/tree-ssa/ssa-dse-1.C -mthumb > -march=armv6s-m -mcpu=cortex-m0 -mfloat-abi=soft -mfpu=auto > -fdiagnostics-plain-output -fmessage-length=0 -std=c++14 -O > -fdump-tree-dse1-details -S -o ssa-dse-1.s (timeout = 800) > spawn -ignore SIGHUP /build/r17-4750-ga382bed036aa5f/bin/arm-none-eabi-g++ > /build/gcc_src/gcc/testsuite/g++.dg/tree-ssa/ssa-dse-1.C -mthumb > -march=armv6s-m -mcpu=cortex-m0 -mfloat-abi=soft -mfpu=auto > -fdiagnostics-plain-output -fmessage-length=0 -std=c++14 -O > -fdump-tree-dse1-details -S -o ssa-dse-1.s > pid is 792592 -792592 > pid is -1 > output is status 0 > PASS: g++.dg/tree-ssa/ssa-dse-1.C (test for excess errors) > g++.dg/tree-ssa/ssa-dse-1.C : pattern found 0 times > FAIL: g++.dg/tree-ssa/ssa-dse-1.C scan-tree-dump-times dse1 "MEM > <char\\[[0-9]+]> \\[\\(struct FixBuf \\*\\)&<retval> \\+ [0-9]+B\\] = {}" 1 > > Kind regards, > Torbjörn > > On 2026-09-29 18:42, Jason Merrill wrote: >> On 9/29/26 12:14 PM, Jonas Hansen wrote: >>> >>> >>>> On 29 Sep 2026, at 17.43, Jason Merrill <[email protected]> wrote: >>>> >>>> On 9/28/26 4:17 AM, Jonas Hansen via Sourceware Forge wrote: >>>>> From: Jonas Hansen <[email protected]> >>>>> The call to braced_lists_to_strings in store_init_value does not look >>>>> through TARGET_EXPR. A constexpr aggregate initialized through one can >>>>> therefore retain a character array CONSTRUCTOR after constant evaluation. >>>>> The middle end then treats an element of that array as a single-character >>>>> string, causing a false -Wformat-truncation warning for a bounded snprintf >>>>> call that reads only the remaining array elements. >>>>> Move the existing conversion after constant folding, next to >>>>> replace_placeholders, so it sees the folded initializer while remaining >>>>> before split_nonconstant_init. Add diagnostic and runtime regressions >>>>> covering bounded reads, overreads, truncation, constexpr copy and >>>>> mutation, >>>>> templates, embedded nuls, and implicit zero initialization. >>>>> Tested on x86_64-pc-linux-gnu with related C++ format, initialization, >>>>> constexpr, narrowing, template, string and #embed tests: 14,435 expected >>>>> passes and no unexpected results across two test selections. C++ >>>>> self-tests >>>>> and the runtime regression, including LTO, also passed. A full bootstrap >>>>> and complete testsuite run have not been performed. >>>>> gcc/cp/ChangeLog: >>>>> PR tree-optimization/127416 >>>>> * typeck2.cc (store_init_value): Move braced_lists_to_strings after >>>>> constant folding. >>>>> gcc/testsuite/ChangeLog: >>>>> PR tree-optimization/127416 >>>>> * g++.dg/warn/Wformat-truncation-nonstring.C: New test. >>>>> * g++.dg/torture/constexpr-array-string.C: New test. >>>> The patch looks good, but do you intend to submit this under an FSF >>>> copyright assignment or the DCO? I don't see either currently. >>>> >>>> https://gcc.gnu.org/contribute.html#legal >>>> >>>> Jason >>>> >>> >>> I’m contributing this patch under DCO 1.1 and certify its terms. >>> >>> Signed-off-by: Jonas Hansen <[email protected]> >>> >>> Forge shows PR #232 as merged, although the change appears absent from >>> current upstream trunk. Could you confirm its status and whether this >>> emailed sign-off is sufficient, or whether you’d prefer an updated >>> submission? >> I'm pretty new to the forge, so I was surprised when the button I pushed >> caused it to claim that the patch was merged; I don't know what that >> actually means, as I didn't see any effect on even the forge trunk. >> I've now added your sign-off to the patch and pushed it. Thanks! >> Jason >
