miscompile: miscompile rv64: addi,andi,li,lui,sb

Run:explore-db12fc36f6-20261127-115111
Kind:miscompile
Category:miscompile rv64: addi,andi,li,lui,sb NEW M
Occurrences:1 in 1 configs, 1 test files
Snippet from:elf-preemption.ec51d63f0f.ll (mutant of elf-preemption.ll) @preemptable_func via full input
Config:-mtriple=riscv64 -relocation-model=static -O0 -verify-machineinstrs
Local check:reproduces at db12fc36f6
Compiler Explorer:not applicable: Compiler Explorer compiles RISC-V but cannot run it

Snippet:

; ModuleID = '<stdin>'
source_filename = "<stdin>"

@preemptable_var = global i32 42
@dsolocal_var = dso_local global i32 42
@weak_dsolocal_var = weak dso_local global i32 42
@hidden_var = hidden global i32 42
@protected_var = protected global i32 42
@G = global i128 42
@G.1 = global i1 true

; Function Attrs: nounwind
define ptr @get_preemptable_var() #0 {
  %B = xor i1 false, true
  store i1 %B, ptr poison, align 1
  ret ptr @preemptable_var
}

; Function Attrs: nounwind
declare ptr @get_dsolocal_var() #0

; Function Attrs: nounwind
declare ptr @get_weak_dsolocal_var() #0

; Function Attrs: nounwind
declare ptr @get_hidden_var() #0

; Function Attrs: nounwind
define ptr @get_protected_var() #0 {
  %LGV1 = load i128, ptr @G, align 4
  %C = icmp uge i128 170141183460469231731687303715884105727, %LGV1
  store i1 %C, ptr @G.1, align 1
  ret ptr @protected_var
}

; Function Attrs: nounwind
define ptr @preemptable_func() #0 {
  %C = icmp eq i32 0, -1
  store i1 %C, ptr @G.1, align 1
  ret ptr @preemptable_func
}

; Function Attrs: nounwind
declare dso_local ptr @dsolocal_func() #0

; Function Attrs: nounwind
declare dso_local ptr @weak_dsolocal_func() #0

; Function Attrs: nounwind
declare dso_local void @call_dsolocal_func() #0

attributes #0 = { nounwind }

Reproduce:

./exec_oracle.py --flags '-mtriple=riscv64 -relocation-model=static -O0 -verify-machineinstrs' --funcs preemptable_func snippet.ll

Local execution result:

64 of 64 inputs differ (first: #0)
SelectionDAG hash b5e9b517a754d0c1, GlobalISel hash 8266fdb53479141e
b0: llc -mtriple=riscv64 -relocation-model=static -verify-machineinstrs -O0 -global-isel=0
b1: llc -mtriple=riscv64 -relocation-model=static -verify-machineinstrs -O2 -global-isel=0
b2: llc -mtriple=riscv64 -relocation-model=static -verify-machineinstrs -O0 -global-isel -global-isel-abort=2

Occurrences (1):

InputFunctionConfig
elf-preemption.ec51d63f0f.ll (mutant of elf-preemption.ll)preemptable_func-mtriple=riscv64 -relocation-model=static -O0 -verify-machineinstrs

Generated 2026-11-29 14:49 UTC.