diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index 599a696839e..960a7f49e45 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -4207,6 +4207,19 @@ types_equal (struct type *a, struct type *b) return true; } + /* Two array types are the same if they have the same element types + and array bounds. */ + if (a->code () == TYPE_CODE_ARRAY) + { + if (!types_equal (a->target_type (), b->target_type ())) + return false; + + if (*a->bounds () != *b->bounds ()) + return false; + + return true; + } + return false; } diff --git a/gdb/testsuite/gdb.cp/converts.exp b/gdb/testsuite/gdb.cp/converts.exp index bf608bdcccd..6ea21fec563 100644 --- a/gdb/testsuite/gdb.cp/converts.exp +++ b/gdb/testsuite/gdb.cp/converts.exp @@ -48,6 +48,7 @@ gdb_test "p foo1_8 (bp)" "Using non-standard.*" "pointer to long int" gdb_test "p foo1_5 (b)" "= 15" "pointer pointer to void pointer" gdb_test "p foo2_1 (b)" "= 21" "pointer pointer to pointer pointer" gdb_test "p foo2_2 (b)" "Cannot resolve.*" "pointer pointer to array of arrays" +gdb_test "p foo2_2 (ba)" "= 22" "array of arrays to array of arrays" gdb_test "p foo2_3 (b)" "= 23" "pointer pointer to array of pointers" gdb_test "p foo2_4 (b)" "Cannot resolve.*" "pointer pointer to array of wrong pointers"