public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/31468]  New: Calling gcc with empty output filename can remove crt0.o (crt1.o on linux)
@ 2007-04-04 14:41 michael dot haubenwallner at salomon dot at
  0 siblings, 0 replies; only message in thread
From: michael dot haubenwallner at salomon dot at @ 2007-04-04 14:41 UTC (permalink / raw)
  To: gcc-bugs

Try these commands:
$ echo 'int main(void) { return 0;}' > xx.c
$ gcc -o '' xx.c

And if you have permission to remove /path/to/crtX.o, it will be removed,
because gcc uses that as the output file.

Although it is illegal to call gcc with an empty output filename,
it really should not break any further link step by removing that crtX.o.

Have seen this on linux, aix, solaris, and hpux.

The best informational error message is from hpux:
$ gcc -o '' xx.c                                                                
/usr/ccs/bin/ld: Can't create /usr/ccs/lib/crt0.o
/usr/ccs/bin/ld: Permission denied
collect2: ld returned 1 exit status

Same is true for 'g++', have not tried others.


-- 
           Summary: Calling gcc with empty output filename can remove crt0.o
                    (crt1.o on linux)
           Product: gcc
           Version: 4.1.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: michael dot haubenwallner at salomon dot at


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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2007-04-04 14:41 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-04-04 14:41 [Bug c/31468] New: Calling gcc with empty output filename can remove crt0.o (crt1.o on linux) michael dot haubenwallner at salomon dot at

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