[llvm-dev] recent changes to unique_function break unit tests with "older" compilers

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[llvm-dev] recent changes to unique_function break unit tests with "older" compilers

Robin Eklind via llvm-dev
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:
.align 2
.type main::{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.

_______________________________________________
LLVM Developers mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev