AES Code failure when optimized for X86_64
## Summary <!-- Summarize the bug encountered concisely --> Attached code is an AES routine that creates an expanded key. It runs fine on macOS arm64. On Linux or macOS x86_64 it also runs fine when compiled with -O0 to -O1. When compiled for macOS/Linux x86_64 -O2 or higher the calculated expanded key is incorrect. ## System Information <!-- The more information are provided the easier it is to replicate the bug --> - **Operating system:** <!-- Windows, Linux (if possible, also name the distro), FreeBSD, Android, ... -->macOS, Linux - **Processor architecture:** <!-- x86, x86-64, ARM, AARCH64, AVR, RISC-V, PowerPC, ... -->x86_64 - **Compiler version:** <!-- 3.2, 3.2.2, 3.3, trunk, beta, ... (if possible, give also the git hash) -->trunk - **Device:** <!-- Computer, Tablet, Mobile, Amiga, Microcontroller, ... --> - Computer ## Steps to reproduce <!-- How one can reproduce the issue - this is very important! --> Compile and run attached code. When compiled with -O2 or greater the generated extended key is incorrect. ## Example Project <!-- If possible, please create an example project that exhibits the problematic behavior, and link to it here in the bug report. -->[AESOptTest.pas](/uploads/fd33cb739127a770a74dd2b789ac9ea2/AESOptTest.pas) ## What is the current bug behavior? <!-- What actually happens --> When compiled with -O2 or higher on x86_64 macOS/Linux it will print message "Bad Key" indicating that the calculated key does not match the expected result. ## What is the expected (correct) behavior? <!-- What you should see instead --> Should print out "Good Key" which means the calculated key matches the expected result. ## Relevant logs and/or screenshots <!-- Paste any relevant logs - please use code blocks (```) to format console output, logs, and code, as it's very hard to read otherwise. You can also use syntax highlighting for Pascal with: ```pascal the code``` For more information see https://docs.gitlab.com/ee/user/markdown.html --> ## Possible fixes <!-- If you can, link to the line of code that might be responsible for the problem -->
issue