From: Gordon Hogenson <ghogenso@u.washington.edu>
To: Ian Lance Taylor <ian@cygnus.com>
Cc: bug-g++@prep.ai.mit.edu, dj@stealth.ctron.com, gas2@cygnus.com
Subject: Re: [ghogenso@u.washington.edu: Problems with .cpp extension]
Date: Wed, 28 Sep 1994 19:07:00 -0000 [thread overview]
Message-ID: <Pine.3.89.9409281940.A8080-0100000@stein1.u.washington.edu> (raw)
In-Reply-To: <199409281533.LAA19725@sanguine.cygnus.com>
Under DJGPP 1.12 with G++ 2.6.0, I experience the following problem
when using filename extension .cpp instead of .cc. The assembler
output contains the incorrect ".file" heading. Included here is an
intentional link-time error to illustrate that ld then
reports the wrong filename.
--------------------- main.cpp ------------------------------
int main()
{
int i;
for (i = 0; i < 55; i++)
my_function(i);
}
------------------- output of 'gcc main.cpp -o main -g -v' --------
Reading specs from d:/gcc/lib/specs
gcc version 2.6.0
d:/gcc/bin/cpp.exe -lang-c++ -v -undef -D__GNUC__=2 -D__GNUG__=2
-D__cplusplus -D__GNUC_MINOR__=6 -Dunix -Di386 -DGO32 -DMSDOS -D__unix__
-D__i386__ -D__GO32__ -D__MSDOS__ -D__unix -D__i386 -D__GO32 -D__MSDOS -g
main.cpp f:/cc000073
GNU CPP version 2.6.0 (80386, BSD syntax)
#include "..." search starts here:
#include <...> search starts here:
d:/gcc/cplusinc
d:/gcc/include
/usr/local/lib/g++-include
/usr/local/include
/usr/local/go32/include
/usr/local/lib/gcc-lib/go32/2.6.0/include
/usr/include
End of search list.
d:/gcc/bin/cc1plus.exe f:/cc000073 -quiet -dumpbase main.cc -g -version
-o f:/cca00073
GNU C++ version 2.6.0 (80386, BSD syntax) compiled by GNU C version 2.6.0.
main.cpp: In function `int main()':
main.cpp:7: warning: implicit declaration of function `int my_function(...)'
d:/gcc/bin/as.exe -o f:/ccb00073 f:/cca00073
d:/gcc/bin/ld.exe -o main d:/gcc/lib/crt0.o -Ld:/gcc/lib f:/ccb00073
-lgcc -lg -lc -lgcc
main.cc:7: main: undefined reference to `my_function'
^^^^^
This is incorrect!
--------------------------------------------------------------------------
Running 'gcc main.cpp -g -v -S -o main.s', we get the file main.s:
-------------------------------------------------------------------------
.file "main.cc"
gcc2_compiled.:
___gnu_compiled_cplusplus:
.text
.align 2
.def _main; .val _main; .scl 2; .type 044; .endef
.globl _main
_main:
pushl %ebp
movl %esp,%ebp
subl $4,%esp
.def .bf; .val .; .scl 101; .line 3; .endef
call ___main
.def _i; .val -4; .scl 1; .type 04; .endef
.ln 4
movl $0,-4(%ebp)
L2:
.def .bb; .val .; .scl 100; .line 4; .endef
cmpl $54,-4(%ebp)
jle L5
jmp L3
.align 2,0x90
L5:
.ln 5
pushl -4(%ebp)
call _my_function
addl $4,%esp
.def .eb; .val .; .scl 100; .line 5; .endef
L4:
incl -4(%ebp)
jmp L2
.align 2,0x90
L3:
xorl %eax,%eax
jmp L1
.align 2,0x90
jmp L1
.align 2,0x90
.ln 7
L1:
.def .ef; .val .; .scl 101; .line 7; .endef
leave
ret
.def _main; .val .; .scl -1; .endef
----------------------------------------------------------------------------
Thus the '.file' is incorrect in the assembler output.
----------------------------------------------------------------------------
Thanks,
Gordon Hogenson
prev parent reply other threads:[~1994-09-28 19:07 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
1994-09-28 4:39 [ghogenso@u.washington.edu: Problems with .cpp extension: minor annoyances] DJ Delorie
1994-09-28 8:33 ` Ian Lance Taylor
1994-09-28 19:07 ` Gordon Hogenson [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.3.89.9409281940.A8080-0100000@stein1.u.washington.edu \
--to=ghogenso@u.washington.edu \
--cc=bug-g++@prep.ai.mit.edu \
--cc=dj@stealth.ctron.com \
--cc=gas2@cygnus.com \
--cc=ian@cygnus.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).