This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Problem with EGCS compiler (egcs-2.91.57 19980901 (egcs-1.1 release) m68k-coff-gcc)



Hello,

I am using the egcs as a cross-compiler (from PC to 68k) and I found
something that could be a problem. I hope you can take a look at it.
Furthermore I have a question which I will ask first.

I would like to have output from the compiler containing the original
source code and the generated assembler code. I tried this with the
option "-Wa,-ahls,-a=stip_pun_tmp.log" but this only produces normal
assembler code (see also the gcc command at the end of this mail). What
do I have to do the get the combined output file?


The problem I found was in the following piece of code:

unsigned long stip_get_eta(int eta_point, unsigned long *eta)
{
    return (*eta - (time(0) % 86300) + 86400) % 86500;
}

which is a bit small but should be OK. (time(0) on our implementation
returns the time in seconds, so this is piece of code should do
something to get a time within a day. In the original code 86300 and
86500 were both 86400, but to make the problem clearer I changed this to
different values).

This resulted however in the following assembler code

stip_get_eta:
	link.w %a6,#0
	move.l %a2,-(%sp)
	move.l 12(%a6),%a2
	clr.l -(%sp)
	jsr time
	move.l #86300,-(%sp)
	move.l %d0,-(%sp)
	jsr __modsi3
	addq.l #8,%sp
	move.l (%a2),%a0
	sub.l %d0,%a0
	move.l #86500,-(%sp)
	pea 86400(%a0)          <<<<<<<<<<<<<
	jsr __umodsi3
	move.l -4(%a6),%a2
	unlk %a6
	rts

which in turn produced the following error report:
Error: displacement too large for this architecture; needs 68020 or
higher -- statement `pea 86400(%a0)' ignored

If I change the code to:

unsigned long stip_get_eta(int eta_point, unsigned long *eta)
{
    return (*eta + 86400 - (time(0) % 86300)) % 86500;
}
(move the ' + 86400' in front of the first mod operator)

the resulting assembler code is:

stip_get_eta:
	link.w %a6,#0
	move.l %a2,-(%sp)
	move.l 12(%a6),%a2
	clr.l -(%sp)
	jsr time
	move.l #86300,-(%sp)
	move.l %d0,-(%sp)
	jsr __modsi3
	addq.l #8,%sp
	add.l #-86400,%d0
	move.l #86500,-(%sp)
	move.l (%a2),%a2
	sub.l %d0,%a2
	move.l %a2,-(%sp)
	jsr __umodsi3
	move.l -4(%a6),%a2
	unlk %a6
	rts

And this code seems to be OK.

The commands I use are:

gcc -b m68k-coff -O2 -m68000 -Wa,-ahls,-a=stip_pun_tmp.log -D
DEBUG_SYMS_TEXT -Wall -save-temps -v -I ../headers_euro -I
/m68k-coff/include -I ../include -D ANSI_C -D IVS_EURO -D PTS -D
SYS_APL_ID=2 -D SYS_APL_VERS=0x0000 -D FILM_BUFFER_SIZE=45 -D
FIRM_RAMDISK_SIZE=6 -D DEBUG_MOBI -D DEBUG_DGPS -D DEBUG_OPER -D
DEBUG_PRIO -D DEBUG_PADI -D DEBUG_STIP -D DEBUG_LOCP -D DEBUG_XFER -D
DEBUG_TABL >> c68.log 2>&1   -c stip_pun_tmp.c -o stip_pun_tmp.o

Reading specs from
E:\UTIL\CYGNUS\CYGWIN~1\H-I586~1\BIN\..\lib\gcc-lib\m68k-coff\egcs-2.91.
57\specs


gcc version egcs-2.91.57 19980901 (egcs-1.1 release)


 
E:\UTIL\CYGNUS\CYGWIN~1\H-I586~1\BIN\..\lib\gcc-lib\m68k-coff\egcs-2.91.
57\cpp.exe -lang-c -v -I ../headers_euro -I /m68k-coff/include -I
../include -iprefix
E:\UTIL\CYGNUS\CYGWIN~1\H-I586~1\BIN\..\lib/gcc-lib/m68k-coff\egcs-2.91.
57\ -undef -D__GNUC__=2 -D__GNUC_MINOR__=91 -Dmc68000 -D__embedded__
-D__mc68000__ -D__embedded__ -D__mc68000 -Asystem(embedded)
-Amachine(mc68000) -D__OPTIMIZE__ -Wall -D DEBUG_SYMS_TEXT -D ANSI_C -D
IVS_EURO -D PTS -D SYS_APL_ID=2 -D SYS_APL_VERS=0x0000 -D
FILM_BUFFER_SIZE=45 -D FIRM_RAMDISK_SIZE=6 -D DEBUG_MOBI -D DEBUG_DGPS
-D DEBUG_OPER -D DEBUG_PRIO -D DEBUG_PADI -D DEBUG_STIP -D DEBUG_LOCP -D
DEBUG_XFER -D DEBUG_TABL stip_pun_tmp.c stip_pun_tmp.i


GNU CPP version egcs-2.91.57 19980901 (egcs-1.1 release) (68k, Motorola
syntax)
#include "..." search starts here:
#include <...> search starts here:
 ..\headers_euro
 \m68k-coff\include
 ..\include
 
E:\UTIL\CYGNUS\CYGWIN~1\H-I586~1\BIN\..\lib\gcc-lib\m68k-coff\egcs-2.91.
57\include
End of search list.
 
E:\UTIL\CYGNUS\CYGWIN~1\H-I586~1\BIN\..\lib\gcc-lib\m68k-coff\egcs-2.91.
57\cc1.exe stip_pun_tmp.i -quiet -dumpbase stip_pun_tmp.c -m68000 -O2
-Wall -version -o stip_pun_tmp.s


GNU C version egcs-2.91.57 19980901 (egcs-1.1 release) (m68k-coff)
compiled by GNU C version 2.7-B19.
stip_pun_tmp.c: In function `stip_get_eta':
stip_pun_tmp.c:4: warning: implicit declaration of function `time'
 
E:\UTIL\CYGNUS\CYGWIN~1\H-I586~1\BIN\..\lib\gcc-lib\m68k-coff\egcs-2.91.
57\..\..\..\..\m68k-coff\bin\as.exe -m68000 -ahls -a=stip_pun_tmp.log -o
stip_pun_tmp.o stip_pun_tmp.s


stip_pun_tmp.s: Assembler messages:
stip_pun_tmp.s:20: Error: displacement too large for this architecture;
needs 68020 or higher -- statement `pea 86400(%a0)' ignored
gcc: file path prefix
`\cygnus\cygwin-b20\H-i586-cygwin32\lib\gcc-lib\m68k-coff\egcs-2.91.57\'
never used

I do not know if something similar was already reported, I checked the
EGCS-Bug-list but did not find anything similar.
I did not compile the compiler myself, but used the compiler package
from http://www.calm.hw.ac.uk/davidf/coldfire with the B20.1 release of
cygwin32.

          Johan Borkhuis

--
J.A. Borkhuis, Product Manager Public Transport Systems
Peek Traffic B.V, Basicweg 16
P.O. Box 2542, 3800 GB Amersfoort NL
Tel.: (+31)-33-454 1970, Fax: (+31)-33-454 1973




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]