public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: preprocessor/3872: gcc -M... ignores "-o"
@ 2002-03-15  3:28 neil
  0 siblings, 0 replies; 3+ messages in thread
From: neil @ 2002-03-15  3:28 UTC (permalink / raw)
  To: D.Yu.Bolkhovityanov, gcc-bugs, gcc-prs, neil, nobody

Synopsis: gcc -M... ignores "-o"

Responsible-Changed-From-To: unassigned->neil
Responsible-Changed-By: neil
Responsible-Changed-When: Fri Mar 15 03:28:28 2002
Responsible-Changed-Why:
    FWIW this was fixed in 3.0.5 and 3.1.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=3872


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: preprocessor/3872: gcc -M... ignores "-o"
@ 2001-07-30  0:48 neil
  0 siblings, 0 replies; 3+ messages in thread
From: neil @ 2001-07-30  0:48 UTC (permalink / raw)
  To: D.Yu.Bolkhovityanov, gcc-bugs, gcc-prs, nobody

Synopsis: gcc -M... ignores "-o"

State-Changed-From-To: open->closed
State-Changed-By: neil
State-Changed-When: Mon Jul 30 00:48:30 2001
State-Changed-Why:
    Could you report bugs in Red Hat's compiler to Red Hat?
    
    Dependency generation was improved substantially in the months before GCC 3.0 was released.   A new option -MF allows you to specify
    an output file, and semantics w.r.t. -o were changed and made more
    consistent.  See
    
    http://gcc.gnu.org/news/dependencies.html
    
    for a brief and incomplete overview.  If you still have problems with 3.0, 
    please file another PR.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view&pr=3872&database=gcc


^ permalink raw reply	[flat|nested] 3+ messages in thread

* preprocessor/3872: gcc -M... ignores "-o"
@ 2001-07-30  0:36 D.Yu.Bolkhovityanov
  0 siblings, 0 replies; 3+ messages in thread
From: D.Yu.Bolkhovityanov @ 2001-07-30  0:36 UTC (permalink / raw)
  To: gcc-gnats

>Number:         3872
>Category:       preprocessor
>Synopsis:       gcc -M... ignores "-o"
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Jul 30 00:36:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     D.Yu.Bolkhovityanov@inp.nsk.su
>Release:        gcc version 2.96 20000731 (Red Hat Linux 7.1 2.96-85)
>Organization:
>Environment:

>Description:
When gcc is ran with a following command line

gcc -M sourcefile.c -o depfile.dep

it prints a list of dependencies to stdout instead of "depfile.dep" (any "-M..." option may be used instead of just "-M" -- e.g. "-MM"). 

What it uses "-o" for is a filename before ":" in depfile -- i.e. there will be "depfile.dep: ..." instead of "sourcefile.o: ...".

In earlier versions (since ancient and at least up to egcs-2.91) this worked as expected.  Such a behaviour seems even more strange if taking into account a note in ChangeLog.CPP for 2001-01-08: "If -o given, use it as the target of any -M options" (or is *that* a cause of the bug?)

Sure, one can use ">depfile.dep" instead, but that's not a good idea, and I'll try to explain why.

When "gcc -M ..." is run from Makefile, and when cpp encounters an error (e.g. missing file in #include), in case of working "-o depfile.dep" it wouldn't touch depfile.dep, while in case of ">depfile.dep" the timestamp on the latter will become more recent than that of "sourcefile.c", and hence the immediately repeated "make" will "succeed" (since it wouldn't run "gcc -M..." at all).  Of course, the subsequent "gcc" w/o "-M" will fail, but such behaviour is undesired anyway.
>How-To-Repeat:
Issue the following commands:

echo "#include <stdio.h>" >sourcefile.c
gcc -E -M sourcefile.c -o depfile.dep

and you'll get a text describing "depfile.dep" (!!!) dependant on many system headers.  The "depfile.dep" isn't created as it should.
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2002-03-15 11:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-03-15  3:28 preprocessor/3872: gcc -M... ignores "-o" neil
  -- strict thread matches above, loose matches on Subject: below --
2001-07-30  0:48 neil
2001-07-30  0:36 D.Yu.Bolkhovityanov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).