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

            Bug ID: 93526
           Summary: x86-64: %c cannot be used in asm for "i" constraint
                    operand and arbitrary constant value
           Product: gcc
           Version: 9.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jbeulich at suse dot com
  Target Milestone: ---

In

//#define VAL 0x7fffffffUL // works
//#define VAL 0x80000000 // works, but produces -0x80000000L
#define VAL 0x80000000U // works, but produces -0x80000000L
//#define VAL -0x80000000L // works
//#define VAL 0x80000000L
//#define VAL 0x80000000UL
//#define VAL 0xffff80000000UL

unsigned long ul = VAL;

void test(void) {
  asm ( ".equ C1, %c0; .global C1" :: "i" (VAL) );
  asm ( ".equ C2, %c0; .global C2" :: "n" (VAL) );

  // these all work
  asm ( ".equ C3, -%n0; .global C3" :: "i" (VAL) );
  asm ( ".equ C4, %p0; .global C4" :: "i" (VAL) );
  asm ( ".equ C5, %P0; .global C5" :: "i" (VAL) );
}

play with the various values for VAL. The ones not marked "works" will produce
"operand is not a condition code" errors. But even among the ones that work
there looks to be a signedness issue with the produced constants in some cases.
(I realize the 'n' modifier is not documented. Perhaps it should be, or else
consider it here just for completeness.)

Reply via email to