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] Redirect calls to non-functions to builtin_unreachable


Hi,

On Thu, Jun 20, 2013 at 05:46:28PM +0200, Martin Jambor wrote:
> On Thu, Jun 20, 2013 at 03:47:11PM +0100, Marcus Shawcroft wrote:
> > Hi,  I've been looking at an issue in mysql compilation which appears
> > to be due to this patch.
> > 
> > On 10 May 2013 18:27, Martin Jambor <mjambor@suse.cz> wrote:
> > > Hi,
> > >
> > > as we discover targets of previously indirect calls in ipa-inline and
> > > ipa-cp, we sometimes figure out that the targets are not a function.
> > > One typical example is when NULL is passed as a function pointer
> > 
> > OK, this part makes sense to me.
> > 
> > > parameter, another is when C++ member-pointer points to a virtual
> > > function and the overloaded field of the structure which can also hold
> > > pointers to non-virtual methods contains odd integer constants.
> > 
> > I'm struggling to understand why such a member-pointer call would be
> > illegal in a well formed program.
> > 
> > Attached is a fragment of code that demonstrates the issue I've been
> > looking at.  When compiled at -O3 the 047i.inline dump tells me that:
> > 
> > ipa-prop: Discovered direct call to non-function in unsigned int
> > A::foo(unsigned int (H::*)() const) const/11, making it unreachable.
> >   not inlinable: unsigned int A::foo(unsigned int (H::*)() const)
> > const/11 -> void __builtin_unreachable()/12, function body not
> > available
> > 
> > This behavior appears to be the explicit intent of the original patch,
> > the call to the member function pointer has been replaced with
> > __builtin_unreachable, but that looks like a legitimate  call to me.
> > What am I missing?
> 
> Hm, the reason why I did this was that I misremembered that each
> branch, the one for virtual calls and the one for direct calls.  But
> when I checked dumps, I realized it was not so, there is only one call
> when the branches join.  I'll fix this promptly.
> 
> Thanks for the report,

For the record, this is PR 57670.

Martin


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