From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22060 invoked by alias); 10 Jul 2013 11:20:47 -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 21999 invoked by uid 48); 10 Jul 2013 11:20:39 -0000 From: "mikpe at it dot uu.se" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/57862] invalid read struct uint32_t member (ARMV5) Date: Wed, 10 Jul 2013 11:20: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.7.2 X-Bugzilla-Keywords: X-Bugzilla-Severity: critical X-Bugzilla-Who: mikpe at it dot uu.se X-Bugzilla-Status: UNCONFIRMED 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: 2013-07/txt/msg00592.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57862 --- Comment #7 from Mikael Pettersson --- (In reply to Gaetano Mendola from comment #6) > struct in_addr myInAddr; > myInAddr.s_addr = theIpHeader->daddr; > > as not portable, where myInAddr.s_addr and theIpHeader->daddr are of the > same type. I'm not a c-standard lawyer but I'm hard believing that in the > standard > that assignment is marked as: "undefined behaviour" unless you use memcpy. The assignment is immaterial, it's the load (theIpHeader->daddr) that's problematic because the base pointer (theIpHeader) is not correctly aligned for its declared type (struct iphdr).