https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106080
Bug ID: 106080 Summary: Labels as values triggering -Wdangling-pointer Product: gcc Version: 12.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: david at tarides dot com Target Milestone: --- Given file1.c: ``` char * caml_instr_base; void f (void) { return; } ``` and file2.c: ``` extern char * caml_instr_base; void f (void); int main (void) { lbl_ACC0: caml_instr_base = &&lbl_ACC0; /* Uncommenting this call suppresses the dangling-pointer warning */ /*f();*/ return 0; } ``` GCC 12.1.0 (run from the published images on Docker Hub) run with `gcc -Wall -c file1.c file2.c` gives: file2.c:6:19: warning: storing the address of local variable 'lbl_ACC0' in 'caml_instr_base' [-Wdangling-pointer=] The message is at least unclear (lbl_ACC0 is a label, not a local variable) and, further, if the call to f is uncommented then the warning completely disappears.