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: [PATCH, PR 60640] When creating virtual clones, clone thunks too


On 04/04/2014 04:05 PM, Jan Hubicka wrote:
Ah, yes, it is what I was discussing this with Jason, but apparently the
discussion died out.  According to his comment __cxa_pure_virtual is a
synonym for undefined behaviour so it may be correct to unconditionally
devirtualize here (changing runtime behaviour from terminate() to random method
call), but at the moment we don't do that.  Somewhere back in my head I have
burned in from C++ lessons that calling pure virtual method should result in
terminate () call, so I am considering __cxa_pure_virtual to be legitimate call
target (as opposed to any non-function or __builtin_unreachable that I drop
from the list).

I would be happy to change this behaviour, since there are quite few extra
cases where we could devirtualize well then.

It's definitely undefined.

10.4/6:

Member functions can be called from a constructor (or destructor) of an abstract class; the effect of making a virtual call (10.3) to a pure virtual function directly or indirectly for the object being created (or destroyed) from such a constructor (or destructor) is undefined.

Jason


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