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

Bug#548274: Incomprehensible error message when strict aliasing rules are broken

Package: g++-4.4
Version: 4.4.1-4
Severity: normal

  cwidget doesn't compile cleanly with g++-4.4 because it violates
"strict aliasing rules"; apparently they've been made stricter in 4.4?
Unfortunately, the error message that g++ generates is very vague and
doesn't help much in tracking it down.

  The problem seems to be something to do with libsigc++:

/usr/include/sigc++-2.0/sigc++/limit_reference.h: In constructor ‘cwidget::widgets::menubar::menubar(bool)’:
/usr/include/sigc++-2.0/sigc++/limit_reference.h:81: error: dereferencing pointer ‘<anonymous>’ does break strict-aliasing rules
/usr/include/sigc++-2.0/sigc++/limit_reference.h:81: note: initialized from here

  Note that this is *all* of the error message; it doesn't make it clear
where the limit_reference template is instantiated from (which is a bug
IMO, hence why I'm filing one).  The code in question looks like this:

template <class T_type>
class limit_reference<T_type, true>
  /** Constructor.
   * @param _A_target The reference to limit.
  limit_reference(T_type& _A_target)
    : visited(_A_target),

  and it's being invoked like this:

    menubar::menubar(bool _always_visible)
      :container(), startloc(0), active(false),
       always_visible(_always_visible), curloc(0), subwidget(NULL)
      do_layout.connect(sigc::mem_fun(*this, &menubar::layout_me));

      focussed.connect(sigc::mem_fun(*this, &menubar::got_focus));
      unfocussed.connect(sigc::mem_fun(*this, &menubar::lost_focus));

  I know that menubar::menubar is the culprit, because when I comment
out these three lines, the error stops.  It also stops if I invoke
another method on menubar; not sure why, but maybe it helps:

    menubar::menubar(bool _always_visible)
      :container(), startloc(0), active(false),
       always_visible(_always_visible), curloc(0), subwidget(NULL)

      do_layout.connect(sigc::mem_fun(*this, &menubar::layout_me));

      focussed.connect(sigc::mem_fun(*this, &menubar::got_focus));
      unfocussed.connect(sigc::mem_fun(*this, &menubar::lost_focus));

  It looks like maybe an intermediate value is causing some trouble
and its name can't be displayed (hence <anonymous>), but I don't know
what's going on.  connect() and mem_fun() are invoked with pretty much
the same code as above in lots of places where no error occurs, and I
don't understand what I'm doing wrong (although I admit I'm not familiar
with the strict aliasing rules, so I could be breaking them by
accident).  Any advice or help would be appreciated; this has me

  I apologize for not having a better example than "compile cwidget" --
I spent some time trying to reproduce this with a simpler batch of code
and was entirely unsuccessful. :-(


-- System Information:
Debian Release: squeeze/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)

Kernel: Linux 2.6.30-1-686 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages g++-4.4 depends on:
ii  gcc-4.4                   4.4.1-4        The GNU C compiler
ii  gcc-4.4-base              4.4.1-4        The GNU Compiler Collection (base 
ii  libc6                     2.9-26         GNU C Library: Shared libraries
ii  libcloog-ppl0             0.15.7-1       the Chunky Loop Generator (runtime
ii  libgmp3c2                 2:4.3.1+dfsg-3 Multiprecision arithmetic library
ii  libgmpxx4ldbl             2:4.3.1+dfsg-3 Multiprecision arithmetic library 
ii  libmpfr1ldbl              2.4.1-2        multiple precision floating-point 
ii  libppl-c2                 0.10.2-2       Parma Polyhedra Library (C interfa
ii  libppl7                   0.10.2-2       Parma Polyhedra Library (runtime l
ii  libstdc++6-4.4-dev        4.4.1-4        The GNU Standard C++ Library v3 (d

g++-4.4 recommends no packages.

Versions of packages g++-4.4 suggests:
pn  g++-4.4-multilib              <none>     (no description available)
pn  gcc-4.4-doc                   <none>     (no description available)
pn  libstdc++6-4.4-dbg            <none>     (no description available)

-- no debconf information

Reply to: