Commit 6869c12d by Paul Thomas

re PR fortran/83149 ([6- and 7-branches] Missing test for sym->ns->proc_name:…

re PR fortran/83149 ([6- and 7-branches] Missing test for sym->ns->proc_name: crash_signal in toplev.c:325)

2018-02-23  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/83149
	* trans-decl.c (gfc_finish_var_decl): Test sym->ns->proc_name
	before accessing its components.

2018-02-23  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/83149
	* gfortran.dg/pr83149_1.f90: New test.
	* gfortran.dg/pr83149.f90: Additional source for previous.

From-SVN: r257934
parent 32995c02
2018-02-23 Paul Thomas <pault@gcc.gnu.org> 2018-02-23 Paul Thomas <pault@gcc.gnu.org>
PR fortran/83149
* trans-decl.c (gfc_finish_var_decl): Test sym->ns->proc_name
before accessing its components.
2018-02-23 Paul Thomas <pault@gcc.gnu.org>
PR fortran/83148 PR fortran/83148
* trans-const.c : Clean up some whitespace issues. * trans-const.c : Clean up some whitespace issues.
* trans-expr.c (gfc_conv_initializer): If an iso_c_binding * trans-expr.c (gfc_conv_initializer): If an iso_c_binding
......
...@@ -609,10 +609,12 @@ gfc_finish_var_decl (tree decl, gfc_symbol * sym) ...@@ -609,10 +609,12 @@ gfc_finish_var_decl (tree decl, gfc_symbol * sym)
function scope. */ function scope. */
if (current_function_decl != NULL_TREE) if (current_function_decl != NULL_TREE)
{ {
if (sym->ns->proc_name->backend_decl == current_function_decl if (sym->ns->proc_name
|| sym->result == sym) && (sym->ns->proc_name->backend_decl == current_function_decl
|| sym->result == sym))
gfc_add_decl_to_function (decl); gfc_add_decl_to_function (decl);
else if (sym->ns->proc_name->attr.flavor == FL_LABEL) else if (sym->ns->proc_name
&& sym->ns->proc_name->attr.flavor == FL_LABEL)
/* This is a BLOCK construct. */ /* This is a BLOCK construct. */
add_decl_as_local (decl); add_decl_as_local (decl);
else else
...@@ -704,7 +706,8 @@ gfc_finish_var_decl (tree decl, gfc_symbol * sym) ...@@ -704,7 +706,8 @@ gfc_finish_var_decl (tree decl, gfc_symbol * sym)
} }
/* Keep variables larger than max-stack-var-size off stack. */ /* Keep variables larger than max-stack-var-size off stack. */
if (!sym->ns->proc_name->attr.recursive && !sym->attr.automatic if (!(sym->ns->proc_name && sym->ns->proc_name->attr.recursive)
&& !sym->attr.automatic
&& INTEGER_CST_P (DECL_SIZE_UNIT (decl)) && 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. */ /* Put variable length auto array pointers always into stack. */
......
2018-02-23 Paul Thomas <pault@gcc.gnu.org>
PR fortran/83149
* gfortran.dg/pr83149_1.f90: New test.
* gfortran.dg/pr83149.f90: Additional source for previous.
2018-02-23 Segher Boessenkool <segher@kernel.crashing.org> 2018-02-23 Segher Boessenkool <segher@kernel.crashing.org>
PR testsuite/80551 PR testsuite/80551
......
! Compiled with pr83149_1.f90
!
module mod1
integer :: ncells
end module
module mod2
contains
function get() result(array)
use mod1
real array(ncells)
array = 1.0
end function
end module
! Compiled with pr83149.f90
! { dg-do run }
! { dg-options "-fno-whole-file" }
! { dg-compile-aux-modules "pr83149.f90" }
! { dg-additional-sources pr83149.f90 }
!
! Contributed by Neil Carlson <neil.n.carlson@gmail.com>
!
subroutine sub(s)
use mod2
real :: s
s = sum(get())
end
use mod1
real :: s
ncells = 2
call sub (s)
if (int (s) .ne. ncells) stop 1
ncells = 10
call sub (s)
if (int (s) .ne. ncells) stop 2
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