From patchwork Tue Sep 14 09:12:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Botcazou X-Patchwork-Id: 1527801 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=adacore.com header.i=@adacore.com header.a=rsa-sha256 header.s=google header.b=Zj6ZzVvf; 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 ozlabs.org (Postfix) with ESMTPS id 4H7yM10kJtz9ssP for ; Tue, 14 Sep 2021 19:13:31 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 0C7BC3857C6C for ; Tue, 14 Sep 2021 09:12:59 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) by sourceware.org (Postfix) with ESMTPS id E1AF93858402 for ; Tue, 14 Sep 2021 09:12:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E1AF93858402 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com Received: by mail-wr1-x432.google.com with SMTP id u15so12962065wru.6 for ; Tue, 14 Sep 2021 02:12:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=lVGPdwUY1oj5trU2dvJfi+YQKcXZssDe5zOE0No6PQI=; b=Zj6ZzVvfWxveDirGFbLlMFHtUlSBBPSx+DAVGBhkDK17Yf9TwCmLYE/xdI62lafHYW ZfHFV2wHr69EoLKzm25go+/GI2v8SvzuZF5GU1pWJVMneFzIHLtUgl8EKzMIvIu+BzMZ vqcaqK3HHmWR9a7+71SJte2lZqQNaUmokAn7tGEI5gyDpxCK9y2aB64JHF0JP81l0x3u BOoAOUyA8x1HBMCMRJJ7oVZTcFrU4+DruMkwWtOEpPBDhAPUg6jseBg+cXpJ/rk8tKe9 7JwbY0GrFmUxJ46L9xUaJ7rw/bhXZRIH5bsPE8Q1a9ql9HfXX2vqdyKCMcl1ihytAdw5 A8qQ== 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=lVGPdwUY1oj5trU2dvJfi+YQKcXZssDe5zOE0No6PQI=; b=4inZxrsWGC9DZYQ5DJWwh9J5yvUMHHVxFggsyWTeTOuMmz4qLbdIxlsuX+om9wKNPs 17KXVh7kitV6Cwcfam+LC+DYxEwxfIUStd27j/UVfkgj3l2TtU33QHlDF5eV0RJd4MsC iMrYXwUDdfs74KIx//CB2dZEg4U6TwcEbTUFnWH9+WKCE8cN21Wr4W8OaRKSgTv1q2ee fz39gITKfEQja6w5UXDlcZ2wsuq8xiExlD0kcVHXgfg03LT3jDfRm217jnNI2pKYNeIH GxNqNpXVN2kPTG05AILUY+vGn6IDMtPEP1XXmhN5rNgqoxEMPfd8qM+lmk9oUOV9BkmU FWLA== X-Gm-Message-State: AOAM532B4MPtwVrqvzkRXPENDAdJa0gdI4cCrNnj3pSdvHvrKpbxUI72 Un9U9RbEn4lFS8/I1wBUo3JoUUcbHS6Q7/dk X-Google-Smtp-Source: ABdhPJzhb4AiRQ4l0CD2lOzkxIatbmiHiu6NtmNgEzVW3dZ5kosPX6zpABzL31JcwPVUY3nqBHsMtA== X-Received: by 2002:a5d:4c41:: with SMTP id n1mr17867132wrt.404.1631610765886; Tue, 14 Sep 2021 02:12:45 -0700 (PDT) Received: from fomalhaut.localnet ([2a01:e0a:41b:84f0:cf71:f5e0:b050:bede]) by smtp.gmail.com with ESMTPSA id z5sm529898wmp.26.2021.09.14.02.12.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Sep 2021 02:12:45 -0700 (PDT) From: Eric Botcazou X-Google-Original-From: Eric Botcazou To: gcc-patches@gcc.gnu.org Subject: [Ada] Fix inaccurate bounds in debug info for vector array types Date: Tue, 14 Sep 2021 11:12:34 +0200 Message-ID: <8822831.CDJkKcVGEf@fomalhaut> MIME-Version: 1.0 X-Spam-Status: No, score=-12.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, 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: , Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" They should not be 0-based, unless the array type itself is. Tested on x86-64/Linux, applied on the mainline, 11 and 10 branches. 2021-09-14 Eric Botcazou * gcc-interface/decl.c (gnat_to_gnu_entity): For vector types, make the representative array the debug type. diff --git a/decl.c b/decl.c index f7394b60..ebb33c97 100644 --- a/decl.c +++ b/decl.c @@ -4744,6 +4744,14 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition) else gnu_decl = create_type_decl (gnu_entity_name, gnu_type, artificial_p, debug_info_p, gnat_entity); + + /* For vector types, make the representative array the debug type. */ + if (VECTOR_TYPE_P (gnu_type)) + { + tree rep = TYPE_REPRESENTATIVE_ARRAY (gnu_type); + TYPE_NAME (rep) = DECL_NAME (gnu_decl); + SET_TYPE_DEBUG_TYPE (gnu_type, rep); + } } /* Otherwise, for a type reusing an existing DECL, back-annotate values. */