public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/113551] New: Miscompilation with -O1 -funswitch-loops -fno-strict-overflow
@ 2024-01-23  2:25 yshuiv7 at gmail dot com
  2024-01-23  2:28 ` [Bug rtl-optimization/113551] " yshuiv7 at gmail dot com
                   ` (20 more replies)
  0 siblings, 21 replies; 22+ messages in thread
From: yshuiv7 at gmail dot com @ 2024-01-23  2:25 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 113551
           Summary: Miscompilation with -O1 -funswitch-loops
                    -fno-strict-overflow
           Product: gcc
           Version: 13.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: yshuiv7 at gmail dot com
  Target Milestone: ---

Code:

struct obj {
        int __pad;
        int i;
};

/* aborts when called with NULL */
int assert_not_null(void *); 

void bug(struct obj **root, struct obj *dso) {
        while (1) {
                struct obj *this = *root;

                if (dso == (void *)0)
                        // should return here
                        return;

                if (dso == this)
                        return;

                // shouldn't reach here
                assert_not_null(dso);

                if (!&dso->i)
                        break;
        }
}

// call like this: bug(&obj, NULL);

Result:

* -O1: ok
* -O1 -funswitch-loops: ok
* -O1 -fno-strict-overflow: ok
* -O1 -funswitch-loops -fno-strict-overflow: abort

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

end of thread, other threads:[~2024-05-14 14:31 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-23  2:25 [Bug rtl-optimization/113551] New: Miscompilation with -O1 -funswitch-loops -fno-strict-overflow yshuiv7 at gmail dot com
2024-01-23  2:28 ` [Bug rtl-optimization/113551] " yshuiv7 at gmail dot com
2024-01-23  2:31 ` yshuiv7 at gmail dot com
2024-01-23  2:31 ` [Bug tree-optimization/113551] " pinskia at gcc dot gnu.org
2024-01-23  2:32 ` pinskia at gcc dot gnu.org
2024-01-23  4:29 ` [Bug tree-optimization/113551] [13/14 Regression] " pinskia at gcc dot gnu.org
2024-01-23  7:54 ` rguenth at gcc dot gnu.org
2024-01-23  8:03 ` [Bug tree-optimization/113551] [13 " rguenth at gcc dot gnu.org
2024-01-23  8:06 ` rguenth at gcc dot gnu.org
2024-01-23 23:23 ` [Bug tree-optimization/113551] [13 Regression] Miscompilation with -O1 -fno-strict-overflow yshuiv7 at gmail dot com
2024-01-23 23:24 ` yshuiv7 at gmail dot com
2024-01-23 23:28 ` yshuiv7 at gmail dot com
2024-01-23 23:34 ` yshuiv7 at gmail dot com
2024-01-23 23:40 ` pinskia at gcc dot gnu.org
2024-01-23 23:42 ` mpolacek at gcc dot gnu.org
2024-01-24  0:19 ` yshuiv7 at gmail dot com
2024-01-24  0:21 ` yshuiv7 at gmail dot com
2024-01-24  0:27 ` pinskia at gcc dot gnu.org
2024-01-24  0:39 ` yshuiv7 at gmail dot com
2024-01-24  8:17 ` [Bug tree-optimization/113551] [13 Regression] Miscompilation with -O1 -funswitch-loops -fno-strict-overflow rguenther at suse dot de
2024-05-14 13:56 ` mikpelinux at gmail dot com
2024-05-14 14:31 ` 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).