Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MSVC fatal error LNK1103 when using call argument name with null character #14787

Open
HertzDevil opened this issue Jul 6, 2024 · 0 comments

Comments

@HertzDevil
Copy link
Contributor

The following:

def foo(**opts)
end

foo("\u{0}abcdefg": 1)

gives the following error when run on Windows without --no-debug:

msvcrt.lib(guard_dispatch.obj) : fatal error LNK1103: debugging information corrupt; recompile module
Error: execution of command failed with exit status 2: "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.38.33130\bin\Hostx64\x64\cl.exe" /nologo _main.o0.obj /FeC:\Users\nicet\AppData\Local\crystal\cache\crystal-run-test.exe.tmp.exe /link "/LIBPATH:C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.38.33130\atlmfc\lib\x64" "/LIBPATH:C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.38.33130\lib\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\Lib\10.0.22621.0\ucrt\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\Lib\10.0.22621.0\um\x64" /DEBUG:FULL /PDBALTPATH:%_PDB% /INCREMENTAL:NO /STACK:0x800000 /LIBPATH:C:\crystal\lib "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.38.33130\lib\x64\msvcrt.lib"

This might be due to CodeView not supporting embedded null characters in symbol names:

; Function Attrs: uwtable
define internal void @.2A.foo.3A..0.abcdefg.3C.Int32.3E..3A.Nil(i32 %__temp_1) #0 !dbg !17 {
alloca:
  %opts = alloca %"NamedTuple(\22\\u0000abcdefg\22: Int32)", align 8, !dbg !18
  %0 = alloca %"NamedTuple(\22\\u0000abcdefg\22: Int32)", align 8, !dbg !18
  br label %entry

entry:                                            ; preds = %alloca
  %1 = getelementptr inbounds %"NamedTuple(\22\\u0000abcdefg\22: Int32)", ptr %0, i32 0, i32 0, !dbg !18
  store i32 %__temp_1, ptr %1, align 4, !dbg !18
  %2 = load %"NamedTuple(\22\\u0000abcdefg\22: Int32)", ptr %0, align 4, !dbg !19
  store %"NamedTuple(\22\\u0000abcdefg\22: Int32)" %2, ptr %opts, align 4, !dbg !19
  ret void, !dbg !19
}

!17 = distinct !DISubprogram(name: "foo:\00abcdefg", linkageName: "foo:\00abcdefg", scope: !13, file: !13, line: 21, type: !6, scopeLine: 21, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition | DISPFlagOptimized, unit: !0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant