OSDN Git Service

2014-02-20 Janus Weil <janus@gcc.gnu.org>
authorjanus <janus@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 20 Feb 2014 08:00:48 +0000 (08:00 +0000)
committerjanus <janus@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 20 Feb 2014 08:00:48 +0000 (08:00 +0000)
Backport from mainline
2014-02-17  Janus Weil  <janus@gcc.gnu.org>

PR fortran/55907
* resolve.c (build_default_init_expr): Don't initialize character
variable if -fno-automatic is given.

2014-02-20  Janus Weil  <janus@gcc.gnu.org>

Backport from mainline
2014-02-17  Janus Weil  <janus@gcc.gnu.org>

PR fortran/55907
* gfortran.dg/init_flag_12.f90: New.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_7-branch@207935 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/fortran/ChangeLog
gcc/fortran/resolve.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/init_flag_12.f90 [new file with mode: 0644]

index 46bb56c..9a39dcc 100644 (file)
@@ -1,3 +1,12 @@
+2014-02-20  Janus Weil  <janus@gcc.gnu.org>
+
+       Backport from mainline
+       2014-02-17  Janus Weil  <janus@gcc.gnu.org>
+
+       PR fortran/55907
+       * resolve.c (build_default_init_expr): Don't initialize character
+       variable if -fno-automatic is given.
+
 2014-02-08  Mikael Morin  <mikael@gcc.gnu.org>
 
        PR fortran/57033
index 8e00739..7a15e9e 100644 (file)
@@ -10167,7 +10167,7 @@ build_default_init_expr (gfc_symbol *sym)
          init_expr = NULL;
        }
       if (!init_expr && gfc_option.flag_init_character == GFC_INIT_CHARACTER_ON
-         && sym->ts.u.cl->length)
+         && sym->ts.u.cl->length && gfc_option.flag_max_stack_var_size != 0)
        {
          gfc_actual_arglist *arg;
          init_expr = gfc_get_expr ();
index 9cca8d7..beaf109 100644 (file)
@@ -1,3 +1,11 @@
+2014-02-20  Janus Weil  <janus@gcc.gnu.org>
+
+       Backport from mainline
+       2014-02-17  Janus Weil  <janus@gcc.gnu.org>
+
+       PR fortran/55907
+       * gfortran.dg/init_flag_12.f90: New.
+
 2014-02-18  Kai Tietz  <ktietz@redhat.com>
 
        PR target/60193
diff --git a/gcc/testsuite/gfortran.dg/init_flag_12.f90 b/gcc/testsuite/gfortran.dg/init_flag_12.f90
new file mode 100644 (file)
index 0000000..5844398
--- /dev/null
@@ -0,0 +1,13 @@
+! { dg-do compile }
+! { dg-options "-fno-automatic -finit-local-zero" }
+!
+! PR 55907: [4.7/4.8/4.9 Regression] ICE with -fno-automatic -finit-local-zero
+!
+! Contributed by J.R. Garcia <garcia.espinosa.jr@gmail.com>
+
+subroutine cchaine (i)
+  implicit none
+  integer :: i
+  character(len=i) :: chaine
+  write(*,*) chaine
+end subroutine