From patchwork Wed Oct 20 08:48:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Botcazou X-Patchwork-Id: 1543761 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=B1nRPl88; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Received: from 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 RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HZ46b16v9z9sR4 for ; Wed, 20 Oct 2021 19:49:25 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id CF3DF385842D for ; Wed, 20 Oct 2021 08:49:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CF3DF385842D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1634719762; bh=3lLHFIJr9dZwLprNxZFSimifEjg4A5BODagxyL2tZY4=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=B1nRPl88SpL0I9NwDj/CXr/N+5QLO/RPKrjHC8XOvFPc3j0kyJg7cQVNfscX7GhpI TiaJEUc8PeJ7H/HMQUT7eXRd7Dveuf0VP9LZZe8YbgS0j0tBhznz0iK9Rk9kENJfFQ 2fHmOIwTIJ6ZI/dKfFQi5Wg6Z4vFD12qOo9QcM2E= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) by sourceware.org (Postfix) with ESMTPS id 4FA873858C3A for ; Wed, 20 Oct 2021 08:48:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 4FA873858C3A Received: by mail-wm1-x32e.google.com with SMTP id p21so17174935wmq.1 for ; Wed, 20 Oct 2021 01:48:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=3lLHFIJr9dZwLprNxZFSimifEjg4A5BODagxyL2tZY4=; b=btxsr9Nx7EkVJizPo9aDQBvq1H6Y8Zvh1i/Ay3Yntm+piUD9vMMv7aDuzJlkYKQxAI kbE71P4fllpJ5myVsK6KieQV3xFXuzDKrEBH0UXO3u8p9eTm6qpak7sHaQZdKKLieV+t gCjgy2D+t+P91AM5cxJFryBAb9vwnxYkZSNieRpemtFaoYGqLShGhxcVQjUNtiCbWrZY +FygAcgAzl/FXkE5rxlfAQMSwQ26JIof+OfOv9Hcq3kBVIVuB2rWHaMZhKsrpTryZgl2 qK72nZPSYScJm/Yq6jjO1eIxDROgqSrJUu5CNUgxutlsFO6KpY3eXLXazxA8LRz2pbRd VPig== X-Gm-Message-State: AOAM532Aph3PPe8E+73L7EJqLDaFwxgSD3Q3mqNN2CQUBcdHbcNLXCnC vMVvHzcVlSI5SVAaU67LYfOqfg+nqB10XQ== X-Google-Smtp-Source: ABdhPJxxID8lVfJAZUyI1GbJ+3oyFS6yTrW7TP/83GD3cN5ze0/jqRNSXYFpJQCe/RxFdiDLT/CFpQ== X-Received: by 2002:a5d:59a7:: with SMTP id p7mr50220353wrr.141.1634719721209; Wed, 20 Oct 2021 01:48:41 -0700 (PDT) Received: from fomalhaut.localnet ([2a01:e0a:41b:84f0:cf71:f5e0:b050:bede]) by smtp.gmail.com with ESMTPSA id h6sm1404435wrx.51.2021.10.20.01.48.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Oct 2021 01:48:40 -0700 (PDT) X-Google-Original-From: Eric Botcazou To: gcc-patches@gcc.gnu.org Subject: Fix PR middle-end/102764 Date: Wed, 20 Oct 2021 10:48:25 +0200 Message-ID: <1708054.VLH7GnMWUR@fomalhaut> MIME-Version: 1.0 X-Spam-Status: No, score=-11.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_NUMSUBJECT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Eric Botcazou via Gcc-patches From: Eric Botcazou Reply-To: Eric Botcazou Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" This is a regression present on the mainline in the form of a -fcompare-debug failure at -O3 on a compiler-generated testcase. Fixed by disregarding a debug statement in the last position of a basic block to reset the current location for the outgoing edges. Bootstrapped/regtested on x86-64/Linux, applied on the mainline as obvious. 2021-10-20 Eric Botcazou PR middle-end/102764 * cfgexpand.c (expand_gimple_basic_block): Disregard a final debug statement to reset the current location for the outgoing edges. 2021-10-20 Eric Botcazou * gcc.dg/pr102764.c: New test. diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c index 03260b019e5..8b067f9d848 100644 --- a/gcc/cfgexpand.c +++ b/gcc/cfgexpand.c @@ -6090,7 +6090,7 @@ expand_gimple_basic_block (basic_block bb, bool disable_tail_calls) /* Expand implicit goto and convert goto_locus. */ FOR_EACH_EDGE (e, ei, bb->succs) { - if (e->goto_locus != UNKNOWN_LOCATION || !stmt) + if (e->goto_locus != UNKNOWN_LOCATION || !stmt || is_gimple_debug (stmt)) set_curr_insn_location (e->goto_locus); if ((e->flags & EDGE_FALLTHRU) && e->dest != bb->next_bb) {