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; 15+ 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] 15+ messages in thread

end of thread, other threads:[~2009-04-03 10:28 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-13146-1008@http.gcc.gnu.org/bugzilla/>
2008-03-14 20:30 ` [Bug c++/13146] inheritance for nonoverlapping_component_refs_p 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
2008-05-16 15:27 ` [Bug middle-end/13146] " rguenth at gcc dot gnu dot org
2009-01-17 12:59 ` rguenth at gcc dot gnu dot org
2009-01-17 16:03 ` rguenth at gcc dot gnu dot org
2009-04-03 10:28 ` rguenth at gcc dot gnu dot org
2009-04-03 10:28 ` rguenth at gcc dot gnu dot org
2003-11-20 22:24 [Bug c++/13146] New: " 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

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