https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103954
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |INVALID Status|UNCONFIRMED |RESOLVED --- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> --- enum EnumSeriProto : guint32 { seriNone = 0, seriRidl = 1, seriPython = 2, seriJava = 3, seriInvalid = 4 }; .... EnumSeriProto dwSeriProto = seriNone; ret = GetSeriProto( pResp, dwSeriProto ); ... return oCfg.GetIntProp( propSeriProto, ( guint32& )dwSeriProto ); ... gint32 GetIntProp( gint32 iProp, guint32& val ) const { return GetPrimProp( iProp, val ); } ... template< typename PrimType, ... > gint32 GetPrimProp( gint32 iProp, PrimType& val ) const { gint32 ret = 0; if( m_pConstCfg == nullptr ) return - # 1212 "/usr/local/include/rpcf/configdb.h" 3 4 14 # 1212 "/usr/local/include/rpcf/configdb.h" ; auto pdb2 = static_cast< const CConfigDb2* const >( m_pConstCfg ); do{ const Variant* p = pdb2->GetPropertyPtr( iProp ); if( p == nullptr ) { ret = - # 1220 "/usr/local/include/rpcf/configdb.h" 3 4 2 # 1220 "/usr/local/include/rpcf/configdb.h" ; break; } val = *p; }while( 0 ); return ret; } enum types don't alias the underlaying type and therefore this code is undefined at runtime. Use Either a memcpy (or an union) inside GetSeriProto or use -fno-strict-aliasing.