Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

GCC 2.6.3 and Cygnus' -mfpflaw patch

5 views
Skip to first unread message

Rugxulo

unread,
Dec 29, 2009, 12:04:37 AM12/29/09
to
Does anyone know anything about the Cygnus patch to GCC 2.6.3 to deal
with the FDIV bug? It seems similar to what Digital Mars, Borland C,
and OpenWatcom support. However, neither DJGPP v1's compile nor any
subsequent GCCs seem to have incorporated this feature. Granted, it's
unofficial, maybe they didn't think it worked well enough, or maybe
full FPU emulation was considered more accurate or better somehow.
Just curious if anybody has any thoughts. (I don't have a buggy
Pentium to test either.)

gcc-2.6.3-fdivpatch.bz2 24-Dec-1994 00:00 28K
gcc-2.6.3.tar.bz2 01-Dec-1994 00:00 4.6M

http://gcc.cybermirror.org/old-releases/gcc-2/

Rugxulo

unread,
Dec 31, 2009, 1:39:59 PM12/31/09
to
Hi,

On Dec 28, 11:04 pm, Rugxulo <rugx...@gmail.com> wrote:
>
> Does anyone know anything about the Cygnus patch to GCC 2.6.3 to deal
> with the FDIV bug?

No responses? Bah. I know there's one guy around here with a buggy
Pentium (not counting CWS), but I forget his name. Didn't DJ used to
work for Cygnus? So he don't know nuthin'? :-/

Long story short, I recompiled GCC 2.6.3, but the compiled .EXE for my
silly example seems to be the same whether using -mfpflaw or not.
Perhaps the changes were in libgcc.a (which BTW wasn't recompiled,
dunno why)??

Anyways, here's my stupid example .BAT just for testing (couldn't
figure out how to write a makefile using "ifeq" to test MAKE_VERSION
to use specific things for v1 ["3.71"] or v2).

Here's a download for ya:

http://rapidshare.com/files/328509374/586fdiv.zip.html
MD5: 70B3BCFAA011062D3490CC437586E327

(that .ZIP contains v1 and v2 .EXEs as well as the .BAT below)

I'm open to suggestions!! I don't have the hardware to test this
myself!! Is the Cygnus patch good for anything??

==========================================
@echo off
if "%DJGPP%"=="" goto end

set FDIV=586fdiv
set FDIVEXE=%FDIV%.exe
set MYGO32=\armslurp\djgpp.v1\bin\go32.exe
set GCCFLAGS=-s -O %1 %2 %3

if not "%1"=="clean" goto begin
for %%a in (%FDIV% %FDIVEXE%) do if exist %%a del %%a
goto end

:begin
if exist %FDIV%.c goto compile
echo #include "stdio.h" >%FDIV%.c
echo int main() { >>%FDIV%.c
echo printf("\nCompiled by GCC %%d.%%d.x\n" >>%FDIV%.c
echo "\n4195835.0/3145727.0 = %%le\n" >>%FDIV%.c
echo "(Wrong would say 1.3337...)\n",__GNUC__,__GNUC_MINOR__, >>%FDIV
%.c
echo 4195835.0/3145727.0); >>%FDIV%.c
echo return 0;} >>%FDIV%.c

:compile
REM **************************************************
ls /dev/env/DJDIR/bin/djsplit.exe
cls
if errorlevel 1 set GCCFLAGS=%GCCFLAGS% -mfpflaw
REM **************************************************

if not exist %FDIV%.c goto end
echo on
gcc %GCCFLAGS% %FDIV%.c -o %FDIV%
@echo off

if not exist go32.exe if not exist %FDIVEXE% copy /b %MYGO32% . >NUL
if exist go32.e* if not exist %FDIVEXE% copy /b go32.e*+%FDIV% %FDIVEXE
% >NUL
if exist %FDIVEXE% upx -qqq --best --lzma %FDIVEXE%
if not exist go32.exe stubit %FDIVEXE% >NUL
if exist go32.exe ren %FDIVEXE% fdiv-dj1.exe
if not exist go32.exe ren %FDIVEXE% fdiv-dj2.exe
for %%a in (fdiv-dj?.exe) do call %%a

:end
if exist %MYGO32% if exist go32.exe del go32.exe
for %%a in (%FDIV% 586fdiv.c 586fdiv.bak) do if exist %%a del %%a
for %%a in (GCCFLAGS FDIV FDIVEXE MYGO32) do set %%a=
==========================================

DJ Delorie

unread,
Dec 31, 2009, 2:01:37 PM12/31/09
to dj...@delorie.com

> Didn't DJ used to work for Cygnus?

I still do, sort of, but that was before my time. Might be related
to the famous "pentium FDIV bug".

Might be more interesting to ask this question on the gcc list, not
here - the people who wrote it still work on gcc.

Rugxulo

unread,
Dec 31, 2009, 2:34:57 PM12/31/09
to
Hi,

On Dec 31, 1:01 pm, DJ Delorie <d...@delorie.com> wrote:
> > Didn't DJ used to work for Cygnus?
>
> I still do, sort of, but that was before my time.  Might be related
> to the famous "pentium FDIV bug".

Any Pentiums from circa 1993 to 1995 would've been affected, IIRC.

> Might be more interesting to ask this question on the gcc list, not
> here - the people who wrote it still work on gcc.

Which list? Aren't there several? You really think they wouldn't flame
me to death for using (gasp) DOS *and* old GCCs *and* old hardware??
If you know where I should go, please point me in that
direction! :-)

DJ Delorie

unread,
Dec 31, 2009, 3:29:48 PM12/31/09
to dj...@delorie.com

> Which list? Aren't there several? You really think they wouldn't
> flame me to death for using (gasp) DOS *and* old GCCs *and* old
> hardware?? If you know where I should go, please point me in that
> direction! :-)

I think asking the gcc developers about a patch they developed long
ago is a suitable topic for the gcc developers list (g...@gcc.gnu.org).
It doesn't matter what OS you use.

Rugxulo

unread,
Dec 31, 2009, 3:55:35 PM12/31/09
to
Hi,

Except that the patch itself was written by Cygnus peeps (pre-Red
Hat), hence was unofficial and never (AFAICT) incorporated into GCC
proper.

I'm thinking "gcc-patches" is a better place, but ... the only thing
worse than being flamed is being ignored into oblivion. (Oh well,
gotta try anyways ....) :-/

0 new messages