From 4cb3f94820fe31de8f63a44c28d9542177cef3a0 Mon Sep 17 00:00:00 2001
From: tastytea <tastytea@tastytea.de>
Date: Mon, 19 Sep 2022 06:00:38 +0200
Subject: [PATCH] fix undefined behaviour when converting float to int *

---
 src/squirrel/squirrel/sqcompiler.cc | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/squirrel/squirrel/sqcompiler.cc b/src/squirrel/squirrel/sqcompiler.cc
index 774d9cfbe..eb1e4594a 100644
--- a/src/squirrel/squirrel/sqcompiler.cc
+++ b/src/squirrel/squirrel/sqcompiler.cc
@@ -893,7 +893,8 @@ public:
 			target = _fs->PushTarget();
 		}
 		if(sizeof(SQFloat) == sizeof(SQInt32)) {
-			_fs->AddInstruction(_OP_LOADFLOAT, target,*((SQInt32 *)&value));
+			SQInt32 *p = reinterpret_cast<SQInt32 *>(&value);
+			_fs->AddInstruction(_OP_LOADFLOAT, target, *p);
 		}
 		else {
 			_fs->AddInstruction(_OP_LOAD, target, _fs->GetNumericConstant(value));
-- 
2.35.1

