Your message dated Sat, 11 Jan 2003 12:18:00 +0100 with message-id <[EMAIL PROTECTED]> and subject line Not a bug: Improper warning when casting from pointer to non-const array to const has caused the attached Bug report to be marked as done.
This means that you claim that the problem has been dealt with. If this is not the case it is now your responsibility to reopen the Bug report if necessary, and/or fix the problem forthwith. (NB: If you are a system administrator and have no idea what I am talking about this indicates a serious mail system misconfiguration somewhere. Please contact me immediately.) Debian bug tracking system administrator (administrator, Debian Bugs database) -------------------------------------- Received: (at submit) by bugs.debian.org; 25 Dec 2001 06:14:32 +0000 >From [EMAIL PROTECTED] Tue Dec 25 00:14:32 2001 Return-path: <[EMAIL PROTECTED]> Received: from cx568534-a.lncln1.ri.home.com (eleutheromania.barsoom.org) [65.15.34.25] by master.debian.org with esmtp (Exim 3.12 1 (Debian)) id 16IkrA-0006m4-00; Tue, 25 Dec 2001 00:14:32 -0600 Received: from agthorr by eleutheromania.barsoom.org with local (Exim 3.32 #1 (Debian)) id 16Ikhr-0004BP-00; Mon, 24 Dec 2001 22:04:55 -0800 From: Agthorr <[EMAIL PROTECTED]> To: Debian Bug Tracking System <[EMAIL PROTECTED]> Subject: gcc-3.0: Improper warning when casting from pointer to non-const array to const X-Reportbug-Version: 1.36 X-Mailer: reportbug 1.36 Date: Mon, 24 Dec 2001 22:04:54 -0800 Message-Id: <[EMAIL PROTECTED]> Delivered-To: [EMAIL PROTECTED] Package: gcc-3.0 Version: 1:3.0.2-4 Severity: normal 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 also occurs in gcc 2.95.4. 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 ;) -- Agthorr ------------------------------------------------------------------------ typedef char foo[16]; void bar (const foo *xyzzy) {} int main(void) { foo bozz; bar (&bozz); return 0; } ------------------------------------------------------------------------ -- System Information Debian Release: 3.0 Architecture: i386 Kernel: Linux eleutheromania 2.4.16 #1 Tue Dec 4 11:20:43 PST 2001 i686 Locale: LANG=C, LC_CTYPE= Versions of packages gcc-3.0 depends on: ii binutils 2.11.92.0.12.3-3 The GNU assembler, linker and bina ii cpp-3.0 1:3.0.2-4 The GNU C preprocessor. ii gcc-3.0-base 1:3.0.2-4 The GNU Compiler Collection (base ii libc6 2.2.4-7 GNU C Library: Shared libraries an ii libgcc1 1:3.0.2-4 GCC support library. --------------------------------------- Received: (at 126411-done) by bugs.debian.org; 11 Jan 2003 11:19:05 +0000 >From [EMAIL PROTECTED] Sat Jan 11 05:19:04 2003 Return-path: <[EMAIL PROTECTED]> Received: from mail.cs.tu-berlin.de [130.149.17.13] (root) by master.debian.org with esmtp (Exim 3.12 1 (Debian)) id 18XJfM-00083j-00; Sat, 11 Jan 2003 05:19:04 -0600 Received: from bolero.cs.tu-berlin.de ([EMAIL PROTECTED] [130.149.19.1]) by mail.cs.tu-berlin.de (8.9.3/8.9.3) with ESMTP id MAA15976 for <[EMAIL PROTECTED]>; Sat, 11 Jan 2003 12:18:01 +0100 (MET) Received: (from [EMAIL PROTECTED]) by bolero.cs.tu-berlin.de (8.11.6+Sun/8.9.3) id h0BBI0C04727; Sat, 11 Jan 2003 12:18:00 +0100 (MET) From: Matthias Klose <[EMAIL PROTECTED]> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <[EMAIL PROTECTED]> Date: Sat, 11 Jan 2003 12:18:00 +0100 To: <[EMAIL PROTECTED]> Subject: Not a bug: Improper warning when casting from pointer to non-const array to const In-Reply-To: <[EMAIL PROTECTED]> References: <[EMAIL PROTECTED]> <[EMAIL PROTECTED]> X-Mailer: VM 7.03 under 21.4 (patch 6) "Common Lisp" XEmacs Lucid Delivered-To: [EMAIL PROTECTED] X-Spam-Status: No, hits=-8.2 required=5.0 tests=IN_REP_TO,QUOTED_EMAIL_TEXT,REFERENCES,SPAM_PHRASE_00_01 version=2.41 X-Spam-Level: not a bug. closing the report. Joseph S. Myers writes: > On Fri, 27 Dec 2002, Matthias Klose wrote: > > > 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. > > It is an assignment from "pointer to array[16] of char" to "pointer to > array[16] of const char" rather than to "pointer to const array[16] of > char", by virtue of the requirement (6.7.3#8 in C99) that a type qualifier > applied to an array type applies instead to the element type. Thus the > case of 6.5.16.1#1 that would be matched in the case of pointers to > nonarray types adding qualifiers is not matched, thus the warning.