From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12840 invoked by alias); 2 Dec 2004 21:21:12 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 12770 invoked by uid 48); 2 Dec 2004 21:21:09 -0000 Date: Thu, 02 Dec 2004 21:21:00 -0000 From: "markus at oberhumer dot com" To: gcc-bugs@gcc.gnu.org Message-ID: <20041202212109.18799.markus@oberhumer.com> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug c/18799] New: error: static declaration of 'x' follows non-static declaration X-Bugzilla-Reason: CC X-SW-Source: 2004-12/txt/msg00415.txt.bz2 List-Id: This code used to give a warning on gcc 3.2 and gcc 3.3, gcc 3.4 does not warn at all, and current mainline 4.0 makes this an error. What do the C89 and C99 standards actually say here ? + cat x.c extern int x[]; static int x[2]; int *foo(void) { return x; } + gcc-3.2 -std=c89 -Wall -W -pedantic -c x.c x.c:2: warning: static declaration for `x' follows non-static + gcc-3.3 -std=c89 -Wall -W -pedantic -c x.c x.c:2: warning: static declaration for `x' follows non-static + gcc-3.4 -std=c89 -Wall -W -pedantic -c x.c + gcc-4.0 -std=c89 -Wall -W -pedantic -c x.c x.c:2: error: static declaration of 'x' follows non-static declaration x.c:1: error: previous declaration of 'x' was here + gcc-3.2 -std=c99 -Wall -W -pedantic -c x.c x.c:2: warning: static declaration for `x' follows non-static + gcc-3.3 -std=c99 -Wall -W -pedantic -c x.c x.c:2: warning: static declaration for `x' follows non-static + gcc-3.4 -std=c99 -Wall -W -pedantic -c x.c + gcc-4.0 -std=c99 -Wall -W -pedantic -c x.c x.c:2: error: static declaration of 'x' follows non-static declaration x.c:1: error: previous declaration of 'x' was here -- Summary: error: static declaration of 'x' follows non-static declaration Product: gcc Version: 4.0.0 Status: UNCONFIRMED Severity: normal Priority: P2 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: markus at oberhumer dot com CC: gcc-bugs at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18799