This particular path for value_cast does not attempt to resolve a
dynamic target type before assigning it to the new value. Having a
value with a dynamic type that hasn't been resolved causes an assert
later, when printing the value. For instance, running the added test
without the fix yields:
This code path is taken when the value being cast has the same size as
the target type, and no earlier more specific rule matched. Fix it by
adding a call to resolve_dynamic_type before assigning the target type
to the value.
The test exercises this by defining a char array
(`g_outer_as_char_array`) with the same size as `outer_type` in the
DWARF info, then casting it to `outer_type`. Without the fix, this
triggers the assertion when printing the result.
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=33575
Change-Id: I547da32bbd24462b779e76bceb6e0a87859188d1 Approved-By: Tom Tromey <tom@tromey.com>