From 40191993da0bec1d166c1224e02788dc669c6dd9 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Wed, 19 Jun 2013 09:04:39 +0200 Subject: [PATCH] isl_printer_print_map: make printing order of disjuncts platform independent In particular, the printing order is based on a sort of the affine hulls of the disjuncts. If some of these affine hulls are the same, then the comparison routine will leave their order open. Different implementations of qsort may therefore produce different results. By using isl_sort instead, we can avoid this platform dependence. Signed-off-by: Sven Verdoolaege --- isl_output.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/isl_output.c b/isl_output.c index e9bc58f..deeb243 100644 --- a/isl_output.c +++ b/isl_output.c @@ -25,6 +25,7 @@ #include #include #include +#include static const char *s_to[2] = { " -> ", " \\to " }; static const char *s_and[2] = { " and ", " \\wedge " }; @@ -738,7 +739,7 @@ error: return NULL; } -static int aff_split_cmp(const void *p1, const void *p2) +static int aff_split_cmp(const void *p1, const void *p2, void *user) { const struct isl_aff_split *s1, *s2; s1 = (const struct isl_aff_split *) p1; @@ -800,7 +801,9 @@ static __isl_give struct isl_aff_split *split_aff(__isl_keep isl_map *map) goto error; } - qsort(split, map->n, sizeof(struct isl_aff_split), &aff_split_cmp); + if (isl_sort(split, map->n, sizeof(struct isl_aff_split), + &aff_split_cmp, NULL) < 0) + goto error; n = map->n; for (i = n - 1; i >= 1; --i) { -- 2.7.4