public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/63783] New: gcc-4.9: Miscompilation of boolean negation on SH4 using -O2
@ 2014-11-08 20:52 glaubitz at physik dot fu-berlin.de
  2014-11-09  1:12 ` [Bug target/63783] [4.9/5 Regression] [SH] " kkojima at gcc dot gnu.org
                   ` (24 more replies)
  0 siblings, 25 replies; 26+ messages in thread
From: glaubitz at physik dot fu-berlin.de @ 2014-11-08 20:52 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63783

            Bug ID: 63783
           Summary: gcc-4.9: Miscompilation of boolean negation on SH4
                    using -O2
           Product: gcc
           Version: 4.9.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: glaubitz at physik dot fu-berlin.de

Hello!

Recently we ran into linker issues on our SH4 buildds in Debian [1]. We
initially blamed the linker for the problem, but after some more investigation,
Michael Karcher was eventually able to track down the problem being a
regression in gcc [2].

When compiling the following code snippet with optimization -O2 enabled, the
assertation will fail but succeed without:

#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);
}

The issue did not arise with gcc-4.6, for example, so it appears to be a
regression with one of the later versions of gcc.

Cheers,
Adrian

> [1] https://sourceware.org/bugzilla/show_bug.cgi?id=17553
> [2] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=768574


^ permalink raw reply	[flat|nested] 26+ messages in thread

end of thread, other threads:[~2014-11-24 16:57 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-08 20:52 [Bug c/63783] New: gcc-4.9: Miscompilation of boolean negation on SH4 using -O2 glaubitz at physik dot fu-berlin.de
2014-11-09  1:12 ` [Bug target/63783] [4.9/5 Regression] [SH] " kkojima at gcc dot gnu.org
2014-11-09  7:14 ` olegendo at gcc dot gnu.org
2014-11-12 23:25 ` gcc-bugzilla at mkarcher dot dialup.fu-berlin.de
2014-11-16  2:36 ` olegendo at gcc dot gnu.org
2014-11-16  7:37 ` gcc-bugzilla at mkarcher dot dialup.fu-berlin.de
2014-11-16  8:24 ` olegendo at gcc dot gnu.org
2014-11-16 10:02 ` gcc-bugzilla at mkarcher dot dialup.fu-berlin.de
2014-11-16 10:41 ` gcc-bugzilla at mkarcher dot dialup.fu-berlin.de
2014-11-16 11:01 ` olegendo at gcc dot gnu.org
2014-11-16 12:24 ` gcc-bugzilla at mkarcher dot dialup.fu-berlin.de
2014-11-16 18:54 ` gcc-bugzilla at mkarcher dot dialup.fu-berlin.de
2014-11-16 23:44 ` olegendo at gcc dot gnu.org
2014-11-19 13:27 ` rguenth at gcc dot gnu.org
2014-11-21  3:41 ` olegendo at gcc dot gnu.org
2014-11-21 18:53 ` gcc-bugzilla at mkarcher dot dialup.fu-berlin.de
2014-11-22  3:28 ` olegendo at gcc dot gnu.org
2014-11-22  3:33 ` olegendo at gcc dot gnu.org
2014-11-22 10:14 ` gcc-bugzilla at mkarcher dot dialup.fu-berlin.de
2014-11-22 10:39 ` olegendo at gcc dot gnu.org
2014-11-22 11:07 ` gcc-bugzilla at mkarcher dot dialup.fu-berlin.de
2014-11-22 15:34 ` olegendo at gcc dot gnu.org
2014-11-22 15:37 ` gcc-bugzilla at mkarcher dot dialup.fu-berlin.de
2014-11-22 15:50 ` olegendo at gcc dot gnu.org
2014-11-22 16:08 ` olegendo at gcc dot gnu.org
2014-11-24 16:57 ` rguenth at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).