[Bug other/50925] [4.7 Regression][avr] ICE at spill_failure, at reload1.c:2118
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50925 Georg-Johann Lay changed: What|Removed |Added Last reconfirmed|2011-11-04 00:00:00 |2012-02-17 0:00 Known to work|4.6.2 | Known to fail||4.5.2, 4.6.2 --- Comment #20 from Georg-Johann Lay 2012-02-27 21:04:29 UTC --- Adjusted "known to fail" as with the new test case.
[Bug other/50925] [4.7 Regression][avr] ICE at spill_failure, at reload1.c:2118
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50925 --- Comment #19 from Georg-Johann Lay 2012-02-27 20:42:39 UTC --- Created attachment 26765 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=26765 spill.c - another reduced test Here is yet another different and simplified test case. With that test case I can produce spill fails for 4.5.2, 4.6.2 and 4.7 trunk (build from around 2012-02-17). >> avr-gcc spill.c -Os -S spill.c: In function 'menu_cycle': spill.c:31:1: error: unable to find a register to spill in class 'POINTER_REGS' spill.c:31:1: error: this is the insn: (insn 36 20 21 2 (set (reg:QI 18 r18) (mem/c:QI (plus:HI (reg/f:HI 28 r28) (const_int 1 [0x1])) [3 S1 A8])) spill.c:29 18 {movqi_insn} (nil)) spill.c:31:1: internal compiler error: in spill_failure, at reload1.c:2120
[Bug other/50925] [4.7 Regression][avr] ICE at spill_failure, at reload1.c:2118
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50925 --- Comment #18 from denisc at gcc dot gnu.org 2012-01-28 10:05:50 UTC --- (In reply to comment #17) > Assuming there is a connexion between these two issues. > > If that assumption turns out to be wrong, please cut the dependency. Dependency cutted. 52025 isn't related to this bug.
[Bug other/50925] [4.7 Regression][avr] ICE at spill_failure, at reload1.c:2118
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50925 Georg-Johann Lay changed: What|Removed |Added Depends on||52025 --- Comment #17 from Georg-Johann Lay 2012-01-27 23:26:37 UTC --- Assuming there is a connexion between these two issues. If that assumption turns out to be wrong, please cut the dependency.
[Bug other/50925] [4.7 Regression][avr] ICE at spill_failure, at reload1.c:2118
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50925 --- Comment #16 from Georg-Johann Lay 2012-01-27 23:20:03 UTC --- Created attachment 26486 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=26486 main-loop.c (maybe related from PR52025) This is a small test case from PR52025 generates strange code: It sets up a frame to store a local variable. Notice that there is just one local variable in the whole little program, so there is really no frame needed. This issue can be resolved by -fno-caller-saves, so maybe it's related to the spill fails from here that can also be hacked around with -fno-caller-saves. Maybe this little programs helps to find what's going wrong with the register allocation and spill fails.
[Bug other/50925] [4.7 Regression][avr] ICE at spill_failure, at reload1.c:2118
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50925 --- Comment #15 from denisc at gcc dot gnu.org 2012-01-14 18:11:33 UTC --- Author: denisc Date: Sat Jan 14 18:11:29 2012 New Revision: 183183 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=183183 Log: PR target/50925 * config/avr/avr-protos.h: Revert change of 2012-01-09. * config/avr/avr.c: Likewise. * config/avr/avr.h: Likewise. Modified: trunk/gcc/ChangeLog trunk/gcc/config/avr/avr-protos.h trunk/gcc/config/avr/avr.c trunk/gcc/config/avr/avr.h
[Bug other/50925] [4.7 Regression][avr] ICE at spill_failure, at reload1.c:2118
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50925 --- Comment #14 from denisc at gcc dot gnu.org 2012-01-12 18:30:00 UTC --- Author: denisc Date: Thu Jan 12 18:29:54 2012 New Revision: 183136 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=183136 Log: PR target/50925 * config/avr/avr-protos.h (avr_hard_regno_nregs): Declare. * config/avr/avr.c (avr_can_eliminate): Simplify. (avr_initial_elimination_offset): Likewise. (avr_prologue_setup_frame): Use hard_frame_pointer_rtx. (expand_epilogue): Likewise. (avr_legitimize_address): Gut. (avr_legitimize_reload_address): Use hard_frame_pointer_rtx. (avr_hard_regno_nregs): New. (avr_hard_regno_ok): Allow only Pmode for arg and frame_pointers. (avr_regno_mode_code_ok_for_base_b): Handle arg and frame pointers. * config/avr/avr.h (FIXED_REGISTERS): Adjust arg pointer, add soft frame pointer. (CALL_USED_REGISTERS): Likewise. (REG_CLASS_CONTENTS): Likewise. (REGISTER_NAMES): Likewise. (HARD_REGNO_NREGS): Use avr_hard_regno_nregs. (HARD_FRAME_POINTER_REGNUM): New. (FRAME_POINTER_REGNUM): Use soft frame pointer. (ELIMINABLE_REGS): Eliminate from the soft frame pointer, remove the HARD_FRAME_POINTER self-elimination. Modified: trunk/gcc/ChangeLog trunk/gcc/config/avr/avr-protos.h trunk/gcc/config/avr/avr.c trunk/gcc/config/avr/avr.h
[Bug other/50925] [4.7 Regression][avr] ICE at spill_failure, at reload1.c:2118
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50925 --- Comment #13 from denisc at gcc dot gnu.org 2011-12-06 18:42:23 UTC --- Created attachment 26008 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=26008 Simplified testcase
[Bug other/50925] [4.7 Regression][avr] ICE at spill_failure, at reload1.c:2118
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50925 --- Comment #12 from denisc at gcc dot gnu.org 2011-12-05 19:15:11 UTC --- This is a very old bug: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42204 http://gcc.gnu.org/ml/gcc/2006-03/msg00783.html
[Bug other/50925] [4.7 Regression][avr] ICE at spill_failure, at reload1.c:2118
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50925 --- Comment #11 from denisc at gcc dot gnu.org 2011-12-05 19:08:41 UTC --- Sorry, wrong button was pressed. (In reply to comment #8) > I'm not going to be able to look at it anytime soon, but just some general > thoughts: I think that I'm ready to explain the bug. > 1. Disabling caller-saves probably isn't appropriate. Just looking at > codesize isn't the way to evaluate caller-saves either as caller-saves is > tasked with improving performance, possibly at the expense of codesize. I'm agree. I don't want to disable caller-saves. > > 2. The first thing someone needs to do is provide information as to why that > insn needs reloads. I don't know enough about the AVR to hazard as guess why > that insn needs reloads. > > 3. Find out where insn 172 comes from. There are restrictions on the insns > created by caller-save. So if caller-save creates a bogus insn, then that > needs to be investigated. Generally, caller-save generate right insn. 1. AVR port have a specific dependency between frame_pointer_needed and get_frame_size(). avr_frame_pointer_required_p (void) { return (cfun->calls_alloca || cfun->calls_setjmp || cfun->has_nonlocal_label || crtl->args.info.nregs == 0 || get_frame_size () > 0); } 2. reload calls the `setup_save_areas ()' and after that get_frame_size () equal to 2, but frame_pointer_needed is 0. It's wrong for AVR port (If dependency between frame_pointer_needed and get_frame_size() is permitted by GCC core). 3. After that caller-save generate right save/restore insns for save to frame slot and restore from it. Like this (r28 is a frame pointer): (insn 162 77 163 10 (set (reg:QI 18 r18) (mem/c:QI (plus:HI (reg/f:HI 28 r28) (const_int 1 [0x1])) [8 S1 A8])) /mnt/d/avr-work/tst/nl.c:120 20 {movqi_insn} (nil)) 4. After that the following code was executed: /* If needed, eliminate any eliminable registers. */ if (num_eliminable || num_eliminable_invariants) did_elimination = eliminate_regs_in_insn (insn, 0); And right insns converted to wrong (__SP_L__ can not be used as a pointer): (insn 162 77 163 10 (set (reg:QI 18 r18) (mem/c:QI (plus:HI (reg/f:HI 32 __SP_L__) (const_int 1 [0x1])) [8 S1 A8])) /mnt/d/avr-work/tst/nl.c:120 20 {movqi_insn} (nil)) Here we have a wrong elimination FP->SP because frame_pointer_needed was not recalculated earlier. 5. relod have the following fragment: if (caller_save_needed) setup_save_areas (); /* If we allocated another stack slot, redo elimination bookkeeping. */ if (something_was_spilled || starting_frame_size != get_frame_size ()) continue; --- But it's not resolve the problem. frame_pointer_needed isn't recalculated. Call to `update_eliminables ()' seems as a right solution.
[Bug other/50925] [4.7 Regression][avr] ICE at spill_failure, at reload1.c:2118
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50925 --- Comment #10 from Jeffrey A. Law 2011-12-05 18:53:34 UTC --- Other ports seem to work OK when the requirement for a frame pointer is conditional on the size of the stack. It's not the most common case, but it does come up in several ports. I still haven't seen a good description of why the particular insn needs reloads. Not everyone is familiar with the guts of the avr port. I'd then be looking at init_caller_save to determine why it thinks a particular address is OK for a caller-save, when in fact it isn't OK. jeff
[Bug other/50925] [4.7 Regression][avr] ICE at spill_failure, at reload1.c:2118
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50925 denisc at gcc dot gnu.org changed: What|Removed |Added CC||denisc at gcc dot gnu.org --- Comment #9 from denisc at gcc dot gnu.org 2011-12-05 18:31:53 UTC --- (In reply to comment #8) > I'm not going to be able to look at it anytime soon, but just some general > thoughts: I think that I'm ready to explain the bug. > 1. Disabling caller-saves probably isn't appropriate. Just looking at > codesize isn't the way to evaluate caller-saves either as caller-saves is > tasked with improving performance, possibly at the expense of codesize. I'm agree. I don't want to disable caller-saves. > > 2. The first thing someone needs to do is provide information as to why that > insn needs reloads. I don't know enough about the AVR to hazard as guess why > that insn needs reloads. > > 3. Find out where insn 172 comes from. There are restrictions on the insns > created by caller-save. So if caller-save creates a bogus insn, then that > needs to be investigated. Generally, caller-save generate right insn. 1. AVR port have a specific dependency between frame_pointer_neede and gat_frame_size()
[Bug other/50925] [4.7 Regression][avr] ICE at spill_failure, at reload1.c:2118
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50925 --- Comment #8 from Jeffrey A. Law 2011-11-14 17:09:04 UTC --- I'm not going to be able to look at it anytime soon, but just some general thoughts: 1. Disabling caller-saves probably isn't appropriate. Just looking at codesize isn't the way to evaluate caller-saves either as caller-saves is tasked with improving performance, possibly at the expense of codesize. 2. The first thing someone needs to do is provide information as to why that insn needs reloads. I don't know enough about the AVR to hazard as guess why that insn needs reloads. 3. Find out where insn 172 comes from. There are restrictions on the insns created by caller-save. So if caller-save creates a bogus insn, then that needs to be investigated. Anyway, that's where I'd start. I can't say enough that disabling caller-saves merely to work around this problem is wrong wrong wrong.
[Bug other/50925] [4.7 Regression][avr] ICE at spill_failure, at reload1.c:2118
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50925 Joel Sherrill changed: What|Removed |Added CC||law at redhat dot com --- Comment #7 from Joel Sherrill 2011-11-14 01:28:46 UTC --- Adding Jeff Law (to the right PR) in the hopes that he can determine who is the right person to investigate this.
[Bug other/50925] [4.7 Regression][avr] ICE at spill_failure, at reload1.c:2118
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50925 --- Comment #6 from Joel Sherrill 2011-11-14 01:26:40 UTC --- (In reply to comment #5) > Asserting that the bug is not a flaw in avr backend, I set the component to > "other". The bug is somewhere in the caller-saves/IRA/reload triangle like > PR50775: http://gcc.gnu.org/ml/gcc/2011-10/msg00537.html We need to get someone more general to look at this and get the right person investigating.
[Bug other/50925] [4.7 Regression][avr] ICE at spill_failure, at reload1.c:2118
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50925 Richard Guenther changed: What|Removed |Added Priority|P3 |P4
[Bug other/50925] [4.7 Regression][avr] ICE at spill_failure, at reload1.c:2118
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50925 Georg-Johann Lay changed: What|Removed |Added Component|target |other Target Milestone|--- |4.7.0 --- Comment #5 from Georg-Johann Lay 2011-11-04 22:27:58 UTC --- Asserting that the bug is not a flaw in avr backend, I set the component to "other". The bug is somewhere in the caller-saves/IRA/reload triangle like PR50775: http://gcc.gnu.org/ml/gcc/2011-10/msg00537.html