https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61144

Alexander Monakov <amonakov at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |amonakov at gcc dot gnu.org

--- Comment #25 from Alexander Monakov <amonakov at gcc dot gnu.org> ---
I have tried to bootstrap and regtest the patch (to be attached) that reflects
the latest comments on the mailing list (except the concern raised by Jan about
C++ optimization).  Unfortunately the patch regresses the following simple C++
testcase, not folding the conditional access to the constant (even at -O3), but
not emitting the constant either and thus causing an undefined reference at
link time.  Uncommenting the commented line allows folding but also emits the
definition of the static member, increasing .rodata size.

It seems odd to me that decl_replaceable_p(z::cst) is true, and that for
instance TREE_PUBLIC(z::cst) is true.  Any help here please?

struct z {
  static const int cst = 1;
};

// const int z::cst;

int foo(int cond)
{
  return cond ? z::cst : 0;
}

Reply via email to