Re: [PATCH] Add null check for character type name

Keith Seitz
2026-02-03T20:59:13Z

Hi,

On 2/3/26 12:27 PM, Tom Tromey wrote:
> The internal AdaCore test suite found that
> wchar_printer::get_default_encoding checks the name of a type without
> first seeing if the name is null:
>
> else if (streq (chtype->name (), "wchar_t"))
>
> Mysteriously, though, this only seems to happen for certain targets
> and perhaps only under certain conditions (I couldn't reproduce it
> msyelf).
>
> I felt that the fix is fairly obvious and that this isn't really worth
> writing a test for. However I can write one using the DWARF assembler
> if someone feels it is worthwhile.

I don't mind not having a test. IMO, we shouldn't be so super-strict
about needing tests for literally everything -- especially trivial
defensive programming patches like this.

Keith