strange assertion failure; but works fine under gdb if set breakpoint on it

mw mingwu at gmail.com
Mon Nov 2 02:57:35 UTC 2020


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.


More information about the Digitalmars-d mailing list