diff --git a/trick_source/codegen/Interface_Code_Gen/PrintFileContentsBase.cpp b/trick_source/codegen/Interface_Code_Gen/PrintFileContentsBase.cpp index 4718f3dc..25d65650 100644 --- a/trick_source/codegen/Interface_Code_Gen/PrintFileContentsBase.cpp +++ b/trick_source/codegen/Interface_Code_Gen/PrintFileContentsBase.cpp @@ -63,6 +63,14 @@ bool PrintFileContentsBase::isPrintable( ClassValues * c , FieldDescription * fd if ( fdes->isSTL() and fdes->getNumDims() ) { return false; } + /** + * It is not possible to take the address of a reference as the referred-to variable's address + * is always returned. As such, the init_attr function cannot obtain the absolute address for + * static reference variables. + */ + if ( fdes->isStatic() && fdes->isReference() ) { + return false; + } if ( fdes->getAccess() == clang::AS_public || (!fdes->isStatic() && !global_compat15 && !c->isCompat15())) { return true; } diff --git a/trick_source/sim_services/MemoryManager/MemoryManager_ref_name.cpp b/trick_source/sim_services/MemoryManager/MemoryManager_ref_name.cpp index 5c5464ea..f22143ab 100644 --- a/trick_source/sim_services/MemoryManager/MemoryManager_ref_name.cpp +++ b/trick_source/sim_services/MemoryManager/MemoryManager_ref_name.cpp @@ -99,6 +99,15 @@ int Trick::MemoryManager::ref_name(REF2 * R, char *name) { } } + if (attr->mods & 1) { + ADDRESS_NODE * address_node = new ADDRESS_NODE ; + address_node->operator_ = AO_DEREFERENCE ; + address_node->operand.address = NULL ; + DLL_AddTail(address_node , R->address_path) ; + + addr = *(char**)addr; + } + /* Save the address and next attributes in the REF structure. If the attributes are dynamically-allocated, reference attributes then free them so we don't leak memory.