[llvm-bugs] [Bug 25814] New: Segfault with variadic templates, lambdas and std::forward (after gcc ABI change)

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Dec 12 07:25:26 PST 2015


https://llvm.org/bugs/show_bug.cgi?id=25814

            Bug ID: 25814
           Summary: Segfault with variadic templates, lambdas and
                    std::forward (after gcc ABI change)
           Product: clang
           Version: 3.7
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++14
          Assignee: unassignedclangbugs at nondot.org
          Reporter: vittorio.romeo at outlook.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

Created attachment 15434
  --> https://llvm.org/bugs/attachment.cgi?id=15434&action=edit
Preprocessed files and associated run scripts

After the "Arch Linux ABI update", clang++ segfaults while trying to compile
the following C++14 code snippet.

(Note that the segfault didn't happen before the ABI update, and that it
doesn't happen on gcc.godbolt.org: https://goo.gl/WrdeqF)

I've reported the bug on Arch's tracker as well.



#include <utility>

template <typename... Ts>
constexpr decltype(auto) outer_wrapper(Ts&&...)
{
return int{};
}

struct static_for_result
{
template <typename T>
constexpr decltype(auto) get_fn_wrapper(T) noexcept
{
return [this](auto&&...)
{
};
}

template <typename T, typename... Ts>
constexpr decltype(auto) inner_wrapper(T, Ts&&...)
{
return outer_wrapper(get_fn_wrapper(T{}));
}

template <typename... Ts>
constexpr decltype(auto) operator()(Ts&&... xs)
{
auto fn_call = [this, &xs...]()
{
return inner_wrapper(int{});
};

return int{};
}
};

template <typename TF>
constexpr decltype(auto) static_for(TF&&)
{
return static_for_result{};
}

int main()
{
return static_for([](auto, auto)
{
})(0);
}




clang++ output:

clang version 3.7.0 (tags/RELEASE_370/final)
Target: x86_64-unknown-linux-gnu
Thread model: posix
Found candidate GCC installation:
/usr/bin/../lib/gcc/x86_64-unknown-linux-gnu/5.2.0
Found candidate GCC installation:
/usr/bin/../lib/gcc/x86_64-unknown-linux-gnu/5.3.0
Found candidate GCC installation:
/usr/bin/../lib64/gcc/x86_64-unknown-linux-gnu/5.2.0
Found candidate GCC installation:
/usr/bin/../lib64/gcc/x86_64-unknown-linux-gnu/5.3.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-unknown-linux-gnu/5.2.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0
Found candidate GCC installation: /usr/lib64/gcc/x86_64-unknown-linux-gnu/5.2.0
Found candidate GCC installation: /usr/lib64/gcc/x86_64-unknown-linux-gnu/5.3.0
Selected GCC installation: /usr/bin/../lib64/gcc/x86_64-unknown-linux-gnu/5.3.0
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Selected multilib: .;@m64
"/usr/bin/clang-3.7" -cc1 -triple x86_64-unknown-linux-gnu -emit-obj
-mrelax-all -disable-free -disable-llvm-verifier -main-file-name rip_abi.cpp
-mrelocation-model static -mthread-model posix -mdisable-fp-elim -fmath-errno
-masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array
-target-cpu x86-64 -v -g -dwarf-column-info -resource-dir
/usr/bin/../lib/clang/3.7.0 -internal-isystem
/usr/bin/../lib64/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../include/c++/5.3.0
-internal-isystem
/usr/bin/../lib64/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../include/c++/5.3.0/x86_64-unknown-linux-gnu
-internal-isystem
/usr/bin/../lib64/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../include/c++/5.3.0/backward
-internal-isystem /usr/local/include -internal-isystem
/usr/bin/../lib/clang/3.7.0/include -internal-externc-isystem /include
-internal-externc-isystem /usr/include -Wall -Wextra -Wpedantic -std=c++14
-fdeprecated-macro -fdebug-compilation-dir /media/veeData/Temp -ferror-limit 19
-fmessage-length 100
-fsanitize=alignment,array-bounds,bool,enum,float-cast-overflow,float-divide-by-zero,function,integer-divide-by-zero,nonnull-attribute,null,object-size,return,returns-nonnull-attribute,shift-base,shift-exponent,signed-integer-overflow,unreachable,vla-bound,vptr
-fsanitize-recover=alignment,array-bounds,bool,enum,float-cast-overflow,float-divide-by-zero,function,integer-divide-by-zero,nonnull-attribute,null,object-size,returns-nonnull-attribute,shift-base,shift-exponent,signed-integer-overflow,vla-bound,vptr
-mstackrealign -fobjc-runtime=gcc -fcxx-exceptions -fexceptions
-fdiagnostics-show-option -fcolor-diagnostics -o /tmp/rip_abi-281042.o -x c++
./rip_abi.cpp
clang -cc1 version 3.7.0 based upon LLVM 3.7.0 default target
x86_64-unknown-linux-gnu
ignoring nonexistent directory "/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/bin/../lib64/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../include/c++/5.3.0
/usr/bin/../lib64/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../include/c++/5.3.0/x86_64-unknown-linux-gnu
/usr/bin/../lib64/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../include/c++/5.3.0/backward
/usr/local/include
/usr/bin/../lib/clang/3.7.0/include
/usr/include
End of search list.
clang-3.7: error: unable to execute command: Segmentation fault (core dumped)
clang-3.7: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 3.7.0 (tags/RELEASE_370/final)
Target: x86_64-unknown-linux-gnu
Thread model: posix
clang-3.7: note: diagnostic msg: PLEASE submit a bug report to
http://llvm.org/bugs/ and include the crash backtrace, preprocessed source, and
associated run script.
clang-3.7: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-3.7: note: diagnostic msg: /tmp/rip_abi-f501e4.cpp
clang-3.7: note: diagnostic msg: /tmp/rip_abi-f501e4.sh
clang-3.7: note: diagnostic msg:

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20151212/bc32516e/attachment.html>


More information about the llvm-bugs mailing list