[LLVMbugs] [Bug 22636] New: Generated code crashes in -O2/-O3 because of template expansion

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Feb 19 14:28:59 PST 2015


            Bug ID: 22636
           Summary: Generated code crashes in -O2/-O3 because of template
           Product: new-bugs
           Version: 3.6
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: eugene.zelenko at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Legacy part of my project contains next code:


template<class T>
LstItrTemplate<T>::LstItrTemplate( LstTemplate<T>& lst )
    list_ = &lst;
    index_ = -1;
    listCap_ = 0;
    if ( list_ ) {
        list_->doReset( *this ); /* plan for nil containers */
        listCap_ = list_->getList().capacity();


LstItrTemplate<Sym> n2it( *declList2_ );

declList2_ is NULL at the time of calling.

In -O2/-O3 check for pointer is omitted (as far as I could judge from Assembler
code) and list_->getList().capacity() is called.

-O1 code is working.

Optimization related command line options: -std=c++98
--gcc-toolchain=/gcc-v4.8.2rh63 -w -O3 -ffast-math -fno-omit-frame-pointer

Sure, legacy code need to be refactored, but GCC 4.4/4.8/4.9 produce working

Sorry, I was not able to reproduce problem in small test case.

You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150219/6af45d31/attachment.html>

More information about the llvm-bugs mailing list