Re: gcc optimization changes results



nirnimesh@xxxxxxxxx wrote:
Not to rain on your parade, but a bug in GCC is less likely than a bug
in your application.


Whereas I totally understand that the bug is more likely to be in my
program than in gcc (or g++), I want to figure if out. How do I
proceed. Also, with optimizations turned off, my program produces
correct results every time. With -O1 or -O2, it does not.
I compile my prog with: "g++ -Wall" and it produces no warnings.

Nirnimesh


Try using pragma to turn optimization off for only portions of your
program until it starts working again. Then you'll have a better
idea where the problem is.

Alternatively knowing in what way it's wrong and what bits of code
are involved in the wrong behavior would help. Then you could single
step through the code to see where it goes wrong.
.