diff options
author | Marek Polacek <polacek@redhat.com> | 2023-02-14 17:05:44 -0500 |
---|---|---|
committer | Marek Polacek <polacek@redhat.com> | 2023-02-15 08:53:44 -0500 |
commit | d482b20fd346482635a770281a164a09d608b058 (patch) | |
tree | 897a39f43f2463b16356c01d500345598e220b74 /gcc/fortran | |
parent | 81f0945cd97cf0645c56b14827abad63164bd80c (diff) | |
download | gcc-d482b20fd346482635a770281a164a09d608b058.zip gcc-d482b20fd346482635a770281a164a09d608b058.tar.gz gcc-d482b20fd346482635a770281a164a09d608b058.tar.bz2 |
warn-access: wrong -Wdangling-pointer with labels [PR106080]
-Wdangling-pointer warns when the address of a label escapes. This
causes grief in OCaml (<https://github.com/ocaml/ocaml/issues/11358>) as
well as in the kernel:
<https://bugzilla.kernel.org/show_bug.cgi?id=215851> because it uses
#define _THIS_IP_ ({ __label__ __here; __here: (unsigned long)&&__here; })
to get the PC. -Wdangling-pointer is documented to warn about pointers
to objects. However, it uses is_auto_decl which checks DECL_P, but DECL_P
is also true for a label/enumerator/function declaration, none of which is
an object. Rather, it should use auto_var_p which correctly checks VAR_P
and PARM_DECL.
PR middle-end/106080
gcc/ChangeLog:
* gimple-ssa-warn-access.cc (is_auto_decl): Remove. Use auto_var_p
instead.
gcc/testsuite/ChangeLog:
* c-c++-common/Wdangling-pointer-10.c: New test.
* c-c++-common/Wdangling-pointer-9.c: New test.
Diffstat (limited to 'gcc/fortran')
0 files changed, 0 insertions, 0 deletions