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
This commit is contained in:
parent
86a0f64291
commit
9eccb94dff
4 changed files with 38 additions and 1 deletions
|
@ -1,5 +1,10 @@
|
|||
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. */
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
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.
|
||||
|
||||
|
|
22
gcc/testsuite/gfortran.dg/save_2.f90
Normal file
22
gcc/testsuite/gfortran.dg/save_2.f90
Normal file
|
@ -0,0 +1,22 @@
|
|||
! 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
|
Loading…
Add table
Reference in a new issue