[Bug middle-end/40078] passing label to inline asm i constraint generates bad code

2010-09-20 Thread ebotcazou at gcc dot gnu dot org


--- Comment #4 from ebotcazou at gcc dot gnu dot org  2010-09-20 22:12 
---
GCC 4.5 now supports asm gotos.


-- 

ebotcazou at gcc dot gnu dot org changed:

   What|Removed |Added

 CC||ebotcazou at gcc dot gnu dot
   ||org
 Status|UNCONFIRMED |RESOLVED
 Resolution||WONTFIX
   Target Milestone|--- |4.5.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40078



[Bug middle-end/40078] passing label to inline asm i constraint generates bad code

2010-03-20 Thread mirq-gccboogs at rere dot qmqm dot pl


--- Comment #3 from mirq-gccboogs at rere dot qmqm dot pl  2010-03-21 01:08 
---
In case you're still interested, there is 'asm goto' coming in gcc 4.5.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40078



[Bug middle-end/40078] passing label to inline asm i constraint generates bad code

2009-05-08 Thread pinskia 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



[Bug middle-end/40078] passing label to inline asm i constraint generates bad code

2009-05-08 Thread scovich at gmail dot com


--- Comment #2 from scovich at gmail dot com  2009-05-08 23:24 ---
Sorry to bring this back up, but I'm not sure if comments show up in a
meaningful way on closed bugs...

1. where does is it documented that inline asm can't change control flow? I
can't find it in the info pages, nor anywhere in google except this bug and
another which was also resolved-invalid with a comment that it's clearly
commented. The docs say you can do control flow within a single asm (if your
assembler supports local labels), but the only other mention is the part that
says you can't jump between asm blocks because the compiler has no way to know
that you did it.

2. It makes sense that anything related to stack frames (ret, call) would be a
snake pit, but is there some reason why local gotos are inherently unsafe?
Unlike an asm-asm jump, the compiler knows all the places control might go (you
can only jump out once, after all), and presumably users wouldn't pass in
labels they don't intend to use. It seems like the compiler could just treat
the asm block accepting labels as a basic block containing a computed goto --
control could fall out the bottom of the block or jump any of the labels which
were passed in. 

3. Supporting local gotos would help work around the annoyance of getting
condition codes out of an asm block efficiently -- pass in the label to a
branch instruction and voila!

In any case, I'm happy to accept a, go away, but would be extremely
interested to hear the reasons behind this limitation given that it seems so
close to working on accident.


-- 

scovich at gmail dot com changed:

   What|Removed |Added

 Status|RESOLVED|UNCONFIRMED
 Resolution|INVALID |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40078