www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - strange assertion failure; but works fine under gdb if set breakpoint

Hi,

I have a strange run-time error, for a linked list, I have this 
assertion:

line 10:  assert(prev_item.next is curr_item);

it used to work fine for a long time, but this assertion starts 
to fail after I made some recent changes. I try to debug it. The 
strange thing is: if I do not set any break point, and just run 
it under gdb, the assertion also fails; but if I set a bp, e.g.

(gdb) b foo.d:10 if prev_item.next != curr_item

the program runs fine, and that bp was never hit.

How come setting a (conditional) break point can change the 
program behavior?

Has anyone seen this kind of error before? any hint, where I 
should check my program?

Thanks.


BTW, I'm using LDC 1.24.0 on 64 Linux.
Nov 01 2020