From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by sourceware.org (Postfix) with ESMTPS id 203803857C51 for ; Wed, 9 Mar 2022 10:40:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 203803857C51 X-IronPort-AV: E=McAfee;i="6200,9189,10280"; a="235551618" X-IronPort-AV: E=Sophos;i="5.90,167,1643702400"; d="scan'208";a="235551618" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Mar 2022 02:40:12 -0800 X-IronPort-AV: E=Sophos;i="5.90,167,1643702400"; d="scan'208";a="711898435" Received: from labpcdell3650-003.iul.intel.com (HELO localhost) ([172.28.49.87]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Mar 2022 02:40:11 -0800 From: Nils-Christian Kempke To: gdb-patches@sourceware.org Subject: [PATCH 11/11] gdb/doc: add section about fortran intrinsic functions and types Date: Wed, 9 Mar 2022 11:39:22 +0100 Message-Id: <20220309103922.3257803-12-nils-christian.kempke@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220309103922.3257803-1-nils-christian.kempke@intel.com> References: <20220309103922.3257803-1-nils-christian.kempke@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-10.9 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org 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: , X-List-Received-Date: Wed, 09 Mar 2022 10:40:15 -0000 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. gdb/doc/ChangeLog: 2022-03-03 Nils-Christian Kempke * gdb.texinfo (Fortran): Add sections about Fortran builtin types and Fortran intrinsic functions. Signed-off-by: Nils-Christian Kempke --- gdb/doc/gdb.texinfo | 138 ++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 128 insertions(+), 10 deletions(-) diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index 132b94c648..1f10a77c25 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -17174,8 +17174,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 @@ -17185,11 +17185,68 @@ will need to refer to variables and functions with a trailing underscore. @menu -* Fortran Operators:: Fortran operators and expressions * Fortran Defaults:: Default settings for Fortran +* Fortran Types:: Fortran builtin types +* Fortran Operators:: Fortran operators and expressions +* Fortran Intrinsics:: Fortran intrinsic functions * Special Fortran Commands:: Special @value{GDBN} commands for Fortran @end menu +@node Fortran Defaults +@subsubsection Fortran Defaults + +@cindex Fortran Defaults + +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. + +@node Fortran Types +@subsubsection Fortran Types + +@cindex Fortran Types + +In Fortran the primitive data-types have an associated KIND type parameter, +written as 'TYPE*KINDPARAM', 'TYPE(KIND=KINDPARAM)', or in the +@value{GDBN}-only dialect 'TYPE_KINDPARAM'. A concrete example would be +'REAL*4', 'REAL(KIND=4)', and 'REAL_4'. The kind of a type can be retrieved by +using the intrinsic function KIND(), see @ref{Fortran Intrinsics}. + +Generally, the actual implementation of the KIND type parameter is compiler +specific. In @value{GDBN} the kind parameter is implemented in accordance to +its use in the @sc{gnu} gfortran compiler. Here, the kind parameter for a +given TYPE specifies its size in memory - a Fortran Integer*4 or +Integer(kind=4) would be an integer type occupying 4 bytes of memory. An +exception to this rule is the COMPLEX type for which the kind of the type +does not specify its entire size, but the size of each of the two REAL's it is +composed of. A COMPLEX*4 would thus consist of two REAL*4s and occupy 8 bytes +of memory. + +For every type there is also a default kind associated with it, e.g. 'Integer' +in @value{GDBN} will internally be an 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 '-fdefault-integer-8' and '-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 +Integer*1, Integer*2, Integer*4, Integer*8, and Integer = Integer*4. + +@item LOGICAL +Locigal*1, Locigal*2, Locigal*4, Locigal*8, and Locigal = Locigal*4. + +@item REAL +Real*4, Real*8, Real*16, and Real = Real*4. + +@item COMPLEX +Complex*4, Complex*8, Complex*16, and Complex = Complex*4. + +@end table + @node Fortran Operators @subsubsection Fortran Operators and Expressions @@ -17219,15 +17276,76 @@ 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 KIND parameter, see @ref{Fortran Types}. + +@table @code +@item ABS(A) +Computes the absolut value of its operand A. Currently not supported for +COMPLEX arguments. + +@item ALLOCATE(ARRAY) +Returns whether ARRAY is allocated or not. + +@item ASSOCIATED(POINTER [, TARGET]) +Returns the association status of the pointer POINTER or if TARGET is present +whether POINTER is associated with the target TARGET. + +@item CEILING(A [, KIND]) +Computes the least integer greater than or equal to A. The optional parameter +KIND specifies the kind of the return type INTEGER(KIND). + +@item CMPLX(X [, Y [, KIND]]) +Returns a complex number where X is converted to the real component. If Y is +present it is converted to the imaginary component. If Y is not present then +the imaginary component is set to 0.0 except if X itself is of COMPLEX type. +The optional parameter KIND specifies the kind of the return type +COMPLEX(KIND). + +@item FLOOR(A [, KIND]) +Computes the greatest integer less than or equal to A. The optional parameter +KIND specifies the kind of the return type INTEGER(KIND). + +@item KIND(A) +Returns the kind value of the argument A, see @ref{Fortran Types}. + +@item LBOUND(ARRAY [, DIM [, KIND]]) +Returns the lower bounds of an array, or a single lower bound along the DIM +dimension if present. The optional parameter KIND specifies the kind of the +return type INTEGER(KIND). + +@item LOC(X) +Returns the address of X as an Integer. + +@item MOD(A, P) +Computes the remainder of the division of A by P. + +@item MODULO(A,P) +Computes the A modulo P. + +@item RANK(A) +Returns the rank of a scalar or array (scalars have rank 0). + +@item SHAPE(A) +Returns the shape of a scalar or array (scalars have shape '()'). + +@item SIZE(ARRAY[, DIM [, KIND]]) +Returns the extent of ARRAY along a specified dimension DIM, or the total +number of elements in ARRAY if DIM is absent. The optional parameter KIND +specifies the kind of the return type INTEGER(KIND). + +@item UBOUND(ARRAY [, DIM [, KIND]]) +Returns the upper bounds of an array, or a single lower bound along the DIM +dimension if present. The optional parameter KIND specifies the kind of the +return type INTEGER(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 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