This is the mail archive of the gcc-prs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

other/5620: [3.1] GCC -save-temps foo.c fails to build foo.o



>Number:         5620
>Category:       other
>Synopsis:       [3.1] GCC -save-temps foo.c fails to build foo.o
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Feb 06 18:06:00 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     Danny Smith
>Release:        GCC version, gcc version 3.1 20020202 (experimental)
>Organization:
>Environment:
NT4sp6, i386-pc-mingw32
>Description:
Compile foo.c (below) with "gcc -o foo -save-temps foo.c"  GCC builds foo.i and foo.s but not  object file foo.o. Hence, the exe fails to build.
Here is the verbose output.  Note that although gcc outputs foo.s it sends the tempname  "D:\TEMP/ccSaaaaa.s" to as.exe:

Reading specs from D:/MINGW/BIN/../lib/gcc-lib/mingw32/3.1/specs
Configured with: ../gcc/configure --with-gcc-version-trigger=/develop/gcc/gcc/gcc/version.c --with-gcc --with-gnu-ld --with-gnu-as --host=mingw32 --target=mingw32 --prefix=/mingw --enable-sjlj-exceptions --enable-threads --disable-nls --enable-languages=f77,c++,objc,ada --disable-win32-registry --enable-shared --enable-objc-gc : (reconfigured) ../gcc/configure --with-gcc-version-trigger=/develop/gcc/gcc/gcc/version.c --with-gcc --with-gnu-ld --with-gnu-as --host=mingw32 --target=mingw32 --prefix=/mingw --enable-sjlj-exceptions --enable-threads --disable-nls --enable-languages=f77,c++,objc,ada --disable-win32-registry --enable-shared --enable-objc-gc
Thread model: win32
gcc version 3.1 20020202 (experimental)
 D:/MINGW/BIN/../lib/gcc-lib/mingw32/3.1/cpp0.exe -lang-c -v -iprefix D:\MINGW\BIN/../lib/gcc-lib/mingw32/3.1/ -D__GNUC__=3 -D__GNUC_MINOR__=1 -D__GNUC_PATCHLEVEL__=0 -D_WIN32 -D__WIN32 -D__WIN32__ -DWINNT -DWIN32 -D__MINGW32__ -D__MSVCRT__ -D_X86_=1 -D_WIN32 -D__WIN32 -D__WIN32__ -D__WINNT__ -D__WIN32__ -D__MINGW32__ -D__MSVCRT__ -D_X86_=1 -D__WINNT -D__WIN32 -Asystem=winnt -D__NO_INLINE__ -D__STDC_HOSTED__=1 -remap -Acpu=i386 -Amachine=i386 -Di386 -D__i386 -D__i386__ -D__tune_i586__ -D__tune_pentium__ -D__stdcall=__attribute__((__stdcall__)) -D__cdecl=__attribute__((__cdecl__)) -D__fastcall=__attribute__((__fastcall__)) -D_stdcall=__attribute__((__stdcall__)) -D_cdecl=__attribute__((__cdecl__)) -D_fastcall=__attribute__((__fastcall__)) -D__declspec(x)=__attribute__((x)) foo.c foo.i
GNU CPP version 3.1 20020202 (experimental) (cpplib) (80386, BSD syntax)
ignoring nonexistent directory "/usr/local/mingw32/include"
#include "..." search starts here:
#include <...> search starts here:
 D:/MINGW/include
 D:/MINGW/lib/gcc-lib/mingw32/3.1/include
 D:/MINGW/mingw32/include
 /mingw/include
 /mingw/include
 /mingw/lib/gcc-lib/mingw32/3.1/include
 /mingw/mingw32/include
End of search list.
 D:/MINGW/BIN/../lib/gcc-lib/mingw32/3.1/cc1.exe -fpreprocessed foo.i -quiet -dumpbase foo.c -version -o foo.s
GNU CPP version 3.1 20020202 (experimental) (cpplib) (80386, BSD syntax)
GNU C version 3.1 20020202 (experimental) (mingw32)
	compiled by GNU C version 3.1 20020117 (experimental).
 D:/MINGW/BIN/../lib/gcc-lib/mingw32/3.1/../../../../mingw32/bin/as.exe -o foo.o D:\TEMP/ccSaaaaa.s
 D:/MINGW/BIN/../lib/gcc-lib/mingw32/3.1/../../../../mingw32/bin/ld.exe -Bdynamic -o foo.exe D:/MINGW/BIN/../lib/gcc-lib/mingw32/3.1/../../../../mingw32/lib/crt2.o -LD:/MINGW/BIN/../lib/gcc-lib/mingw32/3.1 -LD:/MINGW/BIN/../lib/gcc-lib -L/mingw/lib/gcc-lib/mingw32/3.1 -LD:/MINGW/BIN/../lib/gcc-lib/mingw32/3.1/../../../../mingw32/lib -L/mingw/lib/gcc-lib/mingw32/3.1/../../../../mingw32/lib -LD:/MINGW/BIN/../lib/gcc-lib/mingw32/3.1/../../.. -L/mingw/lib/gcc-lib/mingw32/3.1/../../.. foo.o -lmingw32 -lgcc -lmoldname -lisocext -lmsvcrt -luser32 -lkernel32 -ladvapi32 -lshell32 -lmingw32 -lgcc -lmoldname -lisocext -lmsvcrt
D:/MINGW/BIN/../lib/gcc-lib/mingw32/3.1/../../../../mingw32/lib/libmingw32.a(main.o)(.text+0x96):main.c: undefined reference to `WinMain@16'


If I repeat the same command (after foo.i and foo.s are built), it outputs a temp .s file and sends it to as.exe to make foo.o and all is fine,
<snip>
 D:/MINGW/BIN/../lib/gcc-lib/mingw32/3.1/cc1.exe -fpreprocessed foo.i -quiet -dumpbase foo.c -version -o D:\TEMP/cckdaaaa.s
GNU CPP version 3.1 20020202 (experimental) (cpplib) (80386, BSD syntax)
GNU C version 3.1 20020202 (experimental) (mingw32)
	compiled by GNU C version 3.1 20020117 (experimental).
 D:/MINGW/BIN/../lib/gcc-lib/mingw32/3.1/../../../../mingw32/bin/as.exe -o foo.o D:\TEMP/cckdaaaa.s
 D:/MINGW/BIN/../lib/gcc-lib/mingw32/3.1/../../../../mingw32/bin/ld.exe -Bdynamic -o foo.exe D:/MINGW/BIN/../lib/gcc-lib/mingw32/3.1/../../../../mingw32/lib/crt2.o -LD:/MINGW/BIN/../lib/gcc-lib/mingw32/3.1 -LD:/MINGW/BIN/../lib/gcc-lib -L/mingw/lib/gcc-lib/mingw32/3.1 -LD:/MINGW/BIN/../lib/gcc-lib/mingw32/3.1/../../../../mingw32/lib -L/mingw/lib/gcc-lib/mingw32/3.1/../../../../mingw32/lib -LD:/MINGW/BIN/../lib/gcc-lib/mingw32/3.1/../../.. -L/mingw/lib/gcc-lib/mingw32/3.1/../../.. foo.o -lmingw32 -lgcc -lmoldname -lisocext -lmsvcrt -luser32 -lkernel32 -ladvapi32 -lshell32 -lmingw32 -lgcc -lmoldname -lisocext -lmsvcrt

>How-To-Repeat:
Compile the following with "gcc -o foo -save-temps foo.c

/* foo.c * / 
int main()(return 0;}
>Fix:
revert this change:
2001-12-14  Ira Ruben	<ira@apple.com>

	Fix to no allow -save-temps to clobber user's source file.
	* gcc.c: Add static globals input_stat and input_stat_set.
	(do_spec_1): For 'g', 'u', 'U' case with save_temps_flag
	set, check that user's input file is not overwritten.
	(set_input): Reset input_stat_set for each new file.
>Release-Note:
>Audit-Trail:
>Unformatted:


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]