* [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; 15+ 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] 15+ 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; 15+ 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] 15+ 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; 15+ 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] 15+ 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; 15+ 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] 15+ 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; 15+ 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] 15+ 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; 15+ 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] 15+ 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; 15+ 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] 15+ 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; 15+ 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] 15+ 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; 15+ 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] 15+ 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; 15+ 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] 15+ 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; 15+ 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] 15+ 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; 15+ 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] 15+ 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; 15+ 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] 15+ 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; 15+ 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] 15+ messages in thread