2018-03-23  Jakub Jelinek  <jakub@redhat.com>
 
+       PR inline-asm/85034
+       * function.c (match_asm_constraints_1): Don't optimize if input
+       doesn't satisfy general_operand predicate for output's mode.
+
        PR inline-asm/85022
        * alias.c (write_dependence_p): Don't require for x_canonicalized
        non-VOIDmode if x has VOIDmode.
 
       /* Only do the transformation for pseudos.  */
       if (! REG_P (output)
          || rtx_equal_p (output, input)
-         || (GET_MODE (input) != VOIDmode
-             && GET_MODE (input) != GET_MODE (output))
          || !(REG_P (input) || SUBREG_P (input)
-              || MEM_P (input) || CONSTANT_P (input)))
+              || MEM_P (input) || CONSTANT_P (input))
+         || !general_operand (input, GET_MODE (output)))
        continue;
 
       /* We can't do anything if the output is also used as input,
 
 2018-03-23  Jakub Jelinek  <jakub@redhat.com>
 
+       PR inline-asm/85034
+       * gcc.target/i386/pr85034.c: New test.
+
        PR inline-asm/85022
        * c-c++-common/torture/pr85022.c: New test.
 
 
--- /dev/null
+/* PR inline-asm/85034 */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+void
+foo (void)
+{
+  volatile float a;
+  struct S { char a; } b = { 0 };
+  asm volatile ("" : "=r" (a) : "0ir" (b));
+}