diff mbox

Another x86 output_operand_lossage fix (PR target/79729)

Message ID 20170228160422.GM1849@tucnak
State New
Headers show

Commit Message

Jakub Jelinek Feb. 28, 2017, 4:04 p.m. UTC
Hi!

Apparently when fixing these issues earlier I've missed one spot with
gcc_unreachable () dependent on the value that could be provided by user
in bogus inline asm.

Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

2017-02-28  Jakub Jelinek  <jakub@redhat.com>

	PR target/79729
	* config/i386/i386.c (ix86_print_operand) <case 'R'>: Replace
	gcc_unreachable with output_operand_lossage.

	* gcc.target/i386/pr79729.c: New test.


	Jakub

Comments

Uros Bizjak Feb. 28, 2017, 4:18 p.m. UTC | #1
On Tue, Feb 28, 2017 at 5:04 PM, Jakub Jelinek <jakub@redhat.com> wrote:
> Hi!
>
> Apparently when fixing these issues earlier I've missed one spot with
> gcc_unreachable () dependent on the value that could be provided by user
> in bogus inline asm.
>
> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
>
> 2017-02-28  Jakub Jelinek  <jakub@redhat.com>
>
>         PR target/79729
>         * config/i386/i386.c (ix86_print_operand) <case 'R'>: Replace
>         gcc_unreachable with output_operand_lossage.
>
>         * gcc.target/i386/pr79729.c: New test.

OK.

Thanks,
Uros.

> --- gcc/config/i386/i386.c.jj   2017-02-28 07:49:33.000000000 +0100
> +++ gcc/config/i386/i386.c      2017-02-28 07:56:38.536106025 +0100
> @@ -18228,7 +18228,8 @@ ix86_print_operand (FILE *file, rtx x, i
>               fputs ("{rz-sae}", file);
>               break;
>             default:
> -             gcc_unreachable ();
> +             output_operand_lossage ("operand is not a specific integer, "
> +                                     "invalid operand code 'R'");
>             }
>
>           if (ASSEMBLER_DIALECT == ASM_ATT)
> --- gcc/testsuite/gcc.target/i386/pr79729.c.jj  2017-02-28 07:58:11.168862088 +0100
> +++ gcc/testsuite/gcc.target/i386/pr79729.c     2017-02-28 07:58:31.401590388 +0100
> @@ -0,0 +1,8 @@
> +/* PR target/79729 */
> +/* { dg-do compile } */
> +
> +void
> +foo (int x)
> +{
> +  __asm__ volatile ("# %R0" : : "n" (129));    /* { dg-error "invalid operand code" } */
> +}
>
>         Jakub
diff mbox

Patch

--- gcc/config/i386/i386.c.jj	2017-02-28 07:49:33.000000000 +0100
+++ gcc/config/i386/i386.c	2017-02-28 07:56:38.536106025 +0100
@@ -18228,7 +18228,8 @@  ix86_print_operand (FILE *file, rtx x, i
 	      fputs ("{rz-sae}", file);
 	      break;
 	    default:
-	      gcc_unreachable ();
+	      output_operand_lossage ("operand is not a specific integer, "
+				      "invalid operand code 'R'");
 	    }
 
 	  if (ASSEMBLER_DIALECT == ASM_ATT)
--- gcc/testsuite/gcc.target/i386/pr79729.c.jj	2017-02-28 07:58:11.168862088 +0100
+++ gcc/testsuite/gcc.target/i386/pr79729.c	2017-02-28 07:58:31.401590388 +0100
@@ -0,0 +1,8 @@ 
+/* PR target/79729 */
+/* { dg-do compile } */
+
+void
+foo (int x)
+{
+  __asm__ volatile ("# %R0" : : "n" (129));	/* { dg-error "invalid operand code" } */
+}