GNU Binutils with patches for OS216
Revision | 4c60f96807d8559a56412d846b96b9cccedfa8e7 (tree) |
---|---|
Zeit | 2016-09-07 19:19:36 |
Autor | Bernhard Heckel <bernhard.heckel@inte...> |
Commiter | Bernhard Heckel |
Fortran: Testsuite, add cyclic pointers.
2016-05-25 Bernhard Heckel <bernhard.heckel@intel.com>
gdb/testsuite/Changelog:
* pointers.f90: Add cylic pointers.
* pointers.exp: Add print of cyclic pointers.
Change-Id: Ic3b6187c5980fd6c37e2e94787f8321e5b7f2d75
@@ -57,6 +57,24 @@ gdb_test_multiple "print intap" $test { | ||
57 | 57 | gdb_test "print realp" "= \\(PTR TO -> \\( $real \\)\\) 0x0" "print realp, not associated" |
58 | 58 | gdb_test "print *realp" "Cannot access memory at address 0x0" "print *realp, not associated" |
59 | 59 | gdb_test "print \$my_var = intp" "= \\(PTR TO -> \\( $int \\)\\) 0x0" |
60 | +set test "print cyclicp1, not associated" | |
61 | +gdb_test_multiple "print cyclicp1" $test { | |
62 | + -re "= \\( i = -?\\d+, p = 0x0 \\)\r\n$gdb_prompt $" { | |
63 | + pass $test | |
64 | + } | |
65 | + -re "= \\( i = -?\\d+, p = <not associated> \\)\r\n$gdb_prompt $" { | |
66 | + pass $test | |
67 | + } | |
68 | +} | |
69 | +set test "print cyclicp1%p, not associated" | |
70 | +gdb_test_multiple "print cyclicp1%p" $test { | |
71 | + -re "= \\(PTR TO -> \\( Type typewithpointer \\)\\) 0x0\r\n$gdb_prompt $" { | |
72 | + pass $test | |
73 | + } | |
74 | + -re "= \\(PTR TO -> \\( Type typewithpointer \\)\\) <not associated>\r\n$gdb_prompt $" { | |
75 | + pass $test | |
76 | + } | |
77 | +} | |
60 | 78 | |
61 | 79 | |
62 | 80 | gdb_breakpoint [gdb_get_line_number "Before value assignment"] |
@@ -118,6 +136,8 @@ gdb_test_multiple "print *(arrayOfPtr(3)%p)" $test_name { | ||
118 | 136 | pass $test_name |
119 | 137 | } |
120 | 138 | } |
139 | +gdb_test "print cyclicp1" "= \\( i = 1, p = $hex\( <.*>\)? \\)" | |
140 | +gdb_test "print cyclicp1%p" "= \\(PTR TO -> \\( Type typewithpointer \\)\\) $hex\( <.*>\)?" | |
121 | 141 | gdb_test "print *((integer*) &inta + 2)" "= 3" "print temporary pointer, array" |
122 | 142 | gdb_test "print *((integer*) &intvla + 3)" "= 4" "print temporary pointer, allocated vla" |
123 | 143 | gdb_test "print \$pc" "= \\(PTR TO -> \\( void \\(\\)\\(\\)\\)\\) $hex <pointers\\+\\d+>" "Print program counter" |
@@ -20,6 +20,11 @@ program pointers | ||
20 | 20 | integer, allocatable :: ivla2 (:, :) |
21 | 21 | end type two |
22 | 22 | |
23 | + type :: typeWithPointer | |
24 | + integer i | |
25 | + type(typeWithPointer), pointer:: p | |
26 | + end type typeWithPointer | |
27 | + | |
23 | 28 | type :: twoPtr |
24 | 29 | type (two), pointer :: p |
25 | 30 | end type twoPtr |
@@ -34,6 +39,7 @@ program pointers | ||
34 | 39 | real, target :: realv |
35 | 40 | type(two), target :: twov |
36 | 41 | type(twoPtr) :: arrayOfPtr (3) |
42 | + type(typeWithPointer), target:: cyclicp1,cyclicp2 | |
37 | 43 | |
38 | 44 | logical, pointer :: logp |
39 | 45 | complex, pointer :: comp |
@@ -57,6 +63,8 @@ program pointers | ||
57 | 63 | nullify (arrayOfPtr(1)%p) |
58 | 64 | nullify (arrayOfPtr(2)%p) |
59 | 65 | nullify (arrayOfPtr(3)%p) |
66 | + nullify (cyclicp1%p) | |
67 | + nullify (cyclicp2%p) | |
60 | 68 | |
61 | 69 | logp => logv ! Before pointer assignment |
62 | 70 | comp => comv |
@@ -68,6 +76,10 @@ program pointers | ||
68 | 76 | realp => realv |
69 | 77 | twop => twov |
70 | 78 | arrayOfPtr(2)%p => twov |
79 | + cyclicp1%i = 1 | |
80 | + cyclicp1%p => cyclicp2 | |
81 | + cyclicp2%i = 2 | |
82 | + cyclicp2%p => cyclicp1 | |
71 | 83 | |
72 | 84 | logv = associated(logp) ! Before value assignment |
73 | 85 | comv = cmplx(1,2) |