This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran 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] PR35724 compile time segmentation fault for eoshift


This patch fixes the same problem we had with cshift.

Regression tested on x86-64.

Will commit as obvious.

Jerry

2008-04-16 Jerry DeLisle <jvdelisle@gcc.gnu.org>

	PR fortran/35724
	* iresolve.c (gfc_resolve_eoshift): Check for NULL symtree in test for
	optional argument attribute.
! { dg-do compile }
! pr35724 compile time segmentation fault for eoshift with negative third arg
subroutine ra0072(dda,lda,nf10,nf1,mf1,nf2)
      real dda(10,10)
      logical lda(10,10)
      dda = eoshift(dda,(/mf1,nf1/),tws0r,nf3-nf1)
      lda = cshift(lda,(/mf1,nf1/),nf3-nf1)
      where (lda) dda = eoshift(dda,1,1.0,-mf1)
end subroutine
Index: iresolve.c
===================================================================
--- iresolve.c	(revision 134368)
+++ iresolve.c	(working copy)
@@ -738,7 +738,8 @@ gfc_resolve_eoshift (gfc_expr *f, gfc_ex
  
   if (dim != NULL)
     {
-      if (dim->expr_type != EXPR_CONSTANT && dim->symtree->n.sym->attr.optional)
+      if (dim->expr_type != EXPR_CONSTANT && dim->symtree != NULL
+	  && dim->symtree->n.sym->attr.optional)
 	{
 	  /* Mark this for later setting the type in gfc_conv_missing_dummy.  */
 	  dim->representation.length = shift->ts.kind;

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