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

            Bug ID: 78089
           Summary: __builtin_shuffle parsing bug
           Product: gcc
           Version: 7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jakub at gcc dot gnu.org
  Target Milestone: ---

typedef int V __attribute__((vector_size (16)));
V a, b, c;

int
foo ()
{
  return __builtin_shuffle (a, b, c)[3];
}

int
main ()
{
  a = (V) { 1, 2, 3, 4 };
  b = (V) { 5, 6, 7, 8 };
  c = (V) { 7, 2, 5, 6 };
  if (foo () != 7)
    __builtin_abort ();
  return 0;
}

is accepted in C, but rejected in C++, already starting with its introduction
in 4.7.  In C++ __builtin_shuffle (a, b, c) is parsed as postfix-expression
rather than primary-expression, so [3] above is ignored.

Reply via email to