]> granicus.if.org Git - clang/commit
[Sema] Issue a warning for integer overflow in nested struct initializer
authorAkira Hatanaka <ahatanaka@apple.com>
Wed, 10 Feb 2016 06:06:06 +0000 (06:06 +0000)
committerAkira Hatanaka <ahatanaka@apple.com>
Wed, 10 Feb 2016 06:06:06 +0000 (06:06 +0000)
commit3d46479781659e5844a87d0c84952af392aada3a
treea3928c136b1bdb74ddb23981eeda78ddbbd2c99a
parentd11f267f9deb7c338401a150c32e0e36a8b62870
[Sema] Issue a warning for integer overflow in nested struct initializer

r257357 fixed clang to warn on integer overflow in struct initializers.
However, it didn't warn when a struct had a nested initializer. This
commit makes changes in Sema::CheckForIntOverflow to handle nested
initializers.

For example:

struct s {
  struct t {
    unsigned x;
  } t;
} s = {
  {
    .x = 4 * 1024 * 1024 * 1024
  }
};

rdar://problem/23526454

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@260360 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Sema/SemaChecking.cpp
test/Sema/integer-overflow.c