<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 --- - Vector types do not emit size when it differs from calculable size"
href="http://llvm.org/bugs/show_bug.cgi?id=21924">21924</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Vector types do not emit size when it differs from calculable size
</td>
</tr>
<tr>
<th>Product</th>
<td>libraries
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Windows XP
</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>DebugInfo
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>douglas_yung@playstation.sony.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>Clang allows you to create a vector using gcc's vector_size attribute. However,
if the vector's size is not equal to a power of two, it looks to be rounded up
to the nearest one.
For example, consider the following code:
=====
#include <stdio.h>
typedef float vec6f __attributes__((__vector_size__(24)));
int main(int argc, char *argv[]) {
vec6f v01[2] = {{1.0f,2.0f,3.0f,4.0f,5.0f,6.0f},
{7.0f,8.0f,9.0f,10.0f,11.0f,12.0f}};
printf("sizeof(vec6f) = %lu\n", sizeof(vec6f));
printf("sizeof(v01) = %lu\n", sizeof(v01));
return 0;
=====
If you compile that with -O0 -g and then run the resulting binary through a
debugger (say gdb), you get interesting output.
The program when run will print the following:
sizeof(vec6f) = 32
sizeof(v01) = 64
However, if evaluate the same expressions in the debugger, you will get the
following:
(gdb) p sizeof(vec6f)
$1 = 24
(gdb) p sizeof(v01)
$2 = 48
Additionally, if you ask the debugger to print out v01, this is what you get:
(gdb) p v01
$3 = {{1, 2, 3, 4, 5, 6}, {0, 0, 7, 8, 9, 10}}
It has been suggested that this could be fixed if the compiler emitted either a
DW_AT_byte_size or DW_AT_byte_stride attribute.</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>