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.