[Bug c/14934] New: the assumed dependency target isn't always right

dfries at mail dot win dot org gcc-bugzilla@gcc.gnu.org
Tue Apr 13 04:24:00 GMT 2004


SpacedOut:/tmp/test$ gcc -MMD headers.h
SpacedOut:/tmp/test$ cat headers.d 
headers.o: headers.h
SpacedOut:/tmp/test$ gcc -MMD main.c
SpacedOut:/tmp/test$ cat main.d
main.o: main.c

The correct output would be,
headers.h.gch: headers.h
a.out: main.c headers.h.gch

While a.out might be arguable strace
strace -o /tmp/gcc_output -e file -f -F gcc -MMD main.c
shows that main.o was never created so it really can't be the right
target file.

The function deps_add_default_target in gcc/mkdeps.c adds .o to the
basename of whatever file that is being compiled.  Perhaps the section
of the compiler that generates the final output file should be where
the target is specified.

SpacedOut:/tmp/test$ gcc -v
Reading specs from /home/david/WorkProjects/OpenSceneGraph/DevelGcc/install/lib/gcc/i686-pc-linux-gnu/3.5.0/specs
Configured with: ../gcc_src/configure --enable-languages=c++ --prefix=/home/david/WorkProjects/OpenSceneGraph/DevelGcc/install 
--exec-prefix=/home/david/WorkProjects/OpenSceneGraph/DevelGcc/install
Thread model: posix
gcc version 3.5.0 20040412 (experimental)


header.h:
#ifndef _HEADERS_H
#define _HEADERS_H 1
const int value=32;
#endif /* _HEADERS_H */

main.c:
#include "headers.h"

int main(int argc, char ** argv)
{
        return value;
}

-- 
           Summary: the assumed dependency target isn't always right
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: dfries at mail dot win dot org
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i386-linux
  GCC host triplet: i386-linux
GCC target triplet: i386-linux


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14934



More information about the Gcc-bugs mailing list