Waldek Hebisch wrote:
I had build gpc-20050331 with gcc-3.4.3 on Sparc-Solaris 2.6. I have found one new problem: gpc passed incorrect comparison function to qsort. On Linux it did not matter, but on Solaris it may crash or produce wrong code. There are few other test failures, but I can not reproduce the problem with sets.
Could you try the patch below? It fixes the qsort problem. On my machine sets work even without that patch, but in principle that particular bug may cause quite weird problems with sets. BTW, if you re-make, make sure that gpc runtime is re-build (quite likely the runtime got mis-compiled).
diff -u p.orig/types.c p/types.c --- p.orig/types.c Thu Mar 31 02:10:15 2005 +++ p/types.c Tue May 31 23:04:05 2005 @@ -201,7 +201,14 @@ static int sce_cmp (const PTR xp, const PTR yp) {
- return const_lt (TREE_PURPOSE (*(tree *) xp), TREE_PURPOSE (*(tree *) yp)) ? -1 : 1;
- tree c1 = TREE_PURPOSE (*(tree *) xp);
- tree c2 = TREE_PURPOSE (*(tree *) yp);
- if (const_lt (c1, c2))
- return -1;
- else if (const_lt (c2, c1))
- return 1;
- else
- return 0;
}
/* Build a constructor node for set elements.
Right. I think we can also use return tree_int_cst_compare (...) (providing a substitute for gcc-2.x). I'll do this unless you see any problem.
Frank