rbutterworth@watmath.waterloo.edu (Ray Butterworth) (05/27/88)
For some reason, tsize() in mip's pftn.c is called with garbage arguments when the type of the array is (char). The other types seem to work correctly. % cat xx.c int x[] = { sizeof("abc") }; long y[] = { sizeof("abc") }; char z[] = { sizeof("abc") }; BSD% cc xx.c "xx.c", line 3: compiler error: compiler takes size of function SUN% cc xx.c cc: Fatal error in /lib/ccom: Segmentation fault (core dumped)
chris@softway.oz (Chris Maltby) (05/30/88)
In article <19100@watmath.waterloo.edu> rbutterworth (Ray Butterworth) writes: > % cat xx.c > int x[] = { sizeof("abc") }; > long y[] = { sizeof("abc") }; > char z[] = { sizeof("abc") }; > BSD% cc xx.c > "xx.c", line 3: compiler error: compiler takes size of function DYNIX% cc x.c "xx.c", line 3: unknown size It's being real smart, and assuming you want to initialise the char array with "abc". Then it sees the sizeof - spew! A workaround is: char _z[] = "abc"; char z[] = { sizeof _z }; I guess the actual fix is to find the spot where it starts the initialisation and stop it from screwing up. -- Chris Maltby - Softway Pty Ltd (chris@softway.oz) PHONE: +61-2-698-2322 UUCP: uunet!softway.oz!chris FAX: +61-2-699-9174 INTERNET: chris@softway.oz.au