https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105412
Bug ID: 105412 Summary: [10/11/12 Regression] Missing phony target with -MP for first include when compiling from stdin Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: preprocessor Assignee: unassigned at gcc dot gnu.org Reporter: jsm28 at gcc dot gnu.org Target Milestone: --- When generating dependencies with -M -MP, the phony target for the first included header (typically stdc-predef.h) is missing if compiling from stdin, with GCC 10 and later but not with GCC 9. For example: $ echo "#include <cstdlib>" | ./many9/install/compilers/x86_64-linux-gnu/bin/x86_64-glibc-linux-gnu-g++ -M -MP -x c++ - | grep stdc-predef /scratch/jmyers/glibc/many9/install/compilers/x86_64-linux-gnu/sysroot/usr/include/stdc-predef.h \ /scratch/jmyers/glibc/many9/install/compilers/x86_64-linux-gnu/sysroot/usr/include/stdc-predef.h: shows the expected phony target (the second line of output) with a GCC 9 compiler, but $ echo "#include <cstdlib>" | ./many10/install/compilers/x86_64-linux-gnu/bin/x86_64-glibc-linux-gnu-g++ -M -MP -x c++ - | grep stdc-predef /scratch/jmyers/glibc/many10/install/compilers/x86_64-linux-gnu/sysroot/usr/include/stdc-predef.h \ shows that line of output is missing with GCC 10 and later. (This example is adapted from code in glibc's configure script, but the bug only actually causes problems with glibc when the compiler is used with an old sysroot lacking stdc-predef.h and so the missing phony target is that for <cstdlib> itself.)