ulong_extras namespace collisions

12 views
Skip to first unread message

Fredrik Johansson

unread,
Oct 9, 2012, 2:29:02 AM10/9/12
to flint...@googlegroups.com, mpir-...@googlegroups.com
Hello,

I've just found out that there are namespace collisions between
FLINT's ulong_extras module and some internal MPIR functions with an
"n_" prefix defined in likely_prime_p.c. This wouldn't cause too much
problem if the functions were equivalent, but unfortunately, the MPIR
functions don't seem to handle all input correctly, and this causes
mysterious errors for some FLINT users (e.g. me) when FLINT ends up
calling the wrong functions.

In particular, the MPIR n_sqrt returns 9223372036854775808 when given
0 as input on (at least some) 64-bit systems.

I found that I could get the right versions by compiling code with
-lflint -lmpir and not the other way around, but I'm not sure if this
is reliable.

It seems that the easiest way to fix this problem would be to make the
MPIR functions static.

Fredrik

Fredrik Johansson

unread,
Oct 9, 2012, 4:24:55 AM10/9/12
to flint...@googlegroups.com, mpir-...@googlegroups.com
On Tue, Oct 9, 2012 at 10:02 AM, Jean-Pierre Flori <jpf...@gmail.com> wrote:
>
>
> On Tuesday, October 9, 2012 8:29:03 AM UTC+2, Fredrik Johansson wrote:
>>
>>
>> I found that I could get the right versions by compiling code with
>> -lflint -lmpir and not the other way around, but I'm not sure if this
>> is reliable.
>
> Just a remark.
> As far as I understand, this is the correct order because FLINT depends on
> MPIR.
> On systems such as Cygwin ld will miserably fail if you do not feed it with
> libs in the correct ordrer, because it does not perform multiple passes to
> resolve all symbols.
>
> So at least your solution is not too hackish :) (just kidding)

Thanks for the info. I think I've had the order correct in all my code
except this one build script. Anyway, failing miserably certainly
would have been more helpful!

Fredrik

Jean-Pierre Flori

unread,
Oct 9, 2012, 4:02:56 AM10/9/12
to flint...@googlegroups.com, mpir-...@googlegroups.com


On Tuesday, October 9, 2012 8:29:03 AM UTC+2, Fredrik Johansson wrote:

I found that I could get the right versions by compiling code with
-lflint -lmpir and not the other way around, but I'm not sure if this
is reliable.

Bill Hart

unread,
Oct 11, 2012, 10:49:42 AM10/11/12
to mpir-...@googlegroups.com, flint...@googlegroups.com
I plan to change the internal names in MPIR to avoid this. It won't
cause any issues for MPIR users as the names are only used internally.

Bill.
> --
> You received this message because you are subscribed to the Google Groups "mpir-devel" group.
> To post to this group, send email to mpir-...@googlegroups.com.
> To unsubscribe from this group, send email to mpir-devel+...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/mpir-devel?hl=en.
>
Reply all
Reply to author
Forward
0 new messages