[Bug fortran/68829] [4.9/5/6 Regression] Segfaults with -Ofast due to large array on stack

2016-01-10 Thread tkoenig at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68829

Thomas Koenig  changed:

   What|Removed |Added

 CC||tkoenig at gcc dot gnu.org

--- Comment #3 from Thomas Koenig  ---

> > But it's also that you are asking for it with -Ofast.  Maybe the frontend
> > should have a switch to specifiy a size limit?
> 
> Good idea, any volunteer?

It seems that -fmax-stack-var-size=N does not override -Ofast.  Maybe
it should.

ig25@linux-fd1f:/tmp> cat a.f90
real, dimension(10**6) :: a
call random_number(a)
write (*,*) a
end
ig25@linux-fd1f:/tmp> gfortran -fdump-tree-original -Ofast
-fmax-stack-var-size=1 a.f90 
ig25@linux-fd1f:/tmp> head a.f90.003t.original 
MAIN__ ()
{
  static real(kind=4) a[100];

  {
struct array1_real(kind=4) parm.0;

parm.0.dtype = 281;
parm.0.dim[0].lbound = 1;
parm.0.dim[0].ubound = 100;
ig25@linux-fd1f:/tmp>

[Bug fortran/68829] [4.9/5/6 Regression] Segfaults with -Ofast due to large array on stack

2016-01-10 Thread Joost.VandeVondele at mat dot ethz.ch
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68829

Joost VandeVondele  changed:

   What|Removed |Added

 CC||Joost.VandeVondele at mat dot 
ethz
   ||.ch

--- Comment #4 from Joost VandeVondele  
---
(In reply to Thomas Koenig from comment #3)
> 
> It seems that -fmax-stack-var-size=N does not override -Ofast.  Maybe
> it should.
> 

Ah interesting, I wasn't aware that '-fmax-stack-var-size' existed, but indeed,
if -fstack-arrays would honour that flag, this problem would be fixed. That
would be a good solution from my point of view.

[Bug fortran/68829] [4.9/5/6 Regression] Segfaults with -Ofast due to large array on stack

2016-01-09 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68829

Jakub Jelinek  changed:

   What|Removed |Added

   Priority|P3  |P4
 CC||jakub at gcc dot gnu.org