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

DESERIALIZATION FAILURE: result not found (__synthesizedBaseCall_operatorCall) #78119

Open
hjyamauchi opened this issue Dec 11, 2024 · 1 comment
Assignees
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. crash Bug: A crash, i.e., an abnormal termination of software triage needed This issue needs more specific labels

Comments

@hjyamauchi
Copy link
Contributor

Description

A compiler crash. See below for a reduced test that reproduces the crash.

7.      *** DESERIALIZATION FAILURE ***
*** If any module named here was modified in the SDK, please delete the ***
*** new swiftmodule files from the SDK and keep only swiftinterfaces.   ***
module 'CxxStdlib', builder version '6.2(5.10)/compnerd.org Swift version 6.2-dev (LLVM 4930d5a55e7728b, Swift b36b2b8c3a6ce52)', built from swiftinterface against SDK , resilient, loaded from 'C:\Users\hiroshi\AppData\Local\clang\ModuleCache\CxxStdlib-L2GM549N0WR5.swiftmodule'
result not found (__synthesizedBaseCall_operatorCall)
Cross-reference to module '__ObjC'
... std
... hash
... (in c:@N@std@S@hash>#$@N@std@S@basic_string>#C#$@N@std@S@char_traits>#C#$@N@std@S@allocator>#C)
... __synthesizedBaseCall_operatorCall
... with type (std.hash<basic_string<CChar, char_traits<CChar>, allocator<CChar>>>) -> (std.basic_string<CChar, char_traits<CChar>, allocator<CChar>>) -> Int

Reproduction

C:\Users\hiroshi\deserial>ls
Test.swift  include

C:\Users\hiroshi\deserial>cat Test.swift
import cxx

func foo() -> Any? {
  let item = get_item()
  return Dictionary(uniqueKeysWithValues: zip(item.keys, item.values).lazy)
}

C:\Users\hiroshi\deserial>cat include\module.modulemap
module cxx {
  requires cplusplus
  header "header.h"
  export *
}



C:\Users\hiroshi\deserial>cat include\header.h
#include <string>
#include <vector>

struct Item {
  std::vector<std::string> keys;
  std::vector<std::string> values;
};

inline Item get_item() {
  return {};
}
C:\Users\hiroshi\deserial>swiftc.exe Test.swift -cxx-interoperability-mode=default -O -I C:\Users\hiroshi\deserial\include
error: compile command failed due to exception 3 (use -v to see invocation)
Please submit a bug report (https://swift.org/contributing/#reporting-bugs) and include the crash backtrace.
Stack dump:
0.      Program arguments: C:\\Users\\hiroshi\\AppData\\Local\\Programs\\Swift\\Toolchains\\0.0.0+Asserts\\usr\\bin\\swift-frontend.exe -frontend -c -primary-file Test.swift -target x86_64-unknown-windows-msvc -disable-objc-interop -cxx-interoperability-mode=default -sdk C:\\Users\\hiroshi\\AppData\\Local\\Programs\\Swift\\Platforms\\0.0.0\\Windows.platform\\Developer\\SDKs\\Windows.sdk\\ -I C:\\Users\\hiroshi\\deserial\\include -color-diagnostics -O -empty-abi-descriptor -resource-dir C:\\Users\\hiroshi\\AppData\\Local\\Programs\\Swift\\Toolchains\\0.0.0+Asserts\\usr\\lib\\swift -module-name Test -in-process-plugin-server-path C:\\Users\\hiroshi\\AppData\\Local\\Programs\\Swift\\Toolchains\\0.0.0+Asserts\\usr\\bin\\SwiftInProcPluginServer.dll -plugin-path C:\\Users\\hiroshi\\AppData\\Local\\Programs\\Swift\\Toolchains\\0.0.0+Asserts\\usr\\bin -plugin-path C:\\Users\\hiroshi\\AppData\\Local\\Programs\\Swift\\Toolchains\\0.0.0+Asserts\\usr\\local\\bin -enable-default-cmo -o C:\\Users\\hiroshi\\AppData\\Local\\Temp\\TemporaryDirectory.2UJtfY\\Test-1.o
1.      compnerd.org Swift version 6.2-dev (LLVM 4930d5a55e7728b, Swift b36b2b8c3a6ce52)
2.      Compiling with effective version 5.10
3.      While evaluating request ExecuteSILPipelineRequest(Run pipelines { PrepareOptimizationPasses, EarlyModulePasses, HighLevel,Function+EarlyLoopOpt, HighLevel,Module+StackPromote, MidLevel,Function, ClosureSpecialize, LowLevel,Function, LateLoopOpt, SIL Debug Info Generator } on SIL for Test)
4.      While running pass #7538 SILFunctionTransform "Devirtualizer" on SILFunction "@$ss17_NativeDictionaryV16_unsafeInsertNew3key5valueyxn_q_ntFSo3stdO0071basic_stringCCharchar_traitsCCharallocatorCChar_mHGHsqaGJcraCCfsaqChraaV_AITg5".
 for <<debugloc at "<compiler-generated>":0:0>>5.       While deserializing SIL function "$sSo3stdO0071basic_stringCCharchar_traitsCCharallocatorCChar_mHGHsqaGJcraCCfsaqChraaVSH9CxxStdlibSH4hash4intoys6HasherVz_tFTW"
6.      While deserializing SIL function "?__synthesizedBaseCall_operatorCall@?$hash@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@std@@QEBA_KAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@@Z"
7.      *** DESERIALIZATION FAILURE ***
*** If any module named here was modified in the SDK, please delete the ***
*** new swiftmodule files from the SDK and keep only swiftinterfaces.   ***
module 'CxxStdlib', builder version '6.2(5.10)/compnerd.org Swift version 6.2-dev (LLVM 4930d5a55e7728b, Swift b36b2b8c3a6ce52)', built from swiftinterface against SDK , resilient, loaded from 'C:\Users\hiroshi\AppData\Local\clang\ModuleCache\CxxStdlib-L2GM549N0WR5.swiftmodule'
result not found (__synthesizedBaseCall_operatorCall)
Cross-reference to module '__ObjC'
... std
... hash
... (in c:@N@std@S@hash>#$@N@std@S@basic_string>#C#$@N@std@S@char_traits>#C#$@N@std@S@allocator>#C)
... __synthesizedBaseCall_operatorCall
... with type (std.hash<basic_string<CChar, char_traits<CChar>, allocator<CChar>>>) -> (std.basic_string<CChar, char_traits<CChar>, allocator<CChar>>) -> Int

Stack dump

Exception Code: 0x80000003
 #0 0x00007ff746d50255 (C:\Users\hiroshi\AppData\Local\Programs\Swift\Toolchains\0.0.0+Asserts\usr\bin\swift-frontend.exe+0x6a10255)
 #1 0x00007ffdf707e6d5 (C:\Windows\System32\ucrtbase.dll+0x7e6d5)
 #2 0x00007ffdf707f6e1 (C:\Windows\System32\ucrtbase.dll+0x7f6e1)
 #3 0x00007ff74181b376 (C:\Users\hiroshi\AppData\Local\Programs\Swift\Toolchains\0.0.0+Asserts\usr\bin\swift-frontend.exe+0x14db376)
 #4 0x00007ff741926683 (C:\Users\hiroshi\AppData\Local\Programs\Swift\Toolchains\0.0.0+Asserts\usr\bin\swift-frontend.exe+0x15e6683)
 #5 0x00007ff74192689e (C:\Users\hiroshi\AppData\Local\Programs\Swift\Toolchains\0.0.0+Asserts\usr\bin\swift-frontend.exe+0x15e689e)
 #6 0x00007ff74192a0cb (C:\Users\hiroshi\AppData\Local\Programs\Swift\Toolchains\0.0.0+Asserts\usr\bin\swift-frontend.exe+0x15ea0cb)
 #7 0x00007ff7418d45ba (C:\Users\hiroshi\AppData\Local\Programs\Swift\Toolchains\0.0.0+Asserts\usr\bin\swift-frontend.exe+0x15945ba)
 #8 0x00007ff7418ca80a (C:\Users\hiroshi\AppData\Local\Programs\Swift\Toolchains\0.0.0+Asserts\usr\bin\swift-frontend.exe+0x158a80a)
 #9 0x00007ff7418dbd06 (C:\Users\hiroshi\AppData\Local\Programs\Swift\Toolchains\0.0.0+Asserts\usr\bin\swift-frontend.exe+0x159bd06)
#10 0x00007ff7418d545b (C:\Users\hiroshi\AppData\Local\Programs\Swift\Toolchains\0.0.0+Asserts\usr\bin\swift-frontend.exe+0x159545b)
#11 0x00007ff7418cd2b6 (C:\Users\hiroshi\AppData\Local\Programs\Swift\Toolchains\0.0.0+Asserts\usr\bin\swift-frontend.exe+0x158d2b6)
#12 0x00007ff74188f17f (C:\Users\hiroshi\AppData\Local\Programs\Swift\Toolchains\0.0.0+Asserts\usr\bin\swift-frontend.exe+0x154f17f)
#13 0x00007ff741b85268 (C:\Users\hiroshi\AppData\Local\Programs\Swift\Toolchains\0.0.0+Asserts\usr\bin\swift-frontend.exe+0x1845268)
#14 0x00007ff741b856f3 (C:\Users\hiroshi\AppData\Local\Programs\Swift\Toolchains\0.0.0+Asserts\usr\bin\swift-frontend.exe+0x18456f3)
#15 0x00007ff741b86b88 (C:\Users\hiroshi\AppData\Local\Programs\Swift\Toolchains\0.0.0+Asserts\usr\bin\swift-frontend.exe+0x1846b88)
#16 0x00007ff741b85ba1 (C:\Users\hiroshi\AppData\Local\Programs\Swift\Toolchains\0.0.0+Asserts\usr\bin\swift-frontend.exe+0x1845ba1)
#17 0x00007ff7419873e7 (C:\Users\hiroshi\AppData\Local\Programs\Swift\Toolchains\0.0.0+Asserts\usr\bin\swift-frontend.exe+0x16473e7)
#18 0x00007ff741b329b1 (C:\Users\hiroshi\AppData\Local\Programs\Swift\Toolchains\0.0.0+Asserts\usr\bin\swift-frontend.exe+0x17f29b1)
#19 0x00007ff7415d0286 (C:\Users\hiroshi\AppData\Local\Programs\Swift\Toolchains\0.0.0+Asserts\usr\bin\swift-frontend.exe+0x1290286)
#20 0x00007ff7415d5fc6 (C:\Users\hiroshi\AppData\Local\Programs\Swift\Toolchains\0.0.0+Asserts\usr\bin\swift-frontend.exe+0x1295fc6)
#21 0x00007ff74140c854 (C:\Users\hiroshi\AppData\Local\Programs\Swift\Toolchains\0.0.0+Asserts\usr\bin\swift-frontend.exe+0x10cc854)
#22 0x00007ff74140ceea (C:\Users\hiroshi\AppData\Local\Programs\Swift\Toolchains\0.0.0+Asserts\usr\bin\swift-frontend.exe+0x10cceea)
#23 0x00007ff7411c9f6d (C:\Users\hiroshi\AppData\Local\Programs\Swift\Toolchains\0.0.0+Asserts\usr\bin\swift-frontend.exe+0xe89f6d)
#24 0x00007ff7411c91d7 (C:\Users\hiroshi\AppData\Local\Programs\Swift\Toolchains\0.0.0+Asserts\usr\bin\swift-frontend.exe+0xe891d7)
#25 0x00007ff7411c28c7 (C:\Users\hiroshi\AppData\Local\Programs\Swift\Toolchains\0.0.0+Asserts\usr\bin\swift-frontend.exe+0xe828c7)
#26 0x00007ff7411c2b99 (C:\Users\hiroshi\AppData\Local\Programs\Swift\Toolchains\0.0.0+Asserts\usr\bin\swift-frontend.exe+0xe82b99)
#27 0x00007ff7411c25b7 (C:\Users\hiroshi\AppData\Local\Programs\Swift\Toolchains\0.0.0+Asserts\usr\bin\swift-frontend.exe+0xe825b7)
#28 0x00007ff7412193ad (C:\Users\hiroshi\AppData\Local\Programs\Swift\Toolchains\0.0.0+Asserts\usr\bin\swift-frontend.exe+0xed93ad)
#29 0x00007ff7411ba240 (C:\Users\hiroshi\AppData\Local\Programs\Swift\Toolchains\0.0.0+Asserts\usr\bin\swift-frontend.exe+0xe7a240)
#30 0x00007ff7411c2c4a (C:\Users\hiroshi\AppData\Local\Programs\Swift\Toolchains\0.0.0+Asserts\usr\bin\swift-frontend.exe+0xe82c4a)
#31 0x00007ff7411abda5 (C:\Users\hiroshi\AppData\Local\Programs\Swift\Toolchains\0.0.0+Asserts\usr\bin\swift-frontend.exe+0xe6bda5)
#32 0x00007ff740bb16b5 (C:\Users\hiroshi\AppData\Local\Programs\Swift\Toolchains\0.0.0+Asserts\usr\bin\swift-frontend.exe+0x8716b5)
#33 0x00007ff74092705d (C:\Users\hiroshi\AppData\Local\Programs\Swift\Toolchains\0.0.0+Asserts\usr\bin\swift-frontend.exe+0x5e705d)
#34 0x00007ff740927b3f (C:\Users\hiroshi\AppData\Local\Programs\Swift\Toolchains\0.0.0+Asserts\usr\bin\swift-frontend.exe+0x5e7b3f)
#35 0x00007ff7409267c7 (C:\Users\hiroshi\AppData\Local\Programs\Swift\Toolchains\0.0.0+Asserts\usr\bin\swift-frontend.exe+0x5e67c7)
#36 0x00007ff740926d5b (C:\Users\hiroshi\AppData\Local\Programs\Swift\Toolchains\0.0.0+Asserts\usr\bin\swift-frontend.exe+0x5e6d5b)
#37 0x00007ff740928ae5 (C:\Users\hiroshi\AppData\Local\Programs\Swift\Toolchains\0.0.0+Asserts\usr\bin\swift-frontend.exe+0x5e8ae5)
#38 0x00007ff740779110 (C:\Users\hiroshi\AppData\Local\Programs\Swift\Toolchains\0.0.0+Asserts\usr\bin\swift-frontend.exe+0x439110)
#39 0x00007ff740778cb3 (C:\Users\hiroshi\AppData\Local\Programs\Swift\Toolchains\0.0.0+Asserts\usr\bin\swift-frontend.exe+0x438cb3)
#40 0x00007ff746dadf9c (C:\Users\hiroshi\AppData\Local\Programs\Swift\Toolchains\0.0.0+Asserts\usr\bin\swift-frontend.exe+0x6a6df9c)
#41 0x00007ffdf8d7259d (C:\Windows\System32\KERNEL32.DLL+0x1259d)
#42 0x00007ffdf99caf38 (C:\Windows\SYSTEM32\ntdll.dll+0x5af38)

Expected behavior

No crash

Environment

At head in the main branch

Additional information

No response

@hjyamauchi hjyamauchi added bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. crash Bug: A crash, i.e., an abnormal termination of software triage needed This issue needs more specific labels labels Dec 11, 2024
@hyp
Copy link
Contributor

hyp commented Dec 11, 2024

@hyp <-- attempting to fix

@hyp hyp self-assigned this Dec 11, 2024
hyp added a commit that referenced this issue Dec 13, 2024
…her platforms

The PR #77857 added windows-specific workaround for #77856, that happened after #77843. Unfortunately this caused a new issue on windows - #78119. It looks like windows is suffering from a similar serialization issue as libstdc++, although its even more complex as the callAsFunction is not only a derived function from a base class, the base class although has a static call operator. In any case, the libstdc++ callAsFunction deserialization fix should align with the static operator () deserialization too, so for now make windows use the same workaround as other platforms to avoid the deserialization crash (77856).

This change was tested on i686 windows too, ensuring that IR verifier crash no longer happens
hyp added a commit that referenced this issue Dec 13, 2024
…her platforms

The PR #77857 added windows-specific workaround for #77856, that happened after #77843. Unfortunately this caused a new issue on windows - #78119. It looks like windows is suffering from a similar serialization issue as libstdc++, although its even more complex as the callAsFunction is not only a derived function from a base class, the base class although has a static call operator. In any case, the libstdc++ callAsFunction deserialization fix should align with the static operator () deserialization too, so for now make windows use the same workaround as other platforms to avoid the deserialization crash (77856).

This change was tested on i686 windows too, ensuring that IR verifier crash no longer happens
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. crash Bug: A crash, i.e., an abnormal termination of software triage needed This issue needs more specific labels
Projects
None yet
Development

No branches or pull requests

2 participants