Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Sergio Durigan Junior <sergiodj@redhat.com>
To: Andrew Burgess <andrew.burgess@embecosm.com>
Cc: gdb-patches@sourceware.org,  Richard Bunt <Richard.Bunt@arm.com>
Subject: Regression on gdb.fortran/complex.exp on unix/-m32 (was: Re: [PATCHv2 4/8] gdb/fortran: better types for components of complex numbers)
Date: Fri, 03 May 2019 00:21:00 -0000	[thread overview]
Message-ID: <875zqspeua.fsf_-_@redhat.com> (raw)
In-Reply-To: <e63befa789944a27249c5893eb85ce36999c78e4.1554249182.git.andrew.burgess@embecosm.com>	(Andrew Burgess's message of "Wed, 3 Apr 2019 00:58:38 +0100")

On Tuesday, April 02 2019, Andrew Burgess wrote:

> Currently when using $_creal and $_cimag to access the components of a
> complex number the types of these components will have C type names
> 'float', 'double', etc.  This is because the components of a complex
> number are not given type names in DWARF, so GDB has to pick some
> suitable names, and currently we always use the C names.
>
> This commit changes the type names used based on the language, so for
> Fortran we will now use the Fortran float types, and so will get the
> Fortran float type names 'real', 'real*8', etc.

Hi Andrew,

This patch has caused a regression when testing a 64-bit against a
unix/-m32 board:

  print c16
  $5 = (../../binutils-gdb/gdb/target-float.c:2228: internal-error: target_float_ops_kind get_target_float_ops_kind(const type*): unexpected type code
  A problem internal to GDB has been detected,
  further debugging may prove unreliable.
  Quit this debugging session? (y or n) KFAIL: gdb.fortran/complex.exp: print c16 (GDB internal error) (PRMS: gdb/18644)
  Resyncing due to internal error.
  n

  This is a bug, please report it.  For instructions, see:
  <http://www.gnu.org/software/gdb/bugs/>.

  ../../binutils-gdb/gdb/target-float.c:2228: internal-error: target_float_ops_kind get_target_float_ops_kind(const type*): unexpected type code
  A problem internal to GDB has been detected,
  further debugging may prove unreliable.
  Create a core file of GDB? (y or n) n
  Command aborted.

I haven't been able to investigate more, sorry.

Thanks,

> gdb/ChangeLog:
>
> 	* dwarf2read.c (dwarf2_init_complex_target_type): Use different
> 	types for Fortran.
>
> gdb/testsuite/ChangeLog:
>
> 	* gdb.fortran/complex.exp: Expand.
> 	* gdb.fortran/complex.f: Renamed to...
> 	* gdb.fortran/complex.f90: ...this, and extended to add more
> 	complex values.
> ---
>  gdb/ChangeLog                         |  6 +++++
>  gdb/dwarf2read.c                      | 35 +++++++++++++++++++++-------
>  gdb/testsuite/ChangeLog               |  7 ++++++
>  gdb/testsuite/gdb.fortran/complex.exp | 41 +++++++++++++++++++++++++-------
>  gdb/testsuite/gdb.fortran/complex.f   | 24 -------------------
>  gdb/testsuite/gdb.fortran/complex.f90 | 44 +++++++++++++++++++++++++++++++++++
>  6 files changed, 116 insertions(+), 41 deletions(-)
>  delete mode 100644 gdb/testsuite/gdb.fortran/complex.f
>  create mode 100644 gdb/testsuite/gdb.fortran/complex.f90
>
> diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
> index 8881a1e28a8..1277b8acb53 100644
> --- a/gdb/dwarf2read.c
> +++ b/gdb/dwarf2read.c
> @@ -17547,16 +17547,35 @@ dwarf2_init_complex_target_type (struct dwarf2_cu *cu,
>    gdbarch *gdbarch = get_objfile_arch (objfile);
>    struct type *tt = nullptr;
>  
> -  switch (bits)
> +  switch (cu->language)
>      {
> -    case 32:
> -      tt = builtin_type (gdbarch)->builtin_float;
> -      break;
> -    case 64:
> -      tt = builtin_type (gdbarch)->builtin_double;
> +    case language_fortran:
> +      switch (bits)
> +	{
> +	case 32:
> +	  tt = builtin_f_type (gdbarch)->builtin_real;
> +	  break;
> +	case 64:
> +	  tt = builtin_f_type (gdbarch)->builtin_real_s8;
> +	  break;
> +	case 128:
> +	  tt = builtin_f_type (gdbarch)->builtin_real_s16;
> +	  break;
> +	}
>        break;
> -    case 128:
> -      tt = builtin_type (gdbarch)->builtin_long_double;
> +    default:
> +      switch (bits)
> +	{
> +	case 32:
> +	  tt = builtin_type (gdbarch)->builtin_float;
> +	  break;
> +	case 64:
> +	  tt = builtin_type (gdbarch)->builtin_double;
> +	  break;
> +	case 128:
> +	  tt = builtin_type (gdbarch)->builtin_long_double;
> +	  break;
> +	}
>        break;
>      }
>  
> diff --git a/gdb/testsuite/gdb.fortran/complex.exp b/gdb/testsuite/gdb.fortran/complex.exp
> index 3fbbf7154d9..136f1c4df79 100644
> --- a/gdb/testsuite/gdb.fortran/complex.exp
> +++ b/gdb/testsuite/gdb.fortran/complex.exp
> @@ -13,7 +13,7 @@
>  # You should have received a copy of the GNU General Public License
>  # along with this program.  If not, see <http://www.gnu.org/licenses/>.
>  
> -standard_testfile .f
> +standard_testfile .f90
>  
>  if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug f90 quiet}]} {
>      return -1
> @@ -24,13 +24,36 @@ if ![runto MAIN__] then {
>      continue
>  }
>  
> -set bp_location [gdb_get_line_number "stop"]
> -gdb_test "break $bp_location" \
> -    "Breakpoint.*at.* file .*$srcfile, line $bp_location\\." \
> -    "breakpoint at stop"
>  
> -gdb_test "continue" \
> -    "Continuing\\..*Breakpoint.*" \
> -    "continue to breakpoint"
> +gdb_breakpoint [gdb_get_line_number "stop"]
> +gdb_continue_to_breakpoint "continue"
> +
> +gdb_test "print c" " = \\(1000,-50\\)"
> +gdb_test "print c4" " = \\(1000,-50\\)"
> +gdb_test "print c8" " = \\(321,-22\\)"
> +gdb_test "print dc" " = \\(321,-22\\)"
> +
> +setup_kfail gdb/18644 "*-*-*"
> +gdb_test "print c16" " = \\(-874,19\\)"
> +
> +gdb_test "whatis c" "type = complex\\(kind=4\\)"
> +gdb_test "print \$_creal (c)" " = 1000"
> +gdb_test "whatis \$" " = real"
> +
> +gdb_test "whatis c4" "type = complex\\(kind=4\\)"
> +gdb_test "print \$_creal (c4)" " = 1000"
> +gdb_test "whatis \$" " = real"
> +
> +gdb_test "whatis c8" "type = complex\\(kind=8\\)"
> +gdb_test "print \$_creal (c8)" " = 321"
> +gdb_test "whatis \$" " = real\\*8"
> +
> +gdb_test "whatis dc" "type = complex\\(kind=8\\)"
> +gdb_test "print \$_creal (dc)" " = 321"
> +gdb_test "whatis \$" " = real\\*8"
> +
> +gdb_test "whatis c16" "type = complex\\(kind=16\\)"
> +setup_kfail gdb/18644 "*-*-*"
> +gdb_test "print \$_creal (c16)" " = -874"
> +gdb_test "whatis \$" " = real\\*16"
>  
> -gdb_test "print c" "\\\$$decimal = \\(1000,-50\\)"
> diff --git a/gdb/testsuite/gdb.fortran/complex.f b/gdb/testsuite/gdb.fortran/complex.f
> deleted file mode 100644
> index 2f1a7879f9e..00000000000
> --- a/gdb/testsuite/gdb.fortran/complex.f
> +++ /dev/null
> @@ -1,24 +0,0 @@
> -c Copyright 2007-2019 Free Software Foundation, Inc.
> -
> -c This program is free software; you can redistribute it and/or modify
> -c it under the terms of the GNU General Public License as published by
> -c the Free Software Foundation; either version 3 of the License, or
> -c (at your option) any later version.
> -c
> -c This program is distributed in the hope that it will be useful,
> -c but WITHOUT ANY WARRANTY; without even the implied warranty of
> -c MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> -c GNU General Public License for more details.
> -c
> -c You should have received a copy of the GNU General Public License
> -c along with this program.  If not, see <http://www.gnu.org/licenses/>.
> -
> -      real*8 a,b
> -      complex*16 c
> -
> -      a = 1000
> -      b = -50
> -      c = cmplx(a,b)
> -      write(*,*) s
> -      stop
> -      end
> diff --git a/gdb/testsuite/gdb.fortran/complex.f90 b/gdb/testsuite/gdb.fortran/complex.f90
> new file mode 100644
> index 00000000000..2b88c1ee0bb
> --- /dev/null
> +++ b/gdb/testsuite/gdb.fortran/complex.f90
> @@ -0,0 +1,44 @@
> +! Copyright 2007-2019 Free Software Foundation, Inc.
> +!
> +! This program is free software; you can redistribute it and/or modify
> +! it under the terms of the GNU General Public License as published by
> +! the Free Software Foundation; either version 3 of the License, or
> +! (at your option) any later version.
> +!
> +! This program is distributed in the hope that it will be useful,
> +! but WITHOUT ANY WARRANTY; without even the implied warranty of
> +! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> +! GNU General Public License for more details.
> +!
> +! You should have received a copy of the GNU General Public License
> +! along with this program.  If not, see <http://www.gnu.org/licenses/>.
> +
> +program test_complex
> +  real*4 r4a, r4b
> +  real*8 r8a, r8b
> +  real*16 r16a, r16b
> +
> +  complex c
> +  complex(kind=4) c4
> +  complex(kind=8) c8
> +  double complex dc
> +  complex(kind=16) c16
> +
> +  r4a = 1000
> +  r4b = -50
> +  r8a = 321
> +  r8b = -22
> +  r16a = -874
> +  r16b = 19
> +
> +  c = cmplx(r4a,r4b)
> +  c4 = cmplx(r4a,r4b)
> +  c8 = cmplx(r8a, r8b)
> +  dc = cmplx(r8a, r8b)
> +  c16 = cmplx(r16a, r16b)
> +
> +  print *, c, c4, c8, dc, c16	! stop
> +  print *, r4a, r4b
> +  print *, r8a, r8b
> +  print *, r16a, r16b
> +end program test_complex
> -- 
> 2.14.5

-- 
Sergio
GPG key ID: 237A 54B1 0287 28BF 00EF  31F4 D0EB 7628 65FC 5E36
Please send encrypted e-mail if possible
http://sergiodj.net/


  reply	other threads:[~2019-05-03  0:21 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-02 23:58 [PATCHv2 0/8] Series of Fortran type printing patches Andrew Burgess
2019-03-18 12:52 ` [PATCH " Andrew Burgess
2019-03-18 12:52   ` [PATCH 8/8] gdb/fortran: Add allocatable type qualifier Andrew Burgess
2019-03-18 12:52   ` [PATCH 2/8] gdb/fortran: Handle internal function calls Andrew Burgess
2019-03-19 19:52     ` Tom Tromey
2019-03-18 12:52   ` [PATCH 1/8] gdb: Add $_cimag and $_creal internal functions Andrew Burgess
2019-03-18 17:20     ` Eli Zaretskii
2019-03-29 22:41       ` Andrew Burgess
2019-03-30  7:15         ` Eli Zaretskii
2019-03-19 19:47     ` Tom Tromey
2019-04-12 20:24     ` New FAIL on gdb.base/complex-parts.exp - unix/-m32 (was: Re: [PATCH 1/8] gdb: Add $_cimag and $_creal internal functions) Sergio Durigan Junior
2019-04-13  0:02       ` Andrew Burgess
2019-04-16 18:30         ` New FAIL on gdb.base/complex-parts.exp - unix/-m32 Tom Tromey
2019-04-17  0:03           ` Andrew Burgess
2019-03-18 12:52   ` [PATCH 5/8] gdb/fortran: Print 'void' type in lower case Andrew Burgess
2019-03-18 12:52   ` [PATCH 3/8] gdb/fortran: Additional builtin procedures Andrew Burgess
2019-03-19 20:06     ` Tom Tromey
2019-03-18 12:52   ` [PATCH 6/8] gdb/fortran: print function arguments when printing function type Andrew Burgess
2019-03-18 12:52   ` [PATCH 7/8] gdb/fortran: Update rules for printing whitespace in types Andrew Burgess
2019-03-18 12:52   ` [PATCH 4/8] gdb/fortran: better types for components of complex numbers Andrew Burgess
2019-03-19 20:18     ` Tom Tromey
2019-03-19 20:27   ` [PATCH 0/8] Series of Fortran type printing patches Tom Tromey
2019-04-02 23:58   ` [PATCHv2 3/8] gdb/fortran: Additional builtin procedures Andrew Burgess
2019-04-02 23:58   ` [PATCHv2 2/8] gdb/fortran: Introduce fortran-operator.def file Andrew Burgess
2019-04-02 23:58   ` [PATCHv2 1/8] gdb: Remove an unbalanced stray double quote from a comment Andrew Burgess
2019-04-02 23:59   ` [PATCHv2 8/8] gdb/fortran: Add allocatable type qualifier Andrew Burgess
2019-04-02 23:59   ` [PATCHv2 5/8] gdb/fortran: Print 'void' type in lower case Andrew Burgess
2019-04-02 23:59   ` [PATCHv2 4/8] gdb/fortran: better types for components of complex numbers Andrew Burgess
2019-05-03  0:21     ` Sergio Durigan Junior [this message]
2019-04-02 23:59   ` [PATCHv2 7/8] gdb/fortran: Update rules for printing whitespace in types Andrew Burgess
2019-04-02 23:59   ` [PATCHv2 6/8] gdb/fortran: print function arguments when printing function type Andrew Burgess
2019-04-23 22:16 ` [PATCHv2 0/8] Series of Fortran type printing patches Andrew Burgess
2019-04-24 19:19   ` Tom Tromey
2019-04-30 12:37     ` Andrew Burgess

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=875zqspeua.fsf_-_@redhat.com \
    --to=sergiodj@redhat.com \
    --cc=Richard.Bunt@arm.com \
    --cc=andrew.burgess@embecosm.com \
    --cc=gdb-patches@sourceware.org \
    /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