Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.2 9/18/84; site lanl.ARPA
Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!think!harvard!seismo!cmcl2!lanl!rmc
From: rmc@lanl.ARPA
Newsgroups: net.bugs
Subject: Re: Array of unions
Message-ID: <27694@lanl.ARPA>
Date: Fri, 28-Jun-85 11:19:18 EDT
Article-I.D.: lanl.27694
Posted: Fri Jun 28 11:19:18 1985
Date-Received: Sun, 30-Jun-85 00:14:52 EDT
References: <27676@lanl.ARPA>
Distribution: net
Organization: Los Alamos National Laboratory
Lines: 45

> 
> 	I defined an array of unions as follows:
> 
> 	    typedef union {
> 		unsigned char *bytes;
> 		unsigned long *words;
> 	    } block;
> 
> 	    block sched[NKEYS];
> 
> 	Now if I try to pass sched[i] as a parameter,
> the C compiler bombs with "Fatal error in /lib/ccom".

	Here's an example of a program that didn't
compile under 4.2/4.3bsd (VAX).  The program DID
compile on a SUN, or with the portable C compiler
under SUMacC.

#define NKEYS 20
	    typedef union {
		unsigned char *bytes;
		unsigned long *words;
	    } block;


	main()
	{
	block sched[NKEYS];
	int i;
	i= 4;
	bar(i, sched);
	}

	bar (i, sched) block sched[];
	{
	foo(sched[i]);
	}

	foo (junk) block junk;
	{
	printf("%d\n",junk.bytes);
	}

			-- R. Martin Chavez
			(chavez@lanl.ARPA)