I have here a specific code where gcc 4.8.2 generates wrong code, when optimizing with -O2.
The issue seems to be new in 4.8.2 as gcc 4.7.2 works fine.
I have attached a small example project (EX02_gcc_opt_issue.zip) showing the issue.
The testcase implements two flavours of the same function, hipBugTest_c() and hipBugTest_c1().
Both functions should return the same result, but hipBugTest_c1() fails when -O2 optimization is used.
Seems that the problem is related to register usage and signed/unsigned conversion.
See README.txt and src/main.cpp for the more details.
I ran the test on a T2080RDB eval system.
Original Attachment has been moved to: EX02_gcc_opt_issue.zip