This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/11091] New: Wrong code in variable initialization
- From: "dej at inode dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 4 Jun 2003 19:43:21 -0000
- Subject: [Bug c++/11091] New: Wrong code in variable initialization
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11091
Summary: Wrong code in variable initialization
Product: gcc
Version: 3.2.2
Status: UNCONFIRMED
Severity: major
Priority: P2
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: dej@inode.org
CC: gcc-bugs@gcc.gnu.org
GCC build triplet: i386-unknown-freebsd4.6
GCC host triplet: i386-unknown-freebsd4.6
GCC target triplet: i386-unknown-freebsd4.6
GCC generates incorrect code for a variable default constructor initialization:
DBObjectRef DBInstantiator::findChild(DBNameRef name, DBObjType type) const
{
DBObjectRef obj;
return obj;
}
Disassembly:
00000000 <_ZNK14DBInstantiator9findChildE5GCPtrI6DBNameE9DBObjType>:
0: 55 push %ebp
1: 89 e5 mov %esp,%ebp
3: 53 push %ebx
4: 83 ec 04 sub $0x4,%esp
7: 8b 5d 08 mov 0x8(%ebp),%ebx
a: 83 ec 0c sub $0xc,%esp
d: 53 push %ebx
e: e8 fc ff ff ff call f <_ZNK14DBInstantiator9findChildE5GCPtrI
6DBNameE9DBObjType+0xf>
The address of the variable is 0x8(%ebp), but it is the CONTENTS there that seem to be
passed to the constructor call.
Output from -save-temps follows. The *.ii file can be found at
http://www.inode.org/bug.ii since it is not clear how to upload the file to BugZilla.
> /usr/local/gcc322/bin/gcc -c -v -save-temps bug.cpp
Reading specs from /usr/local/gcc322/lib/gcc-lib/i386-unknown-freebsd4.6/3.2.2/specs
Configured with: ../configure --prefix=/usr/local/gcc322
Thread model: posix
gcc version 3.2.2
/usr/local/gcc322/lib/gcc-lib/i386-unknown-freebsd4.6/3.2.2/cpp0 -lang-c++ -D__GNUG__=3
-D__DEPRECATED -D__EXCEPTIONS -v -D__GNUC__=3 -D__GNUC_MINOR__=2 -D__GNUC_PATCHLEVEL__=2
-D__GXX_ABI_VERSION=102 -D__FreeBSD__=4 -Dunix -D__ELF__ -D__KPRINTF_ATTRIBUTE__
-D__FreeBSD__=4 -D__unix__ -D__ELF__ -D__KPRINTF_ATTRIBUTE__ -D__unix -Asystem=unix
-Asystem=bsd -Asystem=FreeBSD -D__NO_INLINE__ -D__STDC_HOSTED__=1 -Acpu=i386
-Amachine=i386 -Di386 -D__i386 -D__i386__ -D__tune_i386__ bug.cpp bug.ii
GNU CPP version 3.2.2 (cpplib) (i386 FreeBSD/ELF)
ignoring nonexistent directory "/usr/local/gcc322/i386-unknown-freebsd4.6/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/local/gcc322/include/c++/3.2.2
/usr/local/gcc322/include/c++/3.2.2/i386-unknown-freebsd4.6
/usr/local/gcc322/include/c++/3.2.2/backward
/usr/local/include
/usr/local/gcc322/include
/usr/local/gcc322/lib/gcc-lib/i386-unknown-freebsd4.6/3.2.2/include
/usr/include
End of search list.
/usr/local/gcc322/lib/gcc-lib/i386-unknown-freebsd4.6/3.2.2/cc1plus -fpreprocessed
bug.ii
-quiet -dumpbase bug.cpp -version -o bug.s
GNU CPP version 3.2.2 (cpplib) (i386 FreeBSD/ELF)
GNU C++ version 3.2.2 (i386-unknown-freebsd4.6)
compiled by GNU C version 3.2.2.
as -o bug.o bug.s
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.