public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/100053] New: tree-fre incorrectly delete a condition
@ 2021-04-12 21:17 qinzhao at gcc dot gnu.org
  2021-04-12 22:52 ` [Bug tree-optimization/100053] " pinskia at gcc dot gnu.org
                   ` (13 more replies)
  0 siblings, 14 replies; 15+ messages in thread
From: qinzhao at gcc dot gnu.org @ 2021-04-12 21:17 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 100053
           Summary: tree-fre incorrectly delete a condition
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: qinzhao at gcc dot gnu.org
  Target Milestone: ---

hi, this is a bug with tree-fre optimization that caused run-time segmentation
fault. 
the original testing case cannot be posted.

the following is the reduced testing case through Creduce. 
ubuntu@qinzhao-ubuntu-x86:~/Bugs/32423691$ cat ksm.i
typedef a;
typedef struct b b;
struct {
  char c
} typedef d;
struct e {
  int f;
  char g
} typedef aa;
struct {
  int ad;
  char ae
} typedef ab;
struct {
  int ac;
  char ah;
  int ai;
  a *h;
  b *ag
} typedef af;
struct b {
  af i;
  struct e *j
} m;
k, o, q, r, s, t, u;
typedef l[];
l n;
*p;
ab al;
v(init) {
  d *aj;
  int ak;
  if (!init) {
    w();
    aj = q;
    if (p[t])
      goto aq;
    af am = (&m)->i;
    if (_setjmp())
      if ((&m)->i.h) {
        a an, ao;
        aa *ap = am.h[(&m)->i.ai];
        void *au;
        if ((&m)->i.ai) {
          if (x())
            an += (long)au % (&m)->i.ag->j->f;
          if ((a)__builtin_alloca)
            ao = au = an;
          ap->g = "";
        }
        y(ao);
      }
    ak |= z(n[k], ak, init ? 0 : ((int *)o)[t]);
    (&al)->ad = (&m)->i.ac & (&m)->i.ah;
    (&m)->i.ac = (&al)->ae = &al;
  }
  if (!init)
    aj->c = s;
  ar(u, r, s);
aq:
  if (!init)
    as(((int *)o)[t]);
}
ubuntu@qinzhao-ubuntu-x86:~/Bugs/32423691$ cat t
/home/ubuntu/Install/latest-debug/bin/gcc ksm.i -c -o ksm.o  -O2 
-fdump-tree-optimized 

ubuntu@qinzhao-ubuntu-x86:~/Bugs/32423691$ sh t
....

there are quite some warnings during compilation, please ignore them.

check the ksm.i.244t.optimized, you will find that the last "if (!init)" is
completely deleted;

if you add -fno-tree-fre to the compilation line, the last "if (!init)" will
not be deleted anymore.

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

end of thread, other threads:[~2021-05-04 13:55 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-12 21:17 [Bug tree-optimization/100053] New: tree-fre incorrectly delete a condition qinzhao at gcc dot gnu.org
2021-04-12 22:52 ` [Bug tree-optimization/100053] " pinskia at gcc dot gnu.org
2021-04-13  8:19 ` rguenth at gcc dot gnu.org
2021-04-13  9:11 ` rguenth at gcc dot gnu.org
2021-04-13 10:12 ` rguenth at gcc dot gnu.org
2021-04-13 10:12 ` [Bug tree-optimization/100053] [9/10/11 Regression] " rguenth at gcc dot gnu.org
2021-04-13 11:36 ` rguenth at gcc dot gnu.org
2021-04-13 12:31 ` cvs-commit at gcc dot gnu.org
2021-04-13 12:31 ` [Bug tree-optimization/100053] [9/10 " rguenth at gcc dot gnu.org
2021-04-13 15:28 ` qinzhao at gcc dot gnu.org
2021-04-13 16:32 ` rguenther at suse dot de
2021-04-13 23:55 ` qinzhao at gcc dot gnu.org
2021-04-26 11:46 ` cvs-commit at gcc dot gnu.org
2021-05-04 13:54 ` [Bug tree-optimization/100053] [9 " cvs-commit at gcc dot gnu.org
2021-05-04 13:55 ` 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).