diff options
author | Aliaksey Kandratsenka <alk@tut.by> | 2015-08-01 20:54:39 -0700 |
---|---|---|
committer | Aliaksey Kandratsenka <alk@tut.by> | 2015-08-02 17:25:13 -0700 |
commit | eb725ff26371dfb5ae2523802c6abe75833cacef (patch) | |
tree | 932fdd3286ec0892f2bea72bf0b2d0aca9a77609 | |
parent | 53833298f3822b2b8b78c9dc85160d65d78a6857 (diff) | |
download | gperftools-eb725ff26371dfb5ae2523802c6abe75833cacef.tar.gz |
unbreak heap-profiler-unittest on gcc 5
gcc 5 has got nice new optimization (-fipa-icf) which merges identical
functions into one. And that causes heap-profiler_unittest to fail
since it expects to see both Allocate and Allocate2 in heap
profiles. And smart GCC detects that they are same function and makes
one function out of two and thus breaks this test.
New code simply adds (disabled) logging calls to make those functions
non-identical.
-rw-r--r-- | src/tests/heap-profiler_unittest.cc | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/tests/heap-profiler_unittest.cc b/src/tests/heap-profiler_unittest.cc index c71e56b..3317813 100644 --- a/src/tests/heap-profiler_unittest.cc +++ b/src/tests/heap-profiler_unittest.cc @@ -58,6 +58,9 @@ static const int kMaxCount = 100000; int* g_array[kMaxCount]; // an array of int-vectors static ATTRIBUTE_NOINLINE void Allocate(int start, int end, int size) { + // NOTE: we're using this to prevent gcc 5 from merging otherwise + // identical Allocate & Allocate2 functions. + VLOG(10, "Allocate"); for (int i = start; i < end; ++i) { if (i < kMaxCount) g_array[i] = new int[size]; @@ -65,6 +68,7 @@ static ATTRIBUTE_NOINLINE void Allocate(int start, int end, int size) { } static ATTRIBUTE_NOINLINE void Allocate2(int start, int end, int size) { + VLOG(10, "Allocate2"); for (int i = start; i < end; ++i) { if (i < kMaxCount) g_array[i] = new int[size]; |