From c5014982bac1ec109d90e422f9a10039c21a5aa0 Mon Sep 17 00:00:00 2001 From: Alexander Monakov Date: Sun, 23 Jul 2017 21:40:24 +0300 Subject: [PATCH] fortran: fix pair_cmp qsort comparator * interface.c (pair_cmp): Fix gfc_symbol comparison. Adjust comment. From-SVN: r250463 --- gcc/fortran/ChangeLog | 4 ++++ gcc/fortran/interface.c | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index ff72ba45ee9..048a835d7fc 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,7 @@ +2017-07-23 Alexander Monakov + + * interface.c (pair_cmp): Fix gfc_symbol comparison. Adjust comment. + 2017-07-18 Nathan Sidwell * trans.c (gfc_build_array_ref): Use TYPE_MAX_VALUE. diff --git a/gcc/fortran/interface.c b/gcc/fortran/interface.c index 6fe0647ecfe..13e2bdd6c7e 100644 --- a/gcc/fortran/interface.c +++ b/gcc/fortran/interface.c @@ -3294,7 +3294,7 @@ argpair; order: - p->a->expr == NULL - p->a->expr->expr_type != EXPR_VARIABLE - - growing p->a->expr->symbol. */ + - by gfc_symbol pointer value (larger first). */ static int pair_cmp (const void *p1, const void *p2) @@ -3320,6 +3320,8 @@ pair_cmp (const void *p1, const void *p2) } if (a2->expr->expr_type != EXPR_VARIABLE) return 1; + if (a1->expr->symtree->n.sym > a2->expr->symtree->n.sym) + return -1; return a1->expr->symtree->n.sym < a2->expr->symtree->n.sym; } -- 2.30.2