Hi! On Sat, Mar 20, 2021 at 10:53:32AM -0400, Vladimir Makarov via Gcc-patches wrote: > It seems CONSTRAINT_LEN treats constraint '\0' as one having length 1.
Maybe we should fix that? See attached patch. Segher diff --git a/gcc/genpreds.c b/gcc/genpreds.c index 8499a2a2383b..b83a030d6a5d 100644 --- a/gcc/genpreds.c +++ b/gcc/genpreds.c @@ -1141,6 +1141,9 @@ write_insn_constraint_len (void) " switch (fc)\n" " {"); + /* Empty constraints have length 0. */ + printf (" case 0: return 0;\n"); + for (i = 0; i < ARRAY_SIZE (constraints_by_letter_table); i++) { class constraint_data *c = constraints_by_letter_table[i]; @@ -1470,14 +1473,9 @@ write_tm_preds_h (void) address_start, address_end); write_allows_reg_mem_function (); - if (constraint_max_namelen > 1) - { - write_insn_constraint_len (); - puts ("#define CONSTRAINT_LEN(c_,s_) " - "insn_constraint_len (c_,s_)\n"); - } - else - puts ("#define CONSTRAINT_LEN(c_,s_) 1\n"); + write_insn_constraint_len (); + puts ("#define CONSTRAINT_LEN(c_,s_) insn_constraint_len (c_,s_)\n"); + if (have_register_constraints) puts ("extern enum reg_class reg_class_for_constraint_1 " "(enum constraint_num);\n"