[Bug c/11413] New: -ffixed registers on powerpc optimized incorrectly

dmk at rscheme dot org gcc-bugzilla@gcc.gnu.org
Wed Jul 2 19:08: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=11413

           Summary: -ffixed registers on powerpc optimized incorrectly
           Product: gcc
           Version: 3.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: dmk at rscheme dot org
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: powerpc-ibm-aix5.1.0.0
  GCC host triplet: powerpc-ibm-aix5.1.0.0
GCC target triplet: powerpc-ibm-aix5.1.0.0

GCC 3.3 on RS6000/PowerPC is incorrectly optimizing registers declared -ffixed,
which RScheme uses for virtual machine registers.  In particular, the compiler
does not recognize that a call an external procedure may clobber a register
which was declared -ffixed. I've reduced it to a small example which exhibits 
the problem.  With -O0, the problem is not exhibited.

This affects the default RScheme 0.7.3.3 build (ftp://ftp.rscheme.org/priv/b/rs-
0.7.3.3-b8.tar.gz)

I will attach the source and preprocessor output.  I included the portion
of the assembly output (below) that I believe is in error (see the ### comment)

----------------------------[gcc invocation]-----------------
bash-2.04$ gcc -v -save-temps -ffixed-18 -ffixed-19 -O2 test.c
Reading specs from /usr/local/lib/gcc-lib/powerpc-ibm-aix5.1.0.0/3.3/specs
Configured with: /tmp/gcc-3.3/configure 
Thread model: aix
gcc version 3.3
 /usr/local/lib/gcc-lib/powerpc-ibm-aix5.1.0.0/3.3/cc1 -E -quiet -v -
D__GNUC__=3 -D__GNUC_MINOR__=3 -D__GNUC_PATCHLEVEL__=0 test.c -ffixed-18 -
ffixed-19 -O2 test.i
ignoring nonexistent directory "NONE/include"
ignoring nonexistent directory "/usr/local/powerpc-ibm-aix5.1.0.0/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include
 /usr/local/lib/gcc-lib/powerpc-ibm-aix5.1.0.0/3.3/include
 /usr/include
End of search list.
 /usr/local/lib/gcc-lib/powerpc-ibm-aix5.1.0.0/3.3/cc1 -fpreprocessed test.i -
quiet -dumpbase test.c -auxbase test -O2 -version -ffixed-18 -ffixed-19 -o 
test.s
GNU C version 3.3 (powerpc-ibm-aix5.1.0.0)
        compiled by GNU C version 3.3.
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
 as -u -mcom -o test.o test.s
 /usr/local/lib/gcc-lib/powerpc-ibm-aix5.1.0.0/3.3/collect2 -bpT:0x10000000 -
bpD:0x20000000 -btextro -bnodelcsect /lib/crt0.o -L/usr/local/lib/gcc-
lib/powerpc-ibm-aix5.1.0.0/3.3 -L/usr/local/lib/gcc-lib/powerpc-ibm-
aix5.1.0.0/3.3/../../.. test.o /usr/local/lib/gcc-lib/powerpc-ibm-
aix5.1.0.0/3.3/libgcc.a /usr/local/lib/gcc-lib/powerpc-ibm-
aix5.1.0.0/3.3/libgcc_eh.a -lc /usr/local/lib/gcc-lib/powerpc-ibm-
aix5.1.0.0/3.3/libgcc.a /usr/local/lib/gcc-lib/powerpc-ibm-
aix5.1.0.0/3.3/libgcc_eh.a
------------------------------------------------------
.foo:
        .extern __mulh
        .extern __mull
        .extern __divss
        .extern __divus
        .extern __quoss
        .extern __quous
        mflr 0
        mr 19,18
        stw 0,8(1)
        stwu 1,-56(1)
        bl .quux        # (this call clobbers reg 18)
        nop
        li 3,0
        andi. 0,18,3 ############# <--- this should reference register 19!
        bne- 0,L..3
L..1:
        addi 1,1,56
        lwz 0,8(1)
        mtlr 0
        blr
L..3:
        bl .blech
        nop
        b L..1



More information about the Gcc-bugs mailing list