public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Joel Brobecker <brobecker@adacore.com>
To: Carl Love via Gdb-patches <gdb-patches@sourceware.org>
Cc: will schmidt <will_schmidt@vnet.ibm.com>,
	cel@us.ibm.com, Rogerio Alves <rogealve@br.ibm.com>,
	Joel Brobecker <brobecker@adacore.com>
Subject: Re: [PATCH] Powerpc, fix vla-optimized-out.exp test
Date: Sun, 17 Apr 2022 08:19:12 -0700	[thread overview]
Message-ID: <Ylwv8N6ESr+KfKs2@adacore.com> (raw)
In-Reply-To: <0b8f207eb10a8a339825478fb94f781a827321ac.camel@us.ibm.com>

Hello Carl,

Thanks for the patch.

> Powerpc, fix vla-optimized-out.exp test
> 
> The size of the variable a is not optimized out on Intel inspite of the
> use of the variable use being optimized out.
> 
> On Powerpc, the use of variable a and the size of variable a are both
> optimized out.

For me, it would be useful to include an annotated copy of the DWARF
info being produced on x86_64-linux where the size is available,
vs the DWARF being produced on PowerPC. This will help understand
what's happening and confirm that it is indeed valid for GDB to
print that the size has been optimized out.

> The output on Powerpc is:
> 
> p sizeof (a)
> $2 = <optimized out>
> (gdb) FAIL: gdb.base/vla-optimized-out.exp: o1: printed size of optimized out vla
> 
> This patch changes the gdb_test to check for the size of vla being
> available or optimized out.  In either case, the test now passes.
> ---
>  gdb/testsuite/gdb.base/vla-optimized-out.exp | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/gdb/testsuite/gdb.base/vla-optimized-out.exp b/gdb/testsuite/gdb.base/vla-optimized-out.exp
> index b16142ee329..0a25788cb34 100644
> --- a/gdb/testsuite/gdb.base/vla-optimized-out.exp
> +++ b/gdb/testsuite/gdb.base/vla-optimized-out.exp
> @@ -40,8 +40,10 @@ proc vla_optimized_out {exe_suffix options} {
>  	" = <optimized out>" \
>  	"printed optimized out vla"
>  
> +    # On Intel the variable use of variable a is optimized out but the size is
> +    # available.  On Powerpc, the variable and the size of a are optimized out.
>      gdb_test "p sizeof (a)" \
> -	" = ($sizeof_result)" \
> +	"( = ($sizeof_result)| = <optimized out>)" \
>  	"printed size of optimized out vla"

In situations like these, I would suggest using gdb_test_multiple
instead. I think it'll make the testcase more readable.

-- 
Joel

  reply	other threads:[~2022-04-17 15:19 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-24 21:41 Carl Love
2022-03-24 22:46 ` will schmidt
2022-03-25 15:26   ` Carl Love
2022-03-28 15:34     ` Carl Love
2022-04-17 15:19       ` Joel Brobecker [this message]
2022-06-09 17:23         ` Carl Love
2022-06-23 14:19           ` Joel Brobecker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Ylwv8N6ESr+KfKs2@adacore.com \
    --to=brobecker@adacore.com \
    --cc=cel@us.ibm.com \
    --cc=gdb-patches@sourceware.org \
    --cc=rogealve@br.ibm.com \
    --cc=will_schmidt@vnet.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).