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

            Bug ID: 77952
           Summary: c++11 and gcc: internal compiler error: in
                    convert_move
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: igor at chub dot in
  Target Milestone: ---

I have the following code:

typedef int  __v8si __attribute__ ((__vector_size__ (32)));

class T
{
public:
   __v8si v;

   __attribute__((target("avx2")))
   T(int p ):v(__extension__ __v8si{p,p,p,p,p,p,p,p}){}

   __attribute__((target("avx2")))
   T(__v8si p):v(p){}

   __attribute__((target("avx2")))
   T operator * ( T  b ) const
   {
      return __builtin_ia32_pmulld256( v , b.v ) ;
   }
};

void h(int *);

__attribute__((target("default")))
void h(int *)
{
}

__attribute__((target("avx2")))
void h(int *)
{
 const T a(1);
 const T b(2);
 const T c (a * b);
}

int main()
{
  return 0;
}

If I try to compile it, I have the following error:

$ gcc test.cpp -std=c++11

test.cpp: In member function 'T T::operator*(T) const':
test.cpp:17:48: internal compiler error: in convert_move, at expr.c:315
       return __builtin_ia32_pmulld256( v , b.v ) ;
                                                ^
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://bugzilla.redhat.com/bugzilla> for instructions.

I have tried to compile it with various gcc versions: 4.9.2, 5.3 and several
other versions.

Have you any ideas why it happens, and how could I solve the problem?

gcc test.cpp -std=c++11 -mavx2 works.

gcc test.cpp -std=c++11 -O1 works.

but I want to compile the code with -O0

Reply via email to