S/390: Allow immediates in loc expander
[official-gcc.git] / gcc / testsuite / gcc.dg / redecl-3.c
blob3181712f0c9e0ba894c5b8a33a0950dc15dfd354
1 /* Test for multiple declarations and composite types. Includes bug
2 13801. */
3 /* Origin: Joseph Myers <jsm@polyomino.org.uk> */
4 /* { dg-do compile } */
5 /* { dg-options "-g" } */
7 typedef int IA[];
8 typedef int A10[10];
10 /* Test all combinations of: a variable declared at file scope (no
11 type specifiers, or extern, or static), or just inside a function
12 (with extern), redeclared in an inner scope (with extern), and
13 redeclared in an inner scope when the previous declaration is
14 hidden (with extern, and not if the original declaration was
15 static). Test three times: incomplete variable types; pointers to
16 incomplete types; functions returning such pointers. */
18 IA a0;
19 void
20 f0 (void)
22 sizeof(a0); /* { dg-error "incomplete" } */
24 extern IA a0;
25 sizeof(a0); /* { dg-error "incomplete" } */
27 int a0;
29 extern IA a0;
30 sizeof(a0); /* { dg-error "incomplete" } */
33 sizeof(a0); /* { dg-error "incomplete" } */
35 sizeof(a0); /* { dg-error "incomplete" } */
37 extern A10 a0;
39 IA a1;
40 void
41 f1 (void)
43 sizeof(a1); /* { dg-error "incomplete" } */
45 extern IA a1;
46 sizeof(a1); /* { dg-error "incomplete" } */
48 int a1;
50 extern A10 a1;
51 sizeof(a1);
54 sizeof(a1); /* { dg-error "incomplete" } */
56 sizeof(a1); /* { dg-error "incomplete" } */
58 extern A10 a1;
60 IA a2;
61 void
62 f2 (void)
64 sizeof(a2); /* { dg-error "incomplete" } */
66 extern A10 a2;
67 sizeof(a2);
69 int a2;
71 extern IA a2;
72 sizeof(a2); /* { dg-error "incomplete" } */
75 sizeof(a2);
77 sizeof(a2); /* { dg-error "incomplete" } */
79 extern A10 a2;
81 IA a3;
82 void
83 f3 (void)
85 sizeof(a3); /* { dg-error "incomplete" } */
87 extern A10 a3;
88 sizeof(a3);
90 int a3;
92 extern A10 a3;
93 sizeof(a3);
96 sizeof(a3);
98 sizeof(a3); /* { dg-error "incomplete" } */
100 extern A10 a3;
102 A10 a4;
103 void
104 f4 (void)
106 sizeof(a4);
108 extern IA a4;
109 sizeof(a4);
111 int a4;
113 extern IA a4;
114 sizeof(a4); /* { dg-error "incomplete" } */
117 sizeof(a4);
119 sizeof(a4);
121 extern A10 a4;
123 A10 a5;
124 void
125 f5 (void)
127 sizeof(a5);
129 extern IA a5;
130 sizeof(a5);
132 int a5;
134 extern A10 a5;
135 sizeof(a5);
138 sizeof(a5);
140 sizeof(a5);
142 extern A10 a5;
144 A10 a6;
145 void
146 f6 (void)
148 sizeof(a6);
150 extern A10 a6;
151 sizeof(a6);
153 int a6;
155 extern IA a6;
156 sizeof(a6); /* { dg-error "incomplete" } */
159 sizeof(a6);
161 sizeof(a6);
163 extern A10 a6;
165 A10 a7;
166 void
167 f7 (void)
169 sizeof(a7);
171 extern A10 a7;
172 sizeof(a7);
174 int a7;
176 extern A10 a7;
177 sizeof(a7);
180 sizeof(a7);
182 sizeof(a7);
184 extern A10 a7;
186 extern IA a8;
187 void
188 f8 (void)
190 sizeof(a8); /* { dg-error "incomplete" } */
192 extern IA a8;
193 sizeof(a8); /* { dg-error "incomplete" } */
195 int a8;
197 extern IA a8;
198 sizeof(a8); /* { dg-error "incomplete" } */
201 sizeof(a8); /* { dg-error "incomplete" } */
203 sizeof(a8); /* { dg-error "incomplete" } */
205 extern A10 a8;
207 extern IA a9;
208 void
209 f9 (void)
211 sizeof(a9); /* { dg-error "incomplete" } */
213 extern IA a9;
214 sizeof(a9); /* { dg-error "incomplete" } */
216 int a9;
218 extern A10 a9;
219 sizeof(a9);
222 sizeof(a9); /* { dg-error "incomplete" } */
224 sizeof(a9); /* { dg-error "incomplete" } */
226 extern A10 a9;
228 extern IA a10;
229 void
230 f10 (void)
232 sizeof(a10); /* { dg-error "incomplete" } */
234 extern A10 a10;
235 sizeof(a10);
237 int a10;
239 extern IA a10;
240 sizeof(a10); /* { dg-error "incomplete" } */
243 sizeof(a10);
245 sizeof(a10); /* { dg-error "incomplete" } */
247 extern A10 a10;
249 extern IA a11;
250 void
251 f11 (void)
253 sizeof(a11); /* { dg-error "incomplete" } */
255 extern A10 a11;
256 sizeof(a11);
258 int a11;
260 extern A10 a11;
261 sizeof(a11);
264 sizeof(a11);
266 sizeof(a11); /* { dg-error "incomplete" } */
268 extern A10 a11;
270 extern A10 a12;
271 void
272 f12 (void)
274 sizeof(a12);
276 extern IA a12;
277 sizeof(a12);
279 int a12;
281 extern IA a12;
282 sizeof(a12); /* { dg-error "incomplete" } */
285 sizeof(a12);
287 sizeof(a12);
289 extern A10 a12;
291 extern A10 a13;
292 void
293 f13 (void)
295 sizeof(a13);
297 extern IA a13;
298 sizeof(a13);
300 int a13;
302 extern A10 a13;
303 sizeof(a13);
306 sizeof(a13);
308 sizeof(a13);
310 extern A10 a13;
312 extern A10 a14;
313 void
314 f14 (void)
316 sizeof(a14);
318 extern A10 a14;
319 sizeof(a14);
321 int a14;
323 extern IA a14;
324 sizeof(a14); /* { dg-error "incomplete" } */
327 sizeof(a14);
329 sizeof(a14);
331 extern A10 a14;
333 extern A10 a15;
334 void
335 f15 (void)
337 sizeof(a15);
339 extern A10 a15;
340 sizeof(a15);
342 int a15;
344 extern A10 a15;
345 sizeof(a15);
348 sizeof(a15);
350 sizeof(a15);
352 extern A10 a15;
354 static IA a16;
355 void
356 f16 (void)
358 sizeof(a16); /* { dg-error "incomplete" } */
360 extern IA a16;
361 sizeof(a16); /* { dg-error "incomplete" } */
363 sizeof(a16); /* { dg-error "incomplete" } */
365 extern A10 a16;
367 static IA a17;
368 void
369 f17 (void)
371 sizeof(a17); /* { dg-error "incomplete" } */
373 extern A10 a17;
374 sizeof(a17);
376 sizeof(a17); /* { dg-error "incomplete" } */
378 extern A10 a17;
380 static A10 a18;
381 void
382 f18 (void)
384 sizeof(a18);
386 extern IA a18;
387 sizeof(a18);
389 sizeof(a18);
391 extern A10 a18;
393 static A10 a19;
394 void
395 f19 (void)
397 sizeof(a19);
399 extern A10 a19;
400 sizeof(a19);
402 sizeof(a19);
404 extern A10 a19;
406 IA *b0;
407 void
408 g0 (void)
410 sizeof(*b0); /* { dg-error "incomplete" } */
412 extern IA *b0;
413 sizeof(*b0); /* { dg-error "incomplete" } */
415 int b0;
417 extern IA *b0;
418 sizeof(*b0); /* { dg-error "incomplete" } */
421 sizeof(*b0); /* { dg-error "incomplete" } */
423 sizeof(*b0); /* { dg-error "incomplete" } */
425 extern A10 *b0;
427 IA *b1;
428 void
429 g1 (void)
431 sizeof(*b1); /* { dg-error "incomplete" } */
433 extern IA *b1;
434 sizeof(*b1); /* { dg-error "incomplete" } */
436 int b1;
438 extern A10 *b1;
439 sizeof(*b1);
442 sizeof(*b1); /* { dg-error "incomplete" } */
444 sizeof(*b1); /* { dg-error "incomplete" } */
446 extern A10 *b1;
448 IA *b2;
449 void
450 g2 (void)
452 sizeof(*b2); /* { dg-error "incomplete" } */
454 extern A10 *b2;
455 sizeof(*b2);
457 int b2;
459 extern IA *b2;
460 sizeof(*b2); /* { dg-error "incomplete" } */
463 sizeof(*b2);
465 sizeof(*b2); /* { dg-error "incomplete" } */
467 extern A10 *b2;
469 IA *b3;
470 void
471 g3 (void)
473 sizeof(*b3); /* { dg-error "incomplete" } */
475 extern A10 *b3;
476 sizeof(*b3);
478 int b3;
480 extern A10 *b3;
481 sizeof(*b3);
484 sizeof(*b3);
486 sizeof(*b3); /* { dg-error "incomplete" } */
488 extern A10 *b3;
490 A10 *b4;
491 void
492 g4 (void)
494 sizeof(*b4);
496 extern IA *b4;
497 sizeof(*b4);
499 int b4;
501 extern IA *b4;
502 sizeof(*b4); /* { dg-error "incomplete" } */
505 sizeof(*b4);
507 sizeof(*b4);
509 extern A10 *b4;
511 A10 *b5;
512 void
513 g5 (void)
515 sizeof(*b5);
517 extern IA *b5;
518 sizeof(*b5);
520 int b5;
522 extern A10 *b5;
523 sizeof(*b5);
526 sizeof(*b5);
528 sizeof(*b5);
530 extern A10 *b5;
532 A10 *b6;
533 void
534 g6 (void)
536 sizeof(*b6);
538 extern A10 *b6;
539 sizeof(*b6);
541 int b6;
543 extern IA *b6;
544 sizeof(*b6); /* { dg-error "incomplete" } */
547 sizeof(*b6);
549 sizeof(*b6);
551 extern A10 *b6;
553 A10 *b7;
554 void
555 g7 (void)
557 sizeof(*b7);
559 extern A10 *b7;
560 sizeof(*b7);
562 int b7;
564 extern A10 *b7;
565 sizeof(*b7);
568 sizeof(*b7);
570 sizeof(*b7);
572 extern A10 *b7;
574 extern IA *b8;
575 void
576 g8 (void)
578 sizeof(*b8); /* { dg-error "incomplete" } */
580 extern IA *b8;
581 sizeof(*b8); /* { dg-error "incomplete" } */
583 int b8;
585 extern IA *b8;
586 sizeof(*b8); /* { dg-error "incomplete" } */
589 sizeof(*b8); /* { dg-error "incomplete" } */
591 sizeof(*b8); /* { dg-error "incomplete" } */
593 extern A10 *b8;
595 extern IA *b9;
596 void
597 g9 (void)
599 sizeof(*b9); /* { dg-error "incomplete" } */
601 extern IA *b9;
602 sizeof(*b9); /* { dg-error "incomplete" } */
604 int b9;
606 extern A10 *b9;
607 sizeof(*b9);
610 sizeof(*b9); /* { dg-error "incomplete" } */
612 sizeof(*b9); /* { dg-error "incomplete" } */
614 extern A10 *b9;
616 extern IA *b10;
617 void
618 g10 (void)
620 sizeof(*b10); /* { dg-error "incomplete" } */
622 extern A10 *b10;
623 sizeof(*b10);
625 int b10;
627 extern IA *b10;
628 sizeof(*b10); /* { dg-error "incomplete" } */
631 sizeof(*b10);
633 sizeof(*b10); /* { dg-error "incomplete" } */
635 extern A10 *b10;
637 extern IA *b11;
638 void
639 g11 (void)
641 sizeof(*b11); /* { dg-error "incomplete" } */
643 extern A10 *b11;
644 sizeof(*b11);
646 int b11;
648 extern A10 *b11;
649 sizeof(*b11);
652 sizeof(*b11);
654 sizeof(*b11); /* { dg-error "incomplete" } */
656 extern A10 *b11;
658 extern A10 *b12;
659 void
660 g12 (void)
662 sizeof(*b12);
664 extern IA *b12;
665 sizeof(*b12);
667 int b12;
669 extern IA *b12;
670 sizeof(*b12); /* { dg-error "incomplete" } */
673 sizeof(*b12);
675 sizeof(*b12);
677 extern A10 *b12;
679 extern A10 *b13;
680 void
681 g13 (void)
683 sizeof(*b13);
685 extern IA *b13;
686 sizeof(*b13);
688 int b13;
690 extern A10 *b13;
691 sizeof(*b13);
694 sizeof(*b13);
696 sizeof(*b13);
698 extern A10 *b13;
700 extern A10 *b14;
701 void
702 g14 (void)
704 sizeof(*b14);
706 extern A10 *b14;
707 sizeof(*b14);
709 int b14;
711 extern IA *b14;
712 sizeof(*b14); /* { dg-error "incomplete" } */
715 sizeof(*b14);
717 sizeof(*b14);
719 extern A10 *b14;
721 extern A10 *b15;
722 void
723 g15 (void)
725 sizeof(*b15);
727 extern A10 *b15;
728 sizeof(*b15);
730 int b15;
732 extern A10 *b15;
733 sizeof(*b15);
736 sizeof(*b15);
738 sizeof(*b15);
740 extern A10 *b15;
742 static IA *b16;
743 void
744 g16 (void)
746 sizeof(*b16); /* { dg-error "incomplete" } */
748 extern IA *b16;
749 sizeof(*b16); /* { dg-error "incomplete" } */
751 sizeof(*b16); /* { dg-error "incomplete" } */
753 extern A10 *b16;
755 static IA *b17;
756 void
757 g17 (void)
759 sizeof(*b17); /* { dg-error "incomplete" } */
761 extern A10 *b17;
762 sizeof(*b17);
764 sizeof(*b17); /* { dg-error "incomplete" } */
766 extern A10 *b17;
768 static A10 *b18;
769 void
770 g18 (void)
772 sizeof(*b18);
774 extern IA *b18;
775 sizeof(*b18);
777 sizeof(*b18);
779 extern A10 *b18;
781 static A10 *b19;
782 void
783 g19 (void)
785 sizeof(*b19);
787 extern A10 *b19;
788 sizeof(*b19);
790 sizeof(*b19);
792 extern A10 *b19;
794 IA *c0 (void);
795 void
796 h0 (void)
798 sizeof(*c0()); /* { dg-error "incomplete" } */
800 extern IA *c0 (void);
801 sizeof(*c0()); /* { dg-error "incomplete" } */
803 int c0;
805 extern IA *c0 (void);
806 sizeof(*c0()); /* { dg-error "incomplete" } */
809 sizeof(*c0()); /* { dg-error "incomplete" } */
811 sizeof(*c0()); /* { dg-error "incomplete" } */
813 A10 *c0 (void) { return 0; }
815 IA *c1 (void);
816 void
817 h1 (void)
819 sizeof(*c1()); /* { dg-error "incomplete" } */
821 extern IA *c1 (void);
822 sizeof(*c1()); /* { dg-error "incomplete" } */
824 int c1;
826 extern A10 *c1 (void);
827 sizeof(*c1());
830 sizeof(*c1()); /* { dg-error "incomplete" } */
832 sizeof(*c1()); /* { dg-error "incomplete" } */
834 A10 *c1 (void) { return 0; }
836 IA *c2 (void);
837 void
838 h2 (void)
840 sizeof(*c2()); /* { dg-error "incomplete" } */
842 extern A10 *c2 (void);
843 sizeof(*c2());
845 int c2;
847 extern IA *c2 (void);
848 sizeof(*c2()); /* { dg-error "incomplete" } */
851 sizeof(*c2());
853 sizeof(*c2()); /* { dg-error "incomplete" } */
855 A10 *c2 (void) { return 0; }
857 IA *c3 (void);
858 void
859 h3 (void)
861 sizeof(*c3()); /* { dg-error "incomplete" } */
863 extern A10 *c3 (void);
864 sizeof(*c3());
866 int c3;
868 extern A10 *c3 (void);
869 sizeof(*c3());
872 sizeof(*c3());
874 sizeof(*c3()); /* { dg-error "incomplete" } */
876 A10 *c3 (void) { return 0; }
878 A10 *c4 (void);
879 void
880 h4 (void)
882 sizeof(*c4());
884 extern IA *c4 (void);
885 sizeof(*c4());
887 int c4;
889 extern IA *c4 (void);
890 sizeof(*c4()); /* { dg-error "incomplete" } */
893 sizeof(*c4());
895 sizeof(*c4());
897 A10 *c4 (void) { return 0; }
899 A10 *c5 (void);
900 void
901 h5 (void)
903 sizeof(*c5());
905 extern IA *c5 (void);
906 sizeof(*c5());
908 int c5;
910 extern A10 *c5 (void);
911 sizeof(*c5());
914 sizeof(*c5());
916 sizeof(*c5());
918 A10 *c5 (void) { return 0; }
920 A10 *c6 (void);
921 void
922 h6 (void)
924 sizeof(*c6());
926 extern A10 *c6 (void);
927 sizeof(*c6());
929 int c6;
931 extern IA *c6 (void);
932 sizeof(*c6()); /* { dg-error "incomplete" } */
935 sizeof(*c6());
937 sizeof(*c6());
939 A10 *c6 (void) { return 0; }
941 A10 *c7 (void);
942 void
943 h7 (void)
945 sizeof(*c7());
947 extern A10 *c7 (void);
948 sizeof(*c7());
950 int c7;
952 extern A10 *c7 (void);
953 sizeof(*c7());
956 sizeof(*c7());
958 sizeof(*c7());
960 A10 *c7 (void) { return 0; }
962 extern IA *c8 (void);
963 void
964 h8 (void)
966 sizeof(*c8()); /* { dg-error "incomplete" } */
968 extern IA *c8 (void);
969 sizeof(*c8()); /* { dg-error "incomplete" } */
971 int c8;
973 extern IA *c8 (void);
974 sizeof(*c8()); /* { dg-error "incomplete" } */
977 sizeof(*c8()); /* { dg-error "incomplete" } */
979 sizeof(*c8()); /* { dg-error "incomplete" } */
981 extern A10 *c8 (void) { return 0; }
983 extern IA *c9 (void);
984 void
985 h9 (void)
987 sizeof(*c9()); /* { dg-error "incomplete" } */
989 extern IA *c9 (void);
990 sizeof(*c9()); /* { dg-error "incomplete" } */
992 int c9;
994 extern A10 *c9 (void);
995 sizeof(*c9());
998 sizeof(*c9()); /* { dg-error "incomplete" } */
1000 sizeof(*c9()); /* { dg-error "incomplete" } */
1002 extern A10 *c9 (void) { return 0; }
1004 extern IA *c10 (void);
1005 void
1006 h10 (void)
1008 sizeof(*c10()); /* { dg-error "incomplete" } */
1010 extern A10 *c10 (void);
1011 sizeof(*c10());
1013 int c10;
1015 extern IA *c10 (void);
1016 sizeof(*c10()); /* { dg-error "incomplete" } */
1019 sizeof(*c10());
1021 sizeof(*c10()); /* { dg-error "incomplete" } */
1023 extern A10 *c10 (void) { return 0; }
1025 extern IA *c11 (void);
1026 void
1027 h11 (void)
1029 sizeof(*c11()); /* { dg-error "incomplete" } */
1031 extern A10 *c11 (void);
1032 sizeof(*c11());
1034 int c11;
1036 extern A10 *c11 (void);
1037 sizeof(*c11());
1040 sizeof(*c11());
1042 sizeof(*c11()); /* { dg-error "incomplete" } */
1044 extern A10 *c11 (void) { return 0; }
1046 extern A10 *c12 (void);
1047 void
1048 h12 (void)
1050 sizeof(*c12());
1052 extern IA *c12 (void);
1053 sizeof(*c12());
1055 int c12;
1057 extern IA *c12 (void);
1058 sizeof(*c12()); /* { dg-error "incomplete" } */
1061 sizeof(*c12());
1063 sizeof(*c12());
1065 extern A10 *c12 (void) { return 0; }
1067 extern A10 *c13 (void);
1068 void
1069 h13 (void)
1071 sizeof(*c13());
1073 extern IA *c13 (void);
1074 sizeof(*c13());
1076 int c13;
1078 extern A10 *c13 (void);
1079 sizeof(*c13());
1082 sizeof(*c13());
1084 sizeof(*c13());
1086 extern A10 *c13 (void) { return 0; }
1088 extern A10 *c14 (void);
1089 void
1090 h14 (void)
1092 sizeof(*c14());
1094 extern A10 *c14 (void);
1095 sizeof(*c14());
1097 int c14;
1099 extern IA *c14 (void);
1100 sizeof(*c14()); /* { dg-error "incomplete" } */
1103 sizeof(*c14());
1105 sizeof(*c14());
1107 extern A10 *c14 (void) { return 0; }
1109 extern A10 *c15 (void);
1110 void
1111 h15 (void)
1113 sizeof(*c15());
1115 extern A10 *c15 (void);
1116 sizeof(*c15());
1118 int c15;
1120 extern A10 *c15 (void);
1121 sizeof(*c15());
1124 sizeof(*c15());
1126 sizeof(*c15());
1128 extern A10 *c15 (void) { return 0; }
1130 static IA *c16 (void);
1131 void
1132 h16 (void)
1134 sizeof(*c16()); /* { dg-error "incomplete" } */
1136 extern IA *c16 (void);
1137 sizeof(*c16()); /* { dg-error "incomplete" } */
1139 sizeof(*c16()); /* { dg-error "incomplete" } */
1141 static A10 *c16 (void) { return 0; }
1143 static IA *c17 (void);
1144 void
1145 h17 (void)
1147 sizeof(*c17()); /* { dg-error "incomplete" } */
1149 extern A10 *c17 (void);
1150 sizeof(*c17());
1152 sizeof(*c17()); /* { dg-error "incomplete" } */
1154 static A10 *c17 (void) { return 0; }
1156 static A10 *c18 (void);
1157 void
1158 h18 (void)
1160 sizeof(*c18());
1162 extern IA *c18 (void);
1163 sizeof(*c18());
1165 sizeof(*c18());
1167 static A10 *c18 (void) { return 0; }
1169 static A10 *c19 (void);
1170 void
1171 h19 (void)
1173 sizeof(*c19());
1175 extern A10 *c19 (void);
1176 sizeof(*c19());
1178 sizeof(*c19());
1180 static A10 *c19 (void) { return 0; }