https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99784

            Bug ID: 99784
           Summary: `labels as values`can point to the wrong spot after
                    optimization
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mh+gcc at glandium dot org
  Target Milestone: ---

Reduced testcase:
```
extern void bar();
extern void qux(void*);
void foo() {
    bar();
here:
    qux(&&here);
}
```
Resulting code at -O2:
```
foo():
.LFB0:
.L2:
        sub     rsp, 8
        call    bar()
.LVL0:
        mov     edi, OFFSET FLAT:.L2
        add     rsp, 8
        jmp     qux(void*)
```

IOW, the pointer that qux gets is that of a location before the call to bar!

Reply via email to