]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Backport PRs 55907, 60231
authorJanus Weil <janus@gcc.gnu.org>
Wed, 19 Feb 2014 07:38:45 +0000 (08:38 +0100)
committerJanus Weil <janus@gcc.gnu.org>
Wed, 19 Feb 2014 07:38:45 +0000 (08:38 +0100)
2014-02-19  Janus Weil  <janus@gcc.gnu.org>

Backports 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-18  Janus Weil  <janus@gcc.gnu.org>

PR fortran/60231
* resolve.c (check_generic_tbp_ambiguity): Check for presence of dummy
arguments to prevent ICE.

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

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

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

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

PR fortran/60231
* gfortran.dg/typebound_generic_15.f90: New.

From-SVN: r207876

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

index 32a43bac8dec5791b2d293327bd7672d8ae7bda0..e0e7c24e6683efd0cd70a7e552780c5ab9c8b0ce 100644 (file)
@@ -1,3 +1,18 @@
+2014-02-19  Janus Weil  <janus@gcc.gnu.org>
+
+       Backports 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-18  Janus Weil  <janus@gcc.gnu.org>
+
+       PR fortran/60231
+       * resolve.c (check_generic_tbp_ambiguity): Check for presence of dummy
+       arguments to prevent ICE.
+
 2014-02-09  Janus Weil  <janus@gcc.gnu.org>
 
        Backport from mainline
index bdca5300f711e1772d85e08c6835dc85852aa9a0..eab98ad95d7a2a630f956a1ce92a2b5efb885438 100644 (file)
@@ -11058,7 +11058,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 ();
@@ -11878,6 +11878,7 @@ check_generic_tbp_ambiguity (gfc_tbp_generic* t1, gfc_tbp_generic* t2,
 {
   gfc_symbol *sym1, *sym2;
   const char *pass1, *pass2;
+  gfc_formal_arglist *dummy_args;
 
   gcc_assert (t1->specific && t2->specific);
   gcc_assert (!t1->specific->is_generic);
@@ -11900,19 +11901,33 @@ check_generic_tbp_ambiguity (gfc_tbp_generic* t1, gfc_tbp_generic* t2,
       return FAILURE;
     }
 
-  /* Compare the interfaces.  */
+  /* Determine PASS arguments.  */
   if (t1->specific->nopass)
     pass1 = NULL;
   else if (t1->specific->pass_arg)
     pass1 = t1->specific->pass_arg;
   else
-    pass1 = gfc_sym_get_dummy_args (t1->specific->u.specific->n.sym)->sym->name;
+    {
+      dummy_args = gfc_sym_get_dummy_args (t1->specific->u.specific->n.sym);
+      if (dummy_args)
+       pass1 = dummy_args->sym->name;
+      else
+       pass1 = NULL;
+    }
   if (t2->specific->nopass)
     pass2 = NULL;
   else if (t2->specific->pass_arg)
     pass2 = t2->specific->pass_arg;
   else
-    pass2 = gfc_sym_get_dummy_args (t2->specific->u.specific->n.sym)->sym->name;
+    {
+      dummy_args = gfc_sym_get_dummy_args (t2->specific->u.specific->n.sym);
+      if (dummy_args)
+       pass2 = dummy_args->sym->name;
+      else
+       pass2 = NULL;
+    }
+
+  /* Compare the interfaces.  */
   if (gfc_compare_interfaces (sym1, sym2, sym2->name, !t1->is_operator, 0,
                              NULL, 0, pass1, pass2))
     {
index e1599b589780964240cc77ba43479d23501e9aa8..2bd0e2167df27120fff02d35ab34d9138b732f29 100644 (file)
@@ -1,3 +1,16 @@
+2014-02-19  Janus Weil  <janus@gcc.gnu.org>
+
+       Backports from mainline:
+       2014-02-17  Janus Weil  <janus@gcc.gnu.org>
+
+       PR fortran/55907
+       * gfortran.dg/init_flag_12.f90: New.
+
+       2014-02-18  Janus Weil  <janus@gcc.gnu.org>
+
+       PR fortran/60231
+       * gfortran.dg/typebound_generic_15.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 
diff --git a/gcc/testsuite/gfortran.dg/typebound_generic_15.f90 b/gcc/testsuite/gfortran.dg/typebound_generic_15.f90
new file mode 100644 (file)
index 0000000..f71ffd9
--- /dev/null
@@ -0,0 +1,18 @@
+! { dg-do compile }
+!
+! PR 60231: [4.8/4.9 Regression] ICE on undefined generic
+!
+! Contributed by Antony Lewis <antony@cosmologist.info>
+
+module Objects
+
+  Type TObjectList
+  contains
+    procedure :: Add1             ! { dg-error "must be a module procedure" }
+    procedure :: Add2             ! { dg-error "must be a module procedure" }
+    generic :: Add => Add1, Add2  ! { dg-error "are ambiguous" }
+  end Type
+
+end module
+
+! { dg-final { cleanup-modules "Objects" } }