On 07/25/05 05:15 PM, Giovanni Bajo sat at the `puter and typed: > Louis LeBlanc <[EMAIL PROTECTED]> wrote: > > > The problem is I'm getting core dumps (SEGV) that appears to come from > > this code when I know it shouldn't be in the execution path. The code > > in question is switched on by a command line argument only, and the > > process is managed by a parent process that monitors and manages it's > > execution - reporting crashes and restarting it if necessary. > > Looks like a bug hidden in your code. Several things you could try: > > - valgrind > - GCC 4.0 with -fmudflap > - GCC 4.1 CVS with -fstack-protect
I've not gotten the chance to build with gcc4.0.1 yet (still building), but I've tried a couple other things with 3.3.6 that you might find interesting, maybe something will raise a flag. I added the -fstack-check switch to my makefile and recompiled with various optimizations. I was pretty surprised at the file sizes that showed up: No Optimization: -rwxr-xr-x 1 leblanc daemon 1128660 Jul 25 16:25 myprocess* Optimized with -O2 -rwxr-xr-x 1 leblanc daemon 1058228 Jul 25 17:36 myprocess* Optimized with -O3 -rwxr-xr-x 1 leblanc daemon 1129792 Jul 25 17:32 myprocess* I would have expected much different results. Shouldn't the file sizes be smaller (at least a little) with the -O3 switch? Maybe there's a loop unrolled to make it faster, resulting in a larger codebase? Anyway, the code that generated these files (identical between the three, except the compilation flags) appears to be hitting something with the optimizer that doesn't like my code. Those with optimization (the last 2) core on less than 50K transactions - both in calls to pthread_mutex_unlock(). I have verified that the mutex passed in is valid (it would have been locked and unlocked some 70K times before failing in my last test). The unoptimized version completed a 401,900 transaction test with no problem. All day, I've been playing with different things, BTW, all these executables were compiled with -ggdb -g3 -Wall. Thanks to everyone who sent ideas so far. Lou -- Louis LeBlanc [EMAIL PROTECTED] Fully Funded Hobbyist, KeySlapper Extrordinaire :þ http://www.keyslapper.net Ô¿Ô¬ Key fingerprint = C5E7 4762 F071 CE3B ED51 4FB8 AF85 A2FE 80C8 D9A2 Udall's Fourth Law: Any change or reform you make is going to have consequences you don't like.