From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18303 invoked by alias); 1 Jun 2012 21:19:32 -0000 Received: (qmail 18293 invoked by uid 22791); 1 Jun 2012 21:19:31 -0000 X-SWARE-Spam-Status: No, hits=-4.3 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00,KHOP_THREADED X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 01 Jun 2012 21:19:18 +0000 From: "eggert at gnu dot org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/48968] incorrect warning about longjmp/vfork clobbering a local (-W -O2, x86-64) Date: Fri, 01 Jun 2012 21:19:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: eggert at gnu dot org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 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: 2012-06/txt/msg00081.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48968 --- Comment #7 from eggert at gnu dot org 2012-06-01 21:19:16 UTC --- Created attachment 27546 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=27546 alternate test case, for x86, showing "({anonymous}) might be clobbered" By compiling on x86 (as opposed to x86-64) and tweaking the source code a bit I got a different diagnostic "error: variable '({anonymous})' might be clobbered by 'longjmp' or 'vfork'" which may help indicate where the problem is. Uncompress and compile the attached program with: gcc -v -m32 -std=gnu99 -c -Werror=clobbered -g -O2 t.i and the output is: Using built-in specs. COLLECT_GCC=gcc Target: x86_64-unknown-linux-gnu Configured with: ../gcc-4.7.0/configure --prefix=/home/eggert/opt/Linux-x86_64/gcc-4.7.0 --disable-nls Thread model: posix gcc version 4.7.0 (GCC) COLLECT_GCC_OPTIONS='-v' '-m32' '-std=gnu99' '-c' '-Werror=clobbered' '-g' '-O2' '-mtune=generic' '-march=x86-64' /home/eggert/opt/Linux-x86_64/gcc-4.7.0/libexec/gcc/x86_64-unknown-linux-gnu/4.7.0/cc1 -fpreprocessed t.i -quiet -dumpbase t.i -m32 -mtune=generic -march=x86-64 -auxbase t -g -O2 -Werror=clobbered -std=gnu99 -version -o /tmp/cc9OhgtR.s GNU C (GCC) version 4.7.0 (x86_64-unknown-linux-gnu) compiled by GNU C version 4.7.0, GMP version 4.3.2, MPFR version 3.0.0, MPC version 0.8.3-dev GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 GNU C (GCC) version 4.7.0 (x86_64-unknown-linux-gnu) compiled by GNU C version 4.7.0, GMP version 4.3.2, MPFR version 3.0.0, MPC version 0.8.3-dev GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 Compiler executable checksum: 0b542ccc033bf565e8473ef2771f60ec t.i: In function 'read_char': t.i:14930:1: error: variable '({anonymous})' might be clobbered by 'longjmp' or 'vfork' [-Werror=clobbered] t.i:14930:1: error: variable '({anonymous})' might be clobbered by 'longjmp' or 'vfork' [-Werror=clobbered] t.i:14930:1: error: variable '({anonymous})' might be clobbered by 'longjmp' or 'vfork' [-Werror=clobbered] t.i:14930:1: error: variable '({anonymous})' might be clobbered by 'longjmp' or 'vfork' [-Werror=clobbered] cc1: some warnings being treated as errors