public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* optimization/4203: empty base class optimization zeroes first byte of other base class when using multiple inheritance
@ 2001-09-01 21:06 franzoy
  0 siblings, 0 replies; only message in thread
From: franzoy @ 2001-09-01 21:06 UTC (permalink / raw)
  To: gcc-gnats; +Cc: jfranzoy

>Number:         4203
>Category:       optimization
>Synopsis:       empty base class optimization zeroes first byte of other base class when using multiple inheritance
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          wrong-code
>Submitter-Id:   net
>Arrival-Date:   Sat Sep 01 21:06:02 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     franzoy@ciudad.com.ar
>Release:        gcc version 3.0
>Organization:
>Environment:
linux kerner 2.2.5.15 I586
>Description:
When using multiple inheritance and one base class have some
data member, the other is an empty class, the later inherits
from another empty class, none of the empty class has
neither declared nor defined constructors and the non empty
base class is enumerated first in the declaration of
superclasses, the non empty base class looses the first
byte of information.


--------------------------------------------------------
g++ -oa -v save-temps a.c
--------------------------------------------------------
Reading specs from /usr/local/gcc-3.0/lib/gcc-lib/i586-pc-linux-gnu/3.0/specs
Configured with: ../gcc-3.0/configure --prefix=/usr/local/gcc-3.0
Thread model: single
gcc version 3.0
 /usr/local/gcc-3.0/lib/gcc-lib/i586-pc-linux-gnu/3.0/cpp0 -lang-c++ -D__GNUG__=3 -D__GXX_DEPRECATED -D__EXCEPTIONS -D__GXX_ABI_VERSION=100 -v -D__GNUC__=3 -D__GNUC_MINOR__=0 -D__GNUC_PATCHLEVEL__=0 -D__ELF__ -Dunix -Dlinux -D__ELF__ -D__unix__ -D__linux__ -D__unix -D__linux -Asystem=posix -D__NO_INLINE__ -D__STDC_HOSTED__=1 -D_GNU_SOURCE -Acpu=i386 -Amachine=i386 -Di386 -D__i386 -D__i386__ -D__tune_i586__ -D__tune_pentium__ a.c a.ii
GNU CPP version 3.0 (cpplib) (i386 Linux/ELF)
ignoring nonexistent directory "/usr/local/gcc-3.0/i586-pc-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/gcc-3.0/include/g++-v3
 /usr/local/gcc-3.0/include/g++-v3/i586-pc-linux-gnu
 /usr/local/gcc-3.0/include/g++-v3/backward
 /usr/local/include
 /usr/local/gcc-3.0/lib/gcc-lib/i586-pc-linux-gnu/3.0/include
 /usr/include
End of search list.
 /usr/local/gcc-3.0/lib/gcc-lib/i586-pc-linux-gnu/3.0/cc1plus -fpreprocessed a.ii -quiet -dumpbase a.c -version -o a.s
GNU CPP version 3.0 (cpplib) (i386 Linux/ELF)
GNU C++ version 3.0 (i586-pc-linux-gnu)
	compiled by GNU C version 3.0.
 as --traditional-format -V -Qy -o a.o a.s
GNU assembler version 2.9.1 (i386-redhat-linux), using BFD version 2.9.1.0.23
 /usr/local/gcc-3.0/lib/gcc-lib/i586-pc-linux-gnu/3.0/collect2 -m elf_i386 -dynamic-linker /lib/ld-linux.so.2 -oa /usr/lib/crt1.o /usr/lib/crti.o /usr/local/gcc-3.0/lib/gcc-lib/i586-pc-linux-gnu/3.0/crtbegin.o -L/usr/local/gcc-3.0/lib/gcc-lib/i586-pc-linux-gnu/3.0 -L/usr/local/gcc-3.0/lib/gcc-lib/i586-pc-linux-gnu/3.0/../../.. a.o -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/local/gcc-3.0/lib/gcc-lib/i586-pc-linux-gnu/3.0/crtend.o /usr/lib/crtn.o

>How-To-Repeat:
# 1 "a.c"
# 1 "/usr/local/gcc-3.0/include/g++-v3/cassert" 1 3
# 31 "/usr/local/gcc-3.0/include/g++-v3/cassert" 3
# 1 "/usr/local/gcc-3.0/include/g++-v3/bits/std_cassert.h" 1 3
# 37 "/usr/local/gcc-3.0/include/g++-v3/bits/std_cassert.h" 3
# 1 "/usr/include/assert.h" 1 3
# 35 "/usr/include/assert.h" 3
# 1 "/usr/include/features.h" 1 3
# 249 "/usr/include/features.h" 3
# 1 "/usr/include/sys/cdefs.h" 1 3
# 250 "/usr/include/features.h" 2 3
# 277 "/usr/include/features.h" 3
# 1 "/usr/include/gnu/stubs.h" 1 3
# 278 "/usr/include/features.h" 2 3
# 36 "/usr/include/assert.h" 2 3
# 58 "/usr/include/assert.h" 3
extern "C" {


extern void __assert_fail (__const char *__assertion, __const char *__file, unsigned int __line, __const char *__function)



     __attribute__ ((__noreturn__));


extern void __assert_perror_fail (int __errnum, __const char *__file, unsigned int __line, __const char *__function)



     __attribute__ ((__noreturn__));

}
# 38 "/usr/local/gcc-3.0/include/g++-v3/bits/std_cassert.h" 2 3
# 32 "/usr/local/gcc-3.0/include/g++-v3/cassert" 2 3
# 2 "a.c" 2

class EmptyBase0 {};
class EmptyBase1 : public EmptyBase0 {};

class Base1
{
public:
        unsigned int t_;
        Base1(unsigned int t) : t_(t) {}
};

class PEPE : public Base1, public EmptyBase1
{
public:
        PEPE(unsigned int t) : Base1(t), EmptyBase1(EmptyBase1()) {}
};

int main()
{
        PEPE pepe(0xff);
        ((void) ((pepe.t_ == 255) ? 0 : (__assert_fail ("pepe.t_ == 255", "a.c", 22, ((__const char *) 0)), 0)));
}
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


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

only message in thread, other threads:[~2001-09-01 21:06 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-09-01 21:06 optimization/4203: empty base class optimization zeroes first byte of other base class when using multiple inheritance franzoy

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