http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54600
Bug #: 54600 Summary: Header file missing from dependency file. Classification: Unclassified Product: gcc Version: 4.5.3 Status: UNCONFIRMED Severity: normal Priority: P3 Component: preprocessor AssignedTo: unassig...@gcc.gnu.org ReportedBy: mr.duncan.mo...@gmail.com In this simplified example, the local unistd.h is absent from the dependency file. % gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/lib/gcc/i686-pc-cygwin/4.5.3/lto-wrapper.exe Target: i686-pc-cygwin Configured with: /gnu/gcc/releases/respins/4.5.3-3/gcc4-4.5.3-3/src/gcc-4.5.3/configure --srcdir=/gnu/gcc/releases/respins/4.5.3-3/gcc4-4.5.3-3/src/gcc-4.5.3 --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --libexecdir=/usr/lib --datadir=/usr/share --localstatedir=/var --sysconfdir=/etc --datarootdir=/usr/share --docdir=/usr/share/doc/gcc4 -C --datadir=/usr/share --infodir=/usr/share/info --mandir=/usr/share/man -v --with-gmp=/usr --with-mpfr=/usr --enable-bootstrap --enable-version-specific-runtime-libs --libexecdir=/usr/lib --enable-static --enable-shared --enable-shared-libgcc --disable-__cxa_atexit --with-gnu-ld --with-gnu-as --with-dwarf2 --disable-sjlj-exceptions --enable-languages=ada,c,c++,fortran,java,lto,objc,obj-c++ --enable-graphite --enable-lto --enable-java-awt=gtk --disable-symvers --enable-libjava --program-suffix=-4 --enable-libgomp --enable-libssp --enable-libada --enable-threads=posix --with-arch=i686 --with-tune=generic --enable-libgcj-sublibs CC=gcc-4 CXX=g++-4 CC_FOR_TARGET=gcc-4 CXX_FOR_TARGET=g++-4 GNATMAKE_FOR_TARGET=gnatmake GNATBIND_FOR_TARGET=gnatbind --with-ecj-jar=/usr/share/java/ecj.jar Thread model: posix gcc version 4.5.3 (GCC) % cat xyz.c #include <fcntl.h> % cat fcntl.h #pragma GCC system_header #include <unistd.h> % cat unistd.h dummy error line % gcc -E -MMD -I. -o xyz.i xyz.c The local unistd.h is included: % cat xyz.i # 1 "xyz.c" # 1 "<built-in>" # 1 "<command-line>" # 1 "xyz.c" # 1 "./fcntl.h" 1 # 2 "./fcntl.h" 3 # 1 "./unistd.h" 1 3 dummy error line # 2 "./fcntl.h" 2 3 # 1 "xyz.c" 2 , but not put in the dependency file: % cat xyz.d xyz.o: xyz.c fcntl.h I would expect: % cat xyz.d xyz.o: xyz.c fcntl.h unistd.h Note that replacing -MMD by -MD gives the expected dependency file.