From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9344 invoked by alias); 2 Feb 2014 04:14:30 -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 9316 invoked by uid 48); 2 Feb 2014 04:14:24 -0000 From: "vladimir.krivopalov at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/57350] std::align missing Date: Sun, 02 Feb 2014 04:14:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libstdc++ X-Bugzilla-Version: 4.8.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: vladimir.krivopalov at gmail dot com 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: 2014-02/txt/msg00060.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57350 --- Comment #6 from Vladimir Krivopalov --- (In reply to David Krauss from comment #5) > Just re-reading now, std::size_t should be std::uintptr_t, but I don't see > anything else that could cause UB. The bitwise "negative" arithmetic should > be OK because it's all on unsigned values. > > And if GNU style doesn't allow auto, those should just be uintptr_t or > size_t as appropriate. This code looks fine to me at my best knowledge of expected std::align() behaviour. I also tried it against the artificial test case described at https://stackoverflow.com/questions/16305311/usage-issue-of-stdalign and it doesn't re-align the already aligned pointer. Not sure if auto keyword is prohibited by GCC internal code style, perhaps someone from GCC devs could help on that. Thank you for preparing the fix, David!