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

Re: C++ PATCH: fix PR 28687


Gabriel Dos Reis wrote:
Benjamin Smedberg <benjamin@smedbergs.us> writes:

| Previously the construct dynamic_cast<void*> worked even when RTTI was
| disabled, and was useful in Mozilla logging code. PR10891 changed this
| behavior so that dynamic_cast is forbidden unconditionally when -fno-rtti is
| used.

That assertion is untrue. The documentation for -fno-rtti is clear
about the dynamic_cast. If -fno-rtti, you can't meaningfully do
dynamic_cast<void*>.

Which one? That it worked previously is a statement of fact, not really disputable. Mozilla logging code would be a shambles if this were not the case.


That it continues to work is a matter of logic and code examination. The code in question is in build_headof() in rtti.c: the offset from a pointer to the most-derived class pointer is contained in the vtable in position -2. No RTTI symbol lookups are performed during this process.

--BDS


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