Path: utzoo!telly!ddsw1!lll-winken!killer!osu-cis!tut.cis.ohio-state.edu!rutgers!njin!princeton!notecnirp!drh
From: drh@notecnirp.Princeton.EDU (Dave Hanson)
Newsgroups: gnu.gcc.bug
Subject: Re: Incorrect warning about incompatible arguments
Message-ID: <12184@princeton.Princeton.EDU>
Date: 22 Sep 88 11:44:41 GMT
Sender: news@princeton.Princeton.EDU
Reply-To: drh@notecnirp.UUCP (Dave Hanson)
Distribution: gnu
Organization: Dept. of Computer Science, Princeton University
Lines: 22

In article <8809220411.AA01379@check.sm.unisys.com> pmontgom@SM.UNISYS.COM (Peter Montgomery) writes:
	/*
	        On a SUN 3 at OS 4.0, GCC 1.28 warns "argument passing between
	incompatible pointer types" for the call to mat_print.  The warning does
	not appear if "const" is omitted from the declaration of mat_print.  GCC
	1.26 did not give this warning.  The object code is correct, with or
	without optimization.
	*/
	
	void mat_print(const int mat[2][2]) {
	    printf("Matrix elements are %d %d %d %d\n", mat[0][0], mat[0][1],
							mat[1][0], mat[1][1]);
	}
	main()
	{
	    int a[2][2] = {10, 20, 30, 40};
	    mat_print(a);
	}

i think this is correct. the type of the argument to mat_print
is `pointer to array of const int'. in main(), the type of a
is `pointer to array of int'. those two types are not
assignment compatible.