public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/13146] New: inheritance for nonoverlapping_component_refs_p
@ 2003-11-20 22:24 dann at godzilla dot ics dot uci dot edu
  2003-11-25  1:00 ` [Bug c++/13146] " pinskia at gcc dot gnu dot org
                   ` (5 more replies)
  0 siblings, 6 replies; 11+ messages in thread
From: dann at godzilla dot ics dot uci dot edu @ 2003-11-20 22:24 UTC (permalink / raw)
  To: gcc-bugs

Currently g++ cannot tell that accesses to class members from different points
of the inheritance hierachy cannot overlap. 

There is a patch that fixes the problem at:

http://gcc.gnu.org/ml/gcc-patches/2002-05/msg01996.html

but it seems that has been forgotten. This bug was created so that the issue 
is not completely forgotten.

A testcase is below. It would be nice if a C++ specialist would 
add more tests.

/* { dg-do link } */

class first
{
public:
  double d;
  int f1;
};

class middle : public first
{
};

class second : public middle
{
public:
  int f2;
  short a;
};

class third
{
public:
  char a;
  char b;
};

class multi: public third, public second
{
public:
  short s;
  char f3;
};

extern void link_error ();

void
foo (first *s1, second *s2)
{
  s1->f1 = 0;
  s2->f2 = 0;
  s1->f1++;
  s2->f2++;
  s1->f1++;
  s2->f2++;
  if (s1->f1 != 2)
    link_error ();
}

void
bar (first *s1, multi *s3)
{
  s1->f1 = 0;
  s3->f3 = 0;
  s1->f1++;
  s3->f3++;
  s1->f1++;
  s3->f3++;
  if (s1->f1 != 2)
    link_error ();
}


int
main()
{
  first a;
  second b;
  multi c;
  foo (&a, &b);
  bar (&a, &c);
  return 0;
}

-- 
           Summary: inheritance for nonoverlapping_component_refs_p
           Product: gcc
           Version: 3.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: dann at godzilla dot ics dot uci dot edu
                CC: gcc-bugs at gcc dot gnu dot org


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


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug c++/13146] inheritance for nonoverlapping_component_refs_p
  2003-11-20 22:24 [Bug c++/13146] New: inheritance for nonoverlapping_component_refs_p dann at godzilla dot ics dot uci dot edu
@ 2003-11-25  1:00 ` pinskia at gcc dot gnu dot org
  2003-12-26  3:00 ` pinskia at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-11-25  1:00 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2003-11-25 01:00 -------
Confirmed.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
           Keywords|                            |pessimizes-code
   Last reconfirmed|0000-00-00 00:00:00         |2003-11-25 01:00:51
               date|                            |


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


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug c++/13146] inheritance for nonoverlapping_component_refs_p
  2003-11-20 22:24 [Bug c++/13146] New: inheritance for nonoverlapping_component_refs_p dann at godzilla dot ics dot uci dot edu
  2003-11-25  1:00 ` [Bug c++/13146] " pinskia at gcc dot gnu dot org
@ 2003-12-26  3:00 ` pinskia at gcc dot gnu dot org
  2004-01-19 21:28 ` dhazeghi at yahoo dot com
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-12-26  3:00 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2003-12-26 02:30 -------
There was a recent discussion about this.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch


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


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug c++/13146] inheritance for nonoverlapping_component_refs_p
  2003-11-20 22:24 [Bug c++/13146] New: inheritance for nonoverlapping_component_refs_p dann at godzilla dot ics dot uci dot edu
  2003-11-25  1:00 ` [Bug c++/13146] " pinskia at gcc dot gnu dot org
  2003-12-26  3:00 ` pinskia at gcc dot gnu dot org
@ 2004-01-19 21:28 ` dhazeghi at yahoo dot com
  2004-07-03  2:37 ` giovannibajo at libero dot it
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 11+ messages in thread
From: dhazeghi at yahoo dot com @ 2004-01-19 21:28 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From dhazeghi at yahoo dot com  2004-01-19 21:28 -------
Would anybody like to volunteer to check Richard's patch?

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rth at redhat dot com


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


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug c++/13146] inheritance for nonoverlapping_component_refs_p
  2003-11-20 22:24 [Bug c++/13146] New: inheritance for nonoverlapping_component_refs_p dann at godzilla dot ics dot uci dot edu
                   ` (2 preceding siblings ...)
  2004-01-19 21:28 ` dhazeghi at yahoo dot com
@ 2004-07-03  2:37 ` giovannibajo at libero dot it
  2004-10-28 20:23 ` dnovillo at gcc dot gnu dot org
  2005-01-27  2:17 ` pinskia at gcc dot gnu dot org
  5 siblings, 0 replies; 11+ messages in thread
From: giovannibajo at libero dot it @ 2004-07-03  2:37 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From giovannibajo at libero dot it  2004-07-03 02:37 -------
RTH: I think your patch linked here is not good anymore. Or at least, we want 
this done on the tree level rather than RTL. Is this still an aliasing bug? If 
so, maybe Diego will be willing to have a look at it.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |giovannibajo at libero dot
                   |                            |it, dnovillo at gcc dot gnu
                   |                            |dot org


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


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug c++/13146] inheritance for nonoverlapping_component_refs_p
  2003-11-20 22:24 [Bug c++/13146] New: inheritance for nonoverlapping_component_refs_p dann at godzilla dot ics dot uci dot edu
                   ` (3 preceding siblings ...)
  2004-07-03  2:37 ` giovannibajo at libero dot it
@ 2004-10-28 20:23 ` dnovillo at gcc dot gnu dot org
  2005-01-27  2:17 ` pinskia at gcc dot gnu dot org
  5 siblings, 0 replies; 11+ messages in thread
From: dnovillo at gcc dot gnu dot org @ 2004-10-28 20:23 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From dnovillo at gcc dot gnu dot org  2004-10-28 20:23 -------

The tree alias analyzer depends on the type information given to it by alias.c.
 In this case, the types of the pointers passed to the two routines have
conflicting alias sets, so they are given the same memory tag.

Without context sensitive information, we cannot tell where these arguments are
really pointing to, so we have to base the analysis exclusively on types. 
Notice, however, that the analysis DTRT when the calls are inlined.

-- 


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


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug c++/13146] inheritance for nonoverlapping_component_refs_p
  2003-11-20 22:24 [Bug c++/13146] New: inheritance for nonoverlapping_component_refs_p dann at godzilla dot ics dot uci dot edu
                   ` (4 preceding siblings ...)
  2004-10-28 20:23 ` dnovillo at gcc dot gnu dot org
@ 2005-01-27  2:17 ` pinskia at gcc dot gnu dot org
  5 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-01-27  2:17 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-01-27 02:17 -------
Also it sounds like the scheduler still needs support from the rtl aliasing mechanism is helped by more 
information.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|2004-10-03 16:32:42         |2005-01-27 02:17:43
               date|                            |


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


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug c++/13146] inheritance for nonoverlapping_component_refs_p
       [not found] <bug-13146-1008@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2008-03-15 12:29 ` rguenth at gcc dot gnu dot org
@ 2008-03-15 12:41 ` rguenth at gcc dot gnu dot org
  3 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-03-15 12:41 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from rguenth at gcc dot gnu dot org  2008-03-15 12:40 -------
the nonoverlapping_memrefs_p check can be simplified (consolidated) by using
the generic get_ref_base_and_extent code.  The result of that can be adjusted
by MEM_OFFSET and only in case of an indirect base we may try to
disambiguate based on struct contain-ness of the types of that accesses.

Maybe I'll have a look, as this sounds uselful in general.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |rguenth at gcc dot gnu dot
                   |dot org                     |org
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2006-01-15 20:43:32         |2008-03-15 12:40:51
               date|                            |


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


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug c++/13146] inheritance for nonoverlapping_component_refs_p
       [not found] <bug-13146-1008@http.gcc.gnu.org/bugzilla/>
  2008-03-14 20:30 ` rguenth at gcc dot gnu dot org
  2008-03-15  0:29 ` dann at godzilla dot ics dot uci dot edu
@ 2008-03-15 12:29 ` rguenth at gcc dot gnu dot org
  2008-03-15 12:41 ` rguenth at gcc dot gnu dot org
  3 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-03-15 12:29 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from rguenth at gcc dot gnu dot org  2008-03-15 12:28 -------
Ah, indeed.  It was fixed by the patch for PR23094 that I had applied ;)
Maybe adjust this testcase to not be a dup of PR23094.


-- 


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


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug c++/13146] inheritance for nonoverlapping_component_refs_p
       [not found] <bug-13146-1008@http.gcc.gnu.org/bugzilla/>
  2008-03-14 20:30 ` rguenth at gcc dot gnu dot org
@ 2008-03-15  0:29 ` dann at godzilla dot ics dot uci dot edu
  2008-03-15 12:29 ` rguenth at gcc dot gnu dot org
  2008-03-15 12:41 ` rguenth at gcc dot gnu dot org
  3 siblings, 0 replies; 11+ messages in thread
From: dann at godzilla dot ics dot uci dot edu @ 2008-03-15  0:29 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from dann at godzilla dot ics dot uci dot edu  2008-03-15 00:28 -------
(In reply to comment #7)
> The testcase is fixed by the SCCVN alias-oracle patch.

Are you sure? I still see the problem (.final_cleanup dump):

void bar(first*, multi*) (s1, s3)
{
<bb 2>:
  s1->f1 = 0;
  s3->f3 = 0;
  s1->f1 = s1->f1 + 1;
  s3->f3 = s3->f3 + 1;
  s1->f1 = s1->f1 + 1;
  s3->f3 = s3->f3 + 1;
  if (s1->f1 != 2)
    goto <bb 3>;
  else
    goto <bb 4>;
<bb 3>:
  link_error () [tail call];
<bb 4>:
  return;
}
void foo(first*, second*) (s1, s2)
{
<bb 2>:
  s1->f1 = 0;
  s2->f2 = 0;
  s1->f1 = s1->f1 + 1;
  s2->f2 = s2->f2 + 1;
  s1->f1 = s1->f1 + 1;
  s2->f2 = s2->f2 + 1;
  if (s1->f1 != 2)
    goto <bb 3>;
  else
    goto <bb 4>;
<bb 3>:
  link_error () [tail call];
<bb 4>:
  return;
}


-- 


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


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug c++/13146] inheritance for nonoverlapping_component_refs_p
       [not found] <bug-13146-1008@http.gcc.gnu.org/bugzilla/>
@ 2008-03-14 20:30 ` rguenth at gcc dot gnu dot org
  2008-03-15  0:29 ` dann at godzilla dot ics dot uci dot edu
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-03-14 20:30 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from rguenth at gcc dot gnu dot org  2008-03-14 20:30 -------
The testcase is fixed by the SCCVN alias-oracle patch.  I don't see how
BINFOs should be needed here - if the MEM_REFs are still there the
disambiguation can happen based on the member offsets, no?


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rguenth at gcc dot gnu dot
                   |                            |org


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


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2008-03-15 12:41 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-11-20 22:24 [Bug c++/13146] New: inheritance for nonoverlapping_component_refs_p dann at godzilla dot ics dot uci dot edu
2003-11-25  1:00 ` [Bug c++/13146] " pinskia at gcc dot gnu dot org
2003-12-26  3:00 ` pinskia at gcc dot gnu dot org
2004-01-19 21:28 ` dhazeghi at yahoo dot com
2004-07-03  2:37 ` giovannibajo at libero dot it
2004-10-28 20:23 ` dnovillo at gcc dot gnu dot org
2005-01-27  2:17 ` pinskia at gcc dot gnu dot org
     [not found] <bug-13146-1008@http.gcc.gnu.org/bugzilla/>
2008-03-14 20:30 ` rguenth at gcc dot gnu dot org
2008-03-15  0:29 ` dann at godzilla dot ics dot uci dot edu
2008-03-15 12:29 ` rguenth at gcc dot gnu dot org
2008-03-15 12:41 ` rguenth at gcc dot gnu dot org

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).