Article View: gnu.gcc.bug
Article #6193fatal signal 11 error in cc1 (gcc 2.7.0, Pentium Linux 1.2)
From: Sanjoy Mahajan
Date: Tue, 09 Jan 1996 00:00
Date: Tue, 09 Jan 1996 00:00
3523 lines
38884 bytes
38884 bytes
On an Linux ELF 133MHz Pentium (kernel 1.2.13), using
% gcc -v
Reading specs from /usr/lib/gcc-lib/i486-linux/2.7.0/specs
gcc version 2.7.0
I get the following error message with the attached program,
% gcc -Wall 21.c
2.c: In function `make_move':
2.c:489: warning: implicit declaration of function `bcopy'
2.c: In function `evaluate':
2.c:572: warning: missing braces around initializer for `move_evals[0]'
2.c:714: warning: passing arg 4 of `qsort' from incompatible pointer type
2.c: In function `main':
2.c:875: warning: left-hand operand of comma expression has no effect
2.c:875: parse error before `)'
gcc: Internal compiler error: program cc1 got fatal signal 11
The .c program itself looks so horrendous because it was produced by
Knuth's CWEB system, from a much nicer CWEB file.
2.c was the file name before I ran it through 'gcc -E'. I called the
result '21.c'
/Sanjoy
here's the program (run through 'gcc -E')
-------------------------- here till end of mail ------------------------------
# 1 "2.c"
# 1 "/home/sanjoy/include/quit.h" 1
# 1 "/usr/include/stdio.h" 1 3
# 1 "/usr/include/features.h" 1 3
# 1 "/usr/include/sys/cdefs.h" 1 3
# 1 "/usr/include/features.h" 1 3
# 136 "/usr/include/features.h" 3
# 24 "/usr/include/sys/cdefs.h" 2 3
# 50 "/usr/include/sys/cdefs.h" 3
# 100 "/usr/include/sys/cdefs.h" 3
typedef long double __long_double_t;
# 128 "/usr/include/sys/cdefs.h" 3
# 134 "/usr/include/features.h" 2 3
# 31 "/usr/include/stdio.h" 2 3
# 1 "/usr/include/libio.h" 1 3
# 1 "/usr/include/_G_config.h" 1 3
typedef long _G_clock_t;
typedef unsigned short _G_dev_t;
typedef long int _G_fpos_t;
typedef unsigned short _G_gid_t;
typedef unsigned long _G_ino_t;
typedef unsigned short _G_mode_t;
typedef unsigned short _G_nlink_t;
typedef long _G_off_t;
typedef int _G_pid_t;
typedef int _G_ptrdiff_t;
typedef unsigned int _G_sigset_t;
typedef unsigned int _G_size_t;
typedef long _G_time_t;
typedef unsigned short _G_uid_t;
typedef long int _G_wchar_t;
typedef int _G_ssize_t;
typedef int _G_wint_t;
typedef void * _G_va_list;
typedef __signed char _G_int8_t;
typedef unsigned char _G_uint8_t;
typedef short _G_int16_t;
typedef unsigned short _G_uint16_t;
typedef long _G_int32_t;
typedef unsigned long _G_uint32_t;
typedef long long _G_int64_t;
typedef unsigned long long _G_uint64_t;
# 32 "/usr/include/libio.h" 2 3
# 53 "/usr/include/libio.h" 3
struct _IO_lock_t {
void *ptr;
short int field1;
short int field2;
};
struct _IO_jump_t; struct _IO_FILE;
struct _IO_marker {
struct _IO_marker *_next;
struct _IO_FILE *_sbuf;
int _pos;
# 174 "/usr/include/libio.h" 3
};
struct _IO_FILE {
int _flags;
char* _IO_read_ptr;
char* _IO_read_end;
char* _IO_read_base;
char* _IO_write_base;
char* _IO_write_ptr;
char* _IO_write_end;
char* _IO_buf_base;
char* _IO_buf_end;
char *_IO_save_base;
char *_IO_backup_base;
char *_IO_save_end;
struct _IO_marker *_markers;
struct _IO_FILE *_chain;
struct _IO_jump_t *_jumps;
int _fileno;
int _blksize;
_G_off_t _offset;
unsigned short _cur_column;
char _unused;
char _shortbuf[1];
struct _IO_lock_t _IO_lock;
};
typedef struct _IO_FILE _IO_FILE;
struct _IO_FILE_plus;
extern struct _IO_FILE_plus _IO_stdin_, _IO_stdout_, _IO_stderr_;
extern int __underflow (_IO_FILE*) ;
extern int __uflow (_IO_FILE*) ;
extern int __overflow (_IO_FILE*, int) ;
extern unsigned __adjust_column (unsigned start, const char *line, int count) ;
extern int _IO_vfscanf (_IO_FILE*, const char*, _G_va_list , int*) ;
extern int _IO_vfprintf (_IO_FILE*, const char*, _G_va_list ) ;
extern _G_ssize_t _IO_padn (_IO_FILE *, int, _G_ssize_t ) ;
extern _G_size_t _IO_sgetn (_IO_FILE *, void*, _G_size_t ) ;
extern void _IO_free_backup_area (_IO_FILE*) ;
# 34 "/usr/include/stdio.h" 2 3
typedef _G_size_t size_t;
typedef struct _IO_FILE FILE;
typedef _G_fpos_t fpos_t;
extern FILE *stdin, *stdout, *stderr;
extern void clearerr (FILE*) ;
extern int fclose (FILE*) ;
extern int feof (FILE*) ;
extern int ferror (FILE*) ;
extern int fflush (FILE*) ;
extern int fgetc (FILE *) ;
extern int fgetpos (FILE* fp, fpos_t *pos) ;
extern char* fgets (char*, int, FILE*) ;
extern FILE* fopen (__const char*, __const char*) ;
extern int fprintf (FILE*, __const char* format, ...) ;
extern int fputc (int, FILE*) ;
extern int fputs (__const char *str, FILE *fp) ;
extern size_t fread (void*, size_t, size_t, FILE*) ;
extern FILE* freopen (__const char*, __const char*, FILE*) ;
extern int fscanf (FILE *fp, __const char* format, ...) ;
extern int fseek (FILE* fp, long int offset, int whence) ;
extern int fsetpos (FILE* fp, __const fpos_t *pos) ;
extern long int ftell (FILE* fp) ;
extern size_t fwrite (__const void*, size_t, size_t, FILE*) ;
extern int getc (FILE *) ;
extern int getchar (void) ;
extern char* gets (char*) ;
extern void perror (__const char *) ;
extern int printf (__const char* format, ...) ;
extern int putc (int, FILE *) ;
extern int putchar (int) ;
extern int puts (__const char *str) ;
extern int remove (__const char*) ;
extern int rename (__const char* _old, __const char* _new) ;
extern void rewind (FILE*) ;
extern int scanf (__const char* format, ...) ;
extern void setbuf (FILE*, char*) ;
extern void setlinebuf (FILE*) ;
extern void setbuffer (FILE*, char*, int) ;
extern int setvbuf (FILE*, char*, int mode, size_t size) ;
extern int sprintf (char*, __const char* format, ...) ;
extern int sscanf (__const char* string, __const char* format, ...) ;
extern FILE* tmpfile (void) ;
extern char* tmpnam (char*) ;
extern int ungetc (int c, FILE* fp) ;
extern int vfprintf (FILE *fp, char __const *fmt0, _G_va_list) ;
extern int vprintf (char __const *fmt, _G_va_list) ;
extern int vsprintf (char* string, __const char* format, _G_va_list) ;
extern int vfscanf (FILE*, __const char *, _G_va_list) ;
extern int vscanf (__const char *, _G_va_list) ;
extern int vsscanf (__const char *, __const char *, _G_va_list) ;
extern int getw (FILE*) ;
extern int putw (int, FILE*) ;
extern char* tempnam (__const char *__dir, __const char *__pfx) ;
extern int sys_nerr;
extern char *sys_errlist[];
extern int _sys_nerr;
extern char *_sys_errlist[];
extern void psignal (int __sig, __const char *__s) ;
extern _G_ssize_t getdelim (char **, size_t *, int, FILE*) ;
extern int snprintf (char *, size_t, const char *, ...) ;
extern int vsnprintf (char *, size_t, const char *, _G_va_list) ;
extern int asprintf (char **, const char *, ...) ;
extern int vasprintf (char **, const char *, _G_va_list) ;
extern FILE *fdopen (int, __const char *) ;
extern int fileno (FILE*) ;
extern FILE* popen (__const char*, __const char*) ;
extern int pclose (FILE*) ;
extern int __underflow (struct _IO_FILE*) ;
extern int __overflow (struct _IO_FILE*, int) ;
# 1 "/home/sanjoy/include/quit.h" 2
# 37 "2.c" 2
# 1 "/usr/include/stdlib.h" 1 3
# 1 "/usr/lib/gcc-lib/i486-linux/2.7.0/include/stddef.h" 1 3
# 17 "/usr/lib/gcc-lib/i486-linux/2.7.0/include/stddef.h" 3
# 59 "/usr/lib/gcc-lib/i486-linux/2.7.0/include/stddef.h" 3
# 129 "/usr/lib/gcc-lib/i486-linux/2.7.0/include/stddef.h" 3
# 180 "/usr/lib/gcc-lib/i486-linux/2.7.0/include/stddef.h" 3
typedef long int wchar_t;
# 286 "/usr/lib/gcc-lib/i486-linux/2.7.0/include/stddef.h" 3
# 34 "/usr/include/stdlib.h" 2 3
# 1 "/usr/include/errno.h" 1 3
# 1 "/usr/include/linux/errno.h" 1 3
# 27 "/usr/include/errno.h" 2 3
extern int sys_nerr;
extern char *sys_errlist[];
extern int _sys_nerr;
extern char *_sys_errlist[];
extern int errno;
extern void perror (__const char* __s) ;
extern char* strerror (int __errno) ;
# 42 "/usr/include/stdlib.h" 2 3
typedef struct
{
int quot;
int rem;
} div_t;
typedef struct
{
long int quot;
long int rem;
} ldiv_t;
extern double atof (__const char *__nptr) ;
extern int atoi (__const char *__nptr) ;
extern long int atol (__const char *__nptr) ;
extern long long int atoq (__const char *__nptr) ;
extern float strtof (__const char *__nptr, char **__endptr) ;
extern double strtod (__const char *__nptr, char **__endptr) ;
extern __long_double_t strtold (__const char *__nptr, char **__endptr) ;
extern long int strtol (__const char *__nptr, char **__endptr,
int __base) ;
extern unsigned long int strtoul (__const char *__nptr,
char **__endptr, int __base) ;
extern long long int strtoq (__const char *__nptr, char **__endptr,
int __base) ;
extern unsigned long long int strtouq (__const char *__nptr,
char **__endptr, int __base) ;
extern double __strtod_internal (__const char *__nptr,
char **__endptr, int __group);
extern float __strtof_internal (__const char *__nptr, char **__endptr,
int __group);
extern __long_double_t __strtold_internal (__const char *__nptr,
char **__endptr, int __group);
extern long int __strtol_internal (__const char *__nptr, char **__endptr,
int __base, int __group);
extern unsigned long int __strtoul_internal (__const char *__nptr,
char **__endptr, int __base,
int __group);
extern long long int __strtoq_internal (__const char *__nptr, char **__endptr,
int __base, int __group);
extern unsigned long long int __strtouq_internal (__const char *__nptr,
char **__endptr, int __base,
int __group);
# 170 "/usr/include/stdlib.h" 3
extern int rand (void) ;
extern void srand (unsigned int __seed) ;
extern long int __random (void) ;
extern void __srandom (unsigned int __seed) ;
extern void * __initstate (unsigned int __seed, void * __statebuf,
size_t __statelen) ;
extern void * __setstate (void * __statebuf) ;
extern long int random (void) ;
extern void srandom (unsigned int __seed) ;
extern void * initstate (unsigned int __seed, void * __statebuf,
size_t __statelen) ;
extern void * setstate (void * __statebuf) ;
# 214 "/usr/include/stdlib.h" 3
extern void * malloc (size_t __size) ;
extern void * realloc (void * __ptr, size_t __size) ;
extern void * calloc (size_t __nmemb, size_t __size) ;
extern void free (void * __ptr) ;
extern void cfree (void * __ptr) ;
# 1 "/usr/include/alloca.h" 1 3
# 1 "/usr/lib/gcc-lib/i486-linux/2.7.0/include/stddef.h" 1 3
# 17 "/usr/lib/gcc-lib/i486-linux/2.7.0/include/stddef.h" 3
# 59 "/usr/lib/gcc-lib/i486-linux/2.7.0/include/stddef.h" 3
# 129 "/usr/lib/gcc-lib/i486-linux/2.7.0/include/stddef.h" 3
# 180 "/usr/lib/gcc-lib/i486-linux/2.7.0/include/stddef.h" 3
# 254 "/usr/lib/gcc-lib/i486-linux/2.7.0/include/stddef.h" 3
# 286 "/usr/lib/gcc-lib/i486-linux/2.7.0/include/stddef.h" 3
# 24 "/usr/include/alloca.h" 2 3
extern void * __alloca (size_t __size) ;
extern void * alloca (size_t __size) ;
# 234 "/usr/include/stdlib.h" 2 3
extern void * valloc (size_t __size) ;
extern void abort (void) ;
extern int atexit (void (*__func) (void)) ;
extern int on_exit (void (*__func) (int __status, void * __arg),
void * __arg) ;
extern void exit (int __status) ;
extern char *getenv (__const char *__name) ;
extern int putenv (__const char *__string) ;
extern int setenv (__const char *__name, __const char *__value,
int __replace) ;
extern int system (__const char *__command) ;
typedef int (*__compar_fn_t) (__const void * , __const void * ) ;
typedef __compar_fn_t comparison_fn_t;
extern void * bsearch (__const void * __key, __const void * __base,
size_t __nmemb, size_t __size,
__compar_fn_t __compar) ;
extern void qsort (void * __base, size_t __nmemb, size_t __size,
__compar_fn_t __compar) ;
# 314 "/usr/include/stdlib.h" 3
extern int abs (int __x) ;
extern long int labs (long int __x) ;
extern div_t div (int __numer, int __denom) ;
extern ldiv_t ldiv (long int __numer, long int __denom) ;
extern int mblen (__const char *__s, size_t __n) ;
extern int mbtowc (wchar_t * __pwc, __const char *__s, size_t __n) ;
extern int wctomb (char *__s, wchar_t __wchar) ;
extern size_t mbstowcs (wchar_t * __pwcs, __const char *__s, size_t __n) ;
extern size_t wcstombs (char *__s, __const wchar_t * __pwcs, size_t __n) ;
# 375 "/usr/include/stdlib.h" 3
extern char **environ;
extern char **__environ;
extern void* memalign (size_t __alignment, size_t __size) ;
extern char* ecvt (double __value, size_t __ndigit, int *__decpt,
int *__sign) ;
extern char* fcvt (double __value, size_t __ndigit, int *__decpt,
int *__sign) ;
extern char* gcvt (double __value, size_t __ndigit, char *__buf) ;
extern double drand48 (void) ;
extern double erand48 (unsigned short int __xsubi[3]) ;
extern long int lrand48 (void) ;
extern long int nrand48 (unsigned short int __xsubi[3]) ;
extern long int mrand48 (void) ;
extern long int jrand48 (unsigned short int __xsubi[3]) ;
extern void srand48 (long int __seedval) ;
extern unsigned short int
*seed48 (unsigned short int __seed16v[3]) ;
extern void lcong48 (unsigned short int __param[7]) ;
extern int setenv (__const char *__name, __const char *__value,
int __overwrite) ;
extern void unsetenv (__const char *__name) ;
struct qelem {
struct qelem *q_forw;
struct qelem *q_back;
char q_data[1];
};
extern void insque (struct qelem *__elem, struct qelem *__prev) ;
extern void remque (struct qelem *__elem) ;
# 38 "2.c" 2
# 1 "/usr/include/math.h" 1 3
extern double acos (double __x) __attribute__ ((const)) ;
extern double asin (double __x) __attribute__ ((const)) ;
extern double atan (double __x) __attribute__ ((const)) ;
extern double atan2 (double __y, double __x) __attribute__ ((const)) ;
extern double cos (double __x) __attribute__ ((const)) ;
extern double sin (double __x) __attribute__ ((const)) ;
extern double tan (double __x) __attribute__ ((const)) ;
extern double cosh (double __x) __attribute__ ((const)) ;
extern double sinh (double __x) __attribute__ ((const)) ;
extern double tanh (double __x) __attribute__ ((const)) ;
extern double acosh (double __x) __attribute__ ((const)) ;
extern double asinh (double __x) __attribute__ ((const)) ;
extern double atanh (double __x) __attribute__ ((const)) ;
extern double exp (double __x) __attribute__ ((const)) ;
extern double frexp (double __x, int *__exp) ;
extern double ldexp (double __x, int __exp) __attribute__ ((const)) ;
extern double log (double __x) __attribute__ ((const)) ;
extern double log10 (double __x) __attribute__ ((const)) ;
extern double expm1 (double __x) __attribute__ ((const)) ;
extern double log1p (double __x) __attribute__ ((const)) ;
extern double modf (double __x, double *__iptr) ;
extern double pow (double __x, double __y) __attribute__ ((const)) ;
extern double sqrt (double __x) __attribute__ ((const)) ;
extern double cbrt (double __x) __attribute__ ((const)) ;
extern double ceil (double __x) __attribute__ ((const)) ;
extern double fabs (double __x) __attribute__ ((const)) ;
extern double floor (double __x) __attribute__ ((const)) ;
extern double fmod (double __x, double __y) __attribute__ ((const)) ;
extern int __isinf (double __value) __attribute__ ((const)) ;
extern int __isnan (double __value) __attribute__ ((const)) ;
extern int __finite (double __value) __attribute__ ((const)) ;
extern double __infnan (int __error) ;
extern double __copysign (double __x,
double __y) __attribute__ ((const)) ;
extern double __rint (double __x) __attribute__ ((const)) ;
extern double rint (double __x) __attribute__ ((const)) ;
extern double hypot (double __x, double __y) __attribute__ ((const)) ;
extern int isinf (double __value) __attribute__ ((const)) ;
extern int isnan (double __value) __attribute__ ((const)) ;
extern int finite (double __value) __attribute__ ((const)) ;
extern double infnan (int __error) __attribute__ ((const)) ;
extern double copysign (double __x,
double __y) __attribute__ ((const)) ;
extern double drem (double __x, double __y) __attribute__ ((const)) ;
extern double pow2 (double __x) __attribute__ ((const)) ;
extern double pow10 (double __x) __attribute__ ((const)) ;
extern double erf (double __x) __attribute__ ((const)) ;
extern double erfc (double __x) __attribute__ ((const)) ;
extern double j0 (double __x) __attribute__ ((const)) ;
extern double j1 (double __x) __attribute__ ((const)) ;
extern double jn (int __n, double __x) __attribute__ ((const)) ;
extern double lgamma (double __x) __attribute__ ((const)) ;
extern double y0 (double __x) __attribute__ ((const)) ;
extern double y1 (double __x) __attribute__ ((const)) ;
extern double yn (int __n, double __x) __attribute__ ((const)) ;
extern __long_double_t acosl (__long_double_t __x) ;
extern __long_double_t asinl (__long_double_t __x) ;
extern __long_double_t atanl (__long_double_t __x) ;
extern __long_double_t cosl (__long_double_t __x) ;
extern __long_double_t sinl (__long_double_t __x) ;
extern __long_double_t tanl (__long_double_t __x) ;
extern __long_double_t acoshl (__long_double_t __x) ;
extern __long_double_t asinhl (__long_double_t __x) ;
extern __long_double_t atanhl (__long_double_t __x) ;
extern __long_double_t coshl (__long_double_t __x) ;
extern __long_double_t sinhl (__long_double_t __x) ;
extern __long_double_t tanhl (__long_double_t __x) ;
extern __long_double_t expl (__long_double_t __x) ;
extern __long_double_t expm1l (__long_double_t __x) __attribute__ ((const)) ;
extern __long_double_t frexpl (__long_double_t __value, int *__exp) ;
extern __long_double_t ldexpl (__long_double_t __x, int __exp) ;
extern __long_double_t logl (__long_double_t __x) ;
extern __long_double_t log10l (__long_double_t __x) ;
extern __long_double_t modfl (__long_double_t __value, __long_double_t * __ip) ;
extern __long_double_t powl (__long_double_t __x, __long_double_t __y) ;
extern __long_double_t sqrtl (__long_double_t __x) ;
extern __long_double_t atan2l (__long_double_t __y, __long_double_t __x) ;
extern __long_double_t hypotl (__long_double_t __x, __long_double_t __y) __attribute__ ((const)) ;
extern __long_double_t erfl (__long_double_t __x) ;
extern __long_double_t erfcl (__long_double_t __x) ;
extern __long_double_t lgammal (__long_double_t __x) ;
extern __long_double_t j0l (__long_double_t __x) ;
extern __long_double_t y0l (__long_double_t __x) ;
extern __long_double_t j1l (__long_double_t __x) ;
extern __long_double_t y1l (__long_double_t __x) ;
extern __long_double_t jnl (int __n, __long_double_t __x) ;
extern __long_double_t ynl (int __n, __long_double_t __x) ;
extern __long_double_t cbrtl (__long_double_t __x) ;
extern __long_double_t log1pl (__long_double_t __x) ;
extern __long_double_t log2l (__long_double_t __x) ;
extern __long_double_t pow2l (__long_double_t __x) ;
extern __long_double_t pow10l (__long_double_t __x) ;
extern __long_double_t ceill (__long_double_t __x) __attribute__ ((const)) ;
extern __long_double_t fabsl (__long_double_t __x) __attribute__ ((const)) ;
extern __long_double_t floorl (__long_double_t __x) __attribute__ ((const)) ;
extern __long_double_t fmodl (__long_double_t __x,
__long_double_t __y) __attribute__ ((const)) ;
extern int __isinfl (__long_double_t __value) __attribute__ ((const)) ;
extern int __isnanl (__long_double_t __value) __attribute__ ((const)) ;
extern int signgam;
# 1 "/usr/include/huge_val.h" 1 3
# 1 "/usr/include/endian.h" 1 3
# 1 "/usr/include/bytesex.h" 1 3
# 1 "/usr/include/linux/version.h" 1 3
# 6 "/usr/include/bytesex.h" 2 3
# 1 "/usr/include/asm/byteorder.h" 1 3
extern unsigned long int ntohl(unsigned long int);
extern unsigned short int ntohs(unsigned short int);
extern unsigned long int htonl(unsigned long int);
extern unsigned short int htons(unsigned short int);
extern unsigned long int __ntohl(unsigned long int);
extern unsigned short int __ntohs(unsigned short int);
extern unsigned long int __constant_ntohl(unsigned long int);
extern unsigned short int __constant_ntohs(unsigned short int);
extern __inline__ unsigned long int
__ntohl(unsigned long int x)
{
__asm__("xchgb %b0,%h0\n\t"
"rorl $16,%0\n\t"
"xchgb %b0,%h0"
:"=q" (x)
: "0" (x));
return x;
}
extern __inline__ unsigned short int
__ntohs(unsigned short int x)
{
__asm__("xchgb %b0,%h0"
: "=q" (x)
: "0" (x));
return x;
}
# 79 "/usr/include/asm/byteorder.h" 3
# 12 "/usr/include/bytesex.h" 2 3
# 34 "/usr/include/endian.h" 2 3
# 27 "/usr/include/huge_val.h" 2 3
# 293 "/usr/include/math.h" 2 3
# 1 "/usr/include/nan.h" 1 3
# 86 "/usr/include/nan.h" 3
# 297 "/usr/include/math.h" 2 3
# 1 "/usr/lib/gcc-lib/i486-linux/2.7.0/include/float.h" 1 3
union __convert_long_double {
unsigned __convert_long_double_i[4];
long double __convert_long_double_d;
};
# 300 "/usr/include/math.h" 2 3
# 1 "/usr/include/values.h" 1 3
# 102 "/usr/include/values.h" 3
# 175 "/usr/include/values.h" 3
# 301 "/usr/include/math.h" 2 3
# 39 "2.c" 2
typedef float Value;
typedef float Prob;
typedef Prob Distribution[(8+2* 3 ) +1];
typedef struct
{
Distribution dist;
Value value;
}Eval;
typedef int Square;
typedef int Color;
typedef Color Edge[10 ];
typedef int Move;
typedef struct
{
Move move;
Value value;
}Move_eval;
typedef Move_eval Move_evals[10 +2];
typedef struct
{
int converged;
Eval eval;
Move_evals move_evals;
}Entry;
typedef struct
{
Move move;
Eval eval;
float prob;
}Kid;
typedef Kid Kids[10 +2];
;
int Corner_bonus= 3 ;
int Converged= 0;
Entry Table[59049 ];
int compare(const Kid*a,const Kid*b)
{
if(a->eval.value-b->eval.value<0.0)
return-1;
else
return 1;
}
void negate_distribution(Eval*a)
{
int i;Value temp;
for(i= 0;i<((8+2* 3 ) -1)/2;i++){ temp = a->dist[(8+2* 3 ) -i] ; a->dist[(8+2* 3 ) -i] = a->dist[i] ; a->dist[i] = temp ;} ;
a->value= 14-a->value;
}
void clear_distribution(Eval*a)
{
int i;
for( i = 0; i <= (8+2* 3 ) ; i ++) a->dist[i]= 0.0;
a->value= 0.0;
}
void multiply_distribution(Eval*a,float x)
{
int i;
for( i = 0; i <= (8+2* 3 ) ; i ++) a->dist[i]*= x;
a->value*= x;
}
void add_distribution(Eval*a,Eval*b)
{
int i;
for( i = 0; i <= (8+2* 3 ) ; i ++)
a->dist[i]+= b->dist[i];
a->value+= b->value;
}
inline Value variance(Eval a)
{
Value ret= 0.0;
int i;
for( i = 0; i <= (8+2* 3 ) ; i ++) ret+= a.dist[i]*(i-a.value)*(i-a.value);
return ret;
}
void print_distribution(Eval eval)
{
int i;
printf("\t %8.5f (%3.1f)",eval.value,sqrt(variance(eval)));
for( i = 0; i <= (8+2* 3 ) ; i ++)
printf(" %3.1f",eval.dist[i]);
}
Eval compute_evaluation(Kids kids,Prob*remaining_prob)
{
int i;
Eval eval;
*remaining_prob= 1.0;
clear_distribution(&eval);
for( i = 0;kids[ i ].move!= (-1 -1) ; i ++)
{
Eval temp_eval= kids[i].eval;
multiply_distribution(&temp_eval,*remaining_prob*kids[i].prob);
add_distribution(&eval,&temp_eval);
*remaining_prob*= 1-kids[i].prob;
}
return eval;
}
static int weight[10 ]= {1,3,9,27,81,243,729,2187,6561,19683};
int table_index(Edge edge,Color color)
{
int i,total= 0;
static int flip[3]= {1 ,0 ,2 };
if(color== 0 )
for( i = 0; i < 10 ; i ++)
total+= weight[i]*edge[i];
else
for( i = 0; i < 10 ; i ++)
total+= weight[i]*flip[edge[i]];
return total;
}
void compute_edge(int index,Edge edge)
{
int i;
for(i= 10 -1;i>=0;i--)
if(2*weight[i]<=index)
index-= (edge[i]= 2)*weight[i];
else if(weight[i]<=index)
index-= (edge[i]= 1)*weight[i];
else
edge[i]= 0;
}
void print_edge(Edge edge)
{
{
int j;
char name[3]= "BW.";
for(j= 0;j<8;j++)
printf("%c",name[edge[j]]);
printf("/");
printf("%c%c",name[edge[8 ]],name[edge[9 ]]);
}
fflush(((_IO_FILE*)(&_IO_stdout_)) );
}
Prob move_probability(Edge edge,Move move,Color turn)
{
int opp_turn= (1-( turn ) ) ;
int i;
float coef,
opp;
for(opp= 0,coef= 0,i= 0;i<8;i++)
{
if(edge[i]==opp_turn)
opp++;
if(edge[i]!= 2 )
coef++;
}
if(move==8||move==9)
return(0.5+coef*0.03);
if(move==0&&edge[1]==opp_turn&&
!(edge[2]==opp_turn&&edge[3]==opp_turn&&
edge[4]==opp_turn&&edge[5]==opp_turn&&
edge[6]==opp_turn))
coef+= 2;
else
if(move==0&&edge[1]==turn)
coef--;
else
if(move==7&&edge[6]==opp_turn&&
!(edge[1]==opp_turn&&edge[2]==opp_turn&&
edge[3]==opp_turn&&edge[4]==opp_turn&&
edge[5]==opp_turn))
coef+= 2;
else
if(move==7&&edge[6]==turn)
coef--;
if(coef<0)
coef= 0;
else
if(coef>10)
coef= 10;
if(move==0)
{
if(edge[8]== 2 )
return coef*coef*0.0011;
else
if(edge[8]==turn)
return coef*coef*0.0003;
else
return coef*0.01+0.89;
}else
if(move==7)
{
if(edge[9]== 2 )
return coef*coef*0.0011;
else
if(edge[9]==turn)
return coef*coef*0.0003;
else
return coef*0.01+0.89;
}
coef= coef+coef+opp;
{
int next= edge[move+1],
prev= edge[move-1];
if(next== 2 )
{
if(prev== 2 )
coef+= 10;
else
if(prev==turn)
;
else
coef+= 15;
}else
if(next==turn)
{
if(prev== 2 )
;
else
if(prev==turn)
coef-= 10;
else
coef+= 10;
}else
{
if(prev== 2 )
coef+= 15;
else
if(prev==turn)
coef+= 10;
else
coef+= 20;
}
}
if(move>=2)
{
if(edge[move-2]==turn)
coef--;
else
if(edge[move-2]==opp_turn)
coef+= 3;
}
if(move<=5)
{
if(edge[move+2]==turn)
coef--;
else
if(edge[move+2]==opp_turn)
coef+= 3;
}
if(coef<0)
coef= 0;
else
if(coef>50)
coef= 50;
switch(move)
{
case 1:
if(edge[8]==opp_turn)
return coef*0.002+0.89;
else
return coef*0.009+0.03;
case 6:
if(edge[9]==opp_turn)
return coef*0.002+0.89;
else
return coef*0.009+0.03;
case 2:
if(((edge[6]==opp_turn)&&(edge[5]== 2 )&&
(edge[7]== 2 ))||
((edge[1]==opp_turn)&&(edge[0]== 2 )&&
(edge[2]== 2 ))||
((edge[6]==opp_turn)&&(edge[5]==opp_turn)&&
(edge[4]== 2 )&&(edge[7]== 2 ))||
((edge[1]==opp_turn)&&(edge[2]==opp_turn)&&
(edge[0]== 2 )&&(edge[3]== 2 )))
return coef*0.015+0.2;
else
if(edge[8]==opp_turn)
return coef*0.016+0.07;
else
if(edge[8]==turn)
return(coef*0.010+0.04);
else
return(coef*0.015+0.05);
case 5:
if(((edge[6]==opp_turn)&&(edge[5]== 2 )&&
(edge[7]== 2 ))||
((edge[1]==opp_turn)&&(edge[0]== 2 )&&
(edge[2]== 2 ))||
((edge[6]==opp_turn)&&(edge[5]==opp_turn)&&
(edge[4]== 2 )&&(edge[7]== 2 ))||
((edge[1]==opp_turn)&&(edge[2]==opp_turn)&&
(edge[0]== 2 )&&(edge[3]== 2 )))
return coef*0.015+0.2;
else
if(edge[9]==opp_turn)
return coef*0.016+0.07;
else
if(edge[9]==turn)
return coef*0.010+0.04;
else
return coef*0.015+0.05;
case 3:
if(((edge[6]==opp_turn)&&(edge[5]== 2 )&&
(edge[7]== 2 ))||
((edge[1]==opp_turn)&&(edge[0]== 2 )&&
(edge[2]== 2 ))||
((edge[6]==opp_turn)&&(edge[5]==opp_turn)&&
(edge[4]== 2 )&&(edge[7]== 2 ))||
((edge[1]==opp_turn)&&(edge[2]==opp_turn)&&
(edge[0]== 2 )&&(edge[3]== 2 )))
return coef*0.015+0.2;
else
return coef*0.0165+0.08;
case 4:
if(((edge[6]==opp_turn)&&(edge[5]== 2 )&&
(edge[7]== 2 ))||
((edge[1]==opp_turn)&&(edge[0]== 2 )&&
(edge[2]== 2 ))||
((edge[6]==opp_turn)&&(edge[5]==opp_turn)&&
(edge[4]== 2 )&&(edge[7]== 2 ))||
((edge[1]==opp_turn)&&(edge[2]==opp_turn)&&
(edge[0]== 2 )&&(edge[3]== 2 )))
return coef*0.015+0.2;
else
return coef*0.0165+0.08;
default:
{ fprintf(((_IO_FILE*)(&_IO_stderr_)) ,"\"%s\", line %d: ", "2.c",473); fprintf(((_IO_FILE*)(&_IO_stderr_)) , "bad move\n" ); fprintf(((_IO_FILE*)(&_IO_stderr_)) ,"\n"); exit(1); } ;
return 0;
}
}
Prob make_move(Edge from,Edge to,Move move,Color color)
{
int i;
int legal= 0 ;
bcopy( from , to ,sizeof(Edge) ) ;
if(move== -1 )
return 1.0;
to[move]= color;
if(move== 8 ||move== 9 )
return move_probability(from,move,color);
if(move>1)
{
for(i= move-1;i>0&&to[i]== (1-( color ) ) ;i--)
;
;
if(i<=move-2&&to[i]==color)
{
legal= 1 ;
for(i++;i<move;i++)
to[i]= color;
}
}
if(move<6)
{
for(i= move+1;i<7&&to[i]== (1-( color ) ) ;i++)
;
;
if(i>=move+2&&to[i]==color)
{
legal= 1 ;
for(i--;i>move;i--)
to[i]= color;
}
}
if(move==0&&to[8 ]== (1-( color ) ) )
to[8 ]= color;
else if(move==7&&to[9 ]== (1-( color ) ) )
to[9 ]= color;
if(legal)
return 1.0;
else
return move_probability(from,move,color);
}
Eval static_evaluation(Edge,Color);
Eval evaluate(Edge edge,Color color,int force_move,int just_passed)
{
Move_evals move_evals= {0,};
float remaining_prob;
Eval eval;
int index;
int i;
int stack_ptr;
Kids kids;
int filled;
;
index= table_index(edge,color);
filled= 1 ;
for( i = 0; i < 10 ; i ++)
if((( edge[i] ) == 2 ) )
{
filled= 0 ;
break;
}
if(filled||(!force_move&&!just_passed))
{
if(Table[index].converged)
return Table[index].eval;
}
;
if(!filled)
{
stack_ptr= 0;
for( i = 0; i < 10 ; i ++)
if((( edge[i] ) == 2 ) )
kids[stack_ptr++].move= i;
filled= stack_ptr==0;
if(!force_move)
kids[stack_ptr++].move= -1 ;
kids[stack_ptr].move= (-1 -1) ;
;
for( i = 0;kids[ i ].move!= (-1 -1) ; i ++)
{
Edge working_edge;
kids[i].prob= make_move(edge,working_edge,kids[i].move,color);
if(kids[i].move== -1 &&just_passed)
{
Eval color_eval,opp_eval;
color_eval= evaluate(working_edge,color,1 ,1 );
opp_eval= evaluate(working_edge,(1-( color ) ) ,1 ,1 );
# 677 "2.c"
negate_distribution(&color_eval);
multiply_distribution(&color_eval,0.5);
multiply_distribution(&opp_eval,0.5);
add_distribution(&opp_eval,&color_eval);
kids[i].eval= opp_eval;
}
else
kids[i].eval=
evaluate(working_edge,(1-( color ) ) ,0 ,kids[i].move== -1 );
# 705 "2.c"
}
;
qsort(kids,stack_ptr,sizeof(kids[0]),compare);
;
for( i = 0;kids[ i ].move!= (-1 -1) ; i ++)
negate_distribution(&kids[i].eval);
eval= compute_evaluation(kids,&remaining_prob);
if(!just_passed&&!force_move)
{
for( i = 0;kids[ i ].move!= (-1 -1) ; i ++)
{
move_evals[i].move= i;
move_evals[i].value= kids[i].eval.value-eval.value;
}
move_evals[i].move= (-1 -1) ;
}
;
;
}
else
eval= static_evaluation(edge,color);
if(filled||(!force_move&&!just_passed))
{
Table[index].converged= 1 ;
Table[index].eval= eval;
Converged++;
if(filled)
(void)evaluate(edge,(1-( color ) ) ,0 ,1 );
if(!force_move&&!just_passed)
bcopy(&move_evals,&Table[index].move_evals,sizeof(Move_evals));
}
else
multiply_distribution(&eval,1.0/(1-remaining_prob));
return eval;
}
Eval static_evaluation(Edge edge,Color color)
{
int eval= 0;
int i;
Eval ret;
for(i= 0;i<8;i++)
if(edge[i]==color)
eval++;
if(edge[0]==color)
eval+= 3 ;
if(edge[7]==color)
eval+= 3 ;
for(i= 0;i<= (8+2* 3 ) ;i++)
ret.dist[i]= 0.0;
ret.dist[eval]= 1.0;
ret.value= eval;
return ret;
}
int main(int argc,char**argv)
{
Edge empty,edge;
int i;
if(argc>=2)
if (!( sscanf(argv[1],"%d",&Corner_bonus)==1 )) { fprintf(((_IO_FILE*)(&_IO_stderr_)) ,"\"%s\", line %d: ", "2.c",825); fprintf(((_IO_FILE*)(&_IO_stderr_)) , "Assertion failed" ); fprintf(((_IO_FILE*)(&_IO_stderr_)) ,"\n"); exit(1); } ;
for(i= 0;i< 59049 ;i++)
Table[i].converged= 0 ;
for(i= 0;i< 10 ;i++)
empty[i]= 2 ;
(void)evaluate(empty,0 ,0 ,0 );
for(i= 0;i< 59049 ;i++)
if(!Table[i].converged)
{
compute_edge(i,edge);
(void)evaluate(edge,0 ,0,0);
}
;
for(i= 0;i< 59049 ;i++)
{
compute_edge(i,edge);
{
int j;
char name[3]= "BW.";
for(j= 0;j<8;j++)
printf("%c",name[edge[j]]);
printf("/");
printf("%c%c",name[edge[8 ]],name[edge[9 ]]);
}
;
{
int j;
printf("\n ");
for(j= 0;Table[i].move_evals[j].move!= (-1 -1) ;j++)
printf("%c/%4.1f ",j>=0?j+'0'?'-',
Table[i].move_evals[j]);
printf("\n");
}
;
}
;
{FILE*fp;
Value max_eval= 2*Corner_bonus+8;
int i;
if (!( fp= fopen("edge_table.c","w") )) { fprintf(((_IO_FILE*)(&_IO_stderr_)) ,"\"%s\", line %d: ", "2.c",894); fprintf(((_IO_FILE*)(&_IO_stderr_)) , "Assertion failed" ); fprintf(((_IO_FILE*)(&_IO_stderr_)) ,"\n"); exit(1); } ;
fprintf(fp,"#include \"eval.h\"");
fprintf(fp,"Edge_entry Edge_Table[3][3][3][3][3][3][3][3][3][3] = {\n");
for(i= 0;i<59049;i++)
{
int j;
fprintf(fp,"%5d, %5d\n ",((int) (1000*( Table[i].eval.value-max_eval/2.0 ) /(max_eval/2.0) +0.5) ) ,
(int)(100*sqrt(variance(Table[i].eval))));
for(j= 0;Table[i].move_evals[j].move!= (-1 -1) ;j++)
fprintf(fp," %5d,",((int) (1000*( Table[i].move_evals[j].value ) /(max_eval/2.0) +0.5) ) );
fprintf(fp,"\n ");
}
fprintf(fp,"};\n");
fclose(fp);
}
;
return 0;
}
Technical Details
Message-ID:
<199601090759.XAA00509@rope.caltech.edu>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 113d02,438eb6dc806d468,start X-Google-Attributes: gid113d02,public From: sanjoy@rope.caltech.edu (Sanjoy Mahajan) Subject: fatal signal 11 error in cc1 (gcc 2.7.0, Pentium Linux 1.2) Date: 1996/01/09 Message-ID: <199601090759.XAA00509@rope.caltech.edu> X-Deja-AN: 134573122 distribution: gnu sender: daemon@cis.ohio-state.edu organization: GNUs Not Usenet newsgroups: gnu.gcc.bug