From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19998 invoked by alias); 16 Aug 2007 10:50:11 -0000 Received: (qmail 18568 invoked by uid 48); 16 Aug 2007 10:50:01 -0000 Date: Thu, 16 Aug 2007 10:50:00 -0000 Subject: [Bug middle-end/33086] New: warn for read-only uninitialized variables passed as arguments X-Bugzilla-Reason: CC Message-ID: 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/msg01059.txt.bz2 void use(const int *); void foo(void) { int i; use(&i); } At least for languages where 'const' is actually enforced, we should warn for this. For languages where the 'const' can be cast away and 'i' can be initialized by 'use' the situation is less clear (although personally I think we should warn anyway). This is one part of PR10138. "the question whether an argument is actually used or not is secondary, the fact that we pass an uninitialized variable to which only read access is possible is definitely worth a warning." http://gcc.gnu.org/bugzilla/show_bug.cgi?id=10138#c8 -- Summary: warn for read-only uninitialized variables passed as arguments Product: gcc Version: 4.3.0 Status: UNCONFIRMED Severity: enhancement Priority: P3 Component: middle-end AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: manu at gcc dot gnu dot org OtherBugsDependingO 10138 nThis: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33086