[Webkit-unassigned] [Bug 28391] Incorrect casts in JavaScriptCore with gcc-3.4

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Aug 21 10:57:00 PDT 2009


https://bugs.webkit.org/show_bug.cgi?id=28391


Eric Seidel <eric at webkit.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #34969|review?                     |review-
               Flag|                            |




--- Comment #3 from Eric Seidel <eric at webkit.org>  2009-08-21 10:57:00 PDT ---
(From update of attachment 34969)
No your fault, but I went to look up WTF::bitwise_cast, only to find that the
comment next to bitwise_cast is basically useless:

    /*
     * C++'s idea of a reinterpret_cast lacks sufficient cojones.
     */
    template<typename TO, typename FROM>
    TO bitwise_cast(FROM from)
    {
        COMPILE_ASSERT(sizeof(TO) == sizeof(FROM),
WTF_bitwise_cast_sizeof_casted_types_is_equal);
        union {
            FROM from;
            TO to;
        } u;
        u.from = from;
        return u.to;
    }

And I would expect that bitwise_cast violates the c++ standard, since I've been
told that only the last union member you write to is valid to read from, any
other member is undefined.  (I've also been told the GCC does define this
behavior and that our use of unions here will work for GCC.   I'm anything bug
a C++ standards expert though.)

I agree with oliver,  GCC 3.x is not supported for WebKit.  I don't think we
should take one-off patches for it, since it's undoubtably going to break
again.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list