[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#591914: gcc-4.4: -MD leaves empty .d file on preprocessor error



Package: gcc-4.4
Version: 4.4.4-7
Severity: normal
Tags: upstream

*** Please type your report below this line ***

If gcc is invoked with "-MD", and a preprocessor error occurs, an
empty dependency file is left.

This leads to a problem in the following scenario:

- program is compiled OK

- a change in an included header causes a preprocessor error

- next compilation fails (correctly), but leaves empty .d file

- header is fixed

- next compilation does nothing, because object/binary is still
  newer than C file, and because of the empty .d file, the
  dependency on the (newer) header is lost

The attached file demonstrates this scenario (just "make" to run all
steps, requires GNU make).

A work-around (commented out in the example) is to remove the gcc
output file (normally the object file, in the simplified example the
binary) before calling gcc. But I think gcc should remove the .d
file itself if it can't complete it due to an error.

-- System Information:
Debian Release: squeeze/sid
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: i386 (i686)

Kernel: Linux 2.6.34 (SMP w/1 CPU core)
Locale: LANG=de_DE, LC_CTYPE=de_DE (charmap=ISO-8859-1)
Shell: /bin/sh linked to /bin/dash

Versions of packages gcc-4.4 depends on:
ii  binutils                      2.20.1-12  The GNU assembler, linker and bina
ii  cpp-4.4                       4.4.4-7    The GNU C preprocessor
ii  gcc-4.4-base                  4.4.4-7    The GNU Compiler Collection (base 
ii  libc6                         2.11.2-2   Embedded GNU C Library: Shared lib
ii  libgcc1                       1:4.4.4-7  GCC support library
ii  libgomp1                      4.4.4-7    GCC OpenMP (GOMP) support library

Versions of packages gcc-4.4 recommends:
ii  libc6-dev                     2.11.2-2   Embedded GNU C Library: Developmen

Versions of packages gcc-4.4 suggests:
ii  gcc-4.4-doc                  4.4.4.nf1-1 documentation for the GNU compiler
pn  gcc-4.4-locales              <none>      (no description available)
ii  gcc-4.4-multilib             4.4.4-7     The GNU C compiler (multilib files
pn  libcloog-ppl0                <none>      (no description available)
pn  libgcc1-dbg                  <none>      (no description available)
pn  libgomp1-dbg                 <none>      (no description available)
pn  libmudflap0-4.4-dev          <none>      (no description available)
pn  libmudflap0-dbg              <none>      (no description available)
pn  libppl-c2                    <none>      (no description available)
pn  libppl7                      <none>      (no description available)

-- no debconf information

Attachment: Makefile
Description: Binary data

#include <stdio.h>
#include "foo.h"

int main ()
{
  puts (S);
  return 0;
}

Reply to: