+2017-02-18 Jakub Jelinek <jakub@redhat.com>
+
+ 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 <wschmidt@linux.vnet.ibm.com>
PR target/79261
break;
default:
- output_operand_lossage
- ("invalid operand size for operand code 'O'");
+ output_operand_lossage ("invalid operand size for operand "
+ "code 'O'");
return;
}
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':
}
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':
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
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);
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);
return;
default:
- output_operand_lossage ("invalid operand code '%c'", code);
+ output_operand_lossage ("invalid operand code '%c'", code);
}
}
--- /dev/null
+/* 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" } */
+}