public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
* [Patch, Fortran] PR 84273: Reject allocatable passed-object dummy argument (proc_ptr_47.f90)
@ 2018-02-09 17:13 Janus Weil
  2018-02-09 23:21 ` Steve Kargl
  0 siblings, 1 reply; 7+ messages in thread
From: Janus Weil @ 2018-02-09 17:13 UTC (permalink / raw)
  To: gfortran, gcc-patches

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

Hi all,

the attached patch fixes some checking code for PASS arguments in
procedure-pointer components, which does not properly account for the
fact that the PASS argument needs to be polymorphic.

[The reason for this issue is probably that PPCs were mostly
implemented before polymorphism was available. The corresponding
pass-arg checks for TBPs are ok.]

The patch also fixes an invalid test case (which was detected thanks
to Neil Carlson). It regtests cleanly on x86_64-linux-gnu. Ok for
trunk?

Cheers,
Janus



2018-02-09  Janus Weil  <janus@gcc.gnu.org>

    PR fortran/84273
    * resolve.c (resolve_component): Fix checks of passed argument in
    procedure-pointer components.


2018-02-09  Janus Weil  <janus@gcc.gnu.org>

    PR fortran/84273
    * gfortran.dg/proc_ptr_47.f90: Fix invalid test case.
    * gfortran.dg/proc_ptr_comp_pass_4.f90: Fix and extend test case.

[-- Attachment #2: pr84273.diff --]
[-- Type: text/plain, Size: 2820 bytes --]

Index: gcc/fortran/resolve.c
===================================================================
--- gcc/fortran/resolve.c	(revision 257498)
+++ gcc/fortran/resolve.c	(working copy)
@@ -13703,8 +13703,8 @@ resolve_component (gfc_component *c, gfc_symbol *s
           return false;
         }
 
-      /* Check for C453.  */
-      if (me_arg->attr.dimension)
+      /* Check for F03:C453.  */
+      if (CLASS_DATA (me_arg)->attr.dimension)
         {
           gfc_error ("Argument %qs of %qs with PASS(%s) at %L "
                      "must be scalar", me_arg->name, c->name, me_arg->name,
@@ -13713,7 +13713,7 @@ resolve_component (gfc_component *c, gfc_symbol *s
           return false;
         }
 
-      if (me_arg->attr.pointer)
+      if (CLASS_DATA (me_arg)->attr.class_pointer)
         {
           gfc_error ("Argument %qs of %qs with PASS(%s) at %L "
                      "may not have the POINTER attribute", me_arg->name,
@@ -13722,7 +13722,7 @@ resolve_component (gfc_component *c, gfc_symbol *s
           return false;
         }
 
-      if (me_arg->attr.allocatable)
+      if (CLASS_DATA (me_arg)->attr.allocatable)
         {
           gfc_error ("Argument %qs of %qs with PASS(%s) at %L "
                      "may not be ALLOCATABLE", me_arg->name, c->name,
Index: gcc/testsuite/gfortran.dg/proc_ptr_47.f90
===================================================================
--- gcc/testsuite/gfortran.dg/proc_ptr_47.f90	(revision 257498)
+++ gcc/testsuite/gfortran.dg/proc_ptr_47.f90	(working copy)
@@ -21,13 +21,9 @@
 
 contains
   function foo(A)
-    class(AA), allocatable :: A
+    class(AA) :: A
     type(AA) foo
 
-    if (.not.allocated (A)) then
-      allocate (A, source = AA (2, foo))
-    endif
-
     select type (A)
       type is (AA)
         foo = AA (3, foo)
Index: gcc/testsuite/gfortran.dg/proc_ptr_comp_pass_4.f90
===================================================================
--- gcc/testsuite/gfortran.dg/proc_ptr_comp_pass_4.f90	(revision 257498)
+++ gcc/testsuite/gfortran.dg/proc_ptr_comp_pass_4.f90	(working copy)
@@ -37,22 +37,23 @@ module m
 
  type :: t8
    procedure(foo8), pass, pointer :: f8  ! { dg-error "must be of the derived type" }
+   procedure(foo9), pass, pointer :: f9  ! { dg-error "Non-polymorphic passed-object dummy argument" }
  end type
 
 contains
 
  subroutine foo1 (x1,y1)
-  type(t1) :: x1(:)
+  class(t1) :: x1(:)
   type(t1) :: y1
  end subroutine
 
  subroutine foo2 (x2,y2)
-  type(t2),pointer :: x2
+  class(t2),pointer :: x2
   type(t2) :: y2
  end subroutine
 
  subroutine foo3 (x3,y3)
-  type(t3),allocatable :: x3
+  class(t3),allocatable :: x3
   type(t3) :: y3
  end subroutine
 
@@ -69,4 +70,8 @@ contains
    integer :: i
  end function
 
+ subroutine foo9(x)
+   type(t8) :: x
+ end subroutine
+
 end module m

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

* Re: [Patch, Fortran] PR 84273: Reject allocatable passed-object dummy argument (proc_ptr_47.f90)
  2018-02-09 17:13 [Patch, Fortran] PR 84273: Reject allocatable passed-object dummy argument (proc_ptr_47.f90) Janus Weil
@ 2018-02-09 23:21 ` Steve Kargl
  2018-02-10 11:46   ` Paul Richard Thomas
  2018-02-11 21:44   ` Janus Weil
  0 siblings, 2 replies; 7+ messages in thread
From: Steve Kargl @ 2018-02-09 23:21 UTC (permalink / raw)
  To: Janus Weil; +Cc: gfortran, gcc-patches

On Fri, Feb 09, 2018 at 06:13:34PM +0100, Janus Weil wrote:
> 
> the attached patch fixes some checking code for PASS arguments in
> procedure-pointer components, which does not properly account for the
> fact that the PASS argument needs to be polymorphic.
> 
> [The reason for this issue is probably that PPCs were mostly
> implemented before polymorphism was available. The corresponding
> pass-arg checks for TBPs are ok.]
> 
> The patch also fixes an invalid test case (which was detected thanks
> to Neil Carlson). It regtests cleanly on x86_64-linux-gnu. Ok for
> trunk?

Janus,

The patch looks ok to me.  Trunk is in regression and doc
fixes only mode, so you'll probably need to ping Jakub or
Richard (ie., release engineer) for an ok. 

PS: Welcome back!  We can definitely use your talent.

-- 
Steve

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

* Re: [Patch, Fortran] PR 84273: Reject allocatable passed-object dummy argument (proc_ptr_47.f90)
  2018-02-09 23:21 ` Steve Kargl
@ 2018-02-10 11:46   ` Paul Richard Thomas
  2018-02-11 13:42     ` Janus Weil
  2018-02-11 21:44   ` Janus Weil
  1 sibling, 1 reply; 7+ messages in thread
From: Paul Richard Thomas @ 2018-02-10 11:46 UTC (permalink / raw)
  To: Steve Kargl; +Cc: Janus Weil, gfortran, gcc-patches

Hi Janus,

As Steve said, welcome back!

I hope that you will post the news of this fix and the correction of
the testcases on clf. Talking of which, have you posted the problems
that others have found as PRs?

It was one of my long deferred tasks to make a start on validating the
testsuite and to remove non-standard features.

Thanks for the patch.

Paul


On 9 February 2018 at 23:21, Steve Kargl
<sgk@troutmask.apl.washington.edu> wrote:
> On Fri, Feb 09, 2018 at 06:13:34PM +0100, Janus Weil wrote:
>>
>> the attached patch fixes some checking code for PASS arguments in
>> procedure-pointer components, which does not properly account for the
>> fact that the PASS argument needs to be polymorphic.
>>
>> [The reason for this issue is probably that PPCs were mostly
>> implemented before polymorphism was available. The corresponding
>> pass-arg checks for TBPs are ok.]
>>
>> The patch also fixes an invalid test case (which was detected thanks
>> to Neil Carlson). It regtests cleanly on x86_64-linux-gnu. Ok for
>> trunk?
>
> Janus,
>
> The patch looks ok to me.  Trunk is in regression and doc
> fixes only mode, so you'll probably need to ping Jakub or
> Richard (ie., release engineer) for an ok.
>
> PS: Welcome back!  We can definitely use your talent.
>
> --
> Steve



-- 
"If you can't explain it simply, you don't understand it well enough"
- Albert Einstein

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

* Re: [Patch, Fortran] PR 84273: Reject allocatable passed-object dummy argument (proc_ptr_47.f90)
  2018-02-10 11:46   ` Paul Richard Thomas
@ 2018-02-11 13:42     ` Janus Weil
  0 siblings, 0 replies; 7+ messages in thread
From: Janus Weil @ 2018-02-11 13:42 UTC (permalink / raw)
  To: Paul Richard Thomas; +Cc: Steve Kargl, gfortran, gcc-patches, neil.n.carlson

Hi guys,

2018-02-10 12:46 GMT+01:00 Paul Richard Thomas <paul.richard.thomas@gmail.com>:
> As Steve said, welcome back!

thanks for the warm welcome :)


> I hope that you will post the news of this fix and the correction of
> the testcases on clf. Talking of which, have you posted the problems
> that others have found as PRs?

Well, I have opened PR 84094 as a collector for such things (and a few
dependencies). Neil Carson has put a great amount of work into
analyzing some of the issues that came up and compiled a very helpful
list at:

https://github.com/nncarlson/gfortran.dg/issues

I have not sifted through the extensive c.l.f. thread (which may
contain further possible issues posted by people who lack the skills
to use any kind of bug tracker), any I don't have the intention
(read:time) to do that.


> It was one of my long deferred tasks to make a start on validating the
> testsuite and to remove non-standard features.

The biggest issue in this respect is probably the frequent use of the
non-std "call abort". All of those could simply be replaced by "stop
1" AFAICS, and if there is consensus that this is a useful thing to
do, I'd be willing to take care of it. (Feedback welcome here).

Cheers,
Janus

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

* Re: [Patch, Fortran] PR 84273: Reject allocatable passed-object dummy argument (proc_ptr_47.f90)
  2018-02-09 23:21 ` Steve Kargl
  2018-02-10 11:46   ` Paul Richard Thomas
@ 2018-02-11 21:44   ` Janus Weil
  2018-02-12  7:22     ` Richard Biener
  1 sibling, 1 reply; 7+ messages in thread
From: Janus Weil @ 2018-02-11 21:44 UTC (permalink / raw)
  To: Steve Kargl, Jakub Jelinek, Richard Guenther; +Cc: gfortran, gcc-patches

Dear release managers,

2018-02-10 0:21 GMT+01:00 Steve Kargl <sgk@troutmask.apl.washington.edu>:
> On Fri, Feb 09, 2018 at 06:13:34PM +0100, Janus Weil wrote:
>>
>> the attached patch fixes some checking code for PASS arguments in
>> procedure-pointer components, which does not properly account for the
>> fact that the PASS argument needs to be polymorphic.
>>
>> [The reason for this issue is probably that PPCs were mostly
>> implemented before polymorphism was available. The corresponding
>> pass-arg checks for TBPs are ok.]
>>
>> The patch also fixes an invalid test case (which was detected thanks
>> to Neil Carlson). It regtests cleanly on x86_64-linux-gnu. Ok for
>> trunk?
>
> The patch looks ok to me.  Trunk is in regression and doc
> fixes only mode, so you'll probably need to ping Jakub or
> Richard (ie., release engineer) for an ok.

would you mind if I applied this patch to trunk at the current stage?
It was approved by Steve and Paul, is rather simple and low-risk ...

Cheers,
Janus

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

* Re: [Patch, Fortran] PR 84273: Reject allocatable passed-object dummy argument (proc_ptr_47.f90)
  2018-02-11 21:44   ` Janus Weil
@ 2018-02-12  7:22     ` Richard Biener
  2018-02-12 17:14       ` Janus Weil
  0 siblings, 1 reply; 7+ messages in thread
From: Richard Biener @ 2018-02-12  7:22 UTC (permalink / raw)
  To: Janus Weil; +Cc: Steve Kargl, Jakub Jelinek, gfortran, gcc-patches

On Sun, 11 Feb 2018, Janus Weil wrote:

> Dear release managers,
> 
> 2018-02-10 0:21 GMT+01:00 Steve Kargl <sgk@troutmask.apl.washington.edu>:
> > On Fri, Feb 09, 2018 at 06:13:34PM +0100, Janus Weil wrote:
> >>
> >> the attached patch fixes some checking code for PASS arguments in
> >> procedure-pointer components, which does not properly account for the
> >> fact that the PASS argument needs to be polymorphic.
> >>
> >> [The reason for this issue is probably that PPCs were mostly
> >> implemented before polymorphism was available. The corresponding
> >> pass-arg checks for TBPs are ok.]
> >>
> >> The patch also fixes an invalid test case (which was detected thanks
> >> to Neil Carlson). It regtests cleanly on x86_64-linux-gnu. Ok for
> >> trunk?
> >
> > The patch looks ok to me.  Trunk is in regression and doc
> > fixes only mode, so you'll probably need to ping Jakub or
> > Richard (ie., release engineer) for an ok.
> 
> would you mind if I applied this patch to trunk at the current stage?
> It was approved by Steve and Paul, is rather simple and low-risk ...

Go ahead.

Richard.

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

* Re: [Patch, Fortran] PR 84273: Reject allocatable passed-object dummy argument (proc_ptr_47.f90)
  2018-02-12  7:22     ` Richard Biener
@ 2018-02-12 17:14       ` Janus Weil
  0 siblings, 0 replies; 7+ messages in thread
From: Janus Weil @ 2018-02-12 17:14 UTC (permalink / raw)
  To: Richard Biener; +Cc: Steve Kargl, Jakub Jelinek, gfortran, gcc-patches

2018-02-12 8:22 GMT+01:00 Richard Biener <rguenther@suse.de>:
>> 2018-02-10 0:21 GMT+01:00 Steve Kargl <sgk@troutmask.apl.washington.edu>:
>> > On Fri, Feb 09, 2018 at 06:13:34PM +0100, Janus Weil wrote:
>> >>
>> >> the attached patch fixes some checking code for PASS arguments in
>> >> procedure-pointer components, which does not properly account for the
>> >> fact that the PASS argument needs to be polymorphic.
>> >>
>> >> [The reason for this issue is probably that PPCs were mostly
>> >> implemented before polymorphism was available. The corresponding
>> >> pass-arg checks for TBPs are ok.]
>> >>
>> >> The patch also fixes an invalid test case (which was detected thanks
>> >> to Neil Carlson). It regtests cleanly on x86_64-linux-gnu. Ok for
>> >> trunk?
>> >
>> > The patch looks ok to me.  Trunk is in regression and doc
>> > fixes only mode, so you'll probably need to ping Jakub or
>> > Richard (ie., release engineer) for an ok.
>>
>> would you mind if I applied this patch to trunk at the current stage?
>> It was approved by Steve and Paul, is rather simple and low-risk ...
>
> Go ahead.


Thanks! Committed as r257590.

Cheers,
Janus

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

end of thread, other threads:[~2018-02-12 17:14 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-09 17:13 [Patch, Fortran] PR 84273: Reject allocatable passed-object dummy argument (proc_ptr_47.f90) Janus Weil
2018-02-09 23:21 ` Steve Kargl
2018-02-10 11:46   ` Paul Richard Thomas
2018-02-11 13:42     ` Janus Weil
2018-02-11 21:44   ` Janus Weil
2018-02-12  7:22     ` Richard Biener
2018-02-12 17:14       ` Janus Weil

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