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(es)] PR fortran/77391 -- RFC vote on which you prefer


Hi Steve,

I am strongly for the enforcement of the standard. Please apply patch #2.

Cheers

Paul


On 26 August 2016 at 20:27, Steve Kargl
<sgk@troutmask.apl.washington.edu> wrote:
> Here are two possible patches for PR fortran/77391.  The first
> patch treats the invalid code as a GNU Fortran extension as
> gfortran current accepts the invalid code.  The second patch
> enforces the standard.  As I think gfortran should encourage
> standard conformance, I am inclined to commit the second patch.
> I will however commit the most popular of the two patches tomorrow.
> Voting starts now and will remain open for 24 hours (give or take
> a few hours depend on when I awaken).
>
> Patch 1:
>
> Index: decl.c
> ===================================================================
> --- decl.c      (revision 239762)
> +++ decl.c      (working copy)
> @@ -4798,11 +4798,23 @@ gfc_match_data_decl (void)
>
>  ok:
>    /* If we have an old-style character declaration, and no new-style
> -     attribute specifications, then there a comma is optional between
> +     attribute specifications, then a comma is optional between
>       the type specification and the variable list.  */
>    if (m == MATCH_NO && current_ts.type == BT_CHARACTER && old_char_selector)
>      gfc_match_char (',');
>
> +  /* F2008(C402): A colon shall not be used as a type-param-value except
> +     in the declaration of an entity or component that has the POINTER
> +     or ALLOCATABLE attribute.  */
> +  if (current_ts.type == BT_CHARACTER && current_ts.deferred
> +      && !(current_attr.allocatable || current_attr.pointer)
> +      && !gfc_notify_std (GFC_STD_GNU, "Deferred length type parameter "
> +                         "without POINTER or ALLOCATABLE attribute at %C"))
> +    {
> +      m = MATCH_ERROR;
> +      goto cleanup;
> +    }
> +
>    /* Give the types/attributes to symbols that follow. Give the element
>       a number so that repeat character length expressions can be copied.  */
>    elem = 1;
>
> Patch 2:
>
> Index: decl.c
> ===================================================================
> --- decl.c      (revision 239762)
> +++ decl.c      (working copy)
> @@ -4798,11 +4798,24 @@ gfc_match_data_decl (void)
>
>  ok:
>    /* If we have an old-style character declaration, and no new-style
> -     attribute specifications, then there a comma is optional between
> +     attribute specifications, then a comma is optional between
>       the type specification and the variable list.  */
>    if (m == MATCH_NO && current_ts.type == BT_CHARACTER && old_char_selector)
>      gfc_match_char (',');
>
> +  /* F2008(C402): A colon shall not be used as a type-param-value except
> +     in the declaration of an entity or component that has the POINTER
> +     or ALLOCATABLE attribute.  */
> +  if (current_ts.type == BT_CHARACTER && current_ts.deferred
> +      && !(current_attr.allocatable || current_attr.pointer))
> +    {
> +
> +      gfc_error ("Deferred length type parameter without POINTER or "
> +                "ALLOCATABLE attribute at %C")
> +      m = MATCH_ERROR;
> +      goto cleanup;
> +    }
> +
>    /* Give the types/attributes to symbols that follow. Give the element
>       a number so that repeat character length expressions can be copied.  */
>    elem = 1;
>
> --
> Steve



-- 
The difference between genius and stupidity is; genius has its limits.

Albert Einstein


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