From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jeffrey A Law To: Paul Koning Cc: egcs@cygnus.com, Linus Torvalds Subject: Re: Linux and EGCS Date: Mon, 15 Dec 1997 07:49:00 -0000 Message-id: <28786.882200973@hurl.cygnus.com> References: <9712121715.AA19735@kona.> X-SW-Source: 1997-12/msg00838.html In message <9712121715.AA19735@kona.>you write: > >>>>> "Jeffrey" == Jeffrey A Law writes: > > Jeffrey> Can either of you re-send me a testcase for the problem of > Jeffrey> moving asm statements with no outputs? I'd like to take a > Jeffrey> look at this proble over the weekend if possible. > > Attached is one I concocted out of one of our source files, where I > first spotted the problem. I don't remember if this particular file > shows it when compiled for an x86 target (I think it doesn't; I do > remember that it definitely does not show the problem on a sparc > target). It WILL show it on a mips64 target (when compiled -O3) OK. Thanks. Interesting, from what I can find, it looks like gcc-2.7 worked correctly more by accident than by design. Particularly in the scheduler. Seems to me the easiest and most correct fix is to set the volatile bit on an asm which has no outputs. Can you try this change and let me know if it fixes your problems? If so I'd like to include it in egcs-1.0.1. * stmt.c (expand_asm_operands): If an ASM has no outputs, then treat it as volatile. Index: stmt.c =================================================================== RCS file: /cvs/cvsfiles/egcs/gcc/stmt.c,v retrieving revision 1.10 diff -c -3 -p -r1.10 stmt.c *** stmt.c 1997/12/11 16:26:01 1.10 --- stmt.c 1997/12/15 15:44:17 *************** expand_asm_operands (string, outputs, in *** 1421,1426 **** --- 1421,1430 ---- /* The insn we have emitted. */ rtx insn; + /* An ASM with no outputs needs to be treated as volatile. */ + if (noutputs == 0) + vol = 1; + if (output_bytecode) { error ("`asm' is invalid when generating bytecode");