[patch, fortran] PR35724 [4.3/4.4 Regression] Compile time segmentation fault for CSHIFT with negative third arg

Jerry DeLisle jvdelisle@verizon.net
Fri Mar 28 08:04:00 GMT 2008


Hi all,

The following patch fixes this regression by checking for the NULL
symtree pointer and not attempting to access it.

I will commit as obvious.  I will also backport to 4.3.  Test case will
be that in the PR.

Regression tested on X86-64

I apologize for the breakage.

Jerry

Index: iresolve.c
===================================================================
--- iresolve.c  (revision 133275)
+++ iresolve.c  (working copy)
@@ -597,7 +597,8 @@ gfc_resolve_cshift (gfc_expr *f, gfc_exp
  
   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;




More information about the Gcc-patches mailing list