target/8554: gcc-3.2 m68k-elf gets ICE

pbarada@mail.wm.sps.mot.com pbarada@mail.wm.sps.mot.com
Tue Nov 12 12:36:00 GMT 2002


>Number:         8554
>Category:       target
>Synopsis:       gcc-3.2 m68k-elf gets ICE
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          ice-on-legal-code
>Submitter-Id:   net
>Arrival-Date:   Tue Nov 12 12:36:01 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     Peter Barada
>Release:        3.2.1 20021111 (prerelease)
>Organization:
>Environment:
System: Linux hyper.wm.sps.mot.com 2.4.2-2 #1 Sun Apr 8 20:41:30 EDT 2001 i686 unknown
Architecture: i686

	
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: m68k-unknown-elf
configured with: /home/pbarada/work/cvs-gnu/gcc-3.2-now/gcc/configure --target=m68k-elf --prefix=/tmp/junk-3.2 --enable-languages=c,c++ --with-local-prefix=/tmp/junk-3.2/m68k-elf --with-newlib
>Description:
	gcc-3.2.1 20021111 --taret=m68k-elf generates an ICE while
	trying to reload the following instruction:

	(insn 23 21 24 (set (reg/v/f:SI 38)
        (mem/f:SI (plus:SI (reg/f:SI 14 %a6)
                (const_int 12 [0xc])) [3 S4 A8])) 30 {movsi_cfv4} (nil)
	    (nil))

	In this case, SI 38 becomes a stack slot(since errno_save has
        to be saved across the call to fwrite), so the insn is rewritten as:

	(insn 23 21 24 (set (mem:SI (plus:SI (reg/f:SI 14 %a6)
        	        (const_int -32780 [0xffff7ff4])) [15 start S4 A8])
        (mem/f:SI (plus:SI (reg/f:SI 14 %a6)
                (const_int 12 [0xc])) [3 S4 A8])) 30 {movsi_cfv4} (nil)
	    (nil))

	But the offset to -32780 is too far for 68k mode 5 addressing,
        so reload pushes the 32780 into %d0(via isn 591), and rewrites
        the insn as: 

	(insn 591 21 23 (set (reg:SI 0 %d0)
	        (const_int -32780 [0xffff7ff4])) 30 {movsi_cfv4} (nil)
	    (nil))

	(insn 23 591 24 (set (mem:SI (plus:SI (reg/f:SI 14 %a6)
                (reg:SI 0 %d0)) [60 start S4 A8])
        (mem/f:SI (plus:SI (reg/f:SI 14 %a6)
                (const_int 12 [0xc])) [5 S4 A8])) 30 {movsi_cfv4} (nil)
	    (nil))

	Which is now illegal for the 68k architecturesince the
        destination operand can not be mode 6 addressing if the source
        operand is mode 5, so an ICE is	generated since this insn is
        not recognizable. 
>How-To-Repeat:
	m68k-elf-gcc -O2 -S the following sourcefile:

typedef unsigned int size_t;
typedef struct _IO_FILE FILE;
extern size_t fwrite (__const void *__restrict __ptr, size_t __size,
                      size_t __n, FILE *__restrict __s) ;
extern int ferror (FILE *__stream) ;
extern int *__errno_location (void) __attribute__ ((__const__));
extern void error (int status, int errnum, const char *format, ...)
     __attribute__ ((__format__ (__printf__, 3, 4)));
enum {  __LC_MESSAGES = 5, };
extern char *__dcgettext (const char *__domainname,
                          const char *__msgid, int __category)
     __attribute__ ((__format_arg__ (2)));
extern char *__dcgettext (const char *__domainname,
                          const char *__msgid, int __category);
extern const char _libc_intl_domainname[];
typedef void *iconv_t;
extern size_t iconv (iconv_t __cd, char **__restrict __inbuf,
                     size_t *__restrict __inbytesleft,
                     char **__restrict __outbuf,
                     size_t *__restrict __outbytesleft);
int process_block (iconv_t cd, char *addr, size_t len, FILE *output);
int
process_block (iconv_t cd, char *addr, size_t len, FILE *output)
{
  const char *start = addr;
  char outbuf[32768];
  char *outptr;
  size_t outlen;
  size_t n;
  while (len > 0)
    {
      outptr = outbuf;
      outlen = 32768;
      n = iconv (cd, &addr, &len, &outptr, &outlen);
      if (outptr != outbuf)
        {
          int errno_save = (*__errno_location ());
          if (fwrite (outbuf, 1, outptr - outbuf, output) < outptr - outbuf
              || ferror (output))
            {
              error (0, 0, __dcgettext (_libc_intl_domainname, ("conversion stopped due to problem in writing the output"), __LC_MESSAGES));
              return -1;
            }
          (*__errno_location ()) = errno_save;
        }
      if (n != (size_t) -1)
        {
          outptr = outbuf;
          outlen = 32768;
          (void) iconv (cd, ((void *)0), ((void *)0), &outptr, &outlen);
          if (outptr != outbuf)
            {
              int errno_save = (*__errno_location ());
              if (fwrite (outbuf, 1, outptr - outbuf, output) < outptr - outbuf
                  || ferror (output))
                {
                  error (0, 0, __dcgettext (_libc_intl_domainname, ("conversion stopped due to problem in writing the output"), __LC_MESSAGES));
                  return -1;
                }
              (*__errno_location ()) = errno_save;
            }
          break;
        }
      if ((*__errno_location ()) != 7)
        {
          switch ((*__errno_location ()))
            {
            case 84:
              error (0, 0, __dcgettext (_libc_intl_domainname, ("illegal input sequence at position %ld"), __LC_MESSAGES),
                     (long) (addr - start));
              break;
            case 22:
              error (0, 0, __dcgettext (_libc_intl_domainname, ("incomplete character or shift sequence at end of buffer"), __LC_MESSAGES));
              break;
            case 9:
              error (0, 0, __dcgettext (_libc_intl_domainname, ("internal error (illegal descriptor)"), __LC_MESSAGES));
              break;
            default:
              error (0, 0, __dcgettext (_libc_intl_domainname, ("unknown iconv() error %d"), __LC_MESSAGES), (*__errno_location ()));
              break;
            }
          return -1;
        }
    }
  return 0;
}

>Fix:
	
>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the Gcc-bugs mailing list