1. Why am I getting segmentation fault on this code

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?

new topic     » topic index » view message » categorize

2. Re: Why am I getting segmentation fault on this code

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

new topic     » goto parent     » topic index » view message » categorize

3. Re: Why am I getting segmentation fault on this code

rneu said...

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, $] 
new topic     » goto parent     » topic index » view message » categorize

4. Re: Why am I getting segmentation fault on this code

Surprisingly, I am getting following error with aseq[3, $] :

<0132>:: Syntax error - expected to see possibly ']', not ',' 
aseq = aseq[3, $] 

aseq[3..$] works.

new topic     » goto parent     » topic index » view message » categorize

5. Re: Why am I getting segmentation fault on this code

rneu said...

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

new topic     » goto parent     » topic index » view message » categorize

6. Re: Why am I getting segmentation fault on this code

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.

new topic     » goto parent     » topic index » view message » categorize

7. Re: Why am I getting segmentation fault on this code

_tom said...

that was a typo:

The old cut-and-paste tick. Sorry about that, chief.

new topic     » goto parent     » topic index » view message » categorize

8. Re: Why am I getting segmentation fault on this code

DerekParnell said...
_tom said...

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". smile

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu