This is a common error that no developer misses. The good ones only once in their life ;-)
When a program runs in debug mode and refuses to run in release mode the cause of the error has to do with optimization.
In your loop you find
From the view of the compiler, dataready does not change within the for-loop and so the whole if-clause can be optimized-out and put right before the loop.
Because this is not what you want
Declare every global variable that gets changed in an interrupt handler as "volatile". This will instruct the compiler/optimizer not to remove accesses to that variable from loops etc.
In your case
volatile uint8 dataReady;
And another hint:
Use CY_ISR_PROTO(Yourhandler), CY_ISR(Yourhandler) and sr_1_StartEx(Yourhandler) to avoid making changes in a generated .c file. See "System Reference Guide" from Creator Help menu.
I will try to remember it. Now it works fine.
You are always welcome!