rose-compiler/rose

Compiling with clang gives: object backing the pointer will be destroyed at the end of the full-expression

mingodad opened this issue · 2 comments

make[6]: Entering directory '/tmp/build-dad/src/frontend/SageIII'
...
Cxx_GrammarCopyMemberFunctions.C:11535:71: warning: object backing the pointer will be destroyed at the end of the full-expression [-Wdangling-gsl]
     SgTemplateArgumentPtrList::const_iterator source_args_iterator = get_args().begin(); 
                                                                      ^~~~~~~~~~
Cxx_GrammarCopyMemberFunctions.C:11553:64: warning: object backing the pointer will be destroyed at the end of the full-expression [-Wdangling-gsl]
     SgTemplateArgumentPtrList::const_iterator args_iterator = result->get_args().begin(); 
                                                               ^~~~~~~~~~~~~~~~~~
Cxx_GrammarCopyMemberFunctions.C:11750:72: warning: object backing the pointer will be destroyed at the end of the full-expression [-Wdangling-gsl]
     SgTemplateParameterPtrList::const_iterator source_args_iterator = get_args().begin(); 
                                                                       ^~~~~~~~~~
Cxx_GrammarCopyMemberFunctions.C:11768:65: warning: object backing the pointer will be destroyed at the end of the full-expression [-Wdangling-gsl]
     SgTemplateParameterPtrList::const_iterator args_iterator = result->get_args().begin(); 
                                                                ^~~~~~~~~~~~~~~~~~

Also:

make[6]: Entering directory '/tmp/build-dad/src/midend/programAnalysis'
...
rose/src/midend/programAnalysis/genericDataflow/simpleAnalyses/liveDeadVarAnalysis.C:1203:50: warning: base class 'VarsExprsProductLattice' is uninitialized when used here to access 'VarsExprsProductLattice::filter' [-Wuninitialized]
                VarsExprsProductLattice(n, state,filter)
                                                 ^
rose/src/midend/programAnalysis/genericDataflow/simpleAnalyses/liveDeadVarAnalysis.C:1257:50: warning: base class 'VarsExprsProductLattice' is uninitialized when used here to access 'VarsExprsProductLattice::filter' [-Wuninitialized]
                VarsExprsProductLattice(n, state,filter)
                                                 ^
...
make[4]: Entering directory '/tmp/build-dad/src/midend'
...
  CXX      astMatching/AstMatching.lo
rose/src/midend/astProcessing/AstSharedMemoryParallelSimpleProcessing.C:13:5: warning: "POSIX threads are unavailable on this platform" // blame initial commit [-W#warnings]
#   warning "POSIX threads are unavailable on this platform" // blame initial commit
    ^
...
  CXX      astUtil/astInterface/AstInterface.lo
In file included from rose/src/midend/astRewriteMechanism/rewriteTemplateInstantiations.C:3:
In file included from rose/src/midend/astRewriteMechanism/rewriteTemplateImpl.h:7:
rose/src/midend/astRewriteMechanism/ASTFragmentCollectorTraversalImpl.h:355:50: warning: instantiation of variable 'AbstractInterfaceNodeCollection<MidLevelCollectionTypedefs>::markerStrings' required here, but no definition is available [-Wundefined-var-template]
          if (markerString == ASTNodeCollection::markerStrings[i][startOrEnd])
                                                 ^
rose/src/midend/astRewriteMechanism/rewrite.h:407:39: note: forward declaration of template entity is here
          static MarkerCollectionType markerStrings;
                                      ^
rose/src/midend/astRewriteMechanism/ASTFragmentCollectorTraversalImpl.h:355:50: note: add an explicit instantiation declaration to suppress this warning if 'AbstractInterfaceNodeCollection<MidLevelCollectionTypedefs>::markerStrings' is explicitly instantiated in another translation unit
          if (markerString == ASTNodeCollection::markerStrings[i][startOrEnd])
                                                 ^
rose/src/midend/astRewriteMechanism/ASTFragmentCollectorTraversalImpl.h:355:50: warning: instantiation of variable 'AbstractInterfaceNodeCollection<HighLevelCollectionTypedefs>::markerStrings' required here, but no definition is available [-Wundefined-var-template]
          if (markerString == ASTNodeCollection::markerStrings[i][startOrEnd])
                                                 ^
rose/src/midend/astRewriteMechanism/rewrite.h:407:39: note: forward declaration of template entity is here
          static MarkerCollectionType markerStrings;
                                      ^
rose/src/midend/astRewriteMechanism/ASTFragmentCollectorTraversalImpl.h:355:50: note: add an explicit instantiation declaration to suppress this warning if 'AbstractInterfaceNodeCollection<HighLevelCollectionTypedefs>::markerStrings' is explicitly instantiated in another translation unit
          if (markerString == ASTNodeCollection::markerStrings[i][startOrEnd])
                                                 ^
...
make[6]: Entering directory '/tmp/build-dad/src/roseExtensions/roseHPCToolkit/src/xml2profir'
...
  CXX      query.lo
In file included from rose/src/roseExtensions/roseHPCToolkit/src/xml2profir/process.cc:24:
In file included from rose/src/roseExtensions/roseHPCToolkit/include/rosehpct/rosehpct.hh:38:
rose/src/roseExtensions/roseHPCToolkit/include/rosehpct/sage/sage.hh:89:33: warning: address of stack memory associated with local variable 'result' returned [-Wreturn-stack-address]
      return const_cast<char *>(result.c_str());
                                ^~~~~~

These warnings are delegated to the next ROSE developer (Tristan):

make[6]: Entering directory '/tmp/build-dad/src/frontend/SageIII'
...
Cxx_GrammarCopyMemberFunctions.C:11535:71: warning: object backing the pointer will be destroyed at the end of the full-expression [-Wdangling-gsl]
     SgTemplateArgumentPtrList::const_iterator source_args_iterator = get_args().begin(); 
                                                                      ^~~~~~~~~~
Cxx_GrammarCopyMemberFunctions.C:11553:64: warning: object backing the pointer will be destroyed at the end of the full-expression [-Wdangling-gsl]
     SgTemplateArgumentPtrList::const_iterator args_iterator = result->get_args().begin(); 
                                                               ^~~~~~~~~~~~~~~~~~
Cxx_GrammarCopyMemberFunctions.C:11750:72: warning: object backing the pointer will be destroyed at the end of the full-expression [-Wdangling-gsl]
     SgTemplateParameterPtrList::const_iterator source_args_iterator = get_args().begin(); 
                                                                       ^~~~~~~~~~
Cxx_GrammarCopyMemberFunctions.C:11768:65: warning: object backing the pointer will be destroyed at the end of the full-expression [-Wdangling-gsl]
     SgTemplateParameterPtrList::const_iterator args_iterator = result->get_args().begin(); 
                                                                ^~~~~~~~~~~~~~~~~~

and also

make[4]: Entering directory '/tmp/build-dad/src/midend'
...
  CXX      astMatching/AstMatching.lo
rose/src/midend/astProcessing/AstSharedMemoryParallelSimpleProcessing.C:13:5: warning: "POSIX threads are unavailable on this platform" // blame initial commit [-W#warnings]
#   warning "POSIX threads are unavailable on this platform" // blame initial commit
    ^
...
  CXX      astUtil/astInterface/AstInterface.lo
In file included from rose/src/midend/astRewriteMechanism/rewriteTemplateInstantiations.C:3:
In file included from rose/src/midend/astRewriteMechanism/rewriteTemplateImpl.h:7:
rose/src/midend/astRewriteMechanism/ASTFragmentCollectorTraversalImpl.h:355:50: warning: instantiation of variable 'AbstractInterfaceNodeCollection<MidLevelCollectionTypedefs>::markerStrings' required here, but no definition is available [-Wundefined-var-template]
          if (markerString == ASTNodeCollection::markerStrings[i][startOrEnd])
                                                 ^
rose/src/midend/astRewriteMechanism/rewrite.h:407:39: note: forward declaration of template entity is here
          static MarkerCollectionType markerStrings;
                                      ^
rose/src/midend/astRewriteMechanism/ASTFragmentCollectorTraversalImpl.h:355:50: note: add an explicit instantiation declaration to suppress this warning if 'AbstractInterfaceNodeCollection<MidLevelCollectionTypedefs>::markerStrings' is explicitly instantiated in another translation unit
          if (markerString == ASTNodeCollection::markerStrings[i][startOrEnd])
                                                 ^
rose/src/midend/astRewriteMechanism/ASTFragmentCollectorTraversalImpl.h:355:50: warning: instantiation of variable 'AbstractInterfaceNodeCollection<HighLevelCollectionTypedefs>::markerStrings' required here, but no definition is available [-Wundefined-var-template]
          if (markerString == ASTNodeCollection::markerStrings[i][startOrEnd])
                                                 ^
rose/src/midend/astRewriteMechanism/rewrite.h:407:39: note: forward declaration of template entity is here
          static MarkerCollectionType markerStrings;
                                      ^
rose/src/midend/astRewriteMechanism/ASTFragmentCollectorTraversalImpl.h:355:50: note: add an explicit instantiation declaration to suppress this warning if 'AbstractInterfaceNodeCollection<HighLevelCollectionTypedefs>::markerStrings' is explicitly instantiated in another translation unit
          if (markerString == ASTNodeCollection::markerStrings[i][startOrEnd])
                                                 ^

The following warnings will not be fixed because we're planning to remove this code in the near future:

make[6]: Entering directory '/tmp/build-dad/src/midend/programAnalysis'
...
rose/src/midend/programAnalysis/genericDataflow/simpleAnalyses/liveDeadVarAnalysis.C:1203:50: warning: base class 'VarsExprsProductLattice' is uninitialized when used here to access 'VarsExprsProductLattice::filter' [-Wuninitialized]
                VarsExprsProductLattice(n, state,filter)
                                                 ^
rose/src/midend/programAnalysis/genericDataflow/simpleAnalyses/liveDeadVarAnalysis.C:1257:50: warning: base class 'VarsExprsProductLattice' is uninitialized when used here to access 'VarsExprsProductLattice::filter' [-Wuninitialized]
                VarsExprsProductLattice(n, state,filter)
                                                 ^

The following warning will not be fixed because it's reminding us to convert all this to std::thread if we decide to keep it:

make[4]: Entering directory '/tmp/build-dad/src/midend'
...
  CXX      astMatching/AstMatching.lo
rose/src/midend/astProcessing/AstSharedMemoryParallelSimpleProcessing.C:13:5: warning: "POSIX threads are unavailable on this platform" // blame initial commit [-W#warnings]
#   warning "POSIX threads are unavailable on this platform" // blame initial commit
    ^

The following flaw has been partly fixed. It is now a memory leak, but at least it's defined behavior. It will be merged soon.

make[6]: Entering directory '/tmp/build-dad/src/roseExtensions/roseHPCToolkit/src/xml2profir'
...
  CXX      query.lo
In file included from rose/src/roseExtensions/roseHPCToolkit/src/xml2profir/process.cc:24:
In file included from rose/src/roseExtensions/roseHPCToolkit/include/rosehpct/rosehpct.hh:38:
rose/src/roseExtensions/roseHPCToolkit/include/rosehpct/sage/sage.hh:89:33: warning: address of stack memory associated with local variable 'result' returned [-Wreturn-stack-address]
      return const_cast<char *>(result.c_str());
                                ^~~~~~