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

--- Comment #3 from Stas Sergeev <stsp at users dot sourceforge.net> ---
I can't use inline-asm gotos because
I can't manipulate such a label in a portable way.
For example:
---
    asm volatile (
        "push $1f\n"
        "ret\n"
        "1:\n"
    );
---

This won't work with -pie.
But if I do "r"(&&ret) then the rip-relative
reference is generated so pie works.

> See PR 29305 and others too on why this is undefined.

>From that PR I can only see that its undefined
because the documentation didn't define such use,
at best. I am not sure it immediately means "undefined".
---
You may not use this mechanism to jump to code in a different function.
If you do that, totally unpredictable things will happen. The best way
to avoid this is to store the label address only in automatic variables
and never pass it as an argument. 
---
Not sure if I violated that.
I pass it as an argument to an inline asm only -
does this count as passing as an argument or what?
I suppose they meant "as an argument to a function".
Inline asm is not a function.

Anyway:
- What is the point to misplace the label that is obviously (for gcc) used?
- Why clang have no problem with that code?

Reply via email to