[llvm-bugs] [Bug 47979] New: __builtin_astype doesn't work with template parameters

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Oct 26 09:44:32 PDT 2020


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

            Bug ID: 47979
           Summary: __builtin_astype doesn't work with template parameters
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: OpenCL
          Assignee: unassignedclangbugs at nondot.org
          Reporter: marco.antognini at arm.com
                CC: anastasia.stulova at arm.com, llvm-bugs at lists.llvm.org

In C++ for OpenCL, when using as_typen (e.g. as_int2) or __builtin_astype with
a template parameter, Clang crashes.

int2 foo(long x) { return as_int2(x); }

template <typename T>
auto bar(T x) {
    return as_int2(x); // CRASH
    return __builtin_astype(x, int2); // CRASH
    return foo(x); // works
}

auto foobar(long x) { return bar(x); }

https://godbolt.org/z/W6cfEK

The crash seems to happen in:

 #5 0x0000556683bca77c clang::ASTContext::getTypeInfoImpl(clang::Type const*)
const (/opt/compiler-explorer/clang-trunk/bin/clang+++0x543d77c)

Note: as_typen is implemented in terms of __builtin_astype.

-- 
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/20201026/d95b64a3/attachment.html>


More information about the llvm-bugs mailing list