diff options
Diffstat (limited to 'gcc/testsuite/gcc.c-torture/compile')
251 files changed, 5344 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.c-torture/compile/900116-1.c b/gcc/testsuite/gcc.c-torture/compile/900116-1.c new file mode 100755 index 0000000..37c7eb7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/900116-1.c @@ -0,0 +1,14 @@ +struct st {char a, b, c, d; } + +zloop (struct st *s, int *p, int *q) +{ + int i; + struct st ss; + + for (i = 0; i < 100; i++) + { + ss = s[i]; + p[i] = ss.c; + q[i] = ss.b; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/900216-1.c b/gcc/testsuite/gcc.c-torture/compile/900216-1.c new file mode 100755 index 0000000..8a4bfb7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/900216-1.c @@ -0,0 +1,9 @@ +foo (p, a, b) + unsigned short *p; +{ + unsigned int x; + + x = p[0]; + + return (x == 134U); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/900313-1.c b/gcc/testsuite/gcc.c-torture/compile/900313-1.c new file mode 100755 index 0000000..f2bc40d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/900313-1.c @@ -0,0 +1,172 @@ +main () +{ + char *a; + foo (alloca (10000)); + foo (alloca (100000)); + foo (alloca ((int) &main)); +} + +many_par (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) +{ + char *x; + int aa, ba, ca, da, ea, fa, ga, ha, ia, ja, ka, la, ma, na, oa, pa; + + aa = bar (); + ba = bar (); + ca = bar (); + da = bar (); + ea = bar (); + fa = bar (); + ga = bar (); + ha = bar (); + ia = bar (); + ja = bar (); + ka = bar (); + la = bar (); + ma = bar (); + na = bar (); + oa = bar (); + pa = bar (); + foobar (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, aa, ba, ca, + da, ea, fa, ga, ha, ia, ja, ka, la, ma, na, oa, pa); + +} + +foobar (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, aa, ba, ca, + da, ea, fa, ga, ha, ia, ja, ka, la, ma, na, oa, pa) +{ + int ab, bb, cb, db, eb, fb, gb, hb, ib, jb, kb, lb, mb, nb, ob, pb; + int qb, rb, sb, tb, ub, vb, xb, yb; + + ab = bar (); + bb = bar (); + cb = bar (); + db = bar (); + eb = bar (); + fb = bar (); + gb = bar (); + hb = bar (); + ib = bar (); + jb = bar (); + kb = bar (); + lb = bar (); + mb = bar (); + nb = bar (); + ob = bar (); + pb = bar (); + qb = bar (); + rb = bar (); + sb = bar (); + tb = bar (); + ub = bar (); + vb = bar (); + xb = bar (); + yb = bar (); + + boofar (a); + boofar (b); + boofar (c); + boofar (d); + boofar (e); + boofar (f); + boofar (g); + boofar (h); + boofar (i); + boofar (j); + boofar (k); + boofar (l); + boofar (m); + boofar (n); + boofar (o); + boofar (p); + boofar (aa); + boofar (ba); + boofar (ca); + boofar (da); + boofar (ea); + boofar (fa); + boofar (ga); + boofar (ha); + boofar (ia); + boofar (ja); + boofar (ka); + boofar (la); + boofar (ma); + boofar (na); + boofar (oa); + boofar (pa); + + boofar (ab); + boofar (bb); + boofar (cb); + boofar (db); + boofar (eb); + boofar (fb); + boofar (gb); + boofar (hb); + boofar (ib); + boofar (jb); + boofar (kb); + boofar (lb); + boofar (mb); + boofar (nb); + boofar (ob); + boofar (pb); + + boofar (a); + boofar (b); + boofar (c); + boofar (d); + boofar (e); + boofar (f); + boofar (g); + boofar (h); + boofar (i); + boofar (j); + boofar (k); + boofar (l); + boofar (m); + boofar (n); + boofar (o); + boofar (p); + boofar (aa); + boofar (ba); + boofar (ca); + boofar (da); + boofar (ea); + boofar (fa); + boofar (ga); + boofar (ha); + boofar (ia); + boofar (ja); + boofar (ka); + boofar (la); + boofar (ma); + boofar (na); + boofar (oa); + boofar (pa); + + boofar (ab); + boofar (bb); + boofar (cb); + boofar (db); + boofar (eb); + boofar (fb); + boofar (gb); + boofar (hb); + boofar (ib); + boofar (jb); + boofar (kb); + boofar (lb); + boofar (mb); + boofar (nb); + boofar (ob); + boofar (pb); + +} + +test_exit_ignore_stack () +{ + foobar (1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/900407-1.c b/gcc/testsuite/gcc.c-torture/compile/900407-1.c new file mode 100755 index 0000000..fdf4779 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/900407-1.c @@ -0,0 +1,10 @@ +foo (a, b, p) + int *p; +{ + int c; + p[1] = a + 0x1000; + c = b + 0xffff0000; + if ((b + 0xffff0000) == 0) + c++; + p[2] = c; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/900516-1.c b/gcc/testsuite/gcc.c-torture/compile/900516-1.c new file mode 100755 index 0000000..69e9614 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/900516-1.c @@ -0,0 +1 @@ +f(c){return!(c?2.0:1.0);} diff --git a/gcc/testsuite/gcc.c-torture/compile/920301-1.c b/gcc/testsuite/gcc.c-torture/compile/920301-1.c new file mode 100755 index 0000000..c4d663e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920301-1.c @@ -0,0 +1,4 @@ +#ifndef NO_LABEL_VALUES +f(){static void*t[]={&&x};x:;} +#endif +g(){static unsigned p[5];} diff --git a/gcc/testsuite/gcc.c-torture/compile/920409-1.c b/gcc/testsuite/gcc.c-torture/compile/920409-1.c new file mode 100755 index 0000000..b96ec53 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920409-1.c @@ -0,0 +1 @@ +x(){int y;y>0.0?y:y-1;} diff --git a/gcc/testsuite/gcc.c-torture/compile/920409-2.c b/gcc/testsuite/gcc.c-torture/compile/920409-2.c new file mode 100755 index 0000000..ef2bdb8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920409-2.c @@ -0,0 +1,2 @@ +double x(){int x1,x2;double v; +if(((long)(x1-x2))<1)return -1.0;v=t(v);v=y(1,v>0.0?(int)v:((int)v-1));} diff --git a/gcc/testsuite/gcc.c-torture/compile/920410-1.c b/gcc/testsuite/gcc.c-torture/compile/920410-1.c new file mode 100755 index 0000000..4bfa7a6 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920410-1.c @@ -0,0 +1,30 @@ +int alloc_float(f) + float f; +{ union + { + float f; + int i; + } + u; + u.f=f; + return u.i&~1; +} + +float c_float(int obj) +{ union + { + float f; + int i; + } u; + + u.i=obj; + return u.f; +} + +main() +{ int x=alloc_float(1.2); + int y=alloc_float(5.7); + int z=alloc_float(c_float(x)*c_float(y)); + + printf("%g\n",(double)c_float(z)); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/920410-2.c b/gcc/testsuite/gcc.c-torture/compile/920410-2.c new file mode 100755 index 0000000..958aae9 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920410-2.c @@ -0,0 +1,12 @@ +joe() +{ + int j; + + while( 1 ) + { + for( j = 0; j < 4; j++ ) + ; + for( j = 0; j < 4; j++ ) + ; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/920411-2.c b/gcc/testsuite/gcc.c-torture/compile/920411-2.c new file mode 100755 index 0000000..0cc13c8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920411-2.c @@ -0,0 +1 @@ +x(){int n;double x;n=x<1?n:n+1;} diff --git a/gcc/testsuite/gcc.c-torture/compile/920413-1.c b/gcc/testsuite/gcc.c-torture/compile/920413-1.c new file mode 100755 index 0000000..45b5fc5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920413-1.c @@ -0,0 +1,2 @@ +union u {double d;long long ll;}; +f(double x, int n){union u v;v.d=x;if(n>=0){v.ll<<=63;}else{v.ll+=1<<-n;v.ll>>=-n;}return v.ll;} diff --git a/gcc/testsuite/gcc.c-torture/compile/920415-1.c b/gcc/testsuite/gcc.c-torture/compile/920415-1.c new file mode 100755 index 0000000..8d9bc06 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920415-1.c @@ -0,0 +1,17 @@ +#ifndef NO_LABEL_VALUES +f () +{ + __label__ l; + void *x() + { + return &&l; + } + goto *x (); + abort (); + return; + l: + exit (0); +} +#else +int x; +#endif diff --git a/gcc/testsuite/gcc.c-torture/compile/920428-1.c b/gcc/testsuite/gcc.c-torture/compile/920428-1.c new file mode 100755 index 0000000..fdc478a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920428-1.c @@ -0,0 +1 @@ +x(){char*q;return(long)q>>8&0xff;} diff --git a/gcc/testsuite/gcc.c-torture/compile/920428-2.c b/gcc/testsuite/gcc.c-torture/compile/920428-2.c new file mode 100755 index 0000000..23f32a8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920428-2.c @@ -0,0 +1,531 @@ +double sin(double x); +double cos(double x); +double tan(double x); +double asin(double x); +double acos(double x); +double atan(double x); +double atan2(double y, double x); +double sinh(double x); +double cosh(double x); +double tanh(double x); +double exp(double x); +double expm1(double x); +double log(double x); +double log10(double x); +double log1p(double x); +double pow(double x, double y); +double sqrt(double x); +double cbrt(double x); +double ceil(double x); +double floor(double x); +double fabs(double x); +double frexp(double value, int *eptr); +double ldexp(double value, int exp); +double modf(double value, double *iptr); +double erf(double x); +double erfc(double x); +double atof(const char *nptr); +double hypot(double x, double y); +double lgamma(double x); +double j0(double x); +double j1(double x); +double jn(int n, double x); +double y0(double x); +double y1(double x); +double yn(int n, double x); +extern struct _iobuf { + int _cnt; + char *_ptr; + char *_base; + int _bufsiz; + short _flag; + char _file; +} _iob[]; +typedef unsigned long size_t; +typedef char *va_list; +struct _iobuf *fopen(const char *filename, const char *type); +struct _iobuf *freopen(const char *filename, const char *type, struct _iobuf *stream); +struct _iobuf *fdopen(int fildes, const char *type); +struct _iobuf *popen(const char *command, const char *type); +int pclose(struct _iobuf *stream); +int fflush(struct _iobuf *stream); +int fclose(struct _iobuf *stream); +int remove(const char *path); +int rename(const char *from, const char *to); +struct _iobuf *tmpfile(void); +char *tmpnam(char *s); +int setvbuf(struct _iobuf *iop, char *buf, int type, size_t size); +int setbuf(struct _iobuf *stream, char *buf); +int setbuffer(struct _iobuf *stream, char *buf, size_t size); +int setlinebuf(struct _iobuf *stream); +int fprintf(struct _iobuf *stream, const char *format, ...); +int printf(const char *format, ...); +char *sprintf(char *s, const char *format, ...); +int vfprintf(struct _iobuf *stream, const char *format, va_list arg); +int vprintf(const char *format, va_list arg); +int vsprintf(char *s, const char *format, va_list arg); +int fscanf(struct _iobuf *stream, const char *format, ...); +int scanf(const char *format, ...); +int sscanf(char *s, const char *format, ...); +int fgetc(struct _iobuf *stream); +int getw(struct _iobuf *stream); +char *fgets(char *s, int n, struct _iobuf *stream); +char *gets(char *s); +int fputc(int c, struct _iobuf *stream); +int putw(int w, struct _iobuf *stream); +int fputs(const char *s, struct _iobuf *stream); +int puts(const char *s); +int ungetc(int c, struct _iobuf *stream); +int fread(void *ptr, size_t size, size_t count, struct _iobuf *iop); +int fwrite(const void *ptr, size_t size, size_t count, struct _iobuf *iop); +int fseek(struct _iobuf *stream, long offset, int ptrname); +long ftell(struct _iobuf *stream); +void rewind(struct _iobuf *stream); +int fgetpos(struct _iobuf *stream, long *pos); +int fsetpos(struct _iobuf *stream, const long *pos); +void perror(const char *s); +typedef unsigned char byte; +typedef unsigned char uchar; +typedef unsigned short ushort; +typedef unsigned int uint; +typedef unsigned long ulong; +typedef unsigned char u_char; +typedef unsigned short u_short; +typedef unsigned int u_int; +typedef unsigned long u_long; +typedef unsigned short ushort_; +typedef struct _physadr { int r[1]; } *physadr; +typedef struct label_t { + int val[11]; +} label_t; +typedef struct _quad { long val[2]; } quad; +typedef long daddr_t; +typedef char * caddr_t; +typedef u_long ino_t; +typedef long swblk_t; +typedef long time_t; +typedef short dev_t; +typedef long off_t; +typedef u_short uid_t; +typedef u_short gid_t; +typedef signed char prio_t; +typedef long fd_mask; +typedef struct fd_set { + fd_mask fds_bits[(((256 )+(( (sizeof(fd_mask) * 8 ) )-1))/( (sizeof(fd_mask) * 8 ) )) ]; +} fd_set; +typedef struct qhdr { + struct qhdr *link, *rlink; +} *queue_t; +typedef char *ptr_ord_t; +typedef double floatp; +typedef char *(*proc_alloc_t)(unsigned num_elements, unsigned element_size, const char *client_name ); +typedef void (*proc_free_t)(char *data, unsigned num_elements, unsigned element_size, const char *client_name ); +extern struct _iobuf *gs_out; +typedef struct gs_point_s { + double x, y; +} gs_point; +typedef struct gs_int_point_s { + int x, y; +} gs_int_point; +typedef struct gs_rect_s { + gs_point p, q; +} gs_rect; +typedef struct gs_int_rect_s { + gs_int_point p, q; +} gs_int_rect; +typedef struct gs_state_s gs_state; +typedef struct { + proc_alloc_t alloc; + proc_free_t free; +} gs_memory_procs; +char *gs_malloc(uint, uint, const char * ); +void gs_free(char *, uint, uint, const char * ); +extern char gs_debug[128]; +extern int gs_log_error(int, const char *, int ); +typedef long fixed; +typedef struct gs_fixed_point_s { + fixed x, y; +} gs_fixed_point; +typedef struct gs_fixed_rect_s { + gs_fixed_point p, q; +} gs_fixed_rect; +typedef struct gs_matrix_s { + long _xx; float xx; long _xy; float xy; long _yx; float yx; long _yy; float yy; long _tx; float tx; long _ty; float ty; +} gs_matrix; +void gs_make_identity(gs_matrix * ); +int gs_make_translation(floatp, floatp, gs_matrix * ), + gs_make_scaling(floatp, floatp, gs_matrix * ), + gs_make_rotation(floatp, gs_matrix * ); +int gs_matrix_multiply(const gs_matrix *, const gs_matrix *, gs_matrix * ), + gs_matrix_invert(const gs_matrix *, gs_matrix * ), + gs_matrix_rotate(const gs_matrix *, floatp, gs_matrix * ); +int gs_point_transform(floatp, floatp, const gs_matrix *, gs_point * ), + gs_point_transform_inverse(floatp, floatp, const gs_matrix *, gs_point * ), + gs_distance_transform(floatp, floatp, const gs_matrix *, gs_point * ), + gs_distance_transform_inverse(floatp, floatp, const gs_matrix *, gs_point * ), + gs_bbox_transform_inverse(gs_rect *, gs_matrix *, gs_rect * ); +typedef struct gs_matrix_fixed_s { + long _xx; float xx; long _xy; float xy; long _yx; float yx; long _yy; float yy; long _tx; float tx; long _ty; float ty; + fixed tx_fixed, ty_fixed; +} gs_matrix_fixed; +extern void gs_update_matrix_fixed(gs_matrix_fixed * ); +int gs_point_transform2fixed(gs_matrix_fixed *, floatp, floatp, gs_fixed_point * ), + gs_distance_transform2fixed(gs_matrix_fixed *, floatp, floatp, gs_fixed_point * ); +typedef struct { + long xx, xy, yx, yy; + int skewed; + int shift; + int max_bits; + fixed round; +} fixed_coeff; + +typedef enum { + gs_cap_butt = 0, + gs_cap_round = 1, + gs_cap_square = 2 +} gs_line_cap; +typedef enum { + gs_join_miter = 0, + gs_join_round = 1, + gs_join_bevel = 2 +} gs_line_join; +gs_state *gs_state_alloc(proc_alloc_t, proc_free_t ); +int gs_state_free(gs_state * ); +int gs_gsave(gs_state * ), + gs_grestore(gs_state * ), + gs_grestoreall(gs_state * ); +gs_state *gs_gstate(gs_state * ); +int gs_currentgstate(gs_state * , const gs_state * ), + gs_setgstate(gs_state * , const gs_state * ); +gs_state *gs_state_swap_saved(gs_state *, gs_state * ); +void gs_state_swap(gs_state *, gs_state * ); +int gs_initgraphics(gs_state * ); +typedef struct gx_device_s gx_device; +int gs_flushpage(gs_state * ); +int gs_copypage(gs_state * ); +int gs_output_page(gs_state *, int, int ); +int gs_copyscanlines(gx_device *, int, byte *, uint, int *, uint * ); +gx_device * gs_getdevice(int ); +int gs_copydevice(gx_device **, gx_device *, proc_alloc_t ); +int gs_makeimagedevice(gx_device **, gs_matrix *, uint, uint, byte *, int, proc_alloc_t ); +void gs_nulldevice(gs_state * ); +int gs_setdevice(gs_state *, gx_device * ); +gx_device * gs_currentdevice(gs_state * ); +const char * gs_devicename(gx_device * ); +void gs_deviceinitialmatrix(gx_device *, gs_matrix * ); +int gs_closedevice(gx_device * ); +int gs_setlinewidth(gs_state *, floatp ); +float gs_currentlinewidth(const gs_state * ); +int gs_setlinecap(gs_state *, gs_line_cap ); +gs_line_cap gs_currentlinecap(const gs_state * ); +int gs_setlinejoin(gs_state *, gs_line_join ); +gs_line_join gs_currentlinejoin(const gs_state * ); +int gs_setmiterlimit(gs_state *, floatp ); +float gs_currentmiterlimit(const gs_state * ); +int gs_setdash(gs_state *, const float *, uint, floatp ); +uint gs_currentdash_length(const gs_state * ); +int gs_currentdash_pattern(const gs_state *, float * ); +float gs_currentdash_offset(const gs_state * ); +int gs_setflat(gs_state *, floatp ); +float gs_currentflat(const gs_state * ); +int gs_setstrokeadjust(gs_state *, int ); +int gs_currentstrokeadjust(const gs_state * ); +typedef enum { + gs_color_space_DeviceGray = 0, + gs_color_space_DeviceRGB, + gs_color_space_DeviceCMYK +} gs_color_space; +typedef struct gs_color_s gs_color; +extern const uint gs_color_sizeof; +int gs_setgray(gs_state *, floatp ); +float gs_currentgray(gs_state * ); +int gs_sethsbcolor(gs_state *, floatp, floatp, floatp ), + gs_currenthsbcolor(gs_state *, float [3] ), + gs_setrgbcolor(gs_state *, floatp, floatp, floatp ), + gs_currentrgbcolor(gs_state *, float [3] ); +int gs_currentcolorspace(gs_state *, gs_color_space * ); +typedef float (*gs_transfer_proc)(gs_state *, floatp ); +int gs_settransfer(gs_state *, gs_transfer_proc ), + gs_settransfer_remap(gs_state *, gs_transfer_proc, int ); +gs_transfer_proc gs_currenttransfer(gs_state * ); +int gs_setcolortransfer(gs_state *, gs_transfer_proc , + gs_transfer_proc , gs_transfer_proc , + gs_transfer_proc ), + gs_setcolortransfer_remap(gs_state *, gs_transfer_proc , + gs_transfer_proc , gs_transfer_proc , + gs_transfer_proc , int ); +void gs_currentcolortransfer(gs_state *, gs_transfer_proc [4] ); +int gs_setscreen(gs_state *, floatp, floatp, float (*)(floatp, floatp ) ); +int gs_currentscreen(gs_state *, float *, float *, float (**)(floatp, floatp ) ); +int gs_sethalftonephase(gs_state *, int, int ); +int gs_currenthalftonephase(gs_state *, gs_int_point * ); +typedef struct gs_screen_enum_s gs_screen_enum; +extern const uint gs_screen_enum_sizeof; +int gs_screen_init(gs_screen_enum *, gs_state *, floatp, floatp ); +int gs_screen_currentpoint(gs_screen_enum *, gs_point * ); +int gs_screen_next(gs_screen_enum *, floatp ); +struct gs_state_s { + gs_state *saved; + gs_memory_procs memory_procs; + gs_matrix_fixed ctm; + gs_matrix ctm_inverse; + int inverse_valid; + struct gx_path_s *path; + struct gx_clip_path_s *clip_path; + int clip_rule; + struct line_params_s *line_params; + struct halftone_params_s *halftone; + float (*ht_proc)(floatp, floatp ); + gs_int_point ht_phase; + gs_int_point phase_mod; + struct gs_color_s *color; + struct gx_device_color_s *dev_color; + struct gx_transfer_s *transfer; + struct gs_font_s *font; + gs_matrix char_tm; + int char_tm_valid; + byte in_cachedevice; + byte in_charpath; + + + + + int level; + float flatness; + int stroke_adjust; + struct device_s *device; + int device_is_shared; + +}; +typedef unsigned long gx_bitmap_id; +typedef struct gx_bitmap_s { + byte *data; + int raster; + gs_int_point size; + gx_bitmap_id id; + ushort rep_width, rep_height; +} gx_bitmap; +typedef unsigned long gx_color_index; +typedef unsigned short gx_color_value; +typedef struct gx_device_color_info_s { + int num_components; + + int depth; + gx_color_value max_gray; + gx_color_value max_rgb; + + gx_color_value dither_gray; + gx_color_value dither_rgb; + +} gx_device_color_info; +typedef struct gx_device_procs_s gx_device_procs; +struct gx_device_s { + int params_size; gx_device_procs *procs; const char *dname; int width; int height; float x_pixels_per_inch; float y_pixels_per_inch; float l_margin, b_margin, r_margin, t_margin; gx_device_color_info color_info; int is_open; +}; +typedef struct gs_prop_item_s gs_prop_item; +struct gx_device_procs_s { + int (*open_device)(gx_device *dev ); + void (*get_initial_matrix)(gx_device *dev, gs_matrix *pmat ); + int (*sync_output)(gx_device *dev ); + int (*output_page)(gx_device *dev, int num_copies, int flush ); + int (*close_device)(gx_device *dev ); + gx_color_index (*map_rgb_color)(gx_device *dev, gx_color_value red, gx_color_value green, gx_color_value blue ); + int (*map_color_rgb)(gx_device *dev, gx_color_index color, gx_color_value rgb[3] ); + int (*fill_rectangle)(gx_device *dev, int x, int y, int width, int height, gx_color_index color ); + int (*tile_rectangle)(gx_device *dev, gx_bitmap *tile, int x, int y, int width, int height, gx_color_index color0, gx_color_index color1, int phase_x, int phase_y ); + int (*copy_mono)(gx_device *dev, unsigned char *data, int data_x, int raster, gx_bitmap_id id, int x, int y, int width, int height, gx_color_index color0, gx_color_index color1 ); + int (*copy_color)(gx_device *dev, unsigned char *data, int data_x, int raster, gx_bitmap_id id, int x, int y, int width, int height ); + int (*draw_line)(gx_device *dev, int x0, int y0, int x1, int y1, gx_color_index color ); + int (*get_bits)(gx_device *dev, int y, unsigned char *data, unsigned int size, int pad_to_word ); + int (*get_props)(gx_device *dev, gs_prop_item *plist ); + + int (*put_props)(gx_device *dev, gs_prop_item *plist, int count ); + +}; +extern unsigned int gx_device_bytes_per_scan_line(gx_device *dev, int pad_to_word ); +int gx_default_open_device(gx_device *dev ); +void gx_default_get_initial_matrix(gx_device *dev, gs_matrix *pmat ); +int gx_default_sync_output(gx_device *dev ); +int gx_default_output_page(gx_device *dev, int num_copies, int flush ); +int gx_default_close_device(gx_device *dev ); +gx_color_index gx_default_map_rgb_color(gx_device *dev, gx_color_value red, gx_color_value green, gx_color_value blue ); +int gx_default_map_color_rgb(gx_device *dev, gx_color_index color, gx_color_value rgb[3] ); +int gx_default_tile_rectangle(gx_device *dev, gx_bitmap *tile, int x, int y, int width, int height, gx_color_index color0, gx_color_index color1, int phase_x, int phase_y ); +int gx_default_copy_color(gx_device *dev, unsigned char *data, int data_x, int raster, gx_bitmap_id id, int x, int y, int width, int height ); +int gx_default_draw_line(gx_device *dev, int x0, int y0, int x1, int y1, gx_color_index color ); +int gx_default_get_bits(gx_device *dev, int y, unsigned char *data, unsigned int size, int pad_to_word ); +int gx_default_get_props(gx_device *dev, gs_prop_item *plist ); +int gx_default_put_props(gx_device *dev, gs_prop_item *plist, int count ); +typedef struct device_s { + gx_device *info; + int is_band_device; + gx_color_index white, black; +} device; +int gs_initmatrix(gs_state * ), + gs_defaultmatrix(const gs_state *, gs_matrix * ), + gs_currentmatrix(const gs_state *, gs_matrix * ), + gs_setmatrix(gs_state *, const gs_matrix * ), + gs_translate(gs_state *, floatp, floatp ), + gs_scale(gs_state *, floatp, floatp ), + gs_rotate(gs_state *, floatp ), + gs_concat(gs_state *, const gs_matrix * ); +int gs_transform(gs_state *, floatp, floatp, gs_point * ), + gs_dtransform(gs_state *, floatp, floatp, gs_point * ), + gs_itransform(gs_state *, floatp, floatp, gs_point * ), + gs_idtransform(gs_state *, floatp, floatp, gs_point * ); +static int +ctm_set_inverse(gs_state *pgs) +{ int code = gs_matrix_invert(&*(gs_matrix *)&(pgs)->ctm , &pgs->ctm_inverse); + 0; + if ( code < 0 ) return code; + pgs->inverse_valid = 1; + return 0; +} +void +gs_update_matrix_fixed(gs_matrix_fixed *pmat) +{ (*pmat). tx = ((float)(((*pmat). tx_fixed = ((fixed)(((*pmat). tx)*(float)(1<<12 ) )) )*(1.0/(1<<12 ) ))) , (*pmat). ty = ((float)(((*pmat). ty_fixed = ((fixed)(((*pmat). ty)*(float)(1<<12 ) )) )*(1.0/(1<<12 ) ))); +} +int +gs_initmatrix(gs_state *pgs) +{ gx_device *dev = pgs->device->info; + (*dev->procs->get_initial_matrix)(dev, &*(gs_matrix *)&(pgs)->ctm ); + (pgs->ctm). tx = ((float)(((pgs->ctm). tx_fixed = ((fixed)(((pgs->ctm). tx)*(float)(1<<12 ) )) )*(1.0/(1<<12 ) ))) , (pgs->ctm). ty = ((float)(((pgs->ctm). ty_fixed = ((fixed)(((pgs->ctm). ty)*(float)(1<<12 ) )) )*(1.0/(1<<12 ) ))) , pgs->inverse_valid = 0, pgs->char_tm_valid = 0; + return 0; +} +int +gs_defaultmatrix(const gs_state *pgs, gs_matrix *pmat) +{ gx_device *dev = pgs->device->info; + (*dev->procs->get_initial_matrix)(dev, pmat); + return 0; +} +int +gs_currentmatrix(const gs_state *pgs, gs_matrix *pmat) +{ *pmat = *(gs_matrix *)&(pgs)->ctm; + return 0; +} +int +gs_setmatrix(gs_state *pgs, const gs_matrix *pmat) +{ *(gs_matrix *)&(pgs)->ctm = *pmat; + (pgs->ctm). tx = ((float)(((pgs->ctm). tx_fixed = ((fixed)(((pgs->ctm). tx)*(float)(1<<12 ) )) )*(1.0/(1<<12 ) ))) , (pgs->ctm). ty = ((float)(((pgs->ctm). ty_fixed = ((fixed)(((pgs->ctm). ty)*(float)(1<<12 ) )) )*(1.0/(1<<12 ) ))) , pgs->inverse_valid = 0, pgs->char_tm_valid = 0; + return 0; +} +int +gs_translate(gs_state *pgs, floatp dx, floatp dy) +{ gs_point pt; + int code; + if ( (code = gs_distance_transform(dx, dy, &*(gs_matrix *)&(pgs)->ctm , &pt)) < 0 ) + return code; + pgs->ctm.tx += pt.x; + pgs->ctm.ty += pt.y; + (pgs->ctm). tx = ((float)(((pgs->ctm). tx_fixed = ((fixed)(((pgs->ctm). tx)*(float)(1<<12 ) )) )*(1.0/(1<<12 ) ))) , (pgs->ctm). ty = ((float)(((pgs->ctm). ty_fixed = ((fixed)(((pgs->ctm). ty)*(float)(1<<12 ) )) )*(1.0/(1<<12 ) ))) , pgs->inverse_valid = 0, pgs->char_tm_valid = 0; + return 0; +} +int +gs_scale(gs_state *pgs, floatp sx, floatp sy) +{ pgs->ctm.xx *= sx; + pgs->ctm.xy *= sx; + pgs->ctm.yx *= sy; + pgs->ctm.yy *= sy; + pgs->inverse_valid = 0, pgs->char_tm_valid = 0; + return 0; +} +int +gs_rotate(gs_state *pgs, floatp ang) +{ int code = gs_matrix_rotate(&*(gs_matrix *)&(pgs)->ctm , ang, &*(gs_matrix *)&(pgs)->ctm ); + pgs->inverse_valid = 0, pgs->char_tm_valid = 0; + return code; +} +int +gs_concat(gs_state *pgs, const gs_matrix *pmat) +{ int code = gs_matrix_multiply(pmat, &*(gs_matrix *)&(pgs)->ctm , &*(gs_matrix *)&(pgs)->ctm ); + (pgs->ctm). tx = ((float)(((pgs->ctm). tx_fixed = ((fixed)(((pgs->ctm). tx)*(float)(1<<12 ) )) )*(1.0/(1<<12 ) ))) , (pgs->ctm). ty = ((float)(((pgs->ctm). ty_fixed = ((fixed)(((pgs->ctm). ty)*(float)(1<<12 ) )) )*(1.0/(1<<12 ) ))) , pgs->inverse_valid = 0, pgs->char_tm_valid = 0; + return code; +} +int +gs_transform(gs_state *pgs, floatp x, floatp y, gs_point *pt) +{ return gs_point_transform(x, y, &*(gs_matrix *)&(pgs)->ctm , pt); +} +int +gs_dtransform(gs_state *pgs, floatp dx, floatp dy, gs_point *pt) +{ return gs_distance_transform(dx, dy, &*(gs_matrix *)&(pgs)->ctm , pt); +} +int +gs_itransform(gs_state *pgs, floatp x, floatp y, gs_point *pt) +{ + + if ( !!(((*(long *)(&((&pgs->ctm)->xy)) | *(long *)(&( (&pgs->ctm)->yx)) ) << 1) == 0) ) + { return gs_point_transform_inverse(x, y, &*(gs_matrix *)&(pgs)->ctm , pt); + } + else + { if ( !pgs->inverse_valid ) { int code = ctm_set_inverse(pgs); if ( code < 0 ) return code; }; + return gs_point_transform(x, y, &pgs->ctm_inverse, pt); + } +} +int +gs_idtransform(gs_state *pgs, floatp dx, floatp dy, gs_point *pt) +{ + + if ( !!(((*(long *)(&((&pgs->ctm)->xy)) | *(long *)(&( (&pgs->ctm)->yx)) ) << 1) == 0) ) + { return gs_distance_transform_inverse(dx, dy, + &*(gs_matrix *)&(pgs)->ctm , pt); + } + else + { if ( !pgs->inverse_valid ) { int code = ctm_set_inverse(pgs); if ( code < 0 ) return code; }; + return gs_distance_transform(dx, dy, &pgs->ctm_inverse, pt); + } +} +int +gs_translate_to_fixed(register gs_state *pgs, fixed px, fixed py) +{ pgs->ctm.tx = ((float)((pgs->ctm.tx_fixed = px)*(1.0/(1<<12 ) ))); + pgs->ctm.ty = ((float)((pgs->ctm.ty_fixed = py)*(1.0/(1<<12 ) ))); + pgs->inverse_valid = 0; + pgs->char_tm_valid = 1; + return 0; +} +int +gx_matrix_to_fixed_coeff(const gs_matrix *pmat, register fixed_coeff *pfc, + int max_bits) +{ gs_matrix ctm; + int scale = -10000; + int expt, shift; + ctm = *pmat; + pfc->skewed = 0; + if ( !((*(long *)(&(ctm.xx)) << 1) == 0) ) + { (void)frexp(ctm.xx, &scale); + } + if ( !((*(long *)(&(ctm.xy)) << 1) == 0) ) + { (void)frexp(ctm.xy, &expt); + if ( expt > scale ) scale = expt; + pfc->skewed = 1; + } + if ( !((*(long *)(&(ctm.yx)) << 1) == 0) ) + { (void)frexp(ctm.yx, &expt); + if ( expt > scale ) scale = expt; + pfc->skewed = 1; + } + if ( !((*(long *)(&(ctm.yy)) << 1) == 0) ) + { (void)frexp(ctm.yy, &expt); + if ( expt > scale ) scale = expt; + } + scale = sizeof(long) * 8 - 1 - max_bits - scale; + shift = scale - 12; + if ( shift > 0 ) + { pfc->shift = shift; + pfc->round = (fixed)1 << (shift - 1); + } + else + { pfc->shift = 0; + pfc->round = 0; + scale -= shift; + } + pfc->xx = (((*(long *)(&(ctm.xx)) << 1) == 0) ? 0 : (long)ldexp(ctm.xx, scale)); + pfc->yy = (((*(long *)(&(ctm.yy)) << 1) == 0) ? 0 : (long)ldexp(ctm.yy, scale)); + if ( pfc->skewed ) + { pfc->xy = (((*(long *)(&(ctm.xy)) << 1) == 0) ? 0 : (long)ldexp(ctm.xy, scale)); + pfc->yx = (((*(long *)(&(ctm.yx)) << 1) == 0) ? 0 : (long)ldexp(ctm.yx, scale)); + } + else + pfc->xy = pfc->yx = 0; + pfc->max_bits = max_bits; + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/920428-3.c b/gcc/testsuite/gcc.c-torture/compile/920428-3.c new file mode 100755 index 0000000..13640c9 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920428-3.c @@ -0,0 +1,5 @@ +#ifndef NO_LABEL_VALUES +x(a){static void*j[]={&&l1,&&l2};goto*j[a];l1:return 0;l2:return 1;} +#else +main(){ exit (0); } +#endif diff --git a/gcc/testsuite/gcc.c-torture/compile/920428-4.c b/gcc/testsuite/gcc.c-torture/compile/920428-4.c new file mode 100755 index 0000000..cc5e30c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920428-4.c @@ -0,0 +1 @@ +x(a){struct{int p[a],i;}l;l.i;} diff --git a/gcc/testsuite/gcc.c-torture/compile/920428-5.c b/gcc/testsuite/gcc.c-torture/compile/920428-5.c new file mode 100755 index 0000000..ff31379 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920428-5.c @@ -0,0 +1 @@ +typedef struct{unsigned b0:1;}*t;x(a,b)t a,b;{b->b0=a->b0;} diff --git a/gcc/testsuite/gcc.c-torture/compile/920428-6.c b/gcc/testsuite/gcc.c-torture/compile/920428-6.c new file mode 100755 index 0000000..e43af7e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920428-6.c @@ -0,0 +1,22 @@ +typedef struct x +{ + struct x *type; + struct x *chain; + struct x *value; +} *tree; + +int +func (new, old) + register tree new, old; +{ + if (old->type == 0 || new->type == 0) + { + register tree t = old->type; + if (t == 0) + t = new->type; + for (; t; t = t->chain ) + if (t->value) + return 1; + } + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/920428-7.c b/gcc/testsuite/gcc.c-torture/compile/920428-7.c new file mode 100755 index 0000000..69b1d97 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920428-7.c @@ -0,0 +1 @@ +x(float*x){int a[4],i=0,j;for(j=0;j<2;j++){f(a[i++]);f(a[i++]);}} diff --git a/gcc/testsuite/gcc.c-torture/compile/920501-1.c b/gcc/testsuite/gcc.c-torture/compile/920501-1.c new file mode 100755 index 0000000..a849564 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920501-1.c @@ -0,0 +1,7 @@ +/* CYGNUS LOCAL -- meissner/no label values */ +#ifndef NO_LABEL_VALUES +a(){int**b[]={&&c};c:;} +#else +int x; +#endif +/* END CYGNUS LOCAL -- meissner/no label values */ diff --git a/gcc/testsuite/gcc.c-torture/compile/920501-10.c b/gcc/testsuite/gcc.c-torture/compile/920501-10.c new file mode 100755 index 0000000..ecb5bb4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920501-10.c @@ -0,0 +1 @@ +x(y){return 8193*y;} diff --git a/gcc/testsuite/gcc.c-torture/compile/920501-11.c b/gcc/testsuite/gcc.c-torture/compile/920501-11.c new file mode 100755 index 0000000..d636357 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920501-11.c @@ -0,0 +1 @@ +typedef struct{int s;}S;foo(){int i=(int)&(S){(void*)((int)&(S){1})};} diff --git a/gcc/testsuite/gcc.c-torture/compile/920501-12.c b/gcc/testsuite/gcc.c-torture/compile/920501-12.c new file mode 100755 index 0000000..594e141 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920501-12.c @@ -0,0 +1,5 @@ +x(x){ return 3 + x;} +a(x){int y[994]; return 3 + x;} +b(x){int y[999]; return 2*(x + 3);} +A(x){int y[9999];return 2*(x + 3);} +B(x){int y[9949];return 3 + x;} diff --git a/gcc/testsuite/gcc.c-torture/compile/920501-13.c b/gcc/testsuite/gcc.c-torture/compile/920501-13.c new file mode 100755 index 0000000..b5a6798 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920501-13.c @@ -0,0 +1 @@ +typedef struct{int i;}t;inline y(t u){}x(){t u;y(u);} diff --git a/gcc/testsuite/gcc.c-torture/compile/920501-15.c b/gcc/testsuite/gcc.c-torture/compile/920501-15.c new file mode 100755 index 0000000..81fd664 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920501-15.c @@ -0,0 +1 @@ +x(a)double a;{int i;return i>a?i:i+1;} diff --git a/gcc/testsuite/gcc.c-torture/compile/920501-16.c b/gcc/testsuite/gcc.c-torture/compile/920501-16.c new file mode 100755 index 0000000..f82b752 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920501-16.c @@ -0,0 +1 @@ +f(n){struct z{int a,b[n],c[n];};} diff --git a/gcc/testsuite/gcc.c-torture/compile/920501-17.c b/gcc/testsuite/gcc.c-torture/compile/920501-17.c new file mode 100755 index 0000000..05a4d40 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920501-17.c @@ -0,0 +1 @@ +x(){static const char x[]="x";char y[2];y[0]=x[1];} diff --git a/gcc/testsuite/gcc.c-torture/compile/920501-18.c b/gcc/testsuite/gcc.c-torture/compile/920501-18.c new file mode 100755 index 0000000..70f7c0a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920501-18.c @@ -0,0 +1,2 @@ +union u{int i;float f;}; +x(p)int p;{union u x;for(x.i=0;x.i<p;x.i++)if(x.f>(float)3.0)break;} diff --git a/gcc/testsuite/gcc.c-torture/compile/920501-19.c b/gcc/testsuite/gcc.c-torture/compile/920501-19.c new file mode 100755 index 0000000..1671cc3 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920501-19.c @@ -0,0 +1 @@ +long long x=0;y(){x=0;} diff --git a/gcc/testsuite/gcc.c-torture/compile/920501-2.c b/gcc/testsuite/gcc.c-torture/compile/920501-2.c new file mode 100755 index 0000000..905f5dd --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920501-2.c @@ -0,0 +1,11 @@ +extern short distdata[64][64], taxidata[64][64]; +extern short PieceList[2][64]; + +int +ScoreKBNK (short int winner, short int king1, short int king2) +{ + register short s; + + s = taxidata[king1][king2] + distdata[PieceList[winner][1]][king2]; + return s; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/920501-20.c b/gcc/testsuite/gcc.c-torture/compile/920501-20.c new file mode 100755 index 0000000..170d050 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920501-20.c @@ -0,0 +1 @@ +int*f(x)int*x;{if(x[4]){int h[1];if(setjmp(h))return x;}} diff --git a/gcc/testsuite/gcc.c-torture/compile/920501-21.c b/gcc/testsuite/gcc.c-torture/compile/920501-21.c new file mode 100755 index 0000000..4a9f05a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920501-21.c @@ -0,0 +1,3 @@ +typedef unsigned short t; +struct foo{t d;}; +int bar(d)t d;{struct foo u;u.d=d;return(int)(&u);} diff --git a/gcc/testsuite/gcc.c-torture/compile/920501-22.c b/gcc/testsuite/gcc.c-torture/compile/920501-22.c new file mode 100755 index 0000000..b15d798 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920501-22.c @@ -0,0 +1 @@ +x(){int y[]={};} diff --git a/gcc/testsuite/gcc.c-torture/compile/920501-23.c b/gcc/testsuite/gcc.c-torture/compile/920501-23.c new file mode 100755 index 0000000..291d93e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920501-23.c @@ -0,0 +1,16 @@ +typedef unsigned char qi; +typedef unsigned short hi; +typedef unsigned long si; +typedef unsigned long long di; +subi(a){return 100-a;} +add(a,b){return a+b;} +mul(a){return 85*a;} +memshift(p)unsigned*p;{unsigned x;for(;;){x=*p++>>16;if(x)return x;}} +ldw(xp)si*xp;{return xp[4];} +ldws_m(xp)si*xp;{si x;do{x=xp[3];xp+=3;}while(x);} +postinc_si(p)si*p;{si x;for(;;){x=*p++;if(x)return x;}} +preinc_si(p)si*p;{si x;for(;;){x=*++p;if(x)return x;}} +postinc_di(p)di*p;{di x;for(;;){x=*p++;if(x)return x;}} +preinc_di(p)di*p;{di x;for(;;){x=*++p;if(x)return x;}} +inc_overlap(p,a)di*p;{do{p=*(di**)p;p=(di*)((int)p+4);}while(*p);} +di move_di(p,p2)di*p,*p2;{di x=p;p2=((di*)x)[1];return p2[1];} diff --git a/gcc/testsuite/gcc.c-torture/compile/920501-24.c b/gcc/testsuite/gcc.c-torture/compile/920501-24.c new file mode 100755 index 0000000..ae9c145 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920501-24.c @@ -0,0 +1,221 @@ +char *malloc (); + +main () +{ + char *buf1; + int i; + int cnt; + + buf1 = malloc (8193); + + read (0, buf1, 8192); + + for (i = 500; i > 0; i--) + cnt = shift (buf1, 8192, '\n'); + printf ("%d ", cnt); + + for (i = 500; i > 0; i--) + cnt = shift_xor (buf1, 8192, '\n'); + printf ("%d ", cnt); + + for (i = 500; i > 0; i--) + cnt = bitfield (buf1, 8192, '\n'); + printf ("%d ", cnt); + + for (i = 500; i > 0; i--) + cnt = char_autoincr (buf1, 8192, '\n'); + printf ("%d ", cnt); + + for (i = 500; i > 0; i--) + cnt = xorand (buf1, 8192, '\n'); + printf ("%d ", cnt); +} + +shift (b1, n, c) + int *b1; + int n; + char c; +{ + int nn; + int cnt = 0; + int w1; + + for (nn = n / (4 * 4); nn > 0; nn--) + { + w1 = *b1++; + if ((char)w1 == c) cnt++; + if ((char)(w1 >>= 8) == c) cnt++; + if ((char)(w1 >>= 8) == c) cnt++; + if ((char)(w1 >>= 8) == c) cnt++; + w1 = *b1++; + if ((char)w1 == c) cnt++; + if ((char)(w1 >>= 8) == c) cnt++; + if ((char)(w1 >>= 8) == c) cnt++; + if ((char)(w1 >>= 8) == c) cnt++; + w1 = *b1++; + if ((char)w1 == c) cnt++; + if ((char)(w1 >>= 8) == c) cnt++; + if ((char)(w1 >>= 8) == c) cnt++; + if ((char)(w1 >>= 8) == c) cnt++; + w1 = *b1++; + if ((char)w1 == c) cnt++; + if ((char)(w1 >>= 8) == c) cnt++; + if ((char)(w1 >>= 8) == c) cnt++; + if ((char)(w1 >>= 8) == c) cnt++; + } + return cnt; +} + +shift_xor (b1, n, c) + int *b1; + int n; + char c; +{ + int nn; + int cnt = 0; + int w1; + int cccc = (c << 24) | (c << 16) | (c << 8) | c; + + for (nn = n / (4 * 4); nn > 0; nn--) + { + w1 = *b1++ ^ cccc; + if ((char)w1 == 0) cnt++; + if ((char)(w1 >>= 8) == 0) cnt++; + if ((char)(w1 >>= 8) == 0) cnt++; + if ((char)(w1 >>= 8) == 0) cnt++; + w1 = *b1++ ^ cccc; + if ((char)w1 == 0) cnt++; + if ((char)(w1 >>= 8) == 0) cnt++; + if ((char)(w1 >>= 8) == 0) cnt++; + if ((char)(w1 >>= 8) == 0) cnt++; + w1 = *b1++ ^ cccc; + if ((char)w1 == 0) cnt++; + if ((char)(w1 >>= 8) == 0) cnt++; + if ((char)(w1 >>= 8) == 0) cnt++; + if ((char)(w1 >>= 8) == 0) cnt++; + w1 = *b1++ ^ cccc; + if ((char)w1 == 0) cnt++; + if ((char)(w1 >>= 8) == 0) cnt++; + if ((char)(w1 >>= 8) == 0) cnt++; + if ((char)(w1 >>= 8) == 0) cnt++; + } + return cnt; +} + +typedef +struct +{ + unsigned b0:8; + unsigned b1:8; + unsigned b2:8; + unsigned b3:8; +} foo; + +bitfield (b1, n, c) + foo *b1; + int n; + char c; +{ + int nn; + int cnt = 0; + register foo w1; + + for (nn = n / (4 * 4); nn > 0; nn--) + { + w1 = *b1++; + if (w1.b0 == c) cnt++; + if (w1.b1 == c) cnt++; + if (w1.b2 == c) cnt++; + if (w1.b3 == c) cnt++; + w1 = *b1++; + if (w1.b0 == c) cnt++; + if (w1.b1 == c) cnt++; + if (w1.b2 == c) cnt++; + if (w1.b3 == c) cnt++; + w1 = *b1++; + if (w1.b0 == c) cnt++; + if (w1.b1 == c) cnt++; + if (w1.b2 == c) cnt++; + if (w1.b3 == c) cnt++; + w1 = *b1++; + if (w1.b0 == c) cnt++; + if (w1.b1 == c) cnt++; + if (w1.b2 == c) cnt++; + if (w1.b3 == c) cnt++; + } + return cnt; +} + + +char_autoincr (b1, n, c) + char *b1; + int n; + char c; +{ + int cnt = 0; + char *bend = b1 + n; + *bend = c; + + for (;;) + { + while (*b1++ != c) + ; + cnt++; + if (b1 > bend) + break; + } + return cnt; +} + +typedef unsigned int uint; + +xorand (b1, n, c) + int *b1; + int n; + unsigned char c; +{ + int xm = ((int) c << 24) | ((int) c << 16) | ((int) c << 8) | ((int) c); + byte_match_count2 (b1, n, xm, 0xff000000, 0xff0000, 0xff00, 0xff); +} + +byte_match_count2 (buf, n, xm, m1, m2, m3, m4) + int *buf; + int n; + uint m1, m2, m3, m4; +{ + int w, cnt = 0; + int *bp; + + n /= 4; + + buf[n] = xm; + + bp = buf; + while (bp < buf + n) + { + w = *bp++ ^ xm; + cnt += ((m1 & w) == 0); + cnt += ((m2 & w) == 0); + cnt += ((m3 & w) == 0); + cnt += ((m4 & w) == 0); + + w = *bp++ ^ xm; + cnt += ((m1 & w) == 0); + cnt += ((m2 & w) == 0); + cnt += ((m3 & w) == 0); + cnt += ((m4 & w) == 0); + + w = *bp++ ^ xm; + cnt += ((m1 & w) == 0); + cnt += ((m2 & w) == 0); + cnt += ((m3 & w) == 0); + cnt += ((m4 & w) == 0); + + w = *bp++ ^ xm; + cnt += ((m1 & w) == 0); + cnt += ((m2 & w) == 0); + cnt += ((m3 & w) == 0); + cnt += ((m4 & w) == 0); + } + return cnt; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/920501-3.c b/gcc/testsuite/gcc.c-torture/compile/920501-3.c new file mode 100755 index 0000000..41ef87f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920501-3.c @@ -0,0 +1,2 @@ +struct{long long x:24,y:40;}v; +x(){v.y=0;} diff --git a/gcc/testsuite/gcc.c-torture/compile/920501-4.c b/gcc/testsuite/gcc.c-torture/compile/920501-4.c new file mode 100755 index 0000000..9cd2fd7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920501-4.c @@ -0,0 +1,49 @@ +foo () +{ + int r0[8186 ]; + int r1[2 ]; + int r2[2 ]; + int bitm0[2 ]; + int bitm1[2 ]; + int bitm2[2 ]; + + int i,j,k,m,n,m_max; + int f; + double fm,ft; + + while (1) { + + if (m%4 == 2) + ++m; + + if (m_max != 0 && m > m_max) + break; + + fm=m; + + r0[k=1]=0; + bitm0[0] = 0; + + while ( n%f == 0 ) { + while ( (ft != 0) && (ft < fm )) { + bitm1[i] = 0; + r1[i]=0; + } + + while ( r0[i] != 0 && r1[i] != 0 ) { + if ( r0[i] < r1[i] ) { + bitm2[k] = bitm0[i]; + r2[k++]=0; + } + else if ( r0[i] > r1[j] ) { + bitm2[k] = bitm1[j]; + r2[k++]=r1[j++]; + } + else { + bitm1[k] = bitm0[i]; + r2[k++]=r0[i++]; + } + } + } + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/920501-6.c b/gcc/testsuite/gcc.c-torture/compile/920501-6.c new file mode 100755 index 0000000..d0a4063 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920501-6.c @@ -0,0 +1 @@ +x(y,z)float*y;{*y=z;} diff --git a/gcc/testsuite/gcc.c-torture/compile/920501-7.c b/gcc/testsuite/gcc.c-torture/compile/920501-7.c new file mode 100755 index 0000000..ee193f7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920501-7.c @@ -0,0 +1,7 @@ +/* CYGNUS LOCAL -- meissner/no label values */ +#ifndef NO_LABEL_VALUES +x(){if(&&e-&&b<0)x();b:goto*&&b;e:;} +#else +int x; +#endif +/* END CYGNUS LOCAL -- meissner/no label values */ diff --git a/gcc/testsuite/gcc.c-torture/compile/920501-8.c b/gcc/testsuite/gcc.c-torture/compile/920501-8.c new file mode 100755 index 0000000..68e3393 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920501-8.c @@ -0,0 +1 @@ +x(int*p){int x=p;} diff --git a/gcc/testsuite/gcc.c-torture/compile/920501-9.c b/gcc/testsuite/gcc.c-torture/compile/920501-9.c new file mode 100755 index 0000000..98a0600 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920501-9.c @@ -0,0 +1 @@ +short x(a)unsigned a;{a=32987799;return a;} diff --git a/gcc/testsuite/gcc.c-torture/compile/920502-1.c b/gcc/testsuite/gcc.c-torture/compile/920502-1.c new file mode 100755 index 0000000..b576c6c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920502-1.c @@ -0,0 +1 @@ +extern void*t[];x(i){goto*t[i];} diff --git a/gcc/testsuite/gcc.c-torture/compile/920502-2.c b/gcc/testsuite/gcc.c-torture/compile/920502-2.c new file mode 100755 index 0000000..d3aa1e2 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920502-2.c @@ -0,0 +1 @@ +x(c){1LL<<c;} diff --git a/gcc/testsuite/gcc.c-torture/compile/920529-1.c b/gcc/testsuite/gcc.c-torture/compile/920529-1.c new file mode 100755 index 0000000..0f50309 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920529-1.c @@ -0,0 +1,21 @@ +void +f (a, b, m, n) + unsigned short *a, *b; + int m, n; +{ + unsigned long acc; + int qn; + int j; + + abort (); + + acc = a[m - 1]; + a += 0; + for (j = qn - 1; j >= 0; j = j - 1) + { + acc = (acc << 16) | a[j]; + acc = acc % *b; + } + + return; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/920611-2.c b/gcc/testsuite/gcc.c-torture/compile/920611-2.c new file mode 100755 index 0000000..e54b1cd --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920611-2.c @@ -0,0 +1,53 @@ +typedef unsigned char uchar; +typedef unsigned short ushort; +typedef unsigned int uint; +typedef unsigned long ulong; + +static unsigned long S[1][1]={0x00820200}; + +static int body(out0,out1,ks,Eswap0,Eswap1) +ulong *out0,*out1; +int *ks; +ulong Eswap0,Eswap1; +{ + register unsigned long l,r,t,u,v; + register unsigned long *s; + register int i,j; + register unsigned long E0,E1; + + l=0; + r=0; + + s=(ulong *)ks; + E0=Eswap0; + E1=Eswap1; + + for (i=0; i<(16 *2); i+=4) + { + v=(r^(r>>16)); + u=(v&E0); + v=(v&E1); + u=(u^(u<<16))^r^s[ i ]; + t=(v^(v<<16))^r^s[ i+1]; + t=(t>>4)|(t<<28); + l^=S[1][(t)&0x3f]| S[3][(t>> 8)&0x3f]| S[5][(t>>16)&0x3f]| S[7][(t>>24)&0x3f]| S[0][(u)&0x3f]| S[2][(u>> 8)&0x3f]| S[4][(u>>16)&0x3f]| S[6][(u>>24)&0x3f]; + v=(l^(l>>16)); + u=(v&E0); + v=(v&E1); + u=(u^(u<<16))^l^s[ i+2 ]; + t=(v^(v<<16))^l^s[ i+2+1]; + t=(t>>4)|(t<<28); + r^= S[1][(t )&0x3f]; + } + t=l; + l=r; + r=t; + + t=r; + r=(l>>1)|(l<<31); + l=(t>>1)|(t<<31); + + *out0=l; + *out1=r; + return(0); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/920615-1.c b/gcc/testsuite/gcc.c-torture/compile/920615-1.c new file mode 100755 index 0000000..9b1c6ac --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920615-1.c @@ -0,0 +1,4 @@ +f() +{ + int x[20] = {[0] = 5, [10] = 12}; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/920617-1.c b/gcc/testsuite/gcc.c-torture/compile/920617-1.c new file mode 100755 index 0000000..2d84e8d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920617-1.c @@ -0,0 +1 @@ +f(){double*xp,y;*xp++=sqrt(y);} diff --git a/gcc/testsuite/gcc.c-torture/compile/920617-2.c b/gcc/testsuite/gcc.c-torture/compile/920617-2.c new file mode 100755 index 0000000..3a54509 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920617-2.c @@ -0,0 +1 @@ +f(a,b,c,d)float a[],d;int b[],c;{} diff --git a/gcc/testsuite/gcc.c-torture/compile/920623-1.c b/gcc/testsuite/gcc.c-torture/compile/920623-1.c new file mode 100755 index 0000000..9b6ad51 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920623-1.c @@ -0,0 +1,2 @@ +int f(int c){return f(c--);} +g(){} diff --git a/gcc/testsuite/gcc.c-torture/compile/920624-1.c b/gcc/testsuite/gcc.c-torture/compile/920624-1.c new file mode 100755 index 0000000..8b4d297 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920624-1.c @@ -0,0 +1,2 @@ +int B[],Q[]; +f(){int s;for(s=0;s<=1;s++)switch(s){case 2:case 3:++B[s];case 4:case 5:++Q[s];}} diff --git a/gcc/testsuite/gcc.c-torture/compile/920625-1.c b/gcc/testsuite/gcc.c-torture/compile/920625-1.c new file mode 100755 index 0000000..720d43f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920625-1.c @@ -0,0 +1,279 @@ +typedef unsigned long int unsigned_word; +typedef signed long int signed_word; +typedef unsigned_word word; + +typedef enum { ADD, ADD_CI, ADD_CO, ADD_CIO, SUB, SUB_CI, SUB_CO, +SUB_CIO, ADC_CI, ADC_CO, ADC_CIO, AND, IOR, XOR, ANDC, IORC, EQV, +NAND, NOR, AND_RC, IOR_RC, XOR_RC, ANDC_RC, IORC_RC, EQV_RC, NAND_RC, +NOR_RC, AND_CC, IOR_CC, XOR_CC, ANDC_CC, IORC_CC, EQV_CC, NAND_CC, +NOR_CC, LSHIFTR, ASHIFTR, SHIFTL, LSHIFTR_CO, ASHIFTR_CO, SHIFTL_CO, +ROTATEL, ROTATEL_CO, ROTATEXL_CIO, ASHIFTR_CON, EXTS1, EXTS2, EXTU1, +EXTU2, CLZ, CTZ, FF1, FF0, ABSVAL, NABSVAL, CMP, CPEQ, CPGE, CPGEU, +CPGT, CPGTU, CPLE, CPLEU, CPLT, CPLTU, CPNEQ, CMPPAR, DOZ, COPY, +EXCHANGE, COMCY, } opcode_t; + +typedef struct +{ + opcode_t opcode:8; + unsigned int s1:8; + unsigned int s2:8; + unsigned int d:8; +} insn_t; + +enum prune_flags +{ + NO_PRUNE = 0, + CY_0 = 1, + CY_1 = 2, + CY_JUST_SET = 4, +}; + +int flag_use_carry = 1; + +inline +recurse(opcode_t opcode, + int d, + int s1, + int s2, + word v, + int cost, + insn_t *sequence, + int n_insns, + word *values, + int n_values, + const word goal_value, + int allowed_cost, + int cy, + int prune_flags) +{ + insn_t insn; + + allowed_cost -= cost; + + if (allowed_cost > 0) + { + word old_d; + + old_d = values[d]; + values[d] = v; + + insn.opcode = opcode; + insn.s1 = s1; + insn.s2 = s2; + insn.d = d; + sequence[n_insns] = insn; + + synth(sequence, n_insns + 1, values, n_values, + goal_value, allowed_cost, cy, prune_flags); + + values[d] = old_d; + } + else if (goal_value == v) + { + insn.opcode = opcode; + insn.s1 = s1; + insn.s2 = s2; + insn.d = d; + sequence[n_insns] = insn; + test_sequence(sequence, n_insns + 1); + } +} + +synth(insn_t *sequence, + int n_insns, + word *values, + int n_values, + word goal_value, + int allowed_cost, + int ci, + int prune_hint) +{ + int s1, s2; + word v, r1, r2; + int co; + int last_dest; + + if (n_insns > 0) + last_dest = sequence[n_insns - 1].d; + else + last_dest = -1; + if (ci >= 0 && flag_use_carry) + { + for (s1 = n_values - 1; s1 >= 0; s1--) + { + r1 = values[s1]; + for (s2 = s1 - 1; s2 >= 0; s2--) + { + r2 = values[s2]; + + if (allowed_cost <= 1 && (prune_hint & CY_JUST_SET) == 0) + { + if (last_dest >= 0 && s1 != last_dest && s2 != last_dest) + continue; + } + do { word __d = ( r1) + ( r2) + (( ci)); ( co) = ( ci) ? __d <= ( r1) : __d < ( r1); (v) = __d; } while (0); + recurse(ADD_CIO, n_values, s1, s2, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, CY_JUST_SET); + do { word __d = ( r1) + ( r2) + (( ci)); ( co) = ( ci); (v) = __d; } while (0); + recurse(ADD_CI, n_values, s1, s2, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); + + do { word __d = ( r1) - ( r2) - (( ci)); ( co) = ( ci) ? __d >= ( r1) : __d > ( r1); (v) = __d; } while (0); + recurse(SUB_CIO, n_values, s1, s2, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, CY_JUST_SET); + do { word __d = ( r2) - ( r1) - (( ci)); ( co) = ( ci) ? __d >= ( r2) : __d > ( r2); (v) = __d; } while (0); + recurse(SUB_CIO, n_values, s2, s1, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, CY_JUST_SET); + + do { word __d = ( r1) - ( r2) - (( ci)); ( co) = ( ci); (v) = __d; } while (0); + recurse(SUB_CI, n_values, s1, s2, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); + do { word __d = ( r2) - ( r1) - (( ci)); ( co) = ( ci); (v) = __d; } while (0); + recurse(SUB_CI, n_values, s2, s1, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); + + } + } + } + for (s1 = n_values - 1; s1 >= 0; s1--) + { + r1 = values[s1]; + for (s2 = s1 - 1; s2 >= 0; s2--) + { + r2 = values[s2]; + + if (allowed_cost <= 1) + { + if (last_dest >= 0 && s1 != last_dest && s2 != last_dest) + continue; + } + + do { word __d = ( r1) + ( r2); ( co) = __d < ( r1); (v) = __d; } while (0); + recurse(ADD_CO, n_values, s1, s2, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, CY_JUST_SET); + + ((v) = ( r1) + ( r2), ( co) = ( ci)); + recurse(ADD, n_values, s1, s2, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); + + do { word __d = ( r1) - ( r2); ( co) = __d > ( r1); (v) = __d; } while (0); + recurse(SUB_CO, n_values, s1, s2, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, CY_JUST_SET); + do { word __d = ( r2) - ( r1); ( co) = __d > ( r2); (v) = __d; } while (0); + recurse(SUB_CO, n_values, s2, s1, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, CY_JUST_SET); + ((v) = ( r1) - ( r2), ( co) = ( ci)); + recurse(SUB, n_values, s1, s2, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); + ((v) = ( r2) - ( r1), ( co) = ( ci)); + recurse(SUB, n_values, s2, s1, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); + + ((v) = ( r1) & ( r2), ( co) = ( ci)); + recurse(AND, n_values, s1, s2, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); + + ((v) = ( r1) | ( r2), ( co) = ( ci)); + recurse(IOR, n_values, s1, s2, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); + + ((v) = ( r1) ^ ( r2), ( co) = ( ci)); + recurse(XOR, n_values, s1, s2, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); + + ((v) = ( r1) & ~( r2), ( co) = ( ci)); + recurse(ANDC, n_values, s1, s2, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); + ((v) = ( r2) & ~( r1), ( co) = ( ci)); + recurse(ANDC, n_values, s2, s1, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); + ((v) = ( r1) | ~( r2), ( co) = ( ci)); + recurse(IORC, n_values, s1, s2, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); + ((v) = ( r2) | ~( r1), ( co) = ( ci)); + recurse(IORC, n_values, s2, s1, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); + ((v) = ( r1) ^ ~( r2), ( co) = ( ci)); + recurse(EQV, n_values, s1, s2, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); + + } + } + if (ci >= 0 && flag_use_carry) + { + for (s1 = n_values - 1; s1 >= 0; s1--) + { + r1 = values[s1]; + + if (allowed_cost <= 1 && (prune_hint & CY_JUST_SET) == 0) + { + + if (last_dest >= 0 && s1 != last_dest) + continue; + } + + do { word __d = ( r1) + ( r1) + (( ci)); ( co) = ( ci) ? __d <= ( r1) : __d < ( r1); (v) = __d; } while (0); + recurse(ADD_CIO, n_values, s1, s1, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, CY_JUST_SET); + + do { word __d = ( r1) + ( r1) + (( ci)); ( co) = ( ci); (v) = __d; } while (0); + recurse(ADD_CI, n_values, s1, s1, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); + + do { word __d = ( r1) + ( -1 ) + (( ci)); ( co) = ( ci) ? __d <= ( r1) : __d < ( r1); (v) = __d; } while (0); + recurse(ADD_CIO, n_values, s1, (0x20 + -1) , v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, CY_JUST_SET); + + do { word __d = ( r1) + ( 0 ) + (( ci)); ( co) = ( ci) ? __d <= ( r1) : __d < ( r1); (v) = __d; } while (0); + recurse(ADD_CIO, n_values, s1, (0x20 + 0) , v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, CY_JUST_SET); + do { word __d = ( 0 ) - ( r1) - (( ci)); ( co) = ( ci) ? __d >= ( 0 ) : __d > ( 0 ); (v) = __d; } while (0); + recurse(SUB_CIO, n_values, (0x20 + 0) , s1, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, CY_JUST_SET); + + } + } + for (s1 = n_values - 1; s1 >= 0; s1--) + { + r1 = values[s1]; + + if (allowed_cost <= 1) + { + if (last_dest >= 0 && s1 != last_dest) + continue; + } + do { word __d = ( r1) + ( r1); ( co) = __d < ( r1); (v) = __d; } while (0); + recurse(ADD_CO, n_values, s1, s1, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, CY_JUST_SET); + + ((v) = ( r1) & ( 1 ), ( co) = ( ci)); + recurse(AND, n_values, s1, (0x20 + 1) , v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); + + ((v) = ( r1) ^ ( 1 ), ( co) = ( ci)); + recurse(XOR, n_values, s1, (0x20 + 1) , v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); + + ((v) = ( -1 ) - ( r1), ( co) = ( ci)); + recurse(SUB, n_values, (0x20 + -1) , s1, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); + do { word __d = ( r1) + ( 1 ); ( co) = __d < ( r1); (v) = __d; } while (0); + recurse(ADD_CO, n_values, s1, (0x20 + 1) , v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, CY_JUST_SET); + ((v) = ( r1) + ( 1 ), ( co) = ( ci)); + recurse(ADD, n_values, s1, (0x20 + 1) , v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); + do { word __d = ( r1) + ( -1 ); ( co) = __d < ( r1); (v) = __d; } while (0); + recurse(ADD_CO, n_values, s1, (0x20 + -1) , v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, CY_JUST_SET); + do { word __d = ( r1) - ( 1 ); ( co) = __d > ( r1); (v) = __d; } while (0); + recurse(SUB_CO, n_values, s1, (0x20 + 1) , v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, CY_JUST_SET); + do { word __d = ( 0 ) - ( r1); ( co) = __d > ( 0 ); (v) = __d; } while (0); + recurse(SUB_CO, n_values, (0x20 + 0) , s1, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, CY_JUST_SET); + ((v) = ( 0 ) - ( r1), ( co) = ( ci)); + recurse(SUB, n_values, (0x20 + 0) , s1, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); + ((v) = ((unsigned_word) ( r1) >> (( 1 ) & (32 - 1)) ), ( co) = ( ci)); + recurse(LSHIFTR, n_values, s1, (0x20 + 1) , v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); + ((v) = ((signed_word) ( r1) >> (( 1 ) & (32 - 1)) ), ( co) = ( ci)); + recurse(ASHIFTR, n_values, s1, (0x20 + 1) , v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); + ((v) = ((signed_word) ( r1) << (( 1 ) & (32 - 1)) ), ( co) = ( ci)); + recurse(SHIFTL, n_values, s1, (0x20 + 1) , v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); + ((v) = ((unsigned_word) ( r1) >> (( 32 -1 ) & (32 - 1)) ), ( co) = ( ci)); + recurse(LSHIFTR, n_values, s1, (0x20 + 32 -1) , v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); + ((v) = ((signed_word) ( r1) >> (( 32 -1 ) & (32 - 1)) ), ( co) = ( ci)); + recurse(ASHIFTR, n_values, s1, (0x20 + 32 -1) , v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); + } + if (ci >= 0 && flag_use_carry + && (allowed_cost <= 1 ? ((prune_hint & CY_JUST_SET) != 0) : 1)) + { + do { word __d = ( 0 ) + ( 0 ) + (( ci)); ( co) = ( ci) ? __d <= ( 0 ) : __d < ( 0 ); (v) = __d; } while (0); + recurse(ADD_CIO, n_values, (0x20 + 0) , (0x20 + 0) , v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, CY_JUST_SET | CY_0); + do { word __d = ( 0 ) - ( 0 ) - (( ci)); ( co) = ( ci) ? __d >= ( 0 ) : __d > ( 0 ); (v) = __d; } while (0); + recurse(SUB_CIO, n_values, (0x20 + 0) , (0x20 + 0) , v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); + do { word __d = ( 0 ) - ( -1 ) - (( ci)); ( co) = ( ci) ? __d >= ( 0 ) : __d > ( 0 ); (v) = __d; } while (0); + recurse(SUB_CIO, n_values, (0x20 + 0) , (0x20 + -1) , v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, CY_JUST_SET | CY_1); + do { word __d = ( 0 ) + ( -1 ) + (( ci)); ( co) = ( ci) ? __d <= ( 0 ) : __d < ( 0 ); (v) = __d; } while (0); + recurse(ADD_CIO, n_values, (0x20 + 0) , (0x20 + -1) , v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); + + } + + if (allowed_cost > 1) + { + ((v) = ( 0x80000000 ), ( co) = ( ci)); + recurse(COPY, n_values, (0x20 - 2) , 0, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); + + ((v) = ( -1 ), ( co) = ( ci)); + recurse(COPY, n_values, (0x20 + -1) , 0, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); + + ((v) = ( 1 ), ( co) = ( ci)); + recurse(COPY, n_values, (0x20 + 1) , 0, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/920625-2.c b/gcc/testsuite/gcc.c-torture/compile/920625-2.c new file mode 100755 index 0000000..1466285 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920625-2.c @@ -0,0 +1,103 @@ +typedef char * caddr_t; +typedef unsigned Cursor; +typedef char *String; +typedef struct _WidgetRec *Widget; +typedef char Boolean; +typedef unsigned int Cardinal; +typedef struct _XedwListReturnStruct { + String string; + int xedwList_index; + struct _XedwListReturnStruct *next; +} XedwListReturnStruct; +static XedwListReturnStruct *return_list; +static String srcdir, dstdir; +char *strcpy(); + extern void setCursor(Cursor); + extern void query_dialog(String, Boolean); + extern Boolean directoryManagerNewDirectory(String); +trashQueryResult(Widget w, Boolean delete, caddr_t call_data) +{ + int execute(String, String, String, Boolean); + extern void destroy_button_dialog(void); + extern void changestate(Boolean); + + extern Cursor busy, left_ptr; + extern String cwd; + static void freeReturnStruct(void); + String rmstring; + int status; + XedwListReturnStruct *tmp; + setCursor(busy); + destroy_button_dialog(); + if (delete == 1) { + rmstring = (("rm -fr") != ((void *)0) ? (strcpy((char*)XtMalloc((unsigned)strlen("rm -fr") + 1), "rm -fr")) : ((void *)0)); + tmp = return_list; + while (tmp != ((void *)0)) { + rmstring = (String) XtRealloc (rmstring, sizeof(char) * + (strlen(rmstring) + + strlen(tmp->string) + 5)); + sprintf(rmstring, "%s '%s'", rmstring, tmp->string); + tmp = tmp->next; + } + if ((status = execute(((void *)0), "rm", rmstring, 1)) != 0) { + XBell(XtDisplay(w), 100); + query_dialog("Can't remove file", 0); + } + XtFree(rmstring); + + directoryManagerNewDirectory(cwd); + } else { + changestate(1); + } + setCursor(left_ptr); + freeReturnStruct(); +} + +copyQueryResult(Widget w, Boolean copy, caddr_t call_data) +{ + extern void destroy_button_dialog(); + extern void changestate(Boolean); + extern Cursor busy, left_ptr; + static void freeReturnStruct(void); + int execute(String, String, String, Boolean); + extern String cwd; + String copystring; + int status; + Cardinal srclen, dstlen; + XedwListReturnStruct *tmp; + destroy_button_dialog(); + setCursor(busy); + if (copy == 1) { + srclen = strlen(srcdir); + dstlen = strlen(dstdir); + copystring = (("cp -r") != ((void *)0) ? (strcpy((char*)XtMalloc((unsigned)strlen("cp -r") + 1), "cp -r")) : ((void *)0)); + tmp = return_list; + while (tmp != ((void *)0)) { + copystring = (String) XtRealloc (copystring, sizeof(char) * + (strlen(copystring) + + strlen(tmp->string) + + srclen + 6)); + sprintf(copystring, "%s '%s/%s'", copystring, srcdir, tmp->string); + tmp = tmp->next; + } + copystring = (String) XtRealloc (copystring, sizeof(char) * + (strlen(copystring) + + dstlen + 5)); + sprintf(copystring, "%s '%s'", copystring, dstdir); + if ((status = execute(((void *)0), "cp", copystring, 1)) != 0) { + XBell(XtDisplay(w), 100); + query_dialog("Can't copy file!", 0); + } + XtFree(copystring); + + directoryManagerNewDirectory(cwd); + } else { + changestate(1); + } + XtFree(srcdir); + XtFree(dstdir); + setCursor(left_ptr); + freeReturnStruct(); +} + +freeReturnStruct(){} diff --git a/gcc/testsuite/gcc.c-torture/compile/920626-1.c b/gcc/testsuite/gcc.c-torture/compile/920626-1.c new file mode 100755 index 0000000..5441986 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920626-1.c @@ -0,0 +1 @@ +f(x)unsigned x;{return x>>-5;} diff --git a/gcc/testsuite/gcc.c-torture/compile/920701-1.c b/gcc/testsuite/gcc.c-torture/compile/920701-1.c new file mode 100755 index 0000000..4302f9e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920701-1.c @@ -0,0 +1 @@ +f(char*c){extern char a[],b[];return a+(b-c);} diff --git a/gcc/testsuite/gcc.c-torture/compile/920702-1.c b/gcc/testsuite/gcc.c-torture/compile/920702-1.c new file mode 100755 index 0000000..23a5395 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920702-1.c @@ -0,0 +1,10 @@ +int somevar; +void +yylex () +{ + register int result = 0; + int num_bits = -1; + + if (((result >> -1) & 1)) + somevar = 99; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/920706-1.c b/gcc/testsuite/gcc.c-torture/compile/920706-1.c new file mode 100755 index 0000000..13b0ff1 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920706-1.c @@ -0,0 +1 @@ +f(){float i[2],o[1];g(o);return*o;} diff --git a/gcc/testsuite/gcc.c-torture/compile/920710-2.c b/gcc/testsuite/gcc.c-torture/compile/920710-2.c new file mode 100755 index 0000000..dcaf1be --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920710-2.c @@ -0,0 +1,36 @@ +union u +{ + struct {unsigned h, l;} i; + double d; +}; + +foo (union u x) +{ + while (x.i.h++) + { + while (x.i.l-- > 0) + ; + while (x.d++ > 0) + ; + } +} + +union n +{ + long long unsigned i; + double d; +}; + +bar (union n x) +{ + int i; + for (i = 0; i < 100; i++) + { + while (--x.i > 0) + ; + while (++x.d > 0) + ; + } + return x.i; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/920711-1.c b/gcc/testsuite/gcc.c-torture/compile/920711-1.c new file mode 100755 index 0000000..a5aa7df --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920711-1.c @@ -0,0 +1 @@ +f(a){a=(1,1)/2;} diff --git a/gcc/testsuite/gcc.c-torture/compile/920721-1.c b/gcc/testsuite/gcc.c-torture/compile/920721-1.c new file mode 100755 index 0000000..7ced611 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920721-1.c @@ -0,0 +1,11 @@ +typedef struct{short ttype;float s;}T; +short t[8][8]; + +T f(T t2,T t1) +{ + T x; + if (t1.ttype == 1) + x.ttype = t[t2.ttype][t1.ttype], + x.s = 1; + return x; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/920723-1.c b/gcc/testsuite/gcc.c-torture/compile/920723-1.c new file mode 100755 index 0000000..af0cf76 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920723-1.c @@ -0,0 +1,23 @@ +typedef struct { + double x, y; +} vector_t; +double sqrt(); +f(int count,vector_t*pos,double r,double *rho) +{ + int i, j, miny, maxy, hy; + float help, d; + int gitt[150][150]; + int *data = (int *)malloc(count*sizeof(int)); + for (i = 0; i < count; i++) + rho[i] = 0; + for (i = 1; i < count; i++) + for (hy = miny; hy<= maxy; hy++) + while(j >=0) { + d = pos[i].y - pos[j].y; + if ( d <= r) { + d = sqrt(d); + rho[i] += help; + } + } +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/920729-1.c b/gcc/testsuite/gcc.c-torture/compile/920729-1.c new file mode 100755 index 0000000..96676e9 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920729-1.c @@ -0,0 +1,2 @@ +extern int i;extern volatile int i; +f(){int j;for(;;)j = i;} diff --git a/gcc/testsuite/gcc.c-torture/compile/920806-1.c b/gcc/testsuite/gcc.c-torture/compile/920806-1.c new file mode 100755 index 0000000..0928fe8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920806-1.c @@ -0,0 +1 @@ +f(){short x=32000;} diff --git a/gcc/testsuite/gcc.c-torture/compile/920808-1.c b/gcc/testsuite/gcc.c-torture/compile/920808-1.c new file mode 100755 index 0000000..17510a9 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920808-1.c @@ -0,0 +1 @@ +f(i){for(i=1;i<=2;({;}),i++){({;}),g();}} diff --git a/gcc/testsuite/gcc.c-torture/compile/920809-1.c b/gcc/testsuite/gcc.c-torture/compile/920809-1.c new file mode 100755 index 0000000..ad35e12 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920809-1.c @@ -0,0 +1 @@ +f(x,y){memcpy (&x,&y,8192);} diff --git a/gcc/testsuite/gcc.c-torture/compile/920817-1.c b/gcc/testsuite/gcc.c-torture/compile/920817-1.c new file mode 100755 index 0000000..31a5733 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920817-1.c @@ -0,0 +1 @@ +int v;static inline f(){return 0;}g(){return f();}void h(){return v++;} diff --git a/gcc/testsuite/gcc.c-torture/compile/920820-1.c b/gcc/testsuite/gcc.c-torture/compile/920820-1.c new file mode 100755 index 0000000..2bc0dbe --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920820-1.c @@ -0,0 +1 @@ +long long f(double y){return y;} diff --git a/gcc/testsuite/gcc.c-torture/compile/920821-1.c b/gcc/testsuite/gcc.c-torture/compile/920821-1.c new file mode 100755 index 0000000..40a8c17 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920821-1.c @@ -0,0 +1 @@ +/* empty */ diff --git a/gcc/testsuite/gcc.c-torture/compile/920821-2.c b/gcc/testsuite/gcc.c-torture/compile/920821-2.c new file mode 100755 index 0000000..a69c0a9 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920821-2.c @@ -0,0 +1,4 @@ +typedef struct{int p[25];}t1; +struct{t1 x,y;}y; +t1 x[1]; +f(){y.x=*x;y.y=*x;} diff --git a/gcc/testsuite/gcc.c-torture/compile/920825-1.c b/gcc/testsuite/gcc.c-torture/compile/920825-1.c new file mode 100755 index 0000000..514d63f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920825-1.c @@ -0,0 +1,3 @@ +#pragma pack(1) +struct{unsigned short f1:5;unsigned short f2:6;}x; +f(){x.f2=1;} diff --git a/gcc/testsuite/gcc.c-torture/compile/920825-2.c b/gcc/testsuite/gcc.c-torture/compile/920825-2.c new file mode 100755 index 0000000..9834aac --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920825-2.c @@ -0,0 +1,3 @@ +f(double*a,int m){int j;for(j=0;j<m;j++)a[j]=1;} +g(double*a){int j;for(j=0;j<4;j++)a[j]=1;} + diff --git a/gcc/testsuite/gcc.c-torture/compile/920826-1.c b/gcc/testsuite/gcc.c-torture/compile/920826-1.c new file mode 100755 index 0000000..d19eff2 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920826-1.c @@ -0,0 +1 @@ +f(int*x){goto*(char)*x;} diff --git a/gcc/testsuite/gcc.c-torture/compile/920828-1.c b/gcc/testsuite/gcc.c-torture/compile/920828-1.c new file mode 100755 index 0000000..4893173 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920828-1.c @@ -0,0 +1 @@ +char a[]={4,5};f(n){return a[n<2?n:0];} diff --git a/gcc/testsuite/gcc.c-torture/compile/920829-1.c b/gcc/testsuite/gcc.c-torture/compile/920829-1.c new file mode 100755 index 0000000..593400b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920829-1.c @@ -0,0 +1 @@ +f(double x){double y;y=x/0.5;if(y<0.1)y=1.0;} diff --git a/gcc/testsuite/gcc.c-torture/compile/920831-1.c b/gcc/testsuite/gcc.c-torture/compile/920831-1.c new file mode 100755 index 0000000..ff2fd63 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920831-1.c @@ -0,0 +1 @@ +f(x){goto*(char)x;} diff --git a/gcc/testsuite/gcc.c-torture/compile/920902-1.c b/gcc/testsuite/gcc.c-torture/compile/920902-1.c new file mode 100755 index 0000000..6f6dcd5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920902-1.c @@ -0,0 +1,2 @@ +void f(int); +void f(x)unsigned char x;{} diff --git a/gcc/testsuite/gcc.c-torture/compile/920909-1.c b/gcc/testsuite/gcc.c-torture/compile/920909-1.c new file mode 100755 index 0000000..939aaf7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920909-1.c @@ -0,0 +1 @@ +long long f(long long a,long long b){return a<<b;} diff --git a/gcc/testsuite/gcc.c-torture/compile/920917-1.c b/gcc/testsuite/gcc.c-torture/compile/920917-1.c new file mode 100755 index 0000000..ebe8200 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920917-1.c @@ -0,0 +1,2 @@ +inline f(x){switch(x){case 6:case 4:case 3:case 1:;}return x;} +g(){f(sizeof("xxxxxx"));} diff --git a/gcc/testsuite/gcc.c-torture/compile/920928-1.c b/gcc/testsuite/gcc.c-torture/compile/920928-1.c new file mode 100755 index 0000000..137363d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920928-1.c @@ -0,0 +1,2 @@ +struct{int c;}v; +static long i=((char*)&(v.c)-(char*)&v); diff --git a/gcc/testsuite/gcc.c-torture/compile/920928-2.c b/gcc/testsuite/gcc.c-torture/compile/920928-2.c new file mode 100755 index 0000000..a0964f9 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920928-2.c @@ -0,0 +1,19 @@ +typedef struct{struct{char*d;int b;}*i;}*t; +double f(); +g(p)t p; +{ + short x,y,delta,s,w,h,fx,fy,tx,ty; + int q1,q2,q3,q4; + h=f((ty-fy)/2.0+0.5); + s=(((int)((short)(tx-fx))<(int)((short)(ty-fy)))?((short)(tx-fx)):((short)(ty-fy)))%2; + delta=(((int)(w)<(int)(h))?(w):(h))-s; + for(x=0;x<=delta;x++) + for(y=1-s;y<=delta;y++){ + q1=((int)((*(p->i->d+(fx+w+x)/8+(fy+h+y)*p->i->b)&(1<<((fx+w+x)%8)))?1:0)); + q2=((int)((*(p->i->d+(fx+w+y)/8+(fy+h-s-x)*p->i->b)&(1<<((fx+w+y)%8)))?1:0)); + q3=((int)((*(p->i->d+(fx+w-s-x)/8+(fy+h-s-y)*p->i->b)&(1<<((fx+w-s-x)%8)))?1:0)); + q4=((int)((*(p->i->d+(fx+w-s-y)/8+(fy+h+x)*p->i->b)&(1<<((fx+w-s-y)%8)))?1:0)); + if(q4!=q1) + ff(p,fx+w-s-y,fy+h+x); + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/920928-3.c b/gcc/testsuite/gcc.c-torture/compile/920928-3.c new file mode 100755 index 0000000..583dc69 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920928-3.c @@ -0,0 +1,19 @@ +f (int phaseone) +{ + typedef struct + { + unsigned char *p; + } + FILE; + FILE b[2]; + static unsigned char xchr[2]; + int j; + int for_end; + if (phaseone) + { + if (j <= for_end) + do + *(b[1].p) = xchr[j]; + while (j++ < 10); + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/920928-4.c b/gcc/testsuite/gcc.c-torture/compile/920928-4.c new file mode 100755 index 0000000..348de65 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920928-4.c @@ -0,0 +1,113 @@ +typedef unsigned char unsigned8; +typedef unsigned short int unsigned16; +typedef unsigned long int unsigned32; +typedef char signed8; +typedef short int signed16; +typedef long int signed32; +typedef unsigned32 boolean32; +typedef unsigned long int error_status_t; +typedef struct { + unsigned32 time_low; + unsigned16 time_mid; + unsigned16 time_hi_and_version; + unsigned8 clock_seq_hi_and_reserved; + unsigned8 clock_seq_low; + unsigned char node[6]; +} uuid_t; + +typedef unsigned32 bitset; +typedef signed32 sec_timeval_sec_t; +typedef struct { + signed32 sec; + signed32 usec; +} sec_timeval_t; +typedef signed32 sec_timeval_period_t; +typedef signed32 sec_rgy_acct_key_t; + +typedef struct { + uuid_t source; + signed32 handle; + boolean32 valid; +} sec_rgy_cursor_t; +typedef unsigned char sec_rgy_pname_t[257]; +typedef unsigned char sec_rgy_name_t[1025]; + +typedef signed32 sec_rgy_override_t; +typedef signed32 sec_rgy_mode_resolve_t; +typedef unsigned char sec_rgy_unix_gecos_t[292]; +typedef unsigned char sec_rgy_unix_login_name_t[1025]; +typedef unsigned char sec_rgy_member_t[1025]; +typedef unsigned char sec_rgy_unix_passwd_buf_t[16]; +typedef struct sec_rgy_sid_t { + uuid_t person; + uuid_t group; + uuid_t org; +} sec_rgy_sid_t; +typedef struct { + signed32 person; + signed32 group; + signed32 org; +} sec_rgy_unix_sid_t; +typedef struct { + sec_rgy_unix_login_name_t name; + sec_rgy_unix_passwd_buf_t passwd; + signed32 uid; + signed32 gid; + signed32 oid; + sec_rgy_unix_gecos_t gecos; + sec_rgy_pname_t homedir; + sec_rgy_pname_t shell; +} sec_rgy_unix_passwd_t; +typedef unsigned char sec_rgy_member_buf_t[10250]; +typedef struct { + sec_rgy_name_t name; + signed32 gid; + sec_rgy_member_buf_t members; +} sec_rgy_unix_group_t; + +typedef struct { + uuid_t site_id; + sec_timeval_sec_t person_dtm; + sec_timeval_sec_t group_dtm; + sec_timeval_sec_t org_dtm; +} rs_cache_data_t; + +typedef enum { + rs_unix_query_name, + rs_unix_query_unix_num, + rs_unix_query_none +} rs_unix_query_t; + +typedef struct { + rs_unix_query_t query; + union { + struct { + long int name_len; + sec_rgy_name_t name; + } name; + long int unix_num; + } tagged_union; +} rs_unix_query_key_t; + +static unsigned long int IDL_offset_vec[] = +{ + 0, + sizeof(sec_rgy_unix_group_t), + (unsigned long int) ((unsigned char *) &((sec_rgy_unix_group_t *) 0)->name - (unsigned char *) 0), + (unsigned long int) ((unsigned char *) &((sec_rgy_unix_group_t *) 0)->gid - (unsigned char *) 0), + (unsigned long int) ((unsigned char *) &((sec_rgy_unix_group_t *) 0)->members - (unsigned char *) 0), + sizeof(rs_cache_data_t), + (unsigned long int) ((unsigned char *) &((rs_cache_data_t *) 0)->site_id.time_low - (unsigned char *) 0), + (unsigned long int) ((unsigned char *) &((rs_cache_data_t *) 0)->site_id.time_mid - (unsigned char *) 0), + (unsigned long int) ((unsigned char *) &((rs_cache_data_t *) 0)->site_id.time_hi_and_version - (unsigned char *) 0), + sizeof(sec_rgy_unix_passwd_t), + (unsigned long int) ((unsigned char *) &((sec_rgy_cursor_t *) 0)->source.clock_seq_hi_and_reserved - (unsigned char *) 0), + (unsigned long int) ((unsigned char *) &((sec_rgy_cursor_t *) 0)->source.clock_seq_low - (unsigned char *) 0), + (unsigned long int) ((unsigned char *) &((sec_rgy_cursor_t *) 0)->source.node - (unsigned char *) 0), + (unsigned long int) ((unsigned char *) &((sec_rgy_cursor_t *) 0)->handle - (unsigned char *) 0), + (unsigned long int) ((unsigned char *) &((sec_rgy_cursor_t *) 0)->valid - (unsigned char *) 0), + sizeof(struct {long int name_len; sec_rgy_name_t name;}), + (unsigned long int) ((unsigned char *) &((struct {long int name_len; sec_rgy_name_t name;} *)0)->name_len + - (unsigned char *) 0), + (unsigned long int) ((unsigned char *) &((struct {long int name_len; sec_rgy_name_t name;} *)0)->name - (unsigned char *) 0), +}; diff --git a/gcc/testsuite/gcc.c-torture/compile/920928-5.c b/gcc/testsuite/gcc.c-torture/compile/920928-5.c new file mode 100755 index 0000000..8c975f0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920928-5.c @@ -0,0 +1,7 @@ +/* REPRODUCED:CC1:SIGNAL MACHINE:m68k OPTIONS:-fpcc-struct-return */ +struct b{}; +f(struct b(*f)()) +{ +struct b d=f(); +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/920928-6.c b/gcc/testsuite/gcc.c-torture/compile/920928-6.c new file mode 100755 index 0000000..692191b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920928-6.c @@ -0,0 +1,2 @@ +struct{int c;}v; +static short i=((char*)&(v.c)-(char*)&v); diff --git a/gcc/testsuite/gcc.c-torture/compile/921004-1.c b/gcc/testsuite/gcc.c-torture/compile/921004-1.c new file mode 100755 index 0000000..a947229 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/921004-1.c @@ -0,0 +1,6 @@ +/* REPRODUCED:CC1:SIGNAL MACHINE:i386 OPTIONS: */ +long long f() +{ +long long*g,*s; +return*g+*s; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/921011-1.c b/gcc/testsuite/gcc.c-torture/compile/921011-1.c new file mode 100755 index 0000000..6cc707d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/921011-1.c @@ -0,0 +1,27 @@ +void +fun (nb) + int nb; +{ + int th, h, em, nlwm, nlwS, nlw, sy; + + while (nb--) + while (h--) + { + nlw = nlwm; + while (nlw) + { + if (nlwS == 1) + { + } + else + if (nlwS == 1) + { + } + nlwS--; nlw--; + } + if (em) + nlwS--; + if (++sy == th) + sy = 0; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/921011-2.c b/gcc/testsuite/gcc.c-torture/compile/921011-2.c new file mode 100755 index 0000000..bf11dad --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/921011-2.c @@ -0,0 +1,65 @@ +extern int foobar1 (); + +typedef struct + { + unsigned long colormap; + unsigned long red_max; + unsigned long red_mult; + unsigned long green_max; + unsigned long green_mult; + unsigned long blue_max; + unsigned long blue_mult; + unsigned long base_pixel; + unsigned long visualid; + unsigned long killid; + } +frotz; + +int +foobar (stdcmap, count) + frotz **stdcmap; + int *count; +{ + register int i; + frotz *data = ((void *) 0); + + unsigned long nitems; + int ncmaps; + int old_style = 0; + unsigned long def_visual = 0L; + frotz *cmaps; + + + if ( foobar1 (&data) != 0) + return 0; + if (nitems < 10) + { + ncmaps = 1; + if (nitems < 9) + { + } + } + else + ncmaps = (nitems / 10); + + { + register frotz *map; + register frotz *prop; + + for (i = ncmaps, map = cmaps, prop = data; i > 0; i--, map++, prop++) + { + map->colormap = prop->colormap; + map->red_max = prop->red_max; + map->red_mult = prop->red_mult; + map->green_max = prop->green_max; + map->green_mult = prop->green_mult; + map->blue_max = prop->blue_max; + map->blue_mult = prop->blue_mult; + map->base_pixel = prop->base_pixel; + map->visualid = (def_visual ? def_visual : prop->visualid); + map->killid = (old_style ? 0L : prop->killid); + } + } + *stdcmap = cmaps; + *count = ncmaps; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/921012-1.c b/gcc/testsuite/gcc.c-torture/compile/921012-1.c new file mode 100755 index 0000000..7b5cb6b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/921012-1.c @@ -0,0 +1,4 @@ +f() +{ +g(({int x;0;})); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/921012-2.c b/gcc/testsuite/gcc.c-torture/compile/921012-2.c new file mode 100755 index 0000000..6f4de77 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/921012-2.c @@ -0,0 +1,7 @@ +struct foo { +int a,b,c; +}; +f(struct foo*a,struct foo*b) +{ +*a=*b; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/921013-1.c b/gcc/testsuite/gcc.c-torture/compile/921013-1.c new file mode 100755 index 0000000..0d14cbc --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/921013-1.c @@ -0,0 +1,4 @@ +f(int x,short y) +{ +long z=y<0?x>0?x:0:y; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/921019-1.c b/gcc/testsuite/gcc.c-torture/compile/921019-1.c new file mode 100755 index 0000000..227bdc2 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/921019-1.c @@ -0,0 +1,9 @@ +struct +{ +int n:1,c:1; +}p; + +f() +{ +p.c=p.n=0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/921021-1.c b/gcc/testsuite/gcc.c-torture/compile/921021-1.c new file mode 100755 index 0000000..18dffeb --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/921021-1.c @@ -0,0 +1,12 @@ +void g(); + +f() +{ +int x=1; +while(x) +{ +x=h(); +if(x) +g(); +} +} diff --git a/gcc/testsuite/gcc.c-torture/compile/921024-1.c b/gcc/testsuite/gcc.c-torture/compile/921024-1.c new file mode 100755 index 0000000..e723246 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/921024-1.c @@ -0,0 +1,9 @@ +long long f(s,r) +{ + return *(long long*)(s+r); +} + +g(s,r) +{ + *(long long*)(s+r)=0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/921026-1.c b/gcc/testsuite/gcc.c-torture/compile/921026-1.c new file mode 100755 index 0000000..18238de --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/921026-1.c @@ -0,0 +1,4 @@ +f(unsigned short*a) +{ +a[0]=65535; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/921103-1.c b/gcc/testsuite/gcc.c-torture/compile/921103-1.c new file mode 100755 index 0000000..578e91a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/921103-1.c @@ -0,0 +1,12 @@ +struct { + unsigned int f1, f2; +} s; + +f() +{ + unsigned x, y; + x = y = 0; + while (y % 4) + y++; + g(&s.f2, s.f1 + x, 4); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/921109-1.c b/gcc/testsuite/gcc.c-torture/compile/921109-1.c new file mode 100755 index 0000000..eda4345 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/921109-1.c @@ -0,0 +1,28 @@ +typedef struct { double x, y; } p; +typedef struct { int s; float r; } t; +t *e, i; +int i1; + +f(t *op) +{ +int i2 = e->r; +p pt; +int c = g(); +t p; + +if (c) +{ +i = *e; +e -= 3; +return 8; +} +if (op > e) +return 1; +op->r = pt.x; +op->r = pt.y; +p = *e; +++e; +e->r = i1, e->s = i1; +*++e = p; +return 3; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/921109-3.c b/gcc/testsuite/gcc.c-torture/compile/921109-3.c new file mode 100755 index 0000000..40e63f2 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/921109-3.c @@ -0,0 +1,46 @@ +/* EXTRA_OPTIONS: -fcaller-saves */ + +extern char *malloc(); + +main() +{ + char w[1000]; + int i, j, nres, t[1000]; + float dv, (**dmat)[4][4]; + short at1, at2; + + nres = 200; + + for (i = 0; i < nres; i++) + { + w[i] = rand() & 15; + t[i] = 0; + } + + dmat = (float (**)[4][4]) malloc(nres * sizeof(*dmat)); + if (!dmat) + return 1; + for (i = 0; i < nres; i++) + { + dmat[i] = (float (*)[4][4]) malloc(nres * sizeof(**dmat)); + if (!dmat[i]) + return 1; + } + + for (i = 0; i < nres; i++) + for (j = i; j < nres; j++) + for (at1 = 0; at1 <= 3; at1++) + for (at2 = 0; at2 <= 3; at2++) + if (i != j || at1 != at2) + if ((w[i] & (1 << at1)) && (w[j] & (1 << at2))) + { + dv = 20.0 * (rand() & 32767) / 32768.0; + dmat[i][j][at1][at2] = dmat[j][i][at2][at1] = dv; + } + else + dmat[i][j][at1][at2] = dmat[j][i][at2][at1] = 999.0; + else + dmat[i][j][at1][at2] = 0.0; + + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/921111-1.c b/gcc/testsuite/gcc.c-torture/compile/921111-1.c new file mode 100755 index 0000000..11b4674 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/921111-1.c @@ -0,0 +1,40 @@ +int ps; +struct vp { + int wa; +}; +typedef struct vp *vpt; +typedef struct vc { + int o; + vpt py[8]; +} *vct; +struct n { + int a; +}; +struct nh { + int x; +}; +typedef struct np *npt; +struct np { + vct d; + int di; +}; +struct nh xhp; +struct n np[3]; + +f(dp) + npt dp; +{ + vpt *py; + int a, l, o = 0; + a = dp->d->o; + if (dp->di < 0) + l = ps; + + if ((int)o & 3) + g(); + + xhp.x = a; + py = &dp->d->py[dp->di]; + if (o + l > ps) + np[2].a = (int)(py[1])->wa; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/921116-2.c b/gcc/testsuite/gcc.c-torture/compile/921116-2.c new file mode 100755 index 0000000..9eac91c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/921116-2.c @@ -0,0 +1,9 @@ +typedef struct { + long l[5]; +} t; + +f(size) +{ + t event; + g(&(event.l[2 + size]), (3 - size) * 4); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/921118-1.c b/gcc/testsuite/gcc.c-torture/compile/921118-1.c new file mode 100755 index 0000000..857c74e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/921118-1.c @@ -0,0 +1,8 @@ +inline f(i) +{ + h((long long) i * 2); +} +g() +{ + f(9); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/921126-1.c b/gcc/testsuite/gcc.c-torture/compile/921126-1.c new file mode 100755 index 0000000..a7b908b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/921126-1.c @@ -0,0 +1,11 @@ +f() +{ + long long a0, a1, a0s, val; + int width; + float d; + if (d) + ; + if (a0s & (1LL << width)) + ; + return a0 / a1; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/921202-1.c b/gcc/testsuite/gcc.c-torture/compile/921202-1.c new file mode 100755 index 0000000..1287edc --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/921202-1.c @@ -0,0 +1,22 @@ +f () +{ + long dx[2055]; + long dy[2055]; + long s1[2055]; + int x, y; + int i; + long s; + + for (;;) + { + s = 2055; + g (s1, s); + for (i = 0; i < 1; i++); + dy[s] = 0x12345; + for (i = 0; i < 1; i++); + if (x != y || h (dx, dy, s) || dx[s] != 0x12345) + { + j (y);k (dy); + } + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/921202-2.c b/gcc/testsuite/gcc.c-torture/compile/921202-2.c new file mode 100755 index 0000000..97d482b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/921202-2.c @@ -0,0 +1,8 @@ +f(x, c) +{ + for (;;) + { + if (x << c) break; + x++; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/921203-1.c b/gcc/testsuite/gcc.c-torture/compile/921203-1.c new file mode 100755 index 0000000..50fe3eb --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/921203-1.c @@ -0,0 +1,5 @@ +char dispstr[]; +f() +{ + strcpy(dispstr,"xxxxxxxxxxx"); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/921203-2.c b/gcc/testsuite/gcc.c-torture/compile/921203-2.c new file mode 100755 index 0000000..929afb1 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/921203-2.c @@ -0,0 +1,13 @@ +typedef struct +{ + char x; +} s1; + +s1 f (int arg0,...) +{ + int args; + s1 back; + va_start (args, arg0); + va_end (args); + return back; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/921206-1.c b/gcc/testsuite/gcc.c-torture/compile/921206-1.c new file mode 100755 index 0000000..b18709d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/921206-1.c @@ -0,0 +1,28 @@ +double sqrt(double),fabs(double),sin(double); +int sxs; +int sys; +f() +{ + int l; + int sm = -52, sx = 52; + char *smap; + for (l = 0; l < 9; l++) + { + double g; + int cx, cy, gx, gy, x, y; + gx = 2 > g / 3 ? 2 : g / 3; + gy = 2 > g / 3 ? 2 : g / 3; + for (y = 0 > cy - gy ? 0 : cy - gy; y <= (sys - 1 < cy + gy ? sys : cy + gy); y++) + { + int sx = 0 > cx - gx ? 0 : cx - gx; + short *ax = (short *) (y * sxs + sx); + + for (x = sx; x <= (sxs - 1 < cx + gx ? sxs - 1 : cx + gx); x++) + { + double c=2.25, z=sqrt(fabs(1-c)), cz=(c>1?0.0:-10)>z?c>1?0:1:z; + } + } + } + for (l = sm; l <= sx; l++) + smap[l] = l > 0 ? 1 + pow(sin(.1 * l / sx)) : 1 - pow(sin(.1 * l / sm)); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/921227-1.c b/gcc/testsuite/gcc.c-torture/compile/921227-1.c new file mode 100755 index 0000000..a49750c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/921227-1.c @@ -0,0 +1,5 @@ +#define k(a) #a +char *s = k(k(1,2)); +char *t = k(#) k(#undef k) k(x); + +f(){} diff --git a/gcc/testsuite/gcc.c-torture/compile/930109-1.c b/gcc/testsuite/gcc.c-torture/compile/930109-1.c new file mode 100755 index 0000000..dbd15a1 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930109-1.c @@ -0,0 +1,12 @@ +f(x) + unsigned x; +{ + static short c; + return x>>c; +} +g(x) + unsigned x; +{ + static char c; + return x>>c; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/930109-2.c b/gcc/testsuite/gcc.c-torture/compile/930109-2.c new file mode 100755 index 0000000..61e3a4d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930109-2.c @@ -0,0 +1,11 @@ +f(r) +{ + int i; + for (i = 0; i < 2; i++) + { + r+= (4 >> i*2); + r+= (2 >> i*2); + r+= (1 >> i*2); + } + return r; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/930111-1.c b/gcc/testsuite/gcc.c-torture/compile/930111-1.c new file mode 100755 index 0000000..2857419 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930111-1.c @@ -0,0 +1,10 @@ +/* 2.3.3 crashes on 386 with -traditional */ +f(a) + char *a; +{ + int d = strcmp(a,"-"); + + while (vfork() < 0) + ; + return d; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/930117-1.c b/gcc/testsuite/gcc.c-torture/compile/930117-1.c new file mode 100755 index 0000000..83317cd --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930117-1.c @@ -0,0 +1,4 @@ +f(x) +{ + (*(void (*)())&x)(); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/930118-1.c b/gcc/testsuite/gcc.c-torture/compile/930118-1.c new file mode 100755 index 0000000..b29543c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930118-1.c @@ -0,0 +1,6 @@ +f() +{ +__label__ l; +l:p(); +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/930120-1.c b/gcc/testsuite/gcc.c-torture/compile/930120-1.c new file mode 100755 index 0000000..95ac43c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930120-1.c @@ -0,0 +1,138 @@ +union { + short I[2]; + long int L; + char C[4]; +} itolws; +char *errflg; +long int dot; +short dotinc; +long int expvf; + +char * +f(fcount,ifp,itype,ptype) + short fcount; + char *ifp; +{ + unsigned w; + long int savdot, wx; + char *fp; + char c, modifier, longpr; + union { + double dval; + struct { + int i1; + int i2; + } ival; + } dw; + union { + float fval; + int ival; + } fw; + int gotdot = 0; + while (fcount > 0) { + fp = ifp; + c = *fp; + longpr = ((c >= 'A') & (c <= 'Z') | (c == 'f') | (c == '4') | (c == 'p') | (c == 'i')); + if ((itype == 0) || (*fp == 'a')) { + wx = dot; + w = dot; + } else { + gotdot = 1; + wx = get((int)dot, itype); + if (!longpr) { + w = (itolws.L=(wx), itolws.I[((dot)&3)>>1]); + } + } + if (c == 'F') { + dw.ival.i1 = wx; + if (itype == 0) { + dw.ival.i2 = expvf; + } + } + + modifier = *fp++; + switch(modifier) { + case ' ' : + case '\t' : + break; + case 't': + case 'T': + printf("%T",fcount); + return(fp); + case 'r': + case 'R': + printf("%M",fcount); + return(fp); + case 'k': + printf("%k",w); + break; + case 'K': + printf("%K",wx); + break; + case 'a': + psymoff(dot,ptype,":%16t"); + dotinc = 0; + break; + case 'p': + psymoff(0,ptype,"%16t"); + break; + case 'u': + printf("%-8u",w); + break; + case 'U': + printf("%-16U",wx); break; + case 'c': + case 'C': + if (modifier == 'C') { + printesc((int)(itolws.L=(wx), itolws.C[(dot)&3])); + } else { + printc((char)(itolws.L=(wx), itolws.C[(dot)&3])); + } + dotinc = 1; + break; + case 'b': + printf("%-8x", (itolws.L=(wx), itolws.C[(dot)&3])); + dotinc = 1; + break; + case 'B': + printf("%-8o", (itolws.L=(wx), itolws.C[(dot)&3])); + dotinc = 1; + break; + case 's': + case 'S': + savdot = dot; + dotinc = 1; + while ((c = (itolws.L=(wx), itolws.C[(dot)&3])) && (errflg == 0)) { + dot = inkdot(1); + if (modifier == 'S') { + printesc(c); + } else { + printc(c); + } + endline(); + if (!(dot & 3)) + wx = get((int)dot, itype); + } + dotinc = dot - savdot + 1; + dot = savdot; + break; + case 'i': + if (gotdot) { + wx = get((int)(dot & ~3), itype); + } + iDasm((int)(wx), (unsigned int)0, (unsigned int)(dot&~3)); + printc('\n'); + break; + case 'f': + fw.ival = wx; + printf("%-16.9f", fw.fval); + dotinc = 4; + break; + case 'F': + printf("%-32.18F", dw.dval); + dotinc = 8; + break; + } + } + return(fp); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/930126-1.c b/gcc/testsuite/gcc.c-torture/compile/930126-1.c new file mode 100755 index 0000000..8313c5c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930126-1.c @@ -0,0 +1,74 @@ +typedef unsigned T; +typedef char Tchar; +T mt (long, char *); +T ms (long, char *); +T mv (long, T, char); +T cons (T, T); +T decl (T * (*) (T *), char *); + +T*L92(T*),*L15(T*),*L14(T*),*L13(T*),*L12(T*),*L11(T*),*L10(T*),*L9(T*),*L8(T*),*L7(T*),*L6(T*),*L5(T*),*L4(T*),*L3(T*),*L2(T*),*L1(T*); + +static T * +Ldata (T * my_pc) +{ +int cc = (((* ((T *) (my_pc))) >> 16) & 0xFF); +T B92, B91, B90, B15, B14, B13, B12, B11, B10, B9, B8, B7, B6, B5, B4, B3, B2, B1, tO7, tO6, tO5, tO4, tO3, tO2, tO1, tO0; +T object = mv (168, 0, ((Tchar) 1)); +T * cb = (T *) (((T) (object & 0x3FF)) | 0x400); +tO0 = mv (92, 0, ((Tchar) 1)); +B92 = decl (L92, ""); +B15 = decl (L15, ""); +B14 = decl (L14, ""); +B13 = decl (L13, ""); +B12 = decl (L12, ""); +B11 = decl (L11, ""); +B10 = decl (L10, ""); +B9 = decl (L9, ""); +B8 = decl (L8, ""); +B7 = decl (L7, ""); +B6 = decl (L6, ""); +B5 = decl (L5, ""); +B4 = decl (L4, ""); +B3 = decl (L3, ""); +B2 = decl (L2, ""); +B1 = decl (L1, ""); +cb[19] = ((((cc) & 0xFF) << 16) | (9 & 0xFF)); +cb[21] = ((((cc) & 0xFF) << 16) | ((10) & 0xFF)); +cb[23] = ((((cc) & 0xFF) << 16) | (11 & 0xFF)); +cb[25] = ((((cc) & 0xFF) << 16) | (12 & 0xFF)); +cb[27] = ((((cc) & 0xFF) << 16) | (13 & 0xFF)); +cb[29] = ((((cc) & 0xFF) << 16) | (14 & 0xFF)); +cb[31] = ((((cc) & 0xFF) << 16) | (15 & 0xFF)); +cb[35] = ((((cc) & 0xFF) << 16) | (17 & 0xFF)); +cb[36] = ((0x1A) << 26) | (((0x39) << 26) | 1) & 0x3FF; +cb[39] = ms (24, ((char *) "")); +cb[41] = ((0x1A) << 26) | (((0x39) << 26) | 1) & 0x3FF; +cb[44] = 3; +cb[46] = 2; +cb[48] = 3; +cb[50] = 6; +cb[52] = 4; +cb[146] = tO0; +((T *) (((tO0 & 0x3FF)) | 0x400))[92] = B1; +((T *) (((tO0 & 0x3FF)) | 0x400))[91] = B2; +((T *) (((tO0 & 0x3FF)) | 0x400))[2] = B90; +((T *) (((tO0 & 0x3FF)) | 0x400))[2] = B91; +((T *) (((tO0 & 0x3FF)) | 0x400))[1] = B92; +cb[58] = 0x2800 | (T) ((T *) ((B6 & 0x3FF) | 0x400) + 3); +cb[57] = 0x2800 | (T) ((T *) ((B7 & 0x3FF) | 0x400) + 3) & ~0xC00; +cb[56] = 0x2800 | (T) ((T *) ((B8 & 0x3FF) | 0x400) + 3) & ~0xC00; +cb[55] = 0x2800 | (T) ((T *) ((B9 & 0x3FF) | 0x400) + 3) & ~0xC00; +tO7 = mv (8, 0, ((Tchar) 1)); +tO4 = ms (9, ((char *) "")); +tO3 = mv (58, 0, ((Tchar) 1)); +tO6 = ms (4, ((char *) "")); +tO2 = mv (4, 0, ((Tchar) 1)); +tO5 = ms (4, ((char *) "")); +tO1 = mv (28, 0, ((Tchar) 1)); +cb[165] = tO1; +cb[163] = cons (((ms (10, ((char *) "")))), (cons (tO5, 0))); +cb[162] = cons (1, (cons (2, 0))); +cb[150] = cons (1, (cons (2, (cons (3, (cons (4, (cons (5, (cons (6, 0))))))))))); +cb[148] = tO7; +return cb; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/930210-1.c b/gcc/testsuite/gcc.c-torture/compile/930210-1.c new file mode 100755 index 0000000..47d2da2 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930210-1.c @@ -0,0 +1,11 @@ +f() +{ + char c1, c2; + char *p1, *p2; + + do { + c1 = c2 = *p1++; + while (c1--) + *p2++ = *p1++; + } while (c2); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/930217-1.c b/gcc/testsuite/gcc.c-torture/compile/930217-1.c new file mode 100755 index 0000000..70f4a48 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930217-1.c @@ -0,0 +1,14 @@ +double g (); +typedef union { + struct { + unsigned s:1, e:8, f:23; + } u; + float f; +} s; + +f(x, n) + float x; +{ + ((s *)&x)->u.e -= n; + x = g((double)x, -n); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/930222-1.c b/gcc/testsuite/gcc.c-torture/compile/930222-1.c new file mode 100755 index 0000000..c6d6aa3 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930222-1.c @@ -0,0 +1,16 @@ +typedef struct + { + long i; + double f; + } T; + +f (T *n1, T *n2) +{ + if (g (n2)) + return n1->i - n2->i; + else + { + double f = n1->f - n2->i; + return f == 0.0 ? 0 : (f > 0.0 ? 1 : -1); + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/930325-1.c b/gcc/testsuite/gcc.c-torture/compile/930325-1.c new file mode 100755 index 0000000..24cea50 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930325-1.c @@ -0,0 +1,23 @@ +typedef unsigned uint; + +inline +g (uint *s, uint *d, uint c) +{ + while (c != 0) + { + *--d = *--s; + c--; + } +} + +f (uint *p1, uint c, uint *p2) +{ + while (c > 0 && *p1 == 0) + { + p1++; + c--; + } + if (c == 0) + return 1; + g (p2, p1, c); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/930326-1.c b/gcc/testsuite/gcc.c-torture/compile/930326-1.c new file mode 100755 index 0000000..97313d8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930326-1.c @@ -0,0 +1,6 @@ +struct +{ + char a, b, f[3]; +} s; + +long i = s.f-&s.b; diff --git a/gcc/testsuite/gcc.c-torture/compile/930326-1.x b/gcc/testsuite/gcc.c-torture/compile/930326-1.x new file mode 100755 index 0000000..6221456 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930326-1.x @@ -0,0 +1,7 @@ +# This doesn't work on mn10200 + +if { [istarget "mn10200*-*-*"] } { + set torture_compile_xfail "mn10200*-*-*" +} + +return 0 diff --git a/gcc/testsuite/gcc.c-torture/compile/930411-1.c b/gcc/testsuite/gcc.c-torture/compile/930411-1.c new file mode 100755 index 0000000..bb03c13 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930411-1.c @@ -0,0 +1,36 @@ +int heap; + +g(){} + +f(int i1, int i2) +{ + i1 = *(int*)(i1 + 4); + if (i1 == 0) + goto L4; + else + goto L9; + L3: + i2 = heap - 8; + *(int*)i2 = 3; + *(int*)(i2 + 4) = i1; + heap -= 8; + return i2; + L4: + i1 = g(i2); + goto L5; + L5: + i1 = *(int*)(i1 + 4); + if (i1 == 0) + goto L7; + else + goto L8; + L7: + i1 = 0; + goto L3; + L8: + i1 = 1; + goto L3; + L9: + i1 = 1; + goto L3; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/930421-1.c b/gcc/testsuite/gcc.c-torture/compile/930421-1.c new file mode 100755 index 0000000..01b465f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930421-1.c @@ -0,0 +1,19 @@ +double q(double); + +f (int **x, int *r, int *s, int a, int b, int c, int d) +{ + int i, j, k, m, e, f, g, z[1024], y[2]; + + e = g = 0; + for (i = 0; i < a; i++) + for (j = 0; j < b; j++) + if (x[i][j]) + for (k = 0; k < c; k++) + { + f = q(1.5) + q(2.5); + if (g < y[f]) + g = e; + } + for (m = 0; m < 1; m++) + z[0] = m*2*d/3.0 - d; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/930427-2.c b/gcc/testsuite/gcc.c-torture/compile/930427-2.c new file mode 100755 index 0000000..53b6337 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930427-2.c @@ -0,0 +1,9 @@ +struct s { + int f; +}; + +f (w, v0, v1, v2, v3) + struct s *w; +{ + g (v0 ? 1 : w->f, v1 ? v3 : v2); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/930503-1.c b/gcc/testsuite/gcc.c-torture/compile/930503-1.c new file mode 100755 index 0000000..6889e8b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930503-1.c @@ -0,0 +1,8 @@ +f (const char *s, char *d, unsigned l) +{ + if (0) + while (1); + else + while (--l >= 0) + *d++ = *s++; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/930503-2.c b/gcc/testsuite/gcc.c-torture/compile/930503-2.c new file mode 100755 index 0000000..1b0ea34 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930503-2.c @@ -0,0 +1,5 @@ +f() +{ + struct { char x; } r; + g(r); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/930506-1.c b/gcc/testsuite/gcc.c-torture/compile/930506-1.c new file mode 100755 index 0000000..8c26ea3 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930506-1.c @@ -0,0 +1,12 @@ +long long +f (a) + double a; +{ + double b; + unsigned long long v; + + b = a / 2.0; + v = (unsigned) b; + a -= (double) v; + return v; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/930506-2.c b/gcc/testsuite/gcc.c-torture/compile/930506-2.c new file mode 100755 index 0000000..e11e62f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930506-2.c @@ -0,0 +1,15 @@ +#ifndef NO_TRAMPOLINES +int f1() +{ + { int ___() { foo(1); } bar(___); } + return( { int ___() { foo(2); } bar(___);} ); +} + +int f2(int j) +{ + { int ___() { foo(j); } bar(___); } + return( { int ___() { foo(j); } bar(___);} ); +} +#else +int x; +#endif diff --git a/gcc/testsuite/gcc.c-torture/compile/930510-1.c b/gcc/testsuite/gcc.c-torture/compile/930510-1.c new file mode 100755 index 0000000..8c46282 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930510-1.c @@ -0,0 +1,18 @@ +typedef long time_t; +static __const int mon_lengths[2][12] = { + 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31, + 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 +}; +static time_t +f (janfirst, year, rulep, offset) + __const time_t janfirst; + __const int year; + register __const struct rule * __const rulep; + __const long offset; +{ + register int leapyear; + register time_t value; + register int i; + + value += mon_lengths[leapyear][i] * ((long) (60 * 60) * 24); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/930513-1.c b/gcc/testsuite/gcc.c-torture/compile/930513-1.c new file mode 100755 index 0000000..2e106ae --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930513-1.c @@ -0,0 +1,9 @@ +struct s { + int f1 : 26; + int f2 : 8; +}; + +f (struct s *x) +{ + return x->f2++ == 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/930513-2.c b/gcc/testsuite/gcc.c-torture/compile/930513-2.c new file mode 100755 index 0000000..a7f508c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930513-2.c @@ -0,0 +1,9 @@ +double g (); + +f (x) + double x; +{ + x = .85; + while (g () < x) + ; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/930513-3.c b/gcc/testsuite/gcc.c-torture/compile/930513-3.c new file mode 100755 index 0000000..f8d4e60 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930513-3.c @@ -0,0 +1,9 @@ +test () +{ + short *p, q[3]; + int x; + + p = q; + for (x = 0; x < 3; x++) + *p++ = 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/930523-1.c b/gcc/testsuite/gcc.c-torture/compile/930523-1.c new file mode 100755 index 0000000..5f2b5b5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930523-1.c @@ -0,0 +1,54 @@ +int v; + +f () +{ + unsigned long *a1, *a2; + int vertex2; + int c, x1, x2, dx1, dx2, dy1, dy2, e1, e2, s2; + unsigned long m, b; + int n; + unsigned long r; + int aba; + + do + { + if (dx2 >= dy2) + dx2 = dx2 % dy2; + + if (dx2 >= dy2) + { + s2 = - (dx2 / dy2); + dx2 = dx2 % dy2; + } + } + while (vertex2 / 65536); + + for (;;) + { + c = x2; + a2 = a1; + if (v) + a2 = 0; + + if (c + n) + { + m = b << (c * 8); + *a2 = (*a2 & ~m) | (r & m); + n += c; + + while (--n) + { + { + } + } + } + + a1 = 0; + x1 += 0; + if (e1 += dx1) + e1 -= dy1; + x2 += s2; + if (e2 += dx2) + e2 -= dy2; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/930525-1.c b/gcc/testsuite/gcc.c-torture/compile/930525-1.c new file mode 100755 index 0000000..00c2e26 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930525-1.c @@ -0,0 +1,7 @@ +typedef struct foo foo_t; +foo_t x; +struct foo { + int i; +}; + +foo_t x = { 10 }; diff --git a/gcc/testsuite/gcc.c-torture/compile/930527-1.c b/gcc/testsuite/gcc.c-torture/compile/930527-1.c new file mode 100755 index 0000000..53e00e6 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930527-1.c @@ -0,0 +1,16 @@ +enum {e0, e1}; + +int x[] = +{ + [e0] = 0 +}; + +f () +{ + switch (1) + { + case e0: + case e1: + break; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/930529-1.c b/gcc/testsuite/gcc.c-torture/compile/930529-1.c new file mode 100755 index 0000000..70b2cb8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930529-1.c @@ -0,0 +1,83 @@ +struct r +{ + int d1, d2; +}; + +struct km +{ + int d; +}; + +struct f1 +{ + char *fn; + char *fd; + char *fs; + char *ic; + void (*ff) (); +}; + +int g (); + +int y; +struct r *bs; +int bv; + +void b (); +char *w (); + +struct km **q; +char **mns; +int nm; +struct f1 **z; + +f (char *km, char *h) +{ + struct f1 *t; + int map = midn(km, strlen(km)); + int V; + int c; + struct r r; + struct f1 *cm; + + if (!g(&V, &cm, h, strlen(h))) + { + c = (cm - z[V]); + goto L; + } + + for (c = 0; c < nm; c++) + if (!strcmp (h, mns[c])) + { + V = -1; + goto L; + } + + for (c = 0; c < y; c++) + { + if (!memcmp (&bs[c], &r, 8)) + goto L; + } + + h = w (&r); + if (!bv) + { + bs = g (8); + t = (struct f1 *)g (20); + } + else + { + bs = g (bs, y * 8); + z[bv] = cr (z[bv], (1 + y) * 20); + t = &z[bv][y - 1]; + } + bs[y - 1] = r; + t->fs[0] = sp (y - 1); + t->fs[1] = 0; + t->ic = 0; + t->fd = 0; + t->fn = cs (h); + t->ff = b; + L: + g (q[map], V, c); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/930530-1.c b/gcc/testsuite/gcc.c-torture/compile/930530-1.c new file mode 100755 index 0000000..848e040 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930530-1.c @@ -0,0 +1,5 @@ +f () +{ + struct { char a, b; } x; + g (x, x, x, x); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/930602-1.c b/gcc/testsuite/gcc.c-torture/compile/930602-1.c new file mode 100755 index 0000000..5a0eb21 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930602-1.c @@ -0,0 +1,13 @@ +typedef struct { + int f[8]; +} T; + +f (w, l, r) + T *w; + unsigned short l, r; +{ + int i; + + for (i = l; i < r; i++) + g (w->f[i]); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/930603-1.c b/gcc/testsuite/gcc.c-torture/compile/930603-1.c new file mode 100755 index 0000000..643cc52 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930603-1.c @@ -0,0 +1,10 @@ +union u { union u *a; double d; }; +union u *s, g(); + +f() +{ + union u x = g(); + + s[0] = *x.a; + s[1] = g(); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/930607-1.c b/gcc/testsuite/gcc.c-torture/compile/930607-1.c new file mode 100755 index 0000000..97c94b2 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930607-1.c @@ -0,0 +1,9 @@ +typedef void f (); +typedef f *pf; +long long i; + +g () +{ + long long p = i; + ((pf) (long) p) (); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/930609-1.c b/gcc/testsuite/gcc.c-torture/compile/930609-1.c new file mode 100755 index 0000000..d50d3c9 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930609-1.c @@ -0,0 +1,104 @@ +const int h (double value); +const double scalb (double x, int n); +const double logb (double x); +static const double a = 0; + +double f (y, x) + double y, x; +{ + static const double zero=0, one=1, small=1.0E-9, big=1.0E18; + double t,z,sy,sx,hi,lo; + int k,m; + + if (x!=x) + return x; + if (y!=y) + return y; + + sy = g (one); + sx = g (one); + + if (x==1) + { + y=g (y); + t=y; + if (h (t)) + goto begin; + } + + if (y==zero) + return (sx==one)?y:g (a); + + if (x==zero) + return g (a); + + if (!h (x)) + if (!h (y)) + return g ((sx==one)?a:3*a); + else + return g ((sx==one)?zero:a); + + if (!h (y)) + return g (a); + + x=g (x); + y=g (y); + if ((m=(k=logb (y))- logb (x)) > 60) + t=big+big; + else if (m < -80) + t=y/x; + else + { + t = y/x; + y = scalb (y,-k); + x=scalb (x,-k); + } + + begin: + if (t < 2.4375) + { + k = 4 * (t+0.0625); + switch (k) + { + case 0: + case 1: + if (t < small) + { + big + small; + return g ((sx>zero)?t:a-t); + } + hi = zero; lo = zero; break; + + case 2: + hi = a; lo = a; + z = x+x; + t = ((y+y) - x) / (z + y); break; + + case 3: + case 4: + hi = a; lo = zero; + t = (y - x) / (x + y); break; + + default: + hi = a; lo = a; + z = y-x; y=y+y+y; t = x+x; + t = ((z+z)-x) / (t + y); break; + } + } + else + { + hi = a; lo = zero; + + if (t <= big) + t = - x / y; + else + { + big+small; + t = zero; + } + } + + z = t*(z*(a+z*(a+z*(a+z*(a+z*(a+z*(a+z*(a+z*(a+z*(a+z*(a+z*a))))))))))); + + return g ((sx>zero)?z:a-z); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/930611-1.c b/gcc/testsuite/gcc.c-torture/compile/930611-1.c new file mode 100755 index 0000000..c216c09 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930611-1.c @@ -0,0 +1,7 @@ +float +f (float a1) +{ + union { float f; int l; } fl1; + fl1.f = a1; + return fl1.l ? 1.0 : a1; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/930618-1.c b/gcc/testsuite/gcc.c-torture/compile/930618-1.c new file mode 100755 index 0000000..74c2157 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930618-1.c @@ -0,0 +1,8 @@ +f (s) +{ + int r; + + r = (!g(s)) | (!g(s)) | (!g(s)) | (!g(s)) | (!g(s)) | (!g(s)) | (!g(s)) | (!g(s)) | (!g(s)) | (!g(s)) | (!g(s)) | (!g(s)) | (!g(s)) | (!g(s)) | (!g(s)) | (!g(s)) | (!g(s)) | (!g(s)) | (!g(s)); + + return r; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/930621-1.c b/gcc/testsuite/gcc.c-torture/compile/930621-1.c new file mode 100755 index 0000000..3679cf1 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930621-1.c @@ -0,0 +1,30 @@ +int bytestart[5000 + 1]; +unsigned char modtext[400 + 1]; +unsigned char bytemem[2][45000L + 1]; + +long +modlookup (int l) +{ + signed char c; + long j; + long k; + signed char w; + long p; + while (p != 0) + { + while ((k < bytestart[p + 2]) && (j <= l) && (modtext[j] == bytemem[w][k])) + { + k = k + 1; + j = j + 1; + } + if (k == bytestart[p + 2]) + if (j > l) + c = 1; + else c = 4; + else if (j > l) + c = 3; + else if (modtext[j] < bytemem[w][k]) + c = 0; + else c = 2; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/930623-1.c b/gcc/testsuite/gcc.c-torture/compile/930623-1.c new file mode 100755 index 0000000..4b5b90b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930623-1.c @@ -0,0 +1,7 @@ +g (a, b) {} + +f (xx) + void* xx; +{ + __builtin_apply ((void*)g, xx, 200); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/930623-2.c b/gcc/testsuite/gcc.c-torture/compile/930623-2.c new file mode 100755 index 0000000..8b61fc1 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930623-2.c @@ -0,0 +1,91 @@ +extern unsigned short statesCount; +extern short cn_cadrstates[38][37]; +extern short coutstate[38][37][5]; +extern short ccostate[38][37][5]; +extern short cdel_E[38][37][5]; +extern short cn[38][37][5][3]; +extern short cd[38][37][5][3]; + +extern short c[4][37]; + +extern double vrandNext[64]; + +f (unsigned long long maddrOutState[37][8 * 8], + int maddrIndices[8 * 8], + int delta_E[8 * 8], + int after_x_hash[8 * 8], + int after_y_hash[8 * 8], + int after_z_hash[8 * 8], + int nActivePlane) +{ + int class[8 * 8]; + int ccoeff[8 * 8]; + int nx[8 * 8]; + int ny[8 * 8]; + int nz[8 * 8]; + int phat[8 * 8]; + int i; + int inState; + + for (inState = 0; inState < statesCount; inState++) { + long long Nf[8 * 8]; + long long Ns[8 * 8]; + long long Nb[8 * 8]; + int bbState[8 * 8]; + int not_flag_p[8 * 8]; + int j; + int max_cadrstates = 0; + + for (i = 0; i < nActivePlane; i++) { + int in = maddrIndices[i]; + int k = cn_cadrstates[class[in]][inState]; + + if (k > max_cadrstates) + max_cadrstates = k; + } + + for (j = 0; j < max_cadrstates; j++) { + int coState[8 * 8]; + int N_co[8 * 8]; + for (i = 0; i < nActivePlane; i++) { + int in = maddrIndices[i]; + int k = cn_cadrstates[class[in]][inState]; + + if (j < k-1) { + long long numer = (nx[in] * cn[class[in]][inState][j][0] + + ny[in] * cn[class[in]][inState][j][1] + + nz[in] * cn[class[in]][inState][j][2]); + long long denom = (nx[in] * cd[class[in]][inState][j][0] + + ny[in] * cd[class[in]][inState][j][1] + + nz[in] * cd[class[in]][inState][j][2]); + long long Nj = ((denom == 0) ? 0 : (((((long long)(const64(0,0x10000)) * numer * Ns[in]) / denom) + (long long)(((unsigned) vrandNext[in]) & 0xffff)) >> 16)); + int outState = coutstate[class[in]][inState][j]; + int this_coState = ccostate[class[in]][inState][j]; + int del_E = cdel_E[class[in]][inState][j]; + int old_Ns = Ns[in]; + + maddrOutState[outState][in] += Nj; + Ns[in] -= Nj; + delta_E[in] += Nj * del_E; + if (not_flag_p[in]) { + after_x_hash[in] += Nj * c[0][outState]; + after_y_hash[in] += Nj * c[1][outState]; + after_z_hash[in] += Nj * c[2][outState]; + } + coState[in] = this_coState; + N_co[in] = Nj; + } + else if (j == k-1) { + long long Nj = Ns[in]; + int outState = coutstate[class[in]][inState][j]; + int this_coState = ccostate[class[in]][inState][j]; + int del_E = cdel_E[class[in]][inState][j]; + maddrOutState[outState][in] += Nj; + delta_E[in] += Nj * del_E; + coState[in] = this_coState; + N_co[in] = Nj; + } + } + } + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/930702-1.c b/gcc/testsuite/gcc.c-torture/compile/930702-1.c new file mode 100755 index 0000000..9f51dd8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930702-1.c @@ -0,0 +1,5 @@ +f () +{ + {({});} + return 1; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/930926-1.c b/gcc/testsuite/gcc.c-torture/compile/930926-1.c new file mode 100755 index 0000000..fcfa4fb --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930926-1.c @@ -0,0 +1,7 @@ +int f () { return 0; } + +void +test () +{ + int j = { f() }; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/930927-1.c b/gcc/testsuite/gcc.c-torture/compile/930927-1.c new file mode 100755 index 0000000..81a4979 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930927-1.c @@ -0,0 +1,3 @@ +#include <stddef.h> + +wchar_t s[5] = L"abcd"; diff --git a/gcc/testsuite/gcc.c-torture/compile/931003-1.c b/gcc/testsuite/gcc.c-torture/compile/931003-1.c new file mode 100755 index 0000000..922b143 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/931003-1.c @@ -0,0 +1,15 @@ +f (n, a) + int n; + double a[]; +{ + double b[51]; + int i, j; + + i = 0; + + for (j = n - 1; j > 0; j--) + b[i++] = 0; + + if (b[0] > b[i - 1]) + a[i] = b[i - 1]; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/931004-1.c b/gcc/testsuite/gcc.c-torture/compile/931004-1.c new file mode 100755 index 0000000..0e741fd --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/931004-1.c @@ -0,0 +1,8 @@ +#define A "This is a long test that tests the structure initialization" +#define B A,A +#define C B,B,B,B +#define D C,C,C,C +int main() +{ + char *subs[]={ D, D, D, D, D, D, D, D, D, D, D, D, D, D, D}; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/931013-1.c b/gcc/testsuite/gcc.c-torture/compile/931013-1.c new file mode 100755 index 0000000..c237c0b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/931013-1.c @@ -0,0 +1,10 @@ +g (); + +f () +{ + long ldata[2]; + int seed; + + seed = (ldata[0]) + (ldata[1] << 16); + g (seed); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/931013-2.c b/gcc/testsuite/gcc.c-torture/compile/931013-2.c new file mode 100755 index 0000000..8fc0db4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/931013-2.c @@ -0,0 +1,20 @@ +f (unsigned short Z[48]) +{ + int j; + unsigned short t1, t2, t3, T[48]; + unsigned short *p = T + 48; + + for (j = 1; j < 8; j++) + { + t1 = *Z++; + *--p = *Z++; + *--p = t1; + t1 = inv(*Z++); + t2 = -*Z++; + t3 = -*Z++; + *--p = inv(*Z++); + *--p = t2; + *--p = t3; + *--p = t1; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/931013-3.c b/gcc/testsuite/gcc.c-torture/compile/931013-3.c new file mode 100755 index 0000000..e663b9a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/931013-3.c @@ -0,0 +1,11 @@ +struct s +{ + int f; +}; + +struct s +f () +{ + int addr; + return *(struct s *) &addr; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/931018-1.c b/gcc/testsuite/gcc.c-torture/compile/931018-1.c new file mode 100755 index 0000000..7efe40e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/931018-1.c @@ -0,0 +1,14 @@ +typedef struct +{ + int a, b; +} T; + +f (T *bs) +{ + long long x; + x = ({ + union { T s; long long l; } u; + u.s = *bs; + u.l; + }); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/931031-1.c b/gcc/testsuite/gcc.c-torture/compile/931031-1.c new file mode 100755 index 0000000..9015f54 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/931031-1.c @@ -0,0 +1,9 @@ +struct s +{ + int pad:1, no:1; +}; + +f (struct s *b, int c) +{ + char d = b->no && c; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/931102-1.c b/gcc/testsuite/gcc.c-torture/compile/931102-1.c new file mode 100755 index 0000000..a039c26 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/931102-1.c @@ -0,0 +1,111 @@ +char *e (); + +#define SET \ + if (d > *b++) d |= a; \ + if (b) b = e(b); + +xxx() +{ + int a, d; + char *b, *c; + + while (1) { + while (1) { + while (1) { + if (a) { + switch (a) { + case 1: + while (1) { + SET + do { + SET + } while (1); + } + case 2: + while (1) { + if (d) { + do { + SET + } while (1); + } + else { + do { + SET + } while (1); + } + } + case 3: + while (1) { + if (d) { + do { + SET + } while (1); + } + else { + do { + SET + } while (1); + } + } + case 4: + while (1) { + if (d) { + do { + SET + } while (1); + } + else { + do { + SET + } while (1); + } + } + } + } + else { + switch (a) { + case 2: + while (1) { + if (d) { + do { + SET + } while (1); + } + else { + do { + SET + } while (1); + } + } + case 3: + while (1) { + if (d) { + do { + SET + } while (1); + } + else { + do { + SET + } while (1); + } + } + case 4: + while (1) { + if (d) { + do { + SET + } while (1); + } + else { + do { + SET + } while (1); + } + } + } + } + } + } + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/931102-2.c b/gcc/testsuite/gcc.c-torture/compile/931102-2.c new file mode 100755 index 0000000..f39b271 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/931102-2.c @@ -0,0 +1,21 @@ +typedef struct { + int a; +} VCR; + +typedef struct { + VCR vcr[8]; +} VCRC; + +typedef struct { + char vcr; +} OWN; + +OWN Own[16]; + +f (x, own) + VCRC *x; + OWN *own; +{ + x[own->vcr / 8].vcr[own->vcr % 8].a--; + x[own->vcr / 8].vcr[own->vcr % 8].a = x[own->vcr / 8].vcr[own->vcr % 8].a; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/931203-1.c b/gcc/testsuite/gcc.c-torture/compile/931203-1.c new file mode 100755 index 0000000..3007ff5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/931203-1.c @@ -0,0 +1,5 @@ +v (a, i) + unsigned *a, i; +{ + a++[i] = 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/940611-1.c b/gcc/testsuite/gcc.c-torture/compile/940611-1.c new file mode 100755 index 0000000..90f7248 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/940611-1.c @@ -0,0 +1,10 @@ +f () +{ + do +L:; + while (0); + do + ; + while (0); + goto L; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/940712-1.c b/gcc/testsuite/gcc.c-torture/compile/940712-1.c new file mode 100755 index 0000000..10a6961 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/940712-1.c @@ -0,0 +1,4 @@ +f () +{ + return (*(volatile unsigned int *)8000) / 3; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/940718-1.c b/gcc/testsuite/gcc.c-torture/compile/940718-1.c new file mode 100755 index 0000000..505280f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/940718-1.c @@ -0,0 +1,7 @@ +extern double log (double) __attribute__ ((const)); + +f (double x) +{ + for (;;) + exp(log(x)); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/941014-1.c b/gcc/testsuite/gcc.c-torture/compile/941014-1.c new file mode 100755 index 0000000..d317015 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/941014-1.c @@ -0,0 +1,11 @@ +f (to) + char *to; +{ + unsigned int wch; + register length; + unsigned char tmp; + unsigned int mult = 10; + + tmp = (wch>>(unsigned int)(length * mult)); + *to++ = (unsigned char)tmp; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/941014-2.c b/gcc/testsuite/gcc.c-torture/compile/941014-2.c new file mode 100755 index 0000000..01e9a67 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/941014-2.c @@ -0,0 +1,37 @@ +void +f (n, ppt, xrot) +{ + int tileWidth; + int nlwSrc; + int srcx; + int v3, v4; + register unsigned long ca1, cx1, ca2, cx2; + unsigned long *pSrcLine; + register unsigned long *pDst; + register unsigned long *pSrc; + register unsigned long b, tmp; + unsigned long tileEndMask; + int v1, v2; + int tileEndPart; + int needFirst; + tileEndPart = 0; + v1 = tileEndPart << 5; + v2 = 32 - v1; + while (n--) + { + if ((srcx = (ppt - xrot) % tileWidth) < 0) + if (needFirst) + if (nlwSrc == 1) + { + tmp = b; + if (tileEndPart) + b = (*pSrc & tileEndMask) | (*pSrcLine >> v1); + } + if (tileEndPart) + b = (tmp << v1) | (b >> v2); + if (v4 != 32) + *pDst = (*pDst & ((tmp << v3) | (b >> v4) & ca1 ^ cx1) + ^ (((tmp << v3) | (b >> v4)) & ca2 ^ cx2)); + *pDst = *pDst & tmp; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/941014-3.c b/gcc/testsuite/gcc.c-torture/compile/941014-3.c new file mode 100755 index 0000000..6dcb893 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/941014-3.c @@ -0,0 +1,72 @@ +typedef unsigned char byte; +typedef unsigned int uint; +typedef unsigned long ulong; +typedef ulong gs_char; +typedef struct gs_show_enum_s gs_show_enum; +typedef struct gs_font_s gs_font; +typedef struct gx_font_stack_item_s { + gs_font *font; +} gx_font_stack_item; +typedef struct gx_font_stack_s { + gx_font_stack_item items[1 + 5 ]; +} gx_font_stack; +struct gs_show_enum_s { + gx_font_stack fstack; +}; +typedef enum { + ft_composite = 0, +} font_type; +struct gs_font_s { + font_type FontType; +}; +typedef enum { + fmap_escape = 3, + fmap_shift = 8 + } fmap_type; +typedef struct gs_type0_data_s { + fmap_type FMapType; +} gs_type0_data; +gs_type0_next_char(register gs_show_enum *penum) +{ + const byte *p; + int fdepth; + gs_font *pfont; + gs_type0_data *pdata; + uint fidx; + gs_char chr; + for (; pfont->FontType == ft_composite; ) + { + fmap_type fmt; + switch ( fmt ) + { + do {} while (0); + rdown: + continue; + case fmap_shift: + p++; + do {} while (0); + goto rdown; + } + break; + } + up: + while ( fdepth > 0 ) + { + switch ( pdata->FMapType ) + { + default: + continue; + case fmap_escape: + fidx = *++p; + do {} while (0); + if ( fidx == chr && fdepth > 1 ) + goto up; + down: + fdepth--; + do {} while (0); + } + break; + } + while ( (pfont = penum->fstack.items[fdepth].font)->FontType == ft_composite ) + ; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/941014-4.c b/gcc/testsuite/gcc.c-torture/compile/941014-4.c new file mode 100755 index 0000000..9e673f3 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/941014-4.c @@ -0,0 +1,16 @@ +#ifndef NO_LABEL_VALUES +f (int *re) +{ + int *loops = 0, *loope = 0; + unsigned dat0 = 0; + static void *debug = &&firstdebug; + + firstdebug: + g (loops, loope); + + if (dat0 & 1) + re[(dat0 >> 2) & 3] = 0; +} +#else +int x; +#endif diff --git a/gcc/testsuite/gcc.c-torture/compile/941019-1.c b/gcc/testsuite/gcc.c-torture/compile/941019-1.c new file mode 100755 index 0000000..257b594 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/941019-1.c @@ -0,0 +1 @@ +__complex__ long double sub (__complex__ long double cld) { return cld; } diff --git a/gcc/testsuite/gcc.c-torture/compile/941111-1.c b/gcc/testsuite/gcc.c-torture/compile/941111-1.c new file mode 100755 index 0000000..3f0c28b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/941111-1.c @@ -0,0 +1,8 @@ +main () +{ + struct S { int i; char c; } obj1, obj2; + + foo (); + if (obj1.c != obj2.c) + bar (); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/941113-1.c b/gcc/testsuite/gcc.c-torture/compile/941113-1.c new file mode 100755 index 0000000..5c2e0b6 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/941113-1.c @@ -0,0 +1,12 @@ +typedef void foo (void); + +f (x) +{ + if (x) + { + const foo* v; + (*v)(); + } + else + g (0); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/950122-1.c b/gcc/testsuite/gcc.c-torture/compile/950122-1.c new file mode 100755 index 0000000..8dea790 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/950122-1.c @@ -0,0 +1,5 @@ +int +foo (int i, unsigned short j) +{ + return j *= i; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/950124-1.c b/gcc/testsuite/gcc.c-torture/compile/950124-1.c new file mode 100755 index 0000000..e723954 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/950124-1.c @@ -0,0 +1,15 @@ +f () +{ + if (g ()) + h (); + else + { + do + { + return 0; + break; + } + while (1); + } + return 1; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/950221-1.c b/gcc/testsuite/gcc.c-torture/compile/950221-1.c new file mode 100755 index 0000000..1414763 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/950221-1.c @@ -0,0 +1,16 @@ +short v = -1; + +typedef struct +{ + short network; +} atype; + +void f () +{ + static atype config; + atype *cp; + short net; + cp = &config; + cp->network = (v == -1) ? 100 : v; + net = cp->network; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/950329-1.c b/gcc/testsuite/gcc.c-torture/compile/950329-1.c new file mode 100755 index 0000000..7c047f5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/950329-1.c @@ -0,0 +1,19 @@ +f () +{ + int i; + for (i = 1;; i = 0) + { + if (h ()) + { + if (i) + g (); + g (h ()); + g (h ()); + } + else + { + g (); + break; + } + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/950512-1.c b/gcc/testsuite/gcc.c-torture/compile/950512-1.c new file mode 100755 index 0000000..e43ec48 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/950512-1.c @@ -0,0 +1,6 @@ +typedef unsigned short uint16; +f (unsigned char *w) +{ + w[2] = (uint16) ((((g (0) % 10000 + 42) & 0xFF) << 8) | (((g (0) % 10000 + 42) >> 8) & 0xFF)) & 0xFF, + w[3] = (uint16) ((((g (0) % 10000 + 42) & 0xFF) << 8) | (((g (0) % 10000 + 42) >> 8) & 0xFF)) >> 8; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/950530-1.c b/gcc/testsuite/gcc.c-torture/compile/950530-1.c new file mode 100755 index 0000000..2b714e0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/950530-1.c @@ -0,0 +1,4 @@ +f (int *s, int *t) +{ + return (t - s) / 2; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/950607-1.c b/gcc/testsuite/gcc.c-torture/compile/950607-1.c new file mode 100755 index 0000000..851defc --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/950607-1.c @@ -0,0 +1,38 @@ +typedef struct { + int component_id; + int component_index; + int h_samp_factor; + int v_samp_factor; +} jpeg_component_info; +struct jpeg_common_struct { + struct jpeg_error_mgr * err; +}; +typedef struct jpeg_common_struct * j_common_ptr; +typedef struct jpeg_compress_struct * j_compress_ptr; +struct jpeg_compress_struct { + struct jpeg_error_mgr * err; + int num_components; + jpeg_component_info * comp_info; + int max_h_samp_factor; + int max_v_samp_factor; +}; +struct jpeg_error_mgr { + int msg_code; +}; + +void +jinit_downsampler (j_compress_ptr cinfo) +{ + int ci; + jpeg_component_info * compptr; + + for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; + ci++, compptr++) { + if (compptr->h_samp_factor == cinfo->max_h_samp_factor && + compptr->v_samp_factor == cinfo->max_v_samp_factor) { + } else if ((cinfo->max_h_samp_factor % compptr->h_samp_factor) == 0 && + (cinfo->max_v_samp_factor % compptr->v_samp_factor) == 0) { + } else + cinfo->err->msg_code = 0; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/950610-1.c b/gcc/testsuite/gcc.c-torture/compile/950610-1.c new file mode 100755 index 0000000..16d0d0e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/950610-1.c @@ -0,0 +1 @@ +f (int n, int a[2][n]) {} diff --git a/gcc/testsuite/gcc.c-torture/compile/950612-1.c b/gcc/testsuite/gcc.c-torture/compile/950612-1.c new file mode 100755 index 0000000..cb3cb0a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/950612-1.c @@ -0,0 +1,134 @@ +typedef enum +{ + LODI, + STO, + ADDI, + ADD, + SUBI, + SUB, + MULI, + MUL, + DIVI, + DIV, + INC, + DEC +} INSN; + +f (pc) + short *pc; +{ + long long stack[16], *sp = &stack[16], acc = 0; + + for (;;) + { + switch ((INSN)*pc++) + { + case LODI: + *--sp = acc; + acc = ((long long)*pc++) << 32; + break; + case STO: + return (acc >> 32) + (((((unsigned long long) acc) & 0xffffffff) & (1 << 31)) != 0); + break; + case ADDI: + acc += ((long long)*pc++) << 32; + break; + case ADD: + acc = *sp++ + acc; + break; + case SUBI: + acc -= ((long long)*pc++) << 32; + break; + case SUB: + acc = *sp++ - acc; + break; + case MULI: + acc *= *pc++; + break; + case MUL: + { + long long aux; + unsigned char minus; + + minus = 0; + aux = *sp++; + if (aux < 0) + { + minus = ~minus; + aux = -aux; + } + if (acc < 0) + { + minus = ~minus; + acc = -acc; + } + acc = ((((((unsigned long long) acc) & 0xffffffff) * (((unsigned long long) aux) & 0xffffffff)) >> 32) + + ((((unsigned long long) acc) >> 32) * (((unsigned long long) aux) & 0xffffffff) + (((unsigned long long) acc) & 0xffffffff) + (((unsigned long long) aux) >> 32)) + + (((((unsigned long long) acc) >> 32) * (((unsigned long long) aux) >> 32)) << 32)); + if (minus) + acc = -acc; + } + break; + case DIVI: + { + short aux; + + aux = *pc++; + acc = (acc + aux / 2) / aux; + } + break; + case DIV: + { + long long aux; + unsigned char minus; + + minus = 0; + aux = *sp++; + if (aux < 0) + { + minus = ~minus; + aux = -aux; + } + if (acc < 0) + { + minus = ~minus; + acc = -acc; + } + + if (((unsigned long long)acc) == 0) + acc = (unsigned long long)-1 / 2; + else if ((((unsigned long long) ((unsigned long long)acc)) & 0xffffffff) == 0) + acc = ((unsigned long long)aux) / (((unsigned long long) ((unsigned long long)acc)) >> 32); + else if ((((unsigned long long) ((unsigned long long)acc)) >> 32) == 0) + acc = ((((unsigned long long)aux) / ((unsigned long long)acc)) << 32) + + ((((unsigned long long)aux) % ((unsigned long long)acc)) << 32) / ((unsigned long long)acc); + else + { + unsigned char shift; + unsigned long hi; + + shift = 32; + hi = (((unsigned long long) ((unsigned long long)acc)) >> 32); + do { + if (hi & ((unsigned long)1 << (shift - 1))) + break; + } while (--shift != 0); + printf("shift = %d\n", shift); + acc = ((((unsigned long long)aux) / ((unsigned long long)acc)) << 32) + + (((((unsigned long long)aux) % ((unsigned long long)acc)) << (32 - shift)) + ((((unsigned long long)acc) >> shift) / 2)) / (((unsigned long long)acc) >> shift); + } + + if (minus) + acc = -acc; + } + break; + case INC: + acc += 1; + break; + case DEC: + acc -= 1; + break; + } + printf("%08lx.%08lx\n", (long)(((unsigned long long) acc) >> 32) , (long)(((unsigned long long) acc) & 0xffffffff)); + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/950613-1.c b/gcc/testsuite/gcc.c-torture/compile/950613-1.c new file mode 100755 index 0000000..8aa757f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/950613-1.c @@ -0,0 +1,31 @@ +#ifndef NO_LABEL_VALUES +f () +{ + long *sp; + long *pc; + + static void *dummy[] = + { + &&L1, + &&L2, + }; + + L1: + { + float val; + val = *(float *) sp; + val = -val; + *(float *) sp = val; + goto *pc++; + } + + L2: + { + float from; + *(long long *) sp = from; + goto *pc++; + } +} +#else +int x; +#endif diff --git a/gcc/testsuite/gcc.c-torture/compile/950618-1.c b/gcc/testsuite/gcc.c-torture/compile/950618-1.c new file mode 100755 index 0000000..4229da4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/950618-1.c @@ -0,0 +1,2 @@ +static __inline__ int f () { return g (); } +int g () { return f (); } diff --git a/gcc/testsuite/gcc.c-torture/compile/950719-1.c b/gcc/testsuite/gcc.c-torture/compile/950719-1.c new file mode 100755 index 0000000..d3277fa --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/950719-1.c @@ -0,0 +1,11 @@ +typedef struct +{ + int Header; + char data[4092]; +} t_node; + +f (unsigned short rid, unsigned short record_length) +{ + t_node tnode; + g (rid, tnode.data + rid * record_length); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/950729-1.c b/gcc/testsuite/gcc.c-torture/compile/950729-1.c new file mode 100755 index 0000000..cfdbad9 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/950729-1.c @@ -0,0 +1,39 @@ +static const char * const lcset = "0123456789abcdef"; +static const char * const ucset = "0123456789ABCDEF"; + +char * +f (char *buffer, long long value, char type) +{ + int base, i; + + i = 128 - 1; + buffer[i--] = '\0'; + + switch (type) + { + case 'u': + case 'o': + case 'x': + case 'X': + if (type == 'u') + base = 10; + else if (type == 'o') + base = 8; + else + base = 16; + + while (i >= 0) + { + if (type == 'X') + buffer[i--] = ucset[((unsigned long long) value) % base]; + else + buffer[i--] = lcset[((unsigned long long) value) % base]; + + if ((value = ((unsigned long long) value) / base) == 0) + break; + } + break; + } + + return &buffer[++i]; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/950816-1.c b/gcc/testsuite/gcc.c-torture/compile/950816-1.c new file mode 100755 index 0000000..da849bb --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/950816-1.c @@ -0,0 +1,7 @@ +f () +{ + unsigned char b[2]; + float f; + b[0] = (unsigned char) f / 256; + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/950816-2.c b/gcc/testsuite/gcc.c-torture/compile/950816-2.c new file mode 100755 index 0000000..41e770d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/950816-2.c @@ -0,0 +1,8 @@ +f () +{ + int i; + float a,b,c; + unsigned char val[2]; + i = func (&c); + val[0] = c < a ? a : c >= 1.0 ? b : c; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/950816-3.c b/gcc/testsuite/gcc.c-torture/compile/950816-3.c new file mode 100755 index 0000000..b3cb0fc --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/950816-3.c @@ -0,0 +1,8 @@ +f () +{ + int i; + short x, z; + for (i = 0; i <= 1; i++) + x = i; + return x + z; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/950910-1.c b/gcc/testsuite/gcc.c-torture/compile/950910-1.c new file mode 100755 index 0000000..1be2aa5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/950910-1.c @@ -0,0 +1,22 @@ +f (char *p) +{ + char c; + + c = *++p; + if (c != ' ') + return 0; + for (;;) + { + c = *p; + if (g (c)) + p++; + else + { + if (c == ' ') + break; + else + return 0; + } + } + return 1; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/950919-1.c b/gcc/testsuite/gcc.c-torture/compile/950919-1.c new file mode 100755 index 0000000..8320f6d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/950919-1.c @@ -0,0 +1,5 @@ +#define empty +#if empty#cpu(m68k) +#endif + +f (){} diff --git a/gcc/testsuite/gcc.c-torture/compile/950921-1.c b/gcc/testsuite/gcc.c-torture/compile/950921-1.c new file mode 100755 index 0000000..371c7d5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/950921-1.c @@ -0,0 +1,12 @@ +f () +{ + union + { + signed char c; + double d; + } u; + + u.c = 1; + u.c = 1; + return u.c; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/950922-1.c b/gcc/testsuite/gcc.c-torture/compile/950922-1.c new file mode 100755 index 0000000..73574f3 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/950922-1.c @@ -0,0 +1,68 @@ +struct sw { + const void *x; + int r; +}; +struct sq { + struct sw *q_w; + int t; + int z; +}; + +int +f (int ch, char *fp, char *ap) +{ + register int n; + register char *cp; + register struct sw *p; + register int f; + int prec; + double _double; + int expt; + int ndig; + char expstr[7]; + unsigned long long _uquad; + struct sq q; + struct sw w[8]; + static char zeroes[16]; + + for (;;) { + switch (ch) { + case 'd': + _double = (double) (ap += 8, *((double *) (ap - 8))); + break; + case 'o': + goto nosign; + case 'u': + _uquad = (f & 0x020 ? (ap += 8, *((long long *) (ap - 8))) : f & 0x010 ? (ap += 4, *((long *) (ap - 4))) : f & 0x040 ? (long)(short)(ap += 4, *((int *) (ap - 4))) : (long)(ap += 4, *((int *) (ap - 4)))); + goto nosign; + case 'x': + _uquad = (f & 0x020 ? (ap += 8, *((long long *) (ap - 8))) : f & 0x010 ? (ap += 4, *((long *) (ap - 4))) : f & 0x040 ? (long)(unsigned short)(ap += 4, *((int *) (ap - 4))) : (long)(ap += 4, *((int *) (ap - 4)))); + nosign: + if (_uquad != 0 || prec != 0); + break; + default: + } + if ((f & 0x100) == 0) { + } else { + if (ch >= 'f') { + if (_double == 0) { + if (expt < ndig || (f & 0x001) != 0) { + { if ((n = (ndig - 1)) > 0) { while (n > 16) {{ p->x = (zeroes); p->r = 16; q.z += 16; p++; if (++q.t >= 8) { if (g(fp, &q)) goto error; p = w; }} n -= 16; }{ p->x = (zeroes); p->r = n; q.z += n; p++; if (++q.t >= 8) { if (g(fp, &q)) goto error; p = w; }}}} + } + } else if (expt <= 0) { + { p->x = ("0"); p->r = 1; q.z += 1; p++; if (++q.t >= 8) { if (g(fp, &q)) goto error; p = w; }} + { p->x = 0; p->r = 1; q.z += 1; p++; if (++q.t >= 8) { if (g(fp, &q)) goto error; p = w; }} + { if ((n = (-expt)) > 0) { while (n > 16) {{ p->x = (zeroes); p->r = 16; q.z += 16; p++; if (++q.t >= 8) { if (g(fp, &q)) goto error; p = w; }} n -= 16; }{ p->x = (zeroes); p->r = n; q.z += n; p++; if (++q.t >= 8) { if (g(fp, &q)) goto error; p = w; }} }} + { p->x = cp; p->r = ndig; q.z += ndig; p++; if (++q.t >= 8) { if (g(fp, &q)) goto error; p = w; }} + } else { + { p->x = cp; p->r = expt; q.z += expt; p++; if (++q.t >= 8) { if (g(fp, &q)) goto error; p = w; }} + cp += expt; + { p->x = ("."); p->r = 1; q.z += 1; p++; if (++q.t >= 8) { if (g(fp, &q)) goto error; p = w; }} + { p->x = cp; p->r = (ndig-expt); q.z += (ndig-expt); p++; if (++q.t >= 8) { if (g(fp, &q)) goto error; p = w; }} + } + } + } + } + + error: +} diff --git a/gcc/testsuite/gcc.c-torture/compile/951004-1.c b/gcc/testsuite/gcc.c-torture/compile/951004-1.c new file mode 100755 index 0000000..1ca6081 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/951004-1.c @@ -0,0 +1,23 @@ +typedef struct +{ + short v, h; +} S; + +S a; + +f (S pnt) +{ + S mpnt, mtp; + + (&pnt)->v -= 1; + mpnt = pnt; + mtp = a; + if (mtp.v != mpnt.v) + { + S tpnt; + + tpnt = mtp; + mtp = mpnt; + mpnt = tpnt; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/951106-1.c b/gcc/testsuite/gcc.c-torture/compile/951106-1.c new file mode 100755 index 0000000..09cba20 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/951106-1.c @@ -0,0 +1,4 @@ +f (double a, double b) +{ + g (a, 0, b); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/951116-1.c b/gcc/testsuite/gcc.c-torture/compile/951116-1.c new file mode 100755 index 0000000..100d690 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/951116-1.c @@ -0,0 +1,9 @@ +f () +{ + long long i; + int j; + long long k = i = j; + + int inner () {return j + i;} + return k; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/951128-1.c b/gcc/testsuite/gcc.c-torture/compile/951128-1.c new file mode 100755 index 0000000..5e4dc70 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/951128-1.c @@ -0,0 +1,5 @@ +char a[]; +f (const int i) +{ + a[i] = 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/951220-1.c b/gcc/testsuite/gcc.c-torture/compile/951220-1.c new file mode 100755 index 0000000..33e98f6 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/951220-1.c @@ -0,0 +1,4 @@ +f (char *x) +{ + return (*x & 2) || (*x & 3); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/951222-1.c b/gcc/testsuite/gcc.c-torture/compile/951222-1.c new file mode 100755 index 0000000..b8246f5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/951222-1.c @@ -0,0 +1,15 @@ +extern long long foo (); + +long long +sub1 () +{ + char junk[10000]; + register long long a, b, c; + + b = foo (); + + setjmp (); + a = foo (); + c = a - b; + return c; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/960106-1.c b/gcc/testsuite/gcc.c-torture/compile/960106-1.c new file mode 100755 index 0000000..c8228aa --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/960106-1.c @@ -0,0 +1,4 @@ +f (a) +{ + return (a & 1) && !(a & 2 & 4); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/960130-1.c b/gcc/testsuite/gcc.c-torture/compile/960130-1.c new file mode 100755 index 0000000..ed8dab4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/960130-1.c @@ -0,0 +1,8 @@ +int a[1]; + +int +main() +{ + extern int a[]; + return *a; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/960201-1.c b/gcc/testsuite/gcc.c-torture/compile/960201-1.c new file mode 100755 index 0000000..adc4623 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/960201-1.c @@ -0,0 +1,5 @@ +union foo +{ + char a; + int x[2]; +} __attribute__ ((transparent_union)); diff --git a/gcc/testsuite/gcc.c-torture/compile/960218-1.c b/gcc/testsuite/gcc.c-torture/compile/960218-1.c new file mode 100755 index 0000000..46fbf77 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/960218-1.c @@ -0,0 +1,2 @@ +#define X(x) x +int main() { return X(0/* *//* */); } diff --git a/gcc/testsuite/gcc.c-torture/compile/960220-1.c b/gcc/testsuite/gcc.c-torture/compile/960220-1.c new file mode 100755 index 0000000..766a066 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/960220-1.c @@ -0,0 +1,6 @@ +f () +{ + unsigned long long int a = 0, b; + while (b > a) + ; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/960221-1.c b/gcc/testsuite/gcc.c-torture/compile/960221-1.c new file mode 100755 index 0000000..0e02496 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/960221-1.c @@ -0,0 +1,11 @@ +struct s1 { int f1; }; + +struct s2 { + struct s1 a; + int f2; +}; + +foo (struct s2 *ptr) +{ + *ptr = (struct s2) {{}, 0}; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/960319-1.c b/gcc/testsuite/gcc.c-torture/compile/960319-1.c new file mode 100755 index 0000000..f3d95ab --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/960319-1.c @@ -0,0 +1,10 @@ +static void +f() +{ + long long a[2]; + int i; + if (g()) + if (h()) + ; + *a |= (long long)i << 65 ; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/960514-1.c b/gcc/testsuite/gcc.c-torture/compile/960514-1.c new file mode 100755 index 0000000..1d38cfd --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/960514-1.c @@ -0,0 +1,12 @@ +struct s { + unsigned long long t[5]; +}; + +void +f (struct s *d, unsigned long long *l) +{ + int i; + + for (i = 0; i < 5; i++) + d->t[i] += l[i]; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/960704-1.c b/gcc/testsuite/gcc.c-torture/compile/960704-1.c new file mode 100755 index 0000000..5a9d35c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/960704-1.c @@ -0,0 +1,10 @@ +struct A { + double d; +}; + +struct A f (); + +main () +{ + struct A a = f(); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/960829-1.c b/gcc/testsuite/gcc.c-torture/compile/960829-1.c new file mode 100755 index 0000000..8c6163d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/960829-1.c @@ -0,0 +1,4 @@ +f () +{ + g (0, 0.0, 0.0, 0.0, 0.0); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/961004-1.c b/gcc/testsuite/gcc.c-torture/compile/961004-1.c new file mode 100755 index 0000000..6407b62 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/961004-1.c @@ -0,0 +1,37 @@ +void +f1 (o1, o2, o3, i, j, k) + long long *o1, *o2, *o3; + int i, j, k; +{ + while (--i) + o1[i] = o2[j >>= 1] + o3[k >>= 1]; +} + +void +f2 (o1, o2, o3, i, j, k) + long long *o1, *o2, *o3; + int i, j, k; +{ + while (--i) + o1[i] = o2[j >>= 1] - o3[k >>= 1]; +} + +void +f3 (o1, o2, o3, i, j, k) + long long *o1, *o3; + unsigned *o2; + int i, j, k; +{ + while (--i) + o1[i] = o2[j >>= 1] + o3[k >>= 1]; +} + +void +f4 (o1, o2, o3, i, j, k) + long long *o1, *o2; + unsigned *o3; + int i, j, k; +{ + while (--i) + o1[i] = o2[j >>= 1] - o3[k >>= 1]; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/961010-1.c b/gcc/testsuite/gcc.c-torture/compile/961010-1.c new file mode 100755 index 0000000..d6145bc --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/961010-1.c @@ -0,0 +1 @@ +double f (double x) { return x == 0 ? x : 0.0; } diff --git a/gcc/testsuite/gcc.c-torture/compile/961019-1.c b/gcc/testsuite/gcc.c-torture/compile/961019-1.c new file mode 100755 index 0000000..0ea6ec6 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/961019-1.c @@ -0,0 +1,11 @@ +char _hex_value[256]; + +void +hex_init () +{ + int i; + for (i = 0; i < 256; i++) + _hex_value[i] = 99; + for (i = 0; i < 10; i++) + _hex_value['0' + i] = i; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/961031-1.c b/gcc/testsuite/gcc.c-torture/compile/961031-1.c new file mode 100755 index 0000000..ea8718f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/961031-1.c @@ -0,0 +1,16 @@ +struct s { + double d; +} sd; + +struct s g () __attribute__ ((const)); + +struct s +g () +{ + return sd; +} + +f () +{ + g (); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/961126-1.c b/gcc/testsuite/gcc.c-torture/compile/961126-1.c new file mode 100755 index 0000000..f3b6af5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/961126-1.c @@ -0,0 +1,107 @@ +int *p; + +main() +{ + int i = sub (); + + i = -i; + if (*p != i) + goto quit; + i = -i; + if (*p != i) + goto quit; + i = -i; + if (*p != i) + goto quit; + i = -i; + if (*p != i) + goto quit; + i = -i; + if (*p != i) + goto quit; + i = -i; + if (*p != i) + goto quit; + i = -i; + if (*p != i) + goto quit; + i = -i; + if (*p != i) + goto quit; + i = -i; + if (*p != i) + goto quit; + i = -i; + if (*p != i) + goto quit; + i = -i; + if (*p != i) + goto quit; + i = -i; + if (*p != i) + goto quit; + i = -i; + if (*p != i) + goto quit; + i = -i; + if (*p != i) + goto quit; + i = -i; + if (*p != i) + goto quit; + i = -i; + if (*p != i) + goto quit; + i = -i; + if (*p != i) + goto quit; + i = -i; + if (*p != i) + goto quit; + i = -i; + if (*p != i) + goto quit; + i = -i; + if (*p != i) + goto quit; + i = -i; + if (*p != i) + goto quit; + i = -i; + if (*p != i) + goto quit; + i = -i; + if (*p != i) + goto quit; + i = -i; + if (*p != i) + goto quit; + i = -i; + if (*p != i) + goto quit; + i = -i; + if (*p != i) + goto quit; + i = -i; + if (*p != i) + goto quit; + i = -i; + if (*p != i) + goto quit; + i = -i; + if (*p != i) + goto quit; + i = -i; + if (*p != i) + goto quit; + i = -i; + if (*p != i) + goto quit; + i = -i; + if (*p != i) + goto quit; + + i = -i; +quit: + sub2 (i); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/961203-1.c b/gcc/testsuite/gcc.c-torture/compile/961203-1.c new file mode 100755 index 0000000..0f066ac --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/961203-1.c @@ -0,0 +1,14 @@ +struct s { + char a[0x32100000]; + int x:30, y:30; +}; + +int +main () +{ + struct s* p; + + p = (struct s*) 0; + if (p->x == p->y) + exit (1); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/961203-1.x b/gcc/testsuite/gcc.c-torture/compile/961203-1.x new file mode 100755 index 0000000..dad1a21 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/961203-1.x @@ -0,0 +1,7 @@ +# This doesn't work on any host with 32 bit int or smaller. + +# Because this test tends to consume lots of system resources and doesn't +# currently work, don't actually run it. Just report a failure. +setup_xfail "*-*-*" +fail "gcc.c-torture/compile/961203-1.c" +return 1 ;# `1' says we handled the testcase ourselves diff --git a/gcc/testsuite/gcc.c-torture/compile/970206-1.c b/gcc/testsuite/gcc.c-torture/compile/970206-1.c new file mode 100755 index 0000000..95196cd --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/970206-1.c @@ -0,0 +1,13 @@ +struct Rect +{ + int iA; + int iB; + int iC; + int iD; +}; + +void +f (int * const this, struct Rect arect) +{ + g (*this, arect); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/970214-1.c b/gcc/testsuite/gcc.c-torture/compile/970214-1.c new file mode 100755 index 0000000..508ea9e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/970214-1.c @@ -0,0 +1,3 @@ +#include <stddef.h> +#define L 264 +wchar_t c = L'X'; diff --git a/gcc/testsuite/gcc.c-torture/compile/980329-1.c b/gcc/testsuite/gcc.c-torture/compile/980329-1.c new file mode 100755 index 0000000..d11b49b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/980329-1.c @@ -0,0 +1,72 @@ +typedef unsigned long int size_t; +struct re_pattern_buffer + { + unsigned char *buffer; + unsigned long int used; + }; +struct re_registers + { + int *start; + }; + +static const char **regstart, **regend; +static const char **old_regend; + +static int +re_match_2_internal (struct re_pattern_buffer *bufp, + struct re_registers *regs) +{ + unsigned char *p = bufp->buffer; + unsigned char *pend = p + bufp->used; + + for (;;) + { + int highest_active_reg = 1; + if (bufp) + { + int i; + for (i = 1;; i++) + regs->start[i] = 0; + } + + switch ((unsigned int) *p++) + { + case 1: + { + unsigned char r = *p; + if (r) + highest_active_reg = r; + } + if (p + 2 == pend) + { + char is_a_jump_n = 0; + int mcnt = 0; + unsigned char *p1; + + p1 = p + 2; + switch (*p1++) + { + case 2: + is_a_jump_n = 1; + case 1: + do { do { mcnt = *p1; } while (0); p1 += 2; } while (0); + if (is_a_jump_n) + p1 = 0; + } + + if (mcnt && *p1 == 0) + { + unsigned r; + for (r = 0; r < (unsigned) *p + (unsigned) *(p + 1); r++) + { + if (regend[0] >= regstart[r]) + regend[r] = old_regend[r]; + } + do { while (0 < highest_active_reg + 1) { } } while (0); + } + } + } + } + + return -1; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/980408-1.c b/gcc/testsuite/gcc.c-torture/compile/980408-1.c new file mode 100755 index 0000000..09bf430 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/980408-1.c @@ -0,0 +1,129 @@ +typedef struct _RunlengthPacket +{ + unsigned short + red, + green, + blue, + length; + unsigned short + index; +} RunlengthPacket; +typedef struct _Image +{ + int + status, + temporary; + char + filename[1664 ]; + long int + filesize; + int + pipe; + char + magick[1664 ], + *comments, + *label, + *text; + unsigned int + matte; + unsigned int + columns, + rows, + depth; + unsigned int + scene, + number_scenes; + char + *montage, + *directory; + unsigned int + colors; + double + gamma; + float + x_resolution, + y_resolution; + unsigned int + mean_error_per_pixel; + double + normalized_mean_error, + normalized_maximum_error; + unsigned long + total_colors; + char + *signature; + unsigned int + packets, + runlength, + packet_size; + unsigned char + *packed_pixels; + long int + magick_time; + char + magick_filename[1664 ]; + unsigned int + magick_columns, + magick_rows; + char + *geometry, + *page; + unsigned int + dispose, + delay, + iterations; + unsigned int + orphan; + struct _Image + *previous, + *list, + *next; +} Image; + Image *MinifyImage(Image *image) +{ + Image + *minified_image; + register RunlengthPacket + *q, + *s, + *s0, + *s1, + *s2, + *s3; + register unsigned int + x; + unsigned int + blue, + green, + red; + unsigned long + total_matte, + total_blue, + total_green, + total_red; + unsigned short + index; + for (x=0; x < (image->columns-1); x+=2) + { + total_red=0; + total_green=0; + total_blue=0; + total_matte=0; + s=s0; + total_red+=( 3 )*(s->red); total_green+=( 3 )*(s->green); total_blue+=( 3 )*(s->blue); total_matte+=( 3 )*(s->index); s++; ; total_red+=( 7 )*(s->red); total_green+=( 7 )*(s->green); total_blue+=( 7 )*(s->blue); total_matte+=( 7 )*(s->index); s++; ; total_red+=( 7 )*(s->red); total_green+=( 7 )*(s->green); total_blue+=( 7 )*(s->blue); total_matte+=( 7 )*(s->index); s++; ; total_red+=( 3 )*(s->red); total_green+=( 3 )*(s->green); total_blue+=( 3 )*(s->blue); total_matte+=( 3 )*(s->index); s++; ; + s=s1; + total_red+=( 7 )*(s->red); total_green+=( 7 )*(s->green); total_blue+=( 7 )*(s->blue); total_matte+=( 7 )*(s->index); s++; ; total_red+=( 15 )*(s->red); total_green+=( 15 )*(s->green); total_blue+=( 15 )*(s->blue); total_matte+=( 15 )*(s->index); s++; ; total_red+=( 15 )*(s->red); total_green+=( 15 )*(s->green); total_blue+=( 15 )*(s->blue); total_matte+=( 15 )*(s->index); s++; ; total_red+=( 7 )*(s->red); total_green+=( 7 )*(s->green); total_blue+=( 7 )*(s->blue); total_matte+=( 7 )*(s->index); s++; ; + s=s2; + total_red+=( 7 )*(s->red); total_green+=( 7 )*(s->green); total_blue+=( 7 )*(s->blue); total_matte+=( 7 )*(s->index); s++; ; total_red+=( 15 )*(s->red); total_green+=( 15 )*(s->green); total_blue+=( 15 )*(s->blue); total_matte+=( 15 )*(s->index); s++; ; total_red+=( 15 )*(s->red); total_green+=( 15 )*(s->green); total_blue+=( 15 )*(s->blue); total_matte+=( 15 )*(s->index); s++; ; total_red+=( 7 )*(s->red); total_green+=( 7 )*(s->green); total_blue+=( 7 )*(s->blue); total_matte+=( 7 )*(s->index); s++; ; + s=s3; + total_red+=( 3 )*(s->red); total_green+=( 3 )*(s->green); total_blue+=( 3 )*(s->blue); total_matte+=( 3 )*(s->index); s++; ; total_red+=( 7 )*(s->red); total_green+=( 7 )*(s->green); total_blue+=( 7 )*(s->blue); total_matte+=( 7 )*(s->index); s++; ; total_red+=( 7 )*(s->red); total_green+=( 7 )*(s->green); total_blue+=( 7 )*(s->blue); total_matte+=( 7 )*(s->index); s++; ; total_red+=( 3 )*(s->red); total_green+=( 3 )*(s->green); total_blue+=( 3 )*(s->blue); total_matte+=( 3 )*(s->index); s++; ; + red=(unsigned short) ((total_red+63) >> 7); + green=(unsigned short) ((total_green+63) >> 7); + blue=(unsigned short) ((total_blue+63) >> 7); + index=(unsigned short) ((total_matte+63) >> 7); + if ((red == q->red) && (green == q->green) && (blue == q->blue) && + (index == q->index) && ((int) q->length < 65535L )) + q->length++; + } + return(minified_image); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/980504-1.c b/gcc/testsuite/gcc.c-torture/compile/980504-1.c new file mode 100755 index 0000000..7b757cc --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/980504-1.c @@ -0,0 +1,28 @@ +typedef struct _geom_elem { + double coeffs[6]; +} pGeomDefRec, *pGeomDefPtr; +typedef struct _mpgeombanddef { + int yOut; + int in_width; +} mpGeometryBandRec, *mpGeometryBandPtr; +typedef void *pointer; +typedef unsigned char CARD8; +typedef CARD8 BytePixel; +void BiGL_B (OUTP,srcimg,width,sline,pedpvt,pvtband) pointer OUTP; +pointer *srcimg; +register int width; +int sline; +pGeomDefPtr pedpvt; mpGeometryBandPtr pvtband; +{ + register float s, t, st; + register int isrcline,isrcpix; + register int srcwidth = pvtband->in_width - 1; + register BytePixel val; + register BytePixel *ptrIn, *ptrJn; + register double a = pedpvt->coeffs[0]; + register double c = pedpvt->coeffs[2]; + register double srcpix = a * ((double)(0.0000)) + pedpvt->coeffs[1] * (pvtband->yOut + ((double)(0.0000)) ) + pedpvt->coeffs[4]; + register double srcline = c * ((double)(0.0000)) + pedpvt->coeffs[3] * (pvtband->yOut + ((double)(0.0000)) ) + pedpvt->coeffs[5]; + if ( (isrcpix >= 0) && (isrcpix < srcwidth) ) + val = ptrIn[isrcpix] * ((float)1. - s - t + st) + ptrIn[isrcpix+1] * (s - st) + ptrJn[isrcpix] * (t - st) + ptrJn[isrcpix+1] * (st) + (float)0.5 ; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/980506-1.c b/gcc/testsuite/gcc.c-torture/compile/980506-1.c new file mode 100755 index 0000000..6ef7796 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/980506-1.c @@ -0,0 +1,63 @@ +unsigned char TIFFFax2DMode[20][256]; +unsigned char TIFFFax2DNextState[20][256]; +unsigned char TIFFFaxUncompAction[20][256]; +unsigned char TIFFFaxUncompNextState[20][256]; +unsigned char TIFFFax1DAction[230][256]; +unsigned char TIFFFax1DNextState[230][256]; + +typedef struct tableentry { + unsigned short length; + unsigned short code; + short runlen; +} tableentry; + +extern tableentry TIFFFaxWhiteCodes[]; +extern tableentry TIFFFaxBlackCodes[]; + +static short sp_data, sp_bit; + +static unsigned char +fetchByte (inbuf) + +unsigned char **inbuf; + +{ + unsigned char byte = **inbuf; + (*inbuf)++; + return (byte); +} + +static int +decode_white_run (inbuf) + +unsigned char **inbuf; + +{ + short state = sp_bit; + short action; + int runlen = 0; + + for (;;) + { + if (sp_bit == 0) + { + nextbyte: + sp_data = fetchByte (inbuf); + } + + action = TIFFFax1DAction[state][sp_data]; + state = TIFFFax1DNextState[state][sp_data]; + if (action == 0 ) + goto nextbyte; + if (action == 1 ) + return (-1 ); + if (action == 210 ) + return (-3 ); + sp_bit = state; + action = (TIFFFaxWhiteCodes[ action - 2 ].runlen) ; + runlen += action; + if (action < 64) + return (runlen); + } +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/980506-2.c b/gcc/testsuite/gcc.c-torture/compile/980506-2.c new file mode 100755 index 0000000..6f6fe19 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/980506-2.c @@ -0,0 +1,89 @@ +/* + * inspired by glibc-2.0.6/sysdeps/libm-ieee754/s_nextafterf.c + * + * gcc -O2 -S -DOP=+ gives faddp %st(1),%st + * gcc -O2 -S -DOP=* gives fmulp %st(1),%st + * gcc -O2 -S -DOP=- gives fsubrp %st(1),%st + * gcc -O2 -S -DOP=/ gives fdivrp %st(1),%st + */ + +#ifndef OP +#define OP * +#endif + +typedef int int32_t __attribute__ ((__mode__ ( __SI__ ))) ; +typedef unsigned int u_int32_t __attribute__ ((__mode__ ( __SI__ ))) ; + +typedef union +{ + float value; + u_int32_t word; +} ieee_float_shape_type; + +float __nextafterf(float x, float y) +{ + int32_t hx,hy,ix,iy; + + { + ieee_float_shape_type gf_u; + gf_u.value = x; + hx = gf_u.word; + } + { + ieee_float_shape_type gf_u; + gf_u.value = y; + hy = gf_u.word; + } + ix = hx&0x7fffffff; + iy = hy&0x7fffffff; + + if ( ix > 0x7f800000 || iy > 0x7f800000 ) + return x+y; + if (x == y) return x; + if (ix == 0) + { + { + ieee_float_shape_type sf_u; + sf_u.word = (hy&0x80000000) | 1; + x = sf_u.value; + } + y = x*x; + if (y == x) return y; else return x; + } + if (hx >= 0) + { + if (hx > hy) + hx -= 1; + else + hx += 1; + } + else + { + if (hy >= 0 || hx > hy) + hx -= 1; + else + hx += 1; + } + hy = hx & 0x7f800000; + if (hy >= 0x7f800000) + return x+x; + if (hy < 0x00800000) + { + y = x OP x; + if (y != x) + { + ieee_float_shape_type sf_u; + sf_u.word = hx; + y = sf_u.value; + return y; + } + } + { + ieee_float_shape_type sf_u; + sf_u.word = hx; + x = sf_u.value; + } + return x; +} + + diff --git a/gcc/testsuite/gcc.c-torture/compile/980511-1.c b/gcc/testsuite/gcc.c-torture/compile/980511-1.c new file mode 100755 index 0000000..f1bac0c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/980511-1.c @@ -0,0 +1,20 @@ +typedef unsigned int __kernel_dev_t; +typedef __kernel_dev_t dev_t; +struct ustat { +}; +typedef unsigned int kdev_t; +static inline kdev_t to_kdev_t(int dev) +{ + int major, minor; + major = (dev >> 8); + minor = (dev & 0xff); + return ((( major ) << 22 ) | ( minor )) ; +} +struct super_block { +}; +struct super_block * get_super (kdev_t dev); +int sys_ustat(dev_t dev, struct ustat * ubuf) +{ + struct super_block *s; + s = get_super(to_kdev_t(dev)); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/980701-1.c b/gcc/testsuite/gcc.c-torture/compile/980701-1.c new file mode 100755 index 0000000..82dd16d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/980701-1.c @@ -0,0 +1,9 @@ + +short +func(void) +{ + unsigned char x, y; + + return y | x << 8; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/980706-1.c b/gcc/testsuite/gcc.c-torture/compile/980706-1.c new file mode 100755 index 0000000..214f36d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/980706-1.c @@ -0,0 +1,10 @@ +void g(long long); + +long long f(long long v1, long long v2, long long v3, long long v4) +{ + g(v1); + g(v2); + g(v3); + g(v4); + return v1 && v2; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/980726-1.c b/gcc/testsuite/gcc.c-torture/compile/980726-1.c new file mode 100755 index 0000000..3d4daa2 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/980726-1.c @@ -0,0 +1,10 @@ +static __inline__ unsigned char BCD(unsigned char binval) +{ + if (binval > 99) return 0x99; + return (((binval/10) << 4) | (binval%10)); +} + +void int1a(unsigned char i) +{ + (*((unsigned char *)1)) = BCD(i); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/980729-1.c b/gcc/testsuite/gcc.c-torture/compile/980729-1.c new file mode 100755 index 0000000..973372b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/980729-1.c @@ -0,0 +1,14 @@ +static int +regex_compile () +{ + int c, c1; + char str[6 + 1]; + c1 = 0; + for (;;) + { + do { } while (0) ; + if (c1 == 6 ) + break; + str[c1++] = c; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/980816-1.c b/gcc/testsuite/gcc.c-torture/compile/980816-1.c new file mode 100755 index 0000000..c56b6c9 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/980816-1.c @@ -0,0 +1,51 @@ +typedef unsigned int size_t; +typedef void *XtPointer; + +typedef struct _WidgetRec *Widget; +typedef struct _WidgetClassRec *WidgetClass; + +extern WidgetClass commandWidgetClass; + +typedef void (*XtCallbackProc)( + Widget , + XtPointer , + XtPointer +); + +extern const char XtStrings[]; + + +typedef struct +{ + char *Name, + *Label; + XtCallbackProc Callback; + XtPointer ClientData; + Widget W; +} DialogButtonType, *DialogButtonTypePtr; + + +Widget AddButtons(Widget Parent, Widget Top, + DialogButtonTypePtr Buttons, size_t Count) +{ + int i; + + for (i = 0; i < Count; i++) + { + if (!Buttons[i].Label) + continue; + Buttons[i].W = XtVaCreateManagedWidget(Buttons[i].Name, + commandWidgetClass, + Parent, + ((char*)&XtStrings[429]) , Buttons[i].Label, + "fromHoriz" , i ? Buttons[i-1].W : ((void *)0) , + "fromVert" , Top, + "resizable" , 1 , + ((void *)0) ); + + XtAddCallback(((char*)&XtStrings[136]), + Buttons[i].Callback, Buttons[i].ClientData); + } + return(Buttons[Count-1].W); +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/980821-1.c b/gcc/testsuite/gcc.c-torture/compile/980821-1.c new file mode 100755 index 0000000..9eb1ac4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/980821-1.c @@ -0,0 +1,15 @@ +typedef int __int32_t; +int __kernel_rem_pio2(int prec) +{ + __int32_t i, jz; + double fw, fq[20]; + switch(prec) { + case 2: + fw = 0.0; + case 3: + for (i=jz;i>0;i--) { + fw = fq[i-1] +fq[i]; + fq[i-1] = fw; + } + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/980825-1.c b/gcc/testsuite/gcc.c-torture/compile/980825-1.c new file mode 100755 index 0000000..34e35bf --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/980825-1.c @@ -0,0 +1,30 @@ +typedef enum { FALSE, TRUE } boolean; +enum _errorTypes { FATAL = 1, WARNING = 2, PERROR = 4 }; +typedef struct _optionValues { + struct _include { + boolean classNames; + boolean defines; + boolean enumerators; + } include; +} optionValues; +extern optionValues Option; +static void applyTagInclusionList( list ) + const char *const list; +{ + boolean mode = TRUE; + const char *p; + for (p = list ; *p != '\0' ; ++p) + switch (*p) + { + case '=': + clearTagList(); + mode = TRUE; + break; + case '+': mode = TRUE; break; + case '-': mode = FALSE; break; + case 'c': Option.include.classNames = mode; break; + case 'd': Option.include.defines = mode; break; + case 'e': Option.include.enumerators = mode; break; + default: error(FATAL, "-i: Invalid tag option '%c'", *p); break; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/981001-1.c b/gcc/testsuite/gcc.c-torture/compile/981001-1.c new file mode 100755 index 0000000..d7cf0dc --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/981001-1.c @@ -0,0 +1,18 @@ +unsigned short code = 0x0000; +unsigned short low = 0x4000; +unsigned short high = 0xb000; + +int main (void) +{ + if ( + (high & 0x8000) != (low & 0x8000) + && ( low & 0x4000) == 0x4000 + && (high & 0x4000) == 0 + ) + { + code ^= 0x4000; + low |= 0x4000; + } + + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/981001-2.c b/gcc/testsuite/gcc.c-torture/compile/981001-2.c new file mode 100755 index 0000000..9ade1d9 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/981001-2.c @@ -0,0 +1,12 @@ +#define weak_alias(func, aliasname) \ + extern __typeof (func) aliasname __attribute__ ((weak, alias (#func))); + +#define add3(d, m, c) ((d) + (m) + (c)) + +int +__add3(int d, int m, int c) +{ + return d + m + c; +} + +weak_alias (__add3, add3) diff --git a/gcc/testsuite/gcc.c-torture/compile/981001-3.c b/gcc/testsuite/gcc.c-torture/compile/981001-3.c new file mode 100755 index 0000000..5f64587 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/981001-3.c @@ -0,0 +1,14 @@ +#define P(a, b) P1(a,b) +#define P1(a,b) a##b + +#define FLT_MIN_EXP (-125) +#define DBL_MIN_EXP (-1021) + +#define MIN_EXP P(FLT,_MIN_EXP) + +#define FLT FLT +int f1 = MIN_EXP; + +#undef FLT +#define FLT DBL +int f2 = MIN_EXP; diff --git a/gcc/testsuite/gcc.c-torture/compile/981001-4.c b/gcc/testsuite/gcc.c-torture/compile/981001-4.c new file mode 100755 index 0000000..dd3df9c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/981001-4.c @@ -0,0 +1,14 @@ +#define P(a,b) P1(a,b) +#define P1(a,b) a##b + +#define ONCE(x, y) (x ?: (x = y())) +#define PREFIX + +extern int P(PREFIX, init) (void); + +int +fun(void) +{ + static int memo; + return ONCE(memo, P(PREFIX, init)); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/981007-1.c b/gcc/testsuite/gcc.c-torture/compile/981007-1.c new file mode 100755 index 0000000..d41400b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/981007-1.c @@ -0,0 +1,21 @@ +extern double fabs (double); +extern double sqrt (double); + +typedef struct complexm { + double re,im; +} complex; + +static complex +setCom (double r, double i) +{ + complex ct; + ct.re=fabs(r)<1E-300?0.0:r; + ct.im=fabs(i)<1E-300?0.0:i; + return ct; +} + +static complex +csqrt_crash (double x) +{ + return (x>=0) ? setCom(sqrt(x),0) : setCom(0,sqrt(-x)); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/981022-1.c b/gcc/testsuite/gcc.c-torture/compile/981022-1.c new file mode 100755 index 0000000..6256673 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/981022-1.c @@ -0,0 +1,9 @@ +/* This tests a combination of two gcc extensions. Omitting the middle + operand of ?: and using ?: as an lvalue. */ +int x, y; + +int main () +{ + (x ?: y) = 0; + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/981022-1.x b/gcc/testsuite/gcc.c-torture/compile/981022-1.x new file mode 100755 index 0000000..f41cdc2 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/981022-1.x @@ -0,0 +1,2 @@ +set torture_compile_xfail "*-*-*" +return 0 diff --git a/gcc/testsuite/gcc.c-torture/compile/981107-1.c b/gcc/testsuite/gcc.c-torture/compile/981107-1.c new file mode 100755 index 0000000..987ec18 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/981107-1.c @@ -0,0 +1,9 @@ +unsigned long seed(void) +{ + unsigned long u; + + call(); + + u = 26107 * (unsigned long)&u; + return u; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/981211-1.c b/gcc/testsuite/gcc.c-torture/compile/981211-1.c new file mode 100755 index 0000000..92c9cfb --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/981211-1.c @@ -0,0 +1,43 @@ +/* Basic tests of the #assert preprocessor extension. */ + +#define fail int fail + +#assert abc (def) +#assert abc (ghi) +#assert abc (jkl) +#assert space ( s p a c e ) + +/* Basic: */ +#if !#abc (def) || !#abc (ghi) || !#abc (jkl) +fail +#endif + +/* any answer for #abc */ +#if !#abc +fail +#endif + +/* internal whitespace is collapsed, + external whitespace is deleted */ +#if !#space (s p a c e) || !#space ( s p a c e ) || #space (space) +fail +#endif + +/* removing assertions */ +#unassert abc (jkl) +#if !#abc || !#abc (def) || !#abc (ghi) || #abc (jkl) +fail +#endif + +#unassert abc +#if #abc || #abc (def) || #abc (ghi) || #abc (jkl) +fail +#endif + +int gobble + +/* make sure it can succeed too. + also check space before open paren isn't significant */ +#if #space(s p a c e) +; +#endif diff --git a/gcc/testsuite/gcc.c-torture/compile/981223-1.c b/gcc/testsuite/gcc.c-torture/compile/981223-1.c new file mode 100755 index 0000000..d207ff1 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/981223-1.c @@ -0,0 +1,8 @@ +__complex__ float +func (__complex__ float x) +{ + if (__real__ x == 0.0) + return 1.0; + else + return 0.0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/990107-1.c b/gcc/testsuite/gcc.c-torture/compile/990107-1.c new file mode 100755 index 0000000..a123ce9 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/990107-1.c @@ -0,0 +1,7 @@ +static int +java_double_finite (d) + double d; +{ + long long *ip = (long long *) &d; + return (*ip & 0x7ff0000000000000LL ) != 0x7ff0000000000000LL ; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/Makefile.in b/gcc/testsuite/gcc.c-torture/compile/Makefile.in new file mode 100755 index 0000000..e6209db --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/Makefile.in @@ -0,0 +1,12 @@ +#### host, target, and site specific Makefile frags come in here. + +srcdir = . + +# Nothing to do... +all: + +clean: + -rm -f *.o *.diff *~ *.bad core *.x + +distclean: clean + -rm -f Makefile config.status diff --git a/gcc/testsuite/gcc.c-torture/compile/calls.c b/gcc/testsuite/gcc.c-torture/compile/calls.c new file mode 100755 index 0000000..1582c0e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/calls.c @@ -0,0 +1,22 @@ +typedef void *(*T)(void); +f1 () +{ + ((T) 0)(); +} +f2 () +{ + ((T) 1000)(); +} +f3 () +{ + ((T) 10000000)(); +} +f4 (r) +{ + ((T) r)(); +} +f5 () +{ + int (*r)() = f3; + ((T) r)(); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/cmpdi-1.c b/gcc/testsuite/gcc.c-torture/compile/cmpdi-1.c new file mode 100755 index 0000000..9e1b659 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/cmpdi-1.c @@ -0,0 +1,15 @@ +f (long long d) +{ + int i = 0; + if (d == 1) + i = 1; + return i; +} + +g (long long d) +{ + int i = 0; + if (d <= 0) + i = 1; + return i; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/combine-hang.c b/gcc/testsuite/gcc.c-torture/compile/combine-hang.c new file mode 100755 index 0000000..7cc57af --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/combine-hang.c @@ -0,0 +1,26 @@ +typedef union +{ + double value; + struct + { + unsigned long msw; + unsigned long lsw; + } parts; +} ieee_double_shape_type; + +double f (int iy) +{ + double z, t; + ieee_double_shape_type u, v; + + if (iy == 1) + return 0; + + u.parts.msw = iy; + u.parts.lsw = 0; + z = u.value; + v.parts.msw = iy; + v.parts.lsw = 0; + t = v.value; + return 1.0+z+t+t; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/compile.exp b/gcc/testsuite/gcc.c-torture/compile/compile.exp new file mode 100755 index 0000000..f96f023 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/compile.exp @@ -0,0 +1,35 @@ +# Expect driver script for GCC Regression Tests +# Copyright (C) 1993, 1995, 1997 Free Software Foundation +# +# This file is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +# These tests come from Torbjorn Granlund's (tege@cygnus.com) +# C torture test suite, and other contributors. + +if $tracelevel then { + strace $tracelevel +} + +# load support procs +load_lib c-torture.exp + +foreach testcase [glob -nocomplain $srcdir/$subdir/*.c] { + # If we're only testing specific files and this isn't one of them, skip it. + if ![runtest_file_p $runtests $testcase] then { + continue + } + + c-torture $testcase +} diff --git a/gcc/testsuite/gcc.c-torture/compile/configure.in b/gcc/testsuite/gcc.c-torture/compile/configure.in new file mode 100755 index 0000000..e4cc69d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/configure.in @@ -0,0 +1,15 @@ +# This file is a shell script fragment that supplies the information +# necessary to tailor a template configure script into the configure +# script appropriate for this directory. For more information, check +# any existing configure script. + +srctrigger=compile.exp +srcname="DejaGnu" + +# per-host: + +# per-target: + +target_makefile_frag=../config/mt-${target_alias} + +# post-target: diff --git a/gcc/testsuite/gcc.c-torture/compile/funcptr-1.c b/gcc/testsuite/gcc.c-torture/compile/funcptr-1.c new file mode 100755 index 0000000..79687c9 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/funcptr-1.c @@ -0,0 +1,19 @@ +extern int (*gp)(const char*); + +int +g (const char* d) +{ + printf ("g"); + return 0; +} + +f () +{ + int errcnt=0; + + if (gp != g) + { + printf ("f"); + errcnt++; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/goto-1.c b/gcc/testsuite/gcc.c-torture/compile/goto-1.c new file mode 100755 index 0000000..caeed3a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/goto-1.c @@ -0,0 +1,16 @@ +f () +{ + do + { + if (0) + { + L1:; + } + else + goto L2; + L2:; + } + while (0); + + goto L1; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/init-1.c b/gcc/testsuite/gcc.c-torture/compile/init-1.c new file mode 100755 index 0000000..38db9ad --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/init-1.c @@ -0,0 +1,19 @@ +typedef struct +{ + char *key; + char *value; +} T1; + +typedef struct +{ + long type; + char *value; +} T3; + +T1 a[] = +{ + { + "", + ((char *)&((T3) {1, (char *) 1})) + } +}; diff --git a/gcc/testsuite/gcc.c-torture/compile/init-2.c b/gcc/testsuite/gcc.c-torture/compile/init-2.c new file mode 100755 index 0000000..63a7f58 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/init-2.c @@ -0,0 +1,4 @@ +struct +{ + int e1, e2; +} v = { e2: 0 }; diff --git a/gcc/testsuite/gcc.c-torture/compile/labels-1.c b/gcc/testsuite/gcc.c-torture/compile/labels-1.c new file mode 100755 index 0000000..fae6ab8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/labels-1.c @@ -0,0 +1,13 @@ +#ifndef NO_LABEL_VALUES +f () +{ + void *x = &&L2; + if (&&L3 - &&L1 > 1) + abort(); + L1: return 1; + L2: abort (); + L3:; +} +#else +int x; +#endif diff --git a/gcc/testsuite/gcc.c-torture/compile/packed-1.c b/gcc/testsuite/gcc.c-torture/compile/packed-1.c new file mode 100755 index 0000000..709fc3c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/packed-1.c @@ -0,0 +1,14 @@ +struct s +{ + int e; +} x; + +struct rbuf +{ + struct s *p __attribute__ ((packed)); +} *b; + +f () +{ + b->p = &x; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/widechar-1.c b/gcc/testsuite/gcc.c-torture/compile/widechar-1.c new file mode 100755 index 0000000..5d89f33 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/widechar-1.c @@ -0,0 +1 @@ +char *s = L"a" "b"; diff --git a/gcc/testsuite/gcc.c-torture/compile/zero-strct-1.c b/gcc/testsuite/gcc.c-torture/compile/zero-strct-1.c new file mode 100755 index 0000000..d3db812 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/zero-strct-1.c @@ -0,0 +1,7 @@ +typedef struct { } empty_t; + +f () +{ + empty_t i; + bar (i); +} |