<html>
<head>
<base href="http://llvm.org/bugs/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - Generated code crashes in -O2/-O3 because of template expansion"
href="http://llvm.org/bugs/show_bug.cgi?id=22636">22636</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Generated code crashes in -O2/-O3 because of template expansion
</td>
</tr>
<tr>
<th>Product</th>
<td>new-bugs
</td>
</tr>
<tr>
<th>Version</th>
<td>3.6
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>new bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>eugene.zelenko@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>Legacy part of my project contains next code:
Template:
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();
}
}
Usage:
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
-pthread
Sure, legacy code need to be refactored, but GCC 4.4/4.8/4.9 produce working
code.
Sorry, I was not able to reproduce problem in small test case.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>