Attached is a complete code sample which causes an "UNREACHABLE executed!" error when compiled on an AMD gpu (Tahiti, Catalyst 13.9, Windows 7 x64).
I've simplified it down to the part that is causing the error: the original kernel was much larger, and had many more math functions in the switch (sinh, tanh, log... etc). Only sin, cos and tan cause this error under these conditions. Additionally, I've run this code successfully on Intel's platform for both GPUs and CPUs, as well as AMD's platform for CPUs.
Finally it does not produce an error unless the compile time option "-cl-opt-disable" is used. Unfortunately I need to disable optimizations for another kernel I'm using (specifically MCW64X, found here). I plan on submitting more code for that bug tomorrow night, hopefully!
The code in question (SomeFunction) isn't even used in the kernel. This might explain why "-cl-opt-disable" is needed (otherwise dead code removal would cull it). I'm basically submitting this as a bug, but I would love to hear a solution: I was hoping make a run with my kernel this weekend.
Best wishes,
Ben