]> git.feebdaed.xyz Git - 0xmirror/gcc.git/commit
c-family: Fix ICE with -MD and -fdeps-format sharing output [PR121864]
authorEgas Ribeiro <egas.g.ribeiro@gmail.com>
Mon, 22 Dec 2025 21:41:00 +0000 (21:41 +0000)
committerJason Merrill <jason@redhat.com>
Fri, 26 Dec 2025 12:35:41 +0000 (19:35 +0700)
commit7b0a85ab6633f71e0488299b2b3a8e26b7cf7d78
tree208a60fbe89a8f9fe7ff5a56f985891ced06b889
parent5cdb2a59308c9539b23e945c7f5f48743520e476
c-family: Fix ICE with -MD and -fdeps-format sharing output [PR121864]

When -MD, -fdeps-format=p1689r5 and -save-temps are used without
explicit output files, they default to the same stream, which is
invalid. The error message attempted to print fdeps_file, but this is
NULL in this case, causing an ICE.

Use out_fname as a fallback when fdeps_file is NULL to avoid the ICE
and provide a meaningful error message.

Fix suggested by Andrew Pinski.

PR c++/121864

gcc/c-family/ChangeLog:

* c-opts.cc (c_common_finish): Use out_fname as fallback when
fdeps_file is NULL in error message.

Signed-off-by: Egas Ribeiro <egas.g.ribeiro@gmail.com>
Reviewed-by: Jason Merrill <jason@redhat.com>
gcc/c-family/c-opts.cc