Mono AOT compiler crashes with: condition `p - buf < buf_size' not met
@BrzVlad is already working on this.
Since Aug 23, 2025.
Assessment
This issue has not been assessed yet.
Description
Description
Crash when AOT-compiling my code.
Reproduction Steps
Clone https://github.com/rolfbjarne/bug-repros and run ./2025-02-24-mono-aot-crash/repro.sh:
$ ./2025-02-24-mono-aot-crash/repro.sh
++ dirname ./2025-02-24-mono-aot-crash/repro.sh
+ cd ./2025-02-24-mono-aot-crash
+ /usr/local/share/dotnet/packs/Microsoft.NETCore.App.Runtime.AOT.osx-arm64.Cross.maccatalyst-arm64/9.0.0/Sdk/../tools/mono-aot-cross --path=./linked --aot=mtriple=arm64-apple-ios15.0-macabi,data-outfile=./monotouchtest.aotdata,static,asmonly,dedup-skip,direct-icalls,full,soft-debug,dwarfdebug,no-direct-calls,outfile=./monotouchtest.dll.s --debug -O=gsharedvt ./linked/monotouchtest.dll
Mono Ahead of Time compiler - compiling assembly [...]/bug-repros/2025-02-24-mono-aot-crash/linked/monotouchtest.dll
AOTID 1085CE5E-EB01-C3CC-909A-0C25AB930848
* Assertion at /Users/runner/work/1/s/src/mono/mono/mini/aot-compiler.c:8037, condition `p - buf < buf_size' not met
./2025-02-24-mono-aot-crash/repro.sh: line 9: 96539 Abort trap: 6 /usr/local/share/dotnet/packs/Microsoft.NETCore.App.Runtime.AOT.osx-arm64.Cross.maccatalyst-arm64/9.0.0/Sdk/../tools/mono-aot-cross --path=./linked --aot=mtriple=arm64-apple-ios15.0-macabi,data-outfile=./monotouchtest.aotdata,static,asmonly,dedup-skip,direct-icalls,full,soft-debug,dwarfdebug,no-direct-calls,outfile=./monotouchtest.dll.s --debug -O=gsharedvt ./linked/monotouchtest.dll
Note: you'll probably have to adjust the path to the mono-aot-cross binary in the script.
Expected behavior
No crash.
Actual behavior
Crash.
Crash report: https://github.com/rolfbjarne/bug-repros/blob/main/2025-02-24-mono-aot-crash/mono-aot-cross-2025-02-24-101943.txt
Regression?
No, this happened as I was adding code to a test project. Removing the new code fixes the crash.
Known Workarounds
No
Configuration
$ dotnet --info
.NET SDK:
Version: 9.0.103
Commit: 049799c39d
Workload version: 9.0.101.2
MSBuild version: 17.12.21+f7f4b086d
Runtime Environment:
OS Name: Mac OS X
OS Version: 14.7
OS Platform: Darwin
RID: osx-arm64
Base Path: /usr/local/share/dotnet/sdk/9.0.103/
.NET workloads installed:
[macos]
Installation Source: SDK 9.0.100
Manifest Version: 15.2.9170/9.0.100
Manifest Path: /usr/local/share/dotnet/sdk-manifests/9.0.100/microsoft.net.sdk.macos/15.2.9170/WorkloadManifest.json
Install Type: FileBased
[maui-ios]
Installation Source: SDK 9.0.100
Manifest Version: 9.0.0/9.0.100
Manifest Path: /usr/local/share/dotnet/sdk-manifests/9.0.100/microsoft.net.sdk.maui/9.0.0/WorkloadManifest.json
Install Type: FileBased
[ios]
Installation Source: SDK 9.0.100
Manifest Version: 18.2.9170/9.0.100
Manifest Path: /usr/local/share/dotnet/sdk-manifests/9.0.100/microsoft.net.sdk.ios/18.2.9170/WorkloadManifest.json
Install Type: FileBased
[maccatalyst]
Installation Source: SDK 9.0.100
Manifest Version: 18.2.9170/9.0.100
Manifest Path: /usr/local/share/dotnet/sdk-manifests/9.0.100/microsoft.net.sdk.maccatalyst/18.2.9170/WorkloadManifest.json
Install Type: FileBased
[maui]
Installation Source: SDK 9.0.100
Manifest Version: 9.0.0/9.0.100
Manifest Path: /usr/local/share/dotnet/sdk-manifests/9.0.100/microsoft.net.sdk.maui/9.0.0/WorkloadManifest.json
Install Type: FileBased
[tvos]
Installation Source: SDK 9.0.100
Manifest Version: 18.2.9170/9.0.100
Manifest Path: /usr/local/share/dotnet/sdk-manifests/9.0.100/microsoft.net.sdk.tvos/18.2.9170/WorkloadManifest.json
Install Type: FileBased
[android]
Installation Source: SDK 9.0.100
Manifest Version: 35.0.24/9.0.100
Manifest Path: /usr/local/share/dotnet/sdk-manifests/9.0.100/microsoft.net.sdk.android/35.0.24/WorkloadManifest.json
Install Type: FileBased
Configured to use workload sets when installing new manifests.
Host:
Version: 9.0.1
Architecture: arm64
Commit: c8acea2262
.NET SDKs installed:
7.0.410 [/usr/local/share/dotnet/sdk]
8.0.304 [/usr/local/share/dotnet/sdk]
8.0.402 [/usr/local/share/dotnet/sdk]
9.0.100 [/usr/local/share/dotnet/sdk]
9.0.102 [/usr/local/share/dotnet/sdk]
9.0.103 [/usr/local/share/dotnet/sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 7.0.20 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 8.0.8 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 9.0.0-rc.2.24474.3 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 9.0.0 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 9.0.1 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.36 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 7.0.20 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.8 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 9.0.0 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 9.0.1 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Other architectures found:
None
Environment variables:
Not set
global.json file:
/Users/rolf/work/dotnet/macios/main/macios/global.json
Learn more:
https://aka.ms/dotnet/info
Download .NET:
https://aka.ms/dotnet/download
Other information
No response
- Dominant language
- C#
- Stars
- 18.3k
- Forks
- 5.6k
- PR merge metrics
- PR metrics pending
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from dotnet/runtime
-
agentic-workflows untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
area-System.Reflection blocking-clean-ci-optional Known Build Error os-mac-os-x untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
area-CodeGen-coreclr untriaged
Difficulty 1/5 Under an hour Newbie friendliness 92/100
-
agentic-workflows untriaged
Difficulty 1/5 Under an hour Newbie friendliness 78/100
-
area-VM-meta-mono untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
-
:watch: Not Triaged 11.0 fundamentals/subsvc
Difficulty 2/5 1-3 hours Newbie friendliness 92/100
dotnet/AspNetCore.Docs#37699 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
SubtitleEdit/subtitleedit#15108 · 1 comment ·
-
area/docs-content Bug pulumi/docs
Difficulty 1/5 1-3 hours Newbie friendliness 94/100
-
Create parent directories only after the containment check in InstallHelper.TryExtractToDirectory Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
PowerShell/PSResourceGet#2056 ·