Bug 96005

Summary: Source/WebCore/platform/Length.cpp fails to build on PPC
Product: WebKit Reporter: Jeremy Huddleston Sequoia <jeremyhu>
Component: PlatformAssignee: Nobody <webkit-unassigned>
Status: RESOLVED WONTFIX    
Severity: Normal CC: simon.fraser
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
URL: https://trac.macports.org/ticket/35989
Bug Depends on:    
Bug Blocks: 126492    
Attachments:
Description Flags
preprocessed source none

Description Jeremy Huddleston Sequoia 2012-09-06 12:04:08 PDT
This was first discovered in MacPorts when building webkit-gtk-1.8.3:

https://trac.macports.org/ticket/35989

The source builds fine for i386 and x86_64 but fails to build for ppc.  This compile-time assert fails:
COMPILE_ASSERT(sizeof(Length) == sizeof(SameSizeAsLength), length_should_stay_small);

libtool: compile:  /usr/bin/g++-4.2 -DHAVE_CONFIG_H -I. -DBUILDING_WEBKIT -Wall -W -Wcast-align -Wchar-subscripts -Wreturn-type -Wformat -Wformat-security -Wno-format-y2k -Wundef -Wmissing-format-attribute -Wpointer-arith -Wwrite-strings -Wno-unused-parameter -Wno-parentheses -fno-exceptions -DENABLE_GLIB_SUPPORT=1 -DBUILDING_CAIRO__=1 -DBUILDING_GTK__=1 -DWTF_CHANGES -DXP_UNIX -DWTF_USE_ICU_UNICODE=1 -DWTF_USE_GSTREAMER=1 -DGTK_API_VERSION_2=1 -DNDEBUG -I./Source/ThirdParty/ANGLE/src -I./Source/ThirdParty/ANGLE/include -I./Source/ThirdParty/ANGLE/include/GLSLANG -I./Source/WebCore -I./Source/WebCore/accessibility -I./Source/WebCore/bindings -I./Source/WebCore/bindings/generic -I./Source/WebCore/bindings/js -I./Source/WebCore/bindings/js/specialization -I./Source/WebCore/bridge -I./Source/WebCore/bridge/c -I./Source/WebCore/bridge/jni/jsc -I./Source/WebCore/bridge/jsc -I./Source/WebCore/css -I./Source/WebCore/dom -I./Source/WebCore/dom/default -I./Source/WebCore/editing -I./Source/WebCore/fileapi -I./Source/WebCore/history -I./Source/WebCore/html -I./Source/WebCore/html/canvas -I./Source/WebCore/html/parser -I./Source/WebCore/html/shadow -I./Source/WebCore/html/track -I./Source/WebCore/inspector -I./Source/WebCore/loader -I./Source/WebCore/loader/appcache -I./Source/WebCore/loader/archive -I./Source/WebCore/loader/cache -I./Source/WebCore/loader/icon -I./Source/WebCore/mathml -I./Source/WebCore/mediastream -I./Source/WebCore/notifications -I./Source/WebCore/page -I./Source/WebCore/page/animation -I./Source/WebCore/page/scrolling -I./Source/WebCore/platform -I./Source/WebCore/platform/animation -I./Source/WebCore/platform/audio -I./Source/WebCore/platform/graphics -I./Source/WebCore/platform/graphics/filters -I./Source/WebCore/platform/graphics/filters/arm -I./Source/WebCore/platform/graphics/gpu -I./Source/WebCore/platform/graphics/opengl -I./Source/WebCore/platform/graphics/opentype -I./Source/WebCore/platform/graphics/transforms -I./Source/WebCore/platform/image-decoders -I./Source/WebCore/platform/image-decoders/bmp -I./Source/WebCore/platform/image-decoders/gif -I./Source/WebCore/platform/image-decoders/ico -I./Source/WebCore/platform/image-decoders/jpeg -I./Source/WebCore/platform/image-decoders/webp -I./Source/WebCore/platform/image-decoders/png -I./Source/WebCore/platform/leveldb -I./Source/WebCore/platform/mediastream -I./Source/WebCore/platform/mock -I./Source/WebCore/platform/network -I./Source/WebCore/platform/sql -I./Source/WebCore/platform/text -I./Source/WebCore/platform/text/transcoder -I./Source/WebCore/platform/win -I./Source/WebCore/plugins -I./Source/WebCore/plugins/win -I./Source/WebCore/rendering -I./Source/WebCore/rendering/mathml -I./Source/WebCore/rendering/style -I./Source/WebCore/rendering/svg -I./Source/WebCore/storage -I./Source/WebCore/svg -I./Source/WebCore/svg/animation -I./Source/WebCore/svg/graphics -I./Source/WebCore/svg/graphics/filters -I./Source/WebCore/svg/properties -I./Source/WebCore/testing -I./Source/WebCore/testing/js -I./Source/WebCore/webaudio -I./Source/WebCore/websockets -I./Source/WebCore/workers -I./Source/WebCore/xml -I./Source/WebCore/xml/parser -I./WebCore/bindings/js -I./DerivedSources/WebCore -I./DerivedSources -I./DerivedSources/JavaScriptCore -DDATA_DIR=\"/opt/local/share\" -DENABLE_CHANNEL_MESSAGING=1 -DENABLE_METER_TAG=1 -DENABLE_PROGRESS_TAG=1 -DENABLE_JAVASCRIPT_DEBUGGER=1 -DENABLE_GAMEPAD=0 -DENABLE_SQL_DATABASE=1 -DENABLE_DATALIST=1 -DENABLE_DIRECTORY_UPLOAD=0 -DENABLE_MUTATION_OBSERVERS=1 -DENABLE_TOUCH_ICON_LOADING=0 -DENABLE_INPUT_COLOR=0 -DENABLE_INPUT_SPEECH=0 -DENABLE_ICONDATABASE=1 -DENABLE_VIDEO=1 -DENABLE_MEDIA_SOURCE=0 -DENABLE_MEDIA_STATISTICS=1 -DENABLE_FULLSCREEN_API=1 -DENABLE_VIDEO_TRACK=1 -DENABLE_MEDIA_STREAM=1 -DENABLE_XSLT=1 -DENABLE_WORKERS=1 -DENABLE_SHADOW_DOM=1 -DENABLE_SHARED_WORKERS=1 -DENABLE_FILTERS=1 -DENABLE_GEOLOCATION=1 -DENABLE_CLIENT_BASED_GEOLOCATION=1 -DENABLE_MATHML=1 -DENABLE_SVG=1 -DENABLE_SVG_FONTS=1 -DENABLE_WEB_SOCKETS=1 -DENABLE_BLOB=1 -DENABLE_REQUEST_ANIMATION_FRAME=1 -DENABLE_WEBGL=1 -DENABLE_MHTML=1 -I./Source/WebCore/loader/archive/mhtml -DENABLE_MICRODATA=1 -DWEBKITGTK_API_VERSION_STRING=\"1.0\" -DWTF_USE_SOUP=1 -I./Source/WebCore/accessibility/gtk -I./Source/WebCore/loader/gtk -I./Source/WebCore/page/gtk -I./Source/WebCore/platform/cairo -I./Source/WebCore/platform/audio/gstreamer -I./Source/WebCore/platform/graphics/cairo -I./Source/WebCore/platform/graphics/glx -I./Source/WebCore/platform/graphics/gstreamer -I./Source/WebCore/platform/graphics/gtk -I./Source/WebCore/platform/gtk -I./Source/WebCore/platform/network/soup -DWTF_USE_PANGO=1 -I./Source/WebCore/platform/graphics/pango -I./Source -I./Source/JavaScriptCore -I./Source/JavaScriptCore/API -I./Source/JavaScriptCore/assembler -I./Source/JavaScriptCore/bytecode -I./Source/JavaScriptCore/bytecompiler -I./Source/JavaScriptCore/dfg -I./Source/JavaScriptCore/heap -I./Source/JavaScriptCore/debugger -I./Source/JavaScriptCore/ForwardingHeaders -I./Source/JavaScriptCore/interpreter -I./Source/JavaScriptCore/jit -I./Source/JavaScriptCore/jit -I./Source/JavaScriptCore/parser -I./Source/JavaScriptCore/profiler -I./Source/JavaScriptCore/runtime -I./Source/JavaScriptCore/tools -I./Source/JavaScriptCore/wtf -I./Source/JavaScriptCore/wtf -I./Source/JavaScriptCore/wtf/gobject -I./Source/JavaScriptCore/wtf/gtk -I./Source/JavaScriptCore/wtf/text -I./Source/JavaScriptCore/wtf/unicode -I./Source/JavaScriptCore/yarr -I./DerivedSources/JavaScriptCore -I./Source/WTF -fno-strict-aliasing -I/opt/local/include/cairo -I/opt/local/include/glib-2.0 -I/opt/local/lib/glib-2.0/include -I/opt/local/include -I/opt/local/include/pixman-1 -I/opt/local/include/freetype2 -I/opt/local/include/libpng15 -D_REENTRANT -I/opt/local/include/enchant -I/opt/local/include/glib-2.0 -I/opt/local/lib/glib-2.0/include -I/opt/local/include -I/opt/local/include -I/opt/local/include/dbus-1.0 -I/opt/local/include/libxml2 -I/opt/local/lib/dbus-1.0/include -I/opt/local/include/glib-2.0 -I/opt/local/lib/glib-2.0/include -D_REENTRANT -I/opt/local/include/glib-2.0 -I/opt/local/lib/glib-2.0/include -I/opt/local/include -D_REENTRANT -I/opt/local/include/gstreamer-0.10 -I/opt/local/include/glib-2.0 -I/opt/local/lib/glib-2.0/include -I/opt/local/include -I/opt/local/include/libxml2 -D_REENTRANT -I/opt/local/include/libsoup-2.4 -I/opt/local/include/libxml2 -I/opt/local/include/glib-2.0 -I/opt/local/lib/glib-2.0/include -I/opt/local/include -I/opt/local/include/libxml2 -I/opt/local/include -I/opt/local/include/libxml2 -D_REENTRANT -I/opt/local/include/pango-1.0 -I/opt/local/include/glib-2.0 -I/opt/local/lib/glib-2.0/include -I/opt/local/include -I/opt/local/include/freetype2 -I/opt/local/include -I/opt/local/include -I/opt/local/include -I/opt/local/include -fvisibility-inlines-hidden -fno-rtti -pipe -O2 -arch ppc -O2 -MT Source/WebCore/platform/libWebCore_la-Length.lo -MD -MP -MF Source/WebCore/platform/.deps/libWebCore_la-Length.Tpo -c Source/WebCore/platform/Length.cpp  -fno-common -DPIC -o Source/WebCore/platform/.libs/libWebCore_la-Length.o
Source/WebCore/platform/Length.cpp:156: error: size of array 'dummylength_should_stay_small' is negative
make[1]: *** [Source/WebCore/platform/libWebCore_la-Length.lo] Error 1
make: *** [all] Error 2
Comment 1 Jeremy Huddleston Sequoia 2012-09-06 12:04:37 PDT
Created attachment 162550 [details]
preprocessed source
Comment 2 Jeremy Huddleston Sequoia 2012-09-06 12:11:58 PDT
sizeof(WebCore::Length) is 16
sizeof(WebCore::SameSizeAsLength) is 8
Comment 3 Jeremy Huddleston Sequoia 2012-09-06 12:17:06 PDT
Yeah, I don't know why that assert should be there.  It's clear that it is not the case.  The assert is essentially saying that these two structures should take up the same amount of memory, and that's clearly not the case:

struct Length {
    union {
        int m_intValue;
        float m_floatValue;
    };
    bool m_quirk;
    unsigned char m_type;
    bool m_isFloat;
};

struct SameSizeAsLength {
    int32_t value;
    int32_t metaData;
};
Comment 4 Jeremy Huddleston Sequoia 2012-09-06 12:27:35 PDT
Or rather, it makes assumptions about packing and sizes that aren't always true...
Comment 5 Alexey Proskuryakov 2012-09-06 16:53:30 PDT
This assertion should pass for any port that doesn't want to waste memory on lengths, so the right fix would be to correct Length structure definition. 

This does not imply that we would necessarily accept a patch for PowerPC alone.
Comment 6 Simon Fraser (smfr) 2014-07-30 12:01:56 PDT
No plans to make PPC build.