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

--- Comment #5 from Uroš Bizjak <ubizjak at gmail dot com> ---
Created attachment 37108
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=37108&action=edit
Proposed patch

There is a logic error in Honza's patch. The part in memrefs_conflict_p should
be changed to:

-      /* If decls are different or we know by offsets that there is no
overlap,
-        we win.  */
-      if (!cmp || !offset_overlap_p (c, xsize, ysize))
+      /* If decls are different and we know by offsets that
+        there is no overlap, we win.  */
+      if (!cmp && !offset_overlap_p (c, xsize, ysize))
        return 0;
-      /* Decls may or may not be different and offsets overlap....*/
+      /* Decls are different and offsets overlap....*/

Even if decls are different, their offsets shouldn't overlap! Addresses with
AND alignment operands depend on increased xsize and ysize, so no wonder gcc
fails to bootstrap on alpha.

In addition to this, the check for SYMBOL_REFs in base_alias_check should be
moved after checks for AND addresses.

The patch also adds some simplification. If symtab_address::equal_address_to
returns -1 for "unknown" (as is otherwise customary throughout the sources), we
can simplify compare_base_decls a bit.

The patch was bootstrapped and regression tested on x86_64-linux-gnu {,-m32}.
Currently, the bootstrap on alpha-linux-gnu is running (this target is a
massive user of AND-aligned addresses, and bootstrap already went well beyond
the point of reported bootstrap failure).

Reply via email to