From patchwork Wed Oct 11 16:55:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Weimer X-Patchwork-Id: 1846871 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=AhfVFjYT; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S5Jms1wk4z23jg for ; Thu, 12 Oct 2023 03:55:41 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 49A3D3858281 for ; Wed, 11 Oct 2023 16:55:39 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id EC43D3858D1E for ; Wed, 11 Oct 2023 16:55:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org EC43D3858D1E Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697043326; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type; bh=d/q6tM0X1D0Vo370a5ZvHIN8E8U++LCCAHvJTXeYXTA=; b=AhfVFjYT2J9gy8uuGKJLUdncNeRWb3DNcWq2jsSb0sXrtNRX/A0t7FZ6Y9VVBb4gtWPBr2 rEWel+oAEH0Uumj0oB7pDO2GM+4rhvvhxiIhsdf6rXZJpTb5Q0ExVh1Dvyv7k+itmYqyIo Z2IV3mgmbmWfvw8sIXmtE4dHKFLxJG8= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-210-5wBYQVqkPyyTyAG1b5zbtA-1; Wed, 11 Oct 2023 12:55:24 -0400 X-MC-Unique: 5wBYQVqkPyyTyAG1b5zbtA-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A85F02825EBC for ; Wed, 11 Oct 2023 16:55:24 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.2.16.9]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 36FDA111CD24 for ; Wed, 11 Oct 2023 16:55:24 +0000 (UTC) From: Florian Weimer To: gcc-patches@gcc.gnu.org Subject: [PATCH] C99 testsuite readiness: Some verified test case adjustments Date: Wed, 11 Oct 2023 18:55:23 +0200 Message-ID: <87r0m1t7yc.fsf@oldenburg.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.3 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-10.8 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org 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 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 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;