This is the mail archive of the
mailing list for the GCC project.
How to avoid code elimination
- From: phi gcc <phi dot gcc at gmail dot com>
- To: "gcc-help at gcc dot gnu dot org" <gcc-help at gcc dot gnu dot org>
- Date: Sun, 26 Nov 2017 12:08:36 +0100
- Subject: How to avoid code elimination
- Authentication-results: sourceware.org; auth=none
I am new to gcc (used other C compilers before).
I have construct of the like in my C code
The reasoning here is that I need to stuff a GDB break point on e=e;
cond goes from false to true after some long to wait condition occurs.
Basically my debug session goes like this
set a temp break in this function reach it, then stick a BP on e=e,
then run and wait the BP.
The e=e; comes form the idea that I reuse here whatever int scalar is
in the vincinity.
I tried to compile with -O0 but to no joy gcc always remove my 'NOP'
intruction knowing better than me what I could do with it.
Is there any other idioms I should use, may be an asm("nop") or the
like I guess ?
Thanx in advance