Threaded Build flag + LinkedList causes Segfault

Archives Forums/BlitzMax Bug Reports/Threaded Build flag + LinkedList causes Segfault

naibaf7(Posted 2012) [#1]
This code is used to represent the problem:

Framework BRL.StandardIO
Import BRL.LinkedList
SuperStrict

Local list:TList = New TList
Local i:Int

For i = 0 To 20000000-1
	ListAddLast(list, String(i))
	If(i Mod 10000=0)
		Print i
	EndIf
Next


Result without Threaded flag: will run through until 20M are reached and program terminates as expected.

Result with Threaded flag on Linux (Threaded):
...
310000
320000
330000
340000
350000
360000
Segmentation fault

Process complete


Result with Threaded flag on Linux (Threaded + Debug):
...
130000
140000
150000
160000
170000
180000
Segmentation fault

Process complete


Result with Threaded flag on Windows are the same, except that on windows there is no error/segfault mentioned and the program just completes as if it would be okay:
220000
230000
240000
250000
260000
270000
280000

Process complete


Debugged with gdb:
[New Thread 5820.0x1c54]

Program received signal SIGSEGV, Segmentation fault.
0x00406c3b in ?? ()
(gdb)

I think this is a major multitask/threading bug. Tested on Blitzmax 1.45 and 1.44.

Last edited 2012