[patch] Workaround gcc bug 49906
Aleksandar Ristovski
aristovski@qnx.com
Fri Oct 28 21:23:00 GMT 2011
On 11-10-28 04:51 PM, Jan Kratochvil wrote:
> Hello Aleksandar,
>
> the problem is that for this testcase:
> /*1*/ static int i;
> /*2*/ static void
> /*3*/ f (int q)
> /*4*/ {
> /*5*/ for (;; i--)
> /*6*/ if (i++)
> /*7*/ break;
> /*8*/ }
> /*9*/ int main (void) { f (5); return 0; }
>
> Built with:
> gcc -o f2 f2.c -Wall -g -Werror
> gcc (GCC) 4.6.3 20111028 (prerelease) -- the version should not matter
> x86_64
>
> it has a regression
> gdb ./f2 -ex 'b f' -ex r
> FSF GDB HEAD:
> Breakpoint 1, f (q=5) at f2.c:6
> ^
> 6 if (i++)
> with your patch:
> Breakpoint 1, f (q=0) at f2.c:4
> ^
> 4 {
>
I think that if you dump line info for your test you will find that line
info is broken as well. Correct line info would yield answer "line 5"
after skipping prologue.
Your result looks slightly better because you did not put {..} for the
'for' block, but it is not correct.
IMO, with the fix, the result is better (beginning of the function block
is better IMO than first statement inside 'for' block).
> For reader's convenience attaching objdump at the bottom of this mail.
Could you do
objdump -W
and post the output?
---
Aleksandar
More information about the Gdb-patches
mailing list