Re: gcc optimization changes results



nirnimesh wrote:

Whereas I totally understand that the bug is more likely to be
in my program than in gcc (or g++), I want to figure it out.
How do I proceed?

It's a painful process ;-)

You need to discard as much code as you can, to find the
smallest program to exhibit the unexpected behavior.

Once you reach that point, you might see the problem. You can also
post it to Usenet for others to offer their advice.

Also, with optimizations turned off, my program produces
correct results every time. With -O1 or -O2, it does not.

I've been trying to build such a program :-)
.