commit | be29ad9c7b1341fcfc3340ff3b8183b4f4112cf1 | [log] [tgz] |
---|---|---|
author | Prashanth Swaminathan <prashanthsw@google.com> | Tue Feb 02 22:16:29 2021 -0800 |
committer | CQ Bot Account <pigweed-scoped@luci-project-accounts.iam.gserviceaccount.com> | Wed Feb 03 17:10:36 2021 +0000 |
tree | 3fa9973fb2e261af5df7c41bf6474d0eae2fc38e | |
parent | 792543049b8a4508004623dbc43accf277a909bc [diff] |
pw_minimal_cpp_stdlib: Fix array alignment in test Resolves static analyzer complaint by explicitly aligning placement new target with size of target value. Change-Id: I7eeed048185bb3886138b760f5f888cd39fa6c46 Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/31680 Reviewed-by: Keir Mierle <keir@google.com> Commit-Queue: Prashanth Swaminathan <prashanthsw@google.com>
diff --git a/pw_minimal_cpp_stdlib/isolated_test.cc b/pw_minimal_cpp_stdlib/isolated_test.cc index 4f90a82..1be9662 100644 --- a/pw_minimal_cpp_stdlib/isolated_test.cc +++ b/pw_minimal_cpp_stdlib/isolated_test.cc
@@ -252,7 +252,7 @@ } TEST(New, PlacementNew) { - unsigned char value[4]; + alignas(sizeof(int)) unsigned char value[sizeof(int)]; new (value) int(1234); int int_value;