Fix Issue 12164 - Function returning ptrdiff_t.min in 64-bit returning 0 when -O is set

The trick used to optimize ?const:const doesn't work when you can't actually express the value as immediates.  They were silently truncated leading to incorrect results.

Values were also truncated due to a typo.
Merge pull request #3805 from yebblies/issue12164

Fix Issue 12164 - Function returning ptrdiff_t.min in 64-bit returning 0 when -O is set