You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl-cvs@perl.apache.org by st...@apache.org on 2014/08/13 10:20:59 UTC

svn commit: r1617680 - /perl/modperl/trunk/src/modules/perl/modperl_env.c

Author: stevehay
Date: Wed Aug 13 08:20:58 2014
New Revision: 1617680

URL: http://svn.apache.org/r1617680
Log:
[PATCH] Fix invalid code that breaks with GCC 4.9 -ftree-dse optimization

Patch from Niko Tyni:

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

Modified:
    perl/modperl/trunk/src/modules/perl/modperl_env.c

Modified: perl/modperl/trunk/src/modules/perl/modperl_env.c
URL: http://svn.apache.org/viewvc/perl/modperl/trunk/src/modules/perl/modperl_env.c?rev=1617680&r1=1617679&r2=1617680&view=diff
==============================================================================
--- perl/modperl/trunk/src/modules/perl/modperl_env.c (original)
+++ perl/modperl/trunk/src/modules/perl/modperl_env.c Wed Aug 13 08:20:58 2014
@@ -37,12 +37,13 @@ static unsigned long modperl_interp_addr
 #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;                                          \