public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "vsevolod.livinskij at frtk dot ru" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/98640] New: GCC produces incorrect code with -O1 and higher
Date: Tue, 12 Jan 2021 17:01:39 +0000	[thread overview]
Message-ID: <bug-98640-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 98640
           Summary: GCC produces incorrect code with -O1 and higher
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: vsevolod.livinskij at frtk dot ru
  Target Milestone: ---

Reproducer:
#include <stdio.h>

unsigned long long int var_0 = 18128133247277979402ULL;
long long int var_14 = 6557021550272328915LL;
unsigned long long int var_83 = 10966786425750692026ULL;

void test() {
  var_14 = var_0 + (bool)7;
  var_83 = 1 + (int)var_0; // 1 + 888395530
}

int main() {
    test();
    printf("%llu\n", var_83);
}

https://godbolt.org/z/axYx1f

>$ g++ -O0 driver.cpp && ./a.out 
888395531
>$ g++ -O1 driver.cpp && ./a.out 
18128133247277979403

gcc version 11.0.0 20210112 (cf2ac1c30af0fa783c8d72e527904dda5d8cc330)

             reply	other threads:[~2021-01-12 17:01 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-12 17:01 vsevolod.livinskij at frtk dot ru [this message]
2021-01-12 18:45 ` [Bug tree-optimization/98640] [10/11 Regression] GCC produces incorrect code with -O1 and higher since r10-2711-g3ed01d5408045d80 marxin at gcc dot gnu.org
2021-01-13  8:18 ` rguenth at gcc dot gnu.org
2021-01-13 10:13 ` cvs-commit at gcc dot gnu.org
2021-03-03 10:36 ` [Bug tree-optimization/98640] [10 " cvs-commit at gcc dot gnu.org
2021-03-03 10:37 ` 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-98640-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).