Date: Mon, 21 Aug 2000 20:30:07 -0700 (PDT) From: "Philip M. Gollucci" <gollucci@wam.umd.edu> To: freebsd-bugs@FreeBSD.org Subject: Re: gnu/20767: gcc const produces invalid warning Message-ID: <200008220330.UAA44701@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR gnu/20767; it has been noted by GNATS. From: "Philip M. Gollucci" <gollucci@wam.umd.edu> To: marka@nominum.com Cc: FreeBSD-gnats-submit@FreeBSD.ORG Subject: Re: gnu/20767: gcc const produces invalid warning Date: Mon, 21 Aug 2000 23:24:15 -0400 (EDT) Acutally shouldn't it.... Don't you want *argv ? as just argv implies the array of command line arguments instead of any single character string ! I could be wrong, if you do use the * it works fine with no warning and -Wall option as well. ***************************************************************************** Philip M. Gollucci (p6m7g8) Web-site : http://www.p6m7g8.com E-mail : gollucci@wam.umd.edu Philip@p6m7g8.com Phone : 301.249.6261 (Home) 301. . (College) Major : Computer Science Electrical Engineering Minor : Classical & Jazz Performance Current Job : Co Science, Discovery, & the Universe Webmaster URL: http://www.sdu.umd.edu Resume : http://www.wam.umd.edu/~gollucci/resume.html ***************************************************************************** On Tue, 22 Aug 2000 marka@nominum.com wrote: > > >Number: 20767 > >Category: gnu > >Synopsis: gcc const produces invalid warning > >Confidential: no > >Severity: non-critical > >Priority: medium > >Responsible: freebsd-bugs > >State: open > >Quarter: > >Keywords: > >Date-Required: > >Class: sw-bug > >Submitter-Id: current-users > >Arrival-Date: Mon Aug 21 20:10:00 PDT 2000 > >Closed-Date: > >Last-Modified: > >Originator: Mark Andrews > >Release: FreeBSD 4.1-STABLE i386 > >Organization: > Nominum > >Environment: > > FreeBSD drugs.dv.isc.org 4.1-STABLE FreeBSD 4.1-STABLE #0: Fri Aug 18 13:53:08 EST 2000 marka@drugs.dv.isc.org:/usr/obj/usr/src/sys/DRUGS i386 > > Using builtin specs. > gcc version 2.95.2 19991024 (release) > > >Description: > > gcc incorrectly reports 'incompatible pointer type' when function > is declared with 'const pointer to const pointer' arguement and is > just passed pointer to pointer. > > Also generates error with 'const pointer to pointer' and 'pointer to > const pointer', i.e. removing either of the consts still generates > the warning. > > >How-To-Repeat: > > % cc xx.c > xx.c: In function `main': > xx.c:22: warning: passing arg 1 of `f' from incompatible pointer type > > #include <stdio.h> > > static const char *foo[] = { "test", NULL }; > > static int > f(const char * const *args) { > int i, j, k; > > k = 0; > for (i = 0; args[i] != NULL; i++) > for (j = 0; args[i][j] != '\0'; j++) > k += args[i][j]; > return (k); > } > > int > main(int argc, char **argv) { > int i; > > i = f(foo); > printf("%d\n", i); > i = f(argv); /* This should not generate a warning! */ > printf("%d\n", i); > return (0); > } > > >Fix: > > > > >Release-Note: > >Audit-Trail: > >Unformatted: > > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-bugs" in the body of the message > To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200008220330.UAA44701>