This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/15438] [3.5 Regression] miscompilation with attribute (__malloc__)
- From: "steven at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 17 May 2004 07:54:50 -0000
- Subject: [Bug tree-optimization/15438] [3.5 Regression] miscompilation with attribute (__malloc__)
- References: <20040514162618.15438.belyshev@lubercy.com>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From steven at gcc dot gnu dot org 2004-05-17 07:54 -------
This is interesting. Before dom1, we have this:
main ()
{
int<D0> * p<D1457>;
int<D0> T.0<D1458>;
# BLOCK 0
# PRED: ENTRY (fallthru)
p<D1457>_1 = &a<D1451>;
*p<D1457>_1 = 0;
# VUSE <a<D1451>_2>;
foo ();
T.0<D1458>_3 = *p<D1457>_1;
if (T.0<D1458>_3 == 0) goto <L0>; else goto <L1>;
# SUCC: 2 (false) 1 (true)
# BLOCK 1
# PRED: 0 (true)
<L0>:;
abort ();
# SUCC:
# BLOCK 2
# PRED: 0 (false)
<L1>:;
return 0;
# SUCC: EXIT
}
Note especially this:
# VUSE <a<D1451>_2>;
foo ();
T.0<D1458>_3 = *p<D1457>_1;
So foo() doesn't clobber a here. (And is it expected that
dereferencing p is not a VUSE of a?)
Then dom1 turns it into this:
main ()
{
int<D0> * p<D1457>;
int<D0> T.0<D1458>;
# BLOCK 0
# PRED: ENTRY (fallthru)
p<D1457>_1 = &a<D1451>;
# a<D1451>_5 = VDEF <a<D1451>_2>;
a<D1451> = 0;
# VUSE <a<D1451>_5>;
foo ();
# VUSE <a<D1451>_5>;
T.0<D1458>_3 = a<D1451>;
if (T.0<D1458>_3 == 0) goto <L0>; else goto <L1>;
# SUCC: 2 (false) 1 (true)
# BLOCK 1
# PRED: 0 (true)
<L0>:;
abort ();
# SUCC:
# BLOCK 2
# PRED: 0 (false)
<L1>:;
return 0;
# SUCC: EXIT
}
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15438