From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20627 invoked by alias); 12 Jul 2008 21:05:52 -0000 Received: (qmail 20615 invoked by uid 22791); 12 Jul 2008 21:05:51 -0000 X-Spam-Check-By: sourceware.org Received: from fk-out-0910.google.com (HELO fk-out-0910.google.com) (209.85.128.187) by sourceware.org (qpsmtpd/0.31) with ESMTP; Sat, 12 Jul 2008 21:05:34 +0000 Received: by fk-out-0910.google.com with SMTP id 19so2127904fkr.8 for ; Sat, 12 Jul 2008 14:05:27 -0700 (PDT) Received: by 10.86.54.3 with SMTP id c3mr11994263fga.55.1215895103629; Sat, 12 Jul 2008 13:38:23 -0700 (PDT) Received: by 10.86.66.18 with HTTP; Sat, 12 Jul 2008 13:38:23 -0700 (PDT) Message-ID: Date: Sat, 12 Jul 2008 21:16:00 -0000 From: "James Gregory" To: "Chris Jefferson" Subject: Re: Including affects whether or not program freezes? Cc: gcc-help@gcc.gnu.org In-Reply-To: <5cc6b04e0807090949g30d5aacckc170e6068093e5a4@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <5cc6b04e0807090949g30d5aacckc170e6068093e5a4@mail.gmail.com> X-IsSubscribed: yes Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org X-SW-Source: 2008-07/txt/msg00162.txt.bz2 On Wed, Jul 9, 2008 at 5:49 PM, Chris Jefferson wrote: > 2008/7/9 James Gregory : >> 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 at the top of the file where the function which >> freezes is defined: my program doesn't freeze Chris Jefferson suggested I add the compiler flag "-fdump-tree-all". I did this for the build which included iostream and the one which didn't, produced a diff of the final code produced for the problematic source file between each version, cropped it a bit, and came up with the following. I don't understand assembler, but the header file inclusion has clearly changed the code gcc produces. The obvious differences are: 1. The existence of the line "-Invalid sum of incoming frequencies 873, should be 0" in the freezing version 2. The replacement of this in the version which freezes: - const unsigned char * this___l_iterthis__I___M_currentthis____.4618; - const unsigned char * this___l_iterthis__I___M_currentthis____.4617; - const unsigned char * this___l_iterthis__I___M_currentthis____.4616; to this in the version which doesn't: + unsigned char temp.4650; + unsigned char temp.4649; + unsigned char temp.4648; Can anyone tell me what is going on here? --- AIInterpreter.cpp.102t.final_cleanup 2008-07-12 21:21:37.000000000 +0100 +++ ../nofreeze/AIInterpreter.cpp.102t.final_cleanup 2008-07-12 21:23:33.000000000 +0100 bool AIInterpreter::is_group_like_this(int, int, bool, bool) (this, n_side, n_group, discount_dead, discount_our) { - int stat_value.4637; - const unsigned char * this___l_iterthis__I___M_currentthis____.4618; - const unsigned char * this___l_iterthis__I___M_currentthis____.4617; - const unsigned char * this___l_iterthis__I___M_currentthis____.4616; + int stat_value.4653; + unsigned char temp.4650; + unsigned char temp.4649; + unsigned char temp.4648; int give_group; int give_side; - struct Group_Base * D.100623; - bool D.100627; + struct Group_Base * D.100677; + bool D.100681; size_t __n; - struct Group_Base * D.100588; - const unsigned char * D.86283; - const unsigned char & D.86265; - unsigned char D.86266; - const unsigned char & D.86197; - unsigned char D.86198; - const unsigned char & D.86143; - unsigned char D.86144; + struct Group_Base * D.100642; + const unsigned char * D.86304; + const unsigned char & D.86286; + unsigned char D.86287; + const unsigned char * D.86270; + const unsigned char & D.86218; + unsigned char D.86219; + const unsigned char * D.86202; + const unsigned char & D.86164; + unsigned char D.86165; + const unsigned char * D.86148; size_t __n; - struct Side * D.86086; + struct Side * D.86107; int second_value; const unsigned char operator_type; int stat_value; - const unsigned char & D.68774; - unsigned char D.68755; - int D.68741; + const unsigned char & D.68792; + unsigned char D.68773; + int D.68759; : - D.100588 = operator-> (&((sides.D.66353._M_impl._M_start + (struct Side *) ((long unsigned int) n_side * 256))->groups.D.33422._M_impl._M_start + (struct Group *) ((long unsigned int) n_group * 16))->h_group); - if (D.100588->alive) goto ; else goto ; + D.100642 = operator-> (&((sides.D.66353._M_impl._M_start + (struct Side *) ((long unsigned int) n_side * 256))->groups.D.33422._M_impl._M_start + (struct Group *) ((long unsigned int) n_group * 16))->h_group); + if (D.100642->alive) goto ; else goto ; :; if (discount_dead) goto ; else goto ; @@ -6385,72 +6402,70 @@ :; __n = (long unsigned int) n_group; __n = (long unsigned int) n_side; - D.86086 = sides.D.66353._M_impl._M_start; - if ((*(((D.86086 + (struct Side *) ((long unsigned int) this->my_side * 256))->scanned_groups.D.34444._M_impl._M_start + (struct vector > *) (__n * 40))->D.67000._M_impl._M_start.D.26400._M_p + (_Bit_type *) ((__n >> 6) * 8)) & 1 << (int) ((unsigned int) __n & 63)) == 0) goto ; else goto ; + D.86107 = sides.D.66353._M_impl._M_start; + if ((*(((D.86107 + (struct Side *) ((long unsigned int) this->my_side * 256))->scanned_groups.D.34444._M_impl._M_start + (struct vector > *) (__n * 40))->D.67000._M_impl._M_start.D.26400._M_p + (_Bit_type *) ((__n >> 6) * 8)) & 1 << (int) ((unsigned int) __n & 63)) == 0) goto ; else goto ; :; - D.100623 = operator-> (&((D.86086 + (struct Side *) (__n * 256))->groups.D.33422._M_impl._M_start + (struct Group *) (__n * 16))->h_group); - D.100627 = OBJ_TYPE_REF(*(D.100623->_vptr.Group_Base + 152B);D.100623->19) (D.100623); - if (D.100627 != 0) goto ; else goto ; + D.100677 = operator-> (&((D.86107 + (struct Side *) (__n * 256))->groups.D.33422._M_impl._M_start + (struct Group *) (__n * 16))->h_group); + D.100681 = OBJ_TYPE_REF(*(D.100677->_vptr.Group_Base + 152B);D.100677->19) (D.100677); + if (D.100681 != 0) goto ; else goto ; :; - if (this->my_side != n_side) goto ; else goto ; + if (this->my_side != n_side) goto ; else goto ; :; - if (this->my_group != n_group) goto ; else goto ; + if (this->my_group != n_group) goto ; else goto ; :; - if (discount_our) goto ; else goto ; + if (discount_our) goto ; else goto ; :; - D.86143 = this->l_iter._M_current; - if (D.86143 == this->l_end._M_current) goto ; else goto ; + D.86164 = this->l_iter._M_current; + if (D.86164 == this->l_end._M_current) goto ; else goto ; :; - D.86144 = *D.86143; - if (D.86144 == 157) goto ; else goto ; + temp.4648 = *D.86164; + if (temp.4648 == 157) goto ; else goto ; :; - if (D.86144 == 158) goto ; else goto ; + if (temp.4648 == 158) goto ; else goto ; -:; - this___l_iterthis__I___M_currentthis____.4616 = (const unsigned char *) ((long unsigned int) D.86143 + 1); +:; + D.86165 = *D.86148; + if (D.86165 == 157) goto ; else goto ; -Invalid sum of incoming frequencies 873, should be 0 :; - this___l_iterthis__I___M_currentthis____.4616 = (const unsigned char *) ((long unsigned int) this___l_iterthis__I___M_currentthis____.4616 + 1); - if (D.86144 == 157) goto ; else goto ; + if (D.86165 == 158) goto ; else goto ; -Invalid sum of incoming frequencies 0, should be 301 -:; - this->l_iter._M_current = this___l_iterthis__I___M_currentthis____.4616; - D.68741 = 0; - goto (); +:; + D.86148 = this->l_iter._M_current + 1B; + this->l_iter._M_current = D.86148; + if (this->l_end._M_current == D.86148) goto ; else goto ; James