IÂ’d like to be able to write toplevel inline assembly with C operands that are
compile-time constants, e.g.

static const char foo[] = "Hello, world!";
enum { bar = 17 };
asm(".pushsection baz; .long %c0, %c1, %c2; .popsection"
    : : "i" (foo), "i" (sizeof(foo)), "i" (bar));

However, this currently fails with “error: expected ‘)’ before ‘:’ token” at
the top level, even though it works fine inside a function.


-- 
           Summary: Extended asm with C operands doesnÂ’t work at top level
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: anders at kaseorg dot com


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

Reply via email to