The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > High Level Programming
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #3 (permalink)  
Old 11-20-2008
cdbug cdbug is offline
Registered User
  
 

Join Date: Oct 2008
Posts: 52
This happens in a large function, which has a relatively complicated algorithm.

Simply speaking, its structure is as such:
___________________________________________________________
some basic calculation
------------------------------

y = expression;

-------------------------------
____________________________________________________________
some operations
--------------------------------

--------------------------------

if {
block 1;
}

else{
if { block 2; }
else { block 3; }
}

The structure of blocks 2 and 3 will change the way in which y is calculated. The result is wrong. I check it through gdb. The five results above are obtained at the same environment except for the changes in the two blocks

In many executions, y is always equal to 0. Otherwise, it will be far larger than a right value.

But when either or each of the two blocks is removed, y will obtain a normal value.

I can not understand