public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/104092] New: [12 Regression] Invalid -Wdangling-pointer warning after writes by calls
@ 2022-01-18 11:12 rsandifo at gcc dot gnu.org
2022-01-18 11:12 ` [Bug middle-end/104092] " rsandifo at gcc dot gnu.org
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: rsandifo at gcc dot gnu.org @ 2022-01-18 11:12 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104092
Bug ID: 104092
Summary: [12 Regression] Invalid -Wdangling-pointer warning
after writes by calls
Product: gcc
Version: 12.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: middle-end
Assignee: unassigned at gcc dot gnu.org
Reporter: rsandifo at gcc dot gnu.org
Target Milestone: ---
Compiling the following testcase with -march=armv8.2-a+sve -O2 -Wall:
--------------------------------------------------------------------
#include <arm_sve.h>
svuint64_t bar(svbool_t pg, const uint64_t *addr) {
return svget2(svld2_u64(pg, addr), 0);
}
--------------------------------------------------------------------
triggers:
foo.c:4:16: warning: using a dangling pointer to an unnamed temporary
[-Wdangling-pointer=]
4 | return svget2(svld2_u64(pg, addr), 0);
| ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
foo.c:4:16: note: unnamed temporary defined here
4 | return svget2(svld2_u64(pg, addr), 0);
| ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
This is because the code looks only at gassigns when tracking whether
a clobber has been overwritten, so it misses assignments by calls.
This seems to be different from PR104076.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug middle-end/104092] [12 Regression] Invalid -Wdangling-pointer warning after writes by calls
2022-01-18 11:12 [Bug middle-end/104092] New: [12 Regression] Invalid -Wdangling-pointer warning after writes by calls rsandifo at gcc dot gnu.org
@ 2022-01-18 11:12 ` rsandifo at gcc dot gnu.org
2022-01-18 11:53 ` rguenth at gcc dot gnu.org
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: rsandifo at gcc dot gnu.org @ 2022-01-18 11:12 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104092
rsandifo at gcc dot gnu.org <rsandifo at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |ASSIGNED
Ever confirmed|0 |1
Assignee|unassigned at gcc dot gnu.org |rsandifo at gcc dot gnu.org
Last reconfirmed| |2022-01-18
--- Comment #1 from rsandifo at gcc dot gnu.org <rsandifo at gcc dot gnu.org> ---
Testing a patch.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug middle-end/104092] [12 Regression] Invalid -Wdangling-pointer warning after writes by calls
2022-01-18 11:12 [Bug middle-end/104092] New: [12 Regression] Invalid -Wdangling-pointer warning after writes by calls rsandifo at gcc dot gnu.org
2022-01-18 11:12 ` [Bug middle-end/104092] " rsandifo at gcc dot gnu.org
@ 2022-01-18 11:53 ` rguenth at gcc dot gnu.org
2022-02-04 7:17 ` cvs-commit at gcc dot gnu.org
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-01-18 11:53 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104092
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |12.0
Keywords| |diagnostic
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug middle-end/104092] [12 Regression] Invalid -Wdangling-pointer warning after writes by calls
2022-01-18 11:12 [Bug middle-end/104092] New: [12 Regression] Invalid -Wdangling-pointer warning after writes by calls rsandifo at gcc dot gnu.org
2022-01-18 11:12 ` [Bug middle-end/104092] " rsandifo at gcc dot gnu.org
2022-01-18 11:53 ` rguenth at gcc dot gnu.org
@ 2022-02-04 7:17 ` cvs-commit at gcc dot gnu.org
2022-02-04 7:17 ` rguenth at gcc dot gnu.org
2022-02-04 8:09 ` cvs-commit at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-02-04 7:17 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104092
--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Richard Biener <rguenth@gcc.gnu.org>:
https://gcc.gnu.org/g:551aa75778a4c5165d9533cd447c8fc822f583e1
commit r12-7044-g551aa75778a4c5165d9533cd447c8fc822f583e1
Author: Richard Biener <rguenther@suse.de>
Date: Wed Feb 2 14:24:39 2022 +0100
Add CLOBBER_EOL to mark storage end-of-life clobbers
This adds a flag to CONSTRUCTOR nodes indicating that for
clobbers this marks the end-of-life of storage as opposed to
just ending the lifetime of the object that occupied it.
The dangling pointer diagnostics uses CLOBBERs but is confused
by those emitted by the C++ frontend for example which emits
them for the second purpose at the start of CTORs. The issue
is also appearant for aarch64 in PR104092.
Distinguishing the two cases is also necessary for the PR90348 fix.
Since I'm going to add another flag I added an enum clobber_flags
and a defaulted argument to build_clobber plus a convenient way to
query the enum from the CTOR tree and specify it for gimple_clobber_p.
Since 'CLOBBER' is already taken and I needed a name for the unspecified
clobber we have now I used 'CLOBBER_UNDEF'.
2022-02-03 Richard Biener <rguenther@suse.de>
PR middle-end/90348
PR middle-end/104092
gcc/
* tree-core.h (clobber_kind): New enum.
(tree_base::u::bits::address_space): Document use in CONSTRUCTORs.
* tree.h (CLOBBER_KIND): Add.
(build_clobber): Add clobber kind argument, defaulted to
CLOBBER_UNDEF.
* tree.cc (build_clobber): Likewise.
* gimple.h (gimple_clobber_p): New overload with specified kind.
* tree-streamer-in.cc (streamer_read_tree_bitfields): Stream
CLOBBER_KIND.
* tree-streamer-out.cc (streamer_write_tree_bitfields):
Likewise.
* tree-pretty-print.cc (dump_generic_node): Mark EOL CLOBBERs.
* gimplify.cc (gimplify_bind_expr): Build storage end-of-life
clobbers
with CLOBBER_EOL.
(gimplify_target_expr): Likewise.
* tree-inline.cc (expand_call_inline): Likewise.
* tree-ssa-ccp.cc (insert_clobber_before_stack_restore): Likewise.
* gimple-ssa-warn-access.cc (pass_waccess::check_stmt): Only treat
CLOBBER_EOL clobbers as ending lifetime of storage.
gcc/lto/
* lto-common.cc (compare_tree_sccs_1): Compare CLOBBER_KIND.
gcc/testsuite/
* gcc.dg/pr87052.c: Adjust.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug middle-end/104092] [12 Regression] Invalid -Wdangling-pointer warning after writes by calls
2022-01-18 11:12 [Bug middle-end/104092] New: [12 Regression] Invalid -Wdangling-pointer warning after writes by calls rsandifo at gcc dot gnu.org
` (2 preceding siblings ...)
2022-02-04 7:17 ` cvs-commit at gcc dot gnu.org
@ 2022-02-04 7:17 ` rguenth at gcc dot gnu.org
2022-02-04 8:09 ` cvs-commit at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-02-04 7:17 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104092
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|ASSIGNED |RESOLVED
--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
Should be fixed now.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug middle-end/104092] [12 Regression] Invalid -Wdangling-pointer warning after writes by calls
2022-01-18 11:12 [Bug middle-end/104092] New: [12 Regression] Invalid -Wdangling-pointer warning after writes by calls rsandifo at gcc dot gnu.org
` (3 preceding siblings ...)
2022-02-04 7:17 ` rguenth at gcc dot gnu.org
@ 2022-02-04 8:09 ` cvs-commit at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-02-04 8:09 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104092
--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Richard Sandiford <rsandifo@gcc.gnu.org>:
https://gcc.gnu.org/g:5b6370295d1efaa563f6d8c45f1fb779c3db452e
commit r12-7045-g5b6370295d1efaa563f6d8c45f1fb779c3db452e
Author: Richard Sandiford <richard.sandiford@arm.com>
Date: Fri Feb 4 08:08:59 2022 +0000
aarch64: Add test for PR104092
gcc/testsuite/
PR middle-end/104092
* gcc.target/aarch64/sve/acle/general/pr104092.c: New test.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-02-04 8:09 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-18 11:12 [Bug middle-end/104092] New: [12 Regression] Invalid -Wdangling-pointer warning after writes by calls rsandifo at gcc dot gnu.org
2022-01-18 11:12 ` [Bug middle-end/104092] " rsandifo at gcc dot gnu.org
2022-01-18 11:53 ` rguenth at gcc dot gnu.org
2022-02-04 7:17 ` cvs-commit at gcc dot gnu.org
2022-02-04 7:17 ` rguenth at gcc dot gnu.org
2022-02-04 8:09 ` cvs-commit at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).