This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug optimization/12108] wrong code generated in the presence of asm("...")
- From: "anton at a0 dot complang dot tuwien dot ac dot at" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 30 Aug 2003 17:20:53 -0000
- Subject: [Bug optimization/12108] wrong code generated in the presence of asm("...")
- References: <20030830095749.12108.anton@mips.complang.tuwien.ac.at>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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