This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug middle-end/38587] [4.4 Regression] psim miscompiled #2



------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]