https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112587
Bug ID: 112587 Summary: -save-temps with p1689 dep output causes null ptr dereference Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: nickbegg at gmail dot com Target Milestone: --- Whilst debugging a separate bug with a trivial module, GCC crashes with a null ptr dereference. I have --save-temps on. The problem seems to start here: gcc/c-family/c-opts.cc:1340 fatal_error (input_location, "%<-MF%> and %<-fdeps-file=%> cannot share an output file %s: %m", fdeps_file); The cc1plus process looks like it's not invoked with -fdeps-file, and thus fdeps_file is null. Printing this diagnostic causes a crash. It seems to crash before a bug report is written out. This is the version - GNU C++23 (GCC) version 14.0.0 20231117 (experimental) (x86_64-pc-linux-gnu) (git rev ba3f5b8465ef7b278ea33ff94cd85b9638058635) This is the cmdline used to launch gcc (launched from cmake/ninja) - /home/nick/gcc-trunk-debug-inst/bin/g++ -D_GLIBCXX_ASSERTIONS -D_GLIBCXX_DEBUG -std=gnu++23 -Wall -Wextra -v -freport-bug -save-temps -MD -MT CMakeFiles/moduleMin.dir/modA.mpp.o -MF CMakeFiles/moduleMin.dir/modA.mpp.o.d -fmodules-ts -fmodule-mapper=CMakeFiles/moduleMin.dir/modA.mpp.o.modmap -MD -fdeps-format=p1689r5 -x c++ -o CMakeFiles/moduleMin.dir/modA.mpp.o -c /home/nick/src/moduleMin/modA.mpp ... and the cmdline to launch cc1plus which crashes - /home/nick/gcc-trunk-debug-inst/libexec/gcc/x86_64-pc-linux-gnu/14.0.0/cc1plus -fpreprocessed CMakeFiles/moduleMin.dir/modA.mpp.ii -quiet -dumpdir CMakeFiles/moduleMin.dir/ -dumpbase modA.mpp.mpp -dumpbase-ext .mpp -mtune=generic -march=x86-64 -Wall -Wextra -std=gnu++23 -version -freport-bug -fmodules-ts -fmodule-mapper=CMakeFiles/moduleMin.dir/modA.mpp.o.modmap -fdeps-format=p1689r5 -o CMakeFiles/moduleMin.dir/modA.mpp.s