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] PR31540 - [Regression 4.2, 4.3] character((constant expression)) for external function


:ADDPATCH fortran:

This is a rather trivial patch that corrects a failure to resolve the
character length of external functions.  Strictly speaking, in this
particular case, it is simplification that is needed.  However, it
does no harm to do the whole job.  The testscase is the reporter's.

Regtested on x86_ia64/FC5 - OK for trunk and 4.2, being a regression
relative to 4.1?

Paul

2007-05-06 Paul Thomas <pault@gcc.gnu.org>

	PR fortran/31540
	* resolve.c (resolve_fl_procedure): Resolve constant character
	lengths.

2007-05-06 Paul Thomas <pault@gcc.gnu.org>

	PR fortran/31540
	* gfortran.dg/char_result_3.f90: New test.


-- "Success is the ability to go from one failure to another with no loss of enthusiasm." - Winston Churchill
Index: gcc/fortran/resolve.c
===================================================================
*** gcc/fortran/resolve.c	(revision 124460)
--- gcc/fortran/resolve.c	(working copy)
*************** resolve_fl_procedure (gfc_symbol *sym, i
*** 5812,5817 ****
--- 5812,5822 ----
    if (sym->ts.type == BT_CHARACTER)
      {
        gfc_charlen *cl = sym->ts.cl;
+ 
+       if (cl && cl->length && gfc_is_constant_expr (cl->length)
+ 	     && resolve_charlen (cl) == FAILURE)
+ 	return FAILURE;
+ 
        if (!cl || !cl->length || cl->length->expr_type != EXPR_CONSTANT)
  	{
  	  if (sym->attr.proc == PROC_ST_FUNCTION)
Index: /svn/trunk/gcc/testsuite/gfortran.dg/char_length_4.f90
===================================================================
*** /svn/trunk/gcc/testsuite/gfortran.dg/char_length_4.f90	(revision 0)
--- /svn/trunk/gcc/testsuite/gfortran.dg/char_length_4.f90	(revision 0)
***************
*** 0 ****
--- 1,13 ----
+ ! { dg-do compile }
+ ! tests the fix for PR31540, in which the character lengths in
+ ! parentheses were not resolved.
+ !
+ ! Contributed by Tobias Burnus <burnus@gcc.gnu.org>
+ !
+         subroutine pfb()
+         implicit none
+         external pfname1, pfname2
+         character ((136)) pfname1
+         character ((129+7)) pfname2
+         return
+         end

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