<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </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 - Crash in GetNeonType"
   href="https://bugs.llvm.org/show_bug.cgi?id=42775">42775</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Crash in GetNeonType
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>8.0
          </td>
        </tr>

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

        <tr>
          <th>OS</th>
          <td>Windows NT
          </td>
        </tr>

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

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>new bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>dmajor@mozilla.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>hans@chromium.org, htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Blocks</th>
          <td>42474
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Clang-cl from the release_90 branch crashes while compiling Firefox for
aarch64-windows.

Unfortunately I couldn't reproduce this locally, it only crashes with Mozilla
automation's clang builds, which don't publish debug symbols. By tracing
execution side-by-side with the crashy build and my own build that has symbols,
I narrowed this down to an unhandled switch case in `GetNeonType`. The
`TypeFlags.Flags` are -1.

Reduced buffer.c:
foo() {
 _InterlockedExchangeAdd64(0, -1);
}

Command line from the reproducer script:
"clang-cl.exe" "-cc1" "-triple" "aarch64-unknown-windows-msvc19.16.27026"
"-emit-obj" "-mincremental-linker-compatible" "-disable-free"
"-disable-llvm-verifier" "-discard-value-names" "-main-file-name" "buffer.c"
"-mrelocation-model" "static" "-mthread-model" "posix" "-mdisable-fp-elim"
"-relaxed-aliasing" "-fmath-errno" "-masm-verbose" "-mconstructor-aliases"
"-munwind-tables" "-target-cpu" "generic" "-target-feature" "+neon"
"-target-abi" "aapcs" "-fallow-half-arguments-and-returns" "-D_MT" "-D_DLL"
"--dependent-lib=msvcrt" "--dependent-lib=oldnames" "-stack-protector" "2"
"-fdiagnostics-format" "msvc" "-gcodeview" "-debug-info-kind=limited"
"-ffunction-sections" "-fdata-sections" "-coverage-notes-file"
"z:\\build\\build\\src\\obj-firefox\\media\\ffvpx\\libavutil\\buffer.gcno" "-D"
"DEBUG=1" "-D" "_USE_MATH_DEFINES" "-D" "inline=__inline" "-D"
"HAVE_AV_CONFIG_H" "-D" "ASSERT_LEVEL=2" "-D" "MOZILLA_CLIENT" "-D"
"_HAS_EXCEPTIONS=0" "-O2" "-Wall" "-Wno-unknown-pragmas" "-Wno-ignored-pragmas"
"-Wno-deprecated-declarations" "-Wno-invalid-noreturn" "-Wno-parentheses"
"-Wno-pointer-sign" "-Wno-sign-compare" "-Wno-switch" "-Wno-type-limits"
"-Wno-unused-function" "-Wno-deprecated-declarations" "-Wno-absolute-value"
"-Wno-incompatible-pointer-types" "-Wno-string-conversion" "-Wno-visibility"
"-Wno-inconsistent-dllimport" "-Wno-macro-redefined" "-ferror-limit" "19"
"-fmessage-length" "0" "-fno-use-cxa-atexit" "-fms-extensions"
"-fms-compatibility" "-fms-compatibility-version=19.16.27026"
"-fdelayed-template-parsing" "-fobjc-runtime=gcc" "-fdiagnostics-show-option"
"-vectorize-loops" "-vectorize-slp" "-std=gnu99" "-faddrsig" "-x" "c"
"buffer.c"

Stack (the top frame is actually GetNeonType, the symbols are missing):

00 clang_cl!clang::CodeGen::CodeGenFunction::EmitCommonNeonBuiltinExpr
01 clang_cl!clang::CodeGen::CodeGenFunction::EmitAArch64BuiltinExpr
02 clang_cl!clang::CodeGen::CodeGenFunction::EmitBuiltinExpr
03 clang_cl!clang::CodeGen::CodeGenFunction::EmitCallExpr
04 clang_cl!clang::CodeGen::CodeGenFunction::EmitCheckedInBoundsGEP
05 clang_cl!clang::CodeGen::CodeGenFunction::EmitScalarExpr
06 clang_cl!clang::CodeGen::CodeGenFunction::EmitAnyExpr
07 clang_cl!clang::CodeGen::CodeGenFunction::EmitIgnoredExpr
08 clang_cl!clang::CodeGen::CodeGenFunction::EmitStmt
09 clang_cl!clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope
0a clang_cl!clang::CodeGen::CodeGenFunction::EmitFunctionBody
0b clang_cl!clang::CodeGen::CodeGenFunction::GenerateCode
0c clang_cl!clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition
0d clang_cl!clang::CodeGen::CodeGenModule::EmitGlobalDefinition
0e clang_cl!clang::CodeGen::CodeGenModule::EmitGlobal
0f clang_cl!clang::CodeGen::CodeGenModule::EmitTopLevelDecl
10 clang_cl!clang::CreateLLVMCodeGen
11 clang_cl!clang::BackendConsumer::HandleTopLevelDecl
12 clang_cl!clang::ParseAST
13 clang_cl!clang::FrontendAction::Execute
14 clang_cl!clang::CompilerInstance::ExecuteAction
15 clang_cl!clang::ExecuteCompilerInvocation
16 clang_cl!clang::ChainedDiagnosticConsumer::HandleDiagnostic
17 clang_cl
18 clang_cl!llvm::itanium_demangle::OutputStream::writeUnsigned
19 KERNEL32!BaseThreadInitThunk
1a ntdll!RtlUserThreadStart</pre>
        </div>
      </p>

        <div id="referenced">
          <hr style="border: 1px dashed #969696">
          <b>Referenced Bugs:</b>
          <ul>
              <li>
                [<a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [meta] 9.0.0 Release Blockers"
   href="https://bugs.llvm.org/show_bug.cgi?id=42474">Bug 42474</a>] [meta] 9.0.0 Release Blockers
              </li>
          </ul>
        </div>
        <br>

      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>