You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@perl.apache.org by Niko Tyni <nt...@debian.org> on 2014/08/10 22:16:01 UTC

[PATCH] Fix invalid code that breaks with GCC 4.9 -ftree-dse optimization

This fixes SIGSEGVs at the start of the test suite when built with
GCC-4.9 at -O2 (which includes -ftree-dse).

Quoting Richard Biener in https://gcc.gnu.org/PR62035 :

> so 'sv' is declared inside the 'else' but you make its address escape
> through the 'svp' variable declared in the outer block.

Bug-Debian: http://bugs.debian.org/754901
---
 src/modules/perl/modperl_env.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/modules/perl/modperl_env.c b/src/modules/perl/modperl_env.c
index 769fd2c..c1a276b 100644
--- a/src/modules/perl/modperl_env.c
+++ b/src/modules/perl/modperl_env.c
@@ -37,12 +37,13 @@ static unsigned long modperl_interp_address(pTHX)
 #define MP_ENV_HV_STORE(hv, key, val) STMT_START {              \
         I32 klen = strlen(key);                                 \
         SV **svp = hv_fetch(hv, key, klen, FALSE);              \
+        SV *sv;                                                 \
                                                                 \
         if (svp) {                                              \
             sv_setpv(*svp, val);                                \
         }                                                       \
         else {                                                  \
-            SV *sv = newSVpv(val, 0);                           \
+            sv = newSVpv(val, 0);                               \
             (void)hv_store(hv, key, klen, sv, FALSE);           \
             modperl_envelem_tie(sv, key, klen);                 \
             svp = &sv;                                          \
-- 
2.1.0.rc1


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Re: [PATCH] Fix invalid code that breaks with GCC 4.9 -ftree-dse optimization

Posted by Steve Hay <st...@googlemail.com>.
On 10 August 2014 21:16, Niko Tyni <nt...@debian.org> wrote:
> This fixes SIGSEGVs at the start of the test suite when built with
> GCC-4.9 at -O2 (which includes -ftree-dse).
>

Thanks for the patch. Now applied in revision 1617680.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org