Like for GIMPLE_PHIs or calls, even for GIMPLE_ASMs we want
a corresponding VAR_DECL assigned for lhs SSA_NAMEs of loads
from memory, as even GIMPLE_ASM relies on those VAR_DECLs to exist.
2024-01-19 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/113464
* gimple-lower-bitint.cc (gimple_lower_bitint): Don't try to
optimize loads into GIMPLE_ASM stmts.
* gcc.dg/bitint-75.c: New test.
if (is_gimple_debug (use_stmt))
continue;
if (gimple_code (use_stmt) == GIMPLE_PHI
- || is_gimple_call (use_stmt))
+ || is_gimple_call (use_stmt)
+ || gimple_code (use_stmt) == GIMPLE_ASM)
{
optimizable_load = false;
break;
--- /dev/null
+/* PR tree-optimization/113464 */
+/* { dg-do compile { target bitint65535 } } */
+/* { dg-options "-O2 -w -std=gnu23" } */
+
+_BitInt(65532) i;
+
+void
+foo (void)
+{
+ __asm__ ("" : "+r" (i)); /* { dg-error "impossible constraint" } */
+}