[LLVMbugs] [Bug 8733] New: AV when reporting diagnostics in some code-completion results

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Dec 3 07:25:23 PST 2010


           Summary: AV when reporting diagnostics in some code-completion
           Product: clang
           Version: trunk
          Platform: All
        OS/Version: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: plc at rowley.co.uk
                CC: llvmbugs at cs.uiuc.edu

Created an attachment (id=5865)
 --> (http://llvm.org/bugs/attachment.cgi?id=5865)
Contains repro case

Code completion generates an exception when reporting errors in #included macro
expansions with precompiled headers enabled.

> more pl230.h
#define __C(X)   (0xFFFFFFFFU >> (31-(X)))

enum {
  V  = __C(31),

> more lm3s_mac.c
#include "pl230.h"

static void

>c-index-test -code-completion-at=lm3s_mac.c:6:2 lm3s_mac.c -nostdinc -I.


599B66BE (0x00000004 0x00EEDAC8 0x00BDF760 0x599B6796),
tSLocEntry()+0142 bytes(s),
anager.h, line 818+0022 byte(s)
599B660A (0x00000004 0x00BDFC20 0x00000004 0x00E6B620),
tSLocEntry()+0026 bytes(s),
anager.h, line 824

...and so on.

Actually, this bug is triggered *ONLY* by CXTranslationUnit_PrecompiledPreamble
as far as I can tell.  Turning precompiled preamble off and we're good.

You change getDefaultParsingOptions() in c-index-test, you provoke a crash or
not, which is what I did.

static unsigned getDefaultParsingOptions() {
  unsigned options = 0; // Nuke this one..
                        // CXTranslationUnit_DetailedPreprocessingRecord;

  if (getenv("CINDEXTEST_EDITING"))
      // Figure out which option triggers fault: break them out...
      options |= CXTranslationUnit_PrecompiledPreamble;
      //      options |= CXTranslationUnit_CacheCompletionResults;
      //      options |= CXTranslationUnit_CXXPrecompiledPreamble;

      // was: options |= clang_defaultEditingTranslationUnitOptions();
    options |= CXTranslationUnit_CacheCompletionResults;

  return options;

This may well affect released versions of clang, I have no idea.  I'm just
trunking at present.

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