From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28380 invoked by alias); 26 May 2009 06:38:01 -0000 Received: (qmail 28297 invoked by uid 48); 26 May 2009 06:37:48 -0000 Date: Tue, 26 May 2009 06:38:00 -0000 Subject: [Bug c/40251] New: Using the -V option makes the compiler to exit with 0 exit code on error X-Bugzilla-Reason: CC Message-ID: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "zoltan at bendor dot com dot au" 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: 2009-05/txt/msg02011.txt.bz2 If a file has errors and gcc gets the -V X.X.X command line option, then the exit code is 0. The following illustrates it: [zoltan manocska]~>arm-elf-gcc --version arm-elf-gcc (GCC) 4.4.0 Copyright (C) 2009 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. [zoltan manocska]~>echo "@" > test.c [zoltan manocska]~>arm-elf-gcc -c test.c test.c:1: error: stray ‘@’ in program [zoltan manocska]~>echo $? 1 [zoltan manocska]~>arm-elf-gcc -V 4.4.0 -c test.c test.c:1: error: stray ‘@’ in program [zoltan manocska]~>echo $? 0 [zoltan manocska]~>arm-elf-gcc -V 4.0.2 -c test.c test.c:1: error: stray ‘@’ in program [zoltan manocska]~>echo $? 0 In a makefile, where a specific compiler is chosen, this bug causes very severe headaches. I don't know if it's true for all targets, but I tried it with arm-elf and mips-elf, they both show the same erroneous behaviour. Before the 4.4.0 compiler was installed, the 4.0.2 compiler did not exhibit this bug: [zoltan manocska]~>arm-elf-gcc-4.0.2 -c test.c test.c:1: error: stray ‘@’ in program [zoltan manocska]~>echo $? 1 [zoltan manocska]~>arm-elf-gcc-4.0.2 -V 4.0.2 -c test.c test.c:1: error: stray ‘@’ in program [zoltan manocska]~>echo $? 1 [zoltan manocska]~>arm-elf-gcc-4.0.2 -V 4.4.0 -c test.c test.c:1: error: stray ‘@’ in program [zoltan manocska]~>echo $? 1 -- Summary: Using the -V option makes the compiler to exit with 0 exit code on error Product: gcc Version: 4.4.0 Status: UNCONFIRMED Severity: major Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: zoltan at bendor dot com dot au GCC host triplet: x86-elf-linux GCC target triplet: arm-elf-none http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40251