public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/106064] New: Wrong code comparing two global zero-sized arrays
@ 2022-06-23 12:36 acoplan at gcc dot gnu.org
  2022-06-23 16:21 ` [Bug tree-optimization/106064] " ktkachov at gcc dot gnu.org
                   ` (13 more replies)
  0 siblings, 14 replies; 15+ messages in thread
From: acoplan at gcc dot gnu.org @ 2022-06-23 12:36 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 106064
           Summary: Wrong code comparing two global zero-sized arrays
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: acoplan at gcc dot gnu.org
  Target Milestone: ---

For the following C code:

int a[0] = {};
int b[0] = {};
int f(void)
{
    return a != b;
}
int g(void)
{
    return (__UINTPTR_TYPE__)a != (__UINTPTR_TYPE__)b;
}

on AArch64 at -O2, we generate:

f:
        mov     w0, 1
        ret
g:
        mov     w0, 0
        ret

so f and g get optimized in contradictory ways. At least one of them must be
wrong.

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

end of thread, other threads:[~2022-07-08 17:02 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-23 12:36 [Bug tree-optimization/106064] New: Wrong code comparing two global zero-sized arrays acoplan at gcc dot gnu.org
2022-06-23 16:21 ` [Bug tree-optimization/106064] " ktkachov at gcc dot gnu.org
2022-06-24  9:56 ` mikpelinux at gmail dot com
2022-06-24 10:20 ` pinskia at gcc dot gnu.org
2022-06-24 10:21 ` pinskia at gcc dot gnu.org
2022-06-24 10:28 ` acoplan at gcc dot gnu.org
2022-06-24 10:30 ` rguenth at gcc dot gnu.org
2022-06-24 10:34 ` acoplan at gcc dot gnu.org
2022-06-24 10:50 ` jakub at gcc dot gnu.org
2022-06-27 10:15 ` acoplan at gcc dot gnu.org
2022-06-27 10:19 ` jakub at gcc dot gnu.org
2022-06-27 12:21 ` acoplan at gcc dot gnu.org
2022-06-27 14:18 ` rearnsha at gcc dot gnu.org
2022-06-27 14:25 ` acoplan at gcc dot gnu.org
2022-07-08 17:02 ` acoplan 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).