2006-10-06 Jakub Jelinek <jakub@redhat.com>
+ PR fortran/28415
+ * trans-decl.c (gfc_finish_var_decl): With -fno-automatic, don't
+ make artificial variables or pointer to variable automatic array
+ TREE_STATIC.
+
* scanner.c (skip_free_comments): Return bool instead of void.
(gfc_next_char_literal): Don't return ' ' if & is missing after
!$omp or !$. Use skip_{free,fixed}_comments directly instead
/* Keep variables larger than max-stack-var-size off stack. */
if (!sym->ns->proc_name->attr.recursive
&& INTEGER_CST_P (DECL_SIZE_UNIT (decl))
- && !gfc_can_put_var_on_stack (DECL_SIZE_UNIT (decl)))
+ && !gfc_can_put_var_on_stack (DECL_SIZE_UNIT (decl))
+ /* Put variable length auto array pointers always into stack. */
+ && (TREE_CODE (TREE_TYPE (decl)) != POINTER_TYPE
+ || sym->attr.dimension == 0
+ || sym->as->type != AS_EXPLICIT
+ || sym->attr.pointer
+ || sym->attr.allocatable)
+ && !DECL_ARTIFICIAL (decl))
TREE_STATIC (decl) = 1;
/* Handle threadprivate variables. */