summaryrefslogtreecommitdiff
path: root/regcomp.c
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2016-03-18 22:36:40 +0000
committerDavid Mitchell <davem@iabyn.com>2016-03-18 22:36:40 +0000
commit34f817bafdabdc84f560b8d590af294880f66e67 (patch)
tree0db840a7fc5b48db6f93201a6130c8f79385accc /regcomp.c
parentcc93400aa5a8d556c56c28a8de644bd178d050d4 (diff)
downloadperl-34f817bafdabdc84f560b8d590af294880f66e67.tar.gz
regex sets: fix Solaris optimiser bug (2nd attempt)
[perl #127455] My first fix for this, (v5.23.7-586-gd9cb841) didn't actually fix it. The diagnosis was correct, but somewhere during fixing and testing I went wrong, and the optimiser bug was still being triggered without me spotting it. The new approach, based on a suggestion by Tony C, is simply to declare the errant local var 'fence' to be volatile. This stops the compiler from optimising away its value.
Diffstat (limited to 'regcomp.c')
-rw-r--r--regcomp.c20
1 files changed, 4 insertions, 16 deletions
diff --git a/regcomp.c b/regcomp.c
index aae29f1034..f8dc8a1bb4 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -14547,7 +14547,9 @@ S_handle_regex_sets(pTHX_ RExC_state_t *pRExC_state, SV** return_invlist,
'stack' of where the undealt-with left
parens would be if they were actually
put there */
- IV fence = 0; /* Position of where most recent undealt-
+ /* The 'volatile' is a workaround for an optimiser bug
+ * in Solaris Studio 12.3. See RT #127455 */
+ volatile IV fence = 0; /* Position of where most recent undealt-
with left paren in stack is; -1 if none.
*/
STRLEN len; /* Temporary */
@@ -15152,21 +15154,7 @@ redo_curchar:
* may have altered the stack in the time since we earlier set
* 'top_index'. */
- {
- /* Work round an optimiser bug in Solaris Studio 12.3:
- * for some reason, the presence of the __assert() in
- * av_tindex_nomg() causes the value of fence to get
- * corrupted, even though the assert is never called. So
- * save the value then restore afterwards.
- * Note that in fact merely accessing the value of fence
- * prior to the statement containing the assert is enough
- * to make the bug go away.
- */
- IV f = fence;
- top_index = av_tindex_nomg(stack);
- fence = f;
- }
-
+ top_index = av_tindex_nomg(stack);
if (top_index - fence >= 0) {
/* If the top entry on the stack is an operator, it had better
* be a '!', otherwise the entry below the top operand should