From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30908 invoked by alias); 11 Jul 2005 18:07:42 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 30113 invoked by uid 22791); 11 Jul 2005 18:07:31 -0000 Received: from k-gate.dachau.marco.de (HELO k-gate.dachau.marco.de) (192.54.39.254) by sourceware.org (qpsmtpd/0.30-dev) with SMTP; Mon, 11 Jul 2005 18:07:31 +0000 Received: from hera.dachau.marco.de (1778 bytes) by k-gate.dachau.marco.de via rsmtp with P:bsmtp/R:inet/T:smtp (sender: ) id for ; Mon, 11 Jul 2005 20:07:24 +0200 (MEST) (Smail-3.2.0.101 1997-Dec-17 #1 built 2005-May-10) Received: from localhost (1347 bytes) by hera.dachau.marco.de via smail with P:stdio/R:smart_host/T:gate_uusmtp (sender: ) (ident using unix) id for ; Mon, 11 Jul 2005 20:07:20 +0200 (CEST) (Smail-3.2.0.101 1997-Dec-17 #1 built 2005-May-10) Message-Id: Subject: attribute initialized To: gcc@gcc.gnu.org Date: Mon, 11 Jul 2005 18:07:00 -0000 From: Sylvester Diehl Cc: diehl@dachau.marco.de (Sylvester Diehl) MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-SW-Source: 2005-07/txt/msg00442.txt.bz2 Hello why doesn't gcc (-Wall -Wuninitalized -O) detect=20 an uninialized variable passed by reference decleared as const * ? Do we need an attribute like (("initialized")) in the function prototype to give gcc an hint to force checking of uninitalized parameters ? example file foo.c: --------- cut here /* gcc -Wall -Wuninitialized -O foo.c */ #include int foo(int const *p) { static int sum =3D 0; sum +=3D *p; return sum; } int main(int argc, char **argv) { int k; return printf("%d\n", foo(&k)); } --------- cut here end of file foo.c p.s. i know i could pass the variable by value to get a warning of an uninitalized variable. --=20 Sylvester Diehl marco Systemanalyse und Entwicklung GmbH Tel +49 8131 5161 42 Hans-B=F6ckler-Str. 2, D 85221 Dachau Fax +49 8131 5161 66 http://www.marco.de/ Email diehl@marco.de