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]

[Patch, fortran] PR30887 and PR30888 - overdone constraints on %VAL


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

--
Anon: "Ignorantibus veritatem dicere semper utile est."

Abraham Lincoln: "It is better to be thought a fool than to speak and
remove all doubt."

Attachment: fixes.Change.Logs
Description: Binary data

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

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