3 @@ -329,8 +329,16 @@ ctor_for_folding (tree decl)
5 /* Variables declared 'const' without an initializer
6 have zero as the initializer if they may not be
7 - overridden at link or run time. */
8 - if (!DECL_INITIAL (real_decl)
9 + overridden at link or run time.
11 + It is actually requirement for C++ compiler to optimize const variables
12 + consistently. As a GNU extension, do not enfore this rule for user defined
13 + weak variables, so we support interposition on:
14 + static const int dummy = 0;
15 + extern const int foo __attribute__((__weak__, __alias__("dummy")));
17 + if ((!DECL_INITIAL (real_decl)
18 + || (DECL_WEAK (decl) && !DECL_COMDAT (decl)))
19 && (DECL_EXTERNAL (decl) || decl_replaceable_p (decl)))
20 return error_mark_node;