Commit 9eccb94d by Jakub Jelinek Committed by Jakub Jelinek

re PR fortran/28415 (4.2.0 ICE when using automatic array and -fno-automatic)

	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.

	* gfortran.dg/save_2.f90: New test.

From-SVN: r117482
parent 86a0f642
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
......
......@@ -511,7 +511,14 @@ gfc_finish_var_decl (tree decl, gfc_symbol * sym)
/* 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. */
......
2006-10-06 Jakub Jelinek <jakub@redhat.com>
PR fortran/28415
* gfortran.dg/save_2.f90: New test.
PR c/29091
* gcc.dg/pr29091.c: New test.
! PR fortran/28415
! { dg-do run }
! { dg-options "-O2 -fno-automatic" }
program foo
integer arrlen
arrlen = 30
call bar(arrlen)
stop
end
subroutine bar(arg)
integer arg
double precision arr(arg)
do i = 1, arg
arr(i) = 1.0d0
enddo
do i = 1, arg
write(*,*) i, arr(i)
enddo
return
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment