Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #13430

Re: Strange behaviour?

From Keith Thompson <kst-u@mib.org>
Newsgroups comp.lang.c
Subject Re: Strange behaviour?
Date 2011-11-15 14:33 -0800
Organization None to speak of
Message-ID <lnfwhp10ew.fsf@nuthaus.mib.org> (permalink)
References <ae447417-7ce0-420a-84be-620f6cbedf7d@p2g2000vbj.googlegroups.com> <slrnjc5gl6.1p3j.usenet-nospam@guild.seebs.net> <0c45cd5f-5093-4a67-8575-67d8bc85be55@p16g2000yqd.googlegroups.com>

Show all headers | View raw


dmjcunha <dmjcunha@gmail.com> writes:
> On Nov 15, 4:26 pm, Seebs <usenet-nos...@seebs.net> wrote:
>> On 2011-11-15, dmjcunha <dmjcu...@gmail.com> wrote:
>>
>> > $6 = 10    <-------------- here I don't understand. There was no
>> > computation with rmid and it changed strangely to 10.
>>
>> Turn off optimization when trying to debug stuff like this.  The
>> generated code is not necessarily doing everything in the order it was
>> written in.  For the compiler you're probably using, this is spelled
>> "-O0".
[...]>
> Strange, I tried "-O1" and the problem was solved.
> James Kuyper, thank you for the explanation.

If changing the optimization level changes the behavior of your code, it
probably indicates a bug in your code.  Most likely your program's
behavior is undefined.

-- 
Keith Thompson (The_Other_Keith) kst-u@mib.org  <http://www.ghoti.net/~kst>
"We must do something.  This is something.  Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"

Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Strange behaviour? dmjcunha <dmjcunha@gmail.com> - 2011-11-15 11:31 -0800
  Re: Strange behaviour? James Kuyper <jameskuyper@verizon.net> - 2011-11-15 14:43 -0500
  Re: Strange behaviour? Seebs <usenet-nospam@seebs.net> - 2011-11-15 19:26 +0000
    Re: Strange behaviour? dmjcunha <dmjcunha@gmail.com> - 2011-11-15 13:15 -0800
      Re: Strange behaviour? Keith Thompson <kst-u@mib.org> - 2011-11-15 14:33 -0800
      Re: Strange behaviour? Willem <willem@toad.stack.nl> - 2011-11-15 22:35 +0000
        Re: Strange behaviour? dmjcunha <dmjcunha@gmail.com> - 2011-11-16 03:37 -0800
          Re: Strange behaviour? Willem <willem@toad.stack.nl> - 2011-11-16 13:34 +0000
          Re: Strange behaviour? Nick Keighley <nick_keighley_nospam@hotmail.com> - 2011-11-16 06:07 -0800
  Re: Strange behaviour? Kenneth Brody <kenbrody@spamcop.net> - 2011-11-16 13:13 -0500
    Re: Strange behaviour? Kaz Kylheku <kaz@kylheku.com> - 2011-11-16 19:12 +0000
      Re: Strange behaviour? dmjcunha <dmjcunha@gmail.com> - 2011-11-16 13:14 -0800
        Re: Strange behaviour? Seebs <usenet-nospam@seebs.net> - 2011-11-16 22:18 +0000

csiph-web