[LLVMbugs] [Bug 13860] New: Segfault with sizeof invalid lambda type

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Sep 17 16:49:52 PDT 2012


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

             Bug #: 13860
           Summary: Segfault with sizeof invalid lambda type
           Product: clang
           Version: trunk
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: arthur.j.odwyer at gmail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Created attachment 9223
  --> http://llvm.org/bugs/attachment.cgi?id=9223
Output of "/usr/bin/clang++ -std=c++11 invalid.cc -v"

cat >invalid.cc <<EOF
void foo() {
    auto x = bar();
    auto y = [x]() { };
    static_assert(sizeof(y), "");
}
EOF
clang++ -std=c++11 invalid.cc


invalid.cc:2:14: error: use of undeclared identifier 'bar'
    auto x = bar();
             ^
clang: error: unable to execute command: Segmentation fault: 11
clang: error: clang frontend command failed due to signal (use -v to see
invocation)
Apple clang version 4.1 (tags/Apple/clang-421.11.65) (based on LLVM 3.1svn)
Target: x86_64-apple-darwin12.0.0
Thread model: posix
clang: note: diagnostic msg: PLEASE submit a bug report to
http://developer.apple.com/bugreporter/ and include the crash backtrace,
preprocessed source, and associated run script.


I believe I was using Clang trunk at 163941 for this.

The input isn't a valid C++ program, but nevertheless it causes Clang to
segfault. This bug was observed in the wild, when two source files got out of
sync so that a function was being used without being declared first. The
static_assert corresponds to a __check_complete deep in the bowels of libc++'s
std::function type.


Bug 12808 (another compile-time lambda issue) might be related, but I doubt it.
Bug 3048, bug 9864 certainly fall into the same category, "sizeof crashes when
presented with invalid input". It seems like a fruitful area for bug-hunting.

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