aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2023-10-13 09:34:55 +0200
committerFlorian Weimer <fweimer@redhat.com>2023-10-13 09:37:03 +0200
commit24eaada73def58a6a0c8702f873d0e2320d2fba4 (patch)
treef36492d5820f3ae20db185966b89280caf673ee8 /gcc
parent0fef2c89d165adca4c4aafeb8d822b4d6ac8623b (diff)
downloadgcc-24eaada73def58a6a0c8702f873d0e2320d2fba4.zip
gcc-24eaada73def58a6a0c8702f873d0e2320d2fba4.tar.gz
gcc-24eaada73def58a6a0c8702f873d0e2320d2fba4.tar.bz2
C99 testsuite readiness: Some verified test case adjustments
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.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pc44485.c2
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr106101.c13
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/pr111331-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/pr100512.c4
-rw-r--r--gcc/testsuite/gcc.dg/pr103003.c4
-rw-r--r--gcc/testsuite/gcc.dg/pr103451.c8
-rw-r--r--gcc/testsuite/gcc.dg/pr68435.c6
7 files changed, 19 insertions, 20 deletions
diff --git a/gcc/testsuite/gcc.c-torture/compile/pc44485.c b/gcc/testsuite/gcc.c-torture/compile/pc44485.c
index fc95925..51c6989 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 dec6608..e307afc 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 4c7f4fd..05a6db6 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 70b90e0..0c1fc63 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 d3d65f8..3cd4628 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 c701934..db724aa 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 2c7c8b8..089bbe0 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;