2014-07-12 Paul Thomas <pault@gcc.gnu.org>
[official-gcc.git] / gcc / testsuite / gfortran.dg / pr36680.f90
blobb554b76543aec43c930006de99a2b7815fe9c78f
1 ! PR target/36680
2 ! { dg-do compile { target i?86-*-* x86_64-*-* } }
3 ! { dg-options "-O1 -fschedule-insns" }
5 MODULE class_dummy_atom_kdtree_types
6 TYPE dummy_atom_kdtree_data
7 INTEGER :: dummy
8 END TYPE
10 TYPE :: dummy_atom_kdtree_node
11 TYPE(dummy_atom_kdtree_node_private), POINTER :: p
12 END TYPE
14 TYPE :: dummy_atom_kdtree_node_private
15 TYPE(dummy_atom_kdtree_data) :: data
16 END TYPE
18 TYPE :: dummy_atom_kdtree
19 TYPE(dummy_atom_kdtree_node) :: root
20 END TYPE
21 END MODULE
23 FUNCTION dummy_atom_kdtree_insert(this, item)
24 USE class_dummy_atom_kdtree_types
26 TYPE(dummy_atom_kdtree), INTENT(inout) :: this
27 TYPE(dummy_atom_kdtree_data), INTENT(in) :: item
29 TYPE(dummy_atom_kdtree_node) :: parent, current
30 INTEGER :: cmp, level, discriminator
32 parent = dummy_atom_kdtree_node(null())
33 current = this%root
34 level = 1
35 discriminator = 1
37 DO WHILE (ASSOCIATED( current%p ))
38 discriminator = MODULO(level-1, 3) + 1
39 cmp = dummy_atom_kdtree_data_compare(item, current%p%data, discriminator)
40 level = level + 1
41 END DO
43 END FUNCTION