On Tue, 23 Jul 2019, Richard Biener wrote:

> OK, so like below.  Slight complication is that C++ doesn't allow
> the void * to int (*)() casting which means we probably have to go
> with the template wrapper.  I have to check if we use gcc_qsort
> from C code, the prototypes are currently in system.h.

This is a bit confusing.  I see the patch implements option 1, but
you're saying you'd prefer option 3 (which is also my preference)?

Calls from C code should be very rare, it's possible to adjust them
manually if going for option 3.

> Of course easiest is to simply rewrite all qsort calls to use
> [gcc_]qsort_r and not provide qsort and poison it.  I'm leaning
> towards this "solution".

All ~150 of them?

> On targets with register passing conventions we can also
> completely elide the cmp2to3 wrapper (ok, that's a hack).

A bad hack indeed.  Option 3 allows getting efficient code
in common cases without causing undefined behavior.

Can you let me handle sort.cc changes once there's agreement
which way to go?

Alexander

Reply via email to