Explorar o código

shader_jit_x64: Fix strict memory aliasing issues.

bunnei %!s(int64=10) %!d(string=hai) anos
pai
achega
135aec7bea
Modificáronse 1 ficheiros con 3 adicións e 1 borrados
  1. 3 1
      src/video_core/shader/shader_jit_x64.cpp

+ 3 - 1
src/video_core/shader/shader_jit_x64.cpp

@@ -741,7 +741,9 @@ void JitCompiler::Compile_Block(unsigned end) {
 void JitCompiler::Compile_NextInstr(unsigned* offset) {
     offset_ptr = offset;
 
-    Instruction instr = *(Instruction*)&g_state.vs.program_code[(*offset_ptr)++];
+    Instruction instr;
+    std::memcpy(&instr, &g_state.vs.program_code[(*offset_ptr)++], sizeof(Instruction));
+
     OpCode::Id opcode = instr.opcode.Value();
     auto instr_func = instr_table[static_cast<unsigned>(opcode)];