help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Optimization breaks program


From: Paul Schneider
Subject: Re: Optimization breaks program
Date: Wed, 28 Apr 2004 16:33:31 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.5) Gecko/20031007

Robert Heller wrote:
  Paul Schneider <paulibaer@uboot.com>,
  In a message on Wed, 28 Apr 2004 12:13:43 +0200, wrote :

PS> With optimization turned to O1, O2, or O3, I get segfaults with my PS> program. With no optimization everything runs fine. Is this a common PS> thing to happen?

Generally not.  Usually there is some *minor* programming error.

Common ones:

        Uninitialized variables (referenced before being set, often
pointers or indexes).

It interestingly occurs unexpectedly and not reproducably in my main loop (it is a numerical application). I put a lot of effort not to use any dynamic structures crafted by myself. The only thing I use pointerwise is a boost::shared_ptr.


        Sometimes the declaration of large (or just not trivial sized)
arrays as 'automatic' (local off the stack).  Change these to 'static'
storage class (still local).


I'm getting a st9bad_alloc, so this might be worthwhile trying.

Thanks,

Paul



reply via email to

[Prev in Thread] Current Thread [Next in Thread]