]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
C99 testsuite readiness: Some verified test case adjustments
authorFlorian Weimer <fweimer@redhat.com>
Fri, 13 Oct 2023 07:34:55 +0000 (09:34 +0200)
committerFlorian Weimer <fweimer@redhat.com>
Fri, 13 Oct 2023 07:37:03 +0000 (09:37 +0200)
The updated test cases still reproduce the bugs with old compilers.

gcc/testsuite/

* gcc.c-torture/compile/pc44485.c (func_21): Add missing cast.
* gcc.c-torture/compile/pr106101.c: Use builtins to avoid
calls to undeclared functions.  Change type of yyvsp to
char ** and introduce yyvsp1 to avoid type errors.
* gcc.c-torture/execute/pr111331-1.c: Add missing int.
* gcc.dg/pr100512.c: Unreduce test case and suppress only
-Wpointer-to-int-cast.
* gcc.dg/pr103003.c: Likewise.
* gcc.dg/pr103451.c: Add cast to long and suppress
-Wdiv-by-zero only.
* gcc.dg/pr68435.c: Avoid implicit int and missing
static function implementation warning.

gcc/testsuite/gcc.c-torture/compile/pc44485.c
gcc/testsuite/gcc.c-torture/compile/pr106101.c
gcc/testsuite/gcc.c-torture/execute/pr111331-1.c
gcc/testsuite/gcc.dg/pr100512.c
gcc/testsuite/gcc.dg/pr103003.c
gcc/testsuite/gcc.dg/pr103451.c
gcc/testsuite/gcc.dg/pr68435.c

index fc959257dd3cb87b88dff629b617ea9726fdc821..51c69894c5461fd127e2d33603b59e5d282a0257 100644 (file)
@@ -39,7 +39,7 @@ lbl_28:for (p_25 = 0; p_25 < 9; p_25 += 1)
     if (p_25)
       goto lbl_29;
   unsigned short l_53;
-  for (0; l_53; l_53 = foo)
+  for (0; l_53; l_53 = (unsigned short) foo)
     {
     }
   return 0;
index dec66081f25e9314c871d5d7176a3c636b32ac37..e307afcbccc709069cea33e4320f56d241118c67 100644 (file)
@@ -24,10 +24,9 @@ static const int yycheck[] =
 };
 
 
-int yyparse (void)
+int yyparse (char **yyvsp, char *yyvsp1)
 {
     int yystate = 0;
-    int *yyvsp = 0;
 
   int yyn;
   int yyresult;
@@ -39,22 +38,22 @@ yyreduce:
     {
   case 72: {
 
-  if (strncmp( yyvsp[0], "~", 1) == 0) {
+  if (__builtin_strncmp( yyvsp[0], "~", 1) == 0) {
    *(char **)&(yyval) = *ftpglob(yyvsp[0]);
    if (globerr != 0) {
     yyval = 0;
    }
-   free(yyvsp[0]);
+   __builtin_free(yyvsp[0]);
   }
  }
     break;
     }
 
-  *++yyvsp = yyval;
+  *++yyvsp1 = yyval;
 
   {
-    const int yyi = yypgoto[0] + *yyvsp;
-    yystate = (yycheck[yyi] == *yyvsp ? 0 : 0);
+    const int yyi = yypgoto[0] + *yyvsp1;
+    yystate = (yycheck[yyi] == *yyvsp1 ? 0 : 0);
   }
 
   return yyresult;
index 4c7f4fdbaa9d1b7f27f4cf63a8e93620a52264cf..05a6db6dce664c24368a8a1b42723ac6a4d6a57f 100644 (file)
@@ -10,7 +10,7 @@ int c(int d, int e, int f) {
 int main() {
   int g = -1;
   a = c(b + 30, 29, g + 29);
-  volatile t = a;
+  volatile int t = a;
   if (t != 28)
     __builtin_abort();
   return 0;
index 70b90e04be96bc88cc63009e1199e17802615b50..0c1fc63b99aff369ccf6f8fce432c421e6277402 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
-/* { dg-options "-O2 -w" } */
+/* { dg-options "-O2 -Wno-pointer-to-int-cast" } */
 
 #include <stdint.h>
 int a;
@@ -15,7 +15,7 @@ void b() {
           ;
     g:
       for (; a;) {
-        int16_t i = &d;
+        int16_t i = (int16_t) &d;
         *c = i && *f;
       }
     }
index d3d65f8b6a64924aa8287739ace706fbe5fb7d7a..3cd4628c8f1647d30941c22ea76c3499d6772590 100644 (file)
@@ -1,11 +1,11 @@
 /* { dg-do compile } */
-/* { dg-options "-O2" } */
+/* { dg-options "-O2 -Wno-pointer-to-int-cast" } */
 typedef char int8_t;
 int8_t c_4, uli_5;
 unsigned short us_6;
 void func_1() {
   int uli_9;
-  short ptr_16ptr_11 = &uli_9; /* { dg-warning "initialization of*" } */
+  short ptr_16ptr_11 = (short) &uli_9;
   for (; us_6 <= 6;)
     if ((us_6 *= uli_9) < (uli_5 || 0) ?: ((c_4 = us_6) >= us_6) - uli_5)
       uli_9 = 9;
index c701934603eda0119869c22c5c29ffde00a6c4dc..db724aa1233837eab862a26a2ee718cc07e83518 100644 (file)
@@ -1,5 +1,5 @@
 // { dg-do compile }
-// { dg-options "-O2 -w -fnon-call-exceptions -fno-delete-dead-exceptions -fdump-tree-optimized" }
+// { dg-options "-O2 -Wno-div-by-zero -fnon-call-exceptions -fno-delete-dead-exceptions -fdump-tree-optimized" }
 
 int func_10_ptr_12;
 
@@ -11,9 +11,9 @@ void func_10(long li_8)
     func_10_ptr_12 &= 4 ? *ptr_9 : 4;
 }
 
-void func_9_s_8(
-{ 
-  func_10(func_9_s_8); 
+void func_9_s_8(void)
+{
+  func_10((long) func_9_s_8);
 }
 
 // { dg-final { scan-tree-dump " / 0" "optimized" } }
index 2c7c8b8dc35f62d4a0d6808e4ddf58833673a779..089bbe08672dbe73438bc934adc5f4ebb94f88f6 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-do compile { target aarch64*-*-* i?86-*-* x86_64-*-* } } */
-/* { dg-options "-fdump-rtl-ce1 -O2 -w --param max-rtl-if-conversion-unpredictable-cost=100" } */
+/* { dg-options "-fdump-rtl-ce1 -O2 --param max-rtl-if-conversion-unpredictable-cost=100" } */
 /* { dg-additional-options "-march=i686" { target { { i?86-*-* x86_64-*-* } && ia32 } } } */
 
 typedef struct cpp_reader cpp_reader;
@@ -20,7 +20,7 @@ enum cpp_ttype
   CPP_HEADER_NAME, CPP_COMMENT, CPP_MACRO_ARG, CPP_PADDING, CPP_EOF,
 };
 
-static struct op lex (cpp_reader *, int);
+struct op lex (cpp_reader *, int);
 
 struct op
 {
@@ -29,7 +29,7 @@ struct op
 };
 
 int
-_cpp_parse_expr (pfile)
+_cpp_parse_expr (cpp_reader *pfile)
 {
   struct op init_stack[20];
   struct op *stack = init_stack;