This is the mail archive of the 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]

[Bug c++/11091] New: Wrong code in variable initialization


           Summary: Wrong code in variable initialization
           Product: gcc
           Version: 3.2.2
            Status: UNCONFIRMED
          Severity: major
          Priority: P2
         Component: c++
 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;  
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  
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 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__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:  
End of search list.  
 /usr/local/gcc322/lib/gcc-lib/i386-unknown-freebsd4.6/3.2.2/cc1plus -fpreprocessed 
-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.

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