www.delorie.com/djgpp/bugs/show.cgi | search |
This is actually a problem with GRX2.0. So, maybe this is not the correct place to report this bug. If not, would someone please forward this to Csaba. The problem: Inconsistant results if the "-fshort-enums" option is used to compile an application. The test conditions: 1. djgpp 2.0, beta3, "djdev200 Development Kit and Runtime" 2. grx, "grx20 GRX 2.0 Graphics Library" 3. In TEST.H, I added a "GrContextSize" after the setmode call, i.e., else GrSetMode(GR_default_graphics); size = GrContextSize(640,480); I compiled blittest as the test case. The results: 1. Without the "-fshort-enums" option: a. with the -O6 option, test ran fine, GrContextSize returned 153,600. b. with the -O2 option, test ran fine, GrContextSize returned 153,600. a. with no optimization, test ran fine, GrContextSize returned 153,600. 2. With the "-fshort-enums" option: a. with the -O6 option, test produced different visual results, GrContextSize returned 1,228,800. b. with the -O2 option, test produced different visual results, GrContextSize returned 614,400. a. with no optimization, test produced different visual results, GrContextSize returned 0.
Re-compile the grx 2.0 library with -fshort-enums.
Possible causes that I can think of right now: 1. Bug in libgrx code. A reference to an enum might be cast to an integer pointer. 2. Bug in gas. short-enum presumable means using more byte/word sized operands and gas is known to behave erratically with such items. 3. The strength-reduce bug in gcc strikes. Was the compiler used 2.7.0?
The "re-compile the grx 2.0 library with -fshort-enums" of my original work-around only "fixed" some of the problems. The target application that I've been developing is about 64K of source code that needs to interface via TCP/IP with a product developed under the Borland compiler. The data structures transferred include enums of size byte. For 2.0, I've segregated all of the GRX calls into a separate module (that has no knowledge of any data structures except internal GRX), and compiled this module without the short-enums flag set. The flag is set for the remainder of the code. Seems to work exactly as the 1.12 code.
webmaster | delorie software privacy |
Copyright © 2010 by DJ Delorie | Updated Jul 2010 |