public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/109585] New: Carla/sord miscompiled with -O2 on ARM64 (inlining issue)
@ 2023-04-21 10:39 hector at marcansoft dot com
  2023-04-21 10:40 ` [Bug c/109585] " hector at marcansoft dot com
                   ` (28 more replies)
  0 siblings, 29 replies; 30+ messages in thread
From: hector at marcansoft dot com @ 2023-04-21 10:39 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 109585
           Summary: Carla/sord miscompiled with -O2 on ARM64 (inlining
                    issue)
           Product: gcc
           Version: 12.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hector at marcansoft dot com
  Target Milestone: ---

Created attachment 54900
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54900&action=edit
Manually annotated disassembly identifying the problem

GCC 12.1.0 miscompiles sord_free() with -O2 due to bad inlining on ARM64.
Reproducible on Compiler Explorer on 12.2 and also trunk.

https://godbolt.org/z/rvxP1oodh (includes full preprocessed input)

I've attached an annotated disassembly. The problem is that
zix_btree_iter_increment() and zix_btree_iter_is_end() are inlined together
into sord_free(), but the `i->stack[0].node == NULL` check in
zix_btree_iter_is_end() somehow got hoisted before the `f->node = NULL;` in
zix_btree_iter_increment(), so the check fails when it pass (ending the loop),
and then the loop body goes on to deref a NULL pointer.

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

end of thread, other threads:[~2023-07-07 10:08 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-21 10:39 [Bug c/109585] New: Carla/sord miscompiled with -O2 on ARM64 (inlining issue) hector at marcansoft dot com
2023-04-21 10:40 ` [Bug c/109585] " hector at marcansoft dot com
2023-04-21 10:52 ` rguenth at gcc dot gnu.org
2023-04-21 11:36 ` [Bug target/109585] " hector at marcansoft dot com
2023-04-21 11:37 ` hector at marcansoft dot com
2023-04-21 16:36 ` hector at marcansoft dot com
2023-04-21 16:38 ` hector at marcansoft dot com
2023-04-21 16:43 ` pinskia at gcc dot gnu.org
2023-04-21 16:50 ` [Bug middle-end/109585] " pinskia at gcc dot gnu.org
2023-04-21 16:55 ` hector at marcansoft dot com
2023-04-21 17:05 ` pinskia at gcc dot gnu.org
2023-04-21 17:08 ` hector at marcansoft dot com
2023-04-21 17:16 ` [Bug middle-end/109585] Carla/sord miscompiled with -O2 on ARM64 with flexible array member pinskia at gcc dot gnu.org
2023-04-22 21:48 ` [Bug rtl-optimization/109585] " amonakov at gcc dot gnu.org
2023-04-23  7:06 ` sjames at gcc dot gnu.org
2023-04-23  7:08 ` hector at marcansoft dot com
2023-04-23  7:50 ` xry111 at gcc dot gnu.org
2023-04-23  7:55 ` [Bug rtl-optimization/109585] [10/11/12/13/14 regression] " xry111 at gcc dot gnu.org
2023-04-24  6:39 ` rguenth at gcc dot gnu.org
2023-04-24  6:40 ` rguenth at gcc dot gnu.org
2023-04-24  8:46 ` amonakov at gcc dot gnu.org
2023-04-24  9:04 ` jakub at gcc dot gnu.org
2023-04-24  9:54 ` rguenth at gcc dot gnu.org
2023-04-24 11:35 ` rguenth at gcc dot gnu.org
2023-04-25 12:24 ` cvs-commit at gcc dot gnu.org
2023-04-25 12:25 ` [Bug rtl-optimization/109585] [10/11/12/13 " rguenth at gcc dot gnu.org
2023-04-26  9:33 ` cvs-commit at gcc dot gnu.org
2023-04-26 10:41 ` cvs-commit at gcc dot gnu.org
2023-05-02 12:04 ` [Bug rtl-optimization/109585] [10/11 " cvs-commit at gcc dot gnu.org
2023-07-07 10:08 ` [Bug rtl-optimization/109585] [10 " 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).