From owner-freebsd-bugs Mon Aug 21 20:10: 7 2000 Delivered-To: freebsd-bugs@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id C505337B43C for ; Mon, 21 Aug 2000 20:10:00 -0700 (PDT) Received: (from gnats@localhost) by freefall.freebsd.org (8.9.3/8.9.2) id UAA43258; Mon, 21 Aug 2000 20:10:00 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from drugs.dv.isc.org (drugs.dv.isc.org [130.155.191.236]) by hub.freebsd.org (Postfix) with ESMTP id 9D23C37B424 for ; Mon, 21 Aug 2000 20:01:45 -0700 (PDT) Received: (from marka@localhost) by drugs.dv.isc.org (8.9.3/8.9.3) id NAA57805; Tue, 22 Aug 2000 13:03:35 +1000 (EST) (envelope-from marka) Message-Id: <200008220303.NAA57805@drugs.dv.isc.org> Date: Tue, 22 Aug 2000 13:03:35 +1000 (EST) From: marka@nominum.com Reply-To: marka@nominum.com To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.2 Subject: gnu/20767: gcc const produces invalid warning Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >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 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