From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id D6B0C384B0E0; Wed, 7 Sep 2022 16:45:01 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D6B0C384B0E0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1662569101; bh=FEHSvoUuD23tw1VwuUARKq4tNxV0vqNHVM/wOdgpja8=; h=From:To:Subject:Date:In-Reply-To:References:From; b=HIr0GrNy51laGqIi6LkrOVdSHIL7Z5PgMrrWZvKYxMiH6j00jreUMC0pydNp4kmQY 0BsfG0N1m8v2piq7XQlaGX0tMDTX9hszJ6QVHSwxDKlCppRapIAwm+65uDNMUQMZVe yQvrll+LrDrhU1uZ+qM6hBgfUn9PqaiZVlQzREnQ= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/106873] unsigned short skips byte when used for memory mapping depending on position in structure Date: Wed, 07 Sep 2022 16:45:01 +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: 12.1.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: pinskia at gcc dot gnu.org X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: INVALID 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: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D106873 --- Comment #4 from Andrew Pinski --- (In reply to Kemal Akcam from comment #3) > I did not report as if unsigned short was different than 2 bytes. >=20 > Please check the output and explain=20 > 1. why output values changes? > 2. why it reads/advances 10 bytes instead of 8 bytes? Again you misunderstand everything. The ABI has a requirement for alignment= of some fields and that is what is called padding. This is why I said you get a warning with -Wpadding . If you want to remove this padding, you either use a bitfield or you use the attribute packed.=