This is the mail archive of the gcc-bugs@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]

Bug in m68k gcc-2.95.2?


Hello, gcc maintainers!

I'm trying to add a new target, m68k-uclinux-elf to
gcc and I have a trouble which seems to be a part of some bug.

It seems like ADDRESS_REG_P macros sometimes mistakes :

here is a sample code :

void
longjmp (sigjmp_buf env, int val)
{
  if (env[0].__mask_was_saved)
    (void) sigprocmask (SIG_SETMASK, &env[0].__saved_mask,
                          (sigset_t *) NULL);
  /* Compiling this "if" gcc generates ill code */

  __longjmp (env[0].__jmpbuf, val ?: 1);
}

After compiling
m68k-uclinux-elf-gcc -O2 -m68000 -msoft-float -D__linux__ -I../include
-I.   -c longjmp.c -o longjmp.o

the assembly is
longjmp.o:     file format elf32-m68k

Disassembly of section .text:
00000000 <longjmp>:
   0:   4e56 0000       linkw %fp,#0
   4:   2f0a            movel %a2,%sp@-
   6:   246e 0008       moveal %fp@(8),%a2
   a:   4aaa 003c       tstl %a2@(60)
                        ^^^^^^^^^^^^^
   e:   6714            beqs 24 <longjmp+0x24>
  10:   42a7            clrl %sp@-
  12:   486a 0040       pea %a2@(64)
  16:   4878 0002       pea 2 <longjmp+0x2>
  1a:   4eb9 0000 0000  jsr 0 <longjmp>
  20:   4fef 000c       lea %sp@(12),%sp
  24:   202e 000c       movel %fp@(12),%d0
  28:   6602            bnes 2c <longjmp+0x2c>
  2a:   7001            moveq #1,%d0
  2c:   2f00            movel %d0,%sp@-
  2e:   2f0a            movel %a2,%sp@-
  30:   4eb9 0000 0000  jsr 0 <longjmp>
  36:   4e71            nop
Disassembly of section .data:

The compiler generated tstl a2, it is illegal for 68000, afaik.

I found out that it happends because while compiling this code
in insn-output5 checking ADDRESS_ERG_P was false...

The most strange thing is that in gcc-2.95.1 everithing was fine,
and i didnot find any changes in m68k code between .1 and .2

Sincerelly Yours, Alexander Komarov.


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