public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/94734] [10 Regression] Program crashes when compiled with -O2 since r10-1892-gb9ef6a2e04bfd013
Date: Thu, 23 Apr 2020 23:24:20 +0000	[thread overview]
Message-ID: <bug-94734-4-Ffdi0fk9WM@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-94734-4@http.gcc.gnu.org/bugzilla/>

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
+  int cstore_31;
+  int cstore_32;

   <bb 2> [local count: 114863530]:
   goto <bb 7>; [100.00%]

   <bb 3> [local count: 1014686026]:
   _1 = (long unsigned int) sum_a_7;
   _2 = _1 * 8;
   _3 = input_21(D) + _2;
   _4 = *_3;
   if (_4 == 0B)
     goto <bb 15>; [5.50%]
   else
     goto <bb 4>; [94.50%]

   <bb 4> [local count: 958878296]:
   if (sum_a_7 <= 1)
-    goto <bb 5>; [28.10%]
+    goto <bb 6>; [28.10%]
   else
-    goto <bb 6>; [71.90%]
+    goto <bb 5>; [71.90%]

-  <bb 5> [local count: 269444804]:
-  arr[sum_a_7] = 1;
+  <bb 5> [local count: 689433492]:
+  cstore_32 = MEM <int[2]> [(void *)&arr][sum_a_7];

   <bb 6> [local count: 958878296]:
+  # cstore_31 = PHI <1(4), cstore_32(5)>
+  MEM <int[2]> [(void *)&arr][sum_a_7] = cstore_31;
   sum_a_23 = sum_a_7 + 1;

done by cselim looks just plain wrong, there is no dominating load from that
memory, so even when the variable is an automatic variable, there is no
guarantee it won't be out of bounds and thus crash already on the load, or just
modify random unrelated memory.

  parent reply	other threads:[~2020-04-23 23:24 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-23 17:17 [Bug c/94734] New: Program crashes when compiled with GCC 10 john+gcc at hogberg dot online
2020-04-23 18:12 ` [Bug c/94734] " john+gcc at hogberg dot online
2020-04-23 19:19 ` [Bug tree-optimization/94734] [10 Regression] Program crashes when compiled with -O2 since r10-1892-gb9ef6a2e04bfd013 marxin at gcc dot gnu.org
2020-04-23 21:24 ` law at redhat dot com
2020-04-23 23:24 ` jakub at gcc dot gnu.org [this message]
2020-04-23 23:25 ` jakub at gcc dot gnu.org
2020-04-24  0:48 ` law at redhat dot com
2020-04-24  5:20 ` jakub at gcc dot gnu.org
2020-04-24  7:52 ` rguenth at gcc dot gnu.org
2020-04-24  7:55 ` rguenth at gcc dot gnu.org
2020-04-24  8:34 ` jakub at gcc dot gnu.org
2020-04-24  8:59 ` jakub at gcc dot gnu.org
2020-04-24  9:03 ` rguenther at suse dot de
2020-04-24  9:09 ` jakub at gcc dot gnu.org
2020-04-24  9:19 ` jakub at gcc dot gnu.org
2020-04-24  9:22 ` rguenth at gcc dot gnu.org
2020-04-24  9:29 ` jakub at gcc dot gnu.org
2020-04-24 10:37 ` jakub at gcc dot gnu.org
2020-04-24 22:10 ` cvs-commit at gcc dot gnu.org
2020-04-24 22:24 ` jakub 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-94734-4-Ffdi0fk9WM@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).