C'mon, guys!

Pete Zakel pete at valid.UUCP
Thu Jul 3 13:38:13 AEST 1986


> I'm sure that this is the problem with with many programmers, but not
> all.  I just ran into a situation yesterday here at the Hospital where
> one of our programmers was falsely attributing a bug to the C compiler
> because the following declaration caused the program to die of a
> segmentation violation:
> 
> 	static char **ptrarray = {
> 		"",
> 		"str1",
> 		"str2",
> 		"etc."
> 	};
> 
> The programmer found that the alternate declaration
> 
> 	static char *ptrarray[] = {
> 		"",
> 		"etc."
> 	};
> 
> ran just fine.
> 
> (Of course there really *is* a bug in the compiler, since it let the
> original declaration through without even a peep; it's just not the bug
> imagined by the programmer.  For everyone's info, the compiler is cc on
> OSx v3.1 [Pyramid Computer Corp.] and I have suggested that the company
> be notified of this bug.  In the meantime, can anyone tell me whether
> this is a known pcc bug, or is it specific to Pyramid's cc?)
> 
> Phil Kos			  ...!decvax!decuac

Our pcc based compiler said "warning: illegal pointer combination, op ="
and "compiler error: initialization alignment error" to the first
declaration.
-- 
-Pete Zakel (..!{hplabs,amd,pyramid,ihnp4}!pesnta!valid!pete)



More information about the Comp.lang.c mailing list