Bug#768574: gcc-4.9: Miscompilation of boolean negation on SH4 using -O2

2014-11-26 Thread John Paul Adrian Glaubitz
On 11/08/2014 02:15 PM, Michael Karcher wrote:
 Package: gcc-4.9
 Version: 4.9.1-16
 Severity: important

doko just uploaded a new SVN snapshot gcc which contains the upstream
fix for this bug among several other, SH-related fixes:

* Update to SVN 20141125 (r218048) from the gcc-4_9-branch.
- PR target/53976 (SH), PR target/63783 (SH), PR target/51244 (SH),
  PR target/60111 (SH), PR target/63673 (ppc),
  PR tree-optimization/61750 (ice), PR target/63947 (x86, wrong code),
  PR tree-optimization/62167 (wrong code), PR c++/63849 (ice),
  PR ada/47500.

I am closing this now. We just have to wait for the SH4 buildds to
catch up :).

Thanks to everyone who helped!

Adrian

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - glaub...@debian.org
`. `'   Freie Universitaet Berlin - glaub...@physik.fu-berlin.de
  `-GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#768574: gcc-4.9: Miscompilation of boolean negation on SH4 using -O2

2014-11-08 Thread Michael Karcher
Package: gcc-4.9
Version: 4.9.1-16
Severity: important

The currently available version of gcc 4.9 for mips miscompiles boolean 
negation under certain circumstances.
The assembly contains the not instruction, which represents bitwise negation, 
which is not appropriate, as
both 0 and 1 get mapped to a non-zero bit-pattern, but the following check of 
the boolean tests it against 0.

See the attached example file. The assertion fails if compiled with -O2 but 
succeeds without optimization.
This is actually a heavily stripped-down example of a miscompilation of 
binutils, making linking of most C++
programs on SH4 fail. The misbehaviour of binutils is reported in
https://sourceware.org/bugzilla/show_bug.cgi?id=17553 , but this bug has been 
correctly rejected as it is
not caused by the binutils source code.

-- System Information:
Debian Release: jessie/sid
  APT prefers unreleased
  APT policy: (500, 'unreleased'), (500, 'unstable')
Architecture: sh4 (sh4a)

Kernel: Linux 3.2.44-00829-g14e6110 (PREEMPT)
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 gcc-4.9 depends on:
ii  binutils2.24.90.20141104-1
ii  cpp-4.9 4.9.1-16
ii  gcc-4.9-base4.9.1-16
ii  libc6   2.19-11
ii  libcloog-isl4   0.18.2-1
ii  libgcc-4.9-dev  4.9.1-16
ii  libgmp102:6.0.0+dfsg-6
ii  libisl100.12.2-2
ii  libmpc3 1.0.2-1
ii  libmpfr43.1.2-1
ii  zlib1g  1:1.2.8.dfsg-2

Versions of packages gcc-4.9 recommends:
ii  libc6-dev  2.19-11

Versions of packages gcc-4.9 suggests:
pn  gcc-4.9-doc  none
pn  gcc-4.9-locales  none
pn  libasan1-dbg none
pn  libatomic1-dbg   none
pn  libcilkrts5-dbg  none
pn  libgcc1-dbg  none
pn  libgomp1-dbg none
pn  libitm1-dbg  none
pn  liblsan0-dbg none
pn  libquadmath-dbg  none
pn  libtsan0-dbg none
pn  libubsan0-dbgnone

-- no debconf information

*** /home/glaubitz/gcctest/gccfail.c
#include assert.h

int decision_result;
int truecount = 0;
int val;

void buggy(int flag)
{
  int condition;
  if(flag == 0)
condition = val != 0;
  else
condition = !decision_result;
  if (condition)
  {
 truecount++;
  }
}

int main(void)
{
  decision_result = 1;
  buggy(1);
  assert(truecount == 0);
}


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org