From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14491 invoked by alias); 20 Jan 2009 15:49:46 -0000 Received: (qmail 14446 invoked by uid 48); 20 Jan 2009 15:49:27 -0000 Date: Tue, 20 Jan 2009 15:49:00 -0000 Message-ID: <20090120154927.14445.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug middle-end/38587] [4.4 Regression] psim miscompiled #2 In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "hjl dot tools at gmail dot com" 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-01/txt/msg02203.txt.bz2 ------- Comment #27 from hjl dot tools at gmail dot com 2009-01-20 15:49 ------- (In reply to comment #26) > Well, ISTR something about local variables need to be marked volatile if you > use setjmp/longjmp. Is psim really in compliance with what the standard says > here? See 7.13.2.1/3 "..., except that the values of objects of automatic > storage duration that are local to the function containing the invocation > of the corresponding setjmp macro that do not have volatile-qualified type and > have been changed between the setjmp invocation and longjmp call are > indeterminate" > This patch for sim: Index: sim/ppc/gen-idecode.c =================================================================== RCS file: /cvs/src/src/sim/ppc/gen-idecode.c,v retrieving revision 1.4 diff -u -p -r1.4 gen-idecode.c --- sim/ppc/gen-idecode.c 19 Jun 2003 18:42:30 -0000 1.4 +++ sim/ppc/gen-idecode.c 20 Jan 2009 15:48:18 -0000 @@ -708,11 +708,11 @@ print_run_until_stop_body(lf *file, } lf_putstr(file, "int last_cpu;\n"); if (generate_smp) { - lf_putstr(file, "int current_cpu;\n"); + lf_putstr(file, "volatile int current_cpu;\n"); } if ((code & generate_with_icache)) { - lf_putstr(file, "int cpu_nr;\n"); + lf_putstr(file, "volatile int cpu_nr;\n"); lf_putstr(file, "\n"); lf_putstr(file, "/* flush the icache of a possible break insn */\n"); lf_putstr(file, "for (cpu_nr = 0; cpu_nr < nr_cpus; cpu_nr++)\n"); seems to work for me. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38587