<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 --- - GlobalOpt removes SectionAttr unexpecedly"
href="http://llvm.org/bugs/show_bug.cgi?id=19474">19474</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>GlobalOpt removes SectionAttr unexpecedly
</td>
</tr>
<tr>
<th>Product</th>
<td>libraries
</td>
</tr>
<tr>
<th>Version</th>
<td>3.3
</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>Interprocedural Optimizations
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>ahuishiwo@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>when with globalopt, section atttribute of the variable is removed
unexpectedly. The following is the case.
#include <stdio.h>
int main()
{
static int a_var __attribute__((section("MySection")));
a_var = 0;
for (int i = 0; i<10; ++i)
a_var++;
return a_var;
}
To reproduce it,
Step1: clang++ -emit-llvm -S main.cpp -o main.ll
Step2: opt -globalopt main.ll -S -o main_opt.ll
Just after step1, the SectionAttr still clings to the variable.
@_ZZ4mainE5a_var = internal global i32 0, section "MySection", align 4
After Step2, SectionAttr is gone as belows,
@%_ZZ4mainE5a_var = alloca i32
store i32 0, i32* %_ZZ4mainE5a_var
The thing is that we need _ZZ4mainE5a_var still convey its SectionAttr
to next phase. However that is not kept for the potential reason that the
shriking process of Globalopt might not copy attribute from original.</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>