public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH v3 00/11] Improve Fortran intrinsic types and procedures
@ 2022-04-11  8:18 Nils-Christian Kempke
  2022-04-11  8:18 ` [PATCH v3 11/11] gdb/doc: add section about Fortran intrinsic functions and types Nils-Christian Kempke
  2022-04-25 12:52 ` [PATCH v3 00/11] Improve Fortran intrinsic types and procedures Luis Machado
  0 siblings, 2 replies; 8+ messages in thread
From: Nils-Christian Kempke @ 2022-04-11  8:18 UTC (permalink / raw)
  To: gdb-patches

Hi,

please find attached v3 of the series.

V1 can be found here

https://sourceware.org/pipermail/gdb-patches/2022-March/186473.html

V2 here

https://sourceware.org/pipermail/gdb-patches/2022-April/187655.html

Changes since V2:

	- [Patch 11/11]: Fixed Texinfo issues.


Thanks!

Nils


Nils-Christian Kempke (11):
  gdb/f-lang: add Integer*1 to Fortran builtin types
  gdb/f-lang: remove hidden ^L characters
  gdb/fortran: fix complex type in Fortran builtin types
  gdb/fortran: reformat build_fortran_types in f-lang.c
  gdb/fortran: change default logical type to builtin_logical
  gdb/fortran: clean-up Fortran intrinsic types
  gdb/fortran: Change GDB print for fortran default types
  gdb/fortran: rename f77_keywords to f_keywords
  gdb/fortran: rewrite intrinsic handling and add some missing overloads
  gdb/fortran/testsuite: add complex from integers test
  gdb/doc: add section about Fortran intrinsic functions and types

 gdb/doc/gdb.texinfo                         | 143 ++++++-
 gdb/f-exp.h                                 | 182 +++++++--
 gdb/f-exp.y                                 | 397 ++++++++++++++------
 gdb/f-lang.c                                | 267 +++++++++----
 gdb/f-lang.h                                |   7 +-
 gdb/std-operator.def                        |  10 +-
 gdb/testsuite/gdb.fortran/complex.exp       |  10 +-
 gdb/testsuite/gdb.fortran/complex.f90       |   7 +-
 gdb/testsuite/gdb.fortran/intrinsics.exp    |  46 ++-
 gdb/testsuite/gdb.fortran/lbound-ubound.F90 |  49 ++-
 gdb/testsuite/gdb.fortran/lbound-ubound.exp |  29 +-
 gdb/testsuite/gdb.fortran/size.exp          |  84 ++++-
 gdb/testsuite/gdb.fortran/size.f90          | 213 ++++++++---
 gdb/testsuite/gdb.fortran/type-kinds.exp    |   2 +
 gdb/testsuite/gdb.fortran/types.exp         |  34 +-
 15 files changed, 1160 insertions(+), 320 deletions(-)

-- 
2.25.1

Intel Deutschland GmbH
Registered Address: Am Campeon 10, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de <http://www.intel.de>
Managing Directors: Christin Eisenschmid, Sharon Heck, Tiffany Doon Silva  
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v3 11/11] gdb/doc: add section about Fortran intrinsic functions and types
  2022-04-11  8:18 [PATCH v3 00/11] Improve Fortran intrinsic types and procedures Nils-Christian Kempke
@ 2022-04-11  8:18 ` Nils-Christian Kempke
  2022-04-11 11:38   ` Eli Zaretskii
  2022-04-25 12:52 ` [PATCH v3 00/11] Improve Fortran intrinsic types and procedures Luis Machado
  1 sibling, 1 reply; 8+ messages in thread
From: Nils-Christian Kempke @ 2022-04-11  8:18 UTC (permalink / raw)
  To: gdb-patches

The earlier version of this document had no sections about the
available Fortran intrinsic functions or the Fortran builtin types.

I added two sections 'Fortran intrinsics' and 'Fortran types' to
document the available Fortran language features.  The subsection
'Fortran Defaults' has been integrated into the Fortran subsection.
---
 gdb/doc/gdb.texinfo | 143 ++++++++++++++++++++++++++++++++++++++++----
 1 file changed, 133 insertions(+), 10 deletions(-)

diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index e4685cd995..8d599a68a1 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -17176,8 +17176,8 @@ vector data types.
 @subsection Fortran
 @cindex Fortran-specific support in @value{GDBN}
 
-@value{GDBN} can be used to debug programs written in Fortran, but it
-currently supports only the features of Fortran 77 language.
+@value{GDBN} can be used to debug programs written in Fortran.  Note, that not
+all Fortran language features are available yet.
 
 @cindex trailing underscore, in Fortran symbols
 Some Fortran compilers (@sc{gnu} Fortran 77 and Fortran 95 compilers
@@ -17186,12 +17186,71 @@ functions.  When you debug programs compiled by those compilers, you
 will need to refer to variables and functions with a trailing
 underscore.
 
+@cindex Fortran Defaults
+Fortran symbols are usually case-insensitive, so @value{GDBN} by
+default uses case-insensitive matching for Fortran symbols.  You can
+change that with the @samp{set case-insensitive} command, see
+@ref{Symbols}, for the details.
+
 @menu
+* Fortran Types::               Fortran builtin types
 * Fortran Operators::           Fortran operators and expressions
-* Fortran Defaults::            Default settings for Fortran
+* Fortran Intrinsics::          Fortran intrinsic functions
 * Special Fortran Commands::    Special @value{GDBN} commands for Fortran
 @end menu
 
+@node Fortran Types
+@subsubsection Fortran Types
+
+@cindex Fortran Types
+
+In Fortran the primitive data-types have an associated @code{KIND} type
+parameter, written as @samp{@var{type}*@var{kindparam}},
+@samp{@var{type}*@var{kindparam}}, or in the @value{GDBN}-only dialect
+@samp{@var{type}_@var{kindparam}}.  A concrete example would be
+@samp{@code{Real*4}}, @samp{@code{Real(kind=4)}}, and @samp{@code{Real_4}}.
+The kind of a type can be retrieved by using the intrinsic function
+@code{KIND}, see @ref{Fortran Intrinsics}.
+
+Generally, the actual implementation of the @code{KIND} type parameter is
+compiler specific.  In @value{GDBN} the kind parameter is implemented in
+accordance with its use in the @sc{gnu} @command{gfortran} compiler.  Here, the
+kind parameter for a given @var{type} specifies its size in memory --- a
+Fortran @code{Integer*4} or @code{Integer(kind=4)} would be an integer type
+occupying 4 bytes of memory.  An exception to this rule is the @code{Complex}
+type for which the kind of the type does not specify its entire size, but
+the size of each of the two @code{Real}'s it is composed of.  A
+@code{Complex*4} would thus consist of two @code{Real*4}s and occupy 8 bytes
+of memory.
+
+For every type there is also a default kind associated with it, e.g.@
+@code{Integer} in @value{GDBN} will internally be an @code{Integer*4} (see the
+table below for default types).  The default types are the same as in @sc{gnu}
+compilers but note, that the @sc{gnu} default types can actually be changed by
+compiler flags such as @option{-fdefault-integer-8} and
+@option{-fdefault-real-8}.
+
+Not every kind parameter is valid for every type and in @value{GDBN} the
+following type kinds are available.
+
+@table @code
+@item Integer
+@code{Integer*1}, @code{Integer*2}, @code{Integer*4}, @code{Integer*8}, and
+@code{Integer} = @code{Integer*4}.
+
+@item Logical
+@code{Logical*1}, @code{Logical*2}, @code{Logical*4}, @code{Logical*8}, and
+@code{Logical} = @code{Logical*4}.
+
+@item Real
+@code{Real*4}, @code{Real*8}, @code{Real*16}, and @code{Real} = @code{Real*4}.
+
+@item Complex
+@code{Complex*4}, @code{Complex*8}, @code{Complex*16}, and @code{Complex} =
+@code{Complex*4}.
+
+@end table
+
 @node Fortran Operators
 @subsubsection Fortran Operators and Expressions
 
@@ -17221,15 +17280,79 @@ to set breakpoints on subroutines nested in modules or in other
 subroutines (internal subroutines).
 @end table
 
-@node Fortran Defaults
-@subsubsection Fortran Defaults
+@node Fortran Intrinsics
+@subsubsection Fortran Intrinsics
 
-@cindex Fortran Defaults
+@cindex Fortran Intrinsics
 
-Fortran symbols are usually case-insensitive, so @value{GDBN} by
-default uses case-insensitive matches for Fortran symbols.  You can
-change that with the @samp{set case-insensitive} command, see
-@ref{Symbols}, for the details.
+Fortran provides a large set of intrinsic procedures.  @value{GDBN} implements
+an incomplete subset of those procedures and their overloads.  Some of these
+procedures take an optional @code{KIND} parameter, see @ref{Fortran Types}.
+
+@table @code
+@item ABS(@var{a})
+Computes the absolute value of its argument @var{a}.  Currently not supported
+for @code{Complex} arguments.
+
+@item ALLOCATE(@var{array})
+Returns whether @var{array} is allocated or not.
+
+@item ASSOCIATED(@var{pointer} [, @var{target}])
+Returns the association status of the pointer @var{pointer} or, if @var{target}
+is present, whether @var{pointer} is associated with the target @var{target}.
+
+@item CEILING(@var{a} [, @var{kind}])
+Computes the least integer greater than or equal to @var{a}.  The optional
+parameter @var{kind} specifies the kind of the return type
+@code{Integer(@var{kind})}.
+
+@item CMPLX(@var{x} [, @var{y} [, @var{kind}]])
+Returns a complex number where @var{x} is converted to the real component.  If
+@var{y} is present it is converted to the imaginary component.  If @var{y} is
+not present then the imaginary component is set to @code{0.0} except if @var{x}
+itself is of @code{Complex} type.  The optional parameter @var{kind} specifies
+the kind of the return type @code{Complex(@var{kind})}.
+
+@item FLOOR(@var{a} [, @var{kind}])
+Computes the greatest integer less than or equal to @var{a}.  The optional
+parameter @var{kind} specifies the kind of the return type
+@code{Integer(@var{kind})}.
+
+@item KIND(@var{a})
+Returns the kind value of the argument @var{a}, see @ref{Fortran Types}.
+
+@item LBOUND(@var{array} [, @var{dim} [, @var{kind}]])
+Returns the lower bounds of an @var{array}, or a single lower bound along the
+@var{dim} dimension if present.  The optional parameter @var{kind} specifies
+the kind of the return type @code{Integer(@var{kind})}.
+
+@item LOC(@var{x})
+Returns the address of @var{x} as an @code{Integer}.
+
+@item MOD(@var{a}, @var{p})
+Computes the remainder of the division of @var{a} by @var{p}.
+
+@item MODULO(@var{a}, @var{p})
+Computes the @var{a} modulo @var{p}.
+
+@item RANK(@var{a})
+Returns the rank of a scalar or array (scalars have rank @code{0}).
+
+@item SHAPE(@var{a})
+Returns the shape of a scalar or array (scalars have shape @samp{@code{()}}).
+
+@item SIZE(@var{array}[, @var{dim} [, @var{kind}]])
+Returns the extent of @var{array} along a specified dimension @var{dim}, or the
+total number of elements in @var{array} if @var{dim} is absent.  The optional
+parameter @var{kind} specifies the kind of the return type
+@code{Integer(@var{kind})}.
+
+@item UBOUND(@var{array} [, @var{dim} [, @var{kind}]])
+Returns the upper bounds of an @var{array}, or a single upper bound along the
+@var{dim} dimension if present.  The optional parameter @var{kind} specifies
+the kind of the return type @code{Integer(@var{kind})}.
+
+@end table
 
 @node Special Fortran Commands
 @subsubsection Special Fortran Commands
-- 
2.25.1

Intel Deutschland GmbH
Registered Address: Am Campeon 10, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de <http://www.intel.de>
Managing Directors: Christin Eisenschmid, Sharon Heck, Tiffany Doon Silva  
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v3 11/11] gdb/doc: add section about Fortran intrinsic functions and types
  2022-04-11  8:18 ` [PATCH v3 11/11] gdb/doc: add section about Fortran intrinsic functions and types Nils-Christian Kempke
@ 2022-04-11 11:38   ` Eli Zaretskii
  2022-04-11 12:08     ` Kempke, Nils-Christian
  0 siblings, 1 reply; 8+ messages in thread
From: Eli Zaretskii @ 2022-04-11 11:38 UTC (permalink / raw)
  To: Nils-Christian Kempke; +Cc: gdb-patches

> From: Nils-Christian Kempke <nils-christian.kempke@intel.com>
> Cc: eliz@gnu.org,
> 	Nils-Christian Kempke <nils-christian.kempke@intel.com>
> Date: Mon, 11 Apr 2022 10:18:59 +0200
> 
> The earlier version of this document had no sections about the
> available Fortran intrinsic functions or the Fortran builtin types.
> 
> I added two sections 'Fortran intrinsics' and 'Fortran types' to
> document the available Fortran language features.  The subsection
> 'Fortran Defaults' has been integrated into the Fortran subsection.

Thanks.

> +@item SHAPE(@var{a})
> +Returns the shape of a scalar or array (scalars have shape @samp{@code{()}}).

It is not useful to nest @code inside @samp.  Please use just @samp:
it does the job of both, but without adding an extra pair of quotes in
the Info output.

This patch is okay with the above nit fixed.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: [PATCH v3 11/11] gdb/doc: add section about Fortran intrinsic functions and types
  2022-04-11 11:38   ` Eli Zaretskii
@ 2022-04-11 12:08     ` Kempke, Nils-Christian
  0 siblings, 0 replies; 8+ messages in thread
From: Kempke, Nils-Christian @ 2022-04-11 12:08 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: gdb-patches

> -----Original Message-----
> From: Eli Zaretskii <eliz@gnu.org>
> Sent: Monday, April 11, 2022 1:39 PM
> To: Kempke, Nils-Christian <nils-christian.kempke@intel.com>
> Cc: gdb-patches@sourceware.org
> Subject: Re: [PATCH v3 11/11] gdb/doc: add section about Fortran intrinsic
> functions and types
> 
> > From: Nils-Christian Kempke <nils-christian.kempke@intel.com>
> > Cc: eliz@gnu.org,
> > 	Nils-Christian Kempke <nils-christian.kempke@intel.com>
> > Date: Mon, 11 Apr 2022 10:18:59 +0200
> >
> > The earlier version of this document had no sections about the
> > available Fortran intrinsic functions or the Fortran builtin types.
> >
> > I added two sections 'Fortran intrinsics' and 'Fortran types' to
> > document the available Fortran language features.  The subsection
> > 'Fortran Defaults' has been integrated into the Fortran subsection.
> 
> Thanks.
> 
> > +@item SHAPE(@var{a})
> > +Returns the shape of a scalar or array (scalars have shape
> @samp{@code{()}}).
> 
> It is not useful to nest @code inside @samp.  Please use just @samp:
> it does the job of both, but without adding an extra pair of quotes in
> the Info output.
> 
> This patch is okay with the above nit fixed.

Thanks! I've fixed this.

I've pushed this series.

-Nils
Intel Deutschland GmbH
Registered Address: Am Campeon 10, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de <http://www.intel.de>
Managing Directors: Christin Eisenschmid, Sharon Heck, Tiffany Doon Silva  
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v3 00/11] Improve Fortran intrinsic types and procedures
  2022-04-11  8:18 [PATCH v3 00/11] Improve Fortran intrinsic types and procedures Nils-Christian Kempke
  2022-04-11  8:18 ` [PATCH v3 11/11] gdb/doc: add section about Fortran intrinsic functions and types Nils-Christian Kempke
@ 2022-04-25 12:52 ` Luis Machado
  2022-04-25 13:19   ` Kempke, Nils-Christian
  1 sibling, 1 reply; 8+ messages in thread
From: Luis Machado @ 2022-04-25 12:52 UTC (permalink / raw)
  To: Nils-Christian Kempke, gdb-patches

Hi,

On 4/11/22 09:18, Nils-Christian Kempke via Gdb-patches wrote:
> Hi,
> 
> please find attached v3 of the series.
> 
> V1 can be found here
> 
> https://sourceware.org/pipermail/gdb-patches/2022-March/186473.html
> 
> V2 here
> 
> https://sourceware.org/pipermail/gdb-patches/2022-April/187655.html
> 
> Changes since V2:
> 
> 	- [Patch 11/11]: Fixed Texinfo issues.
> 
> 
> Thanks!
> 
> Nils
> 
> 
> Nils-Christian Kempke (11):
>    gdb/f-lang: add Integer*1 to Fortran builtin types
>    gdb/f-lang: remove hidden ^L characters
>    gdb/fortran: fix complex type in Fortran builtin types
>    gdb/fortran: reformat build_fortran_types in f-lang.c
>    gdb/fortran: change default logical type to builtin_logical
>    gdb/fortran: clean-up Fortran intrinsic types
>    gdb/fortran: Change GDB print for fortran default types
>    gdb/fortran: rename f77_keywords to f_keywords
>    gdb/fortran: rewrite intrinsic handling and add some missing overloads
>    gdb/fortran/testsuite: add complex from integers test
>    gdb/doc: add section about Fortran intrinsic functions and types
> 
>   gdb/doc/gdb.texinfo                         | 143 ++++++-
>   gdb/f-exp.h                                 | 182 +++++++--
>   gdb/f-exp.y                                 | 397 ++++++++++++++------
>   gdb/f-lang.c                                | 267 +++++++++----
>   gdb/f-lang.h                                |   7 +-
>   gdb/std-operator.def                        |  10 +-
>   gdb/testsuite/gdb.fortran/complex.exp       |  10 +-
>   gdb/testsuite/gdb.fortran/complex.f90       |   7 +-
>   gdb/testsuite/gdb.fortran/intrinsics.exp    |  46 ++-
>   gdb/testsuite/gdb.fortran/lbound-ubound.F90 |  49 ++-
>   gdb/testsuite/gdb.fortran/lbound-ubound.exp |  29 +-
>   gdb/testsuite/gdb.fortran/size.exp          |  84 ++++-
>   gdb/testsuite/gdb.fortran/size.f90          | 213 ++++++++---
>   gdb/testsuite/gdb.fortran/type-kinds.exp    |   2 +
>   gdb/testsuite/gdb.fortran/types.exp         |  34 +-
>   15 files changed, 1160 insertions(+), 320 deletions(-)
> 

I'm running into an internal error after this series when running 
gdb.fortran/intrinsics.exp on 32-bit arm Ubuntu 18.04.

We're failing this particular assertion in eval_op_f_cmplx:

gdb_assert (kind_arg->code () == TYPE_CODE_COMPLEX);


kind_arg->code () == TYPE_CODE_ERROR. I see gdb/f-lang.c initializing 
some types to TYPE_CODE_ERROR if they're not supported. Should we fail 
gracefully in this particular case?

^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: [PATCH v3 00/11] Improve Fortran intrinsic types and procedures
  2022-04-25 12:52 ` [PATCH v3 00/11] Improve Fortran intrinsic types and procedures Luis Machado
@ 2022-04-25 13:19   ` Kempke, Nils-Christian
  2022-04-25 13:21     ` Kempke, Nils-Christian
  2022-04-25 13:41     ` Luis Machado
  0 siblings, 2 replies; 8+ messages in thread
From: Kempke, Nils-Christian @ 2022-04-25 13:19 UTC (permalink / raw)
  To: Luis Machado, gdb-patches

Hi,

Sorry for that - I think the assert should have been removed anyway.

I might have missed removing it - but the two lines below are what I wrote instead - an
error and gdb should not crash..

  if (value_type (arg1)->code () == TYPE_CODE_COMPLEX
      || value_type (arg2)->code () == TYPE_CODE_COMPLEX)
    error (_("Types of arguments for CMPLX called with more then one argument "
	     "must be REAL or INTEGER"));

Does removing the assert do that? I'd assume the tests then just FAIL.

Cheers,
Nils

> -----Original Message-----
> From: Luis Machado <luis.machado@arm.com>
> Sent: Monday, April 25, 2022 2:52 PM
> To: Kempke, Nils-Christian <nils-christian.kempke@intel.com>; gdb-
> patches@sourceware.org
> Subject: Re: [PATCH v3 00/11] Improve Fortran intrinsic types and procedures
> 
> Hi,
> 
> On 4/11/22 09:18, Nils-Christian Kempke via Gdb-patches wrote:
> > Hi,
> >
> > please find attached v3 of the series.
> >
> > V1 can be found here
> >
> > https://sourceware.org/pipermail/gdb-patches/2022-March/186473.html
> >
> > V2 here
> >
> > https://sourceware.org/pipermail/gdb-patches/2022-April/187655.html
> >
> > Changes since V2:
> >
> > 	- [Patch 11/11]: Fixed Texinfo issues.
> >
> >
> > Thanks!
> >
> > Nils
> >
> >
> > Nils-Christian Kempke (11):
> >    gdb/f-lang: add Integer*1 to Fortran builtin types
> >    gdb/f-lang: remove hidden ^L characters
> >    gdb/fortran: fix complex type in Fortran builtin types
> >    gdb/fortran: reformat build_fortran_types in f-lang.c
> >    gdb/fortran: change default logical type to builtin_logical
> >    gdb/fortran: clean-up Fortran intrinsic types
> >    gdb/fortran: Change GDB print for fortran default types
> >    gdb/fortran: rename f77_keywords to f_keywords
> >    gdb/fortran: rewrite intrinsic handling and add some missing overloads
> >    gdb/fortran/testsuite: add complex from integers test
> >    gdb/doc: add section about Fortran intrinsic functions and types
> >
> >   gdb/doc/gdb.texinfo                         | 143 ++++++-
> >   gdb/f-exp.h                                 | 182 +++++++--
> >   gdb/f-exp.y                                 | 397 ++++++++++++++------
> >   gdb/f-lang.c                                | 267 +++++++++----
> >   gdb/f-lang.h                                |   7 +-
> >   gdb/std-operator.def                        |  10 +-
> >   gdb/testsuite/gdb.fortran/complex.exp       |  10 +-
> >   gdb/testsuite/gdb.fortran/complex.f90       |   7 +-
> >   gdb/testsuite/gdb.fortran/intrinsics.exp    |  46 ++-
> >   gdb/testsuite/gdb.fortran/lbound-ubound.F90 |  49 ++-
> >   gdb/testsuite/gdb.fortran/lbound-ubound.exp |  29 +-
> >   gdb/testsuite/gdb.fortran/size.exp          |  84 ++++-
> >   gdb/testsuite/gdb.fortran/size.f90          | 213 ++++++++---
> >   gdb/testsuite/gdb.fortran/type-kinds.exp    |   2 +
> >   gdb/testsuite/gdb.fortran/types.exp         |  34 +-
> >   15 files changed, 1160 insertions(+), 320 deletions(-)
> >
> 
> I'm running into an internal error after this series when running
> gdb.fortran/intrinsics.exp on 32-bit arm Ubuntu 18.04.
> 
> We're failing this particular assertion in eval_op_f_cmplx:
> 
> gdb_assert (kind_arg->code () == TYPE_CODE_COMPLEX);
> 
> 
> kind_arg->code () == TYPE_CODE_ERROR. I see gdb/f-lang.c initializing
> some types to TYPE_CODE_ERROR if they're not supported. Should we fail
> gracefully in this particular case?
Intel Deutschland GmbH
Registered Address: Am Campeon 10, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de <http://www.intel.de>
Managing Directors: Christin Eisenschmid, Sharon Heck, Tiffany Doon Silva  
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928

^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: [PATCH v3 00/11] Improve Fortran intrinsic types and procedures
  2022-04-25 13:19   ` Kempke, Nils-Christian
@ 2022-04-25 13:21     ` Kempke, Nils-Christian
  2022-04-25 13:41     ` Luis Machado
  1 sibling, 0 replies; 8+ messages in thread
From: Kempke, Nils-Christian @ 2022-04-25 13:21 UTC (permalink / raw)
  To: Kempke, Nils-Christian, Luis Machado, gdb-patches

> From: Gdb-patches <gdb-patches-bounces+nils-
> christian.kempke=intel.com@sourceware.org> On Behalf Of Kempke, Nils-
> Christian via Gdb-patches
> Sent: Monday, April 25, 2022 3:20 PM
> To: Luis Machado <luis.machado@arm.com>; gdb-patches@sourceware.org
> Subject: RE: [PATCH v3 00/11] Improve Fortran intrinsic types and procedures
> 
> Hi,
> 
> Sorry for that - I think the assert should have been removed anyway.
> 
> I might have missed removing it - but the two lines below are what I wrote
> instead - an
> error and gdb should not crash..
> 
>   if (value_type (arg1)->code () == TYPE_CODE_COMPLEX
>       || value_type (arg2)->code () == TYPE_CODE_COMPLEX)
>     error (_("Types of arguments for CMPLX called with more then one
> argument "
> 	     "must be REAL or INTEGER"));
> 
> Does removing the assert do that? I'd assume the tests then just FAIL.
> 
> Cheers,
> Nils

I have to correct myself - I wanted to say we should instead of having the assert
likely have an error instead, similar to the two lines below (the ones I cited).

Nils

Intel Deutschland GmbH
Registered Address: Am Campeon 10, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de <http://www.intel.de>
Managing Directors: Christin Eisenschmid, Sharon Heck, Tiffany Doon Silva  
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v3 00/11] Improve Fortran intrinsic types and procedures
  2022-04-25 13:19   ` Kempke, Nils-Christian
  2022-04-25 13:21     ` Kempke, Nils-Christian
@ 2022-04-25 13:41     ` Luis Machado
  1 sibling, 0 replies; 8+ messages in thread
From: Luis Machado @ 2022-04-25 13:41 UTC (permalink / raw)
  To: Kempke, Nils-Christian, gdb-patches

On 4/25/22 14:19, Kempke, Nils-Christian wrote:
> Hi,
> 
> Sorry for that - I think the assert should have been removed anyway.
> 

Not a problem. I just want to make sure I understand the failure and 
what needs to be done to address it.

> I might have missed removing it - but the two lines below are what I wrote instead - an
> error and gdb should not crash..
> 
>    if (value_type (arg1)->code () == TYPE_CODE_COMPLEX
>        || value_type (arg2)->code () == TYPE_CODE_COMPLEX)
>      error (_("Types of arguments for CMPLX called with more then one argument "
> 	     "must be REAL or INTEGER"));
> 
> Does removing the assert do that? I'd assume the tests then just FAIL.
> 

Just for informational purposes, dropping the assertion makes the code 
assert somewhere else.

We could stop with an error like "Unsupported kind" if kind_arg->code () 
is unexpected, but I'm wondering if we could've caught this somewhere 
else before calling into this function with something we know is wrong 
already. If we could do that, then we would fail early, and possibly 
more gracefully.

I see errors of the following type:

"unsupported kind 1 for type complex*4"

This gives a bit more information, but I don't think a code == 
TYPE_CODE_ERROR gives us a chance to show anything more.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-04-25 13:41 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-11  8:18 [PATCH v3 00/11] Improve Fortran intrinsic types and procedures Nils-Christian Kempke
2022-04-11  8:18 ` [PATCH v3 11/11] gdb/doc: add section about Fortran intrinsic functions and types Nils-Christian Kempke
2022-04-11 11:38   ` Eli Zaretskii
2022-04-11 12:08     ` Kempke, Nils-Christian
2022-04-25 12:52 ` [PATCH v3 00/11] Improve Fortran intrinsic types and procedures Luis Machado
2022-04-25 13:19   ` Kempke, Nils-Christian
2022-04-25 13:21     ` Kempke, Nils-Christian
2022-04-25 13:41     ` Luis Machado

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).