Outright bug in the SGI C compiler...

Steve Maurer steve at vicom.com
Tue Nov 28 10:47:30 AEST 1989



	While trying to polish off the ends of a project, I ended
up having to do a work-around for a mutual design deficiency between
our product and the SGI compiler.   However, on the work around
itself, I found another, much less forgivable bug in the SGI
compiler; an outright violation of the C standard.

	While the compiler allows pointers to functions to be
assigned, it does not allow them to be compared.  It also doesn't
allow them to be cast to allow comparison.   The following example
illustrates the problem.  It was checked out on a number of other
C compilers (Sun being the main one), and it compiled and performs
flawlessly.   But not on the SGI.

- - - - - - - - - - - - - - - - - - - - - - - -

void foo(), bar();

main()
{
void (*pfn)();

pfn = foo;			/* SGI compiler allows this	*/

if ( pfn == foo )		/* but barfs on this		*/
	printf("Pfn calls foo\n");
else
	printf("Pfn calls bar\n");
}

void
foo()
{
}

void
bar()
{
}
- - - - - - - - - - - - - - - - - - - - - - - -

	My question is: does anybody know a work around for this flaw?
Is there a new release fix for it?   If that's the case, I need the
new stuff immediately, since the project I'm working on is already way
behind.

						Steve Maurer
						steve at vicom.com



More information about the Comp.sys.sgi mailing list