[cfe-dev] Can we diagnose this?

Richard Smith richard at metafoo.co.uk
Sat Feb 23 21:48:19 PST 2013


This is PR9619 and duplicates. There are really two problems here: we allow
arbitrarily complex types to be created then hit a stack overflow when
processing them, and we don't restrict the depth of operator-> chains we
will follow (except when there is a cycle).
On 23 Feb 2013 20:56, "Sean Silva" <silvas at purdue.edu> wrote:

> Slide 11 of <http://miek.nl/downloads/2010/c++-talk.pdf> shows the
> following code as sending the compiler into an infloop:
>
> template<class T> struct Loop { Loop<T*> operator->(); };
> Loop<int> i, j = i->hooray;
>
> I just verified that clang does go into an infloop for this and
> clang's resident memory starts growing without bound. Is there some
> way for us to detect this and properly diagnose?
>
> Also, I'll file a PR to track this unless somebody knows if we already
> have a PR for it or we deliberately don't do anything about this
> behavior.
>
> -- Sean Silva
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130223/8e322507/attachment.html>


More information about the cfe-dev mailing list