Walt's side effect order changed by -g 
Author Message
 Walt's side effect order changed by -g

Using g77 0.5.20, the switch which makes a difference to the result is
-fno-automatic.  -g does not affect the result.  I suppose that the
problem is that one of the functions which is called uses a static value
left behind in labeled common by the other, but these functions are
invoked in pairs in an expression with nothing to specify which one is
called first.  Thus the value left behind in common could be from either
of the invocations.  My result:
-fautomatic: 24.
-fno-automatic: 10.69
A strange way to reinforce the advice that functions  should not have side
effects.
Tim



Sun, 10 Oct 1999 03:00:00 GMT  
 Walt's side effect order changed by -g

 N8TM> Using g77 0.5.20, the switch which makes a difference to the
 N8TM> result is -fno-automatic.  -g does not affect the result.

Yes.  It's a fundamental GCC feature that -g<anything> doesn't alter
the generated code, otherwise the option is of limited use.



Wed, 13 Oct 1999 03:00:00 GMT  
 Walt's side effect order changed by -g

Quote:


>  N8TM> Using g77 0.5.20, the switch which makes a difference to the
>  N8TM> result is -fno-automatic.  -g does not affect the result.

> Yes.  It's a fundamental GCC feature that -g<anything> doesn't alter
> the generated code, otherwise the option is of limited use.

However, g77-0.5.20 does potentially alter the generated code
when -g is specified -- I just discovered a change to the gcc
back end in the gcc-under-development (while looking for other
fixes that would help solve known problems, which I did find,
thankfully) that fixes this.  It'll be in g77-0.5.21.  (The code
in question is in gcc/unroll.c, function unroll_loop().  So I
am guessing that the code-change triggered by -g in this case
happens only when -funroll-loops is specified, etc.)
--

"Practice random senselessness and act kind of beautiful."



Wed, 13 Oct 1999 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Forth's popularity, side-effect

2. local variables don't cause side effects

3. do GUI's require side effects?

4. Dialogs and side effects

5. Pattern for side effects

6. Skipping print preview side effect ArnĂ³r

7. Avoiding functions with side effects

8. INI file side effects

9. Functions without side effects (was Old confusion)

10. Wrapping a side-effecting function library

11. Side-effect free functions

12. One advantage of computing by side-effect

 

 
Powered by phpBB® Forum Software