Closed Bug 1270810 Opened 8 years ago Closed 8 years ago

memset optimized out with -flifetime-dse in GCC

Categories

(Firefox Build System :: General, defect)

46 Branch
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 1232696

People

(Reporter: goughostt, Unassigned)

Details

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:46.0) Gecko/20100101 Firefox/46.0
Build ID: 20160506193335

Steps to reproduce:

Compile Firefox 46 with GCC 6.1.


Actual results:

Classes with ``NS_DECL_AND_IMPL_ZEROING_OPERATOR_NEW'' actually get random initialization.


Expected results:

Classes with ``NS_DECL_AND_IMPL_ZEROING_OPERATOR_NEW'' actually get zero initialization.
GCC tries to eliminate ``memset`` calls that go before constructors. But Firefox relies on those calls to initialize some class members.

A quick fix is to pass ``-flifetime-dse=1`` to gcc.

Better, all those classes that need zero initialization rely on their constructors. Writing to unconstructed objects and relying on operations before construction are neither reasonable.
Summary: memset optimized out with -fno-lifetime-dse in GCC → memset optimized out with -flifetime-dse in GCC
Component: Untriaged → Build Config
Product: Firefox → Core
Status: UNCONFIRMED → RESOLVED
Closed: 8 years ago
Resolution: --- → DUPLICATE
Product: Core → Firefox Build System
You need to log in before you can comment on or make changes to this bug.