From: Eric Rudd Newsgroups: comp.os.msdos.djgpp Subject: Possible gcc bug Date: Tue, 09 Jun 1998 10:40:59 -0500 Organization: CyberOptics Lines: 29 Message-ID: <357D578B.1088A0F9@cyberoptics.com> Reply-To: rudd AT cyberoptics DOT com NNTP-Posting-Host: rudd.cyberoptics.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk I have isolated what I think is a register-allocation bug in gcc v2.7.2.1 having to do with incorrect handling of extended asm. I would appreciate feedback from others as to what is wrong here. The little subroutine does nothing useful in its condensed form besides illustrating the problem. I compiled with gcc -O2 -S bad.c -o bad.lst Attached to this message is the contents of "bad.lst". Compiling without -O2 produces different code, but also incorrect. void alias(int arg1, int arg2, int *arg3, int *arg4) { /* The problem with this code is that gcc aliases arg3 to arg4, so arg3 never gets set. */ asm (" xorl %0, %0 xorl %1, %1 xorl %%ecx, %%ecx " : "=a" (*arg3), /* Results */ "=d" (*arg4) : "0" (arg1), /* Input args */ "b" (arg2) : "%ecx" /* Clobbered registers */ ); } -Eric Rudd rudd AT cyberoptics DOT com