This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] PR fortran/82934,83318 -- Enforce F2008:C631


Hi Steve,

I see that the implementation of the standard is slightly more
complicated than I thought.

  type :: t(a,b)
    integer, kind :: a
    integer, len :: b
    integer(a) :: v(b)
  end type t

  type(t(4,:)), allocatable :: z1
  type(t(4,10)), allocatable :: z2

  allocate (t(4, :) :: z1) ! { dg-error "cannot contain DEFERRED parameters" }
  allocate (t(4, *) :: z2) ! This should give an error because it isn't a dummy.

  call foo (z1, z2, z2)

contains
  subroutine foo (arg1, arg2, arg3)
    type(t(4,:)), allocatable :: arg1
    type(t(4,*)), allocatable :: arg2
    type(t(4,10)), allocatable :: arg3

    allocate (t(4, :) :: arg1) ! { dg-error "cannot contain DEFERRED
parameters" }
    allocate (t(4, *) :: arg2) ! This needs to be handled correctly at
runtime but is legal.
    allocate (t(4, *) :: arg2) ! This should give an error because the
dummy parameter is not assumed.
  end subroutine

end

I'll hit this next weekend because I am away all this week.

Regards

Paul


On 9 December 2017 at 19:55, Steve Kargl
<sgk@troutmask.apl.washington.edu> wrote:
> On Fri, Dec 08, 2017 at 05:13:28PM -0800, Steve Kargl wrote:
>> The attached patch enforces F2008:C631, which of course is
>>
>> /* F2008:C631 (R626) A type-param-value in a type-spec shall be an
>>    asterisk if and only if each allocate-object is a dummy argument
>>    for which the corresponding type parameter is assumed.  */
>>
>> Regression tested on x86_64-*-freebsd.
>>
>> 2017-12-08  Steven G. Kargl  <kargl@gcc.gnu.org>
>>
>>       PR fortran/82934
>>       PR fortran/83318
>>       * match.c (gfc_match_allocate): Enforce F2008:C631.
>>
>> 2017-12-08  Steven G. Kargl  <kargl@gcc.gnu.org>
>>
>>       PR fortran/82934
>>       PR fortran/83318
>>       * gfortran.dg/allocate_assumed_charlen_2.f90: new test.
>>
>
> The final version of the patch that I committed is attached.
>
> --
> Steve



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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]