* [Bug debug/54793] the location of a formal_parameter is not started from a function entry with -mfentry
2012-10-03 13:10 [Bug debug/54793] New: the location of a formal_parameter is not started from a function entry with -mfentry masami.hiramatsu.pt at hitachi dot com
@ 2012-10-03 13:49 ` jakub at gcc dot gnu.org
2012-10-03 14:12 ` jakub at gcc dot gnu.org
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-10-03 13:49 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54793
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |WAITING
Last reconfirmed| |2012-10-03
CC| |jakub at gcc dot gnu.org
Ever Confirmed|0 |1
--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-10-03 13:48:58 UTC ---
Please provide preprocessed testcase and gcc options used to compile it.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug debug/54793] the location of a formal_parameter is not started from a function entry with -mfentry
2012-10-03 13:10 [Bug debug/54793] New: the location of a formal_parameter is not started from a function entry with -mfentry masami.hiramatsu.pt at hitachi dot com
2012-10-03 13:49 ` [Bug debug/54793] " jakub at gcc dot gnu.org
@ 2012-10-03 14:12 ` jakub at gcc dot gnu.org
2013-01-18 16:02 ` fche at redhat dot com
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-10-03 14:12 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54793
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|WAITING |NEW
CC| |aoliva at gcc dot gnu.org,
| |jason at gcc dot gnu.org,
| |rth at gcc dot gnu.org
--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-10-03 14:12:20 UTC ---
That said, it can be reproduced even on:
int
foo (int a, int b)
{
asm volatile ("nop");
a = 1;
return a + b;
}
with -g -O2 -mfentry -p -dA. The issue is that FUNCTION_PROFILER before
epilogue is emitted really very early, before processing any
NOTE_INSN_VAR_LOCATION that are before the first real insn.
If the targetm.asm_out.function_prologue hook is the default, outputting
nothing, perhaps we could consider as ugly hack to process the
NOTE_INSN_VAR_LOCATION notes before any non-note insn before calling the
FUNCTION_PROFILER, or, just forcefully use the function start label in
dwarf2out_var_location for notes that are before first real insn, perhaps limit
that to #ifdef HAVE_prologue if (HAVE_prologue) #endif to avoid damaging debug
info for !HAVE_prologue targets (if there are still any).
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug debug/54793] the location of a formal_parameter is not started from a function entry with -mfentry
2012-10-03 13:10 [Bug debug/54793] New: the location of a formal_parameter is not started from a function entry with -mfentry masami.hiramatsu.pt at hitachi dot com
2012-10-03 13:49 ` [Bug debug/54793] " jakub at gcc dot gnu.org
2012-10-03 14:12 ` jakub at gcc dot gnu.org
@ 2013-01-18 16:02 ` fche at redhat dot com
2013-01-24 19:12 ` aoliva at gcc dot gnu.org
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: fche at redhat dot com @ 2013-01-18 16:02 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54793
Frank Ch. Eigler <fche at redhat dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |tromey at redhat dot com
Severity|normal |major
--- Comment #3 from Frank Ch. Eigler <fche at redhat dot com> 2013-01-18 16:01:24 UTC ---
A little longer test case (which requires a location_list rather than location
for all the parameters) shows that gdb is adversely affected by this bug too;
its prologue-finding is no help:
% cat foo2.c
int foo (int a, int b) __attribute__((noinline));
int bar (int c, int d) __attribute__((noinline));
int bar (int c, int d)
{
while (c-- > d++) ;
}
int foo (int a, int b)
{
asm volatile ("nop");
return bar (a, b);
}
int main () {
return foo (7, 4);
}
% gcc -g -O2 -mfentry foo2.c -p
% gdb a.out
(gdb) break foo
Breakpoint 1 at 0x400660: file foo2.c, line 11.
(gdb) run
Starting program: /tmp/a.out
Breakpoint 1, foo (a=<optimized out>, b=<optimized out>) at foo2.c:11
11 {
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug debug/54793] the location of a formal_parameter is not started from a function entry with -mfentry
2012-10-03 13:10 [Bug debug/54793] New: the location of a formal_parameter is not started from a function entry with -mfentry masami.hiramatsu.pt at hitachi dot com
` (2 preceding siblings ...)
2013-01-18 16:02 ` fche at redhat dot com
@ 2013-01-24 19:12 ` aoliva at gcc dot gnu.org
2013-01-25 9:08 ` jakub at gcc dot gnu.org
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: aoliva at gcc dot gnu.org @ 2013-01-24 19:12 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54793
Alexandre Oliva <aoliva at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Severity|major |normal
--- Comment #4 from Alexandre Oliva <aoliva at gcc dot gnu.org> 2013-01-24 19:11:20 UTC ---
I guess the most elegant solution is to have the RTL prologue start with a
NOTE_INSN_PROLOGUE_START, and output the before-prologue profiler-call during
the final scan of that note, just like we output the after-prologue profiler
call at the final scan of NOTE_INSN_PROLOGUE_END.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug debug/54793] the location of a formal_parameter is not started from a function entry with -mfentry
2012-10-03 13:10 [Bug debug/54793] New: the location of a formal_parameter is not started from a function entry with -mfentry masami.hiramatsu.pt at hitachi dot com
` (3 preceding siblings ...)
2013-01-24 19:12 ` aoliva at gcc dot gnu.org
@ 2013-01-25 9:08 ` jakub at gcc dot gnu.org
2013-01-25 9:35 ` jakub at gcc dot gnu.org
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2013-01-25 9:08 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54793
--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> 2013-01-25 09:08:14 UTC ---
Well, we can also just use the first NOTE_INSN_BASIC_BLOCK resp.
NOTE_INSN_FUNCTION_BEG, whichever comes first.
The bigger problem with that ia64, pa and a few other targets use both
PROLOGUE_BEFORE_EPILOGUE and non-default function_prologue hook, which emits
some assembly stuff (even when they HAVE_prologue). Perhaps for those targets
we'd need to emit the profiler code right away, and only postpone it until the
first NOTE_INSN_BASIC_BLOCK/NOTE_INSN_FUNCTION_BEG if function_prologue hook is
the default.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug debug/54793] the location of a formal_parameter is not started from a function entry with -mfentry
2012-10-03 13:10 [Bug debug/54793] New: the location of a formal_parameter is not started from a function entry with -mfentry masami.hiramatsu.pt at hitachi dot com
` (4 preceding siblings ...)
2013-01-25 9:08 ` jakub at gcc dot gnu.org
@ 2013-01-25 9:35 ` jakub at gcc dot gnu.org
2013-02-01 16:55 ` jakub at gcc dot gnu.org
2013-12-21 17:06 ` jakub at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2013-01-25 9:35 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54793
--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> 2013-01-25 09:35:17 UTC ---
Created attachment 29271
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29271
gcc48-pr54793.patch
So, e.g. this seems to work for me from quick testing. The insn chain scanning
is there e.g. to emit the profiler stuff right away when final_start_function
is called from output_mi_thunk on various targets.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug debug/54793] the location of a formal_parameter is not started from a function entry with -mfentry
2012-10-03 13:10 [Bug debug/54793] New: the location of a formal_parameter is not started from a function entry with -mfentry masami.hiramatsu.pt at hitachi dot com
` (5 preceding siblings ...)
2013-01-25 9:35 ` jakub at gcc dot gnu.org
@ 2013-02-01 16:55 ` jakub at gcc dot gnu.org
2013-12-21 17:06 ` jakub at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2013-02-01 16:55 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54793
--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> 2013-02-01 16:54:23 UTC ---
Author: jakub
Date: Fri Feb 1 16:54:14 2013
New Revision: 195669
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=195669
Log:
PR debug/54793
* final.c (need_profile_function): New variable.
(final_start_function): Drop ATTRIBUTE_UNUSED from first argument.
If first of NOTE_INSN_BASIC_BLOCK or NOTE_INSN_FUNCTION_BEG
is only preceeded by NOTE_INSN_VAR_LOCATION or NOTE_INSN_DELETED
notes, targetm.asm_out.function_prologue doesn't emit anything,
HAVE_prologue and profiler should be emitted before prologue,
set need_profile_function instead of emitting it.
(final_scan_insn): If need_profile_function, emit
profile_function on the first NOTE_INSN_BASIC_BLOCK or
NOTE_INSN_FUNCTION_BEG note.
Modified:
trunk/gcc/ChangeLog
trunk/gcc/final.c
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug debug/54793] the location of a formal_parameter is not started from a function entry with -mfentry
2012-10-03 13:10 [Bug debug/54793] New: the location of a formal_parameter is not started from a function entry with -mfentry masami.hiramatsu.pt at hitachi dot com
` (6 preceding siblings ...)
2013-02-01 16:55 ` jakub at gcc dot gnu.org
@ 2013-12-21 17:06 ` jakub at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2013-12-21 17:06 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54793
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |FIXED
--- Comment #8 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Fixed for 4.8+.
^ permalink raw reply [flat|nested] 9+ messages in thread