Bug 114970 - [14/15 Regression] 32-bit ARM gcc-14.1 new false positive -Wunused-value
Summary: [14/15 Regression] 32-bit ARM gcc-14.1 new false positive -Wunused-value
Status: UNCONFIRMED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 14.1.0
: P3 normal
Target Milestone: 14.2
Assignee: Not yet assigned to anyone
URL:
Keywords: diagnostic
Depends on:
Blocks:
 
Reported: 2024-05-07 10:51 UTC by Nils Gladitz
Modified: 2024-05-07 21:33 UTC (History)
2 users (show)

See Also:
Host:
Target: arm*-*-*eabi
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments
Testcase (141 bytes, text/x-csrc)
2024-05-07 10:51 UTC, Nils Gladitz
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Nils Gladitz 2024-05-07 10:51:13 UTC
Created attachment 58114 [details]
Testcase

The attached reduced test case produces the following warning:
test.cpp:6:43: warning: value computed is not used [-Wunused-value]
    6 |         std::string_view prefix("<prefix>");

When compiling with:
 -Wall -std=c++20 -O2

I see the warning when building for 32-bit ARM but not x86-64.
There is no warning with GCC 13.2.0.

Also seen with godbolt on "trunk": https://godbolt.org/z/GvbMMsfch
Comment 1 Andrew Pinski 2024-05-07 20:44:06 UTC
This looks related to constructor return this where with ARM EABI constructors (and deconstructors return this) and we produce:
      <<cleanup_point <<< Unknown tree: expr_stmt
        prefix = {._M_len=8, ._M_str=(const char *) "<prefix>"}, (struct basic_string_view *) &prefix >>>>>;


Note "this" of &prefix is there.

Let me try to reduce this a little bit.
I might not get to it until week after next though.