[SERVER-5332] warning: dereferencing type-punned pointer will break strict-aliasing rules Created: 18/Mar/12  Updated: 15/Aug/12  Resolved: 22/Mar/12

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Pedro Larroy Assignee: Eric Milkie
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

de20dd200870367e3f9000c9a6b74fed5e8fa402 from github


Operating System: ALL
Participants:

 Description   

In file included from /home/piotr/devel/mycelium/3rd_party/mongodb/src/mongo/client/../util/net/../../db/jsobj.h:33:0,
from /home/piotr/devel/mycelium/3rd_party/mongodb/src/mongo/client/../util/net/../../db/cmdline.h:20,
from /home/piotr/devel/mycelium/3rd_party/mongodb/src/mongo/client/../util/net/hostandport.h:21,
from /home/piotr/devel/mycelium/3rd_party/mongodb/src/mongo/client/../util/net/message.h:22,
from /home/piotr/devel/mycelium/3rd_party/mongodb/src/mongo/client/dbclient.h:24,
from src/Doc.hh:17,
from src/crawler.cc:41:
/home/piotr/devel/mycelium/3rd_party/mongodb/src/mongo/client/../util/net/../../db/../util/optime.h: In member function 'long long unsigned int mongo::OpTime::asDate() const':
/home/piotr/devel/mycelium/3rd_party/mongodb/src/mongo/client/../util/net/../../db/../util/optime.h:97:69: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
/home/piotr/devel/mycelium/3rd_party/mongodb/src/mongo/client/../util/net/../../db/../util/optime.h: In member function 'long long int mongo::OpTime::asLL() const':
/home/piotr/devel/mycelium/3rd_party/mongodb/src/mongo/client/../util/net/../../db/../util/optime.h:100:60: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
In file included from /home/piotr/devel/mycelium/3rd_party/mongodb/src/mongo/client/dbclient.h:24:0,
from src/Doc.hh:17,
from src/crawler.cc:41:
/home/piotr/devel/mycelium/3rd_party/mongodb/src/mongo/client/../util/net/message.h: In member function 'int& mongo::MsgData::dataAsInt()':
/home/piotr/devel/mycelium/3rd_party/mongodb/src/mongo/client/../util/net/message.h:120:35: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
src/crawler.cc: At global scope:



 Comments   
Comment by Eric Milkie [ 19/Mar/12 ]

Hi Pedro,
The C++ driver uses the same headers as the server, for better or for worse. We compile the server with -fno-strict-aliasing, and as a result we have several coding constructs in the headers that break the strict aliasing rules. To fix your issue, I would compile your translation units that are including dbclient.h with -fno-strict-aliasing.

Generated at Thu Feb 08 03:08:34 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.