From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20673 invoked by alias); 27 Dec 2002 22:16:02 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 20651 invoked by uid 71); 27 Dec 2002 22:16:01 -0000 Resent-Date: 27 Dec 2002 22:16:01 -0000 Resent-Message-ID: <20021227221601.20650.qmail@sources.redhat.com> Resent-From: gcc-gnats@gcc.gnu.org (GNATS Filer) Resent-Cc: gcc-prs@gcc.gnu.org, gcc-bugs@gcc.gnu.org, agthorr@barsoom.org Resent-Reply-To: gcc-gnats@gcc.gnu.org, 126411@bugs.debian.org Received: (qmail 18990 invoked from network); 27 Dec 2002 22:14:10 -0000 Received: from unknown (HELO hirsch.in-berlin.de) (192.109.42.6) by 209.249.29.67 with SMTP; 27 Dec 2002 22:14:10 -0000 Received: from tango.net.local (mail@dsl-213-023-039-145.arcor-ip.net [213.23.39.145]) (authenticated bits=0) by hirsch.in-berlin.de (8.12.1/8.12.1/Debian -2) with ESMTP id gBRMDvXR020584 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NOT); Fri, 27 Dec 2002 23:13:58 +0100 Received: from doko by tango.net.local with local (Exim 4.12 #1 (Debian) [+araqnid]) id 18S2js-0003Xk-00; Fri, 27 Dec 2002 23:13:56 +0100 Message-Id: Date: Fri, 27 Dec 2002 14:16:00 -0000 From: Matthias Klose Reply-To: 126411@bugs.debian.org To: gcc-gnats@gcc.gnu.org, debian-gcc@lists.debian.org X-Send-Pr-Version: 3.113 X-GNATS-Notify: agthorr@barsoom.org Subject: c/9070: Improper warning when casting from pointer to non-const array to const X-SW-Source: 2002-12/txt/msg01321.txt.bz2 List-Id: >Number: 9070 >Category: c >Synopsis: Improper warning when casting from pointer to non-const array to const >Confidential: no >Severity: non-critical >Priority: low >Responsible: unassigned >State: open >Class: change-request >Submitter-Id: net >Arrival-Date: Fri Dec 27 14:16:01 PST 2002 >Closed-Date: >Last-Modified: >Originator: agthorr@barsoom.org >Release: 3.2.1 (Debian) (Debian unstable) >Organization: The Debian Project >Environment: System: Debian GNU/Linux (unstable) Architecture: i686 host: i386-linux Configured with: ../src/configure -v --enable-languages=c,c++,java,f77,proto,pascal,objc,ada --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-gxx-include-dir=/usr/include/c++/3.2 --enable-shared --with-system-zlib --enable-nls --without-included-gettext --enable-__cxa_atexit --enable-clocale=gnu --enable-java-gc=boehm --enable-objc-gc i386-linux Thread model: posix gcc version 3.2.2 20021212 (Debian prerelease) >Description: [ Reported to the Debian BTS as report #126411. Please CC 126411@bugs.debian.org on replies. Log of report can be found at http://bugs.debian.org/126411 ] gcc generates a warning for the following test program, that I believe is inappropriate. The warning is that it cannot implicitly cast from (foo *) to (const foo *). This occurs when foo is an array type. The sample program compiles without warnings if you remove the "const" keyword, or if you remove the [16] making foo an array. This occurs in gcc 2.95.x upto gcc-3_3-branch, no check on HEAD This is a problem for me since I normally compile with -Werror and make rigorous use of const. I can make explicit casts as a temporary fix, but this makes my code ugly ;) typedef char foo[16]; void bar (const foo *xyzzy) {} int main(void) { foo bozz; bar (&bozz); return 0; } >How-To-Repeat: >Fix: >Release-Note: >Audit-Trail: >Unformatted: