[ wxwindows-Bugs-1618449 ] Some warnings under Linux (compile g++ 4.1.2)

SourceForge.net noreply at sourceforge.net
Mon Apr 9 13:51:49 PDT 2007


Bugs item #1618449, was opened at 2006-12-19 00:01
Message generated for change (Comment added) made by wojdyr
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=109863&aid=1618449&group_id=9863

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Build -- unix
Group: Trivial
Status: Pending
Resolution: None
Priority: 6
Private: No
Submitted By: Steven Van Ingelgem (g00fy)
Assigned to: Nobody/Anonymous (nobody)
Summary: Some warnings under Linux (compile g++ 4.1.2)

Initial Comment:
/usr/include/wx-2.8/wx/hashmap.h: In member function ‘wxLongToLongHashMap_wxImplementation_HashTable::Node** wxLongToLongHashMap_wxImplementation_HashTable::
GetNodePtr(const long int&) const’:
/usr/include/wx-2.8/wx/hashmap.h:714: warning: dereferencing type-punned pointer will break strict-aliasing rules
/usr/include/wx-2.8/wx/gdicmn.h: In member function ‘wxStringToColourHashMap_wxImplementation_HashTable::Node** wxStringToColourHashMap_wxImplementation_Hash
Table::GetNodePtr(const wxString&) const’:
/usr/include/wx-2.8/wx/gdicmn.h:544: warning: dereferencing type-punned pointer will break strict-aliasing rules
/usr/include/wx-2.8/wx/clntdata.h: In member function ‘wxShadowObjectMethods_wxImplementation_HashTable::Node** wxShadowObjectMethods_wxImplementation_HashTa
ble::GetNodePtr(const wxString&) const’:
/usr/include/wx-2.8/wx/clntdata.h:20: warning: dereferencing type-punned pointer will break strict-aliasing rules
/usr/include/wx-2.8/wx/clntdata.h: In member function ‘wxShadowObjectFields_wxImplementation_HashTable::Node** wxShadowObjectFields_wxImplementation_HashTabl
e::GetNodePtr(const wxString&) const’:
/usr/include/wx-2.8/wx/clntdata.h:25: warning: dereferencing type-punned pointer will break strict-aliasing rules



Greetz :)

----------------------------------------------------------------------

Comment By: Marcin Wojdyr (wojdyr)
Date: 2007-04-09 22:51

Message:
Logged In: YES 
user_id=586843
Originator: NO

All these warnings are from methods:
wx...._wxImplementation_HashTable::GetNodePtr(const long int&) const

After preprocessing, this line makes the problem: 
node = (Node**)&(*node)->m_nxt;

The method looks like this:

      Node** GetNodePtr( const const_key_type& key ) const
      {
        size_t bucket = m_hasher( key ) % m_tableBuckets;
        Node** node = &m_table[bucket];
        while( *node )
          {
            if( m_equals( m_getKey( (*node)->m_value ), key ) )
                return node;
            node = (Node**)&(*node)->m_nxt;
          }
        return __null;
      }



----------------------------------------------------------------------

Comment By: Vadim Zeitlin (vadz)
Date: 2007-01-07 23:51

Message:
Logged In: YES 
user_id=71618
Originator: NO

I've just realized that we already do use -fno-strict-aliasing so I
understand even less why is this warning given. Could you please show the
compiler command line?

----------------------------------------------------------------------

Comment By: Vadim Zeitlin (vadz)
Date: 2007-01-07 02:47

Message:
Logged In: YES 
user_id=71618
Originator: NO

We really need to fix this but for this we need to understand where exacty
(for which pointer) this is given which would probably require
preprocessing the code (to expand the macro) and then compiling it.

For now the workaround is to use -fno-strict-aliasing gcc option.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=109863&aid=1618449&group_id=9863




More information about the wx-dev mailing list