From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25445 invoked by alias); 20 Aug 2007 15:03:56 -0000 Received: (qmail 23759 invoked by uid 48); 20 Aug 2007 15:03:44 -0000 Date: Mon, 20 Aug 2007 15:03:00 -0000 Message-ID: <20070820150344.23758.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug middle-end/10138] warn for uninitialized arrays passed as const* arguments In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "manu at gcc dot gnu dot org" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2007-08/txt/msg01393.txt.bz2 ------- Comment #12 from manu at gcc dot gnu dot org 2007-08-20 15:03 ------- (In reply to comment #11) > (In reply to comment #10) > > I now think that Andrew is right and that PR33086 and this one are INVALID. > > 'const' does not mean read-only in C++ at all, and much less in C. atoi(const > > char *) could always initialize buf[]. > > Uh, no, it can't. If it did (by casting away the 'const' from its argument > and then writing into the array), this would lead to a segfault: > ------------- > const char a[3] = "10"; > int main () { > return atoi (a); > } > ------------- This testcase has nothing to do with uninitialized variables. If the variable is 'const' already, then there will never be a warning. Will it produce segmentation fault for a local automatic uninitialized pointer? -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=10138