public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] fortran/44797 -- inquire's exist shall be default logical
@ 2010-07-04  6:06 Steve Kargl
  2010-07-04  7:22 ` Tobias Burnus
  0 siblings, 1 reply; 4+ messages in thread
From: Steve Kargl @ 2010-07-04  6:06 UTC (permalink / raw)
  To: fortran, gcc-patches

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

The standard requires a default logical for the EXIST
tag in an inquire statement.  gfortran has an extension
to accept any logical kind.  However, if -std=f95 or
-std=f2003 is given gfortran does not issue an error.
This patch fixes that shortcoming.

OK for trunk?
 
2010-07-03  Steven G. Kargl  <kargl@gcc.gnu.org>

	PR fortran/44797
	* fortran/io.c (resolve_tag): Check EXIST is a default logical.

-- 
Steve

[-- Attachment #2: io.c.diff --]
[-- Type: text/x-diff, Size: 562 bytes --]

Index: io.c
===================================================================
--- io.c	(revision 161480)
+++ io.c	(working copy)
@@ -1497,6 +1497,14 @@ resolve_tag (const io_tag *tag, gfc_expr
 	return FAILURE;
     }
 
+  if (tag == &tag_exist && e->ts.kind != gfc_default_logical_kind)
+    {
+      if (gfc_notify_std (GFC_STD_GNU, "default LOGICAL required "
+			  "in %s tag at %L", tag->name, &e->where)
+	  == FAILURE)
+	return FAILURE;
+    }
+
   if (tag == &tag_convert)
     {
       if (gfc_notify_std (GFC_STD_GNU, "Extension: CONVERT tag at %L",

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

* Re: [PATCH] fortran/44797 -- inquire's exist shall be default logical
  2010-07-04  6:06 [PATCH] fortran/44797 -- inquire's exist shall be default logical Steve Kargl
@ 2010-07-04  7:22 ` Tobias Burnus
  2010-07-04  8:10   ` Tobias Burnus
  0 siblings, 1 reply; 4+ messages in thread
From: Tobias Burnus @ 2010-07-04  7:22 UTC (permalink / raw)
  To: Steve Kargl; +Cc: fortran, gcc-patches

Steve Kargl wrote:
> The standard requires a default logical for the EXIST
> tag in an inquire statement.  gfortran has an extension
> to accept any logical kind.  However, if -std=f95 or
> -std=f2003 is given gfortran does not issue an error.
> This patch fixes that shortcoming.
>
> OK for trunk?
>   

OK if you change GFC_STD_GNU into GFC_STD_F2008. While F95 has

R924 inquire-spec ... or EXIST = scalar-default-logical-variable

and F2003 has

R930 inquire-spec ... EXIST = scalar-default-logical-variable

F2008 FDIS allows it:

R931 inquire-spec ... EXIST = scalar-logical-variable

Tobias

> 2010-07-03  Steven G. Kargl  <kargl@gcc.gnu.org>
>
> 	PR fortran/44797
> 	* fortran/io.c (resolve_tag): Check EXIST is a default logical

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

* Re: [PATCH] fortran/44797 -- inquire's exist shall be default logical
  2010-07-04  7:22 ` Tobias Burnus
@ 2010-07-04  8:10   ` Tobias Burnus
  2010-07-05 20:15     ` Steve Kargl
  0 siblings, 1 reply; 4+ messages in thread
From: Tobias Burnus @ 2010-07-04  8:10 UTC (permalink / raw)
  Cc: Steve Kargl, fortran, gcc-patches

Am 04.07.2010 09:21, schrieb Tobias Burnus:
> Steve Kargl wrote:
>> The standard requires a default logical for the EXIST
>> tag in an inquire statement.  gfortran has an extension
>> to accept any logical kind.  However, if -std=f95 or
>> -std=f2003 is given gfortran does not issue an error.
>> This patch fixes that shortcoming.
>>
>> OK for trunk?
>>   
> 
> OK if you change GFC_STD_GNU into GFC_STD_F2008. While F95 has

For completeness, I have checked the other I/O statements and the change
applies to all (F2003->F2008).


+      if (gfc_notify_std (GFC_STD_GNU, "default LOGICAL required "
+			  "in %s tag at %L", tag->name, &e->where)

I would like to see in the message that it is allowed with F2008, e.g.
"Fortran 2008: Nondefault LOGICAL in %s tag at %L".

Tobias

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

* Re: [PATCH] fortran/44797 -- inquire's exist shall be default logical
  2010-07-04  8:10   ` Tobias Burnus
@ 2010-07-05 20:15     ` Steve Kargl
  0 siblings, 0 replies; 4+ messages in thread
From: Steve Kargl @ 2010-07-05 20:15 UTC (permalink / raw)
  To: Tobias Burnus; +Cc: fortran, gcc-patches

On Sun, Jul 04, 2010 at 10:09:37AM +0200, Tobias Burnus wrote:
> Am 04.07.2010 09:21, schrieb Tobias Burnus:
> > Steve Kargl wrote:
> >> The standard requires a default logical for the EXIST
> >> tag in an inquire statement.  gfortran has an extension
> >> to accept any logical kind.  However, if -std=f95 or
> >> -std=f2003 is given gfortran does not issue an error.
> >> This patch fixes that shortcoming.
> >>
> >> OK for trunk?
> >>   
> > 
> > OK if you change GFC_STD_GNU into GFC_STD_F2008. While F95 has
> 
> For completeness, I have checked the other I/O statements and the change
> applies to all (F2003->F2008).
> 
> 
> +      if (gfc_notify_std (GFC_STD_GNU, "default LOGICAL required "
> +			  "in %s tag at %L", tag->name, &e->where)
> 
> I would like to see in the message that it is allowed with F2008, e.g.
> "Fortran 2008: Nondefault LOGICAL in %s tag at %L".
> 

Committed with your suggested changes as

Sending        ChangeLog
Sending        io.c
Transmitting file data ..
Committed revision 161852.

-- 
Steve

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

end of thread, other threads:[~2010-07-05 20:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-07-04  6:06 [PATCH] fortran/44797 -- inquire's exist shall be default logical Steve Kargl
2010-07-04  7:22 ` Tobias Burnus
2010-07-04  8:10   ` Tobias Burnus
2010-07-05 20:15     ` Steve Kargl

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