This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
RE: ICE with MEM_REF when Pmode is different from word_mode
- From: "Deepti Sharma" <deepti dot gccretarget at gmail dot com>
- To: "'Richard Guenther'" <richard dot guenther at gmail dot com>, "'Mohamed Shafi'" <shafitvm at gmail dot com>
- Cc: "'GCC'" <gcc at gcc dot gnu dot org>, <dj at redhat dot com>, "'Ahmed Sherif'" <ahsh767 at gmail dot com>
- Date: Wed, 29 Aug 2012 16:33:22 +0530
- Subject: RE: ICE with MEM_REF when Pmode is different from word_mode
- References: <CAEsx6g=7sZ1iveFOOOx5YkHO-Eqn9OdUtSRCW2Y7GuULEjD8hA@mail.gmail.com> <CAFiYyc1MJ77YZvFfOOyFda=6e5qeYvdx=c5j04p9j8+HxMzwMA@mail.gmail.com> <CAEsx6g=N_BNRpVzib6ufYASZu0_Dk=3WCmSqDW+aPQ53ZgA-7Q@mail.gmail.com> <CAFiYyc0A2dQwB3Dy2jdRz7+QGb+q249LiyW0M=62Fd+OfXK-rQ@mail.gmail.com>
Hello Richard,
> -----Original Message-----
> From: gcc-owner@gcc.gnu.org [mailto:gcc-owner@gcc.gnu.org] On Behalf Of
> Richard Guenther
> Sent: 31 May 2012 14:27
> To: Mohamed Shafi
> Cc: GCC; dj@redhat.com; Ahmed Sherif
> Subject: Re: ICE with MEM_REF when Pmode is different from word_mode
>
> On Wed, May 30, 2012 at 4:31 PM, Mohamed Shafi <shafitvm@gmail.com>
> wrote:
> > On 29 May 2012 17:31, Richard Guenther <richard.guenther@gmail.com>
> wrote:
> >> On Tue, May 29, 2012 at 1:57 PM, Mohamed Shafi <shafitvm@gmail.com>
> wrote:
> >>> Hi,
> >>>
> >>> I am porting a private target in GCC 4.6.3 version. For my target
> >>> pointer size is 24bits and word size is 32bits. Moreover a byte is
> >>> 32bit
> >>>
> >>> For the testcase gcc.c-torture/compile/921111-1.c i get the
> >>> following ICE
> >>>
> >>> 921111-1.c: In function 'f':
> >>> 921111-1.c:18:5: internal compiler error: in size_binop_loc, at
> >>> fold-const.c:1436
> >>> Please submit a full bug report,
> >>> with preprocessed source if appropriate.
> >>> See <http://gcc.gnu.org/bugs.html> for instructions
> >>>
> >>> This is the reduced testcase of the same
> >>>
> >>> ?struct vp {
> >>> ?int wa;
> >>> };
> >>>
> >>> typedef struct vp *vpt;
> >>>
> >>> typedef struct vc {
> >>> ?int o;
> >>> ?vpt py[8];
> >>> } *vct;
> >>>
> >>> typedef struct np *npt;
> >>> struct np {
> >>> ?vct d;
> >>> ?int di;
> >>> };
> >>>
> >>> int f(npt dp)
> >>> {
> >>> ?vpt *py;
> >>>
> >>> ?py = &dp->d->py[dp->di];
> >>> ?return (int)(py[1])->wa;
> >>> }
> >>>
> >>> The ICE happens in tree_slp_vectorizer pass. The following is the
> >>> tree dump just before that
> >>>
> >>> ;; Function f (f)
> >>>
> >>> f (struct np * dp)
> >>> {
> >>> ?struct vp * D.1232;
> >>> ?int D.1230;
> >>> ?unsigned int D.1228;
> >>> ?int D.1227;
> >>> ?struct vc * D.1225;
> >>>
> >>> <bb 2>:
> >>> ?D.1225_2 = dp_1(D)->d;
> >>> ?D.1227_4 = dp_1(D)->di;
> >>> ?D.1228_5 = (unsigned int) D.1227_4;
> >>> ?D.1232_9 = MEM[(struct vp * *)D.1225_2 + 4B].py[D.1228_5]{lb: 0
> sz:
> >>> 4};
> >>> ?D.1230_10 = D.1232_9->wa;
> >>> ?return D.1230_10;
> >>> }
> >>>
> >>> The ICE happens for
> >>>
> >>> ?D.1232_9 = MEM[(struct vp * *)D.1225_2 + 4B].py[D.1228_5]{lb: 0
> sz:
> >>> 4};
> >>>
> >>> This is due to the addition of the new code in tree-data-ref.c
> (this
> >>> is was not there in 4.5 series)
> >>>
> >>> ?if (TREE_CODE (base) == MEM_REF)
> >>> ? ?{
> >>> ? ? ?if (!integer_zerop (TREE_OPERAND (base, 1)))
> >>> ? ? ? ?{
> >>> ? ? ? ? ?if (!poffset)
> >>> ? ? ? ? ? ?{
> >>> ? ? ? ? ? ? ?double_int moff = mem_ref_offset (base);
> >>> ? ? ? ? ? ? ?poffset = double_int_to_tree (sizetype, moff);
> >>> ? ? ? ? ? ?}
> >>> ? ? ? ? ?else
> >>> ? ? ? ? ? ?poffset = size_binop (PLUS_EXPR, poffset, TREE_OPERAND
> >>> (base, 1));
> >>
> >> This should use mem_ref_offset, too.
> >>
> >
> > This is present in the trunk also. Will you be submitting a patch for
> this?
>
> I put it on my TODO list. Something like
Is this issue fixed now for gcc 4.6.3? I am not able to find a bug entry for
this. Could you please share the link?
Thanks.
> Index: gcc/tree-data-ref.c
> ===================================================================
> --- gcc/tree-data-ref.c (revision 188008)
> +++ gcc/tree-data-ref.c (working copy)
> @@ -720,13 +720,12 @@ dr_analyze_innermost (struct data_refere
> {
> if (!integer_zerop (TREE_OPERAND (base, 1)))
> {
> + double_int moff = mem_ref_offset (base);
> + tree mofft = double_int_to_tree (sizetype, moff);
> if (!poffset)
> - {
> - double_int moff = mem_ref_offset (base);
> - poffset = double_int_to_tree (sizetype, moff);
> - }
> + poffset = mofft;
> else
> - poffset = size_binop (PLUS_EXPR, poffset, TREE_OPERAND
> (base, 1));
> + poffset = size_binop (PLUS_EXPR, poffset, mofft);
> }
> base = TREE_OPERAND (base, 0);
> }
>
>
> > Shafi