public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/54529] New: dead code elimination deletes code adressed by referenced labels
@ 2012-09-08 16:07 Wasserthal at nefkom dot net
2012-09-08 16:37 ` [Bug c/54529] " pinskia at gcc dot gnu.org
2024-03-16 18:06 ` pinskia at gcc dot gnu.org
0 siblings, 2 replies; 3+ messages in thread
From: Wasserthal at nefkom dot net @ 2012-09-08 16:07 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54529
Bug #: 54529
Summary: dead code elimination deletes code adressed by
referenced labels
Classification: Unclassified
Product: gcc
Version: 4.6.3
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: Wasserthal@nefkom.net
given the code:
extern void __attribute__((sysv_abi)) breakfree(long long input);
void submaker(long long input)
{
breakfree(input);
}
void mainloop()
{
goto skipper;
;
hidden:
printf("Hello");
asm("nop; nop; int3; int3; int3; int3; int3; nop; nop; nop; nop");
asm("ret");
exit(1);
skipper:
submaker(&&hidden);
}
(breakfree is an assembler snippet that sets the basepointer to the one of the
over-overliying function and calls the parameter.)
the problem is that any stuff between ,,hidden'' and ,,skipper'' is removed.
there is no 90 90 CC CC CC CC CC 90 90 90 90 in the resulting elf binary.
Problem: there is no safe work-around because you cannot switch off dead code
elimination even on -O0!
you cannot declare the labels as extern, either.
The problem disappears when you add one calculated goto jump to the function,
but if that should not be taken, it is eliminated, too!
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c/54529] dead code elimination deletes code adressed by referenced labels
2012-09-08 16:07 [Bug c/54529] New: dead code elimination deletes code adressed by referenced labels Wasserthal at nefkom dot net
@ 2012-09-08 16:37 ` pinskia at gcc dot gnu.org
2024-03-16 18:06 ` pinskia at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2012-09-08 16:37 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54529
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> 2012-09-08 16:36:59 UTC ---
Addresses of labels are only designed to work with computed gotos.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c/54529] dead code elimination deletes code adressed by referenced labels
2012-09-08 16:07 [Bug c/54529] New: dead code elimination deletes code adressed by referenced labels Wasserthal at nefkom dot net
2012-09-08 16:37 ` [Bug c/54529] " pinskia at gcc dot gnu.org
@ 2024-03-16 18:06 ` pinskia at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-03-16 18:06 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54529
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|INVALID |DUPLICATE
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
.
*** This bug has been marked as a duplicate of bug 44298 ***
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-03-16 18:06 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-08 16:07 [Bug c/54529] New: dead code elimination deletes code adressed by referenced labels Wasserthal at nefkom dot net
2012-09-08 16:37 ` [Bug c/54529] " pinskia at gcc dot gnu.org
2024-03-16 18:06 ` pinskia 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).