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]

Code generation bug in EGCS-1.1b h8300-hms-crosscompiler


Hi!

The following program compiles wrong with "h8300-hms-gcc -mh main.c":

    float f;

    int main()
    {
      f = 1.23;
      while(1);
    }

The disassembled code is (objdump --disassemble main.o):

main.o:     file format coff-h8300

Disassembly of section .text:

00000000 <_main>:
   0:   01 00 6d f6     01 00 6d f6       mov.l er6,@-er7
   4:   0f f6           0f f6             mov.l er7,er6
   6:   01 00 6b 02     01 00 6b 02 00 00 mov.l @0x0:16,er2        <---- BUG!!!
   a:   00 00
   c:   01 00 6b a2     01 00 6b a2 00 00 00 00 mov.l   er2,@0x0:32
  10:   00 00 00 00

00000014 <.L2>:
  14:   40 00           40 00             bra   .0 (16)
  16:   40 00           40 00             bra   .0 (18)

00000018 <.L4>:
  18:   40 00           40 00             bra   .0 (1a)

0000001a <.L1>:
  1a:   01 00 6d 76     01 00 6d 76       mov.l @er7+,er6
  1e:   54 70           54 70             rts

In the linked program it is:

Disassembly of section .text:

000410f6 <.LC0>:
   410f6:       3f 9d           3f 9d             mov.b r7l,@0x9d:8 <--- This is 1.23 (I hope)
   410f8:       70 a4           70 a4        .word      H'70,H'a4
...

0004114e <_main>:
   4114e:       01 00 6d f6     01 00 6d f6       mov.l er6,@-er7
   41152:       0f f6           0f f6             mov.l er7,er6
   41154:       01 00 6b 02     01 00 6b 02 10 f6 mov.l @0x10f6:16,er2  <--- Here is the bug
   41158:       10 f6
   4115a:       01 00 6b a2     01 00 6b a2 00 04 11 bc mov.l er2,@0x411bc:32
   4115e:       00 04 11 bc
...

The problem is, that egcs uses the 16 bit adressing mode and cuts the upper
part of the address.

I'm using egcs-1.1b on linux.

Does anybody have a patch for this problem? What about gcc-2.8.1?

Thanks,

Manni



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