This is an archive of the discontinued LLVM Phabricator instance.

[Bugfix] Disallow declarations of named types in parameter lists of overloadable functions in C
Needs ReviewPublic

Authored by george.burgess.iv on Dec 17 2015, 11:30 AM.
This revision needs review, but there are no reviewers specified.

Details

Reviewers
None
Summary

This keeps the ICE in https://llvm.org/bugs/show_bug.cgi?id=25836 from happening. Long story short, the following C code will make clang overflow its stack:

int Foo(struct A*) __attribute__((overloadable)) {}

...Because the mangling of struct A (which is declared inside of Foo, and therefore nested in Foo) depends on the mangling of Foo, and the mangling of Foo depends on the mangling of struct A. It's a vicious cycle.

This patch fixes the ICE by simply not allowing the user to declare new named types in the parameter list of an overloadable function.

If no one wants to pick this up, I'll find a victim at some point. :)

Diff Detail

Event Timeline

george.burgess.iv retitled this revision from to [Bugfix] Disallow declarations of named types in parameter lists of overloadable functions in C.
george.burgess.iv updated this object.
george.burgess.iv updated this object.
george.burgess.iv added a subscriber: cfe-commits.