[Patch, fortran] PR30887 and PR30888 - overdone constraints on %VAL
Paul Thomas
paulthomas2@wanadoo.fr
Thu Feb 22 20:35:00 GMT 2007
Sorry all:
Both the testcases need a
C { dg-options "-O0" }
to cancel out the implicit -pedantic
Paul
> Jerry and Tobias,
>
> The attached are completely self explanatory fixes for the above to
> %VAL problems.
>
> Bootstrapped and regtested on x86_ia64/FC5.
>
> I cannot do anything with them until at least the 6th, so be my guest.
>
> Best regards
>
> Paul
>
> ------------------------------------------------------------------------
>
> Index: gcc/fortran/resolve.c
> ===================================================================
> *** gcc/fortran/resolve.c (revision 122229)
> --- gcc/fortran/resolve.c (working copy)
> *************** resolve_actual_arglist (gfc_actual_argli
> *** 1016,1037 ****
> since same file external procedures are not resolvable
> in gfortran, it is a good deal easier to leave them to
> intrinsic.c. */
> ! if (ptype != PROC_UNKNOWN && ptype != PROC_EXTERNAL)
> {
> gfc_error ("By-value argument at %L is not allowed "
> "in this context", &e->where);
> return FAILURE;
> }
> -
> - if (((e->ts.type == BT_REAL || e->ts.type == BT_COMPLEX)
> - && e->ts.kind > gfc_default_real_kind)
> - || (e->ts.kind > gfc_default_integer_kind))
> - {
> - gfc_error ("Kind of by-value argument at %L is larger "
> - "than default kind", &e->where);
> - return FAILURE;
> - }
> -
> }
>
> /* Statement functions have already been excluded above. */
> --- 1016,1029 ----
> since same file external procedures are not resolvable
> in gfortran, it is a good deal easier to leave them to
> intrinsic.c. */
> ! if (ptype != PROC_UNKNOWN
> ! && ptype != PROC_DUMMY
> ! && ptype != PROC_EXTERNAL)
> {
> gfc_error ("By-value argument at %L is not allowed "
> "in this context", &e->where);
> return FAILURE;
> }
> }
>
> /* Statement functions have already been excluded above. */
> Index: gcc/testsuite/gfortran.dg/c_by_val_5.f
> ===================================================================
> *** gcc/testsuite/gfortran.dg/c_by_val_5.f (revision 0)
> --- gcc/testsuite/gfortran.dg/c_by_val_5.f (revision 0)
> ***************
> *** 0 ****
> --- 1,17 ----
> + C { dg-do compile }
> + C Tests the fix for PR30888, in which the dummy procedure would
> + C generate an error with the %VAL argument, even though it is
> + C declared EXTERNAL.
> + C
> + C Contributed by Peter W. Draper <p.w.draper@durham.ac.uk>
> + C
> + SUBROUTINE VALTEST( DOIT )
> + EXTERNAL DOIT
> + INTEGER P
> + INTEGER I
> + I = 0
> + P = 0
> + CALL DOIT( %VAL( P ) )
> + CALL DOIT( I )
> + CALL DOIT( %VAL( P ) )
> + END
> Index: gcc/testsuite/gfortran.dg/c_by_val_4.f
> ===================================================================
> *** gcc/testsuite/gfortran.dg/c_by_val_4.f (revision 0)
> --- gcc/testsuite/gfortran.dg/c_by_val_4.f (revision 0)
> ***************
> *** 0 ****
> --- 1,11 ----
> + C { dg-do compile }
> + C Tests the fix for PR30887, in which P would be rejected because it
> + C is not of default kind.
> + C
> + C Contributed by Peter W. Draper <p.w.draper@durham.ac.uk>
> + C
> + SUBROUTINE VALTEST2()
> + INTEGER*8 P
> + P = 0
> + CALL DOIT( %VAL( P ) )
> + END
>
More information about the Fortran
mailing list