[Bug optimization/12108] wrong code generated in the presence of asm("...")
anton at a0 dot complang dot tuwien dot ac dot at
gcc-bugzilla@gcc.gnu.org
Sat Aug 30 17:20:00 GMT 2003
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12108
------- Additional Comments From anton at a0 dot complang dot tuwien dot ac dot at 2003-08-30 17:20 -------
Subject: Re: wrong code generated in the presence of asm("...")
pinskia at gcc dot gnu dot org wrote:
> I think the code is wrong because the asm is not marked as volatile so the schedular is free to
> move it around.
No: from the gcc manual (node Extended asm):
| An `asm' instruction without any operands or clobbers (an "old
|style" `asm') will be treated identically to a volatile `asm'
|instruction.
> Can you try this:
> int foo(int);
> main()
> {
> if(foo(0)!=16)
> abort();
> }
> int y;
> int foo(int x)
> {
> if (x) {
> label1:
> asm volatile (".skip 16"); /* or ".space 16" or somesuch */
> label2:
> ;
> }
> return (&&label2)-(&&label1);
> }
Same result.
- anton
More information about the Gcc-bugs
mailing list