* [Patch, Fortran] Coarrays: Add/fix check for no coarrays as result value
@ 2011-08-04 15:01 Tobias Burnus
2011-08-05 21:45 ` Mikael Morin
2011-08-16 9:29 ` H.J. Lu
0 siblings, 2 replies; 4+ messages in thread
From: Tobias Burnus @ 2011-08-04 15:01 UTC (permalink / raw)
To: gcc patches, gfortran
[-- Attachment #1: Type: text/plain, Size: 258 bytes --]
This patch fixes the result check for coarrays / variables with coarray
subcomponents. It was working with a separate RESULT() variable - but
not if the function name was the result variable.
Build and regtested on x86-64-linux.
OK for the trunk?
Tobias
[-- Attachment #2: caf_result.diff --]
[-- Type: text/x-patch, Size: 2390 bytes --]
2011-08-04 Tobias Burnus <burnus@net-b.de>
* resolve.c (resolve_symbol): Fix coarray result-var check.
2011-08-04 Tobias Burnus <burnus@net-b.de>
* gfortran.dg/coarray_26.f90: New.
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
index b8a8ebb..4401ea5 100644
--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -12440,10 +12440,10 @@ resolve_symbol (gfc_symbol *sym)
gfc_error ("Dummy argument '%s' at %L of LOCK_TYPE shall not be "
"INTENT(OUT)", sym->name, &sym->declared_at);
- /* F2008, C526. */
+ /* F2008, C525. */
if (((sym->ts.type == BT_DERIVED && sym->ts.u.derived->attr.coarray_comp)
|| sym->attr.codimension)
- && sym->attr.result)
+ && (sym->attr.result || sym->result == sym))
gfc_error ("Function result '%s' at %L shall not be a coarray or have "
"a coarray component", sym->name, &sym->declared_at);
--- /dev/null 2011-08-04 08:03:55.531886509 +0200
+++ gcc/gcc/testsuite/gfortran.dg/coarray_26.f90 2011-08-04 16:33:40.000000000 +0200
@@ -0,0 +1,53 @@
+! { dg-do compile }
+! { dg-options "-fcoarray=single" }
+!
+! Coarray declaration constraint checks
+!
+
+function foo3a() result(res)
+ implicit none
+ integer :: res
+ codimension :: res[*] ! { dg-error "CODIMENSION attribute conflicts with RESULT" }
+end
+
+function foo2a() result(res)
+ integer :: res[*] ! { dg-error "CODIMENSION attribute conflicts with RESULT" }
+end
+
+function fooa() result(res) ! { dg-error "shall not be a coarray or have a coarray component" }
+ implicit none
+ type t
+ integer, allocatable :: A[:]
+ end type t
+ type(t):: res
+end
+
+function foo3() ! { dg-error "shall not be a coarray or have a coarray component" }
+ implicit none
+ integer :: foo3
+ codimension :: foo3[*]
+end
+
+function foo2() ! { dg-error "shall not be a coarray or have a coarray component" }
+ implicit none
+ integer :: foo2[*]
+end
+
+function foo() ! { dg-error "shall not be a coarray or have a coarray component" }
+ type t
+ integer, allocatable :: A[:]
+ end type t
+ type(t):: foo
+end
+
+subroutine test()
+ use iso_c_binding
+ implicit none
+ type(c_ptr), save :: caf[*] ! { dg-error "shall not be a coarray" }
+end subroutine test
+
+subroutine test2()
+ use iso_c_binding
+ implicit none
+ type(c_funptr), save :: caf[*] ! { dg-error "shall not be a coarray" }
+end subroutine test2
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Patch, Fortran] Coarrays: Add/fix check for no coarrays as result value
2011-08-04 15:01 [Patch, Fortran] Coarrays: Add/fix check for no coarrays as result value Tobias Burnus
@ 2011-08-05 21:45 ` Mikael Morin
2011-08-16 9:29 ` H.J. Lu
1 sibling, 0 replies; 4+ messages in thread
From: Mikael Morin @ 2011-08-05 21:45 UTC (permalink / raw)
To: fortran; +Cc: Tobias Burnus, gcc patches
On Thursday 04 August 2011 17:00:46 Tobias Burnus wrote:
> This patch fixes the result check for coarrays / variables with coarray
> subcomponents. It was working with a separate RESULT() variable - but
> not if the function name was the result variable.
>
> Build and regtested on x86-64-linux.
> OK for the trunk?
>
> Tobias
OK (and obvious).
Mikael
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Patch, Fortran] Coarrays: Add/fix check for no coarrays as result value
2011-08-04 15:01 [Patch, Fortran] Coarrays: Add/fix check for no coarrays as result value Tobias Burnus
2011-08-05 21:45 ` Mikael Morin
@ 2011-08-16 9:29 ` H.J. Lu
2011-08-16 22:06 ` Tobias Burnus
1 sibling, 1 reply; 4+ messages in thread
From: H.J. Lu @ 2011-08-16 9:29 UTC (permalink / raw)
To: Tobias Burnus; +Cc: gcc patches, gfortran
On Thu, Aug 4, 2011 at 8:00 AM, Tobias Burnus <burnus@net-b.de> wrote:
> This patch fixes the result check for coarrays / variables with coarray
> subcomponents. It was working with a separate RESULT() variable - but not if
> the function name was the result variable.
>
> Build and regtested on x86-64-linux.
> OK for the trunk?
This caused:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50094
--
H.J.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Patch, Fortran] Coarrays: Add/fix check for no coarrays as result value
2011-08-16 9:29 ` H.J. Lu
@ 2011-08-16 22:06 ` Tobias Burnus
0 siblings, 0 replies; 4+ messages in thread
From: Tobias Burnus @ 2011-08-16 22:06 UTC (permalink / raw)
To: H.J. Lu; +Cc: gcc patches, gfortran
[-- Attachment #1: Type: text/plain, Size: 516 bytes --]
Thanks for the report, HJ. And thanks for finding the problem Dominique
before I could even look at the PR. (I have no idea how the typo ended
up in my local patch file - it was clearly not present when I regtested
the patch.)
I have committed the attached patch as obvious - after regtesting. (Rev.
177799.)
Tobias
H.J. Lu wrote:
> On Thu, Aug 4, 2011 at 8:00 AM, Tobias Burnus<burnus@net-b.de> wrote:
>> Build and regtested on x86-64-linux.
> This caused: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50094
[-- Attachment #2: commit.diff --]
[-- Type: text/x-patch, Size: 1053 bytes --]
Index: gcc/fortran/ChangeLog
===================================================================
--- gcc/fortran/ChangeLog (Revision 177797)
+++ gcc/fortran/ChangeLog (Arbeitskopie)
@@ -1,3 +1,9 @@
+2011-08-16 Tobias Burnus <burnus@net-b.de>
+ Dominique Dhumieres <dominiq@lps.ens.fr>
+
+ PR fortran/50094
+ * resolve.c (resolve_symbol): Fix stupid typo.
+
2011-08-15 Tobias Burnus <burnus@net-b.de>
* resolve.c (resolve_symbol): Fix coarray result-var check.
Index: gcc/fortran/resolve.c
===================================================================
--- gcc/fortran/resolve.c (Revision 177797)
+++ gcc/fortran/resolve.c (Arbeitskopie)
@@ -12257,7 +12257,7 @@ resolve_symbol (gfc_symbol *sym)
|| sym->attr.codimension)
&& (sym->attr.result || sym->result == sym))
{
- gfc_error ("Function result '%s' at %L shallolvnot be a coarray or have "
+ gfc_error ("Function result '%s' at %L shall not be a coarray or have "
"a coarray component", sym->name, &sym->declared_at);
return;
}
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-08-16 21:27 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-04 15:01 [Patch, Fortran] Coarrays: Add/fix check for no coarrays as result value Tobias Burnus
2011-08-05 21:45 ` Mikael Morin
2011-08-16 9:29 ` H.J. Lu
2011-08-16 22:06 ` Tobias Burnus
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).