New tests for PRs 52531 and 57365

Dominique d'Humières dominiq@lps.ens.fr
Mon Feb 15 13:53:00 GMT 2016


PRs 52531 and 57365 are fixed on trunk and gcc5 branch. Unless someone objects I am planing to add the following tests in the coming days.

Tested on x86_64-apple-darwin15.

Cheers,

Dominique

Index: gcc/testsuite/ChangeLog
===================================================================
--- gcc/testsuite/ChangeLog	(revision 233424)
+++ gcc/testsuite/ChangeLog	(working copy)
@@ -1,3 +1,13 @@
+2016-02-15  Dominique d'Humieres  <dominiq@lps.ens.fr>
+
+	PR fortran/57365
+	gfortran.dg/allocate_with_source_18.f03: New test.
+
+2016-02-15  Harald Anlauf  <anlauf@gmx.de>
+
+	PR fortran/52531
+	gfortran.dg/gomp/pr52531.f90: New test.
+
 2016-02-15  Richard Biener  <rguenther@suse.de>
 
 	PR tree-optimization/69783
Index: gcc/testsuite/gfortran.dg/allocate_with_source_18.f03
===================================================================
--- gcc/testsuite/gfortran.dg/allocate_with_source_18.f03	(nonexistent)
+++ gcc/testsuite/gfortran.dg/allocate_with_source_18.f03	(working copy)
@@ -0,0 +1,31 @@
+! { dg-do run }
+!
+! PR fortran/57365
+! [OOP] Sourced allocation fails with unlimited polymorphism
+! Contributed by <rxs@hotmail.de>
+!
+program bug
+
+    implicit none
+    character(len=:), allocatable :: test
+
+    test = "A test case"
+    call allocate_test(test)
+    deallocate(test)
+
+contains
+
+    subroutine allocate_test(var)
+        class(*) :: var
+        class(*), pointer :: copyofvar
+        allocate(copyofvar, source=var)
+        select type (copyofvar)
+            type is (character(len=*))
+!                print*, len(copyofvar), copyofvar
+                if (len(copyofvar) /= 11) call abort ()
+                if (copyofvar /= "A test case") call abort ()
+        end select
+        deallocate(copyofvar)
+    end subroutine
+
+end program bug
Index: gcc/testsuite/gfortran.dg/gomp/pr52531.f90
===================================================================
--- gcc/testsuite/gfortran.dg/gomp/pr52531.f90	(nonexistent)
+++ gcc/testsuite/gfortran.dg/gomp/pr52531.f90	(working copy)
@@ -0,0 +1,16 @@
+! { dg-do compile }
+! PR fortran/52531
+module test_mod
+  type, public :: test_type
+  end type
+contains
+  subroutine foo(bar)
+    type(test_type) :: bar
+!$omp parallel default(none) shared(bar) ! Compiles if one removes default(none)
+    call question(bar)
+!$omp end parallel
+  end subroutine
+  subroutine question(var)
+    class(test_type), intent(in) :: var ! Compiles if one replaces class by type
+  end subroutine
+end module



More information about the Fortran mailing list