On Wed, 21 Mar 2001, Mariano Alvarez Fernandez wrote:
Tried to build grx-2.4 for DJGPP using gcc-3.0 20010314. After modifying src/bgi/text7.c (gcc-3.0 20010314 miscompiles it with -O3 -fomit-frame-pointer) to workaround problem, all seems to work.
Can you provide the diff for the workaround (or can we expect that gcc will be fixed)?
Tested with gcc-3.0 20010319 (prerelease) under Linux: the problem is still there. After following patch it works for me. I'm not sure we should apply it now though. With patch we'll get smaller code (_outtextxy() not inlined 4 times) but perhaps some very small performance penalty
It will also go away if we'll change to use -O2 instead of -O3 -fomit-frame-pointer without this patch but as I said it requires benchmarking.
Andris
--- grx24/src/bgi/text7.c~1 Fri Jan 12 15:44:38 2001 +++ grx24/src/bgi/text7.c Wed Mar 21 09:16:24 2001 @@ -24,30 +24,9 @@
#include "text.h"
-/* ----------------------------------------------------------------- */ static void _outtextxy(int *xx, int *yy, int XX, int YY, - int len, const uchar *textstring) -{ - _DO_INIT_CHECK; - __gr_text_init(); -#ifdef GRX_VERSION - if (TXT.font==DEFAULT_FONT) { - if (DefaultFonts[TXT.charsize] == NULL) - DefaultFonts[TXT.charsize] = - GrBuildConvertedFont( - DefaultFonts[1], - GR_FONTCVT_RESIZE, - 8*ZERO2ONE(TXT.charsize), - 8*ZERO2ONE(TXT.charsize), - 0, 0); - __gr_text_bit(DefaultFonts[TXT.charsize],xx,yy,XX,YY,len,(char *) textstring); - } else -#endif - if (BITMAP(TXT.font)) - __gr_text_bit((GrFont *)Fonts[TXT.font],xx,yy,XX,YY,len,(char *) textstring); - else - __gr_text_vec(xx,yy,XX,YY,len,(char *) textstring); -} + int len, const uchar *textstring); +
/* ----------------------------------------------------------------- */ void outtext(const char *textstring) @@ -71,4 +50,29 @@ void __gr_p_outtextxy(int x, int y, __gr_p_GPCstr *txt) { _outtextxy( &x, &y, x+VL, y+VT+PY, txt->len, txt->str); +} + +/* ----------------------------------------------------------------- */ +static void _outtextxy(int *xx, int *yy, int XX, int YY, + int len, const uchar *textstring) +{ + _DO_INIT_CHECK; + __gr_text_init(); +#ifdef GRX_VERSION + if (TXT.font==DEFAULT_FONT) { + if (DefaultFonts[TXT.charsize] == NULL) + DefaultFonts[TXT.charsize] = + GrBuildConvertedFont( + DefaultFonts[1], + GR_FONTCVT_RESIZE, + 8*ZERO2ONE(TXT.charsize), + 8*ZERO2ONE(TXT.charsize), + 0, 0); + __gr_text_bit(DefaultFonts[TXT.charsize],xx,yy,XX,YY,len,(char *) textstring); + } else +#endif + if (BITMAP(TXT.font)) + __gr_text_bit((GrFont *)Fonts[TXT.font],xx,yy,XX,YY,len,(char *) textstring); + else + __gr_text_vec(xx,yy,XX,YY,len,(char *) textstring); }