Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-116821

QNativeIpcKey: UB (inactive union member used)

    XMLWordPrintable

Details

    • 3
    • eb5c5a76c (dev), ef5f2322a (6.6), 93a3deb97 (6.6.0)

    Description

      Quoting https://codereview.qt-project.org/c/qt/qtbase/+/497361/comment/08c2108e_11340ef4/ :

      Either d or typeAndFlags are the active member. We read d and isSlowPath() reads typeAndFlags. So a compiler can legitimately conclude that lhs.d must always be == rhs.d because reading typeAndFlags after asserting (by reading it) that d is the active member would be UB and cannot happen.

      While the above is about operator== specifically, I expect much of the class to have the same issue.

      Acceptance criteria:

      • the union d/typeAndFlags is gone and replaced by a non-variant member and manual bit-fiddling

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            thiago Thiago Macieira
            mmutz Marc Mutz
            Vladimir Minenko Vladimir Minenko
            Alex Blasche Alex Blasche
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes