public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Chris Jefferson" <chris@bubblescope.net>
To: "James Gregory" <james.jrg@gmail.com>
Cc: gcc-help@gcc.gnu.org
Subject: Re: Including <iostream> affects whether or not program freezes?
Date: Wed, 09 Jul 2008 17:02:00 -0000	[thread overview]
Message-ID: <5cc6b04e0807090949g30d5aacckc170e6068093e5a4@mail.gmail.com> (raw)
In-Reply-To: <beb51c260807081931u75f058a5wa15c371dba05685d@mail.gmail.com>

2008/7/9 James Gregory <james.jrg@gmail.com>:
> 1. Compile with MSVC 7.1, no optimization: my program doesn't freeze
> 2. Compile with MSVC 7.1, with optimization: my program doesn't freeze
> 3. Compile with gcc 4.2.3 (Ubuntu 64 bit), no optimization: my program
> doesn't freeze
> 4. Compile with gcc 4.2.3 (Ubuntu 64 bit), with optimization: my
> program freezes in a particular function
> 5. Compile with gcc 4.2.3 (Ubuntu 64 bit), with optimization, and
> include <iostream> at the top of the file where the function which
> freezes is defined: my program doesn't freeze
>
> Debugging this is difficult.

While I could well be repeating what others say, my usual tools for
situations like this, which (touch wood) tend to get me out of it:

A) Turn on all warnings, and read what they say. I've found this kind
of thing can be caused by a missing return statement.
B) Turn on the debugging standard library, if you are using any of the
STL in your code.
C) Find the minimial set of optimisation flags you need to trigger
your problem (in particular if you can turn off inlining it will make
things easier). This makes the next stage easier.
D) Use valgrind and see what it comes up with.

The <iostream> problem sounds to me like your problem could well be
triggered by inlining, which is often very sensitive (at least in g++)
and can change from headers being included on occasion.


>
> James
>

  parent reply	other threads:[~2008-07-09 16:49 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-09  3:26 James Gregory
2008-07-09 12:03 ` Lionel B
2008-07-09 16:49   ` James Gregory
2008-07-09 18:08     ` Burlen Loring
2008-07-09 13:43 ` Andrew Bell
2008-07-09 14:35   ` Andrew Haley
2008-07-09 17:02 ` Chris Jefferson [this message]
2008-07-10 10:58   ` James Gregory
2008-08-05  6:45     ` Christoph Bartoschek
2008-08-05  9:31       ` James Gregory
2008-07-12 21:16   ` James Gregory
2008-07-12 21:05     ` James Gregory
2008-07-12 22:11     ` James Gregory

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5cc6b04e0807090949g30d5aacckc170e6068093e5a4@mail.gmail.com \
    --to=chris@bubblescope.net \
    --cc=gcc-help@gcc.gnu.org \
    --cc=james.jrg@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).