blob: b554b76543aec43c930006de99a2b7815fe9c78f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
! PR target/36680
! { dg-do compile { target i?86-*-* x86_64-*-* } }
! { dg-options "-O1 -fschedule-insns" }
MODULE class_dummy_atom_kdtree_types
TYPE dummy_atom_kdtree_data
INTEGER :: dummy
END TYPE
TYPE :: dummy_atom_kdtree_node
TYPE(dummy_atom_kdtree_node_private), POINTER :: p
END TYPE
TYPE :: dummy_atom_kdtree_node_private
TYPE(dummy_atom_kdtree_data) :: data
END TYPE
TYPE :: dummy_atom_kdtree
TYPE(dummy_atom_kdtree_node) :: root
END TYPE
END MODULE
FUNCTION dummy_atom_kdtree_insert(this, item)
USE class_dummy_atom_kdtree_types
TYPE(dummy_atom_kdtree), INTENT(inout) :: this
TYPE(dummy_atom_kdtree_data), INTENT(in) :: item
TYPE(dummy_atom_kdtree_node) :: parent, current
INTEGER :: cmp, level, discriminator
parent = dummy_atom_kdtree_node(null())
current = this%root
level = 1
discriminator = 1
DO WHILE (ASSOCIATED( current%p ))
discriminator = MODULO(level-1, 3) + 1
cmp = dummy_atom_kdtree_data_compare(item, current%p%data, discriminator)
level = level + 1
END DO
END FUNCTION
|