Bugzilla will be upgraded to version 5.0 on a still to be determined date in the near future. The original upgrade date has been delayed.
Bug 73590 - Interrupting gcc -MD removes .d file but not .o
Interrupting gcc -MD removes .d file but not .o
Product: Red Hat Linux
Classification: Retired
Component: gcc (Show other bugs)
All Linux
medium Severity medium
: ---
: ---
Assigned To: Jason Merrill
Brian Brock
Depends On:
  Show dependency treegraph
Reported: 2002-09-06 09:03 EDT by Jason Merrill
Modified: 2007-04-18 12:46 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2002-09-09 10:28:58 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Jason Merrill 2002-09-06 09:03:47 EDT
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.1b) Gecko/20020721

Description of problem:
[from customer bug report]
We are using -MD option in gcc to manage the dependency information. The problem
is this, if this is interrupted by a control-c gcc promptly deletes the .d file
but not any .o file that may have been existed prior to compilation. So for
example, the following situation could occur:

1. foo.C depends on foo.H
2. foo.H is changed followed by a gmake
3. foo.H is changed again followed by a gmake
4. gmake is interrupted
5. .d file gets deleted
6. foo.H is changed again but doing a gmake will now do nothing

The problem is that now foo.o may have a bogus object layout.

Version-Release number of selected component (if applicable):
All through 2.96-112 and 3.2-5

How reproducible:

Steps to Reproduce:
1. gcc -c foo.c -MD -o foo.o
2. ls -l foo.* (notice that both foo.d and foo.o exist)
3. gcc -c foo.c -MD -o foo.o (interrupt with ^C while cc1 is running)


Actual Results:  foo.o exists, but foo.d does not.

Expected Results:  if foo.d is deleted, foo.o must be deleted as well; otherwise
a makefile which relies on the contents of foo.d in order to decide when to
rebuild foo.o will get the wrong answer.

It might be possible to delete neither if foo.d hasn't been modified yet, but
that's probably too much trouble to implement.

Additional info:

If -o is not used in the compile, neither foo.d nor foo.o are deleted.
Comment 1 Jason Merrill 2002-09-09 10:28:51 EDT
GCC bug report filed at
Comment 2 Jason Merrill 2002-09-22 12:14:53 EDT
fixed in gcc-2.96-113 by reverting part of an earlier patch.

Note You need to log in before you can comment on or make changes to this bug.