This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix debug info for parameters passed by invisible parameters (PR debug/41238)


On Thu, Sep 3, 2009 at 6:04 PM, Jakub Jelinek<jakub@redhat.com> wrote:
> Hi!
>
> Arguments passed by invisible reference (not using DECL_BY_REFERENCE though)
> have DECL_INCOMING_RTL set with set_decl_incoming_rtl (..., true) and don't
> have a REG_EXPR (or shouldn't have a MEM_EXPR), given that the parameter
> isn't in the DECL_INCOMING_RTL REG (or MEM), but in what it points to.
>
> This patch teaches var-tracking.c about those (this bug existed before VTA
> merge, but there was no assert later on which would make it obvious), and
> also prevents stack slots with the pointers to the memory from having bogus
> MEM_ATTRS).
>
> Bootstrapped/regtested on x86_64-linux and i686-linux, Uros said it allowed
> him to at least get past stage1 on alpha-linux, where it previously ICEd
> during libgcc stage1 build. ?Ok for trunk?

Looks good to me.  Can we trigger this on x86 and add a testcase?

Thanks,
Richard.

> 2009-09-03 ?Jakub Jelinek ?<jakub@redhat.com>
>
> ? ? ? ?PR debug/41238
> ? ? ? ?* function.c (assign_parm_find_stack_rtl): Don't set mem attributes on
> ? ? ? ?the stack slot if it is passed by invisible reference.
> ? ? ? ?* var-tracking.c (vt_add_function_parameters): Handle arguments passed by
> ? ? ? ?invisible reference.
>
> --- gcc/function.c.jj ? 2009-09-03 09:59:36.000000000 +0200
> +++ gcc/function.c ? ? ?2009-09-03 13:31:30.000000000 +0200
> @@ -2433,20 +2433,25 @@ assign_parm_find_stack_rtl (tree parm, s
> ? ? stack_parm = gen_rtx_PLUS (Pmode, stack_parm, offset_rtx);
> ? stack_parm = gen_rtx_MEM (data->promoted_mode, stack_parm);
>
> - ?set_mem_attributes (stack_parm, parm, 1);
> - ?/* set_mem_attributes could set MEM_SIZE to the passed mode's size,
> - ? ? while promoted mode's size is needed. ?*/
> - ?if (data->promoted_mode != BLKmode
> - ? ? ?&& data->promoted_mode != DECL_MODE (parm))
> - ? ?{
> - ? ? ?set_mem_size (stack_parm, GEN_INT (GET_MODE_SIZE (data->promoted_mode)));
> - ? ? ?if (MEM_EXPR (stack_parm) && MEM_OFFSET (stack_parm))
> - ? ? ? {
> - ? ? ? ? int offset = subreg_lowpart_offset (DECL_MODE (parm),
> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? data->promoted_mode);
> - ? ? ? ? if (offset)
> - ? ? ? ? ? set_mem_offset (stack_parm,
> - ? ? ? ? ? ? ? ? ? ? ? ? ? plus_constant (MEM_OFFSET (stack_parm), -offset));
> + ?if (!data->passed_pointer)
> + ? ?{
> + ? ? ?set_mem_attributes (stack_parm, parm, 1);
> + ? ? ?/* set_mem_attributes could set MEM_SIZE to the passed mode's size,
> + ? ? ? ?while promoted mode's size is needed. ?*/
> + ? ? ?if (data->promoted_mode != BLKmode
> + ? ? ? ? && data->promoted_mode != DECL_MODE (parm))
> + ? ? ? {
> + ? ? ? ? set_mem_size (stack_parm,
> + ? ? ? ? ? ? ? ? ? ? ? GEN_INT (GET_MODE_SIZE (data->promoted_mode)));
> + ? ? ? ? if (MEM_EXPR (stack_parm) && MEM_OFFSET (stack_parm))
> + ? ? ? ? ? {
> + ? ? ? ? ? ? int offset = subreg_lowpart_offset (DECL_MODE (parm),
> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? data->promoted_mode);
> + ? ? ? ? ? ? if (offset)
> + ? ? ? ? ? ? ? set_mem_offset (stack_parm,
> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? plus_constant (MEM_OFFSET (stack_parm),
> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?-offset));
> + ? ? ? ? ? }
> ? ? ? ?}
> ? ? }
>
> --- gcc/var-tracking.c.jj ? ? ? 2009-09-03 09:59:40.000000000 +0200
> +++ gcc/var-tracking.c ?2009-09-03 13:45:27.000000000 +0200
> @@ -7058,10 +7058,20 @@ vt_add_function_parameters (void)
>
> ? ? ? if (!vt_get_decl_and_offset (incoming, &decl, &offset))
> ? ? ? ?{
> - ? ? ? ? if (!vt_get_decl_and_offset (decl_rtl, &decl, &offset))
> - ? ? ? ? ? continue;
> - ? ? ? ? offset += byte_lowpart_offset (GET_MODE (incoming),
> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?GET_MODE (decl_rtl));
> + ? ? ? ? if (REG_P (incoming) || MEM_P (incoming))
> + ? ? ? ? ? {
> + ? ? ? ? ? ? /* This means argument is passed by invisible reference. ?*/
> + ? ? ? ? ? ? offset = 0;
> + ? ? ? ? ? ? decl = parm;
> + ? ? ? ? ? ? incoming = gen_rtx_MEM (GET_MODE (decl_rtl), incoming);
> + ? ? ? ? ? }
> + ? ? ? ? else
> + ? ? ? ? ? {
> + ? ? ? ? ? ? if (!vt_get_decl_and_offset (decl_rtl, &decl, &offset))
> + ? ? ? ? ? ? ? continue;
> + ? ? ? ? ? ? offset += byte_lowpart_offset (GET_MODE (incoming),
> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?GET_MODE (decl_rtl));
> + ? ? ? ? ? }
> ? ? ? ?}
>
> ? ? ? if (!decl)
>
> ? ? ? ?Jakub
>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]