From patchwork Wed Nov 6 13:50:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Malcolm X-Patchwork-Id: 2007562 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=dnuhBITF; 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 4Xk66V5pgdz1xyY for ; Thu, 7 Nov 2024 00:50:42 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 9E0123858403 for ; Wed, 6 Nov 2024 13:50:38 +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 ESMTP id 91D173858D3C for ; Wed, 6 Nov 2024 13:50:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 91D173858D3C Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 91D173858D3C Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1730901019; cv=none; b=i18VYD2eGTY/9rsurYRfJIed4NzNrd48FIiL3+SPnwTJWLcYQ8CLm+r2NMeyg1C1+VcOVRLWTaGyr638ElN34FeBG+zmA5oDIPl+R/wEcnrls7rNmSPoghldSOiY7Awda/gPyndLYSl/PN6s+ZHSfyKyETMOOtuuKvfhKkShihE= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1730901019; c=relaxed/simple; bh=H70eIjmDqdjh8k3Rx75y/XT9ClXfAzeRWoO8HK/cK/w=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=TVkinHIu4PTOgYSD2hdUWZWu4yuDaE50NMvtshi/rj5H0+K35nhqdtRpOINdV2xTpm3eI/FgEfyfvLkFqdbwMfxdCGr3zDu9s0zZqwW6oiV0hvua22xeP8Owcc48xFtJjmSwNSthbFbawoGoTQRlzU0daKVXjohR9UaLiCjjNEo= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1730901015; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=PVQOB4gE9H1Yy8VfdA5vRFjo+AsSnpBoUTGHxzKOHAM=; b=dnuhBITFTjbpDqQY2xjc0kozSGhLxt6mO4uBoX8dufFd7HTK+SjnAn5/QebOASABhi3CKX XER+qV0rHRA09qPJuAEejYQmBSFoMMl5DTFMfCsE/Bjmu7zLAZxsUM6h4qhRQ64f2289kG Xy+ly13Np7GBlno6Sk/ypJHh3fMspLY= Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-318-N-x77TN0P-mOSVZGNHgmSQ-1; Wed, 06 Nov 2024 08:50:13 -0500 X-MC-Unique: N-x77TN0P-mOSVZGNHgmSQ-1 X-Mimecast-MFC-AGG-ID: N-x77TN0P-mOSVZGNHgmSQ Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 097AC1955F2C for ; Wed, 6 Nov 2024 13:50:13 +0000 (UTC) Received: from t14s.localdomain.com (unknown [10.22.80.43]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 0CA2719541A5; Wed, 6 Nov 2024 13:50:10 +0000 (UTC) From: David Malcolm To: gcc-patches@gcc.gnu.org Cc: David Malcolm Subject: [pushed: r15-4983] testsuite: add infinite recursion test case [PR63388] Date: Wed, 6 Nov 2024 08:50:09 -0500 Message-ID: <20241106135009.3073344-1-dmalcolm@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: zvX1RtWcefSFwcq2ZZnrn2VIu5jQE8K-bahz6EKxQZE_1730901013 X-Mimecast-Originator: redhat.com 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 Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu. Pushed to trunk as r15-4983-g85736ba8e1fc4a. gcc/testsuite/ChangeLog: PR c++/63388 * g++.dg/analyzer/infinite-recursion-pr63388.C: New test. Signed-off-by: David Malcolm --- .../analyzer/infinite-recursion-pr63388.C | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 gcc/testsuite/g++.dg/analyzer/infinite-recursion-pr63388.C diff --git a/gcc/testsuite/g++.dg/analyzer/infinite-recursion-pr63388.C b/gcc/testsuite/g++.dg/analyzer/infinite-recursion-pr63388.C new file mode 100644 index 000000000000..74af8cad3fff --- /dev/null +++ b/gcc/testsuite/g++.dg/analyzer/infinite-recursion-pr63388.C @@ -0,0 +1,21 @@ +// { dg-do compile { target c++11 } } + +namespace std +{ + class ostream; + extern ostream cout; +} + +enum class Month {jan=1, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec}; + +std::ostream& operator<<(std::ostream& os, Month m) +{ + return os << m; // { dg-warning "infinite recursion" } +} + +int main() +{ + Month m = Month::may; + std::cout << m; + return 0; +}