<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - Clang 3.5 crash llvm/tools/clang/lib/AST/Decl.cpp:1687: bool isExternCTemplate(const T &) [T = clang::VarDecl]: Assertion `D.getASTContext().getLangOpts().CPlusPlus' failed"
   href="http://llvm.org/bugs/show_bug.cgi?id=19199">19199</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Clang 3.5 crash llvm/tools/clang/lib/AST/Decl.cpp:1687: bool isExternCTemplate(const T &) [T = clang::VarDecl]: Assertion `D.getASTContext().getLangOpts().CPlusPlus' failed
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Frontend
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>julien.grall@linaro.org
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=12258" name="attach_12258" title="Preprocessed source">attachment 12258</a> <a href="attachment.cgi?id=12258&action=edit" title="Preprocessed source">[details]</a></span>
Preprocessed source

I'm trying to compile Xen on ARM with clang 3.5 and I'm run on some assert from
the compiler (see output log below).

I was able to narrow down until this small source code:

int main(void)
{

#define mcurrent *({ unsigned long __ptr; NULL; })

    struct { _Static_assert(!(__builtin_types_compatible_p(typeof(*mcurrent),
int))) };
    return 0;
}

Compiling the code without any specific argument on clang command line will
result the same issue.

clang: /local/home/julien/works/clang/llvm/tools/clang/lib/AST/Decl.cpp:1687:
bool isExternCTemplate(const T &) [T = clang::VarDecl]: Assertion
`D.getASTContext().getLangOpts().CPlusPlus' failed.
0  clang 0x0a287d39 llvm::sys::PrintStackTrace(_IO_FILE*) + 41
Stack dump:
0.      Program arguments: /usr/local/bin/clang -cc1 -triple
armv7--linux-gnueabihf -S -disable-free -main-file-name kernel.c
-mrelocation-model static -mdisable-fp-elim -relaxed-aliasing -fmath-errno
-masm-verbose -no-integrated-as -mconstructor-aliases -target-cpu cortex-a15
-target-feature +soft-float -target-feature +soft-float-abi -target-feature
-neon -target-feature -crypto -target-abi aapcs-linux -msoft-float -mfloat-abi
soft -target-linker-version 2.22 -g -coverage-file /tmp/kernel-23b11f.s
-nostdsysteminc -nobuiltininc -resource-dir /usr/local/bin/../lib/clang/3.5.0
-dependency-file .kernel.o.d -MT kernel.o -include
/local/home/julien/works/arndale/xen/xen/include/xen/config.h -D
GCC_HAS_VISIBILITY_ATTRIBUTE -D __XEN__ -D VERBOSE -D HAS_DEVICE_TREE -D
CONFIG_FRAME_POINTER -I /local/home/julien/works/arndale/xen/xen/include -O1
-Wall -Wstrict-prototypes -Wdeclaration-after-statement -Wnested-externs
-Werror -Wredundant-decls -Wno-pointer-arith -Wno-parentheses -Wno-format
-Wno-unused-value -Wno-initializer-overrides -std=gnu99
-fno-dwarf-directory-asm -fdebug-compilation-dir
/local/home/julien/works/arndale/xen/xen/common -ferror-limit 19
-fmessage-length 319 -mstackrealign -fno-builtin -fno-signed-char
-fobjc-runtime=gcc -fno-common -fdiagnostics-show-option -fcolor-diagnostics
-vectorize-slp -o /tmp/kernel-23b11f.s -x c kernel.c 
1.      kernel.c:244:68 <Spelling=kernel.c:243:41>: current parser token ';'
2.      kernel.c:225:1: parsing function body 'do_xen_version'
3.      kernel.c:225:1: in compound statement ('{}')
4.      kernel.c:244:5: parsing struct/union body
5.      kernel.c:244:68 <Spelling=kernel.c:243:20>: in compound statement
('{}')
clang: error: unable to execute command: Aborted
clang: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 3.5.0 (<a href="http://llvm.org/git/clang.git">http://llvm.org/git/clang.git</a>
bcbb92d12f871a8f927c7f1cfcb45fbd859c8369) (<a href="http://llvm.org/git/llvm.git">http://llvm.org/git/llvm.git</a>
133aacf0dd1d7d8c7828594e5cd2e9595e0331ed)
Target: arm--linux-gnueabihf
Thread model: posix
clang: note: diagnostic msg: PLEASE submit a bug report to
<a href="http://llvm.org/bugs/">http://llvm.org/bugs/</a> and include the crash backtrace, preprocessed source, and
associated run script.
clang: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang: note: diagnostic msg: /tmp/kernel-ec59a6.c
clang: note: diagnostic msg: /tmp/kernel-ec59a6.sh
clang: note: diagnostic msg: 

********************</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>