diff options
Diffstat (limited to 'gcc/testsuite/gcc.c-torture')
58 files changed, 2776 insertions, 60 deletions
diff --git a/gcc/testsuite/gcc.c-torture/compile/20011119-1.c b/gcc/testsuite/gcc.c-torture/compile/20011119-1.c index 02dfcdbc0b2..2204c11c90b 100644 --- a/gcc/testsuite/gcc.c-torture/compile/20011119-1.c +++ b/gcc/testsuite/gcc.c-torture/compile/20011119-1.c @@ -1,5 +1,4 @@ -extern inline int foo (void) -{ - return 23; -} +extern inline int foo (void) { return 23; } +int xxx(void) __asm__("xxx"); +int xxx(void) { return 23; } extern int foo (void) __attribute__ ((weak, alias ("xxx"))); diff --git a/gcc/testsuite/gcc.c-torture/compile/20011119-2.c b/gcc/testsuite/gcc.c-torture/compile/20011119-2.c index 2616368a1ce..ab649b98bc7 100644 --- a/gcc/testsuite/gcc.c-torture/compile/20011119-2.c +++ b/gcc/testsuite/gcc.c-torture/compile/20011119-2.c @@ -1,13 +1,6 @@ -extern inline int foo (void) -{ - return 23; -} -int bar (void) -{ - return foo (); -} +extern inline int foo (void) { return 23; } +int bar (void) { return foo (); } extern int foo (void) __attribute__ ((weak, alias ("xxx"))); -int baz (void) -{ - return foo (); -} +int baz (void) { return foo (); } +int xxx(void) __asm__("xxx"); +int xxx(void) { return 23; } diff --git a/gcc/testsuite/gcc.c-torture/compile/20020304-1.c b/gcc/testsuite/gcc.c-torture/compile/20020304-1.c new file mode 100644 index 00000000000..3940d5ffd2e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20020304-1.c @@ -0,0 +1,777 @@ +/* In 3.0, this test case (extracted from Bigloo) crashes the compiler in + bb-reorder.c. This is a regression from 2.95, already fixed in 3.1. + + Original bug report is c/5830 by Manuel Serrano <Manuel.Serrano@inria.fr>. + */ + +typedef union scmobj { + struct pair { + union scmobj *car; + union scmobj *cdr; + } pair_t; + struct vector { + long header; + int length; + union scmobj *obj0; + } vector_t; +} *obj_t; + +extern obj_t create_vector (int); +extern obj_t make_pair (obj_t, obj_t); +extern long bgl_list_length (obj_t); +extern int BGl_equalzf3zf3zz__r4_equivalence_6_2z00 (obj_t, obj_t); +extern obj_t BGl_evcompilezd2lambdazd2zz__evcompilez00 (obj_t + BgL_formalsz00_39, + obj_t BgL_bodyz00_40, + obj_t BgL_wherez00_41, + obj_t + BgL_namedzf3zf3_42, + obj_t BgL_locz00_43); + +obj_t +BGl_evcompilezd2lambdazd2zz__evcompilez00 (obj_t BgL_formalsz00_39, + obj_t BgL_bodyz00_40, + obj_t BgL_wherez00_41, + obj_t BgL_namedzf3zf3_42, + obj_t BgL_locz00_43) +{ + if (BGl_equalzf3zf3zz__r4_equivalence_6_2z00 + (BgL_formalsz00_39, + ((obj_t) (obj_t) ((long) (((long) (0) << 2) | 2))))) { + BgL_tagzd21966zd2_943: + if ((BgL_namedzf3zf3_42 != + ((obj_t) (obj_t) ((long) (((long) (1) << 2) | 2))))) { + obj_t BgL_v1042z00_998; + { + int BgL_auxz00_4066; + BgL_auxz00_4066 = (int) (((long) 3)); + BgL_v1042z00_998 = create_vector (BgL_auxz00_4066); + } + { + obj_t BgL_arg1586z00_1000; + BgL_arg1586z00_1000 = make_pair (BgL_wherez00_41, BgL_bodyz00_40); + { + int BgL_auxz00_4070; + BgL_auxz00_4070 = (int) (((long) 2)); + ((&(((obj_t) (BgL_v1042z00_998))->vector_t.obj0))[BgL_auxz00_4070] = + BgL_arg1586z00_1000, + ((obj_t) (obj_t) ((long) (((long) (3) << 2) | 2)))); + } + } + { + int BgL_auxz00_4073; + BgL_auxz00_4073 = (int) (((long) 1)); + ((&(((obj_t) (BgL_v1042z00_998))->vector_t.obj0))[BgL_auxz00_4073] = + BgL_locz00_43, ((obj_t) (obj_t) ((long) (((long) (3) << 2) | 2)))); + } + { + obj_t BgL_auxz00_4078; + int BgL_auxz00_4076; + { + long BgL_auxz00_4079; + { + long BgL_auxz00_4080; + BgL_auxz00_4080 = bgl_list_length (BgL_formalsz00_39); + BgL_auxz00_4079 = (BgL_auxz00_4080 + ((long) 37)); + } + BgL_auxz00_4078 = + (obj_t) ((long) (((long) (BgL_auxz00_4079) << 2) | 1)); + } + BgL_auxz00_4076 = (int) (((long) 0)); + ((&(((obj_t) (BgL_v1042z00_998))->vector_t.obj0))[BgL_auxz00_4076] = + BgL_auxz00_4078, ((obj_t) (obj_t) ((long) (((long) (3) << 2) | 2)))); + } + return BgL_v1042z00_998; + } else { + obj_t BgL_v1043z00_1005; + { + int BgL_auxz00_4085; + BgL_auxz00_4085 = (int) (((long) 3)); + BgL_v1043z00_1005 = create_vector (BgL_auxz00_4085); + } + { + int BgL_auxz00_4088; + BgL_auxz00_4088 = (int) (((long) 2)); + ((&(((obj_t) (BgL_v1043z00_1005))->vector_t.obj0))[BgL_auxz00_4088] = + BgL_bodyz00_40, ((obj_t) (obj_t) ((long) (((long) (3) << 2) | 2)))); + } + { + int BgL_auxz00_4091; + BgL_auxz00_4091 = (int) (((long) 1)); + ((&(((obj_t) (BgL_v1043z00_1005))->vector_t.obj0))[BgL_auxz00_4091] = + BgL_locz00_43, ((obj_t) (obj_t) ((long) (((long) (3) << 2) | 2)))); + } + { + obj_t BgL_auxz00_4096; + int BgL_auxz00_4094; + { + long BgL_auxz00_4097; + { + long BgL_auxz00_4098; + BgL_auxz00_4098 = bgl_list_length (BgL_formalsz00_39); + BgL_auxz00_4097 = (BgL_auxz00_4098 + ((long) 42)); + } + BgL_auxz00_4096 = + (obj_t) ((long) (((long) (BgL_auxz00_4097) << 2) | 1)); + } + BgL_auxz00_4094 = (int) (((long) 0)); + ((&(((obj_t) (BgL_v1043z00_1005))->vector_t.obj0))[BgL_auxz00_4094] = + BgL_auxz00_4096, ((obj_t) (obj_t) ((long) (((long) (3) << 2) | 2)))); + } + return BgL_v1043z00_1005; + } + } else { + if (((((long) BgL_formalsz00_39) & ((1 << 2) - 1)) == 3)) { + if (BGl_equalzf3zf3zz__r4_equivalence_6_2z00 + (((((obj_t) ((long) BgL_formalsz00_39 - 3))->pair_t).cdr), + ((obj_t) (obj_t) ((long) (((long) (0) << 2) | 2))))) { + goto BgL_tagzd21966zd2_943; + } else { + obj_t BgL_cdrzd21979zd2_953; + BgL_cdrzd21979zd2_953 = + ((((obj_t) ((long) BgL_formalsz00_39 - 3))->pair_t).cdr); + if (((((long) BgL_cdrzd21979zd2_953) & ((1 << 2) - 1)) == 3)) { + if (BGl_equalzf3zf3zz__r4_equivalence_6_2z00 + (((((obj_t) ((long) BgL_cdrzd21979zd2_953 - 3))->pair_t).cdr), + ((obj_t) (obj_t) ((long) (((long) (0) << 2) | 2))))) { + goto BgL_tagzd21966zd2_943; + } else { + obj_t BgL_cdrzd21986zd2_956; + BgL_cdrzd21986zd2_956 = + ((((obj_t) ((long) BgL_cdrzd21979zd2_953 - 3))->pair_t).cdr); + if (((((long) BgL_cdrzd21986zd2_956) & ((1 << 2) - 1)) == 3)) { + if (BGl_equalzf3zf3zz__r4_equivalence_6_2z00 + (((((obj_t) ((long) BgL_cdrzd21986zd2_956 - 3))->pair_t). + cdr), + ((obj_t) (obj_t) ((long) (((long) (0) << 2) | 2))))) { + goto BgL_tagzd21966zd2_943; + } else { + obj_t BgL_cdrzd21994zd2_959; + { + obj_t BgL_auxz00_4120; + BgL_auxz00_4120 = + ((((obj_t) ((long) BgL_cdrzd21979zd2_953 - 3))->pair_t). + cdr); + BgL_cdrzd21994zd2_959 = + ((((obj_t) ((long) BgL_auxz00_4120 - 3))->pair_t).cdr); + } + if (((((long) BgL_cdrzd21994zd2_959) & ((1 << 2) - 1)) == 3)) { + if (BGl_equalzf3zf3zz__r4_equivalence_6_2z00 + (((((obj_t) ((long) BgL_cdrzd21994zd2_959 - 3))-> + pair_t).cdr), + ((obj_t) (obj_t) ((long) (((long) (0) << 2) | 2))))) { + goto BgL_tagzd21966zd2_943; + } else { + int BgL_testz00_4128; + { + obj_t BgL_auxz00_4129; + BgL_auxz00_4129 = + ((((obj_t) ((long) BgL_formalsz00_39 - 3))->pair_t). + car); + BgL_testz00_4128 = + ((((long) BgL_auxz00_4129) & ((1 << 2) - 1)) == 3); + } + if (BgL_testz00_4128) { + BgL_tagzd21971zd2_948: + if ((BgL_namedzf3zf3_42 != + ((obj_t) (obj_t) + ((long) (((long) (1) << 2) | 2))))) { + obj_t BgL_v1052z00_1026; + { + int BgL_auxz00_4134; + BgL_auxz00_4134 = (int) (((long) 3)); + BgL_v1052z00_1026 = create_vector (BgL_auxz00_4134); + } + { + obj_t BgL_arg1606z00_1028; + { + obj_t BgL_v1053z00_1029; + { + int BgL_auxz00_4137; + BgL_auxz00_4137 = (int) (((long) 3)); + BgL_v1053z00_1029 = + create_vector (BgL_auxz00_4137); + } + { + int BgL_auxz00_4140; + BgL_auxz00_4140 = (int) (((long) 2)); + ((& + (((obj_t) (BgL_v1053z00_1029))->vector_t. + obj0))[BgL_auxz00_4140] = + BgL_formalsz00_39, + ((obj_t) (obj_t) + ((long) (((long) (3) << 2) | 2)))); + } + { + int BgL_auxz00_4143; + BgL_auxz00_4143 = (int) (((long) 1)); + ((& + (((obj_t) (BgL_v1053z00_1029))->vector_t. + obj0))[BgL_auxz00_4143] = + BgL_bodyz00_40, + ((obj_t) (obj_t) + ((long) (((long) (3) << 2) | 2)))); + } + { + int BgL_auxz00_4146; + BgL_auxz00_4146 = (int) (((long) 0)); + ((& + (((obj_t) (BgL_v1053z00_1029))->vector_t. + obj0))[BgL_auxz00_4146] = + BgL_wherez00_41, + ((obj_t) (obj_t) + ((long) (((long) (3) << 2) | 2)))); + } + BgL_arg1606z00_1028 = BgL_v1053z00_1029; + } + { + int BgL_auxz00_4149; + BgL_auxz00_4149 = (int) (((long) 2)); + ((&(((obj_t) (BgL_v1052z00_1026))->vector_t.obj0)) + [BgL_auxz00_4149] = + BgL_arg1606z00_1028, + ((obj_t) (obj_t) + ((long) (((long) (3) << 2) | 2)))); + } + } + { + int BgL_auxz00_4152; + BgL_auxz00_4152 = (int) (((long) 1)); + ((&(((obj_t) (BgL_v1052z00_1026))->vector_t.obj0)) + [BgL_auxz00_4152] = + BgL_locz00_43, + ((obj_t) (obj_t) + ((long) (((long) (3) << 2) | 2)))); + } + { + obj_t BgL_auxz00_4157; + int BgL_auxz00_4155; + BgL_auxz00_4157 = + (obj_t) ((long) + (((long) (((long) 55)) << 2) | 1)); + BgL_auxz00_4155 = (int) (((long) 0)); + ((&(((obj_t) (BgL_v1052z00_1026))->vector_t.obj0)) + [BgL_auxz00_4155] = + BgL_auxz00_4157, + ((obj_t) (obj_t) + ((long) (((long) (3) << 2) | 2)))); + } + return BgL_v1052z00_1026; + } else { + obj_t BgL_v1054z00_1030; + { + int BgL_auxz00_4160; + BgL_auxz00_4160 = (int) (((long) 3)); + BgL_v1054z00_1030 = create_vector (BgL_auxz00_4160); + } + { + obj_t BgL_arg1608z00_1032; + BgL_arg1608z00_1032 = + make_pair (BgL_bodyz00_40, BgL_formalsz00_39); + { + int BgL_auxz00_4164; + BgL_auxz00_4164 = (int) (((long) 2)); + ((&(((obj_t) (BgL_v1054z00_1030))->vector_t.obj0)) + [BgL_auxz00_4164] = + BgL_arg1608z00_1032, + ((obj_t) (obj_t) + ((long) (((long) (3) << 2) | 2)))); + } + } + { + int BgL_auxz00_4167; + BgL_auxz00_4167 = (int) (((long) 1)); + ((&(((obj_t) (BgL_v1054z00_1030))->vector_t.obj0)) + [BgL_auxz00_4167] = + BgL_locz00_43, + ((obj_t) (obj_t) + ((long) (((long) (3) << 2) | 2)))); + } + { + obj_t BgL_auxz00_4172; + int BgL_auxz00_4170; + BgL_auxz00_4172 = + (obj_t) ((long) + (((long) (((long) 56)) << 2) | 1)); + BgL_auxz00_4170 = (int) (((long) 0)); + ((&(((obj_t) (BgL_v1054z00_1030))->vector_t.obj0)) + [BgL_auxz00_4170] = + BgL_auxz00_4172, + ((obj_t) (obj_t) + ((long) (((long) (3) << 2) | 2)))); + } + return BgL_v1054z00_1030; + } + } else { + int BgL_testz00_4175; + { + obj_t BgL_auxz00_4176; + { + obj_t BgL_auxz00_4177; + BgL_auxz00_4177 = + ((((obj_t) ((long) BgL_formalsz00_39 - 3))-> + pair_t).cdr); + BgL_auxz00_4176 = + ((((obj_t) ((long) BgL_auxz00_4177 - 3))->pair_t). + car); + } + BgL_testz00_4175 = + ((((long) BgL_auxz00_4176) & ((1 << 2) - 1)) == 3); + } + if (BgL_testz00_4175) { + goto BgL_tagzd21971zd2_948; + } else { + int BgL_testz00_4181; + { + obj_t BgL_auxz00_4182; + { + obj_t BgL_auxz00_4183; + { + obj_t BgL_auxz00_4184; + BgL_auxz00_4184 = + ((((obj_t) ((long) BgL_formalsz00_39 - 3))-> + pair_t).cdr); + BgL_auxz00_4183 = + ((((obj_t) ((long) BgL_auxz00_4184 - 3))-> + pair_t).cdr); + } + BgL_auxz00_4182 = + ((((obj_t) ((long) BgL_auxz00_4183 - 3))-> + pair_t).car); + } + BgL_testz00_4181 = + ((((long) BgL_auxz00_4182) & ((1 << 2) - 1)) == + 3); + } + if (BgL_testz00_4181) { + goto BgL_tagzd21971zd2_948; + } else { + goto BgL_tagzd21971zd2_948; + } + } + } + } + } else { + int BgL_testz00_4189; + { + obj_t BgL_auxz00_4190; + BgL_auxz00_4190 = + ((((obj_t) ((long) BgL_formalsz00_39 - 3))->pair_t). + car); + BgL_testz00_4189 = + ((((long) BgL_auxz00_4190) & ((1 << 2) - 1)) == 3); + } + if (BgL_testz00_4189) { + goto BgL_tagzd21971zd2_948; + } else { + int BgL_testz00_4193; + { + obj_t BgL_auxz00_4194; + { + obj_t BgL_auxz00_4195; + BgL_auxz00_4195 = + ((((obj_t) ((long) BgL_formalsz00_39 - 3))->pair_t). + cdr); + BgL_auxz00_4194 = + ((((obj_t) ((long) BgL_auxz00_4195 - 3))->pair_t). + car); + } + BgL_testz00_4193 = + ((((long) BgL_auxz00_4194) & ((1 << 2) - 1)) == 3); + } + if (BgL_testz00_4193) { + goto BgL_tagzd21971zd2_948; + } else { + int BgL_testz00_4199; + { + obj_t BgL_auxz00_4200; + { + obj_t BgL_auxz00_4201; + { + obj_t BgL_auxz00_4202; + BgL_auxz00_4202 = + ((((obj_t) ((long) BgL_formalsz00_39 - 3))-> + pair_t).cdr); + BgL_auxz00_4201 = + ((((obj_t) ((long) BgL_auxz00_4202 - 3))-> + pair_t).cdr); + } + BgL_auxz00_4200 = + ((((obj_t) ((long) BgL_auxz00_4201 - 3))->pair_t). + car); + } + BgL_testz00_4199 = + ((((long) BgL_auxz00_4200) & ((1 << 2) - 1)) == 3); + } + if (BgL_testz00_4199) { + goto BgL_tagzd21971zd2_948; + } else { + if ((BgL_namedzf3zf3_42 != + ((obj_t) (obj_t) + ((long) (((long) (1) << 2) | 2))))) { + obj_t BgL_v1050z00_1022; + { + int BgL_auxz00_4209; + BgL_auxz00_4209 = (int) (((long) 3)); + BgL_v1050z00_1022 = + create_vector (BgL_auxz00_4209); + } + { + obj_t BgL_arg1604z00_1024; + BgL_arg1604z00_1024 = + make_pair (BgL_wherez00_41, BgL_bodyz00_40); + { + int BgL_auxz00_4213; + BgL_auxz00_4213 = (int) (((long) 2)); + ((& + (((obj_t) (BgL_v1050z00_1022))->vector_t. + obj0))[BgL_auxz00_4213] = + BgL_arg1604z00_1024, + ((obj_t) (obj_t) + ((long) (((long) (3) << 2) | 2)))); + } + } + { + int BgL_auxz00_4216; + BgL_auxz00_4216 = (int) (((long) 1)); + ((&(((obj_t) (BgL_v1050z00_1022))->vector_t.obj0)) + [BgL_auxz00_4216] = + BgL_locz00_43, + ((obj_t) (obj_t) + ((long) (((long) (3) << 2) | 2)))); + } + { + obj_t BgL_auxz00_4221; + int BgL_auxz00_4219; + BgL_auxz00_4221 = + (obj_t) ((long) + (((long) (((long) 50)) << 2) | 1)); + BgL_auxz00_4219 = (int) (((long) 0)); + ((&(((obj_t) (BgL_v1050z00_1022))->vector_t.obj0)) + [BgL_auxz00_4219] = + BgL_auxz00_4221, + ((obj_t) (obj_t) + ((long) (((long) (3) << 2) | 2)))); + } + return BgL_v1050z00_1022; + } else { + obj_t BgL_v1051z00_1025; + { + int BgL_auxz00_4224; + BgL_auxz00_4224 = (int) (((long) 3)); + BgL_v1051z00_1025 = + create_vector (BgL_auxz00_4224); + } + { + int BgL_auxz00_4227; + BgL_auxz00_4227 = (int) (((long) 2)); + ((&(((obj_t) (BgL_v1051z00_1025))->vector_t.obj0)) + [BgL_auxz00_4227] = + BgL_bodyz00_40, + ((obj_t) (obj_t) + ((long) (((long) (3) << 2) | 2)))); + } + { + int BgL_auxz00_4230; + BgL_auxz00_4230 = (int) (((long) 1)); + ((&(((obj_t) (BgL_v1051z00_1025))->vector_t.obj0)) + [BgL_auxz00_4230] = + BgL_locz00_43, + ((obj_t) (obj_t) + ((long) (((long) (3) << 2) | 2)))); + } + { + obj_t BgL_auxz00_4235; + int BgL_auxz00_4233; + BgL_auxz00_4235 = + (obj_t) ((long) + (((long) (((long) 54)) << 2) | 1)); + BgL_auxz00_4233 = (int) (((long) 0)); + ((&(((obj_t) (BgL_v1051z00_1025))->vector_t.obj0)) + [BgL_auxz00_4233] = + BgL_auxz00_4235, + ((obj_t) (obj_t) + ((long) (((long) (3) << 2) | 2)))); + } + return BgL_v1051z00_1025; + } + } + } + } + } + } + } else { + int BgL_testz00_4238; + { + obj_t BgL_auxz00_4239; + BgL_auxz00_4239 = + ((((obj_t) ((long) BgL_formalsz00_39 - 3))->pair_t).car); + BgL_testz00_4238 = + ((((long) BgL_auxz00_4239) & ((1 << 2) - 1)) == 3); + } + if (BgL_testz00_4238) { + goto BgL_tagzd21971zd2_948; + } else { + int BgL_testz00_4242; + { + obj_t BgL_auxz00_4243; + BgL_auxz00_4243 = + ((((obj_t) ((long) BgL_cdrzd21979zd2_953 - 3))->pair_t). + car); + BgL_testz00_4242 = + ((((long) BgL_auxz00_4243) & ((1 << 2) - 1)) == 3); + } + if (BgL_testz00_4242) { + goto BgL_tagzd21971zd2_948; + } else { + if ((BgL_namedzf3zf3_42 != + ((obj_t) (obj_t) ((long) (((long) (1) << 2) | 2))))) { + obj_t BgL_v1048z00_1018; + { + int BgL_auxz00_4248; + BgL_auxz00_4248 = (int) (((long) 3)); + BgL_v1048z00_1018 = create_vector (BgL_auxz00_4248); + } + { + obj_t BgL_arg1602z00_1020; + BgL_arg1602z00_1020 = + make_pair (BgL_wherez00_41, BgL_bodyz00_40); + { + int BgL_auxz00_4252; + BgL_auxz00_4252 = (int) (((long) 2)); + ((&(((obj_t) (BgL_v1048z00_1018))->vector_t.obj0)) + [BgL_auxz00_4252] = + BgL_arg1602z00_1020, + ((obj_t) (obj_t) ((long) (((long) (3) << 2) | 2)))); + } + } + { + int BgL_auxz00_4255; + BgL_auxz00_4255 = (int) (((long) 1)); + ((&(((obj_t) (BgL_v1048z00_1018))->vector_t.obj0)) + [BgL_auxz00_4255] = + BgL_locz00_43, + ((obj_t) (obj_t) ((long) (((long) (3) << 2) | 2)))); + } + { + obj_t BgL_auxz00_4260; + int BgL_auxz00_4258; + BgL_auxz00_4260 = + (obj_t) ((long) (((long) (((long) 49)) << 2) | 1)); + BgL_auxz00_4258 = (int) (((long) 0)); + ((&(((obj_t) (BgL_v1048z00_1018))->vector_t.obj0)) + [BgL_auxz00_4258] = + BgL_auxz00_4260, + ((obj_t) (obj_t) ((long) (((long) (3) << 2) | 2)))); + } + return BgL_v1048z00_1018; + } else { + obj_t BgL_v1049z00_1021; + { + int BgL_auxz00_4263; + BgL_auxz00_4263 = (int) (((long) 3)); + BgL_v1049z00_1021 = create_vector (BgL_auxz00_4263); + } + { + int BgL_auxz00_4266; + BgL_auxz00_4266 = (int) (((long) 2)); + ((&(((obj_t) (BgL_v1049z00_1021))->vector_t.obj0)) + [BgL_auxz00_4266] = + BgL_bodyz00_40, + ((obj_t) (obj_t) ((long) (((long) (3) << 2) | 2)))); + } + { + int BgL_auxz00_4269; + BgL_auxz00_4269 = (int) (((long) 1)); + ((&(((obj_t) (BgL_v1049z00_1021))->vector_t.obj0)) + [BgL_auxz00_4269] = + BgL_locz00_43, + ((obj_t) (obj_t) ((long) (((long) (3) << 2) | 2)))); + } + { + obj_t BgL_auxz00_4274; + int BgL_auxz00_4272; + BgL_auxz00_4274 = + (obj_t) ((long) (((long) (((long) 53)) << 2) | 1)); + BgL_auxz00_4272 = (int) (((long) 0)); + ((&(((obj_t) (BgL_v1049z00_1021))->vector_t.obj0)) + [BgL_auxz00_4272] = + BgL_auxz00_4274, + ((obj_t) (obj_t) ((long) (((long) (3) << 2) | 2)))); + } + return BgL_v1049z00_1021; + } + } + } + } + } + } else { + int BgL_testz00_4277; + { + obj_t BgL_auxz00_4278; + BgL_auxz00_4278 = + ((((obj_t) ((long) BgL_formalsz00_39 - 3))->pair_t).car); + BgL_testz00_4277 = + ((((long) BgL_auxz00_4278) & ((1 << 2) - 1)) == 3); + } + if (BgL_testz00_4277) { + goto BgL_tagzd21971zd2_948; + } else { + if ((BgL_namedzf3zf3_42 != + ((obj_t) (obj_t) ((long) (((long) (1) << 2) | 2))))) { + obj_t BgL_v1046z00_1014; + { + int BgL_auxz00_4283; + BgL_auxz00_4283 = (int) (((long) 3)); + BgL_v1046z00_1014 = create_vector (BgL_auxz00_4283); + } + { + obj_t BgL_arg1600z00_1016; + BgL_arg1600z00_1016 = + make_pair (BgL_wherez00_41, BgL_bodyz00_40); + { + int BgL_auxz00_4287; + BgL_auxz00_4287 = (int) (((long) 2)); + ((&(((obj_t) (BgL_v1046z00_1014))->vector_t.obj0)) + [BgL_auxz00_4287] = + BgL_arg1600z00_1016, + ((obj_t) (obj_t) ((long) (((long) (3) << 2) | 2)))); + } + } + { + int BgL_auxz00_4290; + BgL_auxz00_4290 = (int) (((long) 1)); + ((&(((obj_t) (BgL_v1046z00_1014))->vector_t.obj0)) + [BgL_auxz00_4290] = + BgL_locz00_43, + ((obj_t) (obj_t) ((long) (((long) (3) << 2) | 2)))); + } + { + obj_t BgL_auxz00_4295; + int BgL_auxz00_4293; + BgL_auxz00_4295 = + (obj_t) ((long) (((long) (((long) 48)) << 2) | 1)); + BgL_auxz00_4293 = (int) (((long) 0)); + ((&(((obj_t) (BgL_v1046z00_1014))->vector_t.obj0)) + [BgL_auxz00_4293] = + BgL_auxz00_4295, + ((obj_t) (obj_t) ((long) (((long) (3) << 2) | 2)))); + } + return BgL_v1046z00_1014; + } else { + obj_t BgL_v1047z00_1017; + { + int BgL_auxz00_4298; + BgL_auxz00_4298 = (int) (((long) 3)); + BgL_v1047z00_1017 = create_vector (BgL_auxz00_4298); + } + { + int BgL_auxz00_4301; + BgL_auxz00_4301 = (int) (((long) 2)); + ((&(((obj_t) (BgL_v1047z00_1017))->vector_t.obj0)) + [BgL_auxz00_4301] = + BgL_bodyz00_40, + ((obj_t) (obj_t) ((long) (((long) (3) << 2) | 2)))); + } + { + int BgL_auxz00_4304; + BgL_auxz00_4304 = (int) (((long) 1)); + ((&(((obj_t) (BgL_v1047z00_1017))->vector_t.obj0)) + [BgL_auxz00_4304] = + BgL_locz00_43, + ((obj_t) (obj_t) ((long) (((long) (3) << 2) | 2)))); + } + { + obj_t BgL_auxz00_4309; + int BgL_auxz00_4307; + BgL_auxz00_4309 = + (obj_t) ((long) (((long) (((long) 52)) << 2) | 1)); + BgL_auxz00_4307 = (int) (((long) 0)); + ((&(((obj_t) (BgL_v1047z00_1017))->vector_t.obj0)) + [BgL_auxz00_4307] = + BgL_auxz00_4309, + ((obj_t) (obj_t) ((long) (((long) (3) << 2) | 2)))); + } + return BgL_v1047z00_1017; + } + } + } + } + } else { + if ((BgL_namedzf3zf3_42 != + ((obj_t) (obj_t) ((long) (((long) (1) << 2) | 2))))) { + obj_t BgL_v1044z00_1010; + { + int BgL_auxz00_4314; + BgL_auxz00_4314 = (int) (((long) 3)); + BgL_v1044z00_1010 = create_vector (BgL_auxz00_4314); + } + { + obj_t BgL_arg1598z00_1012; + BgL_arg1598z00_1012 = make_pair (BgL_wherez00_41, BgL_bodyz00_40); + { + int BgL_auxz00_4318; + BgL_auxz00_4318 = (int) (((long) 2)); + ((&(((obj_t) (BgL_v1044z00_1010))->vector_t.obj0)) + [BgL_auxz00_4318] = + BgL_arg1598z00_1012, + ((obj_t) (obj_t) ((long) (((long) (3) << 2) | 2)))); + } + } + { + int BgL_auxz00_4321; + BgL_auxz00_4321 = (int) (((long) 1)); + ((&(((obj_t) (BgL_v1044z00_1010))->vector_t.obj0))[BgL_auxz00_4321] + = + BgL_locz00_43, ((obj_t) (obj_t) ((long) (((long) (3) << 2) | 2)))); + } + { + obj_t BgL_auxz00_4326; + int BgL_auxz00_4324; + BgL_auxz00_4326 = + (obj_t) ((long) (((long) (((long) 47)) << 2) | 1)); + BgL_auxz00_4324 = (int) (((long) 0)); + ((&(((obj_t) (BgL_v1044z00_1010))->vector_t.obj0))[BgL_auxz00_4324] + = + BgL_auxz00_4326, + ((obj_t) (obj_t) ((long) (((long) (3) << 2) | 2)))); + } + return BgL_v1044z00_1010; + } else { + obj_t BgL_v1045z00_1013; + { + int BgL_auxz00_4329; + BgL_auxz00_4329 = (int) (((long) 3)); + BgL_v1045z00_1013 = create_vector (BgL_auxz00_4329); + } + { + int BgL_auxz00_4332; + BgL_auxz00_4332 = (int) (((long) 2)); + ((&(((obj_t) (BgL_v1045z00_1013))->vector_t.obj0))[BgL_auxz00_4332] + = + BgL_bodyz00_40, + ((obj_t) (obj_t) ((long) (((long) (3) << 2) | 2)))); + } + { + int BgL_auxz00_4335; + BgL_auxz00_4335 = (int) (((long) 1)); + ((&(((obj_t) (BgL_v1045z00_1013))->vector_t.obj0))[BgL_auxz00_4335] + = + BgL_locz00_43, ((obj_t) (obj_t) ((long) (((long) (3) << 2) | 2)))); + } + { + obj_t BgL_auxz00_4340; + int BgL_auxz00_4338; + BgL_auxz00_4340 = + (obj_t) ((long) (((long) (((long) 51)) << 2) | 1)); + BgL_auxz00_4338 = (int) (((long) 0)); + ((&(((obj_t) (BgL_v1045z00_1013))->vector_t.obj0))[BgL_auxz00_4338] + = + BgL_auxz00_4340, + ((obj_t) (obj_t) ((long) (((long) (3) << 2) | 2)))); + } + return BgL_v1045z00_1013; + } + } + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020304-2.c b/gcc/testsuite/gcc.c-torture/compile/20020304-2.c new file mode 100644 index 00000000000..9a162d4935d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20020304-2.c @@ -0,0 +1,10 @@ +/* This testcase ICEd because a SUBREG of MEM/v was never + simplified. */ +volatile unsigned long long *a; + +unsigned char +foo (void) +{ + unsigned char b = (*a != 0); + return b; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020309-1.c b/gcc/testsuite/gcc.c-torture/compile/20020309-1.c new file mode 100644 index 00000000000..b74061764de --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20020309-1.c @@ -0,0 +1,14 @@ +int +sub1 (char *p, int i) +{ + char j = p[i]; + + { + void + sub2 () + { + i = 2; + p = p + 2; + } + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020309-2.c b/gcc/testsuite/gcc.c-torture/compile/20020309-2.c new file mode 100644 index 00000000000..77699e43d3d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20020309-2.c @@ -0,0 +1,16 @@ +/* This testcase ICEd on IA-32 at -O2, because loop was calling convert_modes + between a MODE_FLOAT and MODE_INT class modes. */ + +typedef union +{ + double d; + long long ll; +} A; + +void +foo (A x, A **y, A z) +{ + for (; *y; y++) + if (x.ll == 262 && (*y)->d == z.d) + break; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020312-1.c b/gcc/testsuite/gcc.c-torture/compile/20020312-1.c new file mode 100644 index 00000000000..9f61dae64a5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20020312-1.c @@ -0,0 +1,19 @@ +/* PR optimization/5892 */ +typedef struct { unsigned long a; unsigned int b, c; } A; +typedef struct { unsigned long a; A *b; int c; } B; + +static inline unsigned int +bar (unsigned int x) +{ + unsigned long r; + asm ("" : "=r" (r) : "0" (x)); + return r >> 31; +} + +int foo (B *x) +{ + A *y; + y = x->b; + y->b = bar (x->c); + y->c = ({ unsigned int z = 1; (z << 24) | (z >> 24); }); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020315-1.c b/gcc/testsuite/gcc.c-torture/compile/20020315-1.c new file mode 100644 index 00000000000..c6c9daa2f72 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20020315-1.c @@ -0,0 +1,34 @@ +/* PR bootstrap/4128 */ + +extern int bar (char *, char *, int, int); +extern long baz (char *, char *, int, int); + +int sgt (char *a, char *b, int c, int d) +{ + return bar (a, b, c, d) > 0; +} + +long dgt (char *a, char *b, int c, int d) +{ + return baz (a, b, c, d) > 0; +} + +int sne (char *a, char *b, int c, int d) +{ + return bar (a, b, c, d) != 0; +} + +long dne (char *a, char *b, int c, int d) +{ + return baz (a, b, c, d) != 0; +} + +int seq (char *a, char *b, int c, int d) +{ + return bar (a, b, c, d) == 0; +} + +long deq (char *a, char *b, int c, int d) +{ + return baz (a, b, c, d) == 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020318-1.c b/gcc/testsuite/gcc.c-torture/compile/20020318-1.c new file mode 100644 index 00000000000..097a35d7956 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20020318-1.c @@ -0,0 +1,16 @@ +/* PR c/5656 + This testcase ICEd on IA-32 at -O3, due to tree inliner not converting + parameter assignment when using K&R syntax. */ + +void foo (c) + char c; +{ + (void) &c; +} + +int bar (void); + +void baz (void) +{ + foo (bar ()); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020320-1.c b/gcc/testsuite/gcc.c-torture/compile/20020320-1.c new file mode 100644 index 00000000000..385c061e193 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20020320-1.c @@ -0,0 +1,24 @@ +/* PR bootstrap/4192 + This testcase caused infinite loop in flow (several places), + because flow assumes gen_jump generates simple_jump_p. */ + +typedef void (*T) (void); +extern T x[]; + +void +foo (void) +{ + static T *p = x; + static _Bool a; + T f; + + if (__builtin_expect (a, 0)) + return; + + while ((f = *p)) + { + p++; + f (); + } + a = 1; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020323-1.c b/gcc/testsuite/gcc.c-torture/compile/20020323-1.c new file mode 100644 index 00000000000..ed3c66651d9 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20020323-1.c @@ -0,0 +1,26 @@ +/* This testcase caused ICE on powerpc at -O3, because regrename did + not handle match_dup of match_operator if the RTLs were not shared. */ + +struct A +{ + unsigned char *a0, *a1; + int a2; +}; + +void bar (struct A *); + +unsigned int +foo (int x) +{ + struct A a; + unsigned int b; + + if (x < -128 || x > 255 || x == -1) + return 26; + + a.a0 = (unsigned char *) &b; + a.a1 = a.a0 + sizeof (unsigned int); + a.a2 = 0; + bar (&a); + return b; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020330-1.c b/gcc/testsuite/gcc.c-torture/compile/20020330-1.c new file mode 100644 index 00000000000..cac7099127f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20020330-1.c @@ -0,0 +1,27 @@ +/* PR 5446 */ +/* This testcase is similar to gcc.c-torture/compile/20011219-1.c except + with parts of it omitted, causing an ICE with -O3 on IA-64. */ + +void * baz (unsigned long); +static inline double ** +bar (long w, long x, long y, long z) +{ + long i, a = x - w + 1, b = z - y + 1; + double **m = (double **) baz (sizeof (double *) * (a + 1)); + + m += 1; + m -= w; + m[w] = (double *) baz (sizeof (double) * (a * b + 1)); + for (i = w + 1; i <= x; i++) + m[i] = m[i - 1] + b; + return m; +} + +void +foo (double w[], int x, double y[], double z[]) +{ + int i; + double **a; + + a = bar (1, 50, 1, 50); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020409-1.c b/gcc/testsuite/gcc.c-torture/compile/20020409-1.c new file mode 100644 index 00000000000..1bdc08ff3b8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20020409-1.c @@ -0,0 +1,9 @@ +/* PR c/5078 */ + +#include <limits.h> + +int f(int i) +{ + i -= 2 * (INT_MAX + 1); + return i; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020418-1.c b/gcc/testsuite/gcc.c-torture/compile/20020418-1.c new file mode 100644 index 00000000000..df01e6847e3 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20020418-1.c @@ -0,0 +1,18 @@ +/* PR c/6358 + This testcase ICEd on IA-32 in foo, because current_function_return_rtx + was assigned a hard register only after expand_null_return was called, + thus return pseudo was clobbered twice and the hard register not at + all. */ + +void baz (void); + +double foo (void) +{ + baz (); + return; +} + +double bar (void) +{ + baz (); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020530-1.c b/gcc/testsuite/gcc.c-torture/compile/20020530-1.c new file mode 100644 index 00000000000..a6794892ec7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20020530-1.c @@ -0,0 +1,16 @@ +/* PR optimization/6822 */ + +extern unsigned char foo1 (void); +extern unsigned short foo2 (void); + +int bar1 (void) +{ + unsigned char q = foo1 (); + return (q < 0x80) ? 64 : 0; +} + +int bar2 (void) +{ + unsigned short h = foo2 (); + return (h < 0x8000) ? 64 : 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020605-1.c b/gcc/testsuite/gcc.c-torture/compile/20020605-1.c new file mode 100644 index 00000000000..960a4be7ed1 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20020605-1.c @@ -0,0 +1,17 @@ +/* This testcase caused on IA-32 -O2 endless loop in + merge_blocks when trying to merge a basic block + with itself. */ + +void f (void) +{ + char *c; + do + { + if (c) + break; + } + while (1); + if (!c) + while (1) + f (); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020701-1.c b/gcc/testsuite/gcc.c-torture/compile/20020701-1.c new file mode 100644 index 00000000000..1258cec28b7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20020701-1.c @@ -0,0 +1,75 @@ +/* PR target/7177 + Problem with cris-axis-elf: ICE in global. + Origin: hp@axis.com. */ + +typedef __SIZE_TYPE__ size_t; +void f1 (void *); +char *f2 (const char *); +int atoi (const char *); +char *strchr (const char *, int); +int strcmp (const char *, const char *); +size_t strlen (const char *); +typedef enum { A, B, C } t1; +extern const char _v[]; + +static t1 +f (const char* p1, const char* p2, char p3) +{ + char *v1; + char *v2; + char *a; + char *v3; + char *v4; + char *v5; + char *e; + char *v6; + t1 r = C; + + v1 = f2 (p2); + v4 = f2 (p1); + + a = v2 = v1; + e = v5 = v4; + memcpy (&e, &e, sizeof (e)); + + v3 = strchr (v2, ','); + v6 = strchr (v5, ','); + + while ((_v + 1)[(unsigned) *a] & 4) + a++; + while ((_v + 1)[(unsigned) *e] & 4) + e++; + + if (a == v3 && e == v6) + { + if (p3) + r = atoi (v5) < atoi (v2) ? B : A; + else + r = atoi (v5) > atoi (v2) ? B : A; + v2 = ++a; + v5 = ++e; + v3 = strchr (v2, ','); + v6 = strchr (v5, ','); + + while ((_v + 1)[(unsigned) *a] & 4) + a++; + while ((_v + 1)[(unsigned) *e] & 4) + e++; + + if (a == v3 && e == v6) + { + if (r == B) + r = B; + else if (p3) + r = atoi (v5) < atoi (v2) ? B : A; + else + r = atoi (v5) > atoi (v2) ? B : A; + } + else + r = C; + } + + f1 (v1); + f1 (v4); + return r; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020710-1.c b/gcc/testsuite/gcc.c-torture/compile/20020710-1.c new file mode 100644 index 00000000000..bf6c9066cdd --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20020710-1.c @@ -0,0 +1,12 @@ +/* Red Hat bugzilla #68395 + PR middle-end/7245 + This testcase ICEd on IA-32 because shift & compare patterns + predicates allowed any immediate, but constraints allowed only + numbers from 1 to 31. */ + +void foo (int *x, unsigned int y) +{ + int a = y >> -13; + if (a) + *x = a; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020715-1.c b/gcc/testsuite/gcc.c-torture/compile/20020715-1.c new file mode 100644 index 00000000000..5294133f37b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20020715-1.c @@ -0,0 +1,22 @@ +/* PR optimization/7153 */ +/* Verify that GCC doesn't promote a register when its + lifetime is not limited to one basic block. */ + +void f(char); +void g(void); + +void scale(void) +{ + int width; + char bytes; + char *src; + + if (width) + { + bytes = *src; + g(); + width *= bytes; + } + + f(bytes); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/920625-1.x b/gcc/testsuite/gcc.c-torture/compile/920625-1.x new file mode 100644 index 00000000000..c88a02e9086 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920625-1.x @@ -0,0 +1,25 @@ +# The problem on IA-64 is that if-conversion creates a sequence +# +# (p17) cmp.geu p6, p7 = r48, r15 +# (p16) cmp.gtu p6, p7 = r48, r15 +# +# where p16 and p17 are complemenary, but the assembler DV validation +# code doesn't recognize that p6 and p7 are complimentary, and so +# we end up warning for a later use +# +# (p6) addl r14 = 1, r0 +# (p7) mov r14 = r0 +# +# that appears to be a WAW violation. + +set torture_eval_before_compile { + + set compiler_conditional_xfail_data { + "missing .pred.rel.mutex directive" \ + "ia64-*-*" \ + { "-O2" "-O3" "-Os" } \ + { "" } + } +} + +return 0 diff --git a/gcc/testsuite/gcc.c-torture/compile/981006-1.x b/gcc/testsuite/gcc.c-torture/compile/981006-1.x index 83a57905597..e05547b397b 100644 --- a/gcc/testsuite/gcc.c-torture/compile/981006-1.x +++ b/gcc/testsuite/gcc.c-torture/compile/981006-1.x @@ -8,6 +8,9 @@ if { [istarget rs6000-*-aix*] || [istarget sh-*-hms] || [istarget sh-*-coff] || [istarget h8300*-*-*] + || [istarget cris-*-elf*] + || [istarget cris-*-aout*] + || [istarget mmix-*-*] } { set options "-Wuninitialized -Werror" } else { diff --git a/gcc/testsuite/gcc.c-torture/compile/981223-1.x b/gcc/testsuite/gcc.c-torture/compile/981223-1.x new file mode 100644 index 00000000000..f8d2aa6f938 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/981223-1.x @@ -0,0 +1,20 @@ +# The problem on IA-64 is that the assembler emits +# +# Warning: Additional NOP may be necessary to workaround Itanium +# processor A/B step errata +# +# This can be fixed by adding "-mb-step" to the command line, which +# does in fact add the extra nop, if someone can tell me how to do +# that for a c-torture compile test. + +set torture_eval_before_compile { + + set compiler_conditional_xfail_data { + "need -mb-step" \ + "ia64-*-*" \ + { "-O2" "-O3" "-Os" } \ + { "" } + } +} + +return 0 diff --git a/gcc/testsuite/gcc.c-torture/compile/iftrap-1.c b/gcc/testsuite/gcc.c-torture/compile/iftrap-1.c new file mode 100644 index 00000000000..a0adc78cf82 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/iftrap-1.c @@ -0,0 +1,99 @@ +/* Verify that ifcvt doesn't crash under a number of interesting conditions. */ + +void f1(int p) +{ + if (p) + __builtin_trap(); +} + +void f2(int p) +{ + if (p) + __builtin_trap(); + else + bar(); +} + +void f3(int p) +{ + if (p) + bar(); + else + __builtin_trap(); +} + +void f4(int p, int q) +{ + if (p) + { + bar(); + if (q) + bar(); + } + else + __builtin_trap(); +} + +void f5(int p) +{ + if (p) + __builtin_trap(); + else + abort(); +} + +void f6(int p) +{ + if (p) + abort(); + else + __builtin_trap(); +} + +void f7(int p) +{ + if (p) + __builtin_trap(); + else + __builtin_trap(); +} + +void f8(int p) +{ + if (p) + __builtin_trap(); + else + { + bar(); + __builtin_trap(); + } +} + +void f9(int p) +{ + if (p) + { + bar(); + __builtin_trap(); + } + else + __builtin_trap(); +} + +void f10(int p) +{ + if (p) + __builtin_trap(); + while (1) + bar(); +} + +void f11(int p) +{ + if (p) + __builtin_trap(); + else + bar(); + while (1) + baz(); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/iftrap-2.c b/gcc/testsuite/gcc.c-torture/compile/iftrap-2.c new file mode 100644 index 00000000000..bb7bb5726b1 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/iftrap-2.c @@ -0,0 +1,10 @@ +void foo(int p, int q) +{ + if (p) + { + if (q) + __builtin_trap (); + } + else + bar(); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/labels-3.x b/gcc/testsuite/gcc.c-torture/compile/labels-3.x new file mode 100644 index 00000000000..e9b4118ff44 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/labels-3.x @@ -0,0 +1,7 @@ +# This test does not compile on mips-irix6 using the native assembler, +# though it does work with gas. See PR6200. Since we cannot (???) +# distinguish which assembler is being used, always pass -S for irix. + +if { [istarget "mips*-*-irix*"] } { set options "-S" } + +return 0 diff --git a/gcc/testsuite/gcc.c-torture/execute/20000906-1.x b/gcc/testsuite/gcc.c-torture/execute/20000906-1.x deleted file mode 100644 index c567fd6cfed..00000000000 --- a/gcc/testsuite/gcc.c-torture/execute/20000906-1.x +++ /dev/null @@ -1,14 +0,0 @@ -# This only fails for `-O2', but not `-O3' or `-Os' -# as I had expected. See clues in testcase source file. - -set torture_eval_before_execute { - - set compiler_conditional_xfail_data { - "loop optimizer leaves dangling pseudo" \ - "i?86-*-*" \ - { "-O2" } \ - { "" } - } -} - -return 0 diff --git a/gcc/testsuite/gcc.c-torture/execute/20010122-1.x b/gcc/testsuite/gcc.c-torture/execute/20010122-1.x new file mode 100644 index 00000000000..c6870a9b548 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20010122-1.x @@ -0,0 +1,8 @@ +# This doesn't work on MIPS Irix. +# See http://gcc.gnu.org/ml/gcc-patches/2002-04/msg00473.html + +if { [istarget "mips*-sgi-irix6*"] } { + set torture_execute_xfail "mips*-sgi-irix6*" +} + +return 0 diff --git a/gcc/testsuite/gcc.c-torture/execute/20020227-1.c b/gcc/testsuite/gcc.c-torture/execute/20020227-1.c new file mode 100644 index 00000000000..0f83088bff9 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20020227-1.c @@ -0,0 +1,30 @@ +/* This testcase failed on mmix-knuth-mmixware. Problem was with storing + to an unaligned mem:SC, gcc tried doing it by parts from a (concat:SC + (reg:SF 293) (reg:SF 294)). */ + +typedef __complex__ float cf; +struct x { char c; cf f; } __attribute__ ((__packed__)); +extern void f2 (struct x*); +extern void f1 (void); +int +main (void) +{ + f1 (); + exit (0); +} + +void +f1 (void) +{ + struct x s; + s.f = 1; + s.c = 42; + f2 (&s); +} + +void +f2 (struct x *y) +{ + if (y->f != 1 || y->c != 42) + abort (); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20020227-1.x b/gcc/testsuite/gcc.c-torture/execute/20020227-1.x new file mode 100644 index 00000000000..3c3c4bb9cb5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20020227-1.x @@ -0,0 +1,21 @@ +# This test reportedly fails on all 64-bit targets, see PR6221. It's +# been observed to fail on at least mips-irix6, alpha, ia64, hppa64, +# sparc64/sparcv9 and mmix during April 2002. + +if { [istarget "*64*-*-*"] || [istarget "alpha*-*-*"] || [istarget "mmix-*-*"] + || [istarget "sparcv9-*-*"] || [istarget "mips*-*-irix6*"] } { + set torture_execute_xfail [istarget] +} + +# Regular sparc- also fails with -m64. +set torture_eval_before_execute { + global compiler_conditional_xfail_data + set compiler_conditional_xfail_data { + "This test fails on 64-bit targets, see PR6221." \ + { "sparc-*-*" } \ + { "-m64" } \ + { "" } + } +} + +return 0 diff --git a/gcc/testsuite/gcc.c-torture/execute/20020307-1.c b/gcc/testsuite/gcc.c-torture/execute/20020307-1.c new file mode 100644 index 00000000000..c6379de3e8b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20020307-1.c @@ -0,0 +1,69 @@ +#define MASK(N) ((1UL << (N)) - 1) +#define BITS(N) ((1UL << ((N) - 1)) + 2) + +#define FUNC(N) void f##N(long j) { if ((j & MASK(N)) >= BITS(N)) abort();} + +FUNC(3) +FUNC(4) +FUNC(5) +FUNC(6) +FUNC(7) +FUNC(8) +FUNC(9) +FUNC(10) +FUNC(11) +FUNC(12) +FUNC(13) +FUNC(14) +FUNC(15) +FUNC(16) +FUNC(17) +FUNC(18) +FUNC(19) +FUNC(20) +FUNC(21) +FUNC(22) +FUNC(23) +FUNC(24) +FUNC(25) +FUNC(26) +FUNC(27) +FUNC(28) +FUNC(29) +FUNC(30) +FUNC(31) + +int main () +{ + f3(0); + f4(0); + f5(0); + f6(0); + f7(0); + f8(0); + f9(0); + f10(0); + f11(0); + f12(0); + f13(0); + f14(0); + f15(0); + f16(0); + f17(0); + f18(0); + f19(0); + f20(0); + f21(0); + f22(0); + f23(0); + f24(0); + f25(0); + f26(0); + f27(0); + f28(0); + f29(0); + f30(0); + f31(0); + + exit(0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20020307-2.c b/gcc/testsuite/gcc.c-torture/execute/20020307-2.c new file mode 100644 index 00000000000..df0efe008ad --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20020307-2.c @@ -0,0 +1,56 @@ +/* PR c/3711 + This testcase ICEd on IA-32 at -O0 and was miscompiled otherwise, + because std_expand_builtin_va_arg didn't handle variable size types. */ + +#include <stdarg.h> + +extern void abort (void); +extern void exit (int); + +void bar (int c) +{ + static int d = '0'; + + if (c != d++) + abort (); + if (c < '0' || c > '9') + abort (); +} + +void foo (int size, ...) +{ + struct + { + char x[size]; + } d; + va_list ap; + int i; + + va_start (ap, size); + d = va_arg (ap, typeof (d)); + for (i = 0; i < size; i++) + bar (d.x[i]); + d = va_arg (ap, typeof (d)); + for (i = 0; i < size; i++) + bar (d.x[i]); + va_end (ap); +} + +int main (void) +{ + int z = 5; + struct { char a[z]; } x, y; + + x.a[0] = '0'; + x.a[1] = '1'; + x.a[2] = '2'; + x.a[3] = '3'; + x.a[4] = '4'; + y.a[0] = '5'; + y.a[1] = '6'; + y.a[2] = '7'; + y.a[3] = '8'; + y.a[4] = '9'; + foo (z, x, y); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20020314-1.c b/gcc/testsuite/gcc.c-torture/execute/20020314-1.c new file mode 100644 index 00000000000..28288c82c8b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20020314-1.c @@ -0,0 +1,36 @@ +void f(void * a, double y) +{ +} + +double g (double a, double b, double c, double d) +{ + double x, y, z; + void *p; + + x = a + b; + y = c * d; + + p = alloca (16); + + f(p, y); + z = x * y * a; + + return z + b; +} + +main () +{ + double a, b, c, d; + a = 1.0; + b = 0.0; + c = 10.0; + d = 0.0; + + if (g (a, b, c, d) != 0.0) + abort (); + + if (a != 1.0 || b != 0.0 || c != 10.0 || d != 0.0) + abort (); + + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20020320-1.c b/gcc/testsuite/gcc.c-torture/execute/20020320-1.c new file mode 100644 index 00000000000..05f72c65482 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20020320-1.c @@ -0,0 +1,23 @@ +/* PR c/5354 */ +/* Verify that GCC preserves relevant stack slots. */ + +extern void abort(void); +extern void exit(int); + +struct large { int x, y[9]; }; + +int main() +{ + int fixed; + + fixed = ({ int temp1 = 2; temp1; }) - ({ int temp2 = 1; temp2; }); + if (fixed != 1) + abort(); + + fixed = ({ struct large temp3; temp3.x = 2; temp3; }).x + - ({ struct large temp4; temp4.x = 1; temp4; }).x; + if (fixed != 1) + abort(); + + exit(0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20020321-1.c b/gcc/testsuite/gcc.c-torture/execute/20020321-1.c new file mode 100644 index 00000000000..d06dd0acd9a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20020321-1.c @@ -0,0 +1,20 @@ +/* PR 3177 */ +/* Produced a SIGILL on ia64 with sibcall from F to G. We hadn't + widened the register window to allow for the fourth outgoing + argument as an "in" register. */ + +float g (void *a, void *b, int e, int c, float d) +{ + return d; +} + +float f (void *a, void *b, int c, float d) +{ + return g (a, b, 0, c, d); +} + +int main () +{ + f (0, 0, 1, 1); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20020402-1.c b/gcc/testsuite/gcc.c-torture/execute/20020402-1.c new file mode 100644 index 00000000000..fe2a6f657b2 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20020402-1.c @@ -0,0 +1,41 @@ +/* derived from PR c/2100 */ + +extern void abort (); +extern void exit (int); + +#define SMALL_N 2 +#define NUM_ELEM 4 + +int main(void) +{ + int listElem[NUM_ELEM]={30,2,10,5}; + int listSmall[SMALL_N]; + int i, j; + int posGreatest=-1, greatest=-1; + + for (i=0; i<SMALL_N; i++) { + listSmall[i] = listElem[i]; + if (listElem[i] > greatest) { + posGreatest = i; + greatest = listElem[i]; + } + } + + for (i=SMALL_N; i<NUM_ELEM; i++) { + if (listElem[i] < greatest) { + listSmall[posGreatest] = listElem[i]; + posGreatest = 0; + greatest = listSmall[0]; + for (j=1; j<SMALL_N; j++) + if (listSmall[j] > greatest) { + posGreatest = j; + greatest = listSmall[j]; + } + } + } + + if (listSmall[0] != 5 || listSmall[1] != 2) + abort (); + exit (0); +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/20020402-2.c b/gcc/testsuite/gcc.c-torture/execute/20020402-2.c new file mode 100644 index 00000000000..e14233f3e3a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20020402-2.c @@ -0,0 +1,230 @@ +/* PR 3967 + + local-alloc screwed up consideration of high+lo_sum and created + reg_equivs that it shouldn't have, resulting in lo_sum with + uninitialized data, resulting in segv. The test has to remain + relatively large, since register spilling is required to twig + the bug. */ + +unsigned long *Local1; +unsigned long *Local2; +unsigned long *Local3; +unsigned long *RDbf1; +unsigned long *RDbf2; +unsigned long *RDbf3; +unsigned long *IntVc1; +unsigned long *IntVc2; +unsigned long *IntCode3; +unsigned long *IntCode4; +unsigned long *IntCode5; +unsigned long *IntCode6; +unsigned long *Lom1; +unsigned long *Lom2; +unsigned long *Lom3; +unsigned long *Lom4; +unsigned long *Lom5; +unsigned long *Lom6; +unsigned long *Lom7; +unsigned long *Lom8; +unsigned long *Lom9; +unsigned long *Lom10; +unsigned long *RDbf11; +unsigned long *RDbf12; + +typedef struct + { + long a1; + unsigned long n1; + unsigned long local1; + unsigned long local2; + unsigned long local3; + unsigned long rdbf1; + unsigned long rdbf2; + unsigned long milli; + unsigned long frames1; + unsigned long frames2; + unsigned long nonShared; + long newPrivate; + long freeLimit; + unsigned long cache1; + unsigned long cache2; + unsigned long cache3; + unsigned long cache4; + unsigned long cache5; + unsigned long time6; + unsigned long frames7; + unsigned long page8; + unsigned long ot9; + unsigned long data10; + unsigned long bm11; + unsigned long misc12; + } +ShrPcCommonStatSType; + + +typedef struct + { + unsigned long sharedAttached; + unsigned long totalAttached; + long avgPercentShared; + unsigned long numberOfFreeFrames; + unsigned long localDirtyPageCount; + unsigned long globalDirtyPageCount; + long wakeupInterval; + unsigned long numActiveProcesses; + unsigned long numRecentActiveProcesses; + unsigned long gemDirtyPageKinds[10]; + unsigned long stoneDirtyPageKinds[10]; + unsigned long gemsInCacheCount; + long targetFreeFrameCount; + } +ShrPcMonStatSType; + +typedef struct + { + unsigned long c1; + unsigned long c2; + unsigned long c3; + unsigned long c4; + unsigned long c5; + unsigned long c6; + unsigned long c7; + unsigned long c8; + unsigned long c9; + unsigned long c10; + unsigned long c11; + unsigned long c12; + unsigned long a1; + unsigned long a2; + unsigned long a3; + unsigned long a4; + unsigned long a5; + unsigned long a6; + unsigned long a7; + unsigned long a8; + unsigned long a9; + unsigned long a10; + unsigned long a11; + unsigned long a12; + unsigned long a13; + unsigned long a14; + unsigned long a15; + unsigned long a16; + unsigned long a17; + unsigned long a18; + unsigned long a19; + unsigned long sessionStats[40]; + } +ShrPcGemStatSType; + +union ShrPcStatUnion + { + ShrPcMonStatSType monitor; + ShrPcGemStatSType gem; + }; + +typedef struct + { + int processId; + int sessionId; + ShrPcCommonStatSType cmn; + union ShrPcStatUnion u; + } ShrPcStatsSType; + +typedef struct + { + unsigned long *p1; + unsigned long *p2; + unsigned long *p3; + unsigned long *p4; + unsigned long *p5; + unsigned long *p6; + unsigned long *p7; + unsigned long *p8; + unsigned long *p9; + unsigned long *p10; + unsigned long *p11; + } +WorkEntrySType; + +WorkEntrySType Workspace; + +static void +setStatPointers (ShrPcStatsSType * statsPtr, long sessionId) +{ + statsPtr->sessionId = sessionId; + statsPtr->cmn.a1 = 0; + statsPtr->cmn.n1 = 5; + + Local1 = &statsPtr->cmn.local1; + Local2 = &statsPtr->cmn.local2; + Local3 = &statsPtr->cmn.local3; + RDbf1 = &statsPtr->cmn.rdbf1; + RDbf2 = &statsPtr->cmn.rdbf2; + RDbf3 = &statsPtr->cmn.milli; + *RDbf3 = 1; + + IntVc1 = &statsPtr->u.gem.a1; + IntVc2 = &statsPtr->u.gem.a2; + IntCode3 = &statsPtr->u.gem.a3; + IntCode4 = &statsPtr->u.gem.a4; + IntCode5 = &statsPtr->u.gem.a5; + IntCode6 = &statsPtr->u.gem.a6; + + { + WorkEntrySType *workSpPtr; + workSpPtr = &Workspace; + workSpPtr->p1 = &statsPtr->u.gem.a7; + workSpPtr->p2 = &statsPtr->u.gem.a8; + workSpPtr->p3 = &statsPtr->u.gem.a9; + workSpPtr->p4 = &statsPtr->u.gem.a10; + workSpPtr->p5 = &statsPtr->u.gem.a11; + workSpPtr->p6 = &statsPtr->u.gem.a12; + workSpPtr->p7 = &statsPtr->u.gem.a13; + workSpPtr->p8 = &statsPtr->u.gem.a14; + workSpPtr->p9 = &statsPtr->u.gem.a15; + workSpPtr->p10 = &statsPtr->u.gem.a16; + workSpPtr->p11 = &statsPtr->u.gem.a17; + } + Lom1 = &statsPtr->u.gem.c1; + Lom2 = &statsPtr->u.gem.c2; + Lom3 = &statsPtr->u.gem.c3; + Lom4 = &statsPtr->u.gem.c4; + Lom5 = &statsPtr->u.gem.c5; + Lom6 = &statsPtr->u.gem.c6; + Lom7 = &statsPtr->u.gem.c7; + Lom8 = &statsPtr->u.gem.c8; + Lom9 = &statsPtr->u.gem.c9; + Lom10 = &statsPtr->u.gem.c10; + RDbf11 = &statsPtr->u.gem.c11; + RDbf12 = &statsPtr->u.gem.c12; +} + +typedef struct +{ + ShrPcStatsSType stats; +} ShrPcPteSType; + +ShrPcPteSType MyPte; + +static void +initPte (void *shrpcPtr, long sessionId) +{ + ShrPcPteSType *ptePtr; + + ptePtr = &MyPte; + setStatPointers (&ptePtr->stats, sessionId); +} + +void +InitCache (int sessionId) +{ + initPte (0, sessionId); +} + +int +main (int argc, char *argv[]) +{ + InitCache (5); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20020402-3.c b/gcc/testsuite/gcc.c-torture/execute/20020402-3.c new file mode 100644 index 00000000000..eef27409327 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20020402-3.c @@ -0,0 +1,81 @@ +/* extracted from gdb sources */ + +typedef unsigned long long CORE_ADDR; + +struct blockvector; + +struct symtab { + struct blockvector *blockvector; +}; + +struct sec { + void *unused; +}; + +struct symbol { + int len; + char *name; +}; + +struct block { + CORE_ADDR startaddr, endaddr; + struct symbol *function; + struct block *superblock; + unsigned char gcc_compile_flag; + int nsyms; + struct symbol syms[1]; +}; + +struct blockvector { + int nblocks; + struct block *block[2]; +}; + +struct blockvector *blockvector_for_pc_sect(register CORE_ADDR pc, + struct symtab *symtab) +{ + register struct block *b; + register int bot, top, half; + struct blockvector *bl; + + bl = symtab->blockvector; + b = bl->block[0]; + + bot = 0; + top = bl->nblocks; + + while (top - bot > 1) + { + half = (top - bot + 1) >> 1; + b = bl->block[bot + half]; + if (b->startaddr <= pc) + bot += half; + else + top = bot + half; + } + + while (bot >= 0) + { + b = bl->block[bot]; + if (b->endaddr > pc) + { + return bl; + } + bot--; + } + return 0; +} + +int main(void) +{ + struct block a = { 0, 0x10000, 0, 0, 1, 20 }; + struct block b = { 0x10000, 0x20000, 0, 0, 1, 20 }; + struct blockvector bv = { 2, { &a, &b } }; + struct symtab s = { &bv }; + + struct blockvector *ret; + + ret = blockvector_for_pc_sect(0x500, &s); + + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20020404-1.c b/gcc/testsuite/gcc.c-torture/execute/20020404-1.c new file mode 100644 index 00000000000..dc62b15bbdd --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20020404-1.c @@ -0,0 +1,102 @@ +/* Extracted from GDB sources. */ + +typedef long long bfd_signed_vma; +typedef bfd_signed_vma file_ptr; + +typedef enum bfd_boolean {false, true} boolean; + +typedef unsigned long long bfd_size_type; + +typedef unsigned int flagword; + +typedef unsigned long long CORE_ADDR; +typedef unsigned long long bfd_vma; + +struct bfd_struct { + int x; +}; + +struct asection_struct { + unsigned int user_set_vma : 1; + bfd_vma vma; + bfd_vma lma; + unsigned int alignment_power; + unsigned int entsize; +}; + +typedef struct bfd_struct bfd; +typedef struct asection_struct asection; + +static bfd * +bfd_openw_with_cleanup (char *filename, const char *target, char *mode); + +static asection * +bfd_make_section_anyway (bfd *abfd, const char *name); + +static boolean +bfd_set_section_size (bfd *abfd, asection *sec, bfd_size_type val); + +static boolean +bfd_set_section_flags (bfd *abfd, asection *sec, flagword flags); + +static boolean +bfd_set_section_contents (bfd *abfd, asection *section, void * data, file_ptr offset, bfd_size_type count); + +static void +dump_bfd_file (char *filename, char *mode, + char *target, CORE_ADDR vaddr, + char *buf, int len) +{ + bfd *obfd; + asection *osection; + + obfd = bfd_openw_with_cleanup (filename, target, mode); + osection = bfd_make_section_anyway (obfd, ".newsec"); + bfd_set_section_size (obfd, osection, len); + (((osection)->vma = (osection)->lma= (vaddr)), ((osection)->user_set_vma = (boolean)true), true); + (((osection)->alignment_power = (0)),true); + bfd_set_section_flags (obfd, osection, 0x203); + osection->entsize = 0; + bfd_set_section_contents (obfd, osection, buf, 0, len); +} + +static bfd * +bfd_openw_with_cleanup (char *filename, const char *target, char *mode) +{ + static bfd foo_bfd = { 0 }; + return &foo_bfd; +} + +static asection * +bfd_make_section_anyway (bfd *abfd, const char *name) +{ + static asection foo_section = { false, 0x0, 0x0, 0 }; + + return &foo_section; +} + +static boolean +bfd_set_section_size (bfd *abfd, asection *sec, bfd_size_type val) +{ + return true; +} + +static boolean +bfd_set_section_flags (bfd *abfd, asection *sec, flagword flags) +{ +} + +static boolean +bfd_set_section_contents (bfd *abfd, asection *section, void * data, file_ptr offset, bfd_size_type count) +{ + if (count != (bfd_size_type)0x1eadbeef) + abort(); +} + +static char hello[] = "hello"; + +int main(void) +{ + dump_bfd_file(0, 0, 0, (CORE_ADDR)0xdeadbeef, hello, (int)0x1eadbeef); + exit(0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20020406-1.c b/gcc/testsuite/gcc.c-torture/execute/20020406-1.c new file mode 100644 index 00000000000..69a82f6589a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20020406-1.c @@ -0,0 +1,126 @@ +// Origin: abbott@dima.unige.it +// PR c/5120 + +extern void * malloc (__SIZE_TYPE__); +extern void * calloc (__SIZE_TYPE__, __SIZE_TYPE__); + +typedef unsigned int FFelem; + +FFelem FFmul(const FFelem x, const FFelem y) +{ + return x; +} + + +struct DUPFFstruct +{ + int maxdeg; + int deg; + FFelem *coeffs; +}; + +typedef struct DUPFFstruct *DUPFF; + + +int DUPFFdeg(const DUPFF f) +{ + return f->deg; +} + + +DUPFF DUPFFnew(const int maxdeg) +{ + DUPFF ans = (DUPFF)malloc(sizeof(struct DUPFFstruct)); + ans->coeffs = 0; + if (maxdeg >= 0) ans->coeffs = (FFelem*)calloc(maxdeg+1,sizeof(FFelem)); + ans->maxdeg = maxdeg; + ans->deg = -1; + return ans; +} + +void DUPFFfree(DUPFF x) +{ +} + +void DUPFFswap(DUPFF x, DUPFF y) +{ +} + + +DUPFF DUPFFcopy(const DUPFF x) +{ + return x; +} + + +void DUPFFshift_add(DUPFF f, const DUPFF g, int deg, const FFelem coeff) +{ +} + + +DUPFF DUPFFexgcd(DUPFF *fcofac, DUPFF *gcofac, const DUPFF f, const DUPFF g) +{ + DUPFF u, v, uf, ug, vf, vg; + FFelem q, lcu, lcvrecip, p; + int df, dg, du, dv; + + printf("DUPFFexgcd called on degrees %d and %d\n", DUPFFdeg(f), DUPFFdeg(g)); + if (DUPFFdeg(f) < DUPFFdeg(g)) return DUPFFexgcd(gcofac, fcofac, g, f); /*** BUG IN THIS LINE ***/ + if (DUPFFdeg(f) != 2 || DUPFFdeg(g) != 1) abort(); + if (f->coeffs[0] == 0) return f; + /****** NEVER REACH HERE IN THE EXAMPLE ******/ + p = 2; + + df = DUPFFdeg(f); if (df < 0) df = 0; /* both inputs are zero */ + dg = DUPFFdeg(g); if (dg < 0) dg = 0; /* one input is zero */ + u = DUPFFcopy(f); + v = DUPFFcopy(g); + + uf = DUPFFnew(dg); uf->coeffs[0] = 1; uf->deg = 0; + ug = DUPFFnew(df); + vf = DUPFFnew(dg); + vg = DUPFFnew(df); vg->coeffs[0] = 1; vg->deg = 0; + + while (DUPFFdeg(v) > 0) + { + dv = DUPFFdeg(v); + lcvrecip = FFmul(1, v->coeffs[dv]); + while (DUPFFdeg(u) >= dv) + { + du = DUPFFdeg(u); + lcu = u->coeffs[du]; + q = FFmul(lcu, lcvrecip); + DUPFFshift_add(u, v, du-dv, p-q); + DUPFFshift_add(uf, vf, du-dv, p-q); + DUPFFshift_add(ug, vg, du-dv, p-q); + } + DUPFFswap(u, v); + DUPFFswap(uf, vf); + DUPFFswap(ug, vg); + } + if (DUPFFdeg(v) == 0) + { + DUPFFswap(u, v); + DUPFFswap(uf, vf); + DUPFFswap(ug, vg); + } + DUPFFfree(vf); + DUPFFfree(vg); + DUPFFfree(v); + *fcofac = uf; + *gcofac = ug; + return u; +} + + + +int main() +{ + DUPFF f, g, cf, cg, h; + f = DUPFFnew(1); f->coeffs[1] = 1; f->deg = 1; + g = DUPFFnew(2); g->coeffs[2] = 1; g->deg = 2; + + printf("calling DUPFFexgcd on degrees %d and %d\n", DUPFFdeg(f), DUPFFdeg(g)) ; + h = DUPFFexgcd(&cf, &cg, f, g); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20020411-1.c b/gcc/testsuite/gcc.c-torture/execute/20020411-1.c new file mode 100644 index 00000000000..89e2bae703b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20020411-1.c @@ -0,0 +1,25 @@ +/* PR optimization/6177 + This testcase ICEd because expr.c did not expect to see a CONCAT + as array rtl. */ + +extern void abort (void); +extern void exit (int); + +__complex__ float foo (void) +{ + __complex__ float f[1]; + __real__ f[0] = 1.0; + __imag__ f[0] = 1.0; + f[0] = __builtin_conjf (f[0]); + return f[0]; +} + +int main (void) +{ + __complex__ double d[1]; + d[0] = foo (); + if (__real__ d[0] != 1.0 + || __imag__ d[0] != -1.0) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20020413-1.c b/gcc/testsuite/gcc.c-torture/execute/20020413-1.c new file mode 100644 index 00000000000..fdef9eed7d5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20020413-1.c @@ -0,0 +1,36 @@ +void test(long double val, int *eval) +{ + long double tmp = 1.0l; + int i = 0; + + if (val < 0.0l) + val = -val; + + if (val >= tmp) + while (tmp < val) + { + tmp *= 2.0l; + if (i++ >= 10) + abort (); + } + else if (val != 0.0l) + while (val < tmp) + { + tmp /= 2.0l; + if (i++ >= 10) + abort (); + } + + *eval = i; +} + +int main(void) +{ + int eval; + + test(3.0, &eval); + test(3.5, &eval); + test(4.0, &eval); + test(5.0, &eval); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20020418-1.c b/gcc/testsuite/gcc.c-torture/execute/20020418-1.c new file mode 100644 index 00000000000..953f96e86ae --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20020418-1.c @@ -0,0 +1,24 @@ +/* ifcvt accidently deletes a referenced label while generating + conditional traps on machines having such patterns */ + +struct foo { int a; }; + +void gcc_crash(struct foo *p) +{ + if (__builtin_expect(p->a < 52, 0)) + __builtin_trap(); + top: + p->a++; + if (p->a >= 62) + goto top; +} + +int main(void) +{ + struct foo x; + + x.a = 53; + gcc_crash(&x); + + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20020423-1.c b/gcc/testsuite/gcc.c-torture/execute/20020423-1.c new file mode 100644 index 00000000000..5f744b6f94a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20020423-1.c @@ -0,0 +1,33 @@ +/* PR c/5430 */ +/* Verify that the multiplicative folding code is not fooled + by the mix between signed variables and unsigned constants. */ + +extern void abort (void); +extern void exit (int); + +int main (void) +{ + int my_int = 924; + unsigned int result; + + result = ((my_int*2 + 4) - 8U) / 2; + if (result != 922U) + abort(); + + result = ((my_int*2 - 4U) + 2) / 2; + if (result != 923U) + abort(); + + result = (((my_int + 2) * 2) - 8U - 4) / 2; + if (result != 920U) + abort(); + result = (((my_int + 2) * 2) - (8U + 4)) / 2; + if (result != 920U) + abort(); + + result = ((my_int*4 + 2U) - 4U) / 2; + if (result != 1847U) + abort(); + + exit(0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20020503-1.c b/gcc/testsuite/gcc.c-torture/execute/20020503-1.c new file mode 100644 index 00000000000..6d45ca09af0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20020503-1.c @@ -0,0 +1,31 @@ +/* PR 6534 */ +/* GCSE unified the two i<0 tests, but if-conversion to ui=abs(i) + insertted the code at the wrong place corrupting the i<0 test. */ + +void abort (void); +static char * +inttostr (long i, char buf[128]) +{ + unsigned long ui = i; + char *p = buf + 127; + *p = '\0'; + if (i < 0) + ui = -ui; + do + *--p = '0' + ui % 10; + while ((ui /= 10) != 0); + if (i < 0) + *--p = '-'; + return p; +} + +int +main () +{ + char buf[128], *p; + + p = inttostr (-1, buf); + if (*p != '-') + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20020529-1.c b/gcc/testsuite/gcc.c-torture/execute/20020529-1.c new file mode 100644 index 00000000000..d1b93c76fdf --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20020529-1.c @@ -0,0 +1,78 @@ +/* PR target/6838 from cato@df.lth.se. + cris-elf got an ICE with -O2: the insn matching + (insn 49 48 52 (parallel[ + (set (mem/s:HI (plus:SI (reg/v/f:SI 0 r0 [24]) + (const_int 8 [0x8])) [5 <variable>.c+0 S2 A8]) + (reg:HI 2 r2 [27])) + (set (reg/f:SI 2 r2 [31]) + (plus:SI (reg/v/f:SI 0 r0 [24]) + (const_int 8 [0x8]))) + ] ) 24 {*mov_sidehi_mem} (nil) + (nil)) + forced a splitter through the output pattern "#", but there was no + matching splitter. */ + +struct xx + { + int a; + struct xx *b; + short c; + }; + +int f1 (struct xx *); +void f2 (void); + +int +foo (struct xx *p, int b, int c, int d) +{ + int a; + + for (;;) + { + a = f1(p); + if (a) + return (0); + if (b) + continue; + p->c = d; + if (p->a) + f2 (); + if (c) + f2 (); + d = p->c; + switch (a) + { + case 1: + if (p->b) + f2 (); + if (c) + f2 (); + default: + break; + } + } + return d; +} + +int main (void) +{ + struct xx s = {0, &s, 23}; + if (foo (&s, 0, 0, 0) != 0 || s.a != 0 || s.b != &s || s.c != 0) + abort (); + exit (0); +} + +int +f1 (struct xx *p) +{ + static int beenhere = 0; + if (beenhere++ > 1) + abort (); + return beenhere > 1; +} + +void +f2 (void) +{ + abort (); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20020611-1.c b/gcc/testsuite/gcc.c-torture/execute/20020611-1.c new file mode 100644 index 00000000000..87fb717cf23 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20020611-1.c @@ -0,0 +1,32 @@ +/* PR target/6997. Missing (set_attr "cc" "none") in sleu pattern in + cris.md. Testcase from hp@axis.com. */ + +int p; +int k; +unsigned int n; + +void x () +{ + unsigned int h; + + h = n <= 30; + if (h) + p = 1; + else + p = 0; + + if (h) + k = 1; + else + k = 0; +} + +unsigned int n = 30; + +main () +{ + x (); + if (p != 1 || k != 1) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20020614-1.c b/gcc/testsuite/gcc.c-torture/execute/20020614-1.c new file mode 100644 index 00000000000..bcbaed8ae8e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20020614-1.c @@ -0,0 +1,41 @@ +/* PR c/6677 */ +/* Verify that GCC doesn't perform illegal simplifications + when folding constants. */ + +#include <limits.h> + +extern void abort (void); +extern void exit (int); + +int main (void) +{ + int i; + signed char j; + unsigned char k; + + i = SCHAR_MAX; + + j = ((signed char) (i << 1)) / 2; + + if (j != -1) + abort(); + + j = ((signed char) (i * 2)) / 2; + + if (j != -1) + abort(); + + i = UCHAR_MAX; + + k = ((unsigned char) (i << 1)) / 2; + + if (k != UCHAR_MAX/2) + abort(); + + k = ((unsigned char) (i * 2)) / 2; + + if (k != UCHAR_MAX/2) + abort(); + + exit(0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20020615-1.c b/gcc/testsuite/gcc.c-torture/execute/20020615-1.c new file mode 100644 index 00000000000..3dabfdc9f3c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20020615-1.c @@ -0,0 +1,59 @@ +/* PR target/7042. When reorg.c changed branches into return insns, it + completely forgot about any current_function_epilogue_delay_list and + dropped those insns. Uncovered on cris-axis-elf, where an insn in an + epilogue delay-slot set the return-value register with the test-case + below. Derived from ghostscript-6.52 (GPL) by hp@axis.com. */ + +typedef struct font_hints_s { + int axes_swapped; + int x_inverted, y_inverted; +} font_hints; +typedef struct gs_fixed_point_s { + long x, y; +} gs_fixed_point; + +int +line_hints(const font_hints *fh, const gs_fixed_point *p0, + const gs_fixed_point *p1) +{ + long dx = p1->x - p0->x; + long dy = p1->y - p0->y; + long adx, ady; + int xi = fh->x_inverted, yi = fh->y_inverted; + int hints; + if (xi) + dx = -dx; + if (yi) + dy = -dy; + if (fh->axes_swapped) { + long t = dx; + int ti = xi; + dx = dy, xi = yi; + dy = t, yi = ti; + } + adx = dx < 0 ? -dx : dx; + ady = dy < 0 ? -dy : dy; + if (dy != 0 && (adx <= ady >> 4)) { + hints = dy > 0 ? 2 : 1; + if (xi) + hints ^= 3; + } else if (dx != 0 && (ady <= adx >> 4)) { + hints = dx < 0 ? 8 : 4; + if (yi) + hints ^= 12; + } else + hints = 0; + return hints; +} +int main () +{ + static font_hints fh[] = {{0, 1, 0}, {0, 0, 1}, {0, 0, 0}}; + static gs_fixed_point gsf[] + = {{0x30000, 0x13958}, {0x30000, 0x18189}, + {0x13958, 0x30000}, {0x18189, 0x30000}}; + if (line_hints (fh, gsf, gsf + 1) != 1 + || line_hints (fh + 1, gsf + 2, gsf + 3) != 8 + || line_hints (fh + 2, gsf + 2, gsf + 3) != 4) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20020619-1.c b/gcc/testsuite/gcc.c-torture/execute/20020619-1.c new file mode 100644 index 00000000000..5ed4d00b01d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20020619-1.c @@ -0,0 +1,32 @@ +static int ref(void) +{ + union { + char c[5]; + int i; + } u; + + __builtin_memset (&u, 0, sizeof(u)); + u.c[0] = 1; + u.c[1] = 2; + u.c[2] = 3; + u.c[3] = 4; + + return u.i; +} + +#define MAX(a,b) (a < b ? b : a) + +static int test(void) +{ + char c[MAX(5, sizeof(int))] __attribute__((aligned)) = { 1, 2, 3, 4 }; + return *(int *)c; +} + +int main() +{ + int a = test(); + int b = ref(); + if (a != b) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20020716-1.c b/gcc/testsuite/gcc.c-torture/execute/20020716-1.c new file mode 100644 index 00000000000..7f559590e9a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20020716-1.c @@ -0,0 +1,36 @@ +extern void abort (void); +extern void exit (int); + +int sub1 (int val) +{ + return val; +} + +int testcond (int val) +{ + int flag1; + + { + int t1 = val; + { + int t2 = t1; + { + flag1 = sub1 (t2) ==0; + goto lab1; + }; + } + lab1: ; + } + + if (flag1 != 0) + return 0x4d0000; + else + return 0; +} + +int main (void) +{ + if (testcond (1)) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/980707-1.c b/gcc/testsuite/gcc.c-torture/execute/980707-1.c index 3af163a3767..5095abe46e1 100644 --- a/gcc/testsuite/gcc.c-torture/execute/980707-1.c +++ b/gcc/testsuite/gcc.c-torture/execute/980707-1.c @@ -1,5 +1,4 @@ -#include <stdio.h> -#include <ctype.h> +#include <stdlib.h> #include <string.h> char ** @@ -10,12 +9,12 @@ buildargv (char *input) while (1) { - while (isspace ((unsigned char)*input) && *input != 0) + while (*input == ' ') input++; if (*input == 0) break; arglist [numargs++] = input; - while (!isspace ((unsigned char)*input) && *input != 0) + while (*input != ' ' && *input != 0) input++; if (*input == 0) break; diff --git a/gcc/testsuite/gcc.c-torture/execute/alloca-1.c b/gcc/testsuite/gcc.c-torture/execute/alloca-1.c new file mode 100644 index 00000000000..a8d1384c6ec --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/alloca-1.c @@ -0,0 +1,21 @@ +/* Verify that alloca storage is sufficiently aligned. */ +/* ??? May fail if BIGGEST_ALIGNMENT > STACK_BOUNDARY. Which, I guess + can only happen on !STRICT_ALIGNMENT targets. */ + +typedef __SIZE_TYPE__ size_t; + +struct dummy { int x __attribute__((aligned)); }; +#define BIGGEST_ALIGNMENT __alignof__(struct dummy) + +_Bool foo(void) +{ + char *p = __builtin_alloca(32); + return ((size_t)p & (BIGGEST_ALIGNMENT - 1)) == 0; +} + +int main() +{ + if (!foo()) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/complex-6.c b/gcc/testsuite/gcc.c-torture/execute/complex-6.c new file mode 100644 index 00000000000..bbb8c8d40aa --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/complex-6.c @@ -0,0 +1,59 @@ +/* This test tests complex conjugate and passing/returning of + complex parameter. */ + +#include <stdlib.h> +#include <stdio.h> + +int err; + +#define TEST(TYPE, FUNC) \ +__complex__ TYPE \ +ctest_ ## FUNC (__complex__ TYPE x) \ +{ \ + __complex__ TYPE res; \ + \ + res = ~x; \ + \ + return res; \ +} \ + \ +void \ +test_ ## FUNC (void) \ +{ \ + __complex__ TYPE res, x; \ + \ + x = 1.0 + 2.0i; \ + \ + res = ctest_ ## FUNC (x); \ + \ + if (res != 1.0 - 2.0i) \ + { \ + printf ("test_" #FUNC " failed\n"); \ + ++err; \ + } \ +} + + +TEST(float, float) +TEST(double, double) +TEST(long double, long_double) +TEST(int, int) +TEST(long int, long_int) + +int +main (void) +{ + + err = 0; + + test_float (); + test_double (); + test_long_double (); + test_int (); + test_long_int (); + + if (err != 0) + abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/loop-12.c b/gcc/testsuite/gcc.c-torture/execute/loop-12.c new file mode 100644 index 00000000000..1e340990cdd --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/loop-12.c @@ -0,0 +1,25 @@ +/* Checks that pure functions are not treated as const. */ + +char *p; + +static int __attribute__ ((pure)) +is_end_of_statement (void) +{ + return *p == '\n' || *p == ';' || *p == '!'; +} + +void foo (void) +{ + /* The is_end_of_statement call was moved out of the loop at one stage, + resulting in an endless loop. */ + while (!is_end_of_statement ()) + p++; +} + +int +main (void) +{ + p = "abc\n"; + foo (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/loop-2c.x b/gcc/testsuite/gcc.c-torture/execute/loop-2c.x deleted file mode 100644 index a98f54941c5..00000000000 --- a/gcc/testsuite/gcc.c-torture/execute/loop-2c.x +++ /dev/null @@ -1,13 +0,0 @@ -if { [istarget "i686-*"] } { - set torture_eval_before_execute { - global compiler_conditional_xfail_data - set compiler_conditional_xfail_data { - "Loop optimiser bug" \ - "i686-*" \ - { "-Os" } \ - { "" } - } - } -} - -return 0 diff --git a/gcc/testsuite/gcc.c-torture/execute/loop-2d.x b/gcc/testsuite/gcc.c-torture/execute/loop-2d.x deleted file mode 100644 index a98f54941c5..00000000000 --- a/gcc/testsuite/gcc.c-torture/execute/loop-2d.x +++ /dev/null @@ -1,13 +0,0 @@ -if { [istarget "i686-*"] } { - set torture_eval_before_execute { - global compiler_conditional_xfail_data - set compiler_conditional_xfail_data { - "Loop optimiser bug" \ - "i686-*" \ - { "-Os" } \ - { "" } - } - } -} - -return 0 diff --git a/gcc/testsuite/gcc.c-torture/execute/va-arg-22.c b/gcc/testsuite/gcc.c-torture/execute/va-arg-22.c new file mode 100644 index 00000000000..46b8dcbe825 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/va-arg-22.c @@ -0,0 +1,78 @@ +#include <stdarg.h> + +extern void abort (void); +extern void exit (int); + +void bar (int n, int c) +{ + static int lastn = -1, lastc = -1; + + if (lastn != n) + { + if (lastc != lastn) + abort (); + lastc = 0; + lastn = n; + } + + if (c != (char) (lastc ^ (n << 3))) + abort (); + lastc++; +} + +#define D(N) typedef struct { char x[N]; } A##N; +D(0) D(1) D(2) D(3) D(4) D(5) D(6) D(7) +D(8) D(9) D(10) D(11) D(12) D(13) D(14) D(15) +D(16) D(31) D(32) D(35) D(72) +#undef D + +void foo (int size, ...) +{ +#define D(N) A##N a##N; +D(0) D(1) D(2) D(3) D(4) D(5) D(6) D(7) +D(8) D(9) D(10) D(11) D(12) D(13) D(14) D(15) +D(16) D(31) D(32) D(35) D(72) +#undef D + va_list ap; + int i; + + if (size != 21) + abort (); + va_start (ap, size); +#define D(N) \ + a##N = va_arg (ap, typeof (a##N)); \ + for (i = 0; i < N; i++) \ + bar (N, a##N.x[i]); +D(0) D(1) D(2) D(3) D(4) D(5) D(6) D(7) +D(8) D(9) D(10) D(11) D(12) D(13) D(14) D(15) +D(16) D(31) D(32) D(35) D(72) +#undef D + va_end (ap); +} + +int main (void) +{ +#define D(N) A##N a##N; +D(0) D(1) D(2) D(3) D(4) D(5) D(6) D(7) +D(8) D(9) D(10) D(11) D(12) D(13) D(14) D(15) +D(16) D(31) D(32) D(35) D(72) +#undef D + int i; + +#define D(N) \ + for (i = 0; i < N; i++) \ + a##N.x[i] = i ^ (N << 3); +D(0) D(1) D(2) D(3) D(4) D(5) D(6) D(7) +D(8) D(9) D(10) D(11) D(12) D(13) D(14) D(15) +D(16) D(31) D(32) D(35) D(72) +#undef D + + foo (21 +#define D(N) , a##N +D(0) D(1) D(2) D(3) D(4) D(5) D(6) D(7) +D(8) D(9) D(10) D(11) D(12) D(13) D(14) D(15) +D(16) D(31) D(32) D(35) D(72) +#undef D + ); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/wchar_t-1.c b/gcc/testsuite/gcc.c-torture/execute/wchar_t-1.c new file mode 100644 index 00000000000..51f91d6ad46 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/wchar_t-1.c @@ -0,0 +1,16 @@ +typedef __WCHAR_TYPE__ wchar_t; +wchar_t x[] = L"Ä"; +wchar_t y = L'Ä'; +extern void abort (void); +extern void exit (int); + +int main (void) +{ + if (sizeof (x) / sizeof (wchar_t) != 2) + abort (); + if (x[0] != L'Ä' || x[1] != L'\0') + abort (); + if (y != L'Ä') + abort (); + exit (0); +} |