public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/106080] New: Labels as values triggering -Wdangling-pointer
@ 2022-06-24 14:30 david at tarides dot com
  2022-06-24 14:43 ` [Bug middle-end/106080] " pinskia at gcc dot gnu.org
                   ` (12 more replies)
  0 siblings, 13 replies; 14+ messages in thread
From: david at tarides dot com @ 2022-06-24 14:30 UTC (permalink / raw)
  To: gcc-bugs

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.

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2023-02-15 17:39 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-24 14:30 [Bug middle-end/106080] New: Labels as values triggering -Wdangling-pointer david at tarides dot com
2022-06-24 14:43 ` [Bug middle-end/106080] " pinskia at gcc dot gnu.org
2022-10-22  1:45 ` pinskia at gcc dot gnu.org
2023-02-14 21:58 ` mpolacek at gcc dot gnu.org
2023-02-14 22:01 ` pinskia at gcc dot gnu.org
2023-02-14 22:05 ` pinskia at gcc dot gnu.org
2023-02-14 22:06 ` pinskia at gcc dot gnu.org
2023-02-14 22:12 ` mpolacek at gcc dot gnu.org
2023-02-14 23:07 ` pinskia at gcc dot gnu.org
2023-02-14 23:21 ` jakub at gcc dot gnu.org
2023-02-14 23:25 ` mpolacek at gcc dot gnu.org
2023-02-15 13:57 ` cvs-commit at gcc dot gnu.org
2023-02-15 17:39 ` cvs-commit at gcc dot gnu.org
2023-02-15 17:39 ` mpolacek 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).