Bug 3259

Summary: TestStackBacktrace gives incorrect result for innermost frame
Product: frysk Reporter: Mike Cvet <mcvet>
Component: generalAssignee: Unassigned <frysk-bugzilla>
Status: ASSIGNED ---    
Severity: normal CC: cagney, qiyaoltc, rmoseley, woodzltc, zhengyo
Priority: P2    
Version: unspecified   
Target Milestone: ---   
Host: Target:
Build: Last reconfirmed:
Bug Depends on:    
Bug Blocks: 1633, 2935, 2936, 3076, 3346    
Attachments: Patch that works around the bug in GCC

Description Mike Cvet 2006-09-25 20:04:48 UTC
On FC5 gcc (GCC) 4.1.1 20060525:
 testBacktrace(frysk.rt.tests.TestStackBacktrace)junit.framework.AssertionFailedError:
 expected:<62> but was:<61>
    at frysk.rt.tests.TestStackBacktrace.testBacktrace(TestRunner)
    at frysk.junit.Runner.<init>(TestRunner)
    at TestRunner.main(TestRunner)

This should not happen since the fix for the innermost frame is already in.
Comment 1 Alexandre Oliva 2006-10-06 07:02:05 UTC
Created attachment 1352 [details]
Patch that works around the bug in GCC

GCC over-optimizes the empty loop, such that it ends up without line number
notes, which is why debug info only mentions the previous line.  Adding
something that GCC does not understand (an empty asm) will still generate the
same code, but the debug info won't be optimized away.

I'll look into improving GCC so as to not over-optimize debug info in this
case, but it looks hard and it's sort-of pointless.
Comment 2 Alexandre Oliva 2006-10-11 07:51:23 UTC
Discussion about the GCC problem started at
http://gcc.gnu.org/ml/gcc/2006-10/msg00199.html
Comment 3 Tim Moore 2006-10-31 21:28:34 UTC
The bug appears also in the frysk test program funit-rt-threader.c. The while
loop at line 71 is sometimes reported as being at line 71 or at line 72.
Comment 4 Mike Cvet 2006-12-27 18:21:11 UTC
*** Bug 3814 has been marked as a duplicate of this bug. ***
Comment 5 Mike Cvet 2006-12-27 18:21:47 UTC
ping?
Comment 6 Mark Wielaard 2007-10-10 11:49:44 UTC
Confirmed still a problem with: gcc (GCC) 4.1.2 20070925 (Red Hat 4.1.2-31)

$ frysk-core/frysk/pkglibdir/funit-rt-looper 0 0 &
$ frysk-core/frysk/bindir/fstack -a $!

Task #28422
#0 0x0804864e in baz()
/home/mark/src/frysk-obj/frysk-core/../../frysk/frysk-core/frysk/pkglibdir/funit-rt-looper.c#61
[...] # Line number should be 62, not 61.