[Bug c/104886] New: -Wdangling-pointer= prints internal MEM and (D) names in warnings
slyfox at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Mar 11 23:36:41 GMT 2022
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104886
Bug ID: 104886
Summary: -Wdangling-pointer= prints internal MEM and (D) names
in warnings
Product: gcc
Version: 12.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: slyfox at gcc dot gnu.org
Target Milestone: ---
Noticed internal names on libuv-1.43.0. Here is the minimal example:
//$ cat a.c
struct uv_stream_s {
int io_watcher;
void *write_completed_queue[];
};
void uv__write_callbacks(struct uv_stream_s *stream) {
int pq;
if (*(int **)stream->write_completed_queue)
;
*(int **)stream->write_completed_queue[0] = &pq;
}
$ gcc -std=gnu89 -fno-strict-aliasing -c a.c -Wall -O2
a.c: In function 'uv__write_callbacks':
a.c:10:45: warning: storing the address of local variable 'pq' in '*(int
**)MEM[(int * *)stream_2(D) + 8B]' [-Wdangling-pointer=]
10 | *(int **)stream->write_completed_queue[0] = &pq;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
a.c:7:7: note: 'pq' declared here
7 | int pq;
| ^~
a.c:8:7: note: '((int **)stream)[1]' declared here
8 | if (*(int **)stream->write_completed_queue)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Note: "note: " looks like a reasonable expression while "warning: " contains
internal names.
$ gcc -v
Using built-in specs.
COLLECT_GCC=/<<NIX>>/gcc-12.0.0/bin/gcc
COLLECT_LTO_WRAPPER=/<<NIX>>/gcc-12.0.0/libexec/gcc/x86_64-unknown-linux-gnu/12.0.1/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with:
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 12.0.1 20220306 (experimental) (GCC)
More information about the Gcc-bugs
mailing list