View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0002617 | FSSCP | math-related | public | 2012-02-29 14:08 | 2012-05-01 12:25 |
Reporter | Echelon9 | Assigned To | Echelon9 | ||
Priority | high | Severity | block | Reproducibility | always |
Status | resolved | Resolution | fixed | ||
Product Version | 3.6.14 RC5 | ||||
Target Version | 3.6.14 | ||||
Summary | 0002617: LLVM warning: argument to 'sizeof' in 'memset' call is the same expression as the destination; did you mean to dereference it? | ||||
Description | warning: argument to 'sizeof' in 'memset' call is the same expression as the destination; did you mean to dereference it? [-Wsizeof-pointer-memaccess] memset (this, 0, sizeof (this)); | ||||
Additional Information | The problem is this is a Pointer type, which is 4 bytes (on 32bit systems), and ints are 4 bytes (on 32bit systems). Another case of why using memset() as a constructor in C++ is rarely correct, and often very dangerous. If mc_info was a non-POD type -- i.e. it included a std::string for example -- the memset will destroy the vtable and break the instance by setting the vtable pointer to NULL. Which is bad. Another problem is that if the type T requires some constructor action more complex than just settings its bits to 0, then the constructors for the members are not called, but their effect is ruined by overwriting the content of the members with memset(). | ||||
Tags | No tags attached. | ||||
fs2open: trunk r8539 2012-02-29 09:09 Ported: N/A Details Diff |
Fix Mantis 2617: LLVM warning: argument to 'sizeof' in 'memset' call is the same expression as the destination; did you mean to dereference it? |
Affected Issues 0002617 |
|
mod - /trunk/fs2_open/code/model/model.h | Diff File | ||
fs2open: fs2_open_3_6_14 r8703 2012-05-01 08:26 Ported: N/A Details Diff |
Backport: Trunk r8539; Fix Mantis 2617: LLVM warning: argument to 'sizeof' in 'memset' call is the same expression as the destination; did you mean to dereference it? |
Affected Issues 0002617 |
|
mod - /branches/fs2_open_3_6_14/code/model/model.h | Diff File |
Date Modified | Username | Field | Change |
---|---|---|---|
2012-02-29 14:08 | Echelon9 | New Issue | |
2012-02-29 14:08 | Echelon9 | Status | new => assigned |
2012-02-29 14:08 | Echelon9 | Assigned To | => Echelon9 |
2012-02-29 14:09 | Echelon9 | Changeset attached | => fs2open trunk r8539 |
2012-02-29 14:09 | Echelon9 | Note Added: 0013369 | |
2012-02-29 14:09 | Echelon9 | Status | assigned => resolved |
2012-02-29 14:09 | Echelon9 | Resolution | open => fixed |
2012-05-01 12:25 | niffiwan | Changeset attached | => fs2open fs2_open_3_6_14 r8703 |
2012-05-01 12:25 | niffiwan | Note Added: 0013495 |