[Bug c++/121864] ICE with empty (or trivial) source, C++ modules, and -save-temps

cvs-commit at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Dec 26 12:36:02 GMT 2025


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121864

--- Comment #7 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Jason Merrill <jason@gcc.gnu.org>:

https://gcc.gnu.org/g:7b0a85ab6633f71e0488299b2b3a8e26b7cf7d78

commit r16-6396-g7b0a85ab6633f71e0488299b2b3a8e26b7cf7d78
Author: Egas Ribeiro <egas.g.ribeiro@gmail.com>
Date:   Mon Dec 22 21:41:00 2025 +0000

    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>


More information about the Gcc-bugs mailing list