Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1760)

Unified Diff: src/hydrogen.cc

Issue 11590005: Fix -Wstrict-aliasing warnings.
Patch Set: Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/heap.h ('k') | src/serialize.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/hydrogen.cc
diff --git a/src/hydrogen.cc b/src/hydrogen.cc
index 97306a165963da9aff7824321404240b0bb2b5b2..2342c44e8a8ec95d3da5da0fd505b6281a74edd4 100644
--- a/src/hydrogen.cc
+++ b/src/hydrogen.cc
@@ -3594,8 +3594,13 @@ static bool BoundsCheckKeyMatch(void* key1, void* key2) {
class BoundsCheckTable : private ZoneHashMap {
public:
BoundsCheckBbData** LookupOrInsert(BoundsCheckKey* key, Zone* zone) {
- return reinterpret_cast<BoundsCheckBbData**>(
- &(Lookup(key, key->Hash(), true, ZoneAllocationPolicy(zone))->value));
+ // Avoid type-punning compiler warnings.
+ union {
+ void** in;
+ BoundsCheckBbData** out;
+ } u;
+ u.in = &(Lookup(key, key->Hash(), true, ZoneAllocationPolicy(zone))->value);
+ return u.out;
}
void Insert(BoundsCheckKey* key, BoundsCheckBbData* data, Zone* zone) {
« no previous file with comments | « src/heap.h ('k') | src/serialize.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698