diff mbox series

C99 testsuite readiness: Some verified test case adjustments

Message ID 87r0m1t7yc.fsf@oldenburg.str.redhat.com
State New
Headers show
Series C99 testsuite readiness: Some verified test case adjustments | expand

Commit Message

Florian Weimer Oct. 11, 2023, 4:55 p.m. UTC
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    |  2 +-
 gcc/testsuite/gcc.c-torture/compile/pr106101.c   | 13 ++++++-------
 gcc/testsuite/gcc.c-torture/execute/pr111331-1.c |  2 +-
 gcc/testsuite/gcc.dg/pr100512.c                  |  4 ++--
 gcc/testsuite/gcc.dg/pr103003.c                  |  4 ++--
 gcc/testsuite/gcc.dg/pr103451.c                  |  8 ++++----
 gcc/testsuite/gcc.dg/pr68435.c                   |  6 +++---
 7 files changed, 19 insertions(+), 20 deletions(-)


base-commit: 4fcf30dd0fb9ec91b4e92bf93415c795d6c3e5e9

Comments

Jeff Law Oct. 12, 2023, 4:35 p.m. UTC | #1
On 10/11/23 10:55, Florian Weimer wrote:
> 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.
OK
jeff
diff mbox series

Patch

diff --git a/gcc/testsuite/gcc.c-torture/compile/pc44485.c b/gcc/testsuite/gcc.c-torture/compile/pc44485.c
index fc959257dd3..51c69894c54 100644
--- a/gcc/testsuite/gcc.c-torture/compile/pc44485.c
+++ b/gcc/testsuite/gcc.c-torture/compile/pc44485.c
@@ -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;
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr106101.c b/gcc/testsuite/gcc.c-torture/compile/pr106101.c
index dec66081f25..e307afcbccc 100644
--- a/gcc/testsuite/gcc.c-torture/compile/pr106101.c
+++ b/gcc/testsuite/gcc.c-torture/compile/pr106101.c
@@ -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;
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr111331-1.c b/gcc/testsuite/gcc.c-torture/execute/pr111331-1.c
index 4c7f4fdbaa9..05a6db6dce6 100644
--- a/gcc/testsuite/gcc.c-torture/execute/pr111331-1.c
+++ b/gcc/testsuite/gcc.c-torture/execute/pr111331-1.c
@@ -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;
diff --git a/gcc/testsuite/gcc.dg/pr100512.c b/gcc/testsuite/gcc.dg/pr100512.c
index 70b90e04be9..0c1fc63b99a 100644
--- a/gcc/testsuite/gcc.dg/pr100512.c
+++ b/gcc/testsuite/gcc.dg/pr100512.c
@@ -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;
       }
     }
diff --git a/gcc/testsuite/gcc.dg/pr103003.c b/gcc/testsuite/gcc.dg/pr103003.c
index d3d65f8b6a6..3cd4628c8f1 100644
--- a/gcc/testsuite/gcc.dg/pr103003.c
+++ b/gcc/testsuite/gcc.dg/pr103003.c
@@ -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;
diff --git a/gcc/testsuite/gcc.dg/pr103451.c b/gcc/testsuite/gcc.dg/pr103451.c
index c701934603e..db724aa1233 100644
--- a/gcc/testsuite/gcc.dg/pr103451.c
+++ b/gcc/testsuite/gcc.dg/pr103451.c
@@ -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" } }
diff --git a/gcc/testsuite/gcc.dg/pr68435.c b/gcc/testsuite/gcc.dg/pr68435.c
index 2c7c8b8dc35..089bbe08672 100644
--- a/gcc/testsuite/gcc.dg/pr68435.c
+++ b/gcc/testsuite/gcc.dg/pr68435.c
@@ -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;