public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: optimization/6806: gcc 3.0.4 ignoring clobbered registers in inline asm with -O1 or higher on i386
@ 2003-05-14 23:16 Dara Hazeghi
  0 siblings, 0 replies; 3+ messages in thread
From: Dara Hazeghi @ 2003-05-14 23:16 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR optimization/6806; it has been noted by GNATS.

From: Dara Hazeghi <dhazeghi@yahoo.com>
To: gcc-gnats@gcc.gnu.org, nobody@gcc.gnu.org
Cc:  
Subject: Re: optimization/6806: gcc 3.0.4 ignoring clobbered registers in inline asm with -O1 or higher on i386
Date: Wed, 14 May 2003 16:13:43 -0700

 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit- 
 trail&database=gcc&pr=6806
 
 Hello,
 
 this bug is still present on gcc 3.3 branch and mainline (20030511).
 
 Dara
 


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: optimization/6806: gcc 3.0.4 ignoring clobbered registers in inline asm with -O1 or higher on i386
@ 2002-05-28 10:16 rth
  0 siblings, 0 replies; 3+ messages in thread
From: rth @ 2002-05-28 10:16 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, michaelni, nobody

Synopsis: gcc 3.0.4 ignoring clobbered registers in inline asm with -O1 or higher on i386

State-Changed-From-To: open->analyzed
State-Changed-By: rth
State-Changed-When: Tue May 28 10:07:23 2002
State-Changed-Why:
    Confirmed still present in 3.1.0 compiling with -O1.
    
    Appears to be some sort of reload inheritence problem, since
    we have
            movl    f, %eax
            movl    %eax, -40(%ebp)
            ...
            addl %eax, %edx         
    #NO_APP
    
    I.e. F got copied to the stack as expected for a "g" input
    with not enough registers, but then we used eax in the asm
    anyway.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=6806


^ permalink raw reply	[flat|nested] 3+ messages in thread

* optimization/6806: gcc 3.0.4 ignoring clobbered registers in inline asm with -O1 or higher on i386
@ 2002-05-24 18:56 michaelni
  0 siblings, 0 replies; 3+ messages in thread
From: michaelni @ 2002-05-24 18:56 UTC (permalink / raw)
  To: gcc-gnats


>Number:         6806
>Category:       optimization
>Synopsis:       gcc 3.0.4 ignoring clobbered registers in inline asm with -O1 or higher on i386
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          wrong-code
>Submitter-Id:   net
>Arrival-Date:   Fri May 24 18:26:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Michael Niedermayer
>Release:        gcc version 3.0.4
>Organization:
>Environment:
Linux MichaelsNB 2.4.18custom1 #1 Mit Mai 15 23:14:08 CEST 2002 i686 unknown
output from gcc -v:
Reading specs from /usr/lib/gcc-lib/i386-linux/3.0.4/specs
Configured with: ../src/configure -v --enable-languages=c,c++,java,f77,proto,objc --prefix=/usr --infodir=/share/info --mandir=/share/man --enable-shared --with-gnu-as --with-gnu-ld --with-system-zlib --enable-long-long --enable-nls --without-included-gettext --disable-checking --enable-threads=posix --enable-java-gc=boehm --with-cpp-install-dir=bin --enable-objc-gc i386-linux
Thread model: posix
gcc version 3.0.4
>Description:
volatile int f=64;
...
		"addl %6, %0		\n\t"
		:"+r" (out)
		:"r" (a), "r" (b), "r" (c), "g" (d), "g" (e), "g"(f)
		: "%eax", "%esi"
	
gcc puts f into eax even though eax is on the clobberlist
>How-To-Repeat:
compile the attached file with gcc -O1 and run it
>Fix:
a possible workaround is to force specific registers instead of using "r"(...)
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: text/plain; name="gcc-test.i"
Content-Disposition: inline; filename="gcc-test.i"

# 1 "gcc-test.c"
volatile int out=1;
volatile int a=2;
volatile int b=4;
volatile int c=8;
volatile int d=16;
volatile int e=32;
volatile int f=64;

int main(){
        int err=0;
        asm volatile(
                "xorl %%eax, %%eax	\n\t"
                "xorl %%esi, %%esi	\n\t"
                "addl %1, %0		\n\t"
                "addl %2, %0		\n\t"
                "addl %3, %0		\n\t"
                "addl %4, %0		\n\t"
                "addl %5, %0		\n\t"
                "addl %6, %0		\n\t"
                :"+r" (out)
                :"r" (a), "r" (b), "r" (c), "g" (d), "g" (e), "g"(f)
                : "%eax", "%esi"
        );

        if(out==127){
                printf("test1: ok\n");
        }else{
                printf("test1: fail %d\n", 127-out);
                err++;
        }
        return err;
}


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-05-14 23:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-05-14 23:16 optimization/6806: gcc 3.0.4 ignoring clobbered registers in inline asm with -O1 or higher on i386 Dara Hazeghi
  -- strict thread matches above, loose matches on Subject: below --
2002-05-28 10:16 rth
2002-05-24 18:56 michaelni

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).