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

--- Comment #3 from Martin Jambor <jamborm at gcc dot gnu.org> ---
The problem is that IPA-CP does not handle zero-aligned pointers (what
would they be?) but get_pointer_alignment_1 actually returns zero for
one and itself returns true, meaning it claims it knows the alignment
is what it says.  The reason for that is that the pointer is actually
either zero or an integer constant, selected by a ternary operator.

Given the circumstances, the behavior of get_pointer_alignment_1 is
actually OK, I suppose, so wee need to check for it like this:

--- a/gcc/ipa-prop.c
+++ b/gcc/ipa-prop.c
@@ -1651,6 +1651,7 @@ ipa_compute_jump_functions_for_edge (struct
ipa_func_body_info *fbi,
          unsigned align;

          if (get_pointer_alignment_1 (arg, &align, &hwi_bitpos)
+             && align != 0
              && align % BITS_PER_UNIT == 0
              && hwi_bitpos % BITS_PER_UNIT == 0)
            {

Reply via email to