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.133.124]) by sourceware.org (Postfix) with ESMTPS id C4E233858C52 for ; Sun, 3 Apr 2022 16:21:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org C4E233858C52 Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-142-zaoEwYLXP_KATSLO3GnsTw-1; Sun, 03 Apr 2022 12:21:56 -0400 X-MC-Unique: zaoEwYLXP_KATSLO3GnsTw-1 Received: by mail-wm1-f70.google.com with SMTP id m35-20020a05600c3b2300b0038c90ef2dceso5724329wms.4 for ; Sun, 03 Apr 2022 09:21:56 -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:cc:subject:in-reply-to:references:date :message-id:mime-version; bh=NdeOL7hb6PS8HsNPHYhIP4K4NRHrv9DKvMcOS8Z733M=; b=niL/8ujxyITXfKI484OWxOD63SuOXKJ0btfmaPFKfB8ztTkcRBhYSBO6cM+omzFkQB gsHTYuGkW+VO8CfhVUY+ArG23HyWoUyR0bVEqp9rQ+1NI0Yn2tS3j/jVff+Sczr/LJ1k CUKtGnGu0b5DS7m+58VTbJWStDtvNu6tHMyg2UnU+mY9YsnQfX6MWq0DuJyulWSF8m95 z+Y6NugMSM/n3M0kMPnYvDhPMH/f2aRY2ieE9V/D2LrKEdVcsojc0dT8fM27fTdm4+lB lo3mwkmJ4k/oeG6FKnczHJ+OJca/4ONHP2g1xO7rI7C8Bm7Wrvj/56B8ilBRQVYHc5m/ 7EpQ== X-Gm-Message-State: AOAM5322o1ssdQcuXAkHqgzPmXYDFbLX3BqpQIDIRg1iHxFPnajX9Twz nhlTqXYI8iWKyDh48Z7kPrknH9efiRzL68IPjgMm8IqZQvmTbJHLoHqoZDaLmNoT9gmrWks2tG3 N0C3ajsPMtMwhR3UgVwt0WQ== X-Received: by 2002:adf:e885:0:b0:203:f46f:e19f with SMTP id d5-20020adfe885000000b00203f46fe19fmr14154300wrm.449.1649002915223; Sun, 03 Apr 2022 09:21:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzMl6BhEwprj2zAZy9o3flVOWtEdjeeLolg1lgUtgSURXKQw6HAl7lEagQaMSnqMk3lPWSsBQ== X-Received: by 2002:adf:e885:0:b0:203:f46f:e19f with SMTP id d5-20020adfe885000000b00203f46fe19fmr14154294wrm.449.1649002915071; Sun, 03 Apr 2022 09:21:55 -0700 (PDT) Received: from localhost (host86-169-131-113.range86-169.btcentralplus.com. [86.169.131.113]) by smtp.gmail.com with ESMTPSA id h8-20020a05600c350800b0038cc9096507sm16297404wmq.3.2022.04.03.09.21.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Apr 2022 09:21:54 -0700 (PDT) From: Andrew Burgess To: Tom Tromey , Andrew Burgess via Gdb-patches Cc: rupothar Subject: Re: [PATCH 3/3] gdb: add support for Fortran's ASSUMED RANK arrays In-Reply-To: <87zgl4lhkz.fsf@tromey.com> References: <20220323115809.GT1212730@redhat.com> <87zgl4lhkz.fsf@tromey.com> Date: Sun, 03 Apr 2022 17:21:53 +0100 Message-ID: <87bkxi87dq.fsf@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE 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: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Apr 2022 16:21:58 -0000 Tom Tromey writes: >>>>>> "Andrew" == Andrew Burgess via Gdb-patches writes: > > Andrew> An alternative approach would be to make the rank value a > Andrew> gdb::optional, however, this ends up adding a bunch of complexity to > Andrew> the code (e.g. having to conditionally build the array to pass to > Andrew> dwarf2_evaluate_property, and handling the 'rank - 1' in > Andrew> resolve_dynamic_array_or_string_1) so I haven't done that, but could, > Andrew> if people think that would be a better approach. > > I don't really have an opinion on this, but didn't want to just > completely ignore it either. > > I did notice one oddity. > > Andrew> + rank = 1; > Andrew> + > Andrew> + for (struct type *tmp_type = TYPE_TARGET_TYPE (type); > Andrew> + check_typedef (tmp_type)->code () == TYPE_CODE_ARRAY; > Andrew> + tmp_type = TYPE_TARGET_TYPE (tmp_type)) > Andrew> + ++rank; > > This loop calls check_typedef in the condition, but not when updating > tmp_type. Probably the update clause should also use check_typedef. > I don't know if Fortran even has typedefs, but its safe to do this. Thanks for the review. I've pushed this series now with the two suggestions you made. If anyone has a strong opinion and would prefer a switch to gdb::optional, then I'm happy to do that work as a followup patch. Thanks, Andrew