On Mon, 8 Jun 1998, Glynn Clements wrote:
>Are you sure? The documentation of -ffloat-store says:
>
>`-ffloat-store'
> Do not store floating point variables in registers, and inhibit
> other options that might change whether a floating point value is
> taken from a register or memory.
>
>The value `reale + 1.0f' wouldn't generally be stored in memory, so
>using -ffloat-store wouldn't affect the above program.
Infact I just rewrote the program as you could see in my original email
and this worked for gcc-2.7.2.x but not with gcc 2.8.1 so gcc 2.8.1 is
sure buggy.
>If I re-write it as:
>
> #include <stdio.h>
>
> int main(void)
> {
> float reale = 1.0f;
> float oneplus;
> int i;
>
> for (i = 0; ; i++)
> {
> oneplus = 1.0f + reale;
> if (oneplus == 1.0f)
> break;
> printf("%.30f\n", oneplus);
> reale=reale/2.0f;
> }
> printf("i = %d\n",i);
> return 0;
> }
Here what I get with gcc-2.8.1:
andrea@dragon:~$ gcc -O2 -ffloat-store p.c
2.000000000000000000000000000000
1.500000000000000000000000000000
1.250000000000000000000000000000
1.125000000000000000000000000000
1.062500000000000000000000000000
1.031250000000000000000000000000
1.015625000000000000000000000000
1.007812500000000000000000000000
1.003906250000000000000000000000
1.001953125000000000000000000000
1.000976562500000000000000000000
1.000488281250000000000000000000
1.000244140625000000000000000000
1.000122070312500000000000000000
1.000061035156250000000000000000
1.000030517578125000000000000000
1.000015258789062500000000000000
1.000007629394531250000000000000
1.000003814697265625000000000000
1.000001907348632812500000000000
1.000000953674316406250000000000
1.000000476837158203125000000000
1.000000238418579101562500000000
1.000000119209289550781250000000
1.000000059604644775390625000000
1.000000029802322387695312500000
1.000000014901161193847656250000
1.000000007450580596923828125000
1.000000003725290298461914062500
1.000000001862645149230957031250
1.000000000931322574615478515625
1.000000000465661287307739257812
1.000000000232830643653869628906
1.000000000116415321826934814453
1.000000000058207660913467407227
1.000000000029103830456733703613
1.000000000014551915228366851807
1.000000000007275957614183425903
1.000000000003637978807091712952
1.000000000001818989403545856476
1.000000000000909494701772928238
1.000000000000454747350886464119
1.000000000000227373675443232059
1.000000000000113686837721616030
1.000000000000056843418860808015
1.000000000000028421709430404007
1.000000000000014210854715202004
1.000000000000007105427357601002
1.000000000000003552713678800501
1.000000000000001776356839400250
1.000000000000000888178419700125
1.000000000000000444089209850063
1.000000000000000222044604925031
1.000000000000000000000000000000
1.000000000000000000000000000000
1.000000000000000000000000000000
1.000000000000000000000000000000
1.000000000000000000000000000000
1.000000000000000000000000000000
1.000000000000000000000000000000
1.000000000000000000000000000000
1.000000000000000000000000000000
1.000000000000000000000000000000
1.000000000000000000000000000000
i = 64
Your same program with egcc_2.90.28 output 24 as with gcc-2.7.2. This is
sure a bug of gcc-2.8.1.
Andrea[s] Arcangeli