------- Comment #8 from rob1weld at aol dot com  2007-06-22 09:42 -------
A earlier version of this program had these lines in it:

...
    f =  abs((float)(a));
    g = fabs((float)(a));
    h = (int)abs(a);
    i = 0.0;

    printf("a = %.2f  b = %.2f  c = %.2f  d = %.2f  e = %.2f  ", a, b, c, d,
e);
    printf("f = %.2f  g = %.2f  h = %.2f  i = %.2f\n", f, g, h, i);
    printf("a = %d  b = %d  c = %d  d = %d  e = %d  ", a, b, c, d, e);
    printf("f = %d  g = %d  h = %d  i = %d\n", f, g, h, i);
printf("i2 = %d\n", i);
    return 0;
...

Here is the output:

/* Output:
a = 16.00  b = 0.00  c = 16.00  d = 16.00  e = 16.00  f = 0.00  g = 16.00  h =
0.00  i = 0.00
a = 0  b = 1076887552  c = 0  d = 0  e = 0  f = 0  g = 0  h = 0  i = 1076887552
i2 = 0
*/


Notice that the prior time that the 9th variable was "1076887552" (as it is in
comment 7). Using gdb I see that print /x 1076887552 = 0x40300000 . It might be
using the stack pointer for the value. 

Notice that "i" and "i2" both print the value of "i" and that it is different -
it is as if gcc is using a pointer into memory instead of the actual value.

I'll work on some debugging and see if I can find out how it derives the value
of "i" that it prints differently each time.



-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32448

Reply via email to