From patchwork Thu Sep 19 13:28:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Marie de Rodat X-Patchwork-Id: 1164617 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-509278-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=adacore.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="Nfx0v/XV"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46YyQ54Ghzz9s4Y for ; Thu, 19 Sep 2019 23:30:05 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:mime-version:content-type; q=dns; s=default; b=OsaA1a5NLdF7Bm0pz12cjTF1LPgPNJwtla5rvVzfRkP98S69X/ 6cw5wXI+4706ZGkqrv+IiOFcrz9Te8+16bHgBQOlXdj8IY4b8CwEAUMJvTMv5x9+ VJ76h/5+OTF2/6tXoFT1PAsmbGC38RebpPAOB4Ae84zEHPTN/JAptlkJs= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:mime-version:content-type; s= default; bh=gHjhOssUVuPL+/VaBGkvE4pLSh4=; b=Nfx0v/XVdVV3GBkbZ1m+ 5o9deO2vzf/msLaz0J+bKVTsezE5kA5vLGFEM6OTID6Nvg0spUp0uymYzuZHLt9m WsTJlh6F/11rpNW+WxqrbKVfpiTtIW1NGjCYYggquT0Ikp/0cdHwO77JN/eo7HvX KVl1QpcB/wQKAUqq46qQvbg= Received: (qmail 1807 invoked by alias); 19 Sep 2019 13:28:28 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 1748 invoked by uid 89); 19 Sep 2019 13:28:27 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-11.2 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=Small X-HELO: rock.gnat.com Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 19 Sep 2019 13:28:26 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 3712D5602C; Thu, 19 Sep 2019 09:28:20 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id kkAb77sW5iMl; Thu, 19 Sep 2019 09:28:20 -0400 (EDT) Received: from tron.gnat.com (tron.gnat.com [205.232.38.10]) by rock.gnat.com (Postfix) with ESMTP id 021A156025; Thu, 19 Sep 2019 09:28:20 -0400 (EDT) Received: by tron.gnat.com (Postfix, from userid 4862) id 010406B4; Thu, 19 Sep 2019 09:28:19 -0400 (EDT) Date: Thu, 19 Sep 2019 09:28:19 -0400 From: Pierre-Marie de Rodat To: gcc-patches@gcc.gnu.org Cc: Tom Tromey Subject: [Ada] Emit DW_AT_GNU_bias with -fgnat-encodings=gdb Message-ID: <20190919132819.GA41927@adacore.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) X-IsSubscribed: yes Emit DW_AT_GNU_bias with -fgnat-encodings=gdb. gdb implements this, but not the encoded variant. Tested on x86_64-pc-linux-gnu, committed on trunk 2019-09-19 Tom Tromey gcc/ada/ * gcc-interface/misc.c (gnat_get_type_bias): Return the bias when -fgnat-encodings=gdb. gcc/testsuite/ * gnat.dg/bias1.adb: New testcase. --- gcc/ada/gcc-interface/misc.c +++ gcc/ada/gcc-interface/misc.c @@ -1111,7 +1111,7 @@ gnat_get_type_bias (const_tree gnu_type) { if (TREE_CODE (gnu_type) == INTEGER_TYPE && TYPE_BIASED_REPRESENTATION_P (gnu_type) - && gnat_encodings == DWARF_GNAT_ENCODINGS_MINIMAL) + && gnat_encodings != DWARF_GNAT_ENCODINGS_ALL) return TYPE_RM_MIN_VALUE (gnu_type); return NULL_TREE; --- /dev/null new file mode 100644 +++ gcc/testsuite/gnat.dg/bias1.adb @@ -0,0 +1,34 @@ +-- { dg-do compile } +-- { dg-options "-cargs -g -dA -gnatws -fgnat-encodings=gdb -margs" } +-- { dg-final { scan-assembler "DW_AT_GNU_bias" } } + +procedure Bias1 is + type Small is range -7 .. -4; + for Small'Size use 2; + Y : Small := -5; + Y1 : Small := -7; + + type Byte is mod 256; + type Repeat_Count_T is new Byte range 1 .. 2 ** 6; + for Repeat_Count_T'Size use 6; + X : Repeat_Count_T := 64; + X1 : Repeat_Count_T := 1; + + type Char_Range is range 65 .. 68; + for Char_Range'Size use 2; + Cval : Char_Range := 65; + + type SomePackedRecord is record + R: Small; + S: Small; + end record; + pragma Pack (SomePackedRecord); + SPR : SomePackedRecord := (R => -4, S => -5); + + type Packed_Array is array (1 .. 3) of Small; + pragma pack (Packed_Array); + A : Packed_Array := (-7, -5, -4); + +begin + null; +end Bias1; \ No newline at end of file