From a2db6c92fc2880ba1f288b6c4599a779997dd4e7 Mon Sep 17 00:00:00 2001 From: Tony Cook Date: Thu, 9 Apr 2015 15:45:16 +1000 Subject: [PATCH] [perl #123971] fix long double pack padding on newer GCC --- pp_pack.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/pp_pack.c b/pp_pack.c index 06adade..1d732a8 100644 --- a/pp_pack.c +++ b/pp_pack.c @@ -2709,6 +2709,12 @@ S_pack_rec(pTHX_ SV *cat, tempsym_t* symptr, SV **beglist, SV **endlist ) #ifdef __GNUC__ /* to work round a gcc/x86 bug; don't use SvNV */ anv.nv = sv_2nv(fromstr); +# if defined(LONGDOUBLE_X86_80_BIT) && defined(USE_LONG_DOUBLE) \ + && LONG_DOUBLESIZE > 10 + /* GCC sometimes overwrites the padding in the + assignment above */ + Zero(anv.bytes+10, sizeof(anv.bytes) - 10, U8); +# endif #else anv.nv = SvNV(fromstr); #endif @@ -2726,6 +2732,11 @@ S_pack_rec(pTHX_ SV *cat, tempsym_t* symptr, SV **beglist, SV **endlist ) # ifdef __GNUC__ /* to work round a gcc/x86 bug; don't use SvNV */ aldouble.ld = (long double)sv_2nv(fromstr); +# if defined(LONGDOUBLE_X86_80_BIT) && LONG_DOUBLESIZE > 10 + /* GCC sometimes overwrites the padding in the + assignment above */ + Zero(aldouble.bytes+10, sizeof(aldouble.bytes) - 10, U8); +# endif # else aldouble.ld = (long double)SvNV(fromstr); # endif -- 1.7.10.4