This is an archive of the discontinued LLVM Phabricator instance.

[mlir][unittest] Fix crash when building with MSVC 2022
ClosedPublic

Authored by aganea on Sep 19 2022, 2:43 PM.

Details

Summary

If I build with Visual Studio 2022 version 17.3.4, the following crash is seen in a Release build:

C:\git\llvm-project>ninja check-mlir -C stage1_msvc
ninja: Entering directory `stage1_msvc'
[21/22] Running the MLIR regression tests
llvm-lit.py: C:\git\llvm-project\llvm\utils\lit\lit\llvm\config.py:46: note: using lit tools: C:\Users\alex_\scoop\apps\git\current\usr\bin
-- Testing: 1487 tests, 16 workers --
Testing:  0.. 10.. 20
FAIL: MLIR :: Dialect/Affine/ops.mlir (181 of 1487)
******************** TEST 'MLIR :: Dialect/Affine/ops.mlir' FAILED ********************
Script:
--
: 'RUN: at line 1';   c:\git\llvm-project\stage1_msvc\bin\mlir-opt.exe -allow-unregistered-dialect -split-input-file C:\git\llvm-project\mlir\test\Dialect\Affine\ops.mlir | c:\git\llvm-project\stage1_msvc\bin\filecheck.exe C:\git\llvm-project\mlir\test\Dialect\Affine\ops.mlir
: 'RUN: at line 2';   c:\git\llvm-project\stage1_msvc\bin\mlir-opt.exe -allow-unregistered-dialect C:\git\llvm-project\mlir\test\Dialect\Affine\ops.mlir -mlir-print-op-generic | c:\git\llvm-project\stage1_msvc\bin\filecheck.exe -check-prefix=GENERIC C:\git\llvm-project\mlir\test\Dialect\Affine\ops.mlir
--
Exit Code: 1

Command Output (stdout):
--
$ ":" "RUN: at line 1"
$ "c:\git\llvm-project\stage1_msvc\bin\mlir-opt.exe" "-allow-unregistered-dialect" "-split-input-file" "C:\git\llvm-project\mlir\test\Dialect\Affine\ops.mlir"
# command stderr:
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.      Program arguments: c:\\git\\llvm-project\\stage1_msvc\\bin\\mlir-opt.exe -allow-unregistered-dialect -split-input-file C:\\git\\llvm-project\\mlir\\test\\Dialect\\Affine\\ops.mlir
1.      MLIR Parser: custom op parser 'func.func'
2.      MLIR Parser: custom op parser 'affine.parallel'
Exception Code: 0xC0000005
 #0 0x00007ff7943feece llvm::hashing::detail::hash_short(char const *, unsigned __int64, unsigned __int64) C:\git\llvm-project\llvm\include\llvm\ADT\Hashing.h:252:0
 #1 0x00007ff79440402e llvm::hash_code::{ctor} C:\git\llvm-project\llvm\include\llvm\ADT\Hashing.h:82:0
 #2 0x00007ff79440402e llvm::hashing::detail::hash_combine_range_impl<char const>(char const *, char const *) C:\git\llvm-project\llvm\include\llvm\ADT\Hashing.h:457:0
 #3 0x00007ff794405bf4 llvm::DenseMapInfo<class llvm::StringRef, void>::getHashValue(class llvm::StringRef) C:\git\llvm-project\llvm\lib\Support\StringRef.cpp:613:0
 #4 0x00007ff795833093 mlir::detail::AttributeUniquer::getWithTypeID C:\git\llvm-project\mlir\include\mlir\IR\AttributeSupport.h:196:0
 #5 0x00007ff795833093 mlir::detail::AttributeUniquer::get C:\git\llvm-project\mlir\include\mlir\IR\AttributeSupport.h:177:0
 #6 0x00007ff795833093 mlir::detail::StorageUserBase<class mlir::StringAttr, class mlir::Attribute, struct mlir::detail::StringAttrStorage, class mlir::detail::AttributeUniquer, struct mlir::TypedAttr::Trait>::get<class llvm::StringRef, class mlir::Type>(class mlir::MLIRContext *, class llvm::StringRef, class mlir::Type) C:\git\llvm-project\mlir\include\mlir\IR\StorageUniquerSupport.h:154:0
 #7 0x00007ff79584eb02 llvm::SmallVector<char,32>::{dtor} C:\git\llvm-project\llvm\include\llvm\ADT\SmallVector.h:1190:0
 #8 0x00007ff79584eb02 mlir::StringAttr::get(class mlir::MLIRContext *, class llvm::Twine const &) C:\git\llvm-project\mlir\lib\IR\BuiltinAttributes.cpp:307:0
 #9 0x00007ff79588515a mlir::Builder::getNamedAttr(class llvm::StringRef, class mlir::Attribute) C:\git\llvm-project\mlir\lib\IR\Builders.cpp:88:0
#10 0x00007ff7972575bc `anonymous namespace'::CustomOpAsmParser::parseAffineMapOfSSAIds C:\git\llvm-project\mlir\lib\AsmParser\Parser.cpp:1605:0
#11 0x00007ff79448d654 mlir::LogicalResult::failed C:\git\llvm-project\mlir\include\mlir\Support\LogicalResult.h:44:0
#12 0x00007ff79448d654 mlir::failed C:\git\llvm-project\mlir\include\mlir\Support\LogicalResult.h:72:0
#13 0x00007ff79448d654 `parseAffineMapWithMinMax'::`2'::<lambda_1>::operator() C:\git\llvm-project\mlir\lib\Dialect\Affine\IR\AffineOps.cpp:3680:0
#14 0x00007ff79446ef89 mlir::ParseResult::{ctor} C:\git\llvm-project\mlir\include\mlir\Support\LogicalResult.h:122:0
#15 0x00007ff79446ef89 llvm::function_ref<mlir::ParseResult __cdecl(void)>::callback_fn<`parseAffineMapWithMinMax'::`2'::<lambda_1> > C:\git\llvm-project\llvm\include\llvm\ADT\STLFunctionalExtras.h:45:0
#16 0x00007ff79725960f mlir::LogicalResult::failed C:\git\llvm-project\mlir\include\mlir\Support\LogicalResult.h:44:0
#17 0x00007ff79725960f mlir::ParseResult::operator bool C:\git\llvm-project\mlir\include\mlir\Support\LogicalResult.h:125:0
#18 0x00007ff79725960f mlir::detail::Parser::parseCommaSeparatedList(enum mlir::AsmParser::Delimiter, class llvm::function_ref<(void)>, class llvm::StringRef) C:\git\llvm-project\mlir\lib\AsmParser\Parser.cpp:103:0
#19 0x00007ff79724e5ea mlir::detail::AsmParserImpl<class mlir::OpAsmParser>::parseCommaSeparatedList(enum mlir::AsmParser::Delimiter, class llvm::function_ref<(void)>, class llvm::StringRef) C:\git\llvm-project\mlir\lib\AsmParser\AsmParserImpl.h:286:0
#20 0x00007ff7944a8f97 mlir::LogicalResult::failed C:\git\llvm-project\mlir\include\mlir\Support\LogicalResult.h:44:0
#21 0x00007ff7944a8f97 mlir::ParseResult::operator bool C:\git\llvm-project\mlir\include\mlir\Support\LogicalResult.h:125:0
#22 0x00007ff7944a8f97 parseAffineMapWithMinMax C:\git\llvm-project\mlir\lib\Dialect\Affine\IR\AffineOps.cpp:3705:0
#23 0x00007ff7944a754f mlir::LogicalResult::failed C:\git\llvm-project\mlir\include\mlir\Support\LogicalResult.h:44:0
#24 0x00007ff7944a754f mlir::ParseResult::operator bool C:\git\llvm-project\mlir\include\mlir\Support\LogicalResult.h:125:0
#25 0x00007ff7944a754f mlir::AffineParallelOp::parse(class mlir::OpAsmParser &, struct mlir::OperationState &) C:\git\llvm-project\mlir\lib\Dialect\Affine\IR\AffineOps.cpp:3756:0
#26 0x00007ff794469ca8 llvm::detail::UniqueFunctionBase<class mlir::ParseResult, class mlir::OpAsmParser &, struct mlir::OperationState &>::CallImpl<class mlir::ParseResult (__cdecl *const)(class mlir::OpAsmParser &, struct mlir::OperationState &)>(void *, class mlir::OpAsmParser &, struct mlir::OperationState &) C:\git\llvm-project\llvm\include\llvm\ADT\FunctionExtras.h:221:0
#27 0x00007ff797251530 llvm::function_ref<(class mlir::OpAsmParser &, struct mlir::OperationState &)>::callback_fn<class llvm::unique_function<(class mlir::OpAsmParser &, struct mlir::OperationState &) const> const>(__int64, class mlir::OpAsmParser &, struct mlir::OperationState &) C:\git\llvm-project\llvm\include\llvm\ADT\STLFunctionalExtras.h:47:0
#28 0x00007ff797259cd1 `anonymous namespace'::OperationParser::parseCustomOperation C:\git\llvm-project\mlir\lib\AsmParser\Parser.cpp:1906:0
#29 0x00007ff79725d505 `anonymous namespace'::OperationParser::parseOperation C:\git\llvm-project\mlir\lib\AsmParser\Parser.cpp:1152:0
#30 0x00007ff797258940 `anonymous namespace'::OperationParser::parseBlock C:\git\llvm-project\mlir\lib\AsmParser\Parser.cpp:2099:0
#31 0x00007ff79725f401 mlir::LogicalResult::failed C:\git\llvm-project\mlir\include\mlir\Support\LogicalResult.h:44:0
#32 0x00007ff79725f401 mlir::ParseResult::operator bool C:\git\llvm-project\mlir\include\mlir\Support\LogicalResult.h:125:0
#33 0x00007ff79725f401 `anonymous namespace'::OperationParser::parseRegionBody C:\git\llvm-project\mlir\lib\AsmParser\Parser.cpp:2057:0
#34 0x00007ff79725f03c mlir::LogicalResult::failed C:\git\llvm-project\mlir\include\mlir\Support\LogicalResult.h:44:0
#35 0x00007ff79725f03c mlir::ParseResult::operator bool C:\git\llvm-project\mlir\include\mlir\Support\LogicalResult.h:125:0
#36 0x00007ff79725f03c `anonymous namespace'::OperationParser::parseRegion C:\git\llvm-project\mlir\lib\AsmParser\Parser.cpp:1993:0
#37 0x00007ff79725eeb3 mlir::LogicalResult::failed C:\git\llvm-project\mlir\include\mlir\Support\LogicalResult.h:44:0
#38 0x00007ff79725eeb3 mlir::ParseResult::operator bool C:\git\llvm-project\mlir\include\mlir\Support\LogicalResult.h:125:0
#39 0x00007ff79725eeb3 `anonymous namespace'::CustomOpAsmParser::parseRegion C:\git\llvm-project\mlir\lib\AsmParser\Parser.cpp:1690:0
#40 0x00007ff79725e67f llvm::optional_detail::OptionalStorage<mlir::ParseResult,1>::{ctor} C:\git\llvm-project\llvm\include\llvm\ADT\Optional.h:200:0
#41 0x00007ff79725e67f llvm::Optional<mlir::ParseResult>::{ctor} C:\git\llvm-project\llvm\include\llvm\ADT\Optional.h:278:0
#42 0x00007ff79725e67f mlir::OptionalParseResult::{ctor} C:\git\llvm-project\mlir\include\mlir\IR\OpDefinition.h:41:0
#43 0x00007ff79725e67f `anonymous namespace'::CustomOpAsmParser::parseOptionalRegion C:\git\llvm-project\mlir\lib\AsmParser\Parser.cpp:1701:0
#44 0x00007ff7958a66db mlir::function_interface_impl::parseFunctionOp(class mlir::OpAsmParser &, struct mlir::OperationState &, bool, class llvm::function_ref<(class mlir::Builder &, class llvm::ArrayRef<class mlir::Type>, class llvm::ArrayRef<class mlir::Type>, class mlir::function_interface_impl::VariadicFlag, class std::basic_string<char, struct std::char_traits<char>, class std::allocator<char>> &)>) C:\git\llvm-project\mlir\lib\IR\FunctionImplementation.cpp:232:0
#45 0x00007ff79470cab1 mlir::ml_program::SubgraphOp::parse(class mlir::OpAsmParser &, struct mlir::OperationState &) C:\git\llvm-project\mlir\lib\Dialect\Func\IR\FuncOps.cpp:266:0
#46 0x00007ff794469ca8 llvm::detail::UniqueFunctionBase<class mlir::ParseResult, class mlir::OpAsmParser &, struct mlir::OperationState &>::CallImpl<class mlir::ParseResult (__cdecl *const)(class mlir::OpAsmParser &, struct mlir::OperationState &)>(void *, class mlir::OpAsmParser &, struct mlir::OperationState &) C:\git\llvm-project\llvm\include\llvm\ADT\FunctionExtras.h:221:0
#47 0x00007ff797251530 llvm::function_ref<(class mlir::OpAsmParser &, struct mlir::OperationState &)>::callback_fn<class llvm::unique_function<(class mlir::OpAsmParser &, struct mlir::OperationState &) const> const>(__int64, class mlir::OpAsmParser &, struct mlir::OperationState &) C:\git\llvm-project\llvm\include\llvm\ADT\STLFunctionalExtras.h:47:0
#48 0x00007ff797259cd1 `anonymous namespace'::OperationParser::parseCustomOperation C:\git\llvm-project\mlir\lib\AsmParser\Parser.cpp:1906:0
#49 0x00007ff79725d505 `anonymous namespace'::OperationParser::parseOperation C:\git\llvm-project\mlir\lib\AsmParser\Parser.cpp:1152:0
#50 0x00007ff7972572b5 `anonymous namespace'::TopLevelOperationParser::parse C:\git\llvm-project\mlir\lib\AsmParser\Parser.cpp:2585:0
#51 0x00007ff7972584b0 mlir::parseAsmSourceFile(class llvm::SourceMgr const &, class mlir::Block *, class mlir::ParserConfig const &, class mlir::AsmParserState *, class mlir::AsmParserCodeCompleteContext *) C:\git\llvm-project\mlir\lib\AsmParser\Parser.cpp:2643:0
#52 0x00007ff79578b171 mlir::parseSourceFile(class llvm::SourceMgr const &, class mlir::Block *, class mlir::ParserConfig const &, class mlir::LocationAttr *) C:\git\llvm-project\mlir\lib\Parser\Parser.cpp:32:0
#53 0x00007ff79578a1cd mlir::parseSourceFile C:\git\llvm-project\mlir\include\mlir\Parser\Parser.h:147:0
#54 0x00007ff79578a1cd performActions C:\git\llvm-project\mlir\lib\Tools\mlir-opt\MlirOptMain.cpp:78:0
#55 0x00007ff79578ac75 processBuffer C:\git\llvm-project\mlir\lib\Tools\mlir-opt\MlirOptMain.cpp:136:0
#56 0x00007ff79578892d llvm::function_ref<mlir::LogicalResult __cdecl(std::unique_ptr<llvm::MemoryBuffer,std::default_delete<llvm::MemoryBuffer> >,llvm::raw_ostream &)>::callback_fn<`mlir::MlirOptMain'::`2'::<lambda_1> > C:\git\llvm-project\llvm\include\llvm\ADT\STLFunctionalExtras.h:45:0
#57 0x00007ff7957f6596 mlir::LogicalResult::failed C:\git\llvm-project\mlir\include\mlir\Support\LogicalResult.h:44:0
#58 0x00007ff7957f6596 mlir::failed C:\git\llvm-project\mlir\include\mlir\Support\LogicalResult.h:72:0
#59 0x00007ff7957f6596 `mlir::splitAndProcessBuffer'::`2'::<lambda_1>::operator() C:\git\llvm-project\mlir\lib\Support\ToolUtilities.cpp:88:0
#60 0x00007ff7957f6b48 llvm::interleave C:\git\llvm-project\llvm\include\llvm\ADT\STLExtras.h:1871:0
#61 0x00007ff7957f6b48 llvm::interleave C:\git\llvm-project\llvm\include\llvm\ADT\STLExtras.h:1889:0
#62 0x00007ff7957f6b48 mlir::splitAndProcessBuffer(class std::unique_ptr<class llvm::MemoryBuffer, struct std::default_delete<class llvm::MemoryBuffer>>, class llvm::function_ref<(class std::unique_ptr<class llvm::MemoryBuffer, struct std::default_delete<class llvm::MemoryBuffer>>, class llvm::raw_ostream &)>, class llvm::raw_ostream &, bool, bool) C:\git\llvm-project\mlir\lib\Support\ToolUtilities.cpp:91:0
#63 0x00007ff7957895e5 mlir::MlirOptMain C:\git\llvm-project\mlir\lib\Tools\mlir-opt\MlirOptMain.cpp:182:0
#64 0x00007ff7957895e5 mlir::MlirOptMain C:\git\llvm-project\mlir\lib\Tools\mlir-opt\MlirOptMain.cpp:201:0
#65 0x00007ff7957895e5 mlir::MlirOptMain(int, char **, class llvm::StringRef, class mlir::DialectRegistry &, bool) C:\git\llvm-project\mlir\lib\Tools\mlir-opt\MlirOptMain.cpp:288:0
#66 0x00007ff7943e42a9 std::vector<std::unique_ptr<mlir::DialectExtensionBase,std::default_delete<mlir::DialectExtensionBase> >,std::allocator<std::unique_ptr<mlir::DialectExtensionBase,std::default_delete<mlir::DialectExtensionBase> > > >::_Tidy C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.33.31629\include\vector:1906:0
#67 0x00007ff7943e42a9 std::vector<std::unique_ptr<mlir::DialectExtensionBase,std::default_delete<mlir::DialectExtensionBase> >,std::allocator<std::unique_ptr<mlir::DialectExtensionBase,std::default_delete<mlir::DialectExtensionBase> > > >::{dtor} C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.33.31629\include\vector:807:0
#68 0x00007ff7943e42a9 main C:\git\llvm-project\mlir\tools\mlir-opt\mlir-opt.cpp:229:0
#69 0x00007ff797299f9c invoke_main D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:78:0
#70 0x00007ff797299f9c __scrt_common_main_seh D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288:0
#71 0x00007ff934eb54e0 (C:\WINDOWS\System32\KERNEL32.DLL+0x154e0)
#72 0x00007ff935ee485b (C:\WINDOWS\SYSTEM32\ntdll.dll+0x485b)

error: command failed with exit status: 3221225477
$ "c:\git\llvm-project\stage1_msvc\bin\filecheck.exe" "C:\git\llvm-project\mlir\test\Dialect\Affine\ops.mlir"
# command stderr:
C:\git\llvm-project\mlir\test\Dialect\Affine\ops.mlir:156:17: error: CHECK-LABEL: expected string not found in input
// CHECK-LABEL: func @parallel
                ^
<stdin>:69:38: note: scanning from here
 func.func @valid_symbol_affine_scope(%arg0: index, %arg1: memref<?xf32>) {
                                     ^
<stdin>:93:8: note: possible intended match here
 "test.func"() ({
       ^

Input file: <stdin>
Check file: C:\git\llvm-project\mlir\test\Dialect\Affine\ops.mlir

-dump-input=help explains the following input dump.

Input was:
<<<<<<
             .
             .
             .
            64: }
            65:
            66:
            67: // -----
            68: module {
            69:  func.func @valid_symbol_affine_scope(%arg0: index, %arg1: memref<?xf32>) {
label:156'0                                          X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: no match found
            70:  test.affine_scopetest.affine_scope {
label:156'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            71:  %c1 = arith.constant 1 : index
label:156'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            72:  %0 = arith.subi %arg0, %c1 : index
label:156'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            73:  affine.for %arg2 = %0 to %arg0 {
label:156'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            74:  %1 = arith.subi %0, %arg2 : index
label:156'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
             .
             .
             .
            88:
label:156'0     ~
            89:
label:156'0     ~
            90: // -----
label:156'0     ~~~~~~~~~
            91: module {
label:156'0     ~~~~~~~~~
            92:  %0 = "test.foo"() : () -> index
label:156'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            93:  "test.func"() ({
label:156'0     ~~~~~~~~~~~~~~~~~~
label:156'1            ?           possible intended match
            94:  ^bb0(%arg0: memref<?xf32>):
label:156'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            95:  %1 = affine.load %arg0[%0] : memref<?xf32>
label:156'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            96:
label:156'0     ~
>>>>>>

error: command failed with exit status: 1

--

********************
Testing:  0.. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80.. 90..
********************
Failed Tests (1):
  MLIR :: Dialect/Affine/ops.mlir


Testing Time: 10.66s
  Unsupported:  335
  Passed     : 1376
  Failed     :    1
FAILED: tools/mlir/test/CMakeFiles/check-mlir C:/git/llvm-project/stage1_msvc/tools/mlir/test/CMakeFiles/check-mlir
cmd.exe /C "cd /D C:\git\llvm-project\stage1_msvc\tools\mlir\test && C:\Users\alex_\scoop\apps\python\3.10.1\python.exe C:/git/llvm-project/stage1_msvc/./bin/llvm-lit.py -sv C:/git/llvm-project/stage1_msvc/tools/mlir/test"
ninja: build stopped: subcommand failed.

I'm using the following to build:

> cmake -GNinja %ROOT%/llvm -DCMAKE_BUILD_TYPE=Release -DLLVM_OPTIMIZED_TABLEGEN=ON -DLLVM_ENABLE_LIBXML2=OFF -DCMAKE_C_COMPILER=cl.exe -DCMAKE_CXX_COMPILER=cl.exe -DCMAKE_LINKER=link.exe -DLLVM_ENABLE_PROJECTS="llvm;clang;lld;clang-tools-extra;mlir" -DLLVM_USE_CRT_RELEASE=MT -DLLVM_ENABLE_PDB=ON -DLLVM_ENABLE_ASSERTIONS=ON

I think the MSVC optimizer optimizes too much, which leads to the constexpr variable being half-empty when entering the lambda function. In Debug mode things are fine.

Diff Detail

Event Timeline

aganea created this revision.Sep 19 2022, 2:43 PM
aganea requested review of this revision.Sep 19 2022, 2:43 PM

Another screenshot with the value of tmpAttrStrName inside the lambda: (xmm0 here, see memory view at the bottom)

mehdi_amini accepted this revision.Sep 20 2022, 2:56 PM

Did you report this as a bug on MSVC? Seems a bit scary...

This revision is now accepted and ready to land.Sep 20 2022, 2:56 PM
jpienaar accepted this revision.Sep 25 2022, 6:22 AM

Did you report this as a bug on MSVC? Seems a bit scary...

It seems the reference to the string litteral is optimized out from the relocation. I suppose the chunk writer code in MSVC has '0' as initial value for the relocation, which makes it write -by mistake- a reference to the first symbol in the COFF table:

SECTION HEADER #1D50
  .rdata name
       0 physical address
       0 virtual address
      10 size of raw data
  440206 file pointer to raw data (00440206 to 00440215)
  440216 file pointer to relocation table
       0 file pointer to line numbers
       1 number of relocations
       0 number of line numbers
40401040 flags
         Initialized Data
         COMDAT; sym= "??__N2VStringLiteral@llvm@@2VStringRef@1@PEBD4??_C@_0BD@EHGHKKPK@__pseudo_bound_map@@_K0BC@@@@" (??__N2VStringLiteral@llvm@@2VStringRef@1@PEBD4??_C@_0BD@EHGHKKPK@__pseudo_bound_map@@_K0BC@@@@)
         8 byte align
         Read Only

RAW DATA #1D50
  00000000: 00 00 00 00 00 00 00 00 12 00 00 00 00 00 00 00  ................

RELOCATIONS #1D50
                                                Symbol    Symbol
 Offset    Type              Applied To         Index     Name
 --------  ----------------  -----------------  --------  ------
 00000000  ADDR64            00000000 00000000         0  @comp.id    <<<<<<<<<<<<<

and:

COFF SYMBOL TABLE
000 01057B8E ABS    notype       Static       | @comp.id

Issue reduced to:

// Build with:
// cl.exe /TP /Zc:inline /Zc:__cplusplus /Oi /permissive- /W0 /Gw /MT /O2 /Ob2 /EHs-c- /GR- -std:c++17 -c this_file.cpp

namespace a {
class aj;
}
using a::aj;
template <typename> class as {
protected:
  as(size_t);
};
template <typename> class au : as<int> {
protected:
  au(size_t av) : as(av) {}
};
class e : au<int> {
public:
  e(unsigned aw) : au(aw) {}
};
template <typename ar> struct f {
  static constexpr size_t ay = sizeof(ar);
  static constexpr size_t b = ay;
};
template <typename ar, unsigned aw = f<ar>::b> class ak : public e {
public:
  ak() : e(aw) {}
};
namespace a {
class aj {
  const char *bd;
  size_t be;

public:
  constexpr aj(const char *bf, size_t bg) : bd(bf), be(bg) {}
};
class g : public aj {
public:
  template <size_t aw> constexpr g(const char (&bi)[aw]) : aj(bi, aw - 1) {}
};
} // namespace a
class c {
public:
  int h(e, int, aj, int);
} i;
int j;
void k() {
  constexpr a::g d = "__pseudo_bound_map";
  ak<c> dc;
  [&] { int dd = i.h(dc, dd, d, j); }();
}

I'll report the bug.

This revision was automatically updated to reflect the committed changes.