[Bug rtl-optimization/88433] wrong code for printf after a pointer cast from a pointer to an adjacent object

2020-03-20 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88433

Martin Sebor  changed:

   What|Removed |Added

 Resolution|--- |DUPLICATE
 Status|NEW |RESOLVED

--- Comment #3 from Martin Sebor  ---
Per comment #2.

*** This bug has been marked as a duplicate of bug 49330 ***

[Bug rtl-optimization/88433] wrong code for printf after a pointer cast from a pointer to an adjacent object

2018-12-11 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88433

Richard Biener  changed:

   What|Removed |Added

   Keywords||alias
 Status|UNCONFIRMED |NEW
   Last reconfirmed||2018-12-11
  Component|target  |rtl-optimization
 Depends on||49330
 Ever confirmed|0   |1

--- Comment #2 from Richard Biener  ---
I think this is a dup of the bug pointing to RTL alias analysis which cannot
properly distinguish between pointers and integers when following to base
terms.

We expand from

   [local count: 1073741825]:
  ix_5 = (long int) 
  ix_6 = ix_5 + 4;
  ix.1_1 = (int *) ix_6;
  p = ix.1_1;
  q = 
  _14 = MEM[(char * {ref-all})];
  _15 = MEM[(char * {ref-all})];
  if (_14 == _15)
goto ; [33.00%]
  else
goto ; [67.00%]

   [local count: 354334802]:
  *ix.1_1 = 11;
  y.4_3 = y;
  __builtin_printf ("%i", y.4_3); [tail call]

where RTL has plenty opportunity to track down ix.1_1 to  + 4 which
makes it non-aliasing to y.

Note we are saved for f just beacuse of optimization propagating a
conditional equivalence p_5 == 

Dup of PR49330.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=49330
[Bug 49330] Integer arithmetic on addresses optimised with pointer arithmetic
rules