[cfe-commits] [PATCH] Fixes for unintended fall-through bugs (-Wimplicit-fallthrough)

Richard Smith richard at metafoo.co.uk
Thu May 31 16:47:20 PDT 2012

On Mon, May 28, 2012, at 8:08PM, Alexander Kornienko <alexfh at google.com> wrote:
> I've put aside header changes for now. There are patches with bug fixes (at
> least, those seem to be bugs to me) and a patch with LLVM_FALLTHROUGH macro.
> Please, take a look at these. Thanks!

Looking at fallthrough-bugs-clang.diff:

--- tools/clang/lib/Sema/SemaDeclAttr.cpp	(revision 157508)
+++ tools/clang/lib/Sema/SemaDeclAttr.cpp	(working copy)
@@ -3342,6 +3342,7 @@

     D->addAttr(::new (S.Context) PcsAttr(Attr.getRange(), S.Context, PCS));
+    return;
     llvm_unreachable("unexpected attribute kind");

Thanks for spotting this. The problem here goes deeper than a simple
missing 'return': this code is not reached at all for the AT_pcs
attribute. The following crashes clang (with or without this change):

int f() __attribute__((pcs("something")));

More information about the cfe-commits mailing list