Commit 950a884b by Thomas Koenig

re PR fortran/68829 (Segfaults with -Ofast due to large array on stack)

2017-08-07  Thomas Koenig  <tkoenig@gcc.gnu.org>

	PR fortran/68829
	* doc/invoke.texi: Document change in behvaior for -Ofast for
	Fortran.

2017-08-07  Thomas Koenig  <tkoenig@gcc.gnu.org>

	PR fortran/68829
	PR fortran/81701
	* options.c: Make -Ofast honor -fmax-stack-var-size.
	* invoke.texi: Document change.

2017-08-07  Thomas Koenig  <tkoenig@gcc.gnu.org>

	PR fortran/68829
	PR fortran/81701
	* gfortran.dg/o_fast_stacksize.90:  New test.

From-SVN: r250923
parent ebeeb49c
2017-08-07 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/68829
* doc/invoke.texi: Document change in behvaior for -Ofast for
Fortran.
2017-08-07 Wilco Dijkstra <wdijkstr@arm.com>
* config/aarch64/aarch64.c (aarch64_pushwb_single_reg):
......
......@@ -7278,7 +7278,8 @@ Disregard strict standards compliance. @option{-Ofast} enables all
@option{-O3} optimizations. It also enables optimizations that are not
valid for all standard-compliant programs.
It turns on @option{-ffast-math} and the Fortran-specific
@option{-fno-protect-parens} and @option{-fstack-arrays}.
@option{-fstack-arrays}, unless @option{-fmax-stack-var-size} is
specified, and @option{-fno-protect-parens}.
@item -Og
@opindex Og
......
2017-08-07 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/68829
PR fortran/81701
* options.c: Make -Ofast honor -fmax-stack-var-size.
* invoke.texi: Document change.
2017-08-01 Thomas König <tkoenig@gcc.gnu.org>
PR fortran/79312
......
......@@ -235,7 +235,9 @@ gfc_post_options (const char **pfilename)
if (flag_protect_parens == -1)
flag_protect_parens = !optimize_fast;
if (flag_stack_arrays == -1)
/* -Ofast sets implies -fstack-arrays unless an explicit size is set for
stack arrays. */
if (flag_stack_arrays == -1 && flag_max_stack_var_size == -2)
flag_stack_arrays = optimize_fast;
/* By default, disable (re)allocation during assignment for -std=f95,
......@@ -380,6 +382,10 @@ gfc_post_options (const char **pfilename)
flag_max_stack_var_size = -1;
}
/* Set flag_stack_arrays correctly. */
if (flag_stack_arrays == -1)
flag_stack_arrays = 0;
/* Set default. */
if (flag_max_stack_var_size == -2)
flag_max_stack_var_size = 32768;
......
2017-08-07 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/68829
PR fortran/81701
* gfortran.dg/o_fast_stacksize.90: New test.
2017-08-07 Wilco Dijkstra <wdijkstr@arm.com>
PR middle-end/46932
......
! { dg-do compile }
! { dg-options "-Ofast -fmax-stack-var-size=100 -fdump-tree-original" }
MODULE foo
CONTAINS
SUBROUTINE mysum(a)
INTEGER :: a(:)
WRITE(6,*) SUM(a)
END SUBROUTINE
END MODULE foo
USE foo
INTEGER, ALLOCATABLE :: a(:)
INTEGER, PARAMETER :: N=2**26 ! 256Mb array
ALLOCATE(a(N)) ; a=1
CALL mysum(a*a)
END
! { dg-final { scan-tree-dump-times "__builtin_malloc" 2 "original" } }
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