aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gfortran.dg/typebound_call_19.f03
diff options
context:
space:
mode:
authorBen Cheng <bccheng@google.com>2014-03-25 22:37:19 -0700
committerBen Cheng <bccheng@google.com>2014-03-25 22:37:19 -0700
commit1bc5aee63eb72b341f506ad058502cd0361f0d10 (patch)
treec607e8252f3405424ff15bc2d00aa38dadbb2518 /gcc-4.9/gcc/testsuite/gfortran.dg/typebound_call_19.f03
parent283a0bf58fcf333c58a2a92c3ebbc41fb9eb1fdb (diff)
downloadtoolchain_gcc-1bc5aee63eb72b341f506ad058502cd0361f0d10.tar.gz
toolchain_gcc-1bc5aee63eb72b341f506ad058502cd0361f0d10.tar.bz2
toolchain_gcc-1bc5aee63eb72b341f506ad058502cd0361f0d10.zip
Initial checkin of GCC 4.9.0 from trunk (r208799).
Change-Id: I48a3c08bb98542aa215912a75f03c0890e497dba
Diffstat (limited to 'gcc-4.9/gcc/testsuite/gfortran.dg/typebound_call_19.f03')
-rw-r--r--gcc-4.9/gcc/testsuite/gfortran.dg/typebound_call_19.f0349
1 files changed, 49 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/gfortran.dg/typebound_call_19.f03 b/gcc-4.9/gcc/testsuite/gfortran.dg/typebound_call_19.f03
new file mode 100644
index 000000000..3c8b7684c
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gfortran.dg/typebound_call_19.f03
@@ -0,0 +1,49 @@
+! { dg-do run }
+!
+! PR 47455: [4.6 Regression][OOP] internal compiler error: in fold_convert_loc, at fold-const.c:2028
+!
+! Contributed by Thomas Henlich <thenlich@users.sourceforge.net>
+
+module class_t
+ type :: tx
+ integer :: i
+ end type
+ type :: t
+ type(tx) :: x
+ procedure(find_x), pointer :: ppc
+ contains
+ procedure :: find_x
+ end type
+ type(tx), target :: zero = tx(0)
+contains
+ function find_x(this)
+ class(t), intent(in) :: this
+ type(tx), pointer :: find_x
+ find_x => zero
+ end function find_x
+end module
+
+program test
+ use class_t
+ class(t),allocatable :: this
+ procedure(find_x), pointer :: pp
+ allocate(this)
+ ! (1) ordinary function call
+ zero = tx(1)
+ this%x = find_x(this)
+ if (this%x%i /= 1) call abort()
+ ! (2) procedure pointer
+ zero = tx(2)
+ pp => find_x
+ this%x = pp(this)
+ if (this%x%i /= 2) call abort()
+ ! (3) PPC
+ zero = tx(3)
+ this%ppc => find_x
+ this%x = this%ppc()
+ if (this%x%i /= 3) call abort()
+ ! (4) TBP
+ zero = tx(4)
+ this%x = this%find_x()
+ if (this%x%i /= 4) call abort()
+end