Declare variables before first goto
Merge remote-tracking branch 'upstream/cuda-error-handling'