summaryrefslogtreecommitdiff
path: root/mg.c
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2020-03-20 09:06:57 +0000
committerDavid Mitchell <davem@iabyn.com>2020-03-20 09:06:57 +0000
commit1943af6140f72047c5028b50f947b52f8998bebd (patch)
treea02ab1e3de087e1e3bc503d0da81238ad9e9c197 /mg.c
parentb33ac5557cb0255702946345f30e9a5ef0e8d88f (diff)
downloadperl-1943af6140f72047c5028b50f947b52f8998bebd.tar.gz
fixup to free_and_set_cop_warnings()
v5.31.9-156-g94c8b9c1f0 introduced the free_and_set_cop_warnings() macro. It's first argument expects a COP rather than a COP*. Its usage in S_restore_cop_warnings(() is to modify PL_cucop, but in order to pass a COP rather than a COP*, the original commit made a local copy of PL_curcop and ended up inadvertently updating the copy instead. This commit changes the maco so it expects a COP*, and updates the bulk of its callers to use &PL_compiling rather than PL_compiling, and fixes up S_restore_cop_warnings(). The symptoms were ASAN failures in a few test scripts including uni/parser.t and ext/XS-APItest/t/handy0*.t. (The S_restore_cop_warnings() function was only used by Perl__force_out_malformed_utf8_message(), so didn't cause many issues outside of test scripts which forced such "malformed "errors).
Diffstat (limited to 'mg.c')
-rw-r--r--mg.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/mg.c b/mg.c
index b21f4d3c2b..e603b60989 100644
--- a/mg.c
+++ b/mg.c
@@ -2966,7 +2966,7 @@ Perl_magic_set(pTHX_ SV *sv, MAGIC *mg)
else if (strEQ(mg->mg_ptr+1, "ARNING_BITS")) {
if ( ! (PL_dowarn & G_WARN_ALL_MASK)) {
if (!SvPOK(sv)) {
- free_and_set_cop_warnings(PL_compiling, pWARN_STD);
+ free_and_set_cop_warnings(&PL_compiling, pWARN_STD);
break;
}
{
@@ -2978,9 +2978,9 @@ Perl_magic_set(pTHX_ SV *sv, MAGIC *mg)
not_all |= ptr[i] ^ 0x55;
}
if (!not_none) {
- free_and_set_cop_warnings(PL_compiling, pWARN_NONE);
+ free_and_set_cop_warnings(&PL_compiling, pWARN_NONE);
} else if (len >= WARNsize && !not_all) {
- free_and_set_cop_warnings(PL_compiling, pWARN_ALL);
+ free_and_set_cop_warnings(&PL_compiling, pWARN_ALL);
PL_dowarn |= G_WARN_ONCE ;
}
else {