Bug#666158: clang: C code using bad memset calls causes illegal instruction when compiled with optimizations enabled

Daniel Friesel derf at chaosdorf.de
Thu Mar 29 10:31:03 UTC 2012


Package: clang
Version: 3.0-6
Severity: minor

Hi,

when compiling C code using memset in a bad way with clang, enabling
optimizations (-O1 / -O2 / -Os) creates binaries with an illegal instruction on
x86 and x86_64 systems:

zsh: illegal hardware instruction  ./ill
valgrind: vex x86->IR: unhandled instruction bytes: 0xF 0xB 0x90 0x90

When using gcc (or clang without optimizations), the code terminates with a
segmentation fault, I believe this should happen for clang -O1 / -O2 as well.

This only happens when compiling _wrong_ code, so I'm not sure how much of a
bug this actually is.

A file to reproduce this (ill.c) is attached.
If I can provide any additional information, please let me know.


-- System Information:
Debian Release: wheezy/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i686)

Kernel: Linux 3.2.0-2-686-pae (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages clang depends on:
ii  libc6                2.13-27
ii  libclang-common-dev  3.0-6
ii  libffi5              3.0.10-3
ii  libgcc1              1:4.7.0-1
ii  libllvm3.0           3.0-9
ii  libstdc++6           4.7.0-1
ii  libstdc++6-4.6-dev   4.6.3-1

Versions of packages clang recommends:
ii  llvm-3.0-dev  <none>
ii  python        2.7.2-10

clang suggests no packages.

-- no debconf information
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ill.c
Type: text/x-c
Size: 737 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-llvm-team/attachments/20120329/700c15cb/attachment.bin>


More information about the Pkg-llvm-team mailing list