[LLVMbugs] [Bug 2266] New: semantic analyzer assertion on malformed code: " The next DeclContext should be directly contained in the current one."

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Wed Apr 30 09:43:12 PDT 2008


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

           Summary: semantic analyzer assertion on malformed code: "The next
                    DeclContext should be directly contained in the current
                    one."
           Product: clang
           Version: unspecified
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Semantic Analyzer
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: kremenek at cs.stanford.edu
                CC: llvmbugs at cs.uiuc.edu


We're seeing an assertion failure that appears to be a regression in handling
malformed code.  The following code triggers an assertion:

int f1 (struct X *x, struct Y *y) {
  int error = 0;
  error = f2 (x, y);
  return error;
}

int
f2 (struct X *x, struct Y *y)
{

I am at revision r50483 of clang.  I am using Mac OS X (Leopard), although I
believe the bug will appear on other platforms (haven't tested yet).

The output of clang:

$ clang /tmp/t.c
Assertion failed: (( (isa<ObjCMethodDecl>(DC) &&
isa<TranslationUnitDecl>(CurContext)) || DC->getParent() == CurContext ) &&
"The next DeclContext should be directly contained in the current one."),
function PushDeclContext, file SemaDecl.cpp, line 48.
0   clang                               0x00297b19 _ZNK4llvm3sys4PathneERKS1_ +
79
1   clang                               0x00297d15
_ZN4llvm3sys28PrintStackTraceOnErrorSignalEv + 387
2   libSystem.B.dylib                   0x915d65eb _sigtramp + 43
3   ???                                 0xffffffff 0x0 + 4294967295
4   libSystem.B.dylib                   0x9164f3f2 raise + 26
5   libSystem.B.dylib                   0x9165e9af abort + 73
6   libSystem.B.dylib                   0x91650593 __assert_rtn + 101
7   clang                               0x000e1cb3
_ZN5clang4Sema15PushDeclContextEPNS_11DeclContextE + 135
8   clang                               0x000e2112
_ZN5clang4Sema23ActOnStartOfFunctionDefEPNS_5ScopeERNS_10DeclaratorE + 1104
9   clang                               0x00171425
_ZN5clang6Parser23ParseFunctionDefinitionERNS_10DeclaratorE + 505
10  clang                               0x0017198b
_ZN5clang6Parser36ParseDeclarationOrFunctionDefinitionEv + 1333
11  clang                               0x00171ae5
_ZN5clang6Parser24ParseExternalDeclarationEv + 85
12  clang                               0x00171d03
_ZN5clang6Parser17ParseTopLevelDeclERPv + 61
13  clang                               0x000d6f5f
_ZN5clang8ParseASTERNS_12PreprocessorEPNS_11ASTConsumerEb + 339
14  clang                               0x00028de4
_Z16InitializeGCModeRN5clang11LangOptionsE + 5620
15  clang                               0x0002b917 main + 1345
16  clang                               0x00001b62 start + 54


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