public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/99079] New: Maybe a wrong code since r6-1462-g4ab1e111ef0669bb
@ 2021-02-12 17:22 marxin at gcc dot gnu.org
  2021-02-12 17:22 ` [Bug tree-optimization/99079] " marxin at gcc dot gnu.org
                   ` (12 more replies)
  0 siblings, 13 replies; 14+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-02-12 17:22 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 99079
           Summary: Maybe a wrong code since r6-1462-g4ab1e111ef0669bb
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: marxin at gcc dot gnu.org
                CC: rguenth at gcc dot gnu.org
  Target Milestone: ---

Since the revision, we optimize the following in a different way:

$ cat x.cpp
unsigned long var = 31;
unsigned long arr;

static void test()
{
  unsigned long s = 1 << var;
  arr = 4897637220ULL % s;
}

int main()
{
  test();
  __builtin_printf ("arr: %ld\n", arr);
  if (arr != 4897637220ULL)
    __builtin_abort();
  return 0;
}

$ g++ x.cpp && ./a.out 
arr: 4897637220
$ g++ x.cpp && ./a.out 
arr: 4897637220

Clang is fine with the test-case:
$ clang++ x.cpp -O3 && ./a.out 
arr: 4897637220

and ICC as well.

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

end of thread, other threads:[~2021-04-22 17:11 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-12 17:22 [Bug tree-optimization/99079] New: Maybe a wrong code since r6-1462-g4ab1e111ef0669bb marxin at gcc dot gnu.org
2021-02-12 17:22 ` [Bug tree-optimization/99079] " marxin at gcc dot gnu.org
2021-02-12 17:51 ` jakub at gcc dot gnu.org
2021-02-12 18:56 ` jakub at gcc dot gnu.org
2021-02-12 19:09 ` jakub at gcc dot gnu.org
2021-02-12 19:11 ` jakub at gcc dot gnu.org
2021-02-12 19:21 ` jakub at gcc dot gnu.org
2021-02-15  8:17 ` cvs-commit at gcc dot gnu.org
2021-02-15  8:20 ` [Bug tree-optimization/99079] [8/9/10 Regression] " jakub at gcc dot gnu.org
2021-03-19 23:29 ` cvs-commit at gcc dot gnu.org
2021-03-20  8:07 ` [Bug tree-optimization/99079] [8/9 " jakub at gcc dot gnu.org
2021-04-20 23:32 ` cvs-commit at gcc dot gnu.org
2021-04-22 16:50 ` cvs-commit at gcc dot gnu.org
2021-04-22 17:11 ` jakub 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).