[Bug fortran/56789] Handling of contiguous dummy arguments

2019-01-19 Thread tkoenig at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56789

Thomas Koenig  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--- Comment #24 from Thomas Koenig  ---
Fixed on trunk, closing.

[Bug fortran/56789] Handling of contiguous dummy arguments

2019-01-19 Thread tkoenig at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56789

--- Comment #23 from Thomas Koenig  ---
Author: tkoenig
Date: Sat Jan 19 20:06:41 2019
New Revision: 268096

URL: https://gcc.gnu.org/viewcvs?rev=268096=gcc=rev
Log:
2018-01-19  Thomas Koenig  
Paul Thomas  

PR fortran/56789
* trans-expr.c (gfc_conv_procedure_call): Call
gfc_conv_subref_array_arg if the formal arg is contiguous
and the actual arg may not be.

2018-01-19  Thomas Koenig  
Paul Thomas  

PR fortran/56789
* gfortran.dg/contiguous_3.f90: Make code compilant.  Remove
scan-tree tests that fail with patch.
* gfortran.dg/contiguous_8.f90: New test.


Added:
trunk/gcc/testsuite/gfortran.dg/contiguous_8.f90
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/trans-expr.c
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/gfortran.dg/contiguous_3.f90

[Bug fortran/56789] Handling of contiguous dummy arguments

2019-01-13 Thread pault at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56789

--- Comment #22 from Paul Thomas  ---
(In reply to Thomas Koenig from comment #21)
> Hi Paul,
> 
> > I was mulling this over a few months ago and came to the conclusion
> > that copy-in/copy-out was the only thing that made sense.
> 
> Well, in that case, I'll take this (if you don't mind).
> 
> I am currently working in that area anyway, so I might as
> well look at this.
> 
> Regards
> 
> Thomas

Be my guest!

Paul

[Bug fortran/56789] Handling of contiguous dummy arguments

2019-01-13 Thread tkoenig at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56789

Thomas Koenig  changed:

   What|Removed |Added

   Assignee|pault at gcc dot gnu.org   |tkoenig at gcc dot 
gnu.org

--- Comment #21 from Thomas Koenig  ---
Hi Paul,

> I was mulling this over a few months ago and came to the conclusion
> that copy-in/copy-out was the only thing that made sense.

Well, in that case, I'll take this (if you don't mind).

I am currently working in that area anyway, so I might as
well look at this.

Regards

Thomas

[Bug fortran/56789] Handling of contiguous dummy arguments

2019-01-13 Thread paul.richard.thomas at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56789

--- Comment #20 from paul.richard.thomas at gmail dot com  ---
Hi Thomas,

I was mulling this over a few months ago and came to the conclusion
that copy-in/copy-out was the only thing that made sense.

The IBM manual is explicit about this:
https://www.ibm.com/support/knowledgecenter/SSGH4D_15.1.3/com.ibm.xlf1513.aix.doc/language_ref/contiguous.html

Regards

Paul

On Sun, 13 Jan 2019 at 12:36, tkoenig at gcc dot gnu.org
 wrote:
>
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56789
>
> --- Comment #19 from Thomas Koenig  ---
> I have asked in
> https://groups.google.com/forum/#!search/comp.lang.fortran$20contiguous$20dummy%7Csort:date/comp.lang.fortran/QiFkx8b48uw/wtQE9M_aFwAJ
> .
>
> Let's see what sort of answers there will be, apart from the almost
> inevitable references to PL/I...
>
> --
> You are receiving this mail because:
> You are on the CC list for the bug.
> You are the assignee for the bug.

[Bug fortran/56789] Handling of contiguous dummy arguments

2019-01-13 Thread tkoenig at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56789

--- Comment #19 from Thomas Koenig  ---
I have asked in
https://groups.google.com/forum/#!search/comp.lang.fortran$20contiguous$20dummy%7Csort:date/comp.lang.fortran/QiFkx8b48uw/wtQE9M_aFwAJ
.

Let's see what sort of answers there will be, apart from the almost
inevitable references to PL/I...

[Bug fortran/56789] Handling of contiguous dummy arguments

2018-10-04 Thread anlauf at gmx dot de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56789

--- Comment #18 from Harald Anlauf  ---
(In reply to Paul Thomas from comment #12)
> (In reply to Harald Anlauf from comment #11)
> > (In reply to paul.richard.tho...@gmail.com from comment #10)
> > > Even if that were allowed, the standard explicitly disallows the
> > > argument association in the testcase: See 5.3.7 of the F2008 standard.
> > 
> > The wording has changed in F2018 DIS, 8.5.7, paragraph 1:
> > 
> > The CONTIGUOUS attribute specifies that an assumed-shape array is 
> > contiguous,
> > that an array pointer can only be pointer associated with a contiguous
> > target,
> > or that an assumed-rank dummy data object is contiguous.
> > 
> > 
> > In my interpretation, the testcase is valid under F2018, but invalid in
> > F2008.
> 
> Hmmm! The F2018 standard is almost obfusticating about argument association
> with contiguous dummies. I will wade through the pertinent sections tonight.
> 
> Paul

FWIW: Crayftn, Intel, PGI, NAG all accept the code without complaining and seem
to do the packing/unpacking.

[Bug fortran/56789] Handling of contiguous dummy arguments

2018-10-04 Thread pault at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56789

Paul Thomas  changed:

   What|Removed |Added

   Assignee|unassigned at gcc dot gnu.org  |pault at gcc dot gnu.org

--- Comment #17 from Paul Thomas  ---
Created attachment 44782
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=44782=edit
"fix" for the PR

Ignoring the niceties of the standard for the moment, this "fixes" the problem;
or, at least, it runs as intended.

Cheers

Paul

[Bug fortran/56789] Handling of contiguous dummy arguments

2018-10-03 Thread paul.richard.thomas at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56789

--- Comment #16 from paul.richard.thomas at gmail dot com  ---
Hi Thomas,

I think that the copy in/copy out might be rather easy to arrange.
Give me a couple of days.

Paul

On Wed, 3 Oct 2018 at 22:01, tkoenig at gcc dot gnu.org
 wrote:
>
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56789
>
> --- Comment #14 from Thomas Koenig  ---
> This would reject the obvious non-contiguous cases.
>
> Index: interface.c
> ===
> --- interface.c (Revision 264540)
> +++ interface.c (Arbeitskopie)
> @@ -3297,6 +3297,14 @@ compare_actual_formal (gfc_actual_arglist **ap, gf
>   return false;
> }
>
> +  if (f->sym->attr.contiguous
> + && !gfc_is_simply_contiguous (a->expr, false, true))
> +   {
> + gfc_error ("Non-contiguous argument actual argument passed to "
> +"contiguous dummy argument %qs at %L", f->sym->name,
> +>expr->where);
> +   }
> +
>/* Find the last array_ref.  */
>actual_arr_ref = NULL;
>if (a->expr->ref)
> Index: trans-array.c
> ===
> --- trans-array.c   (Revision 264540)
> +++ trans-array.c   (Arbeitskopie)
> @@ -7862,8 +7862,7 @@ gfc_conv_array_parameter (gfc_se * se, gfc_expr *
>gfc_prepend_expr_to_block (>post, tmp);
>  }
>
> -  if (g77 || (fsym && fsym->attr.contiguous
> - && !gfc_is_simply_contiguous (expr, false, true)))
> +  if (g77)
>  {
>tree origptr = NULL_TREE;
>
> --
> You are receiving this mail because:
> You are on the CC list for the bug.

[Bug fortran/56789] Handling of contiguous dummy arguments

2018-10-03 Thread tkoenig at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56789

--- Comment #15 from Thomas Koenig  ---
Of course, there should be a "return false;" in there as well.

[Bug fortran/56789] Handling of contiguous dummy arguments

2018-10-03 Thread tkoenig at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56789

--- Comment #14 from Thomas Koenig  ---
This would reject the obvious non-contiguous cases.

Index: interface.c
===
--- interface.c (Revision 264540)
+++ interface.c (Arbeitskopie)
@@ -3297,6 +3297,14 @@ compare_actual_formal (gfc_actual_arglist **ap, gf
  return false;
}

+  if (f->sym->attr.contiguous
+ && !gfc_is_simply_contiguous (a->expr, false, true))
+   {
+ gfc_error ("Non-contiguous argument actual argument passed to "
+"contiguous dummy argument %qs at %L", f->sym->name,
+>expr->where);
+   }
+
   /* Find the last array_ref.  */
   actual_arr_ref = NULL;
   if (a->expr->ref)
Index: trans-array.c
===
--- trans-array.c   (Revision 264540)
+++ trans-array.c   (Arbeitskopie)
@@ -7862,8 +7862,7 @@ gfc_conv_array_parameter (gfc_se * se, gfc_expr *
   gfc_prepend_expr_to_block (>post, tmp);
 }

-  if (g77 || (fsym && fsym->attr.contiguous
- && !gfc_is_simply_contiguous (expr, false, true)))
+  if (g77)
 {
   tree origptr = NULL_TREE;

[Bug fortran/56789] Handling of contiguous dummy arguments

2018-10-03 Thread tkoenig at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56789

Thomas Koenig  changed:

   What|Removed |Added

   Keywords||diagnostic
Summary|Wrong code with contiguous  |Handling of contiguous
   |dummy argument  |dummy arguments

--- Comment #13 from Thomas Koenig  ---
So, this is a diagnostic issue after all.

For the time being, it seems that we could just
not do the pack/unpack and issue an error for the test
case.

We can handle the F2018 stuff later (whatever it turns out to be).