This is the mail archive of the gcc-bugs@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]

[Bug tree-optimization/21407] [4.1 Regression] wrong code with upcast in C++


------- Additional Comments From giovannibajo at libero dot it  2005-05-10 13:16 -------
So what about this, in C:

-------------------------------
struct A
{
  int a;
};

struct B
{
  struct A sa;
  int b;
};

void foo1(void* ptr)
{
  ((struct A*)ptr)->a = 0;
}

void foo2(void* ptr)
{
  ((struct B*)ptr)->b = 0;
}

void bar(void)
{
  struct B sb;
  foo1(&sb);
  foo2(&sb.sa);
  foo1(&sb);
  foo2(&sb.sa);
}
-------------------------------

What is valid C and what is invalid C?


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


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


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