From patchwork Thu Oct 31 03:38:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam James X-Patchwork-Id: 2004456 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org 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 4Xf8qf3R2Mz1xwK for ; Thu, 31 Oct 2024 14:39:07 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B11C53857835 for ; Thu, 31 Oct 2024 03:39:05 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) by sourceware.org (Postfix) with ESMTP id 8AE483857C58 for ; Thu, 31 Oct 2024 03:38:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8AE483857C58 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gentoo.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gentoo.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 8AE483857C58 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=140.211.166.183 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1730345925; cv=none; b=IXej/PIlIt2l8k2NXAd/elTCUlQ43IJ4FZzMyJSGNM9sTsS3HcyKQ1lb88A9Zqgb97UqSzlKWKSPhK6IOymv4HeQcjbdCaexfTtyd0HHul1p90modDIDyzL1By1Xqo1X58IEEV3WJyNNqQKej94PrtAgJZOl0KJ1iNeEp0X6nbE= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1730345925; c=relaxed/simple; bh=3q2xWkIiuxDBX5TIoAAxcBOx9tjIOa5nx8lCfiCNU40=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=XuU9fK9lc6SsxoiKyCgSaO92THwXvo1RW3kT6c6ICHJKFmpIFpFGBNtkznHqJWrtF2CfsrMiTSX62thWAWVHr0qwDRmsGWz7C+pzdJVA5tBvnDYTjOOsSgAnOh42VssIHVQFv5wsmHSEJ7cZWGGpEqiOhE/irm2Xv9myRhFDoZI= ARC-Authentication-Results: i=1; server2.sourceware.org From: Sam James To: gcc-patches@gcc.gnu.org Cc: Sam James Subject: [PATCH] testsuite: add testcase for fixed PR106073 Date: Thu, 31 Oct 2024 03:38:10 +0000 Message-ID: X-Mailer: git-send-email 2.47.0 MIME-Version: 1.0 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 This was fixed by r12-8835-ge8d5f3a1b5a583 which surely made it latent but richi points out it was likely an instance of PR90348. -fstack-reuse continues to be a menace, so let's add the testcase. gcc/testsuite/ChangeLog: PR middle-end/90348 PR tree-optimization/106073 * gcc.dg/pr106073.c: New test. --- OK? gcc/testsuite/gcc.dg/pr106073.c | 123 ++++++++++++++++++++++++++++++++ 1 file changed, 123 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/pr106073.c diff --git a/gcc/testsuite/gcc.dg/pr106073.c b/gcc/testsuite/gcc.dg/pr106073.c new file mode 100644 index 00000000000..570e68868b2 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr106073.c @@ -0,0 +1,123 @@ +/* { dg-do run } */ +/* { dg-options "-O3" } */ +int a, f = 1, h, l, m = 1, o, r = 4, q, s, x, e, aa, ab, ac, *ad, ae = 5, **y, **af, ag, ah, ai, aj; +static int c[6], d, g[6][5], n, *v = &s, ak; +volatile int p; +const volatile int al; +static volatile int t, u, w = 3, z, am, an; +static int ao(); +void ap(); +static void aq() { + int ar[4] = {6, 6, 6, 6}, as[1], i, j; + as[0] = 0; + if (m) { + int at[11] = {4, 4, 6, 5, 7, 0, 7, 6, 7, 6, 6}, *au, *av[7], k; + au = (int*) &au; + for (i = 0; i < 1; i++) + for (j = 0; j < 1; j++) + for (k = 0; k < 7; k++) { + (t || n) && u; + av[k] = 0; + } + y = av; + while (o) { + int *b[2] = {as, ar}; + *af = at; + } + m = 0; + } +} +inline void ap() { + for (; l <= 4; l++) { + *v = 0; + aq(); + if (a) + break; + for (; q; q++) + ; + } +} +int ao() { + int be = 0, j; + if (n) + aa = d = 0; + l = 0; + for (; be < 2; be++) { + int bf[7][2]; + for (ai = 0; ai < 7; ai++) + for (j = 0; j < 2; j++) + bf[ai][j] = 5; + if (be) { + for (; h >= 0; h--) { + while (z >= w) { + ap(); + *ad = 0; + } + ap(); + } + return bf[3][0]; + } + if (bf[3][0]) + continue; + while (1) + ; + } + return 0; +} +static void aw() { + for (; ah; ah++) { + p = 0; + p = 0; + } + int ax = ~e; + L1: + e = a = 0; + L2: + if (!r) + goto L3; + if (!ax) + goto L2; + if (d) + goto L1; + if (!ae) + goto L1; + if (w && x <= 808 && f) + ag = ao(); + g[0][4] = ag; + if (a) { + int bd; + n++; + while (n) + for (bd = 0; bd < 7; bd++) { + am; + am; + am; + am; + d = c[d ^ am]; + } + } else { + L3: + an; + for (; ak; ak++) { + int bc = 7; + for (; bc >= 0; bc--) { + al; + al; + d = f && an; + an; + } + } + } +} +int main() { + int k; + for (; aj < 6; aj++) + c[0] = aj; + aw(); + for (aj = 0; aj < 6; aj++) + for (k = 0; k < 5; k++) + d = c[d ^ g[aj][k]]; + if (d != 5) + __builtin_abort(); + return 0; +}