(In reply to Dr. Werner Fink from comment #12) > (In reply to Martin Li��ka from comment #10) > > (In reply to Dr. Werner Fink from comment #8) > > > Hmm ... the transformation might be correcti(?), but how should libsigsegv > > > catch the first segmentation fault (and only this), if the check is moved in > > > the resulting assembler instructions out of the way? Would the volatile > > > attribute for handler_called help here? > > > > I would recommend to use a memory barrier: > > asm volatile("" ::: "memory"); > > > > More informations: > > https://stackoverflow.com/questions/14950614/working-of-asm-volatile-memory > > > > > > > > Btw: IMHO we need an HOWTO for debugging link time optimized programs within > > > gdb. This because with LTO the core dumps from users/customers become rather > > > useless (IMHO). > > Ouch .. this is somehow a d��j�� vu for me as I had in past (15 years back) > used memory barriers very often but had been told that this not need anymore > with the modern gcc. > > IMHO it is a bug of the compiler if code is moved in such a way that the > logic becomes broken. So that I created a GCC issue and let's be given a clarification: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90245