aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/config/i386/i386.c5
-rw-r--r--gcc/testsuite/gcc.target/i386/pr102761.c11
2 files changed, 15 insertions, 1 deletions
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 3c3336d..f111411 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -13921,7 +13921,10 @@ ix86_print_operand_address_as (FILE *file, rtx addr,
static void
ix86_print_operand_address (FILE *file, machine_mode /*mode*/, rtx addr)
{
- ix86_print_operand_address_as (file, addr, ADDR_SPACE_GENERIC, false);
+ if (this_is_asm_operands && ! address_operand (addr, VOIDmode))
+ output_operand_lossage ("invalid constraints for operand");
+ else
+ ix86_print_operand_address_as (file, addr, ADDR_SPACE_GENERIC, false);
}
/* Implementation of TARGET_ASM_OUTPUT_ADDR_CONST_EXTRA. */
diff --git a/gcc/testsuite/gcc.target/i386/pr102761.c b/gcc/testsuite/gcc.target/i386/pr102761.c
new file mode 100644
index 0000000..58ff27e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr102761.c
@@ -0,0 +1,11 @@
+/* PR target/102761 */
+/* { dg-do compile } */
+/* { dg-options "-O1" } */
+
+int foo (void);
+
+void
+bar (void)
+{
+ asm volatile ("%a0" : : "X"(foo () ? 2 : 1)); /* { dg-error "invalid constraints for operand" } */
+}