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

             Bug #: 12332
           Summary: NULL dereference in MicrosoftMangle.cpp on "operator
                    new" mangling
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
        AssignedTo: [email protected]
        ReportedBy: [email protected]
                CC: [email protected], [email protected]
    Classification: Unclassified


Repro:
$ more operator_new.cpp
void f(unsigned int);

int main() {
  f(42);
  char *ptr = new char;
}

-> mangles "void f(unsigned int)" fine, crashes on mangling "void* operator
new(unsigned int) ..."

Slightly easier to repro with an intermediate var and assert:
llvm\tools\clang$ svn diff lib\AST\MicrosoftMangle.cpp
Index: lib/AST/MicrosoftMangle.cpp
===================================================================
--- lib/AST/MicrosoftMangle.cpp (revision 153267)
+++ lib/AST/MicrosoftMangle.cpp (working copy)
@@ -767,8 +767,11 @@
       // get mangled right.
       for (FunctionDecl::param_const_iterator Parm = D->param_begin(),
            ParmEnd = D->param_end();
-           Parm != ParmEnd; ++Parm)
-        mangleType((*Parm)->getTypeSourceInfo()->getType());
+           Parm != ParmEnd; ++Parm) {
+        TypeSourceInfo *source_info = (*Parm)->getTypeSourceInfo();
+        assert(source_info);
+        mangleType(source_info->getType());
+      }
     } else {
       for (FunctionProtoType::arg_type_iterator Arg = Proto->arg_type_begin(),
            ArgEnd = Proto->arg_type_end();

-- 
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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to