http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49775



--- Comment #8 from Praveen Kaushik <praveen.r.kaushik at gmail dot com> 
2012-09-21 10:36:20 UTC ---

This bug seems to be duplicate of this :



http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26504





The assertion, 



gcc_assert ((SUPPORTS_STACK_ALIGNMENT

        && (elim == hard_frame_pointer_rtx

            || elim == stack_pointer_rtx))

       || elim == (frame_pointer_needed

                   ? hard_frame_pointer_rtx

                   : stack_pointer_rtx));



instead of being checked in 'compute_frame_pointer_to_fb_displacement ()' is

now assigned to 'frame_pointer_fb_offset_valid' and the assertion is moved to

'based_loc_descr()' (where it actually fails).



http://gcc.gnu.org/viewcvs/trunk/gcc/dwarf2out.c?r1=174715&r2=175018&diff_format=h





PR26504 was resolved by defining 'FRAME_POINTER_CFA_OFFSET' macro in avr.h.

This macro was removed later in Revision 171295, so that ARG_POINTER_CFA_OFFSET

can be defined.



These changes were done in order to fix PR48459.



http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48459









snip from dwarf2out.c

----

#ifdef FRAME_POINTER_CFA_OFFSET

  reg = frame_pointer_rtx;

  offset += FRAME_POINTER_CFA_OFFSET (current_function_decl);

#else

  reg = arg_pointer_rtx;

  offset += ARG_POINTER_CFA_OFFSET (current_function_decl);

#endif



  elim = eliminate_regs (reg, VOIDmode, NULL_RTX);



----



Here `reg' is initialized with `arg_pointer_rtx' since FRAME_POINTER_CFA_OFFSET

is not defined.





----

frame_pointer_fb_offset_valid

    = ((SUPPORTS_STACK_ALIGNMENT

        && (elim == hard_frame_pointer_rtx

            || elim == stack_pointer_rtx))

       || elim == (frame_pointer_needed

                   ? hard_frame_pointer_rtx

                   : stack_pointer_rtx));

----



In this, `elim' is expected to be equal to `stack_pointer_rtx' (as

frame_pointer_needed is false) in order to have 'frame_pointer_fb_offset_valid'

value TRUE.





But AVR does not have any elimination to reduce `arg_pointer_rtx' to

`stack_pointer_rtx', so this assertion ought to fail in this case.





So IMO, to fix this issue either FRAME_POINTER_CFA_OFFSET should be defined or

an elimination should be defined which reduces `arg_pointer_rtx' to

`stack_pointer_rtx'.

Reply via email to