middle-end: always find a basename for -fdiagnostics-format=*
commitc5e2c3dd6afcf9b152df72b30e205b0180c0afd5
authorMartin Liska <mliska@suse.cz>
Tue, 10 Jan 2023 14:14:05 +0000 (10 15:14 +0100)
committerMartin Liska <mliska@suse.cz>
Thu, 16 Mar 2023 14:50:00 +0000 (16 15:50 +0100)
tree15585a18ce3c2b3d7684cab1260b6ab94b2cf0cf
parentbd2d206b7b7d32ef6f45ce23192cfaf5fe14ac3d
middle-end: always find a basename for -fdiagnostics-format=*

In some situations, x_dump_base_name is NULL and thus we can
and should use x_main_input_basename which should never be NULL.

PR middle-end/106133

gcc/ChangeLog:

* gcc.cc (driver_handle_option): Use x_main_input_basename
if x_dump_base_name is null.
* opts.cc (common_handle_option): Likewise.

gcc/testsuite/ChangeLog:

* c-c++-common/pr106133.c: New test.
gcc/gcc.cc
gcc/opts.cc
gcc/testsuite/c-c++-common/pr106133.c [new file with mode: 0644]