Fix tests for #25653
Omitting optimization means the reproducer never triggers. This was not caught, because the fix was applied before the test. The test should always be introduced first and CI executed to see if the reproducer triggers.
Edited by Julian Ospald