From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23406 invoked by alias); 27 Oct 2014 03:48:02 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 23316 invoked by uid 48); 27 Oct 2014 03:47:56 -0000 From: "trippels at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/63645] Incorrect code generation Date: Mon, 27 Oct 2014 07:52:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Version: 4.8.2 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: trippels at gcc dot gnu.org X-Bugzilla-Status: RESOLVED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-10/txt/msg02044.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63645 --- Comment #12 from Markus Trippelsdorf --- 1) Your malloc is too small. It has to be sizeof (biggest member). So you're invoking undefined behavior. 2) In the if statement, where you probe the different members, you also invoke undefined behavior. So two bugs in one testcase.