[comp.unix.aix] AIX PS/2 C-compiler bug

pete@bally.Bally.COM (Pete Gregory) (03/02/90)

Hi -

I have AIX PS/2 (the latest and greatest: updates of C compiler and
base operating system as of 2/12/90), but I am unable to compile the 
following simple program:

main()
{
	double d;
	long l;
	short s;
	int i;

	char *c;

	c = (char *) l;
	c = (char *) s;
	c = (char *) i;
	c = (char *) d;
}

...I get the following compile-time diagnostic:

	14.	c = (char *) s;
	15.	c = (char *) d; <<<<<
****** Error number 137 in line 14 of file test.c *****
****** Illegal type conversion *****
1 errors.  0 warnings.  16 lines.  File test.c

...BTW, this program compiles fine on AIX 2.2.1 on the RT (6150/125).

This code is an isolation of code in a much larger program.  The exact
same error occurs there, too (on the PS/2; RT is okay and the program
WORKS).

Any ideas?  Thanks.......


Pete Gregory	      |	uucp:	uunet!bally!pete	    ________
Software Engineer     |	domain:	pete@bally.bally.com	   /	 _  \
Bally Systems, Inc.   |	phone:	702-323-6156 x882	  /   /||  \ \
255 Bell St.	      |	FAX:	702-323-5997		 | |\/ ||  _  |
Reno, NV 89503	      |					 | |   ||   | |
		    					  \    ||__/ /
                                                           \________/	'71 MGB

jackv@turnkey.TCC.COM (Jack F. Vogel) (03/02/90)

In article <233@bally.Bally.COM> pete@bally.Bally.COM (Pete Gregory) writes:
>I have AIX PS/2 (the latest and greatest: updates of C compiler and
>base operating system as of 2/12/90), but I am unable to compile the 
>following simple program:
 
[ substance of program deleted....essentially cast a double to a char*]

>	15.	c = (char *) d; <<<<<

Sorry, but its the RT compiler that is non-standard. I have tried this
cast on every compiler I had in sight...the pcc and gcc under 386/ix,
the compiler on a VAX running 4.3tahoe, and the Metaware compiler on the
370 and NONE of them will let you make this conversion. I am willing to
bet that if one would be hard pressed to fine another compiler that would!
The burning question is why one would want to do this anyway? How about
doing an implicit conversion of the double to an int and then cast that?

In any case, you can't blame the PS/2 compiler.

Disclaimer: These views are mine, not necessarily LCC's or IBM's


-- 
Jack F. Vogel			jackv@seas.ucla.edu
AIX Technical Support	              - or -
Locus Computing Corp.		jackv@ifs.umich.edu