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

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
It doesn't handle negative offsets, we're doing

                  /* Optional constant offset.  */
                  if (c_parser_next_token_is (parser, CPP_PLUS))
                    {
                      c_parser_consume_token (parser);
                      alias_off
                        = c_parser_gimple_postfix_expression (parser).value;
                      alias_off = fold_convert (alias_type, alias_off);
                    }

I tried to parse what -gimple dumps show (which indeed is the "ugly"
hex number given the INTEGER_CSTs have pointer type).  It works when
you write

  __MEM <int, 16> ((char *)&x + _Literal (int) -2) = i;

the magic _Literal forces (some) constant foldings/type conversions to
be done so we get a single value rather than the syntactical negate of
two.  This shows elsewhere, too.  Note it is required to not always parse
-2 as literal since else you couldn't write an unfolded unary minus operation
of a constant.

OTOH I just figured we -gimple dump

int foo (int i)
{
  int j = -1;
  return j + i;
}

as

int __GIMPLE ()
foo (int i)
{
  int D_1910;
  int j;

  j = -1;
  D_1910 = j + i;
  return D_1910;
}

which is then wrong.

Reply via email to