public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: Andreas Oberritter <obi@saftware.de>
To: gcc-gnats@gcc.gnu.org
Cc: debian-gcc@lists.debian.org
Subject: c++/10515: g++ 3.3 mixes up types when an initialized field in a union is not the first one
Date: Sun, 27 Apr 2003 17:36:00 -0000	[thread overview]
Message-ID: <1051464625.1871.5.camel@localhost> (raw)


>Number:         10515
>Category:       c++
>Synopsis:       g++ 3.3 mixes up types when an initialized field in a union
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          rejects-legal
>Submitter-Id:   net
>Arrival-Date:   Sun Apr 27 17:36:01 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Andreas Oberritter
>Release:        3.3 20030415 (Debian prerelease) (Debian testing/unstable)
>Organization:
>Environment:
System: Linux shiva 2.4.20-ac2 #1 Sun Jan 5 10:47:07 CET 2003 i686
unknown unknown GNU/Linux
Architecture: i686

	
host: i386-pc-linux-gnu
build: i386-pc-linux-gnu
target: i386-pc-linux-gnu
configured with: ../src/configure -v
--enable-languages=c,c++,java,f77,pascal,objc,ada,treelang --prefix=/usr
--mandir=/usr/share/man --infodir=/usr/share/info
--with-gxx-include-dir=/usr/include/c++/3.3 --enable-shared
--with-system-zlib --enable-nls --without-included-gettext
--enable-__cxa_atexit --enable-clocale=gnu --enable-debug
--enable-java-gc=boehm --enable-java-awt=xlib --enable-objc-gc
i386-linux
>Description:
g++ 3.3 treats members of a union as if they were of the
first member's type. g++ 3.2 and gcc 3.3 can compile it.
>How-To-Repeat:
struct a {
        int x;
};

struct b {
	int x;
        int y;
};

struct foo {
        union {
		struct a a;
		struct b b;
	} u;
};

int main(void)
{
	struct foo bar = { u: { b: { x: 0, y: 0, }}};
	(void)bar;
	return 0;
}

$ CXXFLAGS="" CPPFLAGS="" g++-3.3 union_bug.cpp -o union_bug
union_bug.cpp: In function `int main()':
union_bug.cpp:20: error: too many initializers for `a'

>Fix:
	




>Release-Note:
>Audit-Trail:
>Unformatted:
 is not the first one


                 reply	other threads:[~2003-04-27 17:36 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1051464625.1871.5.camel@localhost \
    --to=obi@saftware.de \
    --cc=debian-gcc@lists.debian.org \
    --cc=gcc-gnats@gcc.gnu.org \
    /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).