Fedor Sergeev via llvm-dev
2018-Jul-04 10:27 UTC
[llvm-dev] recent changes to unique_function break unit tests with "older" compilers
Chandler, your recent changes for: [ADT] Add llvm::unique_function which is like std::function but supporting move-only closures. (https://reviews.llvm.org/rL336156) lead to FunctionExtrasTest unit test failing with asserts about function-pointer alignment when compiled with gcc4.9.2 on a variety of x86-Linuxes. It appears that gcc4.9.2 generates function pointers to lambdas aligned by 2, not by 4. Simple checker testcase: https://godbolt.org/g/9sKLQx ] gcc --version gcc (GCC) 4.9.2 Copyright (C) 2014 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ] gcc check_lambda_align.cc -std=c++11 ] ./a.out Alignment NOT satisfied for an actual function pointer to lambda! 0x400536 Alignment OK for lambda pointer! 0x400580 Alignment NOT satisfied for an actual function pointer to lambda! 0x4005ca Alignment OK for lambda pointer! 0x400614 Alignment NOT satisfied for an actual function pointer to lambda! 0x40065e ] gcc5.4 appears to do the same. clang is fine (aligns by 8). (you can check assembler generated by gcc at that godbolt.org link above: .align2 .typemain::{lambda(int, int)#1}::_FUN(int, int), @function main::{lambda(int, int)#1}::_FUN(int, int): ) Can we, please, do something about it? :) regards, Fedor. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180704/df52e64a/attachment.html>