This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libstdc++/57350] std::align missing


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57350

--- Comment #6 from Vladimir Krivopalov <vladimir.krivopalov at gmail dot com> ---
(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!


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]