From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id UzXxNOttAWA0PQAAWB0awg (envelope-from ) for ; Fri, 15 Jan 2021 05:26:51 -0500 Received: by simark.ca (Postfix, from userid 112) id CB8641EF80; Fri, 15 Jan 2021 05:26:51 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RDNS_NONE,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2 Received: from sourceware.org (unknown [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 6AEAB1E940 for ; Fri, 15 Jan 2021 05:26:51 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id ED4C4397300E; Fri, 15 Jan 2021 10:26:50 +0000 (GMT) Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) by sourceware.org (Postfix) with ESMTPS id 48E543840C19 for ; Fri, 15 Jan 2021 10:26:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 48E543840C19 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=embecosm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=andrew.burgess@embecosm.com Received: by mail-wr1-x42f.google.com with SMTP id d13so8691460wrc.13 for ; Fri, 15 Jan 2021 02:26:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=mp86//n/IOFc58Ae225WUCAMTBrY8UMvfN9SnvOgTA4=; b=Ounc/06zdSuNeD2UKPt1vMNJyMQ+vMReUaa4DFg0VSdoSP/90BnIBvYBAOeJmmkcfT EA9fdyVHacBg2mnryeWPtAmn9l1wPFOYvMyX500HjOLdG2GKvvgWNDyWAH07e4VxXJhO vRcG2Scb+PQ3ItPU2qQ0f/rcQmiX7PNdlUGs+Fb34xwZkU3RXgnq3tNBEdlJQZRNAuTy cirsi1uw9/g6sfDVrOuRxtMyhdMPl6pOpLvDV34T9o9r4wVgPJ0OLjcilIY/w9M6Rp15 169K/rBtzopwI4rXOd9BOyQPDtnFXgUY4RlotxzFJMcKkvibifUShDM0bwVdvkTfIQ/6 c2UQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=mp86//n/IOFc58Ae225WUCAMTBrY8UMvfN9SnvOgTA4=; b=GB4eET2gRTUzKRluf3mLnFg3IYMUWxGR9OIgnD98cHRkKkDc84k4mV7vrafctN+DiP d7j74x4cLcLuHuqPgFatsklNXJTd9XuTu0uP89zJdqsP9YM/3s0o/AGLkCzMJH+q/9KB vIWrkxi66wzYAhoEd3MfFH1GNWNa8X/G0raizVCpLjhqofwKo8ZfovFR7Z0MS1NnVMbb wAty2a1a81T3F+KwcfZi6yIdCHNrW3+9jY8BO1yiqZz0j2X+ACthgFzt/H5LbUvVsgwU Gh854Oe3AAYuEYvPe5EpUomBZ3eYrJBTgk2+h8YUGNur7ME4czS1XL5I/r6PfSFP5fhe iZFA== X-Gm-Message-State: AOAM533SiR19g8r9mOWtauPIaIYiqHf1s/15fLq3i2R4kSqDfw7VXBg3 d4wVMwDEr2rmQHkXDW8GTICDz8UB1ezThg== X-Google-Smtp-Source: ABdhPJws17DrnqkXSeY1kYU5nZWw345NSDLPG3LveIRAuYtA0qwU2VeYz0nzVGJ+hioKb75aHKd/gg== X-Received: by 2002:adf:c6c4:: with SMTP id c4mr12731456wrh.348.1610706407360; Fri, 15 Jan 2021 02:26:47 -0800 (PST) Received: from localhost (host86-166-129-230.range86-166.btcentralplus.com. [86.166.129.230]) by smtp.gmail.com with ESMTPSA id p8sm14868897wru.50.2021.01.15.02.26.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Jan 2021 02:26:46 -0800 (PST) Date: Fri, 15 Jan 2021 10:26:45 +0000 From: Andrew Burgess To: Tom de Vries Subject: Re: [PATCH][gdb/testsuite] Fix gdb.fortran/array-slices.exp with -m32 Message-ID: <20210115102645.GI265215@embecosm.com> References: <20210115100322.GA3283@delia> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210115100322.GA3283@delia> X-Operating-System: Linux/5.8.13-100.fc31.x86_64 (x86_64) X-Uptime: 10:26:33 up 37 days, 15:11, X-Editor: GNU Emacs [ http://www.gnu.org/software/emacs ] 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: , Cc: gdb-patches@sourceware.org Errors-To: gdb-patches-bounces@sourceware.org Sender: "Gdb-patches" * Tom de Vries [2021-01-15 11:03:23 +0100]: > Hi, > > When running test-case gdb.fortran/array-slices.exp with target board > unix/-m32, we run into: > ... > (gdb) print /x &array4d^M > $69 = 0xffffb620^M > (gdb) print /x (&array4d) + sizeof (array4d)^M > $70 = 0x95c620^M > (gdb) FAIL: gdb.fortran/array-slices.exp: repack=on: test 9: check sizes match > ... > The expressions calculate the start and end of an array, but the calculation > of the end expression has an unexpected result (given that it lies before the > start of the array). By printing "sizeof (array4d)" as a separate > expression: > ... > (gdb) print /x sizeof (array4d) > $1 = 0xc40 > ... > it becomes clear we expected to get 0xffffb620 + 0xc40 == 0xffffc260 instead. > > The problem is that using the '&' returns a pointer type: > ... > (gdb) p &array4d > $5 = (PTR TO -> ( integer(kind=4) (-3:3,7:10,-3:3,-10:-7) )) 0xffffbe00 > ... > which has the consequence that the addition is done as pointer arithmetic. > > Fix this by using the result of "print /x &array4d" instead of &array4d in the > addition. > > Tested on x86_64-linux. > > Any comments? > > Thanks, > - Tom > > [gdb/testsuite] Fix gdb.fortran/array-slices.exp with -m32 > > gdb/testsuite/ChangeLog: > > 2021-01-15 Tom de Vries > > PR testsuite/26997 > * gdb.fortran/array-slices.exp (run_test): Avoid pointer arithmetic > when adding sizeof. LGTM. Thanks, Andrew > > --- > gdb/testsuite/gdb.fortran/array-slices.exp | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/gdb/testsuite/gdb.fortran/array-slices.exp b/gdb/testsuite/gdb.fortran/array-slices.exp > index f45a299b268..45753d9baea 100644 > --- a/gdb/testsuite/gdb.fortran/array-slices.exp > +++ b/gdb/testsuite/gdb.fortran/array-slices.exp > @@ -208,7 +208,7 @@ proc run_test { repack } { > set start_addr [get_hexadecimal_valueof "&${full_var_name}" \ > "start unknown"] > set end_addr [get_hexadecimal_valueof \ > - "(&${full_var_name}) + sizeof (${full_var_name})" \ > + "$start_addr + sizeof (${full_var_name})" \ > "end unknown"] > > # The Fortran compiler can choose to either send a descriptor that