[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#384110: libqt4-dev: using QHash or QSet results in type-punned pointer strict-aliasing warning



Package: libqt4-dev
Version: 4.1.4-1
Severity: normal

Whenever I try to use QHash or QSet (which is built from QHash) I get a
billion warnings from qhash.h like the following:

/usr/include/qt4/QtCore/qhash.h:236:   instantiated from ‘void
QHash<Key, T>::detach() [with Key = int, T = QHashDummyValue]’
/usr/include/qt4/QtCore/qhash.h:711:   instantiated from ‘void
QHash<Key, T>::reserve(int) [with Key = int, T = QHashDummyValue]’
/usr/include/qt4/QtCore/qset.h:146:   instantiated from ‘void
QSet<T>::reserve(int) [with T = int]’
/usr/include/qt4/QtCore/qset.h:204:   instantiated from ‘QSet<T>
QList<T>::toSet() const [with T = int]’
example.cpp:194:   instantiated from here
/usr/include/qt4/QtCore/qhash.h:477: warning: dereferencing type-punned
pointer will break strict-aliasing rules

The line of my actual code is usually when I'm doing something very
simple, like using operator[]. The same exact code replacing QHash for
QMap always gets rid of the warning.

Unfortunately, this isn't even a workaround, because QSet always uses
QHash, so to get a list of unique keys from a multimap:

QList<int> keys = multimap.keys().toSet()

This also results in the warning quoted above.

Anyway, the problem appears to be in the QHash detach_helper method,
where it does a lot of reinterpret casting and then deferences a
pointer. I haven't yet investigated what needs to be done to fix this code.

-- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.17-1-amd64-k8
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)

Versions of packages libqt4-dev depends on:
ii  libaudio-dev                1.8-2        The Network Audio System (NAS). (d
ii  libfreetype6-dev            2.2.1-2      FreeType 2 font engine, developmen
ii  libgl1-mesa-dev [libgl-dev] 6.4.2-1.1    A free implementation of the OpenG
ii  libglu1-mesa-dev [libglu-de 6.4.2-1.1    The OpenGL utility library -- deve
ii  libglu1-xorg-dev            1:7.0.23     transitional package for Debian et
ii  libice-dev                  1:1.0.0-3    X11 Inter-Client Exchange library 
ii  libjpeg62-dev               6b-13        Development files for the IJG JPEG
ii  libmng-dev                  1.0.9-1      M-N-G library (Development headers
ii  libpng12-dev [libpng12-0-de 1.2.8rel-5.2 PNG library - development
ii  libqt4-core                 4.1.4-1      Qt 4 core non-GUI functionality ru
ii  libqt4-gui                  4.1.4-1      Qt 4 core GUI functionality runtim
ii  libqt4-qt3support           4.1.4-1      Qt 3 compatibility library for Qt 
ii  libqt4-sql                  4.1.4-1      Qt 4 SQL database module
ii  libsm-dev                   1:1.0.0-4    X11 Inter-Client Exchange library 
ii  libx11-dev                  2:1.0.0-8    X11 client-side library (developme
ii  libxcursor-dev              1.1.5.2-5    X cursor management library (devel
ii  libxext-dev                 1:1.0.0-4    X11 miscellaneous extensions libra
ii  libxft-dev                  2.1.8.2-8    FreeType-based font drawing librar
ii  libxi-dev                   1:1.0.0-5    X11 Input extension library (devel
ii  libxinerama-dev             1:1.0.1-4.1  X11 Xinerama extension library (de
ii  libxmu-dev                  1:1.0.1-3    X11 miscellaneous utility library 
ii  libxrandr-dev               2:1.1.0.2-4  X11 RandR extension library (devel
ii  libxrender-dev              1:0.9.0.2-4  X Rendering Extension client libra
ii  libxt-dev                   1:1.0.0-5    X11 toolkit intrinsics library (de
ii  x11proto-core-dev           7.0.4-3      X11 core wire protocol and auxilia
ii  xlibmesa-gl-dev             1:7.0.23     transitional package for Debian et
ii  zlib1g-dev                  1:1.2.3-13   compression library - development

Versions of packages libqt4-dev recommends:
ii  qt4-dev-tools                 4.1.4-1    Qt 4 development tools

-- no debconf information



Reply to: