public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Uros Bizjak <ubizjak@gmail.com>
To: Jakub Jelinek <jakub@redhat.com>
Cc: "gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] Fix ICE on invalid inline asm with "X" constraint and non-zero CONST_VECTOR (PR inline-asm/84625)
Date: Fri, 02 Mar 2018 07:16:00 -0000	[thread overview]
Message-ID: <CAFULd4Y5Gg=eSoNdW-aA8sESfAJOG3B-XNRc6Z73i1KrTtFNAg@mail.gmail.com> (raw)
In-Reply-To: <20180301231040.GU5867@tucnak>

On Fri, Mar 2, 2018 at 12:10 AM, Jakub Jelinek <jakub@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  <jakub@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

  reply	other threads:[~2018-03-02  7:16 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-01 23:10 Jakub Jelinek
2018-03-02  7:16 ` Uros Bizjak [this message]
2018-03-02  7:19   ` Uros Bizjak
2018-03-02  7:47     ` Jakub Jelinek
2018-03-02  7:53       ` Uros Bizjak

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAFULd4Y5Gg=eSoNdW-aA8sESfAJOG3B-XNRc6Z73i1KrTtFNAg@mail.gmail.com' \
    --to=ubizjak@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).