From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 18012385C32C for ; Wed, 24 Aug 2022 14:28:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 18012385C32C Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1661351322; 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: in-reply-to:in-reply-to:references:references; bh=AO785R1Tjcb7yL0mBIYH1esfdqsFPijlezJBqROxlAA=; b=OCX5NS0whCUQyaI3Oe5izQfEvHZME2pN+v2RVK1GThMggDKzU/W4Fq4iICBZyGmCFg1xQJ 50FHRBrNvCbzOct9S8QCnY0vAD7OLk0VeY+OIFOxUUFWhOCJP4trX3ZEyo5czC8WsygCDd qDvPi8wiHiznVU40t/tShnpMFeUrpuY= Received: from mail-qv1-f69.google.com (mail-qv1-f69.google.com [209.85.219.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-653-O5chlPk1NjKNsGG6_ZzAxg-1; Wed, 24 Aug 2022 10:28:41 -0400 X-MC-Unique: O5chlPk1NjKNsGG6_ZzAxg-1 Received: by mail-qv1-f69.google.com with SMTP id o6-20020ad443c6000000b00495d04028a6so9655229qvs.18 for ; Wed, 24 Aug 2022 07:28:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc; bh=AO785R1Tjcb7yL0mBIYH1esfdqsFPijlezJBqROxlAA=; b=vz9GKoy6p03yPyYddO7nJvLOBpxcsuzl8cAOGdiR3Moih9WhxiEH0BN0acS2M39PeQ SDFJxrU77uXOtlPGiKZNBP3RSG38mjYK9X7SWrpsIhSAOJ82A7q2ZuWQh/QLR4EZ2yZ2 QKWeJ2VGVbtWMPro8IALUvoKo7RwmhcAZ/ClBs3OXy5CVYnuKCrIXCkndUq+wC858Izh 4pIngdjjMSW2pbeOPQ43+1sy+QqXTigTDMGbg6FVmI3nISmmnjyk6nXV8Bh1Ao8Po9Bl JmXhSjE4eeu+SAaef7k79iqyOw5w9HR6mspFx3tXmvJnL3wzepZwLLoCEfVe9QX1h8ny ShSg== X-Gm-Message-State: ACgBeo0VR1NDcECufagAM7apsCjMO9iWMqeS+g/lABUnnYWOJAJJq15p nJ9KnODuHkWrrglCOKEFEcuqEICjHCk3T7o7sGHczXUvrTgB3bOqgasiTJPMA7oEUGgfOL6gH35 +EbMy3E6gvz0gIdUz8Q== X-Received: by 2002:ac8:7dcf:0:b0:344:5777:b934 with SMTP id c15-20020ac87dcf000000b003445777b934mr24819220qte.170.1661351320794; Wed, 24 Aug 2022 07:28:40 -0700 (PDT) X-Google-Smtp-Source: AA6agR4qOTEVuRVs8wWG3DgCGqK1nZTodINwDJ9bTkI/i8OsguzSlwF5p9BglU1tZBKU2lembGJDmQ== X-Received: by 2002:ac8:7dcf:0:b0:344:5777:b934 with SMTP id c15-20020ac87dcf000000b003445777b934mr24819191qte.170.1661351320439; Wed, 24 Aug 2022 07:28:40 -0700 (PDT) Received: from [192.168.1.101] (130-44-159-43.s15913.c3-0.arl-cbr1.sbo-arl.ma.cable.rcncustomer.com. [130.44.159.43]) by smtp.gmail.com with ESMTPSA id x8-20020a05620a258800b006b9a89d408csm15260362qko.100.2022.08.24.07.28.38 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 24 Aug 2022 07:28:39 -0700 (PDT) Message-ID: <243311c2-3675-c2bb-2d6c-dc407c672eff@redhat.com> Date: Wed, 24 Aug 2022 10:28:37 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.12.0 Subject: Re: [PATCH Rust front-end v2 01/37] Use DW_ATE_UTF for the Rust 'char' type To: philip.herron@embecosm.com, gcc-patches@gcc.gnu.org Cc: gcc-rust@gcc.gnu.org, Tom Tromey References: <20220824115956.737931-1-philip.herron@embecosm.com> <20220824115956.737931-2-philip.herron@embecosm.com> From: Jason Merrill In-Reply-To: <20220824115956.737931-2-philip.herron@embecosm.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-13.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,NICE_REPLY_A,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 8/24/22 04:59, herron.philip@googlemail.com wrote: > From: Tom Tromey > > The Rust 'char' type should use the DWARF DW_ATE_UTF encoding. The DWARF changes are OK. > --- > gcc/dwarf2out.cc | 23 ++++++++++++++++++++++- > 1 file changed, 22 insertions(+), 1 deletion(-) > > diff --git a/gcc/dwarf2out.cc b/gcc/dwarf2out.cc > index e3920c898f5..a8bccbabca4 100644 > --- a/gcc/dwarf2out.cc > +++ b/gcc/dwarf2out.cc > @@ -5600,6 +5600,16 @@ is_fortran (const_tree decl) > return is_fortran (); > } > > +/* Return TRUE if the language is Rust. */ > + > +static inline bool > +is_rust () > +{ > + unsigned int lang = get_AT_unsigned (comp_unit_die (), DW_AT_language); > + > + return lang == DW_LANG_Rust || lang == DW_LANG_Rust_old; > +} > + > /* Return TRUE if the language is Ada. */ > > static inline bool > @@ -13231,7 +13241,11 @@ base_type_die (tree type, bool reverse) > } > if (TYPE_STRING_FLAG (type)) > { > - if (TYPE_UNSIGNED (type)) > + if ((dwarf_version >= 4 || !dwarf_strict) > + && is_rust () > + && int_size_in_bytes (type) == 4) > + encoding = DW_ATE_UTF; > + else if (TYPE_UNSIGNED (type)) > encoding = DW_ATE_unsigned_char; > else > encoding = DW_ATE_signed_char; > @@ -25201,6 +25215,13 @@ gen_compile_unit_die (const char *filename) > } > else if (strcmp (language_string, "GNU F77") == 0) > language = DW_LANG_Fortran77; > + else if (strcmp (language_string, "GNU Rust") == 0) > + { > + if (dwarf_version >= 5 || !dwarf_strict) > + language = DW_LANG_Rust; > + else > + language = DW_LANG_Rust_old; > + } > else if (dwarf_version >= 3 || !dwarf_strict) > { > if (strcmp (language_string, "GNU Ada") == 0)