I have an app with a number of render targets/frame buffers and inside one call to glDrawElements it crashes on device ( iPad iOS 5.0) but not in simulator. This is a very shader intensive app with a dozen different shaders and thousands of vertex buffers.
Further debugging the matter turned me to believe that the crash occurs because of a particular shader, but the shader is valid and so is the frame buffer object that is being written to.
Ok, so after tons of time spent on debugging I found out that my Depth of field shader was causing the crash, particularly this function :
Basically the commented else there is causing my crash. Removing that made everything work. I put it back actually ( I was thinking it may be something else ), only to see that after a couple of shader recompilations the same crash appeared with the same fix, deleting the else.