This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug inline-asm/11203] source doesn't compile with -O0 but they compile with -O3
- From: "xyzzy at speakeasy dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 27 Feb 2007 19:36:06 -0000
- Subject: [Bug inline-asm/11203] source doesn't compile with -O0 but they compile with -O3
- References: <bug-11203-1507@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #38 from xyzzy at speakeasy dot org 2007-02-27 19:36 -------
(In reply to comment #37)
> now if there is a unwritten rule that "m" operands and variations of them
> cannot be copied anywhere, then it would be very desireable to have a asm
> constraint like "m" without this restriction this would resolve this and
> several other bugs
> also it would be very nice if such a dont copy restriction on "m" if it does
> exist could be documented
Copying "m" operands onto the stack might not be such a great thing to wish
for. Imagine if you used asm("movaps %xmm0, %0": "=m"(x[i])); If x[i] is only
32-bits, and gcc copied it onto the stack, then writing 16 bytes with movaps
wouldn't also write to x[i+1] to x[i+3] as intended. I know there is a plenty
of asm code in ffmpeg that overwrites or overreads memory operands and will
fail if gcc tried to move them onto the stack. There is also alignment.
movaps requires an aligned address, and maybe you have chosen x and i in such a
way that it will be aligned. But when gcc copies the value onto the stack, how
is it supposed to know what alignment it needs?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11203