Mail Archives: djgpp/1996/04/09/23:49:13
| Xref: | news2.mv.net comp.os.msdos.djgpp:2566
|
| From: | Stephen Davies <pjdavies AT werple DOT mira DOT net DOT au>
|
| Newsgroups: | comp.os.msdos.djgpp
|
| Subject: | Optimization error in GCC 2.7.2???
|
| Date: | Tue, 09 Apr 1996 16:30:00 -0700
|
| Organization: | werple public-access Internet
|
| Lines: | 11
|
| Message-ID: | <316AF2F8.49BA@werple.mira.net.au>
|
| NNTP-Posting-Host: | dp-m-b57.werple.net.au
|
| Mime-Version: | 1.0
|
| To: | djgpp AT delorie DOT com
|
| DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
I had some code which left-shift-equaled 1 to 128 then back 1 in a loop,
( bit<<=1 ) extracting 1-bit data from an array of chars.
(A 2-colour font, actually.)
The code something like: if(data[i] & bit) PutPixel(x,y,col) (C++)
When optimizing with -O6 (Allegro 2.0 uses 6, even though docs say 0-3)
The "& bit" is optimized out of existence! Without optimization it
stayed. This could be a pretty serious bug!
I worked around it by doing it step by step outside the "if", but it
would be slower.
Stephen Davies
- Raw text -