From 4b20544cd66ed46b397a9b0e14ca2a5feff30d84 Mon Sep 17 00:00:00 2001 From: Uwe Rathmann Date: Fri, 3 Nov 2017 19:58:21 +0100 Subject: [PATCH] working around a gcc optimzation bug with gcc 4/5/6 gcc 7 seems to be o.k. --- src/controls/QskControl.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/controls/QskControl.cpp b/src/controls/QskControl.cpp index 66cd2fb5..3804a5d0 100644 --- a/src/controls/QskControl.cpp +++ b/src/controls/QskControl.cpp @@ -1307,8 +1307,20 @@ void QskControl::updateImplicitSize() const QSizeF hint = contentsSizeHint(); - const auto w = ( hint.width() >= 0 ) ? dw + hint.width() : 0.0; - const auto h = ( hint.height() >= 0 ) ? dh + hint.height() : 0.0; + const qreal w = ( hint.width() >= 0 ) ? dw + hint.width() : 0.0; + const qreal h = ( hint.height() >= 0 ) ? dh + hint.height() : 0.0; + +#ifdef __GNUC__ +#if ( __GNUC__ * 100 + __GNUC_MINOR__) <= 700 + /* + Certain gcc optimizer ( >= -O2 ) seem to be too motivated + ( found with gcc 5.3.1/6.2.1, gcc 7.1.1 is o.k. ). + A volatile local variable prevents those versions from creating wrong code. + */ + const volatile qreal dummy = w; + (void)dummy; +#endif +#endif setupImplicitSizeConnections( false ); setImplicitSize( w, h );