public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "dberlin at dberlin dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/30252] [4.2 regression] miscompilation of sigc++-2.0 based code with -fstrict-aliasing
Date: Tue, 05 Jun 2007 17:45:00 -0000	[thread overview]
Message-ID: <20070605174514.14468.qmail@sourceware.org> (raw)
In-Reply-To: <bug-30252-7958@http.gcc.gnu.org/bugzilla/>



------- Comment #36 from dberlin at gcc dot gnu dot org  2007-06-05 17:45 -------
Subject: Re:  [4.2 regression] miscompilation of sigc++-2.0 based code with
-fstrict-aliasing

On 5 Jun 2007 16:30:32 -0000, rguenther at suse dot de
<gcc-bugzilla@gcc.gnu.org> wrote:
>
>
> ------- Comment #35 from rguenther at suse dot de  2007-06-05 16:30 -------
> Subject: Re:  [4.2 regression] miscompilation of sigc++-2.0
>  based code with -fstrict-aliasing
>
> On Tue, 5 Jun 2007, dberlin at dberlin dot org wrote:
>
> > Subject: Re:  [4.2 regression] miscompilation of sigc++-2.0 based code with
> > -fstrict-aliasing
> >
> > On 5 Jun 2007 09:27:34 -0000, rguenth at gcc dot gnu dot org
> > <gcc-bugzilla@gcc.gnu.org> wrote:
> > >
> > >
> > > ------- Comment #30 from rguenth at gcc dot gnu dot org  2007-06-05 09:27 -------
> > > See this testcase (reduced from spec2k6 dealII by Micha):
> > >
> > >   struct I {
> > >     int ix;
> > >     struct II {
> > >       int j,i;
> > >       void *ptr;
> > >     } ii;
> > >   };// inner;
> > > struct O : public I {
> > > //  int x;
> > >   int y;
> > > };
> > >
> > > static int geti (struct O *o)
> > > {
> > >   return o->ii.i;
> > > }
> > > extern void init(struct O*);
> > > extern void deinit(struct O*);
> > > extern int getcond(void);
> > > struct O::I *getinner (struct O*);
> > > int reset (int cond)
> > > {
> > >
> > >   struct O cell;
> > >   struct O *o;
> > >   struct I::II *in;
> > >   int *pi;
> > >   o = &cell;
> > >   init (o);
> > >   in = &o->ii;
> > >   while (getcond()) {
> > >     if (o->y)
> > >       cell.ii.i = -2;
> > >     if (!getcond()) {
> > >       in->i = -1;
> > >       in->j = o->ii.i;
> > >       break;
> > >     }
> > >   }
> > >   pi = &in->j;
> > >   pi++;
> > >   deinit(&cell);
> > >   return *pi;
> > > }
> > >
> > > and note how we compute the wrong points-to solution for in:
> > >
> > > o_3 = { cell cell.y cell.ptr cell.i cell.j }
> > > in_4 = { cell.y cell.ptr cell.j }
> > >
> >
> > > we are missing cell.i in the points-to set.  This is because with looking
> > > simply for vars with oldoffset + offset is appearantly not enough here.
> > >
> > >   cell + 64    ->  cell.j
> > >   cell.y + 64  ->  off structure
> > >   cell.ptr + 64 -> cell.y
> > >   cell.i + 64  ->  cell.ptr (actually in the middle of it)
> > >   cell.j + 64  ->  cell.ptr
> > >
> > > so, there is nothing in the structure that, if added 64, will point to
> > > cell.i.  But of course we are taking the address of the substructure and
> > > so we are indeed pointing to cell.i.
> > We are pointing to cell, and using that to access cell.i
> > Not quite the same thing.
> > But I guess in our world we have to make them the same thing.
> >
> > > So a different solution would be to add _each_ var starting with the
> > > first one + offset.
> >
> > You don't want to play in solution_set_add, which is common to a bunch of code.
> >
> > The only cases where the above problem comes into play is in offseted
> > copy constraints, line 1520 (IE the last part of
> > do_complex_constraint).
> >
> > In actuality, this is a bug in constraint building.
> >
> > When we generate the constraints for in = &o->ii, we should be adding
> > an offsetted copy constraint for each offset of type *o.
> >
> > This will fix the problem.
>
> How so?  The solution_set_add method is still wrong.

The constraints say to add this offset to the members of the points to
sets of these variables, and put the result over here.
As long as solution_set_add is doing that, it is not the problem.

If it does not generate correct results, it is the constraints that
are wrong, not solution_set_add


-- 


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


  parent reply	other threads:[~2007-06-05 17:45 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-18 15:56 [Bug tree-optimization/30252] New: [4.2/4.3 " belyshev at depni dot sinp dot msu dot ru
2006-12-18 15:57 ` [Bug tree-optimization/30252] " belyshev at depni dot sinp dot msu dot ru
2006-12-18 18:24 ` pinskia at gcc dot gnu dot org
2006-12-18 19:04 ` pinskia at gcc dot gnu dot org
2006-12-19 11:11 ` [Bug tree-optimization/30252] [4.2 " belyshev at depni dot sinp dot msu dot ru
2006-12-27 16:18 ` rguenth at gcc dot gnu dot org
2006-12-27 20:19 ` belyshev at depni dot sinp dot msu dot ru
2007-02-19 20:52 ` mmitchel at gcc dot gnu dot org
2007-04-29  7:02 ` pinskia at gcc dot gnu dot org
2007-04-29  8:58 ` belyshev at depni dot sinp dot msu dot ru
2007-04-30  2:25 ` bangerth at dealii dot org
2007-04-30 14:16 ` pluto at agmk dot net
2007-04-30 14:29 ` pluto at agmk dot net
2007-04-30 14:43 ` bangerth at dealii dot org
2007-05-01  1:11 ` giovannibajo at libero dot it
2007-05-01  1:39 ` bangerth at math dot tamu dot edu
2007-05-01  7:59 ` pluto at agmk dot net
2007-05-01 12:35 ` rguenth at gcc dot gnu dot org
2007-05-01 13:01 ` rguenth at gcc dot gnu dot org
2007-05-01 13:05 ` [Bug c++/30252] " rguenth at gcc dot gnu dot org
2007-05-02 20:59 ` mmitchel at gcc dot gnu dot org
2007-05-13  0:43 ` ismail at pardus dot org dot tr
2007-05-13 10:34 ` rguenth at gcc dot gnu dot org
2007-05-13 12:02 ` rguenth at gcc dot gnu dot org
2007-05-14 19:04 ` dberlin at gcc dot gnu dot org
2007-05-14 21:26 ` mmitchel at gcc dot gnu dot org
2007-05-15  7:59 ` rguenth at gcc dot gnu dot org
2007-06-04 15:28 ` rguenth at gcc dot gnu dot org
2007-06-04 15:45 ` rguenth at gcc dot gnu dot org
2007-06-05  9:27 ` rguenth at gcc dot gnu dot org
2007-06-05 12:05 ` rguenth at gcc dot gnu dot org
2007-06-05 15:01 ` rguenth at gcc dot gnu dot org
2007-06-05 15:57 ` rguenth at gcc dot gnu dot org
2007-06-05 16:20 ` dberlin at dberlin dot org
2007-06-05 16:30 ` rguenther at suse dot de
2007-06-05 17:45 ` dberlin at dberlin dot org [this message]
2007-06-05 18:25 ` matz at gcc dot gnu dot org
2007-06-05 19:07 ` dberlin at dberlin dot org
2007-06-05 19:59 ` rguenther at suse dot de
2007-06-05 22:44 ` dberlin at dberlin dot org
2007-06-06  8:50 ` rguenther at suse dot de
2007-06-06 15:52 ` dberlin at dberlin dot org
2007-06-19  9:24 ` rguenth at gcc dot gnu dot org
2007-06-19  9:46 ` rguenth at gcc dot gnu dot org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070605174514.14468.qmail@sourceware.org \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).