This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/21407] [4.1 Regression] wrong code with upcast in C++
- From: "giovannibajo at libero dot it" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 10 May 2005 13:16:23 -0000
- Subject: [Bug tree-optimization/21407] [4.1 Regression] wrong code with upcast in C++
- References: <20050506002331.21407.pinskia@gcc.gnu.org>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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