1. Why am I getting segmentation fault on this code
- Posted by rneu Jul 14, 2017
- 1502 views
In a program I find that following code produces segmentation fault on compiling, even though it works well on interpreter:
aseq = tail(tail(aseq))
I am using above code to remove first 2 items of a sequence.
Why does this code produces segmentation fault after compiling?
2. Re: Why am I getting segmentation fault on this code
- Posted by _tom (admin) Jul 14, 2017
- 1497 views
I can confirm:
sequence s = {1,2,3,4,5} ? tail( tail(s) )
- Interpreter: ok
- Compiled: segmentation fault
I have added this as a bug to "tickets."
_tom
3. Re: Why am I getting segmentation fault on this code
- Posted by DerekParnell (admin) Jul 14, 2017
- 1432 views
In a program I find that following code produces segmentation fault on compiling, even though it works well on interpreter:
aseq = tail(tail(aseq))
I am using above code to remove first 2 items of a sequence.
Why does this code produces segmentation fault after compiling?
Thanks for reporting a new bug. Every little bit helps.
Also, a faster way of removing the first 'n' items from a list is ...
aseq = aseq[n+1, $]
so in your case you could write ...
aseq = aseq[3, $]
4. Re: Why am I getting segmentation fault on this code
- Posted by rneu Jul 14, 2017
- 1416 views
Surprisingly, I am getting following error with aseq[3, $] :
<0132>:: Syntax error - expected to see possibly ']', not ',' aseq = aseq[3, $]
aseq[3..$] works.
5. Re: Why am I getting segmentation fault on this code
- Posted by _tom (admin) Jul 14, 2017
- 1444 views
Surprisingly, I am getting following error with aseq[3, $] :
<0132>:: Syntax error - expected to see possibly ']', not ',' aseq = aseq[3, $]
aseq[3..$] works.
that was a typo:
sequence s = { 1, 2, 3, 4, 5 } ? s[3..$] --> {3,4,5}
_tom
6. Re: Why am I getting segmentation fault on this code
- Posted by Lnettnay Jul 15, 2017
- 1430 views
On Windows 8.1 compiled the statement doesn't cause a segfault but the program just dies. The debug print statement after it is not executed.
Lonny
PS: After I compiled it again with -debug turned on and then ran it with gdb it did show a segfault.
I'll try to look at some more this afternoon. Need to get some sleep so I can go to work.
7. Re: Why am I getting segmentation fault on this code
- Posted by DerekParnell (admin) Jul 15, 2017
- 1386 views
that was a typo:
The old cut-and-paste tick. Sorry about that, chief.
8. Re: Why am I getting segmentation fault on this code
- Posted by petelomax Jul 15, 2017
- 1403 views
that was a typo:
The old cut-and-paste tick. Sorry about that, chief.
I think that should have been "The old cut-and-paste trick".