[comp.sys.amiga.tech] Is this a Lattice C 5.05 compiler bug ?

ZHHU@MTUS5.BITNET (10/25/90)

Whenever an unsigned integer multiply a float or a double, it will
crash my Amiga 1000, but the same source code works fine on a PC or
UNIX machine. This is painful, because you can be careful by type
casting, but when you compile a PD program, especially the big files
you cannot afford the time to find them. I use Lattice C compiler 5.05,
I wonder if this is a bug, whether 5.10 have the same problem. Can
any body kindly take the risk of crashing, and try the following:

#include <stdio.h>
main()
{
    unsigned int i;
    int j;
    float a;
    i = 10;
    j = 10;
    a = j*15.0;             /* should not crash here */
    printf("a= %f:n",a);
    a = i*15.0;             /* crash here on my machine*/
    printf("a= %f:n",a);
}

/* end of the program */

Zhiquan

aduncan@rhea.trl.oz (Allan Duncan) (10/26/90)

From article <90297.145845ZHHU@MTUS5.BITNET>, by ZHHU@MTUS5.BITNET:
> Whenever an unsigned integer multiply a float or a double, it will
> crash my Amiga 1000, but the same source code works fine on a PC or
> UNIX machine. This is painful, because you can be careful by type

>     float a;
>     i = 10;
>     j = 10;
>     a = j*15.0;             /* should not crash here */
>     printf("a= %f:n",a);
>     a = i*15.0;             /* crash here on my machine*/

What libraries did you link with?  When you use floats in printf, you
need to link in the floating point version of printf before lc by using
the appropriate lcm first. (See the manual page G15 ff).
Allan Duncan	ACSnet	a.duncan@trl.oz
(03) 541 6708	ARPA	a.duncan%trl.oz.au@uunet.uu.net
		UUCP	{uunet,hplabs,ukc}!munnari!trl.oz!a.duncan
Telecom Research Labs, PO Box 249, Clayton, Victoria, 3168, Australia.

root@bcstarc.stgt.sub.org (Frank Pecher) (10/27/90)

In article <90297.145845ZHHU@MTUS5.BITNET> ZHHU@MTUS5.BITNET writes:
>Whenever an unsigned integer multiply a float or a double, it will
>crash my Amiga 1000, but the same source code works fine on a PC or
>UNIX machine. This is painful, because you can be careful by type
>casting, but when you compile a PD program, especially the big files
>you cannot afford the time to find them. I use Lattice C compiler 5.05,
>I wonder if this is a bug, whether 5.10 have the same problem. Can
>any body kindly take the risk of crashing, and try the following:
>
>#include <stdio.h>
>main()
>{
>    unsigned int i;
>    int j;
>    float a;
>    i = 10;
>    j = 10;
>    a = j*15.0;             /* should not crash here */
>    printf("a= %f:n",a);
>    a = i*15.0;             /* crash here on my machine*/
>    printf("a= %f:n",a);
>}

I own an Amiga 2000 and Lattice C5.05; the program works fine when
compiled with

    lc -f -Lm prog

        --  Frank

--
Frank Pecher, Schwalbenweg 26, 7030 Boeblingen root@bcstarc.stgt.sub.org
>>              This line was intentionally left blank                <<

ZHHU@MTUS5.BITNET (10/31/90)

>In article <90297.145845ZHHU@MTUS5.BITNET> ZHHU@MTUS5.BITNET writes:
>>Whenever an unsigned integer multiply a float or a double, it will
>>crash my Amiga 1000, but the same source code works fine on a PC or
>>UNIX machine. This is painful, because you can be careful by type
>>casting, but when you compile a PD program, especially the big files
>>you cannot afford the time to find them. I use Lattice C compiler 5.05,
>>I wonder if this is a bug, whether 5.10 have the same problem. Can
>>any body kindly take the risk of crashing, and try the following:
>>
>>#include <stdio.h>
>>main()
>>{
>>    unsigned int i;
>>    int j;
>>    float a;
>>    i = 10;
>>    j = 10;
>>    a = j*15.0;             /* should not crash here */
>>    printf("a= %f:n",a);
>>    a = i*15.0;             /* crash here on my machine*/
>>    printf("a= %f:n",a);
>>}
>
>I own an Amiga 2000 and Lattice C5.05; the program works fine when
>compiled with
>
>   lc -f -Lm prog
>
>       --  Frank

I try to compile the program using the "-f" switch, it won't crash
the machine any more, thank you Frank. But my question now is:
    Why it crashes my A1000 when I compile using

        lc -Lm prog

    According to the Lattice C manual, the default switch is "-fm" which
    means mixed float and double type.

--Zhiquan

root@bcstarc.stgt.sub.org (Frank Pecher) (11/01/90)

In article <90303.131300ZHHU@MTUS5.BITNET> ZHHU@MTUS5.BITNET writes:
>>In article <90297.145845ZHHU@MTUS5.BITNET> ZHHU@MTUS5.BITNET writes:
>>> [Floating point test program deleted]
>>
>>I own an Amiga 2000 and Lattice C5.05; the program works fine when
>>compiled with
>>
>>   lc -f -Lm prog
>>
>>       --  Frank
>
>I try to compile the program using the "-f" switch, it won't crash
>the machine any more, thank you Frank. But my question now is:
>    Why it crashes my A1000 when I compile using
>
>        lc -Lm prog
>
>    According to the Lattice C manual, the default switch is "-fm" which
>    means mixed float and double type.

Sorry, I really can't figure out, why your prog doesn't work. I just
compiled it using

        lc -Lm prog

and it again works okay.

>--Zhiquan

        --  Frank
--
Frank_Pecher Schwalbenweg_26 7030 Boeblingen GER root@bcstarc.stgt.sub.org
>>                This line was intentionally left blank                <<

walker@unx.sas.com (Doug Walker) (11/07/90)

In article <90297.145845ZHHU@MTUS5.BITNET> ZHHU@MTUS5.BITNET writes:
>Whenever an unsigned integer multiply a float or a double, it will
>crash my Amiga 1000, but the same source code works fine on a PC or
>UNIX machine. This is painful, because you can be careful by type
>casting, but when you compile a PD program, especially the big files
>you cannot afford the time to find them. I use Lattice C compiler 5.05,
>I wonder if this is a bug, whether 5.10 have the same problem. Can
>any body kindly take the risk of crashing, and try the following:
>

I can't get this to crash using either 5.10 or 5.05 on my A3000.
Can you describe the symptoms a little better?  What kind of crash
do you get?  What compile/link options are you using?  It would
probably pay to call SAS/C tech support (my postings are getting
a little redundant redundant on this point) at (919)677-8009.


  *****
=*|_o_o|\\=====Doug Walker, Software Distiller====== BBS: (919)460-7430 =
 *|. o.| ||                                          1200/2400/9600 Dual
  | o  |//     For all you do, this bug's for you!
  ====== 
usenet: ...mcnc!rti!sas!walker   plink: dwalker  bix: djwalker 

ZHHU@MTUS5.BITNET (11/09/90)

In article <90297.145845ZHHU@MTUS5.BITNET> I writes:
>Whenever an unsigned integer multiply a float or a double, it will
>crash my Amiga 1000, but the same source code works fine on a PC or

  It was compiled using the following command:
    LC -Lm program.c

>UNIX machine. This is painful, because you can be careful by type
>casting, but when you compile a PD program, especially the big files
>you cannot afford the time to find them. I use Lattice C compiler 5.05,

  I am sorry, the correct compiler version is 5.04 not 5.05.

>I wonder if this is a bug, whether 5.10 have the same problem. Can
>any body kindly take the risk of crashing, and try the following:
>
>#include <stdio.h>
>main()
>{
>    unsigned int i;
>    int j;
>    float a;
>    i = 10;
>    j = 10;
>    a = j*15.0;             /* should not crash here */
>    printf("a= %f:n",a);
>    a = i*15.0;             /* crash here on my machine*/
>    printf("a= %f:n",a);
>}

  This fact was confirmed by andrew@teslab.lab.oz.au (Andrew Phillips)
 he said:
>I was sceptical but I tried it on my A1000 with Lattice 5.04 with the
>same results.  This is very surprising.  I wonder if it is A1000
>specific?

Frank Pecher (root@bcstarc.stgt.sub.org) said:
>I own an Amiga 2000 and Lattice C5.05; the program works fine when
>compiled with
>
>    lc -f -Lm prog
>

If I compile with "lc -f -Lm ", It won't crash my Amiga 1000 either.
I also tried the other possible switches, it turned out as follows:
     lc -flm -Lm          crashes  (math library lcm.lib)
     lc -fld -Lm          crashes  (math library lcm.lib)

     lc -fim -Lm          no crashes (math library lcmieee.lib)
     lc -fid -Lm          no crashes (math library lcmieee.lib)
     lc -ffs -Lf          no crashes (math library lcmffp.lib)
So I guess the problem is with the math library lcm.lib.


There is problem woth the CodePRobe debuger too. Every time I use
the command DISPLAY or WATCH to a floating point varible it will
crash my machine. For example, it I have a variable x as float or
double, if I say
   display x
it crashes my machine, it always does. The program is compiled
with
    lc -fim -Lm -d5  program.c

Zhiquan

farren@well.sf.ca.us (Mike Farren) (11/11/90)

ZHHU@MTUS5.BITNET writes:

>I am sorry, the correct compiler version is 5.04 not 5.05.

And this might be at the root of many of your problems.  The last
Lattice version was 5.05, in which many bugs were fixed (including
the one with floating-points in CPR).  The current version, from
SAS, is 5.10.   Upgrade, and it'll work better...
-- 
Mike Farren 				     farren@well.sf.ca.us

forgeas@swinjm.UUCP (Jean-Michel Forgeas) (11/12/90)

In article <21610@well.sf.ca.us>, Mike Farren writes:

> [...].  The current version, from
> SAS, is 5.10.   Upgrade, and it'll work better...

Sorry but no. 5.05 was fine, 5.10 have big bugs.
--
                                     \___/
Jean-Michel Forgeas                   \-/
cbmvax!cbmehq!cbmfra!swinjm!forgeas    |    The Software Winery
                                      -^-
                           And, where is the universe ?

walker@unx.sas.com (Doug Walker) (11/30/90)

In article <21610@well.sf.ca.us> farren@well.sf.ca.us (Mike Farren) writes:
>ZHHU@MTUS5.BITNET writes:
>
>>I am sorry, the correct compiler version is 5.04 not 5.05.
>
>And this might be at the root of many of your problems.  The last
>Lattice version was 5.05, in which many bugs were fixed (including
>the one with floating-points in CPR).  The current version, from
>SAS, is 5.10.   Upgrade, and it'll work better...

He's right, honest :-)  5.05 is a free upgrade to registered 5.04
owners - rush right out and call in for it.  (919)677-8000x5042.

5.10 is not a free upgrade, but you get a lot for your $40 upgrade
fee.  Check out the reviews in AmigaWorld and Amazing Computing
recently.  5.10 has been an extremely stable and bug-free release,
and I'm sure you would be happy with it.


  *****
=*|_o_o|\\=====Doug Walker, Software Distiller====== BBS: (919)460-7430 =
 *|. o.| ||                                          1200/2400/9600 Dual
  | o  |//     For all you do, this bug's for you!
  ====== 
usenet: ...mcnc!rti!sas!walker   plink: dwalker  bix: djwalker