]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
2012-02-01 Tobias Burnus <burnus@net-b.de>
authorburnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 1 Feb 2012 19:06:07 +0000 (19:06 +0000)
committerburnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 1 Feb 2012 19:06:07 +0000 (19:06 +0000)
        PR fortran/52024
        * module.c (MOD_VERSION): Bump.
        (mio_typebound_proc): Read/write is_operator from/to the
        .mod file.

2012-02-01  Tobias Burnus  <burnus@net-b.de>

        PR fortran/52024
        * gfortran.dg/typebound_operator_14.f90: New.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@183808 138bc75d-0d04-0410-961f-82ee72b054a4

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

index 2a7cc2824d3d6a2f1611228789fd21debb4a94af..794101bcda4a1c992ff6cd1b8e329a1aa34ca7a6 100644 (file)
@@ -1,3 +1,10 @@
+2012-02-01  Tobias Burnus  <burnus@net-b.de>
+
+       PR fortran/52024
+       * module.c (MOD_VERSION): Bump.
+       (mio_typebound_proc): Read/write is_operator from/to the
+       .mod file.
+
 2012-02-01  Tobias Burnus
 
        PR fortran/52059
index c68277b253612133be004bf8f4c19a5ae7c4759a..5e0f26e1e5f0ceb78d236316c356b959c09c907e 100644 (file)
@@ -81,7 +81,7 @@ along with GCC; see the file COPYING3.  If not see
 
 /* Don't put any single quote (') in MOD_VERSION, 
    if yout want it to be recognized.  */
-#define MOD_VERSION "8"
+#define MOD_VERSION "9"
 
 
 /* Structure that describes a position within a module file.  */
@@ -3578,12 +3578,17 @@ mio_typebound_proc (gfc_typebound_proc** proc)
   if ((*proc)->is_generic)
     {
       gfc_tbp_generic* g;
+      int iop;
 
       mio_lparen ();
 
       if (iomode == IO_OUTPUT)
        for (g = (*proc)->u.generic; g; g = g->next)
-         mio_allocated_string (g->specific_st->name);
+         {
+           iop = (int) g->is_operator;
+           mio_integer (&iop);
+           mio_allocated_string (g->specific_st->name);
+         }
       else
        {
          (*proc)->u.generic = NULL;
@@ -3594,6 +3599,9 @@ mio_typebound_proc (gfc_typebound_proc** proc)
              g = gfc_get_tbp_generic ();
              g->specific = NULL;
 
+             mio_integer (&iop);
+             g->is_operator = (bool) iop;
+
              require_atom (ATOM_STRING);
              sym_root = &current_f2k_derived->tb_sym_root;
              g->specific_st = gfc_get_tbp_symtree (sym_root, atom_string);
index 95b1ece95341139345e324437df03793d6e15ee6..9e655c8d1a64ee08767d3cece7006012bdabb333 100644 (file)
@@ -1,3 +1,8 @@
+2012-02-01  Tobias Burnus  <burnus@net-b.de>
+
+       PR fortran/52024
+       * gfortran.dg/typebound_operator_14.f90: New.
+
 2012-02-01  Tobias Burnus
 
        PR fortran/52059
diff --git a/gcc/testsuite/gfortran.dg/typebound_operator_14.f90 b/gcc/testsuite/gfortran.dg/typebound_operator_14.f90
new file mode 100644 (file)
index 0000000..86c65d7
--- /dev/null
@@ -0,0 +1,42 @@
+! { dg-do compile }
+!
+! PR fortran/52024
+!
+! The test case was segfaulting before
+!
+
+module m_sort
+  implicit none
+  type, abstract :: sort_t
+  contains
+    generic :: operator(.gt.) => gt_cmp
+    procedure :: gt_cmp
+    end type sort_t
+contains
+  logical function gt_cmp(a,b)
+    class(sort_t), intent(in) :: a, b
+    gt_cmp = .true.
+  end function gt_cmp
+end module
+
+module test
+  use m_sort
+  implicit none
+  type, extends(sort_t) :: sort_int_t
+    integer :: i
+  contains
+    generic :: operator(.gt.) => gt_cmp_int ! { dg-error "are ambiguous" }
+    procedure :: gt_cmp_int
+  end type
+contains
+  logical function gt_cmp_int(a,b) result(cmp)
+    class(sort_int_t), intent(in) :: a, b
+    if (a%i > b%i) then
+      cmp = .true.
+     else
+      cmp = .false.
+     end if
+  end function gt_cmp_int
+end module
+
+! { dg-final { cleanup-tree-dump "m_sort test" } }