[Bug middle-end/78047] [7 Regression] Chromium apparently gets miscompiled

2016-10-31 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78047

--- Comment #8 from Richard Biener  ---
Because

(gdb) p *$54
$55 = {id = 30, is_artificial_var = 0, is_special_var = 0, is_unknown_size_var
= 0, is_full_var = 1, is_heap_var = 0, 
  may_have_pointers = 0, only_restrict_pointers = 0, is_restrict_var = 0,
is_global_var = 1, is_ipa_escape_point = 0, is_fn_info = 0, 
  ruid = 0, next = 0, head = 30, offset = 0, size = 448, fullsize = 448, 
  name = 0x7264dd68
"_ZZN18GrResourceProviderC4EP5GrGpuP15GrResourceCacheP13GrSingleOwnerE27gQuadIndexBufferKey_storage",
 
  decl = , solution =
0x37f54e0, oldsolution = 0x0}

thus it is noted as !may_have_pointers.

Ok, this is because we first generate "sth" at offset zero:

/* If there isn't anything at offset zero, create sth.  */
if (!pair
&& offset + foff != 0)
  {
fieldoff_s e
  = {0, offset + foff, false, false, false, false, NULL_TREE};
pair = fieldstack->safe_push (e);
  }

(note may_have_pointers = false) and then end up simply merging:

/* If adjacent fields do not contain pointers merge them.  */
must_have_pointers_p = field_must_have_pointers (field);
if (pair
&& !has_unknown_size
&& !must_have_pointers_p
&& !pair->must_have_pointers
&& !pair->has_unknown_size
&& pair->offset + (HOST_WIDE_INT)pair->size == offset + foff)
  {
pair->size += tree_to_uhwi (DECL_SIZE (field));

may_have_pointers should be conservative these days (should be removed from
fieldoff I guess).

diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c
index fb364f1..2880382 100644
--- a/gcc/tree-ssa-structalias.c
+++ b/gcc/tree-ssa-structalias.c
@@ -5566,7 +5568,7 @@ push_fields_onto_fieldstack (tree type, vec
*fieldstack,
&& offset + foff != 0)
  {
fieldoff_s e
- = {0, offset + foff, false, false, false, false, NULL_TREE};
+ = {0, offset + foff, false, false, true, false, NULL_TREE};
pair = fieldstack->safe_push (e);
  }


fixes it:

  MEM[(struct Builder *)].fKey = [(void
*)_storage + 8B];
  # PT = nonlocal escaped null { D.124724 } (nonlocal, escaped)
  _53 = MEM[(struct SkAutoSTMalloc *)_storage + 8B].fPtr;
  if (_53 != [(struct SkAutoSTMalloc *)_storage +
8B].D.47035.fTStorage)
goto ;

[Bug middle-end/78047] [7 Regression] Chromium apparently gets miscompiled

2016-10-31 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78047

Richard Biener  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
   Assignee|unassigned at gcc dot gnu.org  |rguenth at gcc dot 
gnu.org

--- Comment #7 from Richard Biener  ---
(In reply to Markus Trippelsdorf from comment #5)
>   :  
> 
>   MEM[(struct  &)] ={v} {CLOBBER};  
> 
>   _53 = MEM[(struct SkAutoSTMalloc *)_storage +
> 8B].fPtr;   
> 
>   if (_53 != [(struct SkAutoSTMalloc *)_storage +
> 8B].D.47025.fTStorage)  

So X.fPtr !=   This probably means a latent wrong-code
PTA bug.


  :
  MEM[(struct  &)_storage + 8] ={v} {CLOBBER};
  MEM[(struct  &)_storage + 8] ={v} {CLOBBER};
  MEM[(struct  &)_storage + 8] ={v} {CLOBBER};
  MEM[(struct SkAutoSTMalloc *)_storage + 8B].fPtr =
[(void *)_storage + 16B];
  MEM[(unsigned int &)_storage + 16] = 0;
  MEM[(unsigned int &)_storage + 20] = 0;
  MEM[(struct  &)_storage + 48] ={v} {CLOBBER};
  MEM[(struct sk_sp *)_storage + 48B].fPtr = 0B;
  # USE = nonlocal null { D.124671 D.124724 D.124797 D.124805 } (nonlocal,
escaped)
  # CLB = nonlocal null { D.124671 D.124724 D.124797 D.124805 } (nonlocal,
escaped)
  _49 = GrUniqueKey::GenerateDomain ();

  :
  MEM[(struct  &)] ={v} {CLOBBER};
  MEM[(struct Builder *)].fKey = [(void
*)_storage + 8B];
  # PT = null
  _53 = MEM[(struct SkAutoSTMalloc *)_storage + 8B].fPtr;
  # PT = null { D.124724 } (nonlocal, escaped)
  _54 = [(struct SkAutoSTMalloc *)_storage +
8B].D.47035.fTStorage;
  if (_53 != [(struct SkAutoSTMalloc *)_storage +
8B].D.47035.fTStorage)

...

we fail to add a constraint for _53 = ... at all.  We add:

_49 = NONLOCAL
builder =
&_ZZN18GrResourceProviderC4EP5GrGpuP15GrResourceCacheP13GrSingleOwnerE27gQuadIndexBufferKey_storage
_54 =
&_ZZN18GrResourceProviderC4EP5GrGpuP15GrResourceCacheP13GrSingleOwnerE27gQuadIndexBufferKey_storage
ESCAPED = _53
ESCAPED =
&_ZZN18GrResourceProviderC4EP5GrGpuP15GrResourceCacheP13GrSingleOwnerE27gQuadIndexBufferKey_storage