[gdb/testsuite] Fix missing uint8_t in gdb.fortran/logical.exp

Andrew Burgess andrew.burgess@embecosm.com
Wed Mar 11 10:24:02 GMT 2020


* Tom de Vries <tdevries@suse.de> [2020-03-04 09:48:22 +0100]:

> [ was: Re: [PATCHv2] gdb/fortran: Fix printing of logical true values
> for Flang ]
> 
> On 03-03-2020 19:21, Andrew Burgess wrote:
> > * Sharma, Alok Kumar <AlokKumar.Sharma@amd.com> [2020-03-03 04:47:20 +0000]:
> > 
> >> I strongly agree and accept your comment. Please let me know if
> >> patch need to be updated by me? In case you have already
> >> incorporated the comments, please push it.
> > 
> > I pushed this change.
> 
> I'm running into trouble with the test-case.  Attached patch fixes that.
> 
> OK for trunk?

LGTM.

Thanks for this fix.

> 
> Thanks,
> - Tom

> [gdb/testsuite] Fix missing uint8_t in gdb.fortran/logical.exp
> 
> With test-case gdb.fortran/logical.exp, I run into:
> ...
> (gdb) PASS: gdb.fortran/logical.exp: var=l: get hexadecimal valueof "&l"
> set *((uint8_t *) 0x7fffffffd2bc) = 0xff^M
> No symbol "uint8_t" in current context.^M
> (gdb) FAIL: gdb.fortran/logical.exp: var=l: byte 0: set contents of byte at offset 0
> ...
> 
> Fix this by using the fortran-native type character instead.
> 
> Tested on x86_64-linux, with gcc 7.5.0 and clang 5.0.2.

I dug into this because, as we discussed on IRC you are seeing
failures with 7.5, while I am seeing passes with 7.4.  For me I was
getting the symbol from libgfortan.  I wonder if it's possible that
you're linking against an older version of libgfortran, even with a
newer gcc?

Either way, I think this fix should be merged, so feel free to go
ahead.

Thanks,
Andrew




> 
> gdb/testsuite/ChangeLog:
> 
> 2020-03-04  Tom de Vries  <tdevries@suse.de>
> 
> 	* gdb.fortran/logical.f90: Define variable with character type.
> 	* gdb.fortran/logical.exp: Use character type instead of uint8_t.
> 
> ---
>  gdb/testsuite/gdb.fortran/logical.exp | 2 +-
>  gdb/testsuite/gdb.fortran/logical.f90 | 2 ++
>  2 files changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/gdb/testsuite/gdb.fortran/logical.exp b/gdb/testsuite/gdb.fortran/logical.exp
> index 96e6f8f955..324714fa49 100644
> --- a/gdb/testsuite/gdb.fortran/logical.exp
> +++ b/gdb/testsuite/gdb.fortran/logical.exp
> @@ -43,7 +43,7 @@ foreach_with_prefix var { l l1 l2 l4 l8 } {
>  
>      for { set i 0 } { $i < $len } { incr i } {
>  	with_test_prefix "byte $i" {
> -	    gdb_test_no_output "set *((uint8_t *) ${addr}) = 0xff" \
> +	    gdb_test_no_output "set *((character *) ${addr}) = 0xff" \
>  		"set contents of byte at offset $i"
>  	    gdb_test "p l" " = \\.TRUE\\."
>  	    incr addr
> diff --git a/gdb/testsuite/gdb.fortran/logical.f90 b/gdb/testsuite/gdb.fortran/logical.f90
> index aea78e7089..175dfd1fc5 100644
> --- a/gdb/testsuite/gdb.fortran/logical.f90
> +++ b/gdb/testsuite/gdb.fortran/logical.f90
> @@ -21,10 +21,12 @@ program test
>    logical (kind=2) :: l2
>    logical (kind=4) :: l4
>    logical (kind=8) :: l8
> +  character :: c
>    l = .TRUE.
>    l1 = .TRUE.
>    l2 = .TRUE.
>    l4 = .TRUE.
>    l8 = .TRUE.
>    l = .FALSE.					! stop-here
> +  c = 'a'
>  end



More information about the Gdb-patches mailing list