From 43b2584f79ba62fbff6e1cb2b69c862dcbd09dd4 Mon Sep 17 00:00:00 2001 From: Braden Obrzut Date: Sun, 30 Oct 2016 23:27:29 -0400 Subject: [PATCH] - Fixed: Reference to freed stack object in R_FindPlane. This caused a massive slowdown (90% drop in total performance) in R_FindPlane when built with optimizations on in GCC6. Although I don't really understand why since the comparison should have been O(1) regardless of memory contents and even if the check failed every plane it would still be pretty fast, this is what they mean when they say that anything can happen when undefined behavior is triggered. --- src/r_plane.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/r_plane.cpp b/src/r_plane.cpp index 07efb84b4d..52dfd43323 100644 --- a/src/r_plane.cpp +++ b/src/r_plane.cpp @@ -595,9 +595,10 @@ visplane_t *R_FindPlane (const secplane_t &height, FTextureID picnum, int lightl fixed_t alpha = FLOAT2FIXED(Alpha); //angle_t angle = (xform.Angle + xform.baseAngle).BAMs(); + FTransform nulltransform; + if (picnum == skyflatnum) // killough 10/98 { // most skies map together - FTransform nulltransform; lightlevel = 0; xform = &nulltransform; nulltransform.xOffs = nulltransform.yOffs = nulltransform.baseyOffs = 0;