gst@WJH12.HARVARD.EDU (Gary S. Trujillo) (02/14/89)
Greetings. I just brought up gcc 1.33 on my UNIX-pc (3B1) this past weekend. It went fairly smoothly. I am now attempting to subject the compiler to as rigorous a testing procedure as I can. The following is the result of one of my initial tests. I compiled the program below with the default settings in effect, and it seemed to compile and run OK (I have not checked the runtime results carefully, though). Just for fun, I thought I might try compiling the program with the "-traditional" flag set, to see what sorts of diagnostics might be produced for function prototypes in a mode where they are unrecognizable. My results were that the compiler failed with the message: /u/gst/tmp/gcc/stage1/gcc: Program cc1 got fatal signal 10. Referring to INTRO(2) for my machine, I find that signal 10 refers to "ECHILD - No child processes". Here's the program itself. It is followed (after another line of dashes) by some output from sdb. (I haven't yet tried making gdb.) It would appear that the error message is bogus, or else the debugger output is incorrect, since I don't see any wait()ing going on in the reported vicinity of the error. I thought after using sdb that maybe I should have applied sdb to "gcc", rather than to "cc1", since execution was begun there. However, when I tried doing so, I got garbage results. I've never been too sure of what happens in debug-land after a fork()/exec(), anyway. ------------------------------------------------------------------------------- /* from pp. 119 - 120 of The C Programming Language, Second Edition */ #define ALLOCSIZE 10000 #include <stdio.h> #include <string.h> #define MAXLINES 5000 /* max #lines to be sorted */ char *lineptr[MAXLINES]; /* pointers to text lines */ int readlines(char *lineptr[], int nlines); void writelines(char *lineptr[], int nlines); void qsort(void *lineptr[], int left, int right, int (*comp)(void *, void *)); int numcmp(char *, char *); /* sort input lines */ main(int argc, char *argv[]) { int nlines; /* number of input lines read */ int numeric = 0; /* 1 if numeric sort */ if (argc > 1 && strcmp(argv[1], "-n") == 0) numeric = 1; if ((nlines = readlines(lineptr, MAXLINES)) >= 0) { if (numeric) qsort((void **) lineptr, 0, nlines-1, (int (*)(void*,void*)) numcmp); else qsort((void **) lineptr, 0, nlines-1, (int (*)(void*,void*)) strcmp); writelines(lineptr, nlines); return 0; } else { printf("input too big to sort\n"); return 1; } } /* qsort: sort v[left]...v[right] into increasing order */ void qsort(void *v[], int left, int right, int (*comp)(void *, void *)) { int i, last; void swap(void *v[], int x, int y); if (left >= right) /* do nothing if array contains */ return /* fewer than two elements */ swap(v, left, (left + right)/2); last = left; for (i = left+1; i <= right; i++) if ((*comp)(v[i], v[left]) < 0) swap(v, ++last, i); swap(v, left, last); qsort(v, left, last-1, comp); qsort(v, last+1, right, comp); } /* readlines & writelines from p. 109 */ #define MAXLEN 1000 /* max length of any input line */ int getline(char *, int); char *alloc(int); /* readlines: read input lines */ int readlines(char *lineptr[], int maxlines) { int len, nlines; char *p, line[MAXLEN]; nlines = 0; while ((len = getline(line, MAXLEN)) > 0) if (nlines >= maxlines || (p = alloc(len)) == NULL) return -1; else { line[len-1] = '\0'; /* delete newline */ strcpy(p, line); lineptr[nlines++] = p; } return nlines; } /* writelines: write output lines */ void writelines(char *lineptr[], int nlines) { int i; for (i = 0; i< nlines; i++) printf("%s\n", lineptr[i]); } /* alloc() routine from p. 101 */ static char allocbuf[ALLOCSIZE]; /* storage for alloc */ static char *allocp = allocbuf; /* next free position */ char *alloc(int n) /* return pointer to n characters */ { if (allocbuf + ALLOCSIZE - allocp >= n) { /* it fits */ allocp += n; return allocp - n; /* old p */ } else /* not enough room */ return 0; } void afree(char *p) /* free storage pointed to by p */ { if (p >= allocbuf && p < allocbuf + ALLOCSIZE) allocp = p; } /* getline from p. 165 */ int getline(char *line, int max) { if (fgets(line, max, stdin) == NULL) return 0; else return strlen(line); } /* swap from p. 121 */ void swap(void *v[], int i, int j) { void *temp; temp = v[i]; v[i] = v[j]; v[j] = temp; } /* numcmp from p. 121 */ #include <math.h> /* numcmp: compare s1 and s2 numerically */ int numcmp(char *s1, char *s2) { double v1, v2; v1 = atof(s1); v2 = atof(s2); if (v1 < v2) return -1; else if (v1 > v2) return 1; else return 0; } ------------------------------------------------------------------------------- Script started on Mon Feb 13 13:46:23 1989 u[1] sdb debug/cc1 Core file 'core' Bus Error (10) at 40 files, 1434 procedures. 0x8e6c4 in compparms:427: if (! comptypes (TREE_VALUE (t1), TREE_VALUE (t2))) >t compparms(parms1=0x136444,parms2=0x12b40c) [c-typeck.c:427] comptypes(type1=0x1364dc,type2=0x134720) [c-typeck.c:353] duplicate_decls(new=0x13654c,old=0x134790) [c-decl.c:609] pushdecl(x=0x13654c) [c-decl.c:812] start_function(declspecs=0x1361f2,declarator=0x1364bc) [c-decl.c:3193] LI%319() compile_file(name="/tmp/cca06145.cpp") [toplev.c:971] LI%301() >w 422: return 1; 423: /* If one parmlist is shorter than the other, 424: they fail to match. */ 425: if (t1 == 0 || t2 == 0) 426: return 0; 427: if (! comptypes (TREE_VALUE (t1), TREE_VALUE (t2))) 428: return 0; 429: t1 = TREE_CHAIN (t1); 430: t2 = TREE_CHAIN (t2); 431: } >x d0/ 1 a1/ 0x1343f6 d1/ 0x12c658 a2/ 0x13645c d2/ 0 a3/ 5 d3/ 0x12 a4/ 0x12c31c d4/ 1 a5/ 0 d5/ -2 a6/ 0x2fe1c6 d6/ 1 a7/ 0x2fe1be d7/ 0 rps/ 0 a0/ 0x13654c pc/ 0x8e6c4 compparms:427+2 (compparms+66): or.b &2f2a,(%a4) >t1/ 0x13645c >t2/ 0x000005 >t1[0]/ t1[0].common.uid/ 1255 t1[0].common.chain/ 0x136474 t1[0].common.type/ 0x000000 t1[0].common.code/ 0 t1[0].common.external_attr/ 0 t1[0].common.public_attr/ 0 t1[0].common.static_attr/ 0 t1[0].common.volatile_attr/ 0 t1[0].common.packed_attr/ 0 t1[0].common.readonly_attr/ 0 t1[0].common.literal_attr/ 0 t1[0].common.nonlocal_attr/ 0 t1[0].common.permanent_attr/ -1 t1[0].common.addressable_attr/ 0 t1[0].common.regdecl_attr/ 0 t1[0].common.this_vol_attr/ 0 t1[0].common.unsigned_attr/ 0 t1[0].common.asm_written_attr/ 0 t1[0].common.inline_attr/ 0 t1[0].common.used_attr/ 0 t1[0].common.lang_flag_1/ 0 t1[0].common.lang_flag_2/ 0 t1[0].common.lang_flag_3/ 0 t1[0].common.lang_flag_4/ 0 t1[0].int_cst.common/ "" t1[0].int_cst.int_cst_low/ 0 t1[0].int_cst.int_cst_high/ 1214160 t1[0].real_cst.common/ "" t1[0].real_cst.rtl/ 0x000000 t1[0].real_cst.real_cst/ 2.576442409559e-308 t1[0].string.common/ "" t1[0].string.rtl/ 0x000000 t1[0].string.length/ 1214160 t1[0].string.pointer/ Data address not found >t2[0]/ t2[0].common.uid/ Data address not found >q script done on Mon Feb 13 13:55:28 1989 Please let me know if you need more information, or have any suggestions. -- Gary S. Trujillo {linus,bbn,m2c}!spdcc!gnosys!gst Somerville, Massachusetts {icus,ima,stech,wjh12}!gnosys!gst