From: Matthew Fernandez Date: Sat, 9 May 2020 00:16:18 +0000 (-0700) Subject: fix: print index instead of pointer value in debugging message X-Git-Tag: 2.44.1~72^2~1 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=31ef5a3c31214d77137e4b36603a2a97576e851e;p=graphviz fix: print index instead of pointer value in debugging message The .v and .av members of the structs being used here are node_t**s. So the addition of an integer results in a node_t**. This does not seem like what was intended to be printed here, but rather the integer value being added. This issue was found by adding __attribute__((format(printf, 2, 3))) to agerr() and then using compiler flag -Werror=format. --- diff --git a/lib/dotgen/mincross.c b/lib/dotgen/mincross.c index c7c498541..7d5f73ae9 100644 --- a/lib/dotgen/mincross.c +++ b/lib/dotgen/mincross.c @@ -1365,7 +1365,7 @@ void install_in_rank(graph_t * g, node_t * n) if (GD_rank(g)[r].v + ND_order(n) > GD_rank(g)[r].av + GD_rank(Root)[r].an) { agerr(AGERR, "install_in_rank, line %d: GD_rank(g)[%d].v + ND_order(%s) [%d] > GD_rank(g)[%d].av + GD_rank(Root)[%d].an [%d]\n", - __LINE__, r, agnameof(n),GD_rank(g)[r].v + ND_order(n), r, r, GD_rank(g)[r].av+GD_rank(Root)[r].an); + __LINE__, r, agnameof(n),ND_order(n), r, r, GD_rank(Root)[r].an); return; } }