public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Intrinsic documentation for DIM, MOD and MODULO.
@ 2019-08-19 10:40 Mark Eggleston
  2019-08-19 15:14 ` Jeff Law
  0 siblings, 1 reply; 4+ messages in thread
From: Mark Eggleston @ 2019-08-19 10:40 UTC (permalink / raw)
  To: gcc-patches, fortran

[-- Attachment #1: Type: text/plain, Size: 500 bytes --]

The intrinsics DIM, MOD and MODULO can accept arguments of different 
kinds and return values with the larger of the two kinds. Notes to this 
effect have been added as they were missing from the documentation.

Please find attached the patch.

ChangeLog:

gcc/fortran/ChangeLog

     Mark Eggleston  <mark.eggleston@codethink.com>

     PR fortran/89236
     * intrinsic.texi: Add GNU extension notes to DIM, MOD, MODULO.

-- 
https://www.codethink.co.uk/privacy.html


[-- Attachment #2: 0001-Intrinsic-documentation.patch --]
[-- Type: text/x-patch, Size: 3017 bytes --]

From 4e527390271f8002f37b33262bd4b4f90ad2062a Mon Sep 17 00:00:00 2001
From: Mark Eggleston <markeggleston@codethink.com>
Date: Tue, 5 Feb 2019 16:38:10 +0000
Subject: [PATCH] Intrinsic documentation.

---
 gcc/fortran/intrinsic.texi | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/gcc/fortran/intrinsic.texi b/gcc/fortran/intrinsic.texi
index 941c2e39374..4cb0ec8a4cd 100644
--- a/gcc/fortran/intrinsic.texi
+++ b/gcc/fortran/intrinsic.texi
@@ -4876,11 +4876,13 @@ Elemental function
 @item @emph{Arguments}:
 @multitable @columnfractions .15 .70
 @item @var{X} @tab The type shall be @code{INTEGER} or @code{REAL}
-@item @var{Y} @tab The type shall be the same type and kind as @var{X}.
+@item @var{Y} @tab The type shall be the same type and kind as @var{X}.  (As
+a GNU extension, arguments of different kinds are permitted.)
 @end multitable
 
 @item @emph{Return value}:
-The return value is of type @code{INTEGER} or @code{REAL}.
+The return value is of type @code{INTEGER} or @code{REAL}.  (As a GNU
+extension, kind is the largest kind of the actual arguments.)
 
 @item @emph{Example}:
 @smallexample
@@ -10603,14 +10605,16 @@ Elemental function
 @multitable @columnfractions .15 .70
 @item @var{A} @tab Shall be a scalar of type @code{INTEGER} or @code{REAL}.
 @item @var{P} @tab Shall be a scalar of the same type and kind as @var{A} 
-and not equal to zero.
+and not equal to zero.  (As a GNU extension, arguments of different kinds are
+permitted.)
 @end multitable
 
 @item @emph{Return value}:
 The return value is the result of @code{A - (INT(A/P) * P)}. The type
 and kind of the return value is the same as that of the arguments. The
 returned value has the same sign as A and a magnitude less than the
-magnitude of P.
+magnitude of P.  (As a GNU extension, kind is the largest kind of the actual
+arguments.)
 
 @item @emph{Example}:
 @smallexample
@@ -10674,11 +10678,13 @@ Elemental function
 @multitable @columnfractions .15 .70
 @item @var{A} @tab Shall be a scalar of type @code{INTEGER} or @code{REAL}.
 @item @var{P} @tab Shall be a scalar of the same type and kind as @var{A}. 
-It shall not be zero.
+It shall not be zero.  (As a GNU extension, arguments of different kinds are
+permitted.)
 @end multitable
 
 @item @emph{Return value}:
-The type and kind of the result are those of the arguments.
+The type and kind of the result are those of the arguments.  (As a GNU
+extension, kind is the largest kind of the actual arguments.)
 @table @asis
 @item If @var{A} and @var{P} are of type @code{INTEGER}:
 @code{MODULO(A,P)} has the value @var{R} such that @code{A=Q*P+R}, where
@@ -12911,7 +12917,7 @@ Elemental function
 @item @emph{Arguments}:
 @multitable @columnfractions .15 .70
 @item @var{A} @tab Shall be of type @code{INTEGER} or @code{REAL}
-@item @var{B} @tab Shall be of the same type and kind as @var{A}
+@item @var{B} @tab Shall be of the same type and kind as @var{A}.
 @end multitable
 
 @item @emph{Return value}:
-- 
2.11.0


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

* Re: [PATCH] Intrinsic documentation for DIM, MOD and MODULO.
  2019-08-19 10:40 [PATCH] Intrinsic documentation for DIM, MOD and MODULO Mark Eggleston
@ 2019-08-19 15:14 ` Jeff Law
  2019-08-19 16:54   ` Steve Kargl
  0 siblings, 1 reply; 4+ messages in thread
From: Jeff Law @ 2019-08-19 15:14 UTC (permalink / raw)
  To: Mark Eggleston, gcc-patches, fortran

On 8/19/19 3:11 AM, Mark Eggleston wrote:
> The intrinsics DIM, MOD and MODULO can accept arguments of different
> kinds and return values with the larger of the two kinds. Notes to this
> effect have been added as they were missing from the documentation.
> 
> Please find attached the patch.
> 
> ChangeLog:
> 
> gcc/fortran/ChangeLog
> 
>     Mark Eggleston  <mark.eggleston@codethink.com>
> 
>     PR fortran/89236
>     * intrinsic.texi: Add GNU extension notes to DIM, MOD, MODULO.
> 
Do we want to be more specific about what types are accepted as a GNU
extension for these operators?

jeff

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

* Re: [PATCH] Intrinsic documentation for DIM, MOD and MODULO.
  2019-08-19 15:14 ` Jeff Law
@ 2019-08-19 16:54   ` Steve Kargl
  2019-08-19 23:01     ` Jeff Law
  0 siblings, 1 reply; 4+ messages in thread
From: Steve Kargl @ 2019-08-19 16:54 UTC (permalink / raw)
  To: Jeff Law; +Cc: Mark Eggleston, gcc-patches, fortran

On Mon, Aug 19, 2019 at 09:08:12AM -0600, Jeff Law wrote:
> On 8/19/19 3:11 AM, Mark Eggleston wrote:
> > The intrinsics DIM, MOD and MODULO can accept arguments of different
> > kinds and return values with the larger of the two kinds. Notes to this
> > effect have been added as they were missing from the documentation.
> > 
> > Please find attached the patch.
> > 
> > ChangeLog:
> > 
> > gcc/fortran/ChangeLog
> > 
> >     Mark Eggleston  <mark.eggleston@codethink.com>
> > 
> >     PR fortran/89236
> >     * intrinsic.texi: Add GNU extension notes to DIM, MOD, MODULO.
> > 
> Do we want to be more specific about what types are accepted as a GNU
> extension for these operators?
> 

The current documentation already has that info.

_Arguments_:
     X           The type shall be 'INTEGER' or 'REAL'
     Y           The type shall be the same type and kind as X.

In Fortran standardese, INTEGER means any of the supported
integer kinds (e.g., INTEGER(2)).  X and Y must both be either
INTEGER or REAL, and X and Y must have the same kind type
paramter.  Mark's addition to the manual notes that the
GNU extension allows different kind type parameters, e.g.,

integer(1) i
integer(2) j
...
  k = dim(i,j) 

converts i to an integer(2) before executing the function.

Mark, BTW and IMHO, for minor changes/improvements to the gfortran
documentation, I consider these to be pre-approved.  For
large changes, or if you want someone to proofread a change,
then asking for commit approval is appropriate. 
-- 
Steve

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

* Re: [PATCH] Intrinsic documentation for DIM, MOD and MODULO.
  2019-08-19 16:54   ` Steve Kargl
@ 2019-08-19 23:01     ` Jeff Law
  0 siblings, 0 replies; 4+ messages in thread
From: Jeff Law @ 2019-08-19 23:01 UTC (permalink / raw)
  To: sgk; +Cc: Mark Eggleston, gcc-patches, fortran

On 8/19/19 10:19 AM, Steve Kargl wrote:
> On Mon, Aug 19, 2019 at 09:08:12AM -0600, Jeff Law wrote:
>> On 8/19/19 3:11 AM, Mark Eggleston wrote:
>>> The intrinsics DIM, MOD and MODULO can accept arguments of different
>>> kinds and return values with the larger of the two kinds. Notes to this
>>> effect have been added as they were missing from the documentation.
>>>
>>> Please find attached the patch.
>>>
>>> ChangeLog:
>>>
>>> gcc/fortran/ChangeLog
>>>
>>>     Mark Eggleston  <mark.eggleston@codethink.com>
>>>
>>>     PR fortran/89236
>>>     * intrinsic.texi: Add GNU extension notes to DIM, MOD, MODULO.
>>>
>> Do we want to be more specific about what types are accepted as a GNU
>> extension for these operators?
>>
> 
> The current documentation already has that info.
Ah, in that case Mark's patch seems like a no-brainer :-)

Jeff

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

end of thread, other threads:[~2019-08-19 22:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-19 10:40 [PATCH] Intrinsic documentation for DIM, MOD and MODULO Mark Eggleston
2019-08-19 15:14 ` Jeff Law
2019-08-19 16:54   ` Steve Kargl
2019-08-19 23:01     ` Jeff Law

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