public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/11810] New: gcc -pipe -ox.o -c x.c  writes erroneous x.o on compile error
@ 2003-08-05 18:21 deweese at ict dot usc dot edu
  2003-08-05 18:27 ` [Bug c/11810] " pinskia at physics dot uc dot edu
                   ` (9 more replies)
  0 siblings, 10 replies; 13+ messages in thread
From: deweese at ict dot usc dot edu @ 2003-08-05 18:21 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11810

           Summary: gcc -pipe -ox.o -c x.c  writes erroneous x.o on compile
                    error
           Product: gcc
           Version: 3.3.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: deweese at ict dot usc dot edu
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i386-pc-linux-gnu
  GCC host triplet: i386-pc-linux-gnu
GCC target triplet: i386-pc-linux-gnu

GCC incorrectly generates an output .o file even if there is a compiler
error under the following conditions:
    -pipe is enabled, -c is enabled, and -o<objname>.o is specified.

The output object file is slightly different than an object file generated
from a C file without a minor compiler error, for example if the word ERROR
is added arbitrarily to the C file. Under these error conditions,
some symbols go missing from the output object file.

I have verified that the error occurs on gcc 2.95, 3.0.4, 3.2.3, and 3.3.1.

>How-To-Repeat:

Create a file "foo.c" with the following content, sans angle brackets:
>>>>
#include <stdio.h>
int main(int argc, char** argv) {
  ERROR
  printf("Hello World.\n");
  return 0;
}
<<<<

Execute the following command with any version of gcc:
gcc -pipe -ofoo.o -c foo.c

The output is as follows:
foo.c: In function main':
foo.c:4: error: ERROR' undeclared (first use in this function)
foo.c:4: error: (Each undeclared identifier is reported only once
foo.c:4: error: for each function it appears in.)
foo.c:4: error: syntax error before "printf"

However, foo.o is written out. Subsequently, linking it causes an error:

gcc test.o

The output is:
/usr/lib/gcc-lib/i386-linux/3.3.1/../../../crt1.o(.text+0x18): In function
_start':
: undefined reference to main'
collect2: ld returned 1 exit status


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

* [Bug c/11810] gcc -pipe -ox.o -c x.c  writes erroneous x.o on compile error
  2003-08-05 18:21 [Bug c/11810] New: gcc -pipe -ox.o -c x.c writes erroneous x.o on compile error deweese at ict dot usc dot edu
@ 2003-08-05 18:27 ` pinskia at physics dot uc dot edu
  2003-08-05 18:28 ` [Bug debug/11810] " pinskia at physics dot uc dot edu
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 13+ messages in thread
From: pinskia at physics dot uc dot edu @ 2003-08-05 18:27 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11810


pinskia at physics dot uc dot edu changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |zap at cobra dot ru


------- Additional Comments From pinskia at physics dot uc dot edu  2003-08-05 18:27 -------
*** Bug 10369 has been marked as a duplicate of this bug. ***


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

* [Bug debug/11810] gcc -pipe -ox.o -c x.c  writes erroneous x.o on compile error
  2003-08-05 18:21 [Bug c/11810] New: gcc -pipe -ox.o -c x.c writes erroneous x.o on compile error deweese at ict dot usc dot edu
  2003-08-05 18:27 ` [Bug c/11810] " pinskia at physics dot uc dot edu
@ 2003-08-05 18:28 ` pinskia at physics dot uc dot edu
  2003-08-05 18:31 ` [Bug driver/11810] " pinskia at physics dot uc dot edu
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 13+ messages in thread
From: pinskia at physics dot uc dot edu @ 2003-08-05 18:28 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11810


pinskia at physics dot uc dot edu changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
          Component|c                           |debug
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2003-08-05 18:28:03
               date|                            |


------- Additional Comments From pinskia at physics dot uc dot edu  2003-08-05 18:28 -------
I can confirm this on the mainline (20030805).
>From bug 10369 which is a dup:
I've tracked the problem: it is in gcc.c when executing the 'W' spec, it calls 
add_temporary_file_name or such (don't remember the exact function name, don't have the 
sources handy). The name that is passed to the function includes the -o switch (e.g. 
add_temporary_file_name ("-ofile.o")) and on failure the driver tries to delete the file with this 
name, and naturally fails.


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

* [Bug driver/11810] gcc -pipe -ox.o -c x.c  writes erroneous x.o on compile error
  2003-08-05 18:21 [Bug c/11810] New: gcc -pipe -ox.o -c x.c writes erroneous x.o on compile error deweese at ict dot usc dot edu
  2003-08-05 18:27 ` [Bug c/11810] " pinskia at physics dot uc dot edu
  2003-08-05 18:28 ` [Bug debug/11810] " pinskia at physics dot uc dot edu
@ 2003-08-05 18:31 ` pinskia at physics dot uc dot edu
  2003-08-23  1:09 ` dhazeghi at yahoo dot com
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 13+ messages in thread
From: pinskia at physics dot uc dot edu @ 2003-08-05 18:31 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11810



------- Additional Comments From pinskia at physics dot uc dot edu  2003-08-05 18:31 -------
Some more information the driver removes -ofoo.o instead of foo.o.


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

* [Bug driver/11810] gcc -pipe -ox.o -c x.c  writes erroneous x.o on compile error
  2003-08-05 18:21 [Bug c/11810] New: gcc -pipe -ox.o -c x.c writes erroneous x.o on compile error deweese at ict dot usc dot edu
                   ` (2 preceding siblings ...)
  2003-08-05 18:31 ` [Bug driver/11810] " pinskia at physics dot uc dot edu
@ 2003-08-23  1:09 ` dhazeghi at yahoo dot com
  2003-12-16 19:49 ` geoffk at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 13+ messages in thread
From: dhazeghi at yahoo dot com @ 2003-08-23  1:09 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11810


dhazeghi at yahoo dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|3.4                         |---


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

* [Bug driver/11810] gcc -pipe -ox.o -c x.c  writes erroneous x.o on compile error
  2003-08-05 18:21 [Bug c/11810] New: gcc -pipe -ox.o -c x.c writes erroneous x.o on compile error deweese at ict dot usc dot edu
                   ` (3 preceding siblings ...)
  2003-08-23  1:09 ` dhazeghi at yahoo dot com
@ 2003-12-16 19:49 ` geoffk at gcc dot gnu dot org
  2003-12-16 19:50 ` geoffk at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 13+ messages in thread
From: geoffk at gcc dot gnu dot org @ 2003-12-16 19:49 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From geoffk at gcc dot gnu dot org  2003-12-16 19:42 -------
*** Bug 9470 has been marked as a duplicate of this bug. ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bkoz at redhat dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11810


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

* [Bug driver/11810] gcc -pipe -ox.o -c x.c  writes erroneous x.o on compile error
  2003-08-05 18:21 [Bug c/11810] New: gcc -pipe -ox.o -c x.c writes erroneous x.o on compile error deweese at ict dot usc dot edu
                   ` (4 preceding siblings ...)
  2003-12-16 19:49 ` geoffk at gcc dot gnu dot org
@ 2003-12-16 19:50 ` geoffk at gcc dot gnu dot org
  2003-12-16 19:51 ` geoffk at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 13+ messages in thread
From: geoffk at gcc dot gnu dot org @ 2003-12-16 19:50 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From geoffk at gcc dot gnu dot org  2003-12-16 19:47 -------
There are other problems with removing output files.  For instance:

$ echo 'error!' > x
$ gcc -x c x -S
x:1: error: parse error before '!' token
$ ls
x       x.s
$ rm x.s
$ gcc -x c x -save-temps -c
x:1: error: parse error before '!' token
$ ls
x       x.i     x.s


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11810


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

* [Bug driver/11810] gcc -pipe -ox.o -c x.c  writes erroneous x.o on compile error
  2003-08-05 18:21 [Bug c/11810] New: gcc -pipe -ox.o -c x.c writes erroneous x.o on compile error deweese at ict dot usc dot edu
                   ` (5 preceding siblings ...)
  2003-12-16 19:50 ` geoffk at gcc dot gnu dot org
@ 2003-12-16 19:51 ` geoffk at gcc dot gnu dot org
  2004-08-12 18:27 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 13+ messages in thread
From: geoffk at gcc dot gnu dot org @ 2003-12-16 19:51 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From geoffk at gcc dot gnu dot org  2003-12-16 19:47 -------
Similar problems also occur with PCH, see 9470.

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11810


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

* [Bug driver/11810] gcc -pipe -ox.o -c x.c  writes erroneous x.o on compile error
  2003-08-05 18:21 [Bug c/11810] New: gcc -pipe -ox.o -c x.c writes erroneous x.o on compile error deweese at ict dot usc dot edu
                   ` (6 preceding siblings ...)
  2003-12-16 19:51 ` geoffk at gcc dot gnu dot org
@ 2004-08-12 18:27 ` pinskia at gcc dot gnu dot org
  2005-08-07  5:13 ` pinskia at gcc dot gnu dot org
  2005-08-07  5:15 ` pinskia at gcc dot gnu dot org
  9 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-08-12 18:27 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-08-12 18:27 -------
http://gcc.gnu.org/ml/gcc-patches/2004-08/msg00784.html

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11810


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

* [Bug driver/11810] gcc -pipe -ox.o -c x.c  writes erroneous x.o on compile error
  2003-08-05 18:21 [Bug c/11810] New: gcc -pipe -ox.o -c x.c writes erroneous x.o on compile error deweese at ict dot usc dot edu
                   ` (7 preceding siblings ...)
  2004-08-12 18:27 ` pinskia at gcc dot gnu dot org
@ 2005-08-07  5:13 ` pinskia at gcc dot gnu dot org
  2005-08-07  5:15 ` pinskia at gcc dot gnu dot org
  9 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-08-07  5:13 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-08-07 05:13 -------
*** Bug 23269 has been marked as a duplicate of this bug. ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hg211 at ural2 dot hszk dot
                   |                            |bme dot hu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11810


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

* [Bug driver/11810] gcc -pipe -ox.o -c x.c  writes erroneous x.o on compile error
  2003-08-05 18:21 [Bug c/11810] New: gcc -pipe -ox.o -c x.c writes erroneous x.o on compile error deweese at ict dot usc dot edu
                   ` (8 preceding siblings ...)
  2005-08-07  5:13 ` pinskia at gcc dot gnu dot org
@ 2005-08-07  5:15 ` pinskia at gcc dot gnu dot org
  9 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-08-07  5:15 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-08-07 05:15 -------
Patch was reviewed here: <http://gcc.gnu.org/ml/gcc-patches/2005-07/msg01432.html>.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                URL|http://gcc.gnu.org/ml/gcc-  |
                   |patches/2004-               |
                   |08/msg00784.html            |
  GCC build triplet|i386-pc-linux-gnu           |
   GCC host triplet|i386-pc-linux-gnu           |
 GCC target triplet|i386-pc-linux-gnu           |
           Keywords|patch                       |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11810


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

* [Bug driver/11810] gcc -pipe -ox.o -c x.c  writes erroneous x.o on compile error
       [not found] <bug-11810-6671@http.gcc.gnu.org/bugzilla/>
  2009-11-04 15:47 ` nathan at gcc dot gnu dot org
@ 2010-05-22 17:57 ` jsm28 at gcc dot gnu dot org
  1 sibling, 0 replies; 13+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2010-05-22 17:57 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #12 from jsm28 at gcc dot gnu dot org  2010-05-22 17:57 -------
Fixed by the indicated commit.


-- 

jsm28 at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.5.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11810


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

* [Bug driver/11810] gcc -pipe -ox.o -c x.c  writes erroneous x.o on compile error
       [not found] <bug-11810-6671@http.gcc.gnu.org/bugzilla/>
@ 2009-11-04 15:47 ` nathan at gcc dot gnu dot org
  2010-05-22 17:57 ` jsm28 at gcc dot gnu dot org
  1 sibling, 0 replies; 13+ messages in thread
From: nathan at gcc dot gnu dot org @ 2009-11-04 15:47 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #11 from nathan at gcc dot gnu dot org  2009-11-04 15:47 -------
Subject: Bug 11810

Author: nathan
Date: Wed Nov  4 15:47:00 2009
New Revision: 153900

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=153900
Log:
        PR driver/11810
        * gcc.c (SWITCHES_NEED_SPACES): Define to "o".
        * config/alpha/osf.h (SWITCHES_NEED_SPACES): Remove here.
        * config/mips/iris.h (SWITCHES_NEED_SPACES): Remove here.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/alpha/osf.h
    trunk/gcc/config/mips/iris.h
    trunk/gcc/gcc.c


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11810


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

end of thread, other threads:[~2010-05-22 17:57 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-08-05 18:21 [Bug c/11810] New: gcc -pipe -ox.o -c x.c writes erroneous x.o on compile error deweese at ict dot usc dot edu
2003-08-05 18:27 ` [Bug c/11810] " pinskia at physics dot uc dot edu
2003-08-05 18:28 ` [Bug debug/11810] " pinskia at physics dot uc dot edu
2003-08-05 18:31 ` [Bug driver/11810] " pinskia at physics dot uc dot edu
2003-08-23  1:09 ` dhazeghi at yahoo dot com
2003-12-16 19:49 ` geoffk at gcc dot gnu dot org
2003-12-16 19:50 ` geoffk at gcc dot gnu dot org
2003-12-16 19:51 ` geoffk at gcc dot gnu dot org
2004-08-12 18:27 ` pinskia at gcc dot gnu dot org
2005-08-07  5:13 ` pinskia at gcc dot gnu dot org
2005-08-07  5:15 ` pinskia at gcc dot gnu dot org
     [not found] <bug-11810-6671@http.gcc.gnu.org/bugzilla/>
2009-11-04 15:47 ` nathan at gcc dot gnu dot org
2010-05-22 17:57 ` jsm28 at gcc dot gnu dot org

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