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] PR35724 [4.3/4.4 Regression] Compile time segmentation fault for CSHIFT with negative third arg


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;



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