On 07/19/2016 07:04 AM, David Malcolm wrote:
If a NULL is passed in as the expected or actual value for an
ASSERT_STREQ, the call to strcmp within selftest::assert_streq
can segfault, leading to a failure of -fself-test without
indicating which test failed.

Handle this more gracefully by checking for NULL, so that
information on the failing test is printed to stderr if this
occurs.

Successfully bootstrapped&regrtested on x86_64-pc-linux-gnu.
I also manually tested the various kinds of failure of
ASSERT_STR_EQ, and verified that each branch prints a sane
failure message before aborting.

OK for trunk?

gcc/ChangeLog:
        * selftest.c (selftest::assert_streq): Handle NULL values of
        val_actual and val_expected.
OK.
jeff

Reply via email to