Package: clang-3.4 Version: 1:3.4.2-6 Severity: important Dear Maintainer,
The attached simple example receives SIGSEGFAULT when compiled with this command: clang++ -O2 -g -o segfault segfault.cpp segault.cpp: #include <iostream> #include <cassert> class SampleYVector { public: SampleYVector() :x(0) ,y(0) {} SampleYVector(int x_, int y_) :x(x_) ,y(y_) {} SampleYVector& operator&= (const int mask) { x &= mask; y &= mask; return *this; } int x; int y; }; SampleYVector operator& (const SampleYVector &lhs, const int mask) { SampleYVector temp(lhs); temp &= mask; return temp; } struct InterPrediction { public: int leftDataMargin; int rightDataMargin; void test(const SampleYVector &mv); }; void getMargins(const int fractional, int &topLeftMargin, int &bottomRightMargin) { switch (fractional) { case 0: topLeftMargin = 0; bottomRightMargin = 0; break; case 1: topLeftMargin = 3; bottomRightMargin = 3; break; case 2: topLeftMargin = 3; bottomRightMargin = 4; break; case 3: topLeftMargin = 2; bottomRightMargin = 4; break; case 4: topLeftMargin = 1; bottomRightMargin = 2; break; default: assert(false); break; } } void InterPrediction::test(const SampleYVector &mv) { const SampleYVector mvFrac = mv & 3; std::cout << mvFrac.x << "x" << mvFrac.y << '\n'; const int fractionalX = 0; std::cout << fractionalX << std::endl; getMargins(mvFrac.x, leftDataMargin, rightDataMargin); } int main() { SampleYVector mv(0, 2); InterPrediction interPrediction; interPrediction.test(mv); return 0; } run with: $ ./segfault 0x2 0 this = 0x7fff11f9ed18 &mv = 0x7fff11f9ed20 Segmentation fault When compiled without "-O2" the executable executes successfully. Best regards, Dominik Wójt -- System Information: Debian Release: jessie/sid APT prefers testing APT policy: (500, 'testing') Architecture: amd64 (x86_64) Foreign Architectures: i386 Kernel: Linux 3.14-2-amd64 (SMP w/8 CPU cores) Locale: LANG=en_US.utf8, LC_CTYPE=en_US.utf8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Versions of packages clang-3.4 depends on: ii libc6 2.19-7 ii libc6-dev 2.19-7 ii libclang-common-3.4-dev 1:3.4.2-6 ii libclang1-3.4 1:3.4.2-6 ii libffi6 3.1-2 ii libgcc-4.9-dev 4.9.1-4 ii libgcc1 1:4.9.1-4 ii libllvm3.4 1:3.4.2-6 ii libobjc-4.9-dev 4.9.1-4 ii libstdc++-4.9-dev 4.9.1-4 ii libstdc++6 4.9.1-4 ii libtinfo5 5.9+20140712-2 Versions of packages clang-3.4 recommends: ii llvm-3.4-dev 1:3.4.2-6 ii python 2.7.8-1 Versions of packages clang-3.4 suggests: pn clang-3.4-doc <none> pn gnustep <none> pn gnustep-devel <none> -- no debconf information -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org