Skip to content

Commit

Permalink
sagemathgh-37951: declare the last arg to GAP_CallFunc3Args volatile
Browse files Browse the repository at this point in the history
    
This appears to fix sagemath#37026 (segfaults in src/sage/libs/gap/element.pyx
with Python 3.12 and gcc 13.2.1)

See also
sagemath#36407 (comment)

The corresponding gcc 13.2.1's bug (or feature) is being dealt with
here: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114872
### 📝 Checklist

<!-- Put an `x` in all the boxes that apply. -->

- [x] The title is concise and informative.
- [x] The description explains in detail what this PR is about.
- [x] I have linked a relevant issue or discussion.
- [ ] I have created tests covering the changes.
- [ ] I have updated the documentation and checked the documentation
preview.

### ⌛ Dependencies

<!-- List all open PRs that this PR logically depends on. For example,
-->
<!-- - sagemath#12345: short description why this is a dependency -->
<!-- - sagemath#34567: ... -->
    
URL: sagemath#37951
Reported by: Dima Pasechnik
Reviewer(s): Dima Pasechnik, Gonzalo Tornaría
  • Loading branch information
Release Manager committed May 17, 2024
2 parents 9ef8c4d + 72e6b66 commit cffe979
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/sage/libs/gap/element.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -2504,6 +2504,7 @@ cdef class GapElement_Function(GapElement):
cdef Obj result = NULL
cdef Obj arg_list
cdef int n = len(args)
cdef volatile Obj v2

if n > 0 and n <= 3:
libgap = self.parent()
Expand All @@ -2522,10 +2523,11 @@ cdef class GapElement_Function(GapElement):
(<GapElement>a[0]).value,
(<GapElement>a[1]).value)
elif n == 3:
v2 = (<GapElement>a[2]).value
result = GAP_CallFunc3Args(self.value,
(<GapElement>a[0]).value,
(<GapElement>a[1]).value,
(<GapElement>a[2]).value)
v2)
else:
arg_list = make_gap_list(args)
result = GAP_CallFuncList(self.value, arg_list)
Expand Down

0 comments on commit cffe979

Please sign in to comment.