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

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Nick Desaulniers from comment #3)
> Thanks for the feedback. I guess I was expecting these two to be somewhat
> equivalent:
> 
> void x (int a) {
>     if (a)
>         asm("# %0"::"i"(__COUNTER__));
>     else
>         asm("# %0"::"i"(__COUNTER__));
> }
> 
> void y (int a) {
>     if (a)
>         asm("# %=");
>     else
>         asm("# %=");
> }

They are not. I was just about going to suggest the use of __COUNTER__ as the
correct way of implementing the inline-asm also.

For GCC, %= gets resolved at the very end of compiling when outputting the asm
to the output file.

GCC does touch the string or look into the inline-asm string during compiling
except to duplicate it or to see if it is an exact match (remove duplicates).

Reply via email to