Hello!

The testcase fails with:

FAIL: g++.dg/pr83239.C  -std=gnu++11  scan-tree-dump-not optimized
"_ZNSt6vectorIiSaIiEE17_M_default_appendEm"
FAIL: g++.dg/pr83239.C  -std=gnu++14  scan-tree-dump-not optimized
"_ZNSt6vectorIiSaIiEE17_M_default_appendEm"

the test depends on _M_default_append to be inlined, so it verifies
the inlining with:

// Verify that std::vector<T>::_M_default_append() has been inlined
// (the absence of warnings depends on it).
// { dg-final { scan-tree-dump-not
"_ZNSt6vectorIiSaIiEE17_M_default_appendEm"  optimized } }
// { dg-final { scan-tree-dump-not
"_ZNSt6vectorIPvSaIS0_EE17_M_default_appendEm" optimized } }

However, this is not the case with the default -finline-limit, so
raise it to 500 (the same approach is taken in g++.dg/
tree-ssa/copyprop.C).

Unfortunately, the fixed testcase exposes some issue with -std=gnu++98:

FAIL: g++.dg/pr83239.C  -std=gnu++98 (test for excess errors)

In function 'void test_loop() [with T = int]':
cc1plus: warning: 'void* __builtin_memset(void*, int, long unsigned
int)' specified size 18446744073709551608 exceeds maximum object size
9223372036854775807 [-Wstringop-overflow=]
In function 'void test_if(std::vector<T>&, int) [with T = long int]':
cc1plus: warning: 'void* __builtin_memset(void*, int, long unsigned
int)' specified size 18446744073709551600 exceeds maximum object size
9223372036854775807 [-Wstringop-overflow=]

2018-08-01  Uros Bizjak  <ubiz...@gmail.com>

    PR testsuite/86153
    * g++.dg/pr83239.C (dg-options): Add -finline-limit=500.

OK for mainline and gcc-8 branch?

Uros.
Index: g++.dg/pr83239.C
===================================================================
--- g++.dg/pr83239.C    (revision 263193)
+++ g++.dg/pr83239.C    (working copy)
@@ -1,7 +1,7 @@
 // PR tree-optimization/83239 - False positive from -Wstringop-overflow
 // on simple std::vector code
 // { dg-do compile }
-// { dg-options "-O3 -Wall -fdump-tree-optimized"  }
+// { dg-options "-O3 -finline-limit=500 -Wall -fdump-tree-optimized"  }
 
 #include <vector>
 

Reply via email to