From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) by sourceware.org (Postfix) with ESMTPS id F1DC5385802D for ; Fri, 3 Sep 2021 08:54:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org F1DC5385802D 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-x42d.google.com with SMTP id m9so7167862wrb.1 for ; Fri, 03 Sep 2021 01:54:53 -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=X9tyW76sOXVac5R55GFq/zRqJIptOzMG1cKD3VuH1Ew=; b=KbVKpEZIIlsXkjSh2kNoNu4qIjwORE7tRuNphp9TPKOIkAguR7FWsTKIADEPiyOvlh ASfUjWuDG/asAGHqISpKKJXuikt9uw67S21XlF1eNMnNgGl90C6kd+W/HxTLv/i7UQ6C A/5SmFPYCxwuqcJDrDWVCwARCHrRQQ9Uvt/KhOAsdkHzIHO6vYDs2NE8JNWFf1PTPinF SqHM0dYo8nmZsXP1vtas+FYtWPrRQhzoPfEnuyteN30YGsVnYITfA40a9KNf5c9SEfU8 kQk8R0+mJx/8d/qP53uJoz91H3Ga39y0aqznyCSIsWQA7NGIBoVdMyEoTd9vyM+4j4w/ 5GlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=X9tyW76sOXVac5R55GFq/zRqJIptOzMG1cKD3VuH1Ew=; b=C64vqBLtV3OqNPYVPd8fWsMg5iRVyaD4wh+dnohkmmvxzVY7q7PVktNsHeINQ+39b6 BOiH9N8STiJoCyWTtMn/aWtFz58CLOzsj2rGahLnr3EkNaxuQASZX0VQzB9bKWnQmplo dPSGPoZUR1mnKKpG10e8zfIHNvNao2/aRjI+3vgtdUp5L3W23Rk4uBcS+Iw7zr/DmG6Y 8iQcGefgSMuw1xPTF6v7AIt1sgQOkgef9Z4k4qLQxwekkz1CyQx3/NQC65WnK1HRXAH+ l9vJ01X8rkHj2eU2TO0144zPcTeZsTWU9naB/SyiVf5qhEG8xTNlRMPdXuiOK6wrOFxP fKBw== X-Gm-Message-State: AOAM530JiVfZwa93OChDXchP6ErTF8ZETqKeFIMy2+TsrJXtEBff7AFf XkPu0MBBxeftHaKt9adkUXjaZIq1lqlpgkQz X-Google-Smtp-Source: ABdhPJzVDEooCIpw7CiyDZQDubvDdQ+YFdPp+8RiTlWz/fZ7rDW7qke9NhBwl8qO18mzbZVmQpMBQA== X-Received: by 2002:adf:edcf:: with SMTP id v15mr2726575wro.61.1630659292788; Fri, 03 Sep 2021 01:54:52 -0700 (PDT) Received: from fomalhaut.localnet ([2a01:e0a:41b:84f0:cf71:f5e0:b050:bede]) by smtp.gmail.com with ESMTPSA id y21sm3878450wmc.11.2021.09.03.01.54.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Sep 2021 01:54:52 -0700 (PDT) From: Eric Botcazou X-Google-Original-From: Eric Botcazou To: gcc-patches@gcc.gnu.org Subject: [patch] Fix debug info for packed array types in Ada Date: Fri, 03 Sep 2021 10:54:36 +0200 Message-ID: <4704769.31r3eYUQgx@fomalhaut> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="nextPart4369252.LvFx2qVVIh" Content-Transfer-Encoding: 7Bit X-Spam-Status: No, score=-11.4 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: , X-List-Received-Date: Fri, 03 Sep 2021 08:54:55 -0000 This is a multi-part message in MIME format. --nextPart4369252.LvFx2qVVIh Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Hi, packed array types are sometimes represented with integer types under the hood in Ada, but we nevertheless need to emit them as array types in the debug info so we have the types.get_array_descr_info langhook for this purpose; but it is not invoked from modified_type_die, which is responsible for: FAIL: gdb.ada/arrayptr.exp: scenario=minimal: print pa_ptr.all FAIL: gdb.ada/arrayptr.exp: scenario=minimal: print pa_ptr.all(3) in the GDB testsuite. Tested on x86-64/Linux, both GCC and GDB, OK for the mainline? 2021-09-03 Eric Botcazou * dwarf2out.c (modified_type_die): Deal with all array types earlier. -- Eric Botcazou --nextPart4369252.LvFx2qVVIh Content-Disposition: attachment; filename="p.diff" Content-Transfer-Encoding: 7Bit Content-Type: text/x-patch; charset="UTF-8"; name="p.diff" diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 07a479f6382..85fc24cc2b6 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -13542,6 +13542,7 @@ modified_type_die (tree type, int cv_quals, bool reverse, tree qualified_type; tree name, low, high; dw_die_ref mod_scope; + struct array_descr_info info; /* Only these cv-qualifiers are currently handled. */ const int cv_qual_mask = (TYPE_QUAL_CONST | TYPE_QUAL_VOLATILE | TYPE_QUAL_RESTRICT | TYPE_QUAL_ATOMIC | @@ -13786,6 +13787,13 @@ modified_type_die (tree type, int cv_quals, bool reverse, } } } + else if (TREE_CODE (type) == ARRAY_TYPE + || (lang_hooks.types.get_array_descr_info + && lang_hooks.types.get_array_descr_info (type, &info))) + { + gen_type_die (type, context_die); + return lookup_type_die (type); + } else if (code == INTEGER_TYPE && TREE_TYPE (type) != NULL_TREE && subrange_type_for_debug_p (type, &low, &high)) @@ -13836,13 +13844,12 @@ modified_type_die (tree type, int cv_quals, bool reverse, return lookup_type_die (t); return lookup_type_die (type); } - else if (TREE_CODE (type) != VECTOR_TYPE - && TREE_CODE (type) != ARRAY_TYPE) - return lookup_type_die (type_main_variant (type)); - else - /* Vectors have the debugging information in the type, - not the main variant. */ + /* Vectors have the debugging information in the type, + not the main variant. */ + else if (TREE_CODE (type) == VECTOR_TYPE) return lookup_type_die (type); + else + return lookup_type_die (type_main_variant (type)); } /* Builtin types don't have a DECL_ORIGINAL_TYPE. For those, --nextPart4369252.LvFx2qVVIh--