This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug tree-optimization/15438] [3.5 Regression] miscompilation with attribute (__malloc__)


------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]