Ignore:
Timestamp:
Oct 15, 2020, 9:41:31 PM (3 years ago)
Author:
Michael Brooks <mlbrooks@…>
Branches:
ADT, arm-eh, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
afe2939
Parents:
0b18db7
Message:

Expanding earlier #182 fix to another case of the same issue. Fixes #224?

There is now a reusable helper function addDataSectonAttribute that applies the fix to an ObjectDecl? when we realize it needs it. Test const-init is expanded with case of #224.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/InitTweak/FixInit.cc

    r0b18db7 rf1791a4  
    802802                                if ( Statement * ctor = ctorInit->get_ctor() ) {
    803803                                        if ( objDecl->get_storageClasses().is_static ) {
     804
     805                                                // The ojbect needs to go in the data section, regardless of dtor complexity below.
     806                                                // The attribute works, and is meant to apply, both for leaving the static local alone,
     807                                                // and for hoisting it out as a static global.
     808                                                addDataSectonAttribute( objDecl );
     809
    804810                                                // originally wanted to take advantage of gcc nested functions, but
    805811                                                // we get memory errors with this approach. To remedy this, the static
Note: See TracChangeset for help on using the changeset viewer.