This is GCC Bugzilla
This is GCC Bugzilla Version 2.20+
View Bug Activity | Format For Printing | Clone This Bug
There is no way to specify a constraint for an operand of an asm statement that may only be a destination operand (ie. the first operand of the st insn). If you try to use the "m" constraint together with the %P operand modifier you can get invalid asm code when %P expands to a register instead of a number. For example, the Linux kernel uses this asm statement: asm volatile ("\n[1:]\tst"#n" %1=%r2%P1\t// %0 gets overwritten by exception handler\n" "\t.xdata4 \"__ex_table\", 1b-., 1f-.\n" "[1:]" : "=r"(__pu_r8) : "m"(__m(addr)), "rO"(val), "0"(__pu_r8)); Occassionally you'll get an assembler error because the POST_MODIFY is expanded into a register.
Confirmed. I believe 25008 will have to be fixed before we can add a working constraint letter for this. It should be possible to generate a testcase for this by taking the example from 25008, changing the "S" to an "m", and then changing foo to a valid store instruction syntax so as to get the desired assembler error. I'll worry about that later when I need a testcase.