Incorrect assembler code generated for target h8300-hitachi-coff

Stefan.Becker@nmp.nokia.com Stefan.Becker@nmp.nokia.com
Mon Jul 27 02:10:00 GMT 1998


Hi!

I'm trying to compile gcc 2.8.1/egcs 1.0.3a as a cross-compiler for the
target h8300-hitachi-coff on the host platform hppa1.1-hp-hpux10.20.
While compiling the C library package "newlib" the compiler generates
incorrect assembler code which causes gas to fail. The faulty lines look
like this:

        mov.b   r4l,r4hn        mov.b   r5h,r4l
                       ^ This looks like a \n without the \!

When I replace the "n" with "\n" the code assembles just fine. I have
been trying to identify the place in the code where "n" is generated
errorneously instead of "\n" but I couldn't find it (insn_output.c looks
OK to me...). The machine configuration for h8300 is slightely different
for gcc/egcs but updating the gcc to the egcs one didn't fix the problem,
because BOTH compilers fail at the same place.

I'll attach one example file from newlib-1.8.1 which fails to compile but
there are more of them.

Configuration:

    ../src/configure --prefix=/appl/hpux10/gcc
                     --with-gnu-as --with-gnu-ld --with-newlib
                     --target=h8300-hitachi-coff

Compilation:

     gmake CFLAGS=-O2 CXXFLAGS=-O2 LANGUAGES="c c++" (cross for egcs)

Version information:

 misc/unix/gcc/build/gcc-2.8.1/h8300-hitachi-coff/gcc/xgcc -v
 Using builtin specs.
 gcc version 2.8.1

 misc/unix/gcc/build/egcs-1.0.3a/h8300-hitachi-coff/gcc/xgcc -v
 Using builtin specs.
 gcc version egcs-2.90.29 980515 (egcs-1.0.3 release)

Example compilation:

/home/stefanb/misc/unix/gcc/build/gcc-2.8.1/h8300-hitachi-coff/gcc/xgcc
-B/home/stefanb/misc/unix/gcc/build/gcc-2.8.1/h8300-hitachi-coff/gcc/
-idirafter
/home/stefanb/misc/unix/gcc/build/gcc-2.8.1/h8300-hitachi-coff/h8300-hit
achi-coff/newlib/targ-include -idirafter
/home/stefanb/misc/unix/gcc/build/gcc-2.8.1/src/newlib/libc/include
-nostdinc -O2  -O2 -DSMALL_DTOA -DSMALL_MEMORY -fno-builtin
-I/home/stefanb/misc/unix/gcc/build/gcc-2.8.1/h8300-hitachi-coff/h8300-h
itachi-coff/newlib/./targ-include
-I/home/stefanb/misc/unix/gcc/build/gcc-2.8.1/src/newlib/./libc/include
-c ../../../../../src/newlib/libm/math/ef_fmod.c -v
Reading specs from
/home/stefanb/misc/unix/gcc/build/gcc-2.8.1/h8300-hitachi-coff/gcc/specs
gcc version 2.8.1
 /home/stefanb/misc/unix/gcc/build/gcc-2.8.1/h8300-hitachi-coff/gcc/cpp
-lang-c -nostdinc -v
-I/home/stefanb/misc/unix/gcc/build/gcc-2.8.1/h8300-hitachi-coff/h8300-h
itachi-coff/newlib/./targ-include
-I/home/stefanb/misc/unix/gcc/build/gcc-2.8.1/src/newlib/./libc/include
-isystem
/home/stefanb/misc/unix/gcc/build/gcc-2.8.1/h8300-hitachi-coff/gcc/inclu
de -undef -D__GNUC__=2 -D__GNUC_MINOR__=8 -D__LONG_MAX__=2147483647L
-D__LONG_LONG_MAX__=2147483647L -D__LONG_MAX__=2147483647L
-D__LONG_LONG_MAX__=2147483647L -D__CHAR_UNSIGNED__ -D__OPTIMIZE__
-D__H8300__ -D__SIZE_TYPE__=unsigned int -D__PTRDIFF_TYPE__=int
-Acpu(h8300) -Amachine(h8300) -D__INT_MAX__=32767 -DSMALL_DTOA
-DSMALL_MEMORY -idirafter
/home/stefanb/misc/unix/gcc/build/gcc-2.8.1/h8300-hitachi-coff/h8300-hit
achi-coff/newlib/targ-include -idirafter
/home/stefanb/misc/unix/gcc/build/gcc-2.8.1/src/newlib/libc/include
../../../../../src/newlib/libm/math/ef_fmod.c /var/tmp/cca04439.i
GNU CPP version 2.8.1 (Hitachi H8/300)
#include "..." search starts here:
#include <...> search starts here:
 /home/stefanb/misc/unix/gcc/build/gcc-2.8.1/h8300-hitachi-coff/h8300-hi
tachi-coff/newlib/targ-include
 /home/stefanb/misc/unix/gcc/build/gcc-2.8.1/src/newlib/libc/include
 /home/stefanb/misc/unix/gcc/build/gcc-2.8.1/h8300-hitachi-coff/gcc/incl
ude
 /home/stefanb/misc/unix/gcc/build/gcc-2.8.1/h8300-hitachi-coff/h8300-hi
tachi-coff/newlib/targ-include
 /home/stefanb/misc/unix/gcc/build/gcc-2.8.1/src/newlib/libc/include
End of search list.
 /home/stefanb/misc/unix/gcc/build/gcc-2.8.1/h8300-hitachi-coff/gcc/cc1
/var/tmp/cca04439.i -quiet -dumpbase ef_fmod.c -O2 -O2 -version
-fno-builtin -o /var/tmp/cca04439.s
GNU C version 2.8.1 (h8300-hitachi-coff) compiled by GNU C version 2.8.1.
 /home/stefanb/misc/unix/gcc/build/gcc-2.8.1/h8300-hitachi-coff/gcc/as -o
ef_fmod.o /var/tmp/cca04439.s
/var/tmp/cca04340.s: Assembler messages:
/var/tmp/cca04340.s:135: Error: invalid operands
/var/tmp/cca04340.s:203: Error: invalid operands

I have attached the preprocessed file (-E -o ef_fmod.i) and the resulting
assembler file (-S -o ef_fmod.s).

Regards,

	Stefan

---
Stefan Becker
E-Mail: Stefan.Becker@nmp.nokia.com


More information about the Gcc-bugs mailing list