Bug 55257 - [4.8 Regression]: g++.dg/debug/dwarf2/non-virtual-thunk.C scan-assembler thunk.C:30
Summary: [4.8 Regression]: g++.dg/debug/dwarf2/non-virtual-thunk.C scan-assembler thun...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 4.8.0
: P3 normal
Target Milestone: 4.8.0
Assignee: Hans-Peter Nilsson
URL:
Keywords: wrong-debug
Depends on:
Blocks:
 
Reported: 2012-11-10 01:51 UTC by Hans-Peter Nilsson
Modified: 2013-05-31 10:22 UTC (History)
2 users (show)

See Also:
Host: x86_64-unknown-linux-gnu
Target: cris-axis-elf
Build:
Known to work:
Known to fail:
Last reconfirmed: 2012-11-12 00:00:00


Attachments
non-virtual-thunk.s (3.88 KB, text/plain)
2012-11-10 01:51 UTC, Hans-Peter Nilsson
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Hans-Peter Nilsson 2012-11-10 01:51:55 UTC
Created attachment 28649 [details]
non-virtual-thunk.s

This test previously passed, now it fails.
A patch in the revision range (last_known_working:first_known_failing) 193333:193342 exposed or caused this regression.  Since then it fails as follows:

Running /tmp/hpautotest-gcc0/gcc/gcc/testsuite/g++.dg/debug/dwarf2/dwarf2.exp ...
FAIL: g++.dg/debug/dwarf2/non-virtual-thunk.C -std=gnu++98  scan-assembler thunk.C:30
FAIL: g++.dg/debug/dwarf2/non-virtual-thunk.C -std=gnu++11  scan-assembler thunk.C:30

No extra clue in g++.log.
Executing on host: /tmp/hpautotest-gcc0/cris-elf/gccobj/gcc/testsuite/g++/../../g++ -B/tmp/hpautotest-gcc0/cris-elf/gccobj/gcc/testsuite/g++/../../ /tmp/hpautotest-gcc0/gcc/gcc/testsuite/g++.dg/debug/dwarf2/non-virtual-thunk.C  -fno-diagnostics-show-caret  -nostdinc++ -I/tmp/hpautotest-gcc0/cris-elf/gccobj/cris-elf/libstdc++-v3/include/cris-elf -I/tmp/hpautotest-gcc0/cris-elf/gccobj/cris-elf/libstdc++-v3/include -I/tmp/hpautotest-gcc0/gcc/libstdc++-v3/libsupc++ -I/tmp/hpautotest-gcc0/gcc/libstdc++-v3/include/backward -I/tmp/hpautotest-gcc0/gcc/libstdc++-v3/testsuite/util -fmessage-length=0 -std=gnu++98 -g2 -dA -ffat-lto-objects  -S   -isystem /tmp/hpautotest-gcc0/cris-elf/gccobj/cris-elf/./newlib/targ-include -isystem /tmp/hpautotest-gcc0/gcc/newlib/libc/include  -o non-virtual-thunk.s    (timeout = 300)
PASS: g++.dg/debug/dwarf2/non-virtual-thunk.C -std=gnu++98 (test for excess errors)
FAIL: g++.dg/debug/dwarf2/non-virtual-thunk.C -std=gnu++98  scan-assembler thunk.C:30

(same for -std=gnu++11)

There's no "thunk.C:30" in the assembly file, just lots of:
"<TAB>;# /tmp/hpautotest-gcc0/gcc/gcc/testsuite/g++.dg/debug/dwarf2/non-virtual-thunk.C:33"

See the attached non-virtual-thunk.s.

Author of suspect patch in revision range CC:ed.
Comment 1 Jakub Jelinek 2012-11-12 07:51:26 UTC
If the target doesn't call final_start_function and final_end_function in output_mi_thunk targhook (or equivalent), it is a target bug.
Comment 2 Hans-Peter Nilsson 2012-11-12 17:08:12 UTC
(In reply to comment #1)
> If the target doesn't call final_start_function and final_end_function in
> output_mi_thunk targhook (or equivalent), it is a target bug.

I see.  I either missed this requirement when I implemented those bits for CRIS or it wasn't a requirement at the time.  BTW, I see several ports are missing those calls.  I guess in the general case it can't be left to middle-end to call those functions at the right time, so I'll just update the port and hopefully the documentation, but no promises.  Assigning the PR to myself while verifying that this is the cause.
Comment 3 Jakub Jelinek 2012-11-12 17:14:41 UTC
It is a requirement if you want proper debug info or unwind info for the thunk, without that (or without calling the corresponding functions yourself, which is harder to maintain) you don't get proper debug info.  It can't be called from the middle end, because some targets need to perform various things before final_start_function (or perhaps after final_end_function).
Comment 4 Hans-Peter Nilsson 2012-11-12 17:21:57 UTC
(In reply to comment #3)
> It can't be called from
> the middle end, because some targets need to perform various things before
> final_start_function (or perhaps after final_end_function).

Yes, that's what I meant, so let's just document the requirement.
Comment 5 Hans-Peter Nilsson 2012-11-13 06:14:18 UTC
Patch verified, changing component to target prior to commit.
Comment 6 Hans-Peter Nilsson 2012-11-13 06:15:59 UTC
Author: hp
Date: Tue Nov 13 06:15:53 2012
New Revision: 193467

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=193467
Log:
	PR target/55257
	* config/cris/cris.c (cris_asm_output_mi_thunk): Call
	final_start_function and final_end_function.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/cris/cris.c
Comment 7 Hans-Peter Nilsson 2012-11-13 06:39:34 UTC
.