https://gcc.gnu.org/g:83739ee76da65ddf56a1be3eda253e2ad0fa5ab8
commit r16-5946-g83739ee76da65ddf56a1be3eda253e2ad0fa5ab8 Author: Alexandre Oliva <[email protected]> Date: Sat Dec 6 22:08:04 2025 -0300 cselib: dump_cselib_* fixes Rework dump_cselib_table to not crash when cselib_preserved_hash_table is not allocated, and to remove the extraneous indirection from dump_cselib_val that made it inconvenient to call from a debugger. for gcc/ChangeLog * cselib.cc (dump_cselib_val): Split out of and rename to... (dump_cselib_val_ptr): ... this. (dump_cselib_table): Adjust. Skip cselib_preserved_hash_table when not allocated. Diff: --- gcc/cselib.cc | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/gcc/cselib.cc b/gcc/cselib.cc index 7f1991b09c3c..930357409bc5 100644 --- a/gcc/cselib.cc +++ b/gcc/cselib.cc @@ -3459,12 +3459,11 @@ cselib_finish (void) next_uid = 0; } -/* Dump the cselib_val *X to FILE *OUT. */ +/* Dump the cselib_val V to FILE *OUT. */ int -dump_cselib_val (cselib_val **x, FILE *out) +dump_cselib_val (cselib_val *v, FILE *out) { - cselib_val *v = *x; bool need_lf = true; print_inline_rtx (out, v->val_rtx, 0); @@ -3533,15 +3532,27 @@ dump_cselib_val (cselib_val **x, FILE *out) return 1; } +/* Dump the cselib_val *X to FILE *OUT. */ + +static int +dump_cselib_val_ptr (cselib_val **x, FILE *out) +{ + cselib_val *v = *x; + return dump_cselib_val (v, out); +} + /* Dump to OUT everything in the CSELIB table. */ void dump_cselib_table (FILE *out) { fprintf (out, "cselib hash table:\n"); - cselib_hash_table->traverse <FILE *, dump_cselib_val> (out); - fprintf (out, "cselib preserved hash table:\n"); - cselib_preserved_hash_table->traverse <FILE *, dump_cselib_val> (out); + cselib_hash_table->traverse <FILE *, dump_cselib_val_ptr> (out); + if (cselib_preserved_hash_table) + { + fprintf (out, "cselib preserved hash table:\n"); + cselib_preserved_hash_table->traverse <FILE *, dump_cselib_val_ptr> (out); + } if (first_containing_mem != &dummy_val) { fputs ("first mem ", out);
