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 c++/11376] [3.3/3.4 regression] mozilla-1.4 miscompiled


PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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



------- Additional Comments From kevin dot hendricks at sympatico dot ca  2003-07-07 16:11 -------
Subject: Re:  [3.3/3.4 regression] mozilla-1.4 miscompiled

Hi,

This is basically what my first shot at a simpler test program looked like but 
I could never recreate the problem with code like this and ended up having to 
pull in the nsCOMPtr template and related support code to recreate the 
problem.

I will try building this case up to see if it can recreate with this approach.

Kevin

 > This function calls begin_assignment which casts &mRawPtr (whose type is
> nsiSupports**) to void** through reinterpret_cast. Then, this void** is
> casted to mc0** through reinterpret_cast. Now, mc0 is derived from
> nsiSupports. In short, this looks like:
>
> struct A {};
> struct B : A {};
> A* a;
>
> void** pv = reinterpret_cast<void**>(&a);
> B** pb = reinterpret_cast<B**>(pv);
> *pb = new B;
> assert (typeid(*a) == typeid(B));
>
> I believe this violates ISO C++ aliasing rules, but I don't have a standard
> handy to double-check now.
>
> Kevin, can you please confirm that my snippet follows the code correctly?
> Nathan, do you think the code is legal?
>
>
>
>
> ------- You are receiving this mail because: -------
> You are on the CC list for the bug, or are watching someone who is.


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