fix Issue 9387 - Compiler switch -O changes behavior of correct code