From f2f39d4aaadcefb1a20c4fe6d8202f82b58b1ba8 Mon Sep 17 00:00:00 2001 From: Pierre Muller Date: Tue, 7 Jan 2025 14:40:09 +0000 Subject: [PATCH] Avoid wrong typecast by checking explictly that hp1 is indeed an instruction --- compiler/riscv/aoptcpurv.pas | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/riscv/aoptcpurv.pas b/compiler/riscv/aoptcpurv.pas index 0ccd53fa30..5418c18e69 100644 --- a/compiler/riscv/aoptcpurv.pas +++ b/compiler/riscv/aoptcpurv.pas @@ -262,7 +262,7 @@ implementation %reg3,%reg2,%reg2 ? } - if GetNextInstruction(p,hp1) and + if GetNextInstruction(p,hp1) and (hp1.typ=ait_instruction) and (((mvop=A_FSGNJ_S) and (taicpu(hp1).opcode in [A_FADD_S,A_FSUB_S,A_FMUL_S,A_FDIV_S,A_FSQRT_S, A_FNEG_S,A_FMADD_S,A_FMSUB_S,A_FNMSUB_S,A_FNMADD_S,A_FMIN_S,A_FMAX_S,A_FCVT_D_S, A_FEQ_S])) or