LWG 3035. std::allocator's constructors should be constexpr
[official-gcc.git] / gcc / testsuite / gcc.dg / tree-prof / section-attr-3.c
blob36829dcb7a0e4590ba1a46917afbcce6843378bb
1 /* Checks for a bug where static data with a section attribute within a
2 function would stop the function being partitioned into hot and cold
3 blocks. */
4 /* { dg-require-effective-target freorder } */
5 /* { dg-options "-O2 -fno-profile-reorder-functions -freorder-blocks-and-partition -save-temps" } */
7 #define SIZE 10000
9 #define NOINLINE __attribute__((noinline)) __attribute__ ((noclone))
11 const char *sarr[SIZE];
12 const char *buf_hot __attribute__ ((section (".data")));
13 const char *buf_cold;
15 void foo (int path);
17 int
18 main (int argc, char *argv[])
20 int i;
21 buf_hot = "hello";
22 buf_cold = "world";
23 for (i = 0; i < 1000000; i++)
24 foo (argc);
25 return 0;
29 void NOINLINE
30 foo (int path)
32 int i;
33 if (path)
35 for (i = 0; i < SIZE; i++)
36 sarr[i] = buf_hot;
38 else
40 for (i = 0; i < SIZE; i++)
41 sarr[i] = buf_cold;
45 /* { dg-final-use { scan-assembler "\.section\[\t \]*\.text\.unlikely\[\\n\\r\]+\[\t \]*\.size\[\t \]*foo\.cold\.0" { target *-*-linux* *-*-gnu* } } } */