Bug 20770 - Using -M -MT ... -MF ... with -g3 generates preprocess line to stdout
Summary: Using -M -MT ... -MF ... with -g3 generates preprocess line to stdout
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: preprocessor (show other bugs)
Version: 3.4.2
: P2 normal
Target Milestone: 4.1.0
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-04-05 18:29 UTC by Ben Vizzier
Modified: 2008-03-30 20:04 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ben Vizzier 2005-04-05 18:29:03 UTC
Found using gcc 3.4.2 on Fedora Core 3:

$ gcc -g3 -M -MT hello. -MF hello.d hello.c 
# 1 "/home/viz/src//"
$ 

The line '# 1 "/home/viz/src//"' should not be generated.

Verified that the problem still exists in 3.4.3.

$ cat hello.c
#include <stdio.h>

int main () {
   printf("Hello\n");
}
$ gcc -v -Wall -g3 -M -MT hello. -MF hello.d hello.c
Reading specs from /usr/local/lib/gcc/x86_64-unknown-linux-gnu/3.4.3/specs
Configured with: ./configure 
Thread model: posix
gcc version 3.4.3
 /usr/local/libexec/gcc/x86_64-unknown-linux-gnu/3.4.3/cc1 -E -quiet -v -M -MF hello.d -MT hello. 
-dD hello.c -mtune=k8 -Wall -fworking-directory
ignoring nonexistent directory "NONE/include"
ignoring nonexistent directory "/usr/local/lib/gcc/x86_64-unknown-linux-gnu/3.4.3/../../../../
x86_64-unknown-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include
 /usr/local/lib/gcc/x86_64-unknown-linux-gnu/3.4.3/include
 /usr/include
End of search list.
# 1 "/home/viz/src//"
$

Workaround: Don't use the -g3 option.
Comment 1 Andrew Pinski 2005-04-05 23:32:42 UTC
I know I have seen this around somewhere before but I forgot where.
Comment 2 Tom Tromey 2006-12-26 00:37:33 UTC
FWIW I do not see this bug with the fedora core 6 gcc:

mopsy. gcc --version
gcc (GCC) 4.1.1 20061011 (Red Hat 4.1.1-30)
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Comment 3 Tom Tromey 2007-11-28 18:21:15 UTC
Can you reproduce this with anything newer than 3.4?
The 3.x release series is closed.  I couldn't reproduce with 4.1.
So, barring new information, I think this is fixed.
Comment 4 Andrew Pinski 2008-03-30 20:04:02 UTC
Fixed so closing as such.