Hello,

I've found a way to turn off optimisation for a function.
This seems to work, the time output shows.

Qt Code:
  1. #pragma GCC push_options
  2. #pragma GCC optimize ("O0") //capital 0 - zero
  3. void MainWindow::f4(int n, int arr[], int size) {
  4. int k;
  5. for (int j = 0; j < n; j++)
  6. {
  7. for (int i = 0; i <= size - 1; i++)
  8. {
  9. k = arr[i]; //ok
  10. //qDebug() << k << i << j;
  11. }
  12. }
  13. }
  14. #pragma GCC pop_options
To copy to clipboard, switch view to plain text mode 
Regards