This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/40078] passing label to inline asm "i" constraint generates bad code
- From: "pinskia at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 8 May 2009 22:52:26 -0000
- Subject: [Bug middle-end/40078] passing label to inline asm "i" constraint generates bad code
- References: <bug-40078-14600@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #1 from pinskia at gcc dot gnu dot org 2009-05-08 22:52 -------
This is by design, first inline-asm is not allowed to change control flow.
Second labels can be moved if they are not used normally in the program. In
this case they are not used normally. Addresses of labels are only designed
for computed gotos and any other use causes undefined behavior of their
placement.
Yes:
asm("jmp %0" : : "i"(&&some_label));
is valid as the address of a label is a constant but GCC does not look into the
string and how you use it.
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40078