This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch, fortran] PR35724 [4.3/4.4 Regression] Compile time segmentation fault for CSHIFT with negative third arg
- From: Jerry DeLisle <jvdelisle at verizon dot net>
- To: Fortran List <fortran at gcc dot gnu dot org>
- Cc: gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 27 Mar 2008 21:43:21 -0700
- Subject: [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;