public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* GCC3.4.0-20040406 bug report
@ 2004-04-09  5:26 Kenji Mugita
  2004-04-21  2:58 ` Jim Wilson
  0 siblings, 1 reply; 2+ messages in thread
From: Kenji Mugita @ 2004-04-09  5:26 UTC (permalink / raw)
  To: gcc-bugs


---------------------------------
the exact version of GCC;
---------------------------------

GCC3.4.0-20040406 for SH

---------------------------------
the system type;
---------------------------------
Cygwin on Win2000

---------------------------------
the options given when GCC was configured/built;
------------------------------------------------
Reading specs from /usr/local/lib/gcc/sh-elf/3.4.0/specs
Configured with: ../configure --target=sh-elf --prefix=/usr/local --enable-languages=c++ --with-newlib --with-headers=/usr/src/newlib-1.10.0/newlib/libc/include
Thread model: single
gcc version 3.4.0 20040407 (prerelease)

------------------------------------------------
the complete command line that triggers the bug;
------------------------------------------------
sh-elf-gcc -O2 -m3 -ml -I/usr/local/jde/SH3/sh7727/include -include C:\Cygwin\usr\local\jde\SH3\sh7727\00\options.inc -c io.c -o io.o

------------------------------------------------
the compiler output (error messages, warnings, etc.); and
-----------------------------------------------------
io.c: In function `Interrupt_error':
io.c:59: internal compiler error: in output_stack_adjust, at config/sh/sh.c:4606
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.

--------------------------------------------------
the preprocessed file (*.i*) that triggers the bug,
--------------------------------------------------

# 1 "io.c"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "/usr/local/jde/SH3/sh7727/00/options.inc" 1
# 2 "<command line>" 2
# 1 "io.c"
# 12 "io.c"
# 1 "/usr/local/lib/gcc/sh-elf/3.4.0/include/limits.h" 1 3 4
# 11 "/usr/local/lib/gcc/sh-elf/3.4.0/include/limits.h" 3 4
# 1 "/usr/local/lib/gcc/sh-elf/3.4.0/include/syslimits.h" 1 3 4

# 1 "/usr/local/lib/gcc/sh-elf/3.4.0/include/limits.h" 1 3 4
# 122 "/usr/local/lib/gcc/sh-elf/3.4.0/include/limits.h" 3 4
# 1 "/usr/local/lib/gcc/sh-elf/3.4.0/../../../../sh-elf/sys-include/limits.h" 1 3 4

# 1 "/usr/local/lib/gcc/sh-elf/3.4.0/../../../../sh-elf/sys-include/newlib.h" 1 3 4
# 5 "/usr/local/lib/gcc/sh-elf/3.4.0/../../../../sh-elf/sys-include/limits.h" 2 3 4
# 123 "/usr/local/lib/gcc/sh-elf/3.4.0/include/limits.h" 2 3 4
# 8 "/usr/local/lib/gcc/sh-elf/3.4.0/include/syslimits.h" 2 3 4
# 12 "/usr/local/lib/gcc/sh-elf/3.4.0/include/limits.h" 2 3 4
# 13 "io.c" 2

# 1 "/usr/local/jde/SH3/sh7727/include/sh7727.h" 1
# 10 "/usr/local/jde/SH3/sh7727/include/sh7727.h"
typedef unsigned char BYTE;
typedef unsigned short WORD;
typedef unsigned long LWORD;
# 15 "io.c" 2


# 1 "io.h" 1
# 63 "io.h"
int _xreadx(int mode, int *err);
LWORD CheckRom(void);
# 18 "io.c" 2
# 1 "flash8M.h" 1

int WriteToFlash8M(char *dat, LWORD addr,int wsize);
int EraseFlash8M(LWORD addr);
int CheckFlash8M(LWORD addr);
# 19 "io.c" 2
# 34 "io.c"
LWORD LoadAddr = 0;

#pragma interrupt int_trap
void int_trap(void)
{
     xputs("Interrupt Trap..\r\n");
}

void Interrupt_error(void)
{
  char buff[1024];
  unsigned int *ExpAddr;
  int *ExpCode;

  ExpCode = (int *)0x0c0003f0;
  ExpAddr = (unsigned int *)0x0c0003f8;

}


void reserved_vector(void)
{
     xputs("Reserved_Vector Trap. Reboot..\r\n");
     asm ("mov %0,r10; jmp @r10"::"r"(0x1000));
}

void err_slot_op(void)
{
     LWORD pc;

     asm ("mov.l @(4,r15),r10; mov.l r10,@%0":"=g"(pc));
     xputs("\r\nSlot opration Error. Reboot.. PC=");
     puthxl(pc);
     xputs("\r\n");
     asm ("mov %0,r10; jmp @r10"::"r"(0x1000));
}

int err_illegal_op(void)
{
     LWORD w;

     asm ("mov.l @(24,r15),r10 ; mov r10,%0":"=g"(w)::"r10");
     xputs("\r\nIllegal Opcode Error.. PC=");
     puthxl(w);
     asm ("mov r15,%0":"=g"(w):);
     xputs(" SP="); puthxl(w);
     xputs("\r\n");
     asm ("mov %0,r10; jmp @r10"::"r"(0x1000));
}

void err_cpu_addr(void)
{
     LWORD w;

     asm ("mov.l @(24,r15),r10 ; mov r10,%0":"=g"(w)::"r10");
     xputs("\r\nAddress Error. Reboot.. PC=");
     puthxl(w);
     asm ("mov r15,%0":"=g"(w):);
     xputs(" SP="); puthxl(w);
     xputs("\r\n");
     asm ("mov %0,r10; jmp @r10"::"r"(0x1000));
}

void err_dma_addr(void)
{
     LWORD pc;

     asm ("mov.l @(4,r15),r10; mov.l r10,@%0":"=g"(pc));
     xputs("\r\nDMA Address Error. Reboot.. PC=\r\n");
     puthxl(pc);
     xputs("\r\n");
     asm ("mov %0,r10; jmp @r10"::"r"(0x1000));
}

void int_nmi(void)
{
     LWORD pc;

     asm ("mov.l @(4,r15),r10; mov.l r10,@%0":"=g"(pc));
     xputs("\r\nNMI Occuerd. Reboot.. PC=");
     puthxl(pc);
     xputs("\r\n");
     asm ("mov %0,r10; jmp @r10"::"r"(0x1000));
}

void int_break(void)
{
     LWORD pc;

     asm ("mov.l @(4,r15),r10; mov.l r10,@%0":"=g"(pc));
     xputs("\r\nUser Break. Reboot.. PC=");
     puthxl(pc);
     xputs("\r\n");
     asm ("mov %0,r10; jmp @r10"::"r"(0x1000));
}




const WORD crctable[(127 * 2 + 1)+1] =
{
  0x0000,0x1021,0x2042,0x3063,0x4084,0x50a5,0x60c6,0x70e7,
  0x8108,0x9129,0xa14a,0xb16b,0xc18c,0xd1ad,0xe1ce,0xf1ef,
  0x1231,0x0210,0x3273,0x2252,0x52b5,0x4294,0x72f7,0x62d6,
  0x9339,0x8318,0xb37b,0xa35a,0xd3bd,0xc39c,0xf3ff,0xe3de,
  0x2462,0x3443,0x0420,0x1401,0x64e6,0x74c7,0x44a4,0x5485,
  0xa56a,0xb54b,0x8528,0x9509,0xe5ee,0xf5cf,0xc5ac,0xd58d,
  0x3653,0x2672,0x1611,0x0630,0x76d7,0x66f6,0x5695,0x46b4,
  0xb75b,0xa77a,0x9719,0x8738,0xf7df,0xe7fe,0xd79d,0xc7bc,
  0x48c4,0x58e5,0x6886,0x78a7,0x0840,0x1861,0x2802,0x3823,
  0xc9cc,0xd9ed,0xe98e,0xf9af,0x8948,0x9969,0xa90a,0xb92b,
  0x5af5,0x4ad4,0x7ab7,0x6a96,0x1a71,0x0a50,0x3a33,0x2a12,
  0xdbfd,0xcbdc,0xfbbf,0xeb9e,0x9b79,0x8b58,0xbb3b,0xab1a,
  0x6ca6,0x7c87,0x4ce4,0x5cc5,0x2c22,0x3c03,0x0c60,0x1c41,
  0xedae,0xfd8f,0xcdec,0xddcd,0xad2a,0xbd0b,0x8d68,0x9d49,
  0x7e97,0x6eb6,0x5ed5,0x4ef4,0x3e13,0x2e32,0x1e51,0x0e70,
  0xff9f,0xefbe,0xdfdd,0xcffc,0xbf1b,0xaf3a,0x9f59,0x8f78,
  0x9188,0x81a9,0xb1ca,0xa1eb,0xd10c,0xc12d,0xf14e,0xe16f,
  0x1080,0x00a1,0x30c2,0x20e3,0x5004,0x4025,0x7046,0x6067,
  0x83b9,0x9398,0xa3fb,0xb3da,0xc33d,0xd31c,0xe37f,0xf35e,
  0x02b1,0x1290,0x22f3,0x32d2,0x4235,0x5214,0x6277,0x7256,
  0xb5ea,0xa5cb,0x95a8,0x8589,0xf56e,0xe54f,0xd52c,0xc50d,
  0x34e2,0x24c3,0x14a0,0x0481,0x7466,0x6447,0x5424,0x4405,
  0xa7db,0xb7fa,0x8799,0x97b8,0xe75f,0xf77e,0xc71d,0xd73c,
  0x26d3,0x36f2,0x0691,0x16b0,0x6657,0x7676,0x4615,0x5634,
  0xd94c,0xc96d,0xf90e,0xe92f,0x99c8,0x89e9,0xb98a,0xa9ab,
  0x5844,0x4865,0x7806,0x6827,0x18c0,0x08e1,0x3882,0x28a3,
  0xcb7d,0xdb5c,0xeb3f,0xfb1e,0x8bf9,0x9bd8,0xabbb,0xbb9a,
  0x4a75,0x5a54,0x6a37,0x7a16,0x0af1,0x1ad0,0x2ab3,0x3a92,
  0xfd2e,0xed0f,0xdd6c,0xcd4d,0xbdaa,0xad8b,0x9de8,0x8dc9,
  0x7c26,0x6c07,0x5c64,0x4c45,0x3ca2,0x2c83,0x1ce0,0x0cc1,
  0xef1f,0xff3e,0xcf5d,0xdf7c,0xaf9b,0xbfba,0x8fd9,0x9ff8,
  0x6e17,0x7e36,0x4e55,0x5e74,0x2e93,0x3eb2,0x0ed1,0x1ef0
};

WORD crc1(int n, BYTE c[])
{
  WORD r;

  r = 0;
  while(--n >= 0)
   r = (r << 8) ^
    crctable[(BYTE)(r >> (16 - 8)) ^ *c++];
  return r;
}
# 214 "io.c"
const char HeaderMark[16] = "JSD ROM_Monitor\0";

LWORD CheckProgramSub(BYTE *ap, int prompt)
{
     int i;
     LWORD sad,size;
     WORD crc,crc0;
     BYTE *p;

     for(i=0; i<16; i++){
         if( HeaderMark[i] != *(ap+i)) return 0;
     }

     for(p=ap+16, sad=0; p < ap+20; p++){
         sad = sad * 0x100 + (LWORD)*p;
     }

     for(p=ap+20, size=0; p < ap+24 ; p++){
         size = size * 0x100 + (LWORD)*p;
     }

     crc = (LWORD)*(ap+24) * 0x100 + (LWORD)*(ap+25);
     crc0 = crc1(size, (void*)sad);

     if(prompt){
         xputs("\r\nFind Header Mark at ");
         puthxl((LWORD)ap);
         xputs("\r\nProgram Start at ");
         puthxl(sad);
         xputs("\r\nProgram Size is ");
         puthxl(size);
         if(crc == crc0) xputs("\r\nCRC OK.");
         else{
             xputs("\r\nCRC ERROR crc =");
             puthxw(crc);
             xputs(", crc0=");
             puthxw(crc0);
         }
         xputs("\r\nDATE : ");
         xputs(ap + 32);
         xputs("\r\nFILE NAME : ");
         xputs(ap + 50);
         xputs("\r\n");
     }

     if(crc != crc0){
         return(0);
     }
  return sad;
}


LWORD CheckProgram(LWORD addr, int prompt)
{
     BYTE *ap;
     LWORD r;


     if( addr ){
         ap = (BYTE*)addr;
         r = CheckProgramSub(ap, prompt);
         if( r ) return r;
  }

     if( LoadAddr ){
         ap = (BYTE*)LoadAddr;
         r = CheckProgramSub(ap, prompt);
         if( r ) return r;
  }

     for(ap=(BYTE*)0x08000; ap < (BYTE*)0x3ff00; ap += 0x1000){
         r = CheckProgramSub(ap, prompt);
         if( r ) return r;
  }

     for(ap=(BYTE*)0x200000; ap < (BYTE*)(0x200000 +0x080000 -1); ap += 0x1000){
         r = CheckProgramSub(ap, prompt);
         if( r ) return r;
  }
  return(0);
}


void RunUserProgram(void)
{
     int r;
     LWORD ap;




  if(r==0){
      ap = CheckProgram(0,0);
         if(0<ap){
             asm volatile ("mov %0,r11; stc sr,r10; or r11,r10; ldc r10,sr"::"r"((0xf0)):"r10","r11");
             asm volatile ("mov %0,r10\n jmp @r10; nop"::"r"(ap));
         }
     }
}
# 321 "io.c"
int SysRead(int file, char *ptr, int len)
{
     int i;

     if( len < 0 )return consts();
     for(i=0; i<len; i++) *ptr++ = conin();
}


int SysWrite(int file, char *ptr, int len)
{
     int i;
     for(i=0; i<len; i++) conout(*ptr++);
}
# 431 "io.c"
void init(void)
{
     IntMskSet(10);
     IntBLSet(0);
  (*(volatile unsigned short *)0xa4000104) = 0xaa9a;
  (*(volatile unsigned char *)0xa4000124) = 0x0000;
  init_serial();


}
# 479 "io.c"
int _ReadX(BYTE *buf, LWORD *addr, int *typ, int LittleEndian)
{
     char s[64];
  WORD crc,crc0;
  int i,r,d,size,err;
  BYTE *p;

  r = 0;
  crc = 0;
  size = 0;
  *typ = -1;




  for(err=0;;err++){
   d = conin();
   if((BYTE)d == 0x01){
    buf[0] = d;
    size = 128;
    break;
         }else if((BYTE)d == 0x02){
    buf[0] = d;
    size = 1024;
    break;
         }else if((BYTE)d == 0x03){

             return -4;
         }
         if(10 < err){
             r = -3;
             for(i=0; i<128; i++){
                if(consts()) conin();
             }
             goto Xend_of_func;
   }
  }
  r = size;



  for(p=buf+1; ;){
   d = conin();
   *p++ = (BYTE)d;
   if((buf+size+8) <= p) break;
  }



  crc = crc1(size+6, buf);
  crc0 = buf[size+6];
  crc0 = (crc0 << 8) | buf[size+7];
  if(crc != crc0){
   r = -2;
   goto Xend_of_func;
  }



  *typ = (int)buf[1];



  *addr = ((LWORD)buf[2] << 24)
         +((LWORD)buf[3] << 16)
         +((LWORD)buf[4] << 8)
         +((LWORD)buf[5]);



  for(i=0; i<size; i+=2){
      if(LittleEndian){
       buf[i] = buf[i+7];
       buf[i+1] = buf[i+6];
      }else{
       buf[i] = buf[i+6];
       buf[i+1] = buf[i+7];
      }
  }
Xend_of_func:
  return(r);
}






int _xreadx(int mode, int *err)
{
     BYTE BlockData[1024 +16];
  int i,r,r0,t,err0,siz,ofs;
     LWORD addr,sad;


     sad = 0xffffffff;

  for(siz=0,*err=0;;){
         r = _ReadX(&BlockData[0], &addr, &t, 0);
         if( 0 < r ){
             switch(mode){
               case 1:
                 if( (addr < 0x200000)||((0x200000 +0x080000 -1) < addr) ){
                     xputs("\r\nError. Address is not in RAM area. address=");
                     puthxl(addr);
                     xputs("\r\n");
                     *err = -2;
                     for(i=0; i<10; i++)conout(0x18);
                     return 0;
                 }
                 break;
         case 3:
                 if( (addr < 0x08000)||(0x3ff00 < addr) ){
                     xputs("\r\nError. Address is not in ROM area. address=");
                     puthxl(addr);
                     xputs("\r\n");
                     *err = -2;
                     for(i=0; i<10; i++)conout(0x18);
                     return 0;
                 }
                 break;
    }
         }
   if( ( 0 <= r )&&( t == 0) ){
    break;
   }
         if(0 < r){
             if( (0 < addr)&&(addr < sad) ) sad = addr;
             switch(mode){
               case 1:
     for(i=0; i<r; i++)
      *(BYTE*)(addr+i) = BlockData[i];
           break;
               case 2:
     for(i=0,err0=0; i<r; i++){
      if(BlockData[i] != *(BYTE*)(i+addr)){
       err0++;
      }
     }
     *err += err0;
     break;
         case 3:
                 for(r0=0; r0 < r; r0 += 128){

                     if(*err < 0 ){
             conout(0x18);
             return siz;
                     }
                 }
                 break;
    }
    siz += r;
    conout(0x06);
   }else if( (r == -1)||(r == -4) ){
       break;
         }else{
    conout(0x15);
   }
  }
  LoadAddr = sad;
  return siz;
}




---------------------------------------------------
Kenji Mugita(JSD)
mugita@jsdkk.com


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: GCC3.4.0-20040406 bug report
  2004-04-09  5:26 GCC3.4.0-20040406 bug report Kenji Mugita
@ 2004-04-21  2:58 ` Jim Wilson
  0 siblings, 0 replies; 2+ messages in thread
From: Jim Wilson @ 2004-04-21  2:58 UTC (permalink / raw)
  To: Kenji Mugita; +Cc: gcc-bugs

Kenji Mugita wrote:
> io.c: In function `Interrupt_error':
> io.c:59: internal compiler error: in output_stack_adjust, at 
> config/sh/sh.c:4606

Bugs should be submitted into our bug database, bugzilla, instead of
emailing them to gcc-bugs.  We do not track bug reports sent via email,
so you are more likely to get an answer if you file a bug report into
bugzilla.

See
    http://gcc.gnu.org/bugs.html
for more info on reporting bugs.
-- 
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-04-21  2:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-04-09  5:26 GCC3.4.0-20040406 bug report Kenji Mugita
2004-04-21  2:58 ` Jim Wilson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).