[LLVMbugs] [Bug 11832] New: clang crashes with std::initializer_list<const char*> in non-static function

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Jan 23 04:05:20 PST 2012


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

             Bug #: 11832
           Summary: clang crashes with std::initializer_list<const char*>
                    in non-static function
           Product: clang
           Version: trunk
          Platform: Macintosh
        OS/Version: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++0x
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: jonathan.sauer at gmx.de
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Created attachment 7928
  --> http://llvm.org/bugs/attachment.cgi?id=7928
Complete crash log

The following program crashes clang r148686:

namespace std {
    typedef unsigned long size_t;

    // Reduced from libc++
    template<class _Ep>
    class initializer_list
    {
        // Comment these two lines to avoid the crash
        const _Ep* __begin_;
        size_t    __size_;

        inline
        initializer_list(const _Ep* __b, size_t __s) noexcept
            {}
    public:
    };
}

//#define STATIC static // Does not crash clang
#define STATIC          // Crashes clang

void foo(std::initializer_list<const char*>);

STATIC void bar()
{
    foo({ "foo" });
}

STATIC void baz(const char* s)
{
    foo({ s });
}


This results in (full log attached):

$ ~/LLVM/build/Release+Asserts/bin/clang++ -std=c++0x -v clang.cpp 
[...]
Assertion failed: (getOperand(0)->getType() ==
cast<PointerType>(getOperand(1)->getType())->getElementType() && "Ptr must be a
pointer to Val type!"), function AssertOK, file
/Users/rynnsauer/LLVM/llvm/lib/VMCore/Instructions.cpp, line 1082.
[...]

Interestingly, it does not crash if (a) the calling functions are static, or
(b) std::initializer_list has no members.

-- 
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