[LLVMbugs] [Bug 13543] New: UNREACHABLE in method HasSideEffects

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Aug 7 01:12:00 PDT 2012


http://llvm.org/bugs/show_bug.cgi?id=13543

             Bug #: 13543
           Summary: UNREACHABLE in method HasSideEffects
           Product: clang
           Version: trunk
          Platform: Macintosh
        OS/Version: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: jonathan.sauer at gmx.de
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu,
                    richard-llvm at metafoo.co.uk
    Classification: Unclassified


Created attachment 9009
  --> http://llvm.org/bugs/attachment.cgi?id=9009
Log of clang run

The following code crashes clang r161398 with "UNREACHABLE executed":

template <typename Lambda, typename R, typename... Params>
R lambdaDelegate(void*, Params...)
{
}

template <typename R, typename... P>
struct LambdaRef final {
    template <typename L>
    // Commenting <constexpr> here results in a smaller backtrace and
    // smaller stackdump, but the same UNREACHABLE
    constexpr LambdaRef(L&& lambda) noexcept :
        m_lambda(&lambda)
    ,   m_delegate(&lambdaDelegate<L, R, P...>) 
    {
    }

    void*   m_lambda;
    R (*m_delegate)(void*, P...);
};


static void foo(const LambdaRef<void, int>&)
{
}


int main()
{
    int result = 0;
    foo([&](int i) {
        result += i;
    });
}


This results in (complete log attached):

% ~/LLVM/build/Release+Asserts/bin/clang -std=c++11 -v clang.cpp
clang version 3.2 (trunk 161398)
Target: x86_64-apple-darwin10.8.0
Thread model: posix
[...]
shouldn't see dependent / unresolved nodes here
UNREACHABLE executed at
/Users/rynnsauer/LLVM/llvm/tools/clang/lib/AST/Expr.cpp:2644!
0  clang             0x000000010163a662 PrintStackTrace(void*) + 34
1  clang             0x000000010163aab4 SignalHandler(int) + 644
2  libSystem.B.dylib 0x00007fff8a5dc1ba _sigtramp + 26
3  libSystem.B.dylib 000000000000000000 _sigtramp + 1973567072
4  clang             0x0000000100050f66 abort + 22
5  clang             0x000000010004e0d4 llvm::llvm_unreachable_internal(char
const*, char const*, unsigned int) + 468
6  clang             0x0000000100a1cb46
clang::Expr::HasSideEffects(clang::ASTContext const&) const + 550


This might be a result of the changes in r161388, which is why I added Richard
Smith to the CC list.

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list