public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/99784] New: `labels as values`can point to the wrong spot after optimization
@ 2021-03-26 7:19 mh+gcc at glandium dot org
2021-03-26 7:20 ` [Bug c/99784] " mh+gcc at glandium dot org
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: mh+gcc at glandium dot org @ 2021-03-26 7:19 UTC (permalink / raw)
To: gcc-bugs
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!
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c/99784] `labels as values`can point to the wrong spot after optimization
2021-03-26 7:19 [Bug c/99784] New: `labels as values`can point to the wrong spot after optimization mh+gcc at glandium dot org
@ 2021-03-26 7:20 ` mh+gcc at glandium dot org
2021-03-26 7:43 ` pinskia at gcc dot gnu.org
2021-03-26 7:55 ` mh+gcc at glandium dot org
2 siblings, 0 replies; 4+ messages in thread
From: mh+gcc at glandium dot org @ 2021-03-26 7:20 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99784
--- Comment #1 from Mike Hommey <mh+gcc at glandium dot org> ---
This is reproducible with all versions of GCC on godbolt, including trunk.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c/99784] `labels as values`can point to the wrong spot after optimization
2021-03-26 7:19 [Bug c/99784] New: `labels as values`can point to the wrong spot after optimization mh+gcc at glandium dot org
2021-03-26 7:20 ` [Bug c/99784] " mh+gcc at glandium dot org
@ 2021-03-26 7:43 ` pinskia at gcc dot gnu.org
2021-03-26 7:55 ` mh+gcc at glandium dot org
2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-03-26 7:43 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99784
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |DUPLICATE
Status|UNCONFIRMED |RESOLVED
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Dup of bug 96956. This is undefined. See PR 96956 for the reason why.
*** This bug has been marked as a duplicate of bug 96956 ***
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c/99784] `labels as values`can point to the wrong spot after optimization
2021-03-26 7:19 [Bug c/99784] New: `labels as values`can point to the wrong spot after optimization mh+gcc at glandium dot org
2021-03-26 7:20 ` [Bug c/99784] " mh+gcc at glandium dot org
2021-03-26 7:43 ` pinskia at gcc dot gnu.org
@ 2021-03-26 7:55 ` mh+gcc at glandium dot org
2 siblings, 0 replies; 4+ messages in thread
From: mh+gcc at glandium dot org @ 2021-03-26 7:55 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99784
--- Comment #3 from Mike Hommey <mh+gcc at glandium dot org> ---
PR 96956 only really talks about this: "You may not use this mechanism to jump
to code in a different function. If you do that, totally unpredictable things
happen.".
My testcase doesn't involve jumping to the address.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-03-26 7:55 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-26 7:19 [Bug c/99784] New: `labels as values`can point to the wrong spot after optimization mh+gcc at glandium dot org
2021-03-26 7:20 ` [Bug c/99784] " mh+gcc at glandium dot org
2021-03-26 7:43 ` pinskia at gcc dot gnu.org
2021-03-26 7:55 ` mh+gcc at glandium dot 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).