Opened 9 years ago
Closed 9 years ago
#15446 closed defect (fixed)
GP interface confused by stack overflow when enlarging results vector
Reported by: | pbruin | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | sage-6.2 |
Component: | interfaces | Keywords: | gp stack overflow |
Cc: | Merged in: | ||
Authors: | Peter Bruin | Reviewers: | Alejandro Argaez |
Report Upstream: | N/A | Work issues: | |
Branch: | ab293b2 (Commits, GitHub, GitLab) | Commit: | ab293b23647b01c03eae0e5c0a9f189ebcc2cc3c |
Dependencies: | Stopgaps: |
Description
From Georgi Guninski on sage-support (https://groups.google.com/forum/#!topic/sage-support/A_GilhiUAwM):
sage: gp("{T(n)=n+1}") sage: for n in [ 1 .. 2**20]: a=gp.T(n) print n #wait some time.. ... 65535 65536 --------------------------------------------------------------------------- TypeError TypeError: Error executing code in GP: CODE: sage[131074]=65537; PARI/GP ERROR: *** at top-level: sage[131074]=65537 *** ^-------------- *** array index (131074) out of allowed range [1-131073].
after this trying:
sage: gp.T(1)
again raises exception.
After the above computation, the log file .sage/gp-expect.log
ends with
? sage[131070]=65535; sage[131070]=65535; ? sage[131071]=T(sage[131070]); sage[131071]=T(sage[131070]); ? sage=concat(sage, vector(131072,k,0)); sage=concat(sage, vector(131072,k,0)); *** at top-level: sage=concat(sage,vec *** ^-------------------- *** the PARI stack overflows ! current stack size: 10000000 (9.537 Mbytes) [hint] you can increase GP stack with allocatemem() ? allocatemem() allocatemem() *** Warning: new stack size = 20000000 (19.073 Mbytes). ? sage=concat(sage, vector(131072,k,0)); sage=concat(sage, vector(131072,k,0)); ? sage[131072]=65536; sage[131072]=65536; ? sage[131073]=T(sage[131072]); sage[131073]=T(sage[131072]); ? sage[131074]=65537; sage[131074]=65537; *** at top-level: sage[131074]=65537 *** ^-------------- *** array index (131074) out of allowed range [1-131073]. ?
It appears that the vector sage
wasn't doubled correctly; probably it got messed up by the failed concat()
.
Change History (9)
comment:1 Changed 9 years ago by
Milestone: | sage-6.1 → sage-6.2 |
---|
comment:2 Changed 9 years ago by
Authors: | → Peter Bruin |
---|---|
Branch: | → u/pbruin/15446-gp_results_vector |
Commit: | → ab293b23647b01c03eae0e5c0a9f189ebcc2cc3c |
Status: | new → needs_review |
comment:3 Changed 9 years ago by
Commit: | ab293b23647b01c03eae0e5c0a9f189ebcc2cc3c → 229fd4c77e034dff5250277d4f9ecc030effe7c7 |
---|
Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:
229fd4c | use separate variables instead of a vector for GP results
|
comment:4 Changed 9 years ago by
Never mind the commit in comment:3, this breaks when there are more than 65535 variables.
comment:5 Changed 9 years ago by
Commit: | 229fd4c77e034dff5250277d4f9ecc030effe7c7 → ab293b23647b01c03eae0e5c0a9f189ebcc2cc3c |
---|
Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:
ab293b2 | fix resizing of GP results vector when stack overflow occurs
|
comment:6 follow-up: 7 Changed 9 years ago by
Status: | needs_review → positive_review |
---|
comment:7 Changed 9 years ago by
Alejandro, could you fill in your name (more precisely your real name, not Trac username) in the "Reviewer" field?
comment:8 Changed 9 years ago by
Reviewers: | → Alejandro Argaez |
---|
comment:9 Changed 9 years ago by
Branch: | u/pbruin/15446-gp_results_vector → ab293b23647b01c03eae0e5c0a9f189ebcc2cc3c |
---|---|
Resolution: | → fixed |
Status: | positive_review → closed |
The problem appears to be fixed by introducing a temporary variable to hold the result of
concat()
instead of directly assigning it tosage
.