Instead of loading value and casting, cast pointer and load

Fix for #8042.  Changes code generation to cast a pointer and then load value (like Clang), instead of loading a value and then casting it.