From: Jakub Jelinek Date: Sat, 18 Feb 2017 13:13:43 +0000 (+0100) Subject: re PR target/79559 (ICE in ix86_print_operand, at config/i386/i386.c:18189) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c26159516d6a16def440628643d8c1b7c43169c3;p=gcc.git re PR target/79559 (ICE in ix86_print_operand, at config/i386/i386.c:18189) PR target/79559 * config/i386/i386.c (ix86_print_operand): Use output_operand_lossage instead of gcc_assert for K, r and R code checks. Formatting fixes. * gcc.target/i386/pr79559.c: New test. From-SVN: r245560 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 53cd408b609..90e6d1f0ae5 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2017-02-18 Jakub Jelinek + + PR target/79559 + * config/i386/i386.c (ix86_print_operand): Use output_operand_lossage + instead of gcc_assert for K, r and R code checks. Formatting fixes. + 2017-02-17 Bill Schmidt PR target/79261 diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index a1c084f1b8f..fb0dca2bf0b 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -17847,8 +17847,8 @@ ix86_print_operand (FILE *file, rtx x, int code) break; default: - output_operand_lossage - ("invalid operand size for operand code 'O'"); + output_operand_lossage ("invalid operand size for operand " + "code 'O'"); return; } @@ -17882,15 +17882,14 @@ ix86_print_operand (FILE *file, rtx x, int code) return; default: - output_operand_lossage - ("invalid operand size for operand code 'z'"); + output_operand_lossage ("invalid operand size for operand " + "code 'z'"); return; } } if (GET_MODE_CLASS (GET_MODE (x)) == MODE_FLOAT) - warning - (0, "non-integer operand used with operand code 'z'"); + warning (0, "non-integer operand used with operand code 'z'"); /* FALLTHRU */ case 'Z': @@ -17952,13 +17951,12 @@ ix86_print_operand (FILE *file, rtx x, int code) } else { - output_operand_lossage - ("invalid operand type used with operand code 'Z'"); + output_operand_lossage ("invalid operand type used with " + "operand code 'Z'"); return; } - output_operand_lossage - ("invalid operand size for operand code 'Z'"); + output_operand_lossage ("invalid operand size for operand code 'Z'"); return; case 'd': @@ -18157,7 +18155,12 @@ ix86_print_operand (FILE *file, rtx x, int code) break; case 'K': - gcc_assert (CONST_INT_P (x)); + if (!CONST_INT_P (x)) + { + output_operand_lossage ("operand is not an integer, invalid " + "operand code 'K'"); + return; + } if (INTVAL (x) & IX86_HLE_ACQUIRE) #ifdef HAVE_AS_IX86_HLE @@ -18180,8 +18183,12 @@ ix86_print_operand (FILE *file, rtx x, int code) return; case 'r': - gcc_assert (CONST_INT_P (x)); - gcc_assert (INTVAL (x) == ROUND_SAE); + if (!CONST_INT_P (x) || INTVAL (x) != ROUND_SAE) + { + output_operand_lossage ("operand is not a specific integer, " + "invalid operand code 'r'"); + return; + } if (ASSEMBLER_DIALECT == ASM_INTEL) fputs (", ", file); @@ -18194,7 +18201,12 @@ ix86_print_operand (FILE *file, rtx x, int code) return; case 'R': - gcc_assert (CONST_INT_P (x)); + if (!CONST_INT_P (x)) + { + output_operand_lossage ("operand is not an integer, invalid " + "operand code 'R'"); + return; + } if (ASSEMBLER_DIALECT == ASM_INTEL) fputs (", ", file); @@ -18309,7 +18321,7 @@ ix86_print_operand (FILE *file, rtx x, int code) return; default: - output_operand_lossage ("invalid operand code '%c'", code); + output_operand_lossage ("invalid operand code '%c'", code); } } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 035cf4739c2..b4edfe81361 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-02-18 Jakub Jelinek + + PR target/79559 + * gcc.target/i386/pr79559.c: New test. + 2017-02-17 Joseph Myers * gcc.dg/c11-float-2.c: New test. diff --git a/gcc/testsuite/gcc.target/i386/pr79559.c b/gcc/testsuite/gcc.target/i386/pr79559.c new file mode 100644 index 00000000000..2eeb652a82e --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr79559.c @@ -0,0 +1,11 @@ +/* PR target/79559 */ +/* { dg-do compile } */ + +void +foo (int x) +{ + __asm__ volatile ("# %K0" : : "r" (x)); /* { dg-error "invalid operand code" } */ + __asm__ volatile ("# %r0" : : "r" (x)); /* { dg-error "invalid operand code" } */ + __asm__ volatile ("# %r0" : : "n" (129)); /* { dg-error "invalid operand code" } */ + __asm__ volatile ("# %R0" : : "r" (x)); /* { dg-error "invalid operand code" } */ +}