delorie.com/djgpp/bugs/show.cgi   search  
Bug 000040

When Created: 11/30/1995 14:08:16
Against DJGPP version: 2.00.beta3
By whom: t.s.abbott@larc.nasa.gov
Abstract: incorrect application output in grx 2.0 with -fshort-enums compiler option.
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.  

Workaround added: 11/30/1995 14:41:38
By whom: t.s.abbott@larc.nasa.gov
Re-compile the grx 2.0 library with -fshort-enums.

Note added: 12/04/1995 06:57:24
By whom: terra@diku.dk (morten Welinder)
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?

Workaround added: 12/04/1995 12:23:43
By whom: t.s.abbott
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.

Closed on 05/18/2000 10:00:01: Too old to care, and seems to be in GRX anyway.
By whom: eliz@is.elta.co.il



  webmaster     delorie software   privacy  
  Copyright © 2010   by DJ Delorie     Updated Jul 2010