diff options
Diffstat (limited to 'gdb/testsuite/gdb.fortran')
-rw-r--r-- | gdb/testsuite/gdb.fortran/vla-ptype.exp | 12 | ||||
-rw-r--r-- | gdb/testsuite/gdb.fortran/vla-sizeof.exp | 10 | ||||
-rw-r--r-- | gdb/testsuite/gdb.fortran/vla-value.exp | 27 | ||||
-rw-r--r-- | gdb/testsuite/gdb.fortran/vla.f90 | 15 |
4 files changed, 64 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.fortran/vla-ptype.exp b/gdb/testsuite/gdb.fortran/vla-ptype.exp index a4c3c9c..7f8268b 100644 --- a/gdb/testsuite/gdb.fortran/vla-ptype.exp +++ b/gdb/testsuite/gdb.fortran/vla-ptype.exp @@ -98,3 +98,15 @@ gdb_test "ptype vla2" "type = $real, allocatable \\(:,:,:\\)" "ptype vla2 not al gdb_test "ptype vla2(5, 45, 20)" \ "no such vector element \\\(vector not allocated\\\)" \ "ptype vla2(5, 45, 20) not allocated" + +gdb_breakpoint [gdb_get_line_number "vla1-neg-bounds-v1"] +gdb_continue_to_breakpoint "vla1-neg-bounds-v1" +gdb_test "ptype vla1" \ + "type = $real, allocatable \\(-2:-1,-5:-2,-3:-1\\)" \ + "ptype vla1 negative bounds" + +gdb_breakpoint [gdb_get_line_number "vla1-neg-bounds-v2"] +gdb_continue_to_breakpoint "vla1-neg-bounds-v2" +gdb_test "ptype vla1" \ + "type = $real, allocatable \\(-2:1,-5:2,-3:1\\)" \ + "ptype vla1 negative lower bounds, positive upper bounds" diff --git a/gdb/testsuite/gdb.fortran/vla-sizeof.exp b/gdb/testsuite/gdb.fortran/vla-sizeof.exp index 4fe6938..4aece0b 100644 --- a/gdb/testsuite/gdb.fortran/vla-sizeof.exp +++ b/gdb/testsuite/gdb.fortran/vla-sizeof.exp @@ -59,3 +59,13 @@ gdb_test "print sizeof(pvla)" " = 4000" "print sizeof associated pvla" gdb_test "print sizeof(pvla(3,2,1))" "4" \ "print sizeof element from associated pvla" gdb_test "print sizeof(pvla(3:4,2,1))" "800" "print sizeof sliced pvla" + +gdb_breakpoint [gdb_get_line_number "vla1-neg-bounds-v1"] +gdb_continue_to_breakpoint "vla1-neg-bounds-v1" +gdb_test "print sizeof(vla1)" " = 96" \ + "print sizeof vla1 negative bounds" + +gdb_breakpoint [gdb_get_line_number "vla1-neg-bounds-v2"] +gdb_continue_to_breakpoint "vla1-neg-bounds-v2" +gdb_test "print sizeof(vla1)" " = 640" \ + "print sizeof vla1 negative lower bounds, positive upper bounds" diff --git a/gdb/testsuite/gdb.fortran/vla-value.exp b/gdb/testsuite/gdb.fortran/vla-value.exp index 3cf5d67..ed0cace 100644 --- a/gdb/testsuite/gdb.fortran/vla-value.exp +++ b/gdb/testsuite/gdb.fortran/vla-value.exp @@ -161,3 +161,30 @@ gdb_breakpoint [gdb_get_line_number "pvla-deassociated"] gdb_continue_to_breakpoint "pvla-deassociated, second time" gdb_test "print \$mypvar(1,3,8)" " = 1001" \ "print \$mypvar(1,3,8) after deallocated" + +gdb_breakpoint [gdb_get_line_number "vla1-neg-bounds-v1"] +gdb_continue_to_breakpoint "vla1-neg-bounds-v1" +with_test_prefix "negative bounds" { + gdb_test "print vla1(-2,-5,-3)" " = 1" + gdb_test "print vla1(-2,-3,-1)" " = -231" + gdb_test "print vla1(-3,-5,-3)" "no such vector element" + gdb_test "print vla1(-2,-6,-3)" "no such vector element" + gdb_test "print vla1(-2,-5,-4)" "no such vector element" + gdb_test "print vla1(0,-2,-1)" "no such vector element" + gdb_test "print vla1(-1,-1,-1)" "no such vector element" + gdb_test "print vla1(-1,-2,0)" "no such vector element" +} + +gdb_breakpoint [gdb_get_line_number "vla1-neg-bounds-v2"] +gdb_continue_to_breakpoint "vla1-neg-bounds-v2" +with_test_prefix "negative lower bounds, positive upper bounds" { + gdb_test "print vla1(-2,-5,-3)" " = 2" + gdb_test "print vla1(-2,-3,-1)" " = 2" + gdb_test "print vla1(-2,-4,-2)" " = -242" + gdb_test "print vla1(-3,-5,-3)" "no such vector element" + gdb_test "print vla1(-2,-6,-3)" "no such vector element" + gdb_test "print vla1(-2,-5,-4)" "no such vector element" + gdb_test "print vla1(2,2,1)" "no such vector element" + gdb_test "print vla1(1,3,1)" "no such vector element" + gdb_test "print vla1(1,2,2)" "no such vector element" +} diff --git a/gdb/testsuite/gdb.fortran/vla.f90 b/gdb/testsuite/gdb.fortran/vla.f90 index 5bc6087..0ccb5c9 100644 --- a/gdb/testsuite/gdb.fortran/vla.f90 +++ b/gdb/testsuite/gdb.fortran/vla.f90 @@ -54,4 +54,19 @@ program vla allocate (vla3 (2,2)) ! vla2-deallocated vla3(:,:) = 13 + + allocate (vla1 (-2:-1, -5:-2, -3:-1)) + vla1(:, :, :) = 1 + vla1(-2, -3, -1) = -231 + + deallocate (vla1) ! vla1-neg-bounds-v1 + l = allocated(vla1) + + allocate (vla1 (-2:1, -5:2, -3:1)) + vla1(:, :, :) = 2 + vla1(-2, -4, -2) = -242 + + deallocate (vla1) ! vla1-neg-bounds-v2 + l = allocated(vla1) + end program vla |