🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.bug
Article #172

Re: gcc 2.2.2 optimizer bug/68k

#172
From: Andrew Smith
Date: Mon, 20 Jul 1992 20:49
51 lines
1695 bytes
I'll bet that you did not declare "addr" as a volatile pointer! Unless you
do that, GCC is entitled to think that *addr can never change, so it doesn't
need to recalculate it each time through the loop.

Don't ask me why it still leaves the loop in the program - that is the real bug!


Andrew.

 
> C code: 
> 
>         graph_AMOVE(0,-i);
>         while (!(*addr & 32));
>  
> ------------------------------- 
> 68k assembler code not optimized 
> 
>         jbsr _graph_AMOVE 
>         addqw #8,sp
> L86:
>         movel _addr,a0
>         moveb a0@(1),d0
>         andb #32,d0
>         tstb d0
>         jne L87
>         jra L86
> L87:
>  
> --------------------------------- 
> 68k assembler code with optimization (-O) 
>  
>         jbsr _graph_AMOVE
>         addqw #8,sp
>         movel _addr,a0
>         moveb a0@(1),d0
>         andb #32,d0
> L97:
>         tstb d0
>         jeq L97
>         clrl d0
> 
> 
> -- 
> _____________
> Hermann Hueni Seidenweg 40, CH-3012 Bern,		    +41 31 234 607
> Jucker Informatik, Anlikerweg 5, CH-3626 Huenibach,	    +41 33 434 868
> Physiological Institute, University of Berne, CH-3012 Bern, +41 31 658 726
> e-mail: hueni@optolab.unibe.ch			       fax: +41 31 654 611
> 
> 
Technical Details
Message-ID: <9207202049.AA09471@zaphod.synoptics.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!synoptics.com!asmith

Show Full Headers
Complete Article Headers
Newsgroups: gnu.gcc.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!synoptics.com!asmith
From: asmith@synoptics.com (Andrew Smith)
Subject: Re:  gcc 2.2.2 optimizer bug/68k
Message-ID: <9207202049.AA09471@zaphod.synoptics.com>
Sender: gnulists@ai.mit.edu
Organization: GNUs Not Usenet
Distribution: gnu
Date: Mon, 20 Jul 1992 20:49:22 GMT
Approved: bug-gcc@prep.ai.mit.edu
Lines: 53