How the hell do I debug this Segmentation fault?
===

Moving to a newer version of CC compiler, a segmentation fault in a module that used to work appeared.

## Observations so far: ##

 1. From the core file I could learn in what function the segmentation
    fault originated. When I observed the function I could not find
    anything suspicious.

 2. First major problem was that the seg fault reproduced only when compiling in "release" (optimizations turned on), and didn't reproduce on "debug". Also, the seg fault doesn't reproduce on g++.  

 3. Now I started to use printing, and a bigger problem appeared- when adding cout/printf (to binary search the seg fault line/print the value of pointers) to certain lines in the code, the seg fault didn't reproduce.  Moreover, I put a cout in a certain line in the code that maintained the seg fault, which supposedly means that the seg fault happens before that line. Commenting lines **after** that line made the seg fault go away.



I file like this screams memory corruption (specifically of the stack), but I have no idea on how to advance on this without looking at the generated assembly.  

**Any ideas?** thanks in advance.

I'm working on SunOS_5.10_Studio_12_5.12_64, CC version "Sun C++ 5.12 SunOS_sparc 2011/11/16"