This is the mail archive of the mailing list for the GDB project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] Workaround gcc bug 49906

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

it has a regression
	gdb ./f2 -ex 'b f' -ex r
	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?


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]