[PATCH] D15621: [Bugfix] Disallow declarations of named types in parameter lists of overloadable functions in C

George Burgess IV via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 17 11:30:37 PST 2015


george.burgess.iv created this revision.
george.burgess.iv added a subscriber: cfe-commits.

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. See the bug for 

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

http://reviews.llvm.org/D15621

Files:
  include/clang/AST/Decl.h
  include/clang/Basic/AttrDocs.td
  include/clang/Sema/Sema.h
  lib/AST/ASTDumper.cpp
  lib/AST/Decl.cpp
  lib/Sema/SemaDecl.cpp
  test/CodeGen/overloadable.c
  test/Sema/overloadable.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D15621.43160.patch
Type: text/x-patch
Size: 8049 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20151217/ebbcea35/attachment-0001.bin>


More information about the cfe-commits mailing list