[Bug driver/67301] Unable to compile program using extended assembly and asmSymbolicName

noloader at gmail dot com gcc-bugzilla@gcc.gnu.org
Fri Aug 21 05:11:00 GMT 2015


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

--- Comment #2 from Jeffrey Walton <noloader at gmail dot com> ---
(In reply to Andrew Pinski from comment #1)
> Try:
>  int main(int argc, char* argv[])
>   {
>       __asm__ __volatile__ (
> 
>             "\t movl %[__ARGC], %%eax \n"
>             :
>             : [__ARGC] "r" (argc)
>       );
> 
>       return 0;
>   }
> 
> Basically the syntax for naming operands is [XYZ] but since it is optional,
> [ is used to say it is optional part of the syntax.  Yes it is slightly
> confusing but that is what you get when you use [] as both part of the
> actual syntax and saying it is an optional part.

Oh, I see. Yes, that's confusing. 

When I read it, I thought the double square brackets were a typo that should
have read something like the following, meaning the asmSymbolicName is optional
(which it is):

    [ [asmSymbolicName] constraint (cexpression) ]


Perhaps the docs should call that out specifically to avoid confusion?



More information about the Gcc-bugs mailing list