[Bug c/119251] New diagnostic: -Wcompound-literal-address

2025-03-12 Thread alx at kernel dot org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119251 --- Comment #10 from Alejandro Colomar --- (In reply to Jakub Jelinek from comment #8) > In that case the warning should be also restricted to the case when ({ comes > from macro expansion and the compound literal from macro argument (not sure >

[Bug c/119251] New diagnostic: -Wcompound-literal-address

2025-03-12 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119251 --- Comment #9 from Jakub Jelinek --- (In reply to Andrew Pinski from comment #7) > GCC already has Wdangling-pointer which is done at optimization time too so > I suspect it should catch most of these. Though it should be improved for > handlin

[Bug c/119251] New diagnostic: -Wcompound-literal-address

2025-03-12 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119251 --- Comment #8 from Jakub Jelinek --- In that case the warning should be also restricted to the case when ({ comes from macro expansion and the compound literal from macro argument (not sure if the last one can be differentiated from locations).

[Bug c/119251] New diagnostic: -Wcompound-literal-address

2025-03-12 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119251 Andrew Pinski changed: What|Removed |Added Blocks||104077 --- Comment #7 from Andrew Pinsk

[Bug c/119251] New diagnostic: -Wcompound-literal-address

2025-03-12 Thread alx at kernel dot org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119251 --- Comment #6 from Alejandro Colomar --- (In reply to uecker from comment #5) > Maybe a more targeted warning would make sense, e.g. taking the address of a > compound literal inside ({ }). Maybe even checking whether it escapes? > And/or onl

[Bug c/119251] New diagnostic: -Wcompound-literal-address

2025-03-12 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119251 Richard Biener changed: What|Removed |Added Severity|normal |enhancement Version|unknown

[Bug c/119251] New diagnostic: -Wcompound-literal-address

2025-03-12 Thread uecker at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119251 --- Comment #5 from uecker at gcc dot gnu.org --- Maybe a more targeted warning would make sense, e.g. taking the address of a compound literal inside ({ }). Maybe even checking whether it escapes? And/or only inside macros?

[Bug c/119251] New diagnostic: -Wcompound-literal-address

2025-03-12 Thread alx at kernel dot org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119251 --- Comment #3 from Alejandro Colomar --- (In reply to Jakub Jelinek from comment #1) > How is compound literal different from any other automatic variable? > And of course taking the address of compound literal when used in scope is > just fine

[Bug c/119251] New diagnostic: -Wcompound-literal-address

2025-03-12 Thread uecker at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119251 uecker at gcc dot gnu.org changed: What|Removed |Added CC||uecker at gcc dot gnu.org --

[Bug c/119251] New diagnostic: -Wcompound-literal-address

2025-03-12 Thread alx at kernel dot org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119251 --- Comment #4 from Alejandro Colomar --- I understand that program rely on this. I don't intend this diagnostic to be in -Wextra (at least not for now). I just want to have it available, so that I can enable it for myself.

[Bug c/119251] New diagnostic: -Wcompound-literal-address

2025-03-12 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119251 Jakub Jelinek changed: What|Removed |Added CC||jakub at gcc dot gnu.org --- Comment #1