This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: [Bug inline-asm/11103] [3.3/3.4 regression] asm-specifier conflicts with asm clobber list
- From: Hans-Peter Nilsson <hp at bitrange dot com>
- To: Richard dot Earnshaw at arm dot com
- Cc: gcc-bugzilla at gcc dot gnu dot org, <dhazeghi at yahoo dot com>, <gcc-bugs at gcc dot gnu dot org>
- Date: Sun, 15 Jun 2003 19:17:16 -0400 (EDT)
- Subject: Re: [Bug inline-asm/11103] [3.3/3.4 regression] asm-specifier conflicts with asm clobber list
On Mon, 9 Jun 2003, Richard Earnshaw wrote:
> gcc-bugzilla@gcc.gnu.org said:
> > Confirmed with gcc 3.3 and mainline (20030608). I think this belongs
> > in the inline-asm category though. Richard, would you mind commenting
> > on whether the code in question is legal? Thanks,
>
> The error is perfectly correct, as I see it, and the manual supports this
> view:
Agreed. (Whew, I don't have to argue for it again. :-)
> Note, I think the whole asm construct here is somewhat bogus, the compiler
> could legitimately produce the following code for it and claim that it has
> met the "specification" requested:
No it can't. It is written in stone^W^Win the manual that
asm-declared registers that feed into asms in the source aren't
moved around and renamed by GCC to appear in different registers
in the asm. Modulo GCC bugs, of course, so I suggest add checks
in the asm. See for example gcc.dg/asmreg-1.c.
> stmfd sp!, {r4, lr}
> mov r3, r1 // myr1 into safe registers (myr1 is now dead).
> mov r4, r2
> mov r1, r0
> // Input registers are r1, r3 and r4. Output regs are r1 (tied to input)
> bl __put_user_1 // User's asm instruction
> mov r0, r1 // Assign r1 result (from asm) to res.
> ldmfd sp!, {r4, pc}
>
> The key point here is that nothing in the ASM can say which specific
> register an input argument must appear in or where the result will be
By feeding specific asm-declared variables, it does.
> returned -- that might be a weakness in the way our ASM is specified, but
> that is life.
It would be, if it wasn't documented to work (Explicit Reg
Vars):
These local variables are sometimes convenient for use with the
extended @code{asm} feature (@pxref{Extended Asm}), if you want
to write one output of the assembler instruction directly into a
particular register. (This will work provided the register you
specify fits the constraints specified for that operand in the
@code{asm}.)
Maybe it can bw said in stronger words, but it *is* documented.
brgds, H-P
PS. I'm a week behind on list traffic.