New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pari fails to catch error (32-bit gcc 4.8.1) #14873
Comments
comment:2
For the record, this is Fedora 19 and
|
comment:4
Meant to cc the other Bruin, maybe at least one of you cares about Pari ;-) |
comment:5
The bug does not occur on Gentoo x86_64 with GCC 4.4.5. Unfortunately, I don't have a 32-bit system to test the patch, and I don't understand the subtleties of |
comment:6
In fact, that is one of the classic cases where you must declare the variable If it doesn't occur on your system then that is just because your optimizer is not smart enough. There isn't anything special about 32 vs 64 bit here, it just happened to be triggered in 32 bit only. |
comment:7
Replying to @vbraun:
So far I understand the use of I am also wondering why |
comment:8
I haven't really looked at what The fact that we pass a pointer to the jump buffer down to err_catch just before leaving its scope
is very worrying. And by that, I mean: does not work as intended in my 32-bit VM. Pari I agree that This bug is also in the pari version we are shipping (in Updated patch fixes all that is wrong in |
Updated patch |
comment:9
Attachment: trac_14873_pari_volatile.patch.gz There are a few more points that I am worried about, which are not strictly about this patch but about PARI error handling in general:
In the PARI version that Sage currently uses, similar macros exists without the prefix I made a patch that, as an alternative to
Within such a block, one can put things like
Note that I have not yet tried to change the hundreds of instances of Perhaps we could first apply Volker Braun's patch to fix the doctest problem, and later do something along the lines of my patch? |
Attachment: trac_14873_pari_catch.patch.gz alternative macros for PARI error catching |
This comment has been minimized.
This comment has been minimized.
comment:11
PS: the new macros in the patch I just uploaded do not use any global variables and can presumably be nested, unlike the existing ones (I have not tested this yet). |
comment:12
Since the error handling significantly changed with the new Pari version I would be in favor of doing both the update and necessary changes of our code on a future ticket. I agree that there are no checks on whether |
Reviewer: Peter Bruin |
comment:13
OK, I think the sensible thing to do is to give a positive review and postpone any further improvements in the error handling code to another ticket. |
comment:14
I've made #14894 to track further improvements. |
Merged: sage-5.12.beta0 |
On Fedora 19 32-bit I get the following doctest failure:
This doctests checks that Pari errors are caught since the result doesn't fit into the default stack, so the pari stack needs to be enlarged during the computation.
Curiously, this works correctly on Fedora 19 x86_64. I haven't completely thought through if its an error in our code, but marking the variables used in the setjmp branch volatile fixes it. I am tempted to say that treating pari_errno as constant and optmizing it out / putting it in a register is legal if its not declared volatile.
Apply: attachment: trac_14873_pari_volatile.patch
CC: @nexttime @nbruin @pjbruin @tornaria @jdemeyer
Component: packages: standard
Author: Volker Braun
Reviewer: Peter Bruin
Merged: sage-5.12.beta0
Issue created by migration from https://trac.sagemath.org/ticket/14873
The text was updated successfully, but these errors were encountered: