miscompile: miscompile rv64: add,addi,ld,lui,lw,lwu

Run:explore-b577f07195-20261129-105236
Kind:miscompile
Category:miscompile rv64: add,addi,ld,lui,lw,lwu M
Occurrences:1 in 1 configs, 1 test files
Snippet from:memset-inline.a738fe63.eea2c2b3.8f0ba3a9.1164ab9de8.ll (mutant of memset-inline.a738fe63.eea2c2b3.8f0ba3a9.ll) @aligned_memset_zero_2 via full input
Config:-mtriple=riscv64 -verify-machineinstrs -mattr=+m,+v,+unaligned-vector-mem,+f,+c -O2
Local check:reproduces at b577f07195
Compiler Explorer:not applicable: Compiler Explorer compiles RISC-V but cannot run it

Snippet:

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

@G = global <4 x float> splat (float 1.000000e+00)
@G.2 = global <4 x i32> splat (i32 2147483647)
@G.3 = global <4 x i32> zeroinitializer
@G.1 = global i128 -1
@G.4 = global ptr poison
@G.5 = global i8 127
@G.6 = global i1 false
@G.7 = global i128 170141183460469231731687303715884105727
@G.8 = global <4 x i1> splat (i1 true)
@G.9 = global i32 -1
@G.10 = global <4 x i32> splat (i32 42)

; Function Attrs: nounwind
declare void @memset_1(ptr, i8) #0

; Function Attrs: nounwind
declare void @memset_2(ptr, i8) #0

; Function Attrs: nounwind
declare void @memset_4(ptr, i8) #0

; Function Attrs: nounwind
declare void @memset_8(ptr, i8) #0

; Function Attrs: nounwind
declare void @memset_16(ptr, i8) #0

; Function Attrs: nounwind
declare void @memset_32(ptr, i8) #0

; Function Attrs: nounwind
declare void @memset_64(ptr, i8) #0

; Function Attrs: nounwind
declare void @aligned_memset_2(ptr align 2, i8) #0

; Function Attrs: nounwind
declare void @aligned_memset_4(ptr align 4, i8) #0

; Function Attrs: nounwind
declare void @aligned_memset_8(ptr align 8, i8) #0

; Function Attrs: nounwind
declare void @aligned_memset_16(ptr align 16, i8) #0

; Function Attrs: nounwind
declare void @aligned_memset_32(ptr align 32, i8) #0

; Function Attrs: nounwind
declare void @aligned_memset_64(ptr align 64, i8) #0

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

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

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

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

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

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

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

; Function Attrs: nounwind
define void @aligned_memset_zero_2(ptr %a) #0 {
  %LGV2 = load i32, ptr @G.9, align 4
  %G1 = getelementptr ptr, ptr %a, i16 -1
  %LGV = load i128, ptr @G.1, align 4
  %G = getelementptr ptr, ptr %a, i128 %LGV
  %E = extractelement <8 x i8> splat (i8 -1), i8 -1
  tail call void @llvm.memset.inline.p0.i64(ptr align 2 %a, i8 %E, i64 2, i1 false)
  %I = insertelement <4 x i32> splat (i32 65536), i32 %LGV2, i64 0
  store ptr %G, ptr @G.4, align 8
  store ptr %G1, ptr %G, align 8
  store <4 x i32> %I, ptr @G.10, align 16
  ret void
}

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

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

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

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

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

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

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

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

; Function Attrs: nounwind
define void @aligned_memset_zero_256(ptr %a) #0 {
  %LGV1 = load i128, ptr @G.7, align 4
  %G = getelementptr ptr, ptr %a, i128 %LGV1
  %G1 = getelementptr i128, ptr %G, i128 %LGV1
  %B = fsub <4 x float> splat (float 1.000000e+00), splat (float 1.000000e+00)
  tail call void %G(ptr align 64 %a, i8 0, i64 256, i1 false)
  store <4 x float> %B, ptr @G, align 16
  %G2 = getelementptr ptr, ptr %a, i128 %LGV1
  store ptr %G1, ptr %G2, align 8
  ret void
}

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: write)
declare void @llvm.memset.inline.p0.i64(ptr writeonly captures(none), i8, i64, i1 immarg) #1

attributes #0 = { nounwind }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: write) }

Reproduce:

./exec_oracle.py --flags '-mtriple=riscv64 -verify-machineinstrs -mattr=+m,+v,+unaligned-vector-mem,+f,+c -O2' --funcs aligned_memset_zero_2 snippet.ll

Local execution result:

64 of 64 inputs differ (first: #0)
SelectionDAG hash c6068328bf1585d7, GlobalISel hash f99b0a0cb41e452f
b0: llc -mtriple=riscv64 -verify-machineinstrs -mattr=+m,+v,+unaligned-vector-mem,+f,+c -O2 -global-isel=0
b1: llc -mtriple=riscv64 -verify-machineinstrs -mattr=+m,+v,+unaligned-vector-mem,+f,+c -O0 -global-isel=0
b2: llc -mtriple=riscv64 -verify-machineinstrs -mattr=+m,+v,+unaligned-vector-mem,+f,+c -O2 -global-isel -global-isel-abort=2

Occurrences (1):

InputFunctionConfig
memset-inline.a738fe63.eea2c2b3.8f0ba3a9.1164ab9de8.ll (mutant of memset-inline.a738fe63.eea2c2b3.8f0ba3a9.ll)aligned_memset_zero_2-mtriple=riscv64 -verify-machineinstrs -mattr=+m,+v,+unaligned-vector-mem,+f,+c -O2

Generated 2026-11-29 14:49 UTC.