We incorrectly stored the archinfo_host argument of iselSB_S390 into
a global variable not realising it points to a stack-allocated variable.
This caused s390_archinfo_host->hwcaps member to change its value
randomly over time. It could have caused invalid code to be generated.
Curious that it did not surface.
git-svn-id: svn://svn.valgrind.org/vex/trunk@2297 8f6e269a-dfd6-0310-a8e1-e2731360e62c
diff --git a/priv/host_s390_isel.c b/priv/host_s390_isel.c
index 9400012..35226f9 100644
--- a/priv/host_s390_isel.c
+++ b/priv/host_s390_isel.c
@@ -2619,7 +2619,9 @@
/*--- Insn selector top-level ---*/
/*---------------------------------------------------------*/
-/* Translate an entire SB to s390 code. */
+/* Translate an entire SB to s390 code.
+ Note: archinfo_host is a pointer to a stack-allocated variable.
+ Do not assign it to a global variable! */
HInstrArray *
iselSB_S390(IRSB *bb, VexArch arch_host, VexArchInfo *archinfo_host,
@@ -2632,8 +2634,8 @@
ISelEnv *env;
UInt hwcaps_host = archinfo_host->hwcaps;
- /* KLUDGE: export archinfo_host. */
- s390_archinfo_host = archinfo_host;
+ /* KLUDGE: export hwcaps. */
+ s390_host_hwcaps = hwcaps_host;
/* Do some sanity checks */
vassert((VEX_HWCAPS_S390X(hwcaps_host) & ~(VEX_HWCAPS_S390X_ALL)) == 0);