This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] gdb: Ensure compiler doesn't optimise variable out in test
- From: Tom Tromey <tom at tromey dot com>
- To: Palmer Dabbelt <palmer at sifive dot com>
- Cc: andrew dot burgess at embecosm dot com, gdb-patches at sourceware dot org
- Date: Wed, 29 Aug 2018 20:30:47 -0600
- Subject: Re: [PATCH] gdb: Ensure compiler doesn't optimise variable out in test
- References: <20180829180259.2718-1-andrew.burgess@embecosm.com> <mhng-c147d665-ff40-415d-98a2-1eea608c9e54@palmer-si-x1c4>
>>>>> "Palmer" == Palmer Dabbelt <palmer@sifive.com> writes:
Palmer> Isn't the compiler still free to kill "a" here because it can see into
Palmer> use_a() and therefor inline it? I'd expected it to choose to inline
Palmer> use_a(), as doing nothing is always cheaper than calling a function.
It is but in practice gdb compiles without optimization in most cases
and compilers generally don't bother in that situation. Though if
there's a readily available, more principled fix, that would be fine
too.
Tom