[prev in list] [next in list] [prev in thread] [next in thread] 

List:       cfe-commits
Subject:    Re: [cfe-commits] [PATCH] Fixes for unintended fall-through bugs (-Wimplicit-fallthrough)
From:       Richard Smith <richard () metafoo ! co ! uk>
Date:       2012-05-31 23:47:20
Message-ID: CAOfiQqmqttQyy53rW17gvigPtymQ_PHgPwa0VFXTDYR=RhJtzw () mail ! gmail ! com
[Download RAW message or body]

On Mon, May 28, 2012, at 8:08PM, Alexander Kornienko <alexfh@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;
   }
   default:
     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")));
_______________________________________________
cfe-commits mailing list
cfe-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic