This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
other/5718: Inconsistent and backwards incompatible handling of '-o' switch.
- From: osv at javad dot ru
- To: gcc-gnats at gcc dot gnu dot org
- Date: 18 Feb 2002 12:21:22 -0000
- Subject: other/5718: Inconsistent and backwards incompatible handling of '-o' switch.
- Reply-to: osv at javad dot ru
>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: