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

Jeffrey A Law law@upchuck.cygnus.com
Fri Apr 9 00:51:00 GMT 1999


  In message <FCF5ECA039A1D111A02808002BE647CB647FB3@mail.peektraffic.nl>you wr
ite:
  > 
  > 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
I just tried this with the current sources and it does not generate the
bogus pea instruction.  Similarly for the egcs-1.2 release.

I'm pretty sure this problem has been fixed, probably by one of the fixes
to GO_IF_LEGITIMATE_ADDRESS.

Thanks,
jeff


More information about the Gcc-bugs mailing list