On Fri, Mar 2, 2018 at 12:10 AM, Jakub Jelinek <ja...@redhat.com> wrote: > Hi! > > Assertions are only useful when inline asm is not involved, otherwise users > can write anything they want. > > Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for > trunk? > > 2018-03-02 Jakub Jelinek <ja...@redhat.com> > > PR inline-asm/84625 > * config/i386/i386.c (ix86_print_operand): Use conditional > output_operand_lossage instead of gcc_assert if CONST_VECTOR is not > zero vector. > > * gcc.target/i386/pr84625.c: New test.
OK. Thanks, Uros. > --- gcc/config/i386/i386.c.jj 2018-02-26 20:49:57.345331383 +0100 > +++ gcc/config/i386/i386.c 2018-03-01 12:01:17.820587068 +0100 > @@ -18743,7 +18743,8 @@ ix86_print_operand (FILE *file, rtx x, i > since we can in fact encode that into an immediate. */ > if (GET_CODE (x) == CONST_VECTOR) > { > - gcc_assert (x == CONST0_RTX (GET_MODE (x))); > + if (x != CONST0_RTX (GET_MODE (x))) > + output_operand_lossage ("invalid vector immediate"); > x = const0_rtx; > } > > --- gcc/testsuite/gcc.target/i386/pr84625.c.jj 2018-03-01 12:00:06.254636914 > +0100 > +++ gcc/testsuite/gcc.target/i386/pr84625.c 2018-03-01 12:14:54.044024998 > +0100 > @@ -0,0 +1,12 @@ > +/* PR inline-asm/84625 */ > +/* { dg-do compile } */ > +/* { dg-options "-O2 -msse2" } */ > + > +typedef int V __attribute__((vector_size (16))); > + > +void > +foo (void) > +{ > + asm volatile ("# %0" : : "X" ((V) { 1, 2, 3, 4 })); // { dg-error > "invalid vector immediate" } > + asm volatile ("# %0" : : "" ((V) { 2, 3, 4, 5 })); // { dg-error > "invalid vector immediate" } > +} > > Jakub