Bug 13434 - gcc warning in JavaScriptCore/wtf
Summary: gcc warning in JavaScriptCore/wtf
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 523.x (Safari 3)
Hardware: PC All
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2007-04-21 05:23 PDT by Alp Toker
Modified: 2008-06-09 14:18 PDT (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alp Toker 2007-04-21 05:23:46 PDT
This compiler warning is issued by gcc 4.1.2 (which is apparently more recent than what's used by Apple). It was noticed when building the "gdk" port.

bdash points out that "according to the man page, the warning will only be emitted in unsafe cases. there's a separate flag to turn on warning in all cases, even those which are potentially safe"

So it's possible that gcc is now good enough to identify more "unsafe" conditions, in which case the bug should be fixed, or it might be a regression in gcc's detection of unsafe conditions, in which case it might be worth considering suppressing the warning. I leave it to someone familiar with the code to determine this.

I include the flags we use in the gdk port for reference.


g++ -c -o obj-gnu/webcore_gdk_RenderApplet.o -I../../../JavaScriptCore -I../.. -I../../bindings/js -I../../bridge -I../../css -I../../DerivedSources/WebCore -I../../dom -I../../editing -I../../ForwardingHeaders/kjs -I../../history -I../../html -I../../include -I../../loader -I../../loader/gdk -I../../loader/icon -I../../page -I../../platform -I../../platform/graphics -I../../platform/graphics/gdk -I../../platform/image-decoders -I../../platform/image-decoders/bmp -I../../platform/image-decoders/gif -I../../platform/image-decoders/ico -I../../platform/image-decoders/jpeg -I../../platform/image-decoders/png -I../../platform/image-decoders/xbm -I../../platform/image-decoders/zlib -I../../platform/network -I../../platform/network/gdk -I../../rendering -I../../xml -DENABLE_XSLT=1 -DLINUX -DUSE_CONSERVATIVE_GC=0 -DHAVE_FUNC_ISNAN -D_THREAD_SAFE -pthread -g -I../../platform/gdk -I../../platform/network/gdk -DBUILDING_GDK__ -DBUILDING_CAIRO__ -Iplatform/gdk -Iplatform/graphics/cairo -DENABLE_XPATH -I/usr/include/libxml2 -I/usr/include/libxml2 -g -Wall -O2  -I/usr/include/freetype2    -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/freetype2 -I/usr/include/libpng12    -I/usr/include/cairo -I/usr/include/freetype2 -I/usr/include/libpng12    -fPIC -DPIC -fno-rtti -fno-exceptions   -MTobj-gnu/webcore_gdk_RenderApplet.o -MF`echo obj-gnu/webcore_gdk_RenderApplet.o | sed -e 's,\.o$,.d,'` -MD ../../rendering/RenderApplet.cpp
../../../JavaScriptCore/wtf/HashTable.h: In static member function 'static void WTF::RefCounter<WTF::PairBaseHashTraits<FirstTraits, SecondTraits>, ValueStorageTraits>::deref(const typename ValueStorageTraits::TraitType&) [with FirstTraits = WTF::HashTraits<WebCore::String>, SecondTraits = WTF::HashTraits<WebCore::String>, ValueStorageTraits = WTF::PairHashTraits<WTF::HashTraits<WebCore::StringImpl*>, WTF::HashTraits<int> >]':
../../../JavaScriptCore/wtf/HashMap.h:291:   instantiated from 'void WTF::HashMap<KeyArg, MappedArg, HashArg, KeyTraitsArg, MappedTraitsArg>::remove(WTF::HashTableIteratorAdapter<WTF::HashTable<typename WTF::HashKeyStorageTraits<HashArg, KeyTraitsArg>::Traits::TraitType, typename WTF::PairHashTraits<typename WTF::HashKeyStorageTraits<HashArg, KeyTraitsArg>::Traits, typename MappedTraitsArg::StorageTraits>::TraitType, WTF::PairFirstExtractor<typename WTF::PairHashTraits<typename WTF::HashKeyStorageTraits<HashArg, KeyTraitsArg>::Traits, typename MappedTraitsArg::StorageTraits>::TraitType>, typename WTF::HashKeyStorageTraits<HashArg, KeyTraitsArg>::Hash, WTF::PairHashTraits<typename WTF::HashKeyStorageTraits<HashArg, KeyTraitsArg>::Traits, typename MappedTraitsArg::StorageTraits>, typename WTF::HashKeyStorageTraits<HashArg, KeyTraitsArg>::Traits>, typename WTF::PairBaseHashTraits<KeyTraitsArg, MappedTraitsArg>::TraitType>) [with KeyArg = WebCore::String, MappedArg = WebCore::String, HashArg = WTF::CaseInsensitiveHash<WebCore::String>, KeyTraitsArg = WTF::HashTraits<WebCore::String>, MappedTraitsArg = WTF::HashTraits<WebCore::String>]'
../../../JavaScriptCore/wtf/HashMap.h:298:   instantiated from 'void WTF::HashMap<KeyArg, MappedArg, HashArg, KeyTraitsArg, MappedTraitsArg>::remove(const typename KeyTraitsArg::TraitType&) [with KeyArg = WebCore::String, MappedArg = WebCore::String, HashArg = WTF::CaseInsensitiveHash<WebCore::String>, KeyTraitsArg = WTF::HashTraits<WebCore::String>, MappedTraitsArg = WTF::HashTraits<WebCore::String>]'
../../platform/network/ResourceRequest.h:132:   instantiated from here
../../../JavaScriptCore/wtf/HashTable.h:895: warning: dereferencing type-punned pointer will break strict-aliasing rules
../../../JavaScriptCore/wtf/HashMap.h: In static member function 'static void WTF::HashMapTranslator<false, ValueType, ValueStorageTraits, HashFunctions>::translate(typename ValueStorageTraits::TraitType&, const typename ValueType::first_type&, const typename ValueType::second_type&, unsigned int) [with ValueType = std::pair<WebCore::String, WebCore::String>, ValueStorageTraits = WTF::PairHashTraits<WTF::HashTraits<WebCore::StringImpl*>, WTF::HashTraits<int> >, HashFunctions = WTF::StrHash<WebCore::String>]':
../../../JavaScriptCore/wtf/HashTable.h:443:   instantiated from 'std::pair<typename WTF::HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>::iterator, bool> WTF::HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>::add(const T&, const Extra&) [with T = WebCore::String, Extra = WebCore::String, HashTranslator = WTF::HashMapTranslator<false, std::pair<WebCore::String, WebCore::String>, WTF::PairHashTraits<WTF::HashTraits<WebCore::StringImpl*>, WTF::HashTraits<int> >, WTF::StrHash<WebCore::String> >, Key = WebCore::StringImpl*, Value = std::pair<WebCore::StringImpl*, int>, Extractor = WTF::PairFirstExtractor<std::pair<WebCore::StringImpl*, int> >, HashFunctions = WTF::StrHash<WebCore::StringImpl*>, Traits = WTF::PairHashTraits<WTF::HashTraits<WebCore::StringImpl*>, WTF::HashTraits<int> >, KeyTraits = WTF::HashTraits<WebCore::StringImpl*>]'
../../../JavaScriptCore/wtf/HashMap.h:255:   instantiated from 'std::pair<typename WTF::HashMap<KeyArg, MappedArg, HashArg, KeyTraitsArg, MappedTraitsArg>::iterator, bool> WTF::HashMap<KeyArg, MappedArg, HashArg, KeyTraitsArg, MappedTraitsArg>::inlineAdd(const typename KeyTraitsArg::TraitType&, const typename MappedTraitsArg::TraitType&) [with KeyArg = WebCore::String, MappedArg = WebCore::String, HashArg = WTF::StrHash<WebCore::String>, KeyTraitsArg = WTF::HashTraits<WebCore::String>, MappedTraitsArg = WTF::HashTraits<WebCore::String>]'
../../../JavaScriptCore/wtf/HashMap.h:262:   instantiated from 'std::pair<typename WTF::HashMap<KeyArg, MappedArg, HashArg, KeyTraitsArg, MappedTraitsArg>::iterator, bool> WTF::HashMap<KeyArg, MappedArg, HashArg, KeyTraitsArg, MappedTraitsArg>::set(const typename KeyTraitsArg::TraitType&, const typename MappedTraitsArg::TraitType&) [with KeyArg = WebCore::String, MappedArg = WebCore::String, HashArg = WTF::StrHash<WebCore::String>, KeyTraitsArg = WTF::HashTraits<WebCore::String>, MappedTraitsArg = WTF::HashTraits<WebCore::String>]'
../../rendering/RenderApplet.cpp:86:   instantiated from here
../../../JavaScriptCore/wtf/HashMap.h:147: warning: dereferencing type-punned pointer will break strict-aliasing rules
../../../JavaScriptCore/wtf/HashTable.h: In static member function 'static void WTF::RefCounter<WTF::PairBaseHashTraits<FirstTraits, SecondTraits>, ValueStorageTraits>::ref(const typename ValueStorageTraits::TraitType&) [with FirstTraits = WTF::HashTraits<WebCore::String>, SecondTraits = WTF::HashTraits<WebCore::String>, ValueStorageTraits = WTF::PairHashTraits<WTF::HashTraits<WebCore::StringImpl*>, WTF::HashTraits<int> >]':
../../../JavaScriptCore/wtf/HashTable.h:922:   instantiated from 'static void WTF::HashTableRefCounterBase<true, HashTableType, ValueTraits>::refAll(HashTableType&) [with HashTableType = WTF::HashTable<WebCore::StringImpl*, std::pair<WebCore::StringImpl*, int>, WTF::PairFirstExtractor<std::pair<WebCore::StringImpl*, int> >, WTF::StrHash<WebCore::StringImpl*>, WTF::PairHashTraits<WTF::HashTraits<WebCore::StringImpl*>, WTF::HashTraits<int> >, WTF::HashTraits<WebCore::StringImpl*> >, ValueTraits = WTF::PairBaseHashTraits<WTF::HashTraits<WebCore::String>, WTF::HashTraits<WebCore::String> >]'
../../../JavaScriptCore/wtf/HashTable.h:936:   instantiated from 'static void WTF::HashTableRefCounter<HashTableType, ValueTraits>::refAll(HashTableType&) [with HashTableType = WTF::HashTable<WebCore::StringImpl*, std::pair<WebCore::StringImpl*, int>, WTF::PairFirstExtractor<std::pair<WebCore::StringImpl*, int> >, WTF::StrHash<WebCore::StringImpl*>, WTF::PairHashTraits<WTF::HashTraits<WebCore::StringImpl*>, WTF::HashTraits<int> >, WTF::HashTraits<WebCore::StringImpl*> >, ValueTraits = WTF::PairBaseHashTraits<WTF::HashTraits<WebCore::String>, WTF::HashTraits<WebCore::String> >]'
../../../JavaScriptCore/wtf/HashMap.h:154:   instantiated from 'void WTF::HashMap<KeyArg, MappedArg, HashArg, KeyTraitsArg, MappedTraitsArg>::refAll() [with KeyArg = WebCore::String, MappedArg = WebCore::String, HashArg = WTF::StrHash<WebCore::String>, KeyTraitsArg = WTF::HashTraits<WebCore::String>, MappedTraitsArg = WTF::HashTraits<WebCore::String>]'
../../../JavaScriptCore/wtf/HashMap.h:172:   instantiated from 'WTF::HashMap<KeyArg, MappedArg, HashArg, KeyTraitsArg, MappedTraitsArg>::HashMap(const WTF::HashMap<KeyArg, MappedArg, HashArg, KeyTraitsArg, MappedTraitsArg>&) [with KeyArg = WebCore::String, MappedArg = WebCore::String, HashArg = WTF::StrHash<WebCore::String>, KeyTraitsArg = WTF::HashTraits<WebCore::String>, MappedTraitsArg = WTF::HashTraits<WebCore::String>]'
../../rendering/RenderApplet.cpp:41:   instantiated from here
../../../JavaScriptCore/wtf/HashTable.h:891: warning: dereferencing type-punned pointer will break strict-aliasing rules
Comment 1 Mark Rowe (bdash) 2007-04-21 09:14:02 PDT
CC'ing Maciej on this bug as the warnings are from the HashTable/HashMap code in WTF and he was the original author of that code.
Comment 2 Cameron Zwarich (cpst) 2008-06-08 23:36:12 PDT
Isn't this now fixed?
Comment 3 Alexey Proskuryakov 2008-06-09 14:18:45 PDT
This was fixed back in April as <rdar://problem/5657459>.