[comp.sys.hp] C compiler / Assembler bugs on HP 9000/300

gregc@miro.Berkeley.EDU (Greg Couch) (04/05/88)

Below is a short program that demonstrates bugs that were found when
porting a program to the HP.  I'm running HP-UX 6.0.1 and the same
bugs occured under HP-UX 5.5.  Is there an e-mail place we can send
bugs to, like Berkeley's 4bsd-bugs@Berkeley.EDU?

	- Greg Couch
	gregc@miro.Berkeley.EDU
	gregc@Berkeley.EDU

-----
	main()
	{
		char	*a, *b, *c;
		float	f, g;

	# ifdef compbug
		/* this generates a compiler error */
		if ((float) (a - b) * 10.0 < (float) (a - c))
			;
	# else /* assembug */
		/* this generates an assembler error */
		if ((float) (a - b) * 10.0 < (float) (f = (a - c)))
			;
	# endif
	}

cunniff@hpfclq.HP.COM (Ross Cunniff) (04/06/88)

In article <23519@ucbvax.BERKELEY.EDU>, gregc@miro.Berkeley.EDU (Greg Couch)
writes:
> Below is a short program that demonstrates bugs that were found when
> porting a program to the HP.  I'm running HP-UX 6.0.1 and the same
> bugs occured under HP-UX 5.5.

The S300 people responsible for the C compiler have been notified.  This
bug will be fixed in some future release of HP-UX.  As a workaround, use
a temporary integer variable in the code, thus:

	main()
	{
		int	t1, t2;
		char	*a, *b, *c;
		float	f, g;

	# ifdef compbug
		/* this DOESN'T generate a compiler error */
		t1 = a - b;	t2 = a - c;
		if ((float) t1 * 10.0 < (float) t2)
			;
	# else /* assembug */
		/* this DOESN'T generate an assembler error */
		t1 = a - b;	t2 = a - c;
		if ((float) t1 * 10.0 < (float) (f = t2))
			;
	# endif
	}

N.B.: There is no bug in the assembler; in the second example given,
the compiler incorrectly generated the instruction fmov.l %a0,%fp0
which is an illegal instruction.

> Is there an e-mail place we can send
> bugs to, like Berkeley's 4bsd-bugs@Berkeley.EDU?

Not really.  Contact your service representative or sales rep. to report
bugs.  Sigh.  We could really use an e-mail address for bugs...

>	- Greg Couch
>	gregc@miro.Berkeley.EDU
>	gregc@Berkeley.EDU

				Ross Cunniff
				Hewlett-Packard ISD/UDL
				...{ucbvax,hplabs}!hpda!cunniff
				cunniff%hpda@hplabs.ARPA

kk@hpl-opus.HP.COM (Konstantinos Konstantinides) (04/07/88)

According to the HP-UX Software Release/Status Bulletin
for HP 9000 Series 200/300 Computers, August 1987, 
HP Part Number 97005-90010, this seems to be a known bug (page 23)

From the bulletin:

The following line doesn't compile
 x[1] = x[2] < x[3]; /* x is an array of doubles */

Temporary solution:
Add an additional assignement between the comparison and the original 
assignement.

 x[1] = (double) (i=(x[2] < x[3])); /* is is an integer */

For your program the following seems to work:

    f= (float) (a-b);
    g = (float) (a-c);
    if (f*10. <g)
    ;

The above Bulletin has instructions, forms and addresses for submitting bugs
(no e-mail address is mentioned). For the USA the addresses are
 
National Response Center
Hewlett-Packard
3300 Scott Blvd.
Santa Clara, CA 95051

or
1765 The Exchange Suite 100
Atlanta, GA 30339

See that Bulletin for addresses in Europe and Australia.

------------------------------------------------
Although I am working for HP this is not an official response,
but I hope that it helps.
K. Konstantinides kk%hpkronos@hplabs.hp.com