<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 --- - -O2 and above producing unaligned movdqa on amd64"
href="http://llvm.org/bugs/show_bug.cgi?id=19166">19166</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>-O2 and above producing unaligned movdqa on amd64
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>3.4
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>OpenBSD
</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>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>oga+llvm@nicotinebsd.org
</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>Created <span class=""><a href="attachment.cgi?id=12244" name="attach_12244" title="A C file that exhibits the bug, there at at least 3 more in mesa.">attachment 12244</a> <a href="attachment.cgi?id=12244&action=edit" title="A C file that exhibits the bug, there at at least 3 more in mesa.">[details]</a></span>
A C file that exhibits the bug, there at at least 3 more in mesa.
Building Mesa 9.2.5 with clang on Bitrig or OpenBSD at least causes a bus error
caused by a GPF pretty quickly.
Investigation showed that in a number of places (an example is attached) an
array initialisation is being optimised to a movdqa. The memory target of this
is unaligned.
For example with this array:
/* ubyte -> float conversion */
GLfloat _mesa_ubyte_to_float_color_tab[256];
set by this code:
for (i = 0; i < 256; i++) {
_mesa_ubyte_to_float_color_tab[i] = (float) i / 255.0F;
}
nm on the sybmbol with -O0 shows a sane alignment:
16:47 < oga> 008f4e00 B _mesa_ubyte_to_float_color_tab
whereas with -O3 it produces:
16:57 < oga> without -O0 - 008f21d0 B _mesa_ubyte_to_float_color_tab
I attach the C file in question, which when built with the following flags
exhibits this bug:
clang -O3 -pipe -std=c99
-I/usr/xenocara/lib/libGL/mesa/libmesagallium/../../../../dist/Mesa/src/mesa/drivers/dri/common
-I/usr/xenocara/lib/libGL/mesa/libmesagallium/../../../../dist/Mesa/src/gallium/auxiliary
-I/usr/xenocara/lib/libGL/mesa/libmesagallium/../../../../dist/Mesa/src/gallium/include
-I/usr/xenocara/lib/libGL/mesa/libmesagallium/../generated
-I/usr/xenocara/lib/libGL/mesa/libmesagallium/../generated/main
-D__NOT_HAVE_DRM_H -I.
-I/usr/xenocara/lib/libGL/mesa/libmesagallium/../../../../dist/Mesa/src/mapi
-I/usr/xenocara/lib/libGL/mesa/libmesagallium/../../../../dist/Mesa/include
-I/usr/xenocara/lib/libGL/mesa/libmesagallium/../../../../dist/Mesa/include/GL/internal
-I/usr/xenocara/lib/libGL/mesa/libmesagallium/../../../../dist/Mesa/src/mesa
-I/usr/xenocara/lib/libGL/mesa/libmesagallium/../../../../dist/Mesa/src/mesa/main
-I/usr/xenocara/lib/libGL/mesa/libmesagallium/../../../../dist/Mesa/src/mesa/math
-I/usr/xenocara/lib/libGL/mesa/libmesagallium/../../../../dist/Mesa/src/mesa/tnl
-I/usr/xenocara/lib/libGL/mesa/libmesagallium/../../../../dist/Mesa/src/glsl
-I/usr/xenocara/lib/libGL/mesa/libmesagallium/obj/shader/slang
-I/usr/xenocara/lib/libGL/mesa/libmesagallium/../../generated
-I/usr/xenocara/lib/libGL/mesa/libmesagallium/../../generated/main
-I/usr/X11R6/include -DHAVE_UNISTD_H -DHAVE_PTHREAD -DHAVE_ALIAS
-DHAVE_DLOPEN -DHAVE_POSIX_MEMALIGN -D_REENTRANT -DIN_DRI_DRIVER
-DPACKAGE_VERSION="9.2.5" -DPACKAGE_BUGREPORT="<a href="mailto:bugs@openbsd.org">bugs@openbsd.org</a>"
-I/usr/xenocara/lib/libGL/mesa/libmesagallium/../../../../dist/Mesa/src/mesa/x86
-D__GLX_ALIGN64 -DUSE_X86_64_ASM -c -fpic -DPIC
/usr/xenocara/lib/libGL/mesa/libmesagallium/../../../../dist/Mesa/src/mesa/main/context.c
-o context.ll
I also attach the .ll file produced. The bug is still there with -O2 but -O1
removes it.</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>