From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6884 invoked by alias); 29 Nov 2005 06:14:04 -0000 Received: (qmail 6875 invoked by uid 48); 29 Nov 2005 06:14:02 -0000 Date: Tue, 29 Nov 2005 06:14:00 -0000 Subject: [Bug c/25151] New: GCC issues warnings to a syntactically correct expression. X-Bugzilla-Reason: CC Message-ID: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "mishabear at gmail dot com" 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 X-SW-Source: 2005-11/txt/msg03933.txt.bz2 List-Id: Put the following code in a file tt.c and compile tt.c with command "gcc -Wall tt.c", then the compiler will complain. int main() { void *pv; pv = (pv=0); return 0; } The compiler complains: tt.c: In function `main': tt.c:5: warning: operation on `pv' may be undefined The result of "gcc --version" is: gcc (GCC) 3.2.3 20030502 (Red Hat Linux 3.2.3-52) Copyright (C) 2002 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. The result of "cat /etc/issue" is: Red Hat Enterprise Linux AS release 3 (Taroon Update 5) Kernel \r on an \m The result of "uname -a" is: Linux AS3-A64 2.4.21-32.EL #1 SMP Fri Apr 15 21:02:58 EDT 2005 x86_64 x86_64 x86_64 GNU/Linux In fact the type of pv has no matter with the warning. The warning will still show up if the type of pv is changed to int, short or double. -- Summary: GCC issues warnings to a syntactically correct expression. Product: gcc Version: 3.2.3 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: mishabear at gmail dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25151