public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: other/5718: Inconsistent and backwards incompatible handling of '-o' switch.
@ 2002-02-19 11:06 Neil Booth
  0 siblings, 0 replies; 7+ messages in thread
From: Neil Booth @ 2002-02-19 11:06 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR other/5718; it has been noted by GNATS.

From: Neil Booth <neil@daikokuya.demon.co.uk>
To: Zack Weinberg <zack@codesourcery.com>
Cc: Nathan Sidwell <nathan@codesourcery.com>, gcc-gnats@gcc.gnu.org,
	osv@javad.ru, gcc-patches@gcc.gnu.org
Subject: Re: other/5718: Inconsistent and backwards incompatible handling of '-o' switch.
Date: Tue, 19 Feb 2002 18:48:12 +0000

 Zack Weinberg wrote:-
 
 > On Mon, Feb 18, 2002 at 10:17:33PM +0000, Neil Booth wrote:
 > > Zack / Nathan,
 > > 
 > > I'd appreciate it if you would have a careful look at the attached patch,
 > > which I hope fixes this PR.  It's an attempt to fix the issue of "MD
 > > -E -o file" specificying the preprocessed output file, but "MD -c -o
 > > file" specifying the output object file.  This is what 2.95 appears to
 > > have done.
 > 
 > This seems to be the right thing, or at least a step in the right
 > direction.
 
 Great, I've committed it.  I think I've got Chris' issues fixed too.
 (PR 3951).  I'm doing a bootstrap and test cycle; if it looks good I'll
 post that too.
 
 Then I'll want to make the documentation crystal clear, and hopefully
 figure out a way to add tests to the testsuite.  However, that probably
 requires TCL-hacking, and so might not be doable immediately.  But at
 least we'll have 2.95 and 3.1 agreeing.  I hope there's a 3.0.5; then we
 can consider 3.0 finally fixed too.
 
 [Incidentally, Zack, unless you object I'm going to document cpplib's
 use of environment variables.  I think there are at least 6 we use,
 and some documented only in the code].
 
 Neil.


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

* Re: other/5718: Inconsistent and backwards incompatible handling of '-o' switch.
@ 2002-02-19 11:32 Zack Weinberg
  0 siblings, 0 replies; 7+ messages in thread
From: Zack Weinberg @ 2002-02-19 11:32 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR other/5718; it has been noted by GNATS.

From: Zack Weinberg <zack@codesourcery.com>
To: Neil Booth <neil@daikokuya.demon.co.uk>
Cc: Nathan Sidwell <nathan@codesourcery.com>, gcc-gnats@gcc.gnu.org,
	osv@javad.ru, gcc-patches@gcc.gnu.org
Subject: Re: other/5718: Inconsistent and backwards incompatible handling of '-o' switch.
Date: Tue, 19 Feb 2002 10:55:56 -0800

 > [Incidentally, Zack, unless you object I'm going to document cpplib's
 > use of environment variables.  I think there are at least 6 we use,
 > and some documented only in the code].
 
 Sounds like a good idea to me.
 
 zw


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

* Re: other/5718: Inconsistent and backwards incompatible handling of '-o' switch.
@ 2002-02-19 10:56 Zack Weinberg
  0 siblings, 0 replies; 7+ messages in thread
From: Zack Weinberg @ 2002-02-19 10:56 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR other/5718; it has been noted by GNATS.

From: Zack Weinberg <zack@codesourcery.com>
To: Neil Booth <neil@daikokuya.demon.co.uk>
Cc: Nathan Sidwell <nathan@codesourcery.com>, gcc-gnats@gcc.gnu.org,
	osv@javad.ru, gcc-patches@gcc.gnu.org
Subject: Re: other/5718: Inconsistent and backwards incompatible handling of '-o' switch.
Date: Tue, 19 Feb 2002 10:36:28 -0800

 On Mon, Feb 18, 2002 at 10:17:33PM +0000, Neil Booth wrote:
 > Zack / Nathan,
 > 
 > I'd appreciate it if you would have a careful look at the attached patch,
 > which I hope fixes this PR.  It's an attempt to fix the issue of "MD
 > -E -o file" specificying the preprocessed output file, but "MD -c -o
 > file" specifying the output object file.  This is what 2.95 appears to
 > have done.
 
 This seems to be the right thing, or at least a step in the right
 direction.
 
 zw


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

* Re: other/5718: Inconsistent and backwards incompatible handling of '-o' switch.
@ 2002-02-18 23:49 neil
  0 siblings, 0 replies; 7+ messages in thread
From: neil @ 2002-02-18 23:49 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, nobody, osv

Synopsis: Inconsistent and backwards incompatible handling of '-o' switch.

State-Changed-From-To: open->closed
State-Changed-By: neil
State-Changed-When: Mon Feb 18 23:49:42 2002
State-Changed-Why:
    Fixed for 3.1.  I'll try and get it in the patch set for 3.0.5, if such a beast ever gets released.

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


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

* Re: other/5718: Inconsistent and backwards incompatible handling of '-o'  switch.
@ 2002-02-18 14:46 Nathan Sidwell
  0 siblings, 0 replies; 7+ messages in thread
From: Nathan Sidwell @ 2002-02-18 14:46 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR other/5718; it has been noted by GNATS.

From: Nathan Sidwell <nathan@codesourcery.com>
To: Neil Booth <neil@daikokuya.demon.co.uk>
Cc: Zack Weinberg <zack@codesourcery.com>, gcc-gnats@gcc.gnu.org, osv@javad.ru,
   gcc-patches@gcc.gnu.org
Subject: Re: other/5718: Inconsistent and backwards incompatible handling of '-o' 
 switch.
Date: Mon, 18 Feb 2002 22:42:22 +0000

 Neil,
 >         * gcc.c (cpp_unique_options): Treat -o as indicating object file
 >         only if not -E.  If -E, pass -o through to the preprocessor.
 this looks right to me. Of course the big incompatibility is PR 3951 :-(
 
 nathan
 -- 
 Dr Nathan Sidwell   ::   http://www.codesourcery.com   ::   CodeSourcery LLC
          'But that's a lie.' - 'Yes it is. What's your point?'
 nathan@codesourcery.com : http://www.cs.bris.ac.uk/~nathan/ : nathan@acm.org


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

* Re: other/5718: Inconsistent and backwards incompatible handling of '-o' switch.
@ 2002-02-18 14:26 Neil Booth
  0 siblings, 0 replies; 7+ messages in thread
From: Neil Booth @ 2002-02-18 14:26 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR other/5718; it has been noted by GNATS.

From: Neil Booth <neil@daikokuya.demon.co.uk>
To: Zack Weinberg <zack@codesourcery.com>,
	Nathan Sidwell <nathan@codesourcery.com>
Cc: gcc-gnats@gcc.gnu.org, osv@javad.ru, gcc-patches@gcc.gnu.org
Subject: Re: other/5718: Inconsistent and backwards incompatible handling of '-o' switch.
Date: Mon, 18 Feb 2002 22:17:33 +0000

 Zack / Nathan,
 
 I'd appreciate it if you would have a careful look at the attached patch,
 which I hope fixes this PR.  It's an attempt to fix the issue of "MD
 -E -o file" specificying the preprocessed output file, but "MD -c -o
 file" specifying the output object file.  This is what 2.95 appears to
 have done.
 
 This is output from gcc with this patch applied (uninteresting lines
 deleted).  Pay particular note to what the driver passes through as the
 "-MQ" and "-o" options, and the /tmp/foo.d file created in the first two
 cases:
 
 $ gcc -E -MD /tmp/foo.c -o /tmp/foo.i -v
  ./cpp0 -lang-c -v -iprefix ./../lib/gcc-lib/i686-pc-linux-gnu/3.1/ -isystem ./include -M -MF /tmp/foo.d -D__GNUC__=3 -D__GNUC_MINOR__=1 -D__GNUC_PATCHLEVEL__=0 -D__ELF__ -Dunix -Dlinux -D__ELF__ -D__unix__ -D__linux__ -D__unix -D__linux -Asystem=posix -D__NO_INLINE__ -D__STDC_HOSTED__=1 -Acpu=i386 -Amachine=i386 -Di386 -D__i386 -D__i386__ -D__tune_i686__ -D__tune_pentiumpro__ /tmp/foo.c -o /tmp/foo.i
 
 foo.o: /tmp/foo.c
 
 $ gcc -c -MD /tmp/foo.c -o /tmp/foo.o -v
  ./cc1 -lang-c -v -iprefix ./../lib/gcc-lib/i686-pc-linux-gnu/3.1/ -isystem ./include -M -MF /tmp/foo.d -MQ /tmp/foo.o -D__GNUC__=3 -D__GNUC_MINOR__=1 -D__GNUC_PATCHLEVEL__=0 -D__ELF__ -Dunix -Dlinux -D__ELF__ -D__unix__ -D__linux__ -D__unix -D__linux -Asystem=posix -D__NO_INLINE__ -D__STDC_HOSTED__=1 -Acpu=i386 -Amachine=i386 -Di386 -D__i386 -D__i386__ -D__tune_i686__ -D__tune_pentiumpro__ /tmp/foo.c -quiet -dumpbase foo.c -version -o /tmp/ccfuYhmC.s
 
 /tmp/foo.o: /tmp/foo.c
 
 $ gcc -E /tmp/foo.c -o /tmp/foo.i -v
  ./cpp0 -lang-c -v -iprefix ./../lib/gcc-lib/i686-pc-linux-gnu/3.1/ -isystem ./include -D__GNUC__=3 -D__GNUC_MINOR__=1 -D__GNUC_PATCHLEVEL__=0 -D__ELF__ -Dunix -Dlinux -D__ELF__ -D__unix__ -D__linux__ -D__unix -D__linux -Asystem=posix -D__NO_INLINE__ -D__STDC_HOSTED__=1 -Acpu=i386 -Amachine=i386 -Di386 -D__i386 -D__i386__ -D__tune_i686__ -D__tune_pentiumpro__ /tmp/foo.c -o /tmp/foo.i
 
 $ gcc -c /tmp/foo.c -o /tmp/foo.o -v
  ./cc1 -lang-c -v -iprefix ./../lib/gcc-lib/i686-pc-linux-gnu/3.1/ -isystem ./include -D__GNUC__=3 -D__GNUC_MINOR__=1 -D__GNUC_PATCHLEVEL__=0 -D__ELF__ -Dunix -Dlinux -D__ELF__ -D__unix__ -D__linux__ -D__unix -D__linux -Asystem=posix -D__NO_INLINE__ -D__STDC_HOSTED__=1 -Acpu=i386 -Amachine=i386 -Di386 -D__i386 -D__i386__ -D__tune_i686__ -D__tune_pentiumpro__ /tmp/foo.c -quiet -dumpbase foo.c -version -o /tmp/ccB6LDn5.s
 
 If you think this is the desired behaviour, then I'll apply the patch to
 mainline, and to the branch for 3.0.5 (not 3.0.4) if Mark approves.
 
 Thanks,
 
 Neil.
 
 	* gcc.c (cpp_unique_options): Treat -o as indicating object file
 	only if not -E.  If -E, pass -o through to the preprocessor.
 
 Index: gcc.c
 ===================================================================
 RCS file: /cvs/gcc/gcc/gcc/gcc.c,v
 retrieving revision 1.291
 diff -u -p -r1.291 gcc.c
 --- gcc.c	2002/02/15 19:11:00	1.291
 +++ gcc.c	2002/02/18 22:06:58
 @@ -665,7 +665,7 @@ static const char *cpp_unique_options =
   %{nostdinc*} %{C} %{v} %{I*} %{P} %{$} %I\
   %{MD:-M -MF %W{!o: %b.d}%W{o*:%.d%*}}\
   %{MMD:-MM -MF %W{!o: %b.d}%W{o*:%.d%*}}\
 - %{M} %{MM} %W{MF*} %{MG} %{MP} %{MQ*} %{MT*} %{M|MD|MM|MMD:%{o*:-MQ %*}}\
 + %{M} %{MM} %W{MF*} %{MG} %{MP} %{MQ*} %{MT*} %{!E:%{M|MD|MM|MMD:%{o*:-MQ %*}}}\
   %{!no-gcc:-D__GNUC__=%v1 -D__GNUC_MINOR__=%v2 -D__GNUC_PATCHLEVEL__=%v3}\
   %{!undef:%{!ansi:%{!std=*:%p}%{std=gnu*:%p}} %P} %{trigraphs}\
   %{Os:-D__OPTIMIZE_SIZE__} %{O*:%{!O0:-D__OPTIMIZE__}}\
 @@ -674,7 +674,7 @@ static const char *cpp_unique_options =
   %{ffreestanding:-D__STDC_HOSTED__=0} %{fno-hosted:-D__STDC_HOSTED__=0}\
   %{!ffreestanding:%{!fno-hosted:-D__STDC_HOSTED__=1}} %{remap}\
   %{g3:-dD} %{H} %C %{D*&U*&A*} %{i*} %Z %i\
 - %{E:%{!M*:%W{o*}}}";
 + %{E:%W{o*}}";
  
  /* This contains cpp options which are common with cc1_options and are passed
     only when preprocessing only to avoid duplication.  */


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

* other/5718: Inconsistent and backwards incompatible handling of '-o' switch.
@ 2002-02-18  4:26 osv
  0 siblings, 0 replies; 7+ messages in thread
From: osv @ 2002-02-18  4:26 UTC (permalink / raw)
  To: gcc-gnats


>Number:         5718
>Category:       other
>Synopsis:       Inconsistent and backwards incompatible handling of '-o' switch.
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Feb 18 04:26:00 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     osv@javad.ru
>Release:        version 3.0.3
>Organization:
>Environment:
Linux falcon 2.2.14 #2 SMP Sat Apr 15 13:24:18 MSD 2000 i686 unknown
>Description:
gcc doesn't pass '-o' option to preprocessor when both -E and -MD are
specified, i.e., when gcc is invoked like this:

gcc -E -MD file.c -o file.i

the result of preprocessing is output to 'stdout', not into 'file.i'.

Having definition of '-MD' from gcc.info:

  "... This is in addition to compiling the main file as specified--`-MD'
       does not inhibit ordinary compilation..."

and the following behavior:

gcc -c     file.c -o file.o     # sends output to 'file.o'
gcc -c -MD file.c -o file.o     # sends output to 'file.o'
gcc -E     file.c -o file.i     # sends output to 'file.i'
gcc -E -MD file.c -o file.i     # ! sends output to 'stdout'


I believe the behavior of "-E -MD -o" combination of command-line options is
both inconsistent and surprising.

gcc before 3.0 (e.g., 2.95.2) behaves correctly, so current behavior is also backwards
incompatible. 
>How-To-Repeat:
$ cat file.c
void foo() {}
$ ~/try/bin/gcc -v -E -MD file.c -o file.i
Reading specs from /home/osv/try/lib/gcc-lib/i686-pc-linux-gnu/3.0.3/specs
Configured with: /home/osv/cygnus/gcc/configure --prefix=/home/osv/try --disable-nls --with-gnu-as --with-gnu-ld : (reconfigured) 
Thread model: single
gcc version 3.0.3
 /home/osv/try/lib/gcc-lib/i686-pc-linux-gnu/3.0.3/cpp0 -lang-c -v -M -MF file.d -MQ file.i -D__GNUC__=3 -D__GNUC_MINOR__=0 -D__GNUC_PATCHLEVEL__=3 -D__ELF__ -Dunix -Dlinux -D__ELF__ -D__unix__ -D__linux__ -D__unix -D__linux -Asystem=posix -D__NO_INLINE__ -D__STDC_HOSTED__=1 -Acpu=i386 -Amachine=i386 -Di386 -D__i386 -D__i386__ -D__tune_i686__ -D__tune_pentiumpro__ file.c
GNU CPP version 3.0.3 (cpplib) (i386 Linux/ELF)
ignoring nonexistent directory "/home/osv/try/i686-pc-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include
 /home/osv/try/include
 /home/osv/try/lib/gcc-lib/i686-pc-linux-gnu/3.0.3/include
 /usr/include
End of search list.
# 1 "file.c"
void foo() {}
$ cat file.i
cat: file.i: No such file or directory
$
>Fix:
Use

gcc -E -MD file.c > file.i

instead of 

gcc -E -MD file.c -o file.i
>Release-Note:
>Audit-Trail:
>Unformatted:


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

end of thread, other threads:[~2002-02-19 19:06 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-02-19 11:06 other/5718: Inconsistent and backwards incompatible handling of '-o' switch Neil Booth
  -- strict thread matches above, loose matches on Subject: below --
2002-02-19 11:32 Zack Weinberg
2002-02-19 10:56 Zack Weinberg
2002-02-18 23:49 neil
2002-02-18 14:46 Nathan Sidwell
2002-02-18 14:26 Neil Booth
2002-02-18  4:26 osv

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).