Closed
Bug 384104
Opened 17 years ago
Closed 17 years ago
strict aliasing warnings in ALE macros
Categories
(Core :: JavaScript Engine, enhancement)
Core
JavaScript Engine
Tracking
()
RESOLVED
FIXED
People
(Reporter: igor, Assigned: igor)
Details
Attachments
(1 file)
6.99 KB,
patch
|
brendan
:
review+
|
Details | Diff | Splinter Review |
When JS engine is compiled at -O2 with GCC, the compiler generates warnings like: jsemit.c:1628: warning: dereferencing type-punned pointer will break strict-aliasing rules They all happens inside ATOM_LIST_LOOKUP when it casts &_ale->entry.next to JSAtomListElement **: #define ATOM_LIST_LOOKUP(_ale,_hep,_al,_atom) ... JSAtomListElement **_alep = &(_al)->list; ... _alep = (JSAtomListElement **)&_ale->entry.next; Such assignments, although widely used and de-facto safe, indeed breaks the strict aliasing rules of the C standard so I suggest to fix this and suppress GCC warnings that currently pollute the compilation output at the minimal optimization level when GCC really detects potentially not initialized variables quite reliably. The attached patch does that via declaring JSAtomList.list as JSHashEntry* and casting it to (JSAtomListElement *) as necessary. The patch also replaces ALE_SET_VALUE and ALE_SET_NEXT via direct cast-free expansion.
Attachment #268035 -
Flags: review?(brendan)
Updated•17 years ago
|
Attachment #268035 -
Flags: review?(brendan) → review+
Assignee | ||
Comment 1•17 years ago
|
||
I committed the patch from comment 0 to the trunk: Checking in js/src/jsatom.c; /cvsroot/mozilla/js/src/jsatom.c,v <-- jsatom.c new revision: 3.95; previous revision: 3.94 done Checking in js/src/jsatom.h; /cvsroot/mozilla/js/src/jsatom.h,v <-- jsatom.h new revision: 3.60; previous revision: 3.59 done Checking in js/src/jsemit.c; /cvsroot/mozilla/js/src/jsemit.c,v <-- jsemit.c new revision: 3.256; previous revision: 3.255 done
Status: NEW → RESOLVED
Closed: 17 years ago
Resolution: --- → FIXED
Updated•17 years ago
|
Flags: in-testsuite-
You need to log in
before you can comment on or make changes to this bug.
Description
•