* [Bug c/42240] wrong Epilog on nacked function
2009-12-01 16:18 [Bug c/42240] New: wrong Epilog on nacked function stefan dot dreyer at yahoo dot de
@ 2009-12-01 16:19 ` stefan dot dreyer at yahoo dot de
2009-12-01 16:44 ` stefan dot dreyer at yahoo dot de
` (12 subsequent siblings)
13 siblings, 0 replies; 26+ messages in thread
From: stefan dot dreyer at yahoo dot de @ 2009-12-01 16:19 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from stefan dot dreyer at yahoo dot de 2009-12-01 16:19 -------
Created an attachment (id=19199)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=19199&action=view)
Compileable testfile
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42240
^ permalink raw reply [flat|nested] 26+ messages in thread
* [Bug c/42240] wrong Epilog on nacked function
2009-12-01 16:18 [Bug c/42240] New: wrong Epilog on nacked function stefan dot dreyer at yahoo dot de
2009-12-01 16:19 ` [Bug c/42240] " stefan dot dreyer at yahoo dot de
@ 2009-12-01 16:44 ` stefan dot dreyer at yahoo dot de
2009-12-01 16:45 ` stefan dot dreyer at yahoo dot de
` (11 subsequent siblings)
13 siblings, 0 replies; 26+ messages in thread
From: stefan dot dreyer at yahoo dot de @ 2009-12-01 16:44 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from stefan dot dreyer at yahoo dot de 2009-12-01 16:44 -------
Created an attachment (id=19200)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=19200&action=view)
Compileable testfile
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42240
^ permalink raw reply [flat|nested] 26+ messages in thread
* [Bug c/42240] wrong Epilog on nacked function
2009-12-01 16:18 [Bug c/42240] New: wrong Epilog on nacked function stefan dot dreyer at yahoo dot de
2009-12-01 16:19 ` [Bug c/42240] " stefan dot dreyer at yahoo dot de
2009-12-01 16:44 ` stefan dot dreyer at yahoo dot de
@ 2009-12-01 16:45 ` stefan dot dreyer at yahoo dot de
2009-12-01 16:46 ` stefan dot dreyer at yahoo dot de
` (10 subsequent siblings)
13 siblings, 0 replies; 26+ messages in thread
From: stefan dot dreyer at yahoo dot de @ 2009-12-01 16:45 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from stefan dot dreyer at yahoo dot de 2009-12-01 16:44 -------
Created an attachment (id=19201)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=19201&action=view)
generatet assambly file
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42240
^ permalink raw reply [flat|nested] 26+ messages in thread
* [Bug c/42240] wrong Epilog on nacked function
2009-12-01 16:18 [Bug c/42240] New: wrong Epilog on nacked function stefan dot dreyer at yahoo dot de
` (2 preceding siblings ...)
2009-12-01 16:45 ` stefan dot dreyer at yahoo dot de
@ 2009-12-01 16:46 ` stefan dot dreyer at yahoo dot de
2009-12-01 16:58 ` [Bug target/42240] " j at uriah dot heep dot sax dot de
` (9 subsequent siblings)
13 siblings, 0 replies; 26+ messages in thread
From: stefan dot dreyer at yahoo dot de @ 2009-12-01 16:46 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from stefan dot dreyer at yahoo dot de 2009-12-01 16:46 -------
(From update of attachment 19201)
in
/* epilogue start */
rjmp .L6
infinite, never leaves function
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42240
^ permalink raw reply [flat|nested] 26+ messages in thread
* [Bug target/42240] wrong Epilog on nacked function
2009-12-01 16:18 [Bug c/42240] New: wrong Epilog on nacked function stefan dot dreyer at yahoo dot de
` (3 preceding siblings ...)
2009-12-01 16:46 ` stefan dot dreyer at yahoo dot de
@ 2009-12-01 16:58 ` j at uriah dot heep dot sax dot de
2009-12-01 19:21 ` [Bug target/42240] wrong epilogue on naked function a dot kaiser at gmx dot net
` (8 subsequent siblings)
13 siblings, 0 replies; 26+ messages in thread
From: j at uriah dot heep dot sax dot de @ 2009-12-01 16:58 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from j at uriah dot heep dot sax dot de 2009-12-01 16:58 -------
My first analysis shows that this is likely to be related to the
introduction of RTL prologues/epilogues in GCC 4.3. GCC 4.2.2
has:
if (avr_naked_function_p (current_function_decl))
{
fputs ("/* epilogue: naked */\n", file);
goto out;
}
...
out:
fprintf (file, "/* epilogue end (size=%d) */\n", epilogue_size);
fprintf (file, "/* function %s size %d (%d) */\n", current_function_name (),
prologue_size + function_size + epilogue_size, function_size);
commands_in_file += prologue_size + function_size + epilogue_size;
commands_in_prologues += prologue_size;
commands_in_epilogues += epilogue_size;
}
GCC 4.3.4 has:
/* epilogue: naked */
if (cfun->machine->is_naked)
{
emit_jump_insn (gen_return ());
return;
}
So apparently, emit_jump_insn (gen_return ()); is responsible for creating
the infinite loop.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42240
^ permalink raw reply [flat|nested] 26+ messages in thread
* [Bug target/42240] wrong epilogue on naked function
2009-12-01 16:18 [Bug c/42240] New: wrong Epilog on nacked function stefan dot dreyer at yahoo dot de
` (4 preceding siblings ...)
2009-12-01 16:58 ` [Bug target/42240] " j at uriah dot heep dot sax dot de
@ 2009-12-01 19:21 ` a dot kaiser at gmx dot net
2009-12-01 19:38 ` a dot kaiser at gmx dot net
` (7 subsequent siblings)
13 siblings, 0 replies; 26+ messages in thread
From: a dot kaiser at gmx dot net @ 2009-12-01 19:21 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from a dot kaiser at gmx dot net 2009-12-01 19:21 -------
Same for ARM target, when compiled for Thumb instruction set (-fthumb).
--
a dot kaiser at gmx dot net changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |a dot kaiser at gmx dot net
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42240
^ permalink raw reply [flat|nested] 26+ messages in thread
* [Bug target/42240] wrong epilogue on naked function
2009-12-01 16:18 [Bug c/42240] New: wrong Epilog on nacked function stefan dot dreyer at yahoo dot de
` (5 preceding siblings ...)
2009-12-01 19:21 ` [Bug target/42240] wrong epilogue on naked function a dot kaiser at gmx dot net
@ 2009-12-01 19:38 ` a dot kaiser at gmx dot net
2009-12-01 22:50 ` a dot kaiser at gmx dot net
` (6 subsequent siblings)
13 siblings, 0 replies; 26+ messages in thread
From: a dot kaiser at gmx dot net @ 2009-12-01 19:38 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from a dot kaiser at gmx dot net 2009-12-01 19:37 -------
Confirmed for 4.4.2.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42240
^ permalink raw reply [flat|nested] 26+ messages in thread
* [Bug target/42240] wrong epilogue on naked function
2009-12-01 16:18 [Bug c/42240] New: wrong Epilog on nacked function stefan dot dreyer at yahoo dot de
` (6 preceding siblings ...)
2009-12-01 19:38 ` a dot kaiser at gmx dot net
@ 2009-12-01 22:50 ` a dot kaiser at gmx dot net
2010-07-22 11:26 ` anitha dot boyapati at atmel dot com
` (5 subsequent siblings)
13 siblings, 0 replies; 26+ messages in thread
From: a dot kaiser at gmx dot net @ 2009-12-01 22:50 UTC (permalink / raw)
To: gcc-bugs
------- Comment #8 from a dot kaiser at gmx dot net 2009-12-01 22:50 -------
For the ARM target, falling off the end of the function does not make sense
anyway, since the last byte usually is followed by the constant pool. So the
AVR target finally caught up with the ARM target and doesn't work that way
either.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42240
^ permalink raw reply [flat|nested] 26+ messages in thread
* [Bug target/42240] wrong epilogue on naked function
2009-12-01 16:18 [Bug c/42240] New: wrong Epilog on nacked function stefan dot dreyer at yahoo dot de
` (7 preceding siblings ...)
2009-12-01 22:50 ` a dot kaiser at gmx dot net
@ 2010-07-22 11:26 ` anitha dot boyapati at atmel dot com
2010-07-26 6:49 ` anitha dot boyapati at atmel dot com
` (4 subsequent siblings)
13 siblings, 0 replies; 26+ messages in thread
From: anitha dot boyapati at atmel dot com @ 2010-07-22 11:26 UTC (permalink / raw)
To: gcc-bugs
------- Comment #9 from anitha dot boyapati at atmel dot com 2010-07-22 11:26 -------
I think the bug is not due to 'naked' function. When the naked attribute is
removed for __init_seed(void), the following diff can be observed in the
assembly file.
====================================================
--- test_without_naked.s 2010-07-22 15:53:13.178956400 +0530
+++ test_with_naked.s 2010-07-22 15:52:52.474373900 +0530
@@ -14,10 +14,11 @@
.L2:
rjmp .L2
.size main, .-main
+ .section .init8,"ax",@progbits
.global __init_seed
.type __init_seed, @function
__init_seed:
-/* prologue: function */
+/* prologue: naked */
/* frame size = 0 */
ldi r24,lo8(__noinit_start+2)
ldi r25,hi8(__noinit_start+2)
@@ -41,7 +42,6 @@
sts (seedram)+1,r19
sts seedram,r18
/* epilogue start */
- ret
.L11:
ldi r18,lo8(0)
ldi r19,hi8(0)
=======================================================
It can be seen that in case of naked function, 'ret' is not generated. Hence
the execution goes into infinite loop. The code generated for epilogue is wrong
in few cases for either for naked/normal functions with -O2 enabled. However
incase of normal functions, execution is not affected as 'ret' is executed
before entering into block labelled .L11 (of main.s).
.L11:
ldi r18,lo8(0)
ldi r19,hi8(0)
rjmp .L6
--
anitha dot boyapati at atmel dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |anitha dot boyapati at atmel
| |dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42240
^ permalink raw reply [flat|nested] 26+ messages in thread
* [Bug target/42240] wrong epilogue on naked function
2009-12-01 16:18 [Bug c/42240] New: wrong Epilog on nacked function stefan dot dreyer at yahoo dot de
` (8 preceding siblings ...)
2010-07-22 11:26 ` anitha dot boyapati at atmel dot com
@ 2010-07-26 6:49 ` anitha dot boyapati at atmel dot com
2010-07-26 17:37 ` eric dot weddington at atmel dot com
` (3 subsequent siblings)
13 siblings, 0 replies; 26+ messages in thread
From: anitha dot boyapati at atmel dot com @ 2010-07-26 6:49 UTC (permalink / raw)
To: gcc-bugs
------- Comment #10 from anitha dot boyapati at atmel dot com 2010-07-26 06:49 -------
Bug can be confirmed with 4.4.3 version also (With -O2)
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42240
^ permalink raw reply [flat|nested] 26+ messages in thread
* [Bug target/42240] wrong epilogue on naked function
2009-12-01 16:18 [Bug c/42240] New: wrong Epilog on nacked function stefan dot dreyer at yahoo dot de
` (9 preceding siblings ...)
2010-07-26 6:49 ` anitha dot boyapati at atmel dot com
@ 2010-07-26 17:37 ` eric dot weddington at atmel dot com
2010-07-26 17:41 ` [Bug target/42240] [4.3/4.4 Regression, avr] " eric dot weddington at atmel dot com
` (2 subsequent siblings)
13 siblings, 0 replies; 26+ messages in thread
From: eric dot weddington at atmel dot com @ 2010-07-26 17:37 UTC (permalink / raw)
To: gcc-bugs
------- Comment #11 from eric dot weddington at atmel dot com 2010-07-26 17:37 -------
Anitha, can you please check 4.5.x and HEAD?
--
eric dot weddington at atmel dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Known to fail|4.3.2 4.3.4 |4.3.2 4.3.4 4.4.3
Last reconfirmed|0000-00-00 00:00:00 |2010-07-26 17:37:41
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42240
^ permalink raw reply [flat|nested] 26+ messages in thread
* [Bug target/42240] [4.3/4.4 Regression, avr] wrong epilogue on naked function
2009-12-01 16:18 [Bug c/42240] New: wrong Epilog on nacked function stefan dot dreyer at yahoo dot de
` (10 preceding siblings ...)
2010-07-26 17:37 ` eric dot weddington at atmel dot com
@ 2010-07-26 17:41 ` eric dot weddington at atmel dot com
2010-07-27 11:35 ` anitha dot boyapati at atmel dot com
2010-07-31 10:22 ` [Bug target/42240] [4.3/4.4 Regression] " rguenth at gcc dot gnu dot org
13 siblings, 0 replies; 26+ messages in thread
From: eric dot weddington at atmel dot com @ 2010-07-26 17:41 UTC (permalink / raw)
To: gcc-bugs
--
eric dot weddington at atmel dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
Severity|normal |major
GCC target triplet| |avr
Summary|wrong epilogue on naked |[4.3/4.4 Regression, avr]
|function |wrong epilogue on naked
| |function
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42240
^ permalink raw reply [flat|nested] 26+ messages in thread
* [Bug target/42240] [4.3/4.4 Regression, avr] wrong epilogue on naked function
2009-12-01 16:18 [Bug c/42240] New: wrong Epilog on nacked function stefan dot dreyer at yahoo dot de
` (11 preceding siblings ...)
2010-07-26 17:41 ` [Bug target/42240] [4.3/4.4 Regression, avr] " eric dot weddington at atmel dot com
@ 2010-07-27 11:35 ` anitha dot boyapati at atmel dot com
2010-07-31 10:22 ` [Bug target/42240] [4.3/4.4 Regression] " rguenth at gcc dot gnu dot org
13 siblings, 0 replies; 26+ messages in thread
From: anitha dot boyapati at atmel dot com @ 2010-07-27 11:35 UTC (permalink / raw)
To: gcc-bugs
------- Comment #12 from anitha dot boyapati at atmel dot com 2010-07-27 11:35 -------
confirmed for 4.5.0. Yet to verify for HEAD.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42240
^ permalink raw reply [flat|nested] 26+ messages in thread
* [Bug target/42240] [4.3/4.4 Regression] wrong epilogue on naked function
2009-12-01 16:18 [Bug c/42240] New: wrong Epilog on nacked function stefan dot dreyer at yahoo dot de
` (12 preceding siblings ...)
2010-07-27 11:35 ` anitha dot boyapati at atmel dot com
@ 2010-07-31 10:22 ` rguenth at gcc dot gnu dot org
13 siblings, 0 replies; 26+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2010-07-31 10:22 UTC (permalink / raw)
To: gcc-bugs
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|[4.3/4.4 Regression, avr] |[4.3/4.4 Regression] wrong
|wrong epilogue on naked |epilogue on naked function
|function |
Target Milestone|--- |4.3.6
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42240
^ permalink raw reply [flat|nested] 26+ messages in thread
* [Bug target/42240] [4.3/4.4 Regression] wrong epilogue on naked function
[not found] <bug-42240-4@http.gcc.gnu.org/bugzilla/>
@ 2010-11-04 11:14 ` avr at gjlay dot de
2010-11-09 10:24 ` anitha.boyapati at atmel dot com
` (9 subsequent siblings)
10 siblings, 0 replies; 26+ messages in thread
From: avr at gjlay dot de @ 2010-11-04 11:14 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42240
Georg Lay <avr at gjlay dot de> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |avr at gjlay dot de
--- Comment #13 from Georg Lay <avr at gjlay dot de> 2010-11-04 11:14:15 UTC ---
Implement TARGET_CANNOT_MODIFY_JUMPS_P and respect epilogue_completed and
cfun->machine->is_naked. This will stop BB reorder and similar post-epilogue
passes from moving the non-code-producing return-insn up.
^ permalink raw reply [flat|nested] 26+ messages in thread
* [Bug target/42240] [4.3/4.4 Regression] wrong epilogue on naked function
[not found] <bug-42240-4@http.gcc.gnu.org/bugzilla/>
2010-11-04 11:14 ` avr at gjlay dot de
@ 2010-11-09 10:24 ` anitha.boyapati at atmel dot com
2010-11-09 10:26 ` anitha.boyapati at atmel dot com
` (8 subsequent siblings)
10 siblings, 0 replies; 26+ messages in thread
From: anitha.boyapati at atmel dot com @ 2010-11-09 10:24 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42240
--- Comment #14 from Anitha Boyapati <anitha.boyapati at atmel dot com> 2010-11-09 10:24:11 UTC ---
Created attachment 22339
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=22339
Initial patch to fix the bug
BB reordering pass is suppressed for naked functions. Also suppressed when the
end of epilogue is reached.
^ permalink raw reply [flat|nested] 26+ messages in thread
* [Bug target/42240] [4.3/4.4 Regression] wrong epilogue on naked function
[not found] <bug-42240-4@http.gcc.gnu.org/bugzilla/>
2010-11-04 11:14 ` avr at gjlay dot de
2010-11-09 10:24 ` anitha.boyapati at atmel dot com
@ 2010-11-09 10:26 ` anitha.boyapati at atmel dot com
2010-11-09 17:16 ` avr at gjlay dot de
` (7 subsequent siblings)
10 siblings, 0 replies; 26+ messages in thread
From: anitha.boyapati at atmel dot com @ 2010-11-09 10:26 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42240
--- Comment #15 from Anitha Boyapati <anitha.boyapati at atmel dot com> 2010-11-09 10:26:04 UTC ---
(In reply to comment #13)
> Implement TARGET_CANNOT_MODIFY_JUMPS_P and respect epilogue_completed and
> cfun->machine->is_naked. This will stop BB reorder and similar post-epilogue
> passes from moving the non-code-producing return-insn up.
Yes, BB reordering pass is shifting jump blocks. Attached patch solves the
issue. The output is:
.brsh .L11 | brlo .L5
> ldi r24, lo8(0)
> ldi r25, hi8(0)
> rjmp .L6
> L5:
.L11: <
ldi r24, lo8(0) <
ldi r25, hi8(0) <
rjmp .L6 <
^ permalink raw reply [flat|nested] 26+ messages in thread
* [Bug target/42240] [4.3/4.4 Regression] wrong epilogue on naked function
[not found] <bug-42240-4@http.gcc.gnu.org/bugzilla/>
` (2 preceding siblings ...)
2010-11-09 10:26 ` anitha.boyapati at atmel dot com
@ 2010-11-09 17:16 ` avr at gjlay dot de
2010-11-09 17:21 ` avr at gjlay dot de
` (6 subsequent siblings)
10 siblings, 0 replies; 26+ messages in thread
From: avr at gjlay dot de @ 2010-11-09 17:16 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42240
--- Comment #16 from Georg Lay <avr at gjlay dot de> 2010-11-09 17:16:02 UTC ---
Created attachment 22349
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=22349
PR target/42240
^ permalink raw reply [flat|nested] 26+ messages in thread
* [Bug target/42240] [4.3/4.4 Regression] wrong epilogue on naked function
[not found] <bug-42240-4@http.gcc.gnu.org/bugzilla/>
` (3 preceding siblings ...)
2010-11-09 17:16 ` avr at gjlay dot de
@ 2010-11-09 17:21 ` avr at gjlay dot de
2010-11-10 10:38 ` anitha.boyapati at atmel dot com
` (5 subsequent siblings)
10 siblings, 0 replies; 26+ messages in thread
From: avr at gjlay dot de @ 2010-11-09 17:21 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42240
--- Comment #17 from Georg Lay <avr at gjlay dot de> 2010-11-09 17:20:59 UTC ---
(In reply to comment #14)
> Created attachment 22339 [details]
> Initial patch to fix the bug
>
> BB reordering pass is suppressed for naked functions. Also suppressed when the
> end of epilogue is reached.
BBreordering (or other passes doing similar things) need not to be disabled.
What do you think? Moreover, there is a gap between reload_completed and
epilogue_completed because the naked return insn is allowed since after reload.
Georg
^ permalink raw reply [flat|nested] 26+ messages in thread
* [Bug target/42240] [4.3/4.4 Regression] wrong epilogue on naked function
[not found] <bug-42240-4@http.gcc.gnu.org/bugzilla/>
` (4 preceding siblings ...)
2010-11-09 17:21 ` avr at gjlay dot de
@ 2010-11-10 10:38 ` anitha.boyapati at atmel dot com
2010-11-10 13:01 ` avr at gjlay dot de
` (4 subsequent siblings)
10 siblings, 0 replies; 26+ messages in thread
From: anitha.boyapati at atmel dot com @ 2010-11-10 10:38 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42240
--- Comment #18 from Anitha Boyapati <anitha.boyapati at atmel dot com> 2010-11-10 10:38:33 UTC ---
(In reply to comment #17)
> (In reply to comment #14)
> > Created attachment 22339 [details] [details]
> > Initial patch to fix the bug
> >
> > BB reordering pass is suppressed for naked functions. Also suppressed when the
> > end of epilogue is reached.
>
> BBreordering (or other passes doing similar things) need not to be disabled.
> What do you think?
I think BBreordering after the end of epilogue in case of normal functions is
little confusing. For e.g., the same testcase with naked removed generates the
following code without the patch.
.L6:
sts (seedram)+1,r25
sts seedram,r24
/* epilogue start */
ret
.L11:
ldi r24,lo8(0)
ldi r25,hi8(0)
rjmp .L6
I am not sure what additional advantage we get by allowing this to happen after
epilogue. Hence I tried to disable this. Ofcourse, I still need to run entire
regression to see if this causes any side affect.
> Moreover, there is a gap between reload_completed and
> epilogue_completed
Agreed. Thanks for catching that.
> because the naked return insn is allowed since after reload.
I dindn't quite get this. Can you give some example?
^ permalink raw reply [flat|nested] 26+ messages in thread
* [Bug target/42240] [4.3/4.4 Regression] wrong epilogue on naked function
[not found] <bug-42240-4@http.gcc.gnu.org/bugzilla/>
` (5 preceding siblings ...)
2010-11-10 10:38 ` anitha.boyapati at atmel dot com
@ 2010-11-10 13:01 ` avr at gjlay dot de
2011-02-27 9:33 ` denisc at gcc dot gnu.org
` (3 subsequent siblings)
10 siblings, 0 replies; 26+ messages in thread
From: avr at gjlay dot de @ 2010-11-10 13:01 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42240
--- Comment #19 from Georg Lay <avr at gjlay dot de> 2010-11-10 13:00:47 UTC ---
(In reply to comment #18)
> I think BBreordering after the end of epilogue in case of normal functions is
> little confusing.
Yes, optimized code is often confusing.
> I am not sure what additional advantage we get by allowing this to happen after
> epilogue. Hence I tried to disable this.
There is no bug for functions not attributed naked. I do not see why that
should be changed. Note that the backend is lying about branch costs and sets
them to zero -- both in space and time. Therefore, .bbro has fun and jumps
around. Tweaking that is of no concern here.
> > Moreover, there is a gap between reload_completed and
> > epilogue_completed
>
> Agreed. Thanks for catching that.
>
>
> > because the naked return insn is allowed since after reload.
>
> I dindn't quite get this. Can you give some example?
avr.h allows that insn after reload:
(define_insn "return_from_naked_epilogue"
[(return)]
"(reload_completed
&& cfun->machine
&& cfun->machine->is_naked)"
...
so it might be emitted after reload. Because it is non-simple, it will occur
just once, but it must be in the right place (ensured by .pro_and_epilogue) and
must not be moved around (ensured by new target hook). Observe a simple test
case like lined out below, and how the compiler transform with/without naked,
optimize size/speed, branch cost 0/!=0
char c;
void foo (char i)
{
c = 17;
switch (i)
{
case 0 : c = 1; break;
case 3 : c = 2; break;
case 7 : c = 12; break;
case 9 : c = 32; break;
}
}
^ permalink raw reply [flat|nested] 26+ messages in thread
* [Bug target/42240] [4.3/4.4 Regression] wrong epilogue on naked function
[not found] <bug-42240-4@http.gcc.gnu.org/bugzilla/>
` (6 preceding siblings ...)
2010-11-10 13:01 ` avr at gjlay dot de
@ 2011-02-27 9:33 ` denisc at gcc dot gnu.org
2011-03-03 16:59 ` denisc at gcc dot gnu.org
` (2 subsequent siblings)
10 siblings, 0 replies; 26+ messages in thread
From: denisc at gcc dot gnu.org @ 2011-02-27 9:33 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42240
--- Comment #20 from denisc at gcc dot gnu.org 2011-02-27 08:36:58 UTC ---
Author: denisc
Date: Sun Feb 27 08:36:55 2011
New Revision: 170534
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=170534
Log:
2011-02-22 Georg-Johann Lay <avr@gjlay.de>
PR target/42240
* config/avr/avr.c (avr_cannot_modify_jumps_p): New function.
(TARGET_CANNOT_MODIFY_JUMPS_P): Define.
Modified:
trunk/gcc/ChangeLog
trunk/gcc/config/avr/avr.c
^ permalink raw reply [flat|nested] 26+ messages in thread
* [Bug target/42240] [4.3/4.4 Regression] wrong epilogue on naked function
[not found] <bug-42240-4@http.gcc.gnu.org/bugzilla/>
` (7 preceding siblings ...)
2011-02-27 9:33 ` denisc at gcc dot gnu.org
@ 2011-03-03 16:59 ` denisc at gcc dot gnu.org
2011-04-14 15:38 ` gjl at gcc dot gnu.org
2012-01-26 23:44 ` gjl at gcc dot gnu.org
10 siblings, 0 replies; 26+ messages in thread
From: denisc at gcc dot gnu.org @ 2011-03-03 16:59 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42240
--- Comment #21 from denisc at gcc dot gnu.org 2011-03-03 16:58:34 UTC ---
Author: denisc
Date: Thu Mar 3 16:58:26 2011
New Revision: 170657
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=170657
Log:
Backport from mainline
2011-02-22 Georg-Johann Lay <avr@gjlay.de>
PR target/42240
* config/avr/avr.c (avr_cannot_modify_jumps_p): New function.
(TARGET_CANNOT_MODIFY_JUMPS_P): Define.
Modified:
branches/gcc-4_5-branch/gcc/ChangeLog
branches/gcc-4_5-branch/gcc/config/avr/avr.c
^ permalink raw reply [flat|nested] 26+ messages in thread
* [Bug target/42240] [4.3/4.4 Regression] wrong epilogue on naked function
[not found] <bug-42240-4@http.gcc.gnu.org/bugzilla/>
` (8 preceding siblings ...)
2011-03-03 16:59 ` denisc at gcc dot gnu.org
@ 2011-04-14 15:38 ` gjl at gcc dot gnu.org
2012-01-26 23:44 ` gjl at gcc dot gnu.org
10 siblings, 0 replies; 26+ messages in thread
From: gjl at gcc dot gnu.org @ 2011-04-14 15:38 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42240
Georg-Johann Lay <gjl at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
CC| |gjl at gcc dot gnu.org
Known to work| |4.5.3, 4.6.0
Resolution| |FIXED
Known to fail| |
--- Comment #22 from Georg-Johann Lay <gjl at gcc dot gnu.org> 2011-04-14 15:37:51 UTC ---
Closed as resolved+fixed in 4.5.3, 4.6.0
^ permalink raw reply [flat|nested] 26+ messages in thread
* [Bug target/42240] [4.3/4.4 Regression] wrong epilogue on naked function
[not found] <bug-42240-4@http.gcc.gnu.org/bugzilla/>
` (9 preceding siblings ...)
2011-04-14 15:38 ` gjl at gcc dot gnu.org
@ 2012-01-26 23:44 ` gjl at gcc dot gnu.org
10 siblings, 0 replies; 26+ messages in thread
From: gjl at gcc dot gnu.org @ 2012-01-26 23:44 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42240
Georg-Johann Lay <gjl at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |wrong-code
Target Milestone|4.3.6 |4.5.3
^ permalink raw reply [flat|nested] 26+ messages in thread