https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93952
Bug ID: 93952 Summary: Giving an array in an operand Product: gcc Version: unknown Status: UNCONFIRMED Keywords: ABI, accepts-invalid, documentation Severity: normal Priority: P3 Component: inline-asm Assignee: unassigned at gcc dot gnu.org Reporter: frederic.recou...@univ-grenoble-alpes.fr Target Milestone: --- I am trying to understand the meaning of giving an array in an operand of an inline assembly statement. Please consider the following small snippet of code: int main (int argc, char * argv[]) { char t[] = "abc"; int x; __asm__ ("movl %1, %0" : "=r" (x) : "r" (t)); return x; } Here are my observation and my understanding: The object t that has type "array of char" is converted to an expression with type "pointer to char" that points to the initial element of t. It is equivalent to: x = (int) &t[0]; If we change the constraint "r" to "m", the result is different. Here is the limit of my understanding and it is only speculation: The constraint "m" take the address of t, but as it is an array, it actually returns it unchanged and then it access to the value pointed by. It is like: x = (int) *(/*&*/(&t[0])); Now I wonder if the code where we replace the constraint by "rm" is valid because the returned value depends of the constraint the compiler have chosen. In my mind, I would have expected that "m" constraint pass the same value but in a way it is accessible through memory, that is: char *p = t; x = (int) *(&p); Could someone point me out where I am going wrong here?