public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "glaubitz at physik dot fu-berlin.de" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/63783] New: gcc-4.9: Miscompilation of boolean negation on SH4 using -O2
Date: Sat, 08 Nov 2014 20:52:00 -0000	[thread overview]
Message-ID: <bug-63783-4@http.gcc.gnu.org/bugzilla/> (raw)

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


             reply	other threads:[~2014-11-08 20:52 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-08 20:52 glaubitz at physik dot fu-berlin.de [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-63783-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).