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 middle-end/78047] [7 Regression] Chromium apparently gets miscompiled


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78047

--- Comment #8 from Richard Biener <rguenth at gcc dot gnu.org> ---
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 = 0x7ffff264dd68
"_ZZN18GrResourceProviderC4EP5GrGpuP15GrResourceCacheP13GrSingleOwnerE27gQuadIndexBufferKey_storage", 
  decl = <var_decl 0x7ffff3607000 gQuadIndexBufferKey_storage>, 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<fieldoff_s>
*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 *)&builder].fKey = &MEM[(void
*)&gQuadIndexBufferKey_storage + 8B];
  # PT = nonlocal escaped null { D.124724 } (nonlocal, escaped)
  _53 = MEM[(struct SkAutoSTMalloc *)&gQuadIndexBufferKey_storage + 8B].fPtr;
  if (_53 != &MEM[(struct SkAutoSTMalloc *)&gQuadIndexBufferKey_storage +
8B].D.47035.fTStorage)
    goto <bb 10>;

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