public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/107295] [13 Regression] Rejected code in libreoffice with -m32 since r13-3290-g98e341130f87984a
Date: Fri, 21 Oct 2022 16:07:54 +0000	[thread overview]
Message-ID: <bug-107295-4-ljJ6aNko4E@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-107295-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:2cc41601d9a948e8d612a21c3b9a44ce0b977747

commit r13-3438-g2cc41601d9a948e8d612a21c3b9a44ce0b977747
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Fri Oct 21 18:04:54 2022 +0200

    c++: Don't shortcut TREE_CONSTANT vector type CONSTRUCTORs in
cxx_eval_constant_expression [PR107295]

    The excess precision support broke building skia (dependency of firefox)
    on ia32 (it has something like the a constexpr variable), but as the other
    cases show, it is actually a preexisting problem if one uses casts from
    constants with wider floating point types.
    The problem is that cxx_eval_constant_expression tries to short-cut
    processing of TREE_CONSTANT CONSTRUCTORs if they satisfy
    reduced_constant_expression_p - instead of calling cxx_eval_bare_aggregate
    on them it just verifies flags and if they are TREE_CONSTANT even after
    that, just fold.
    Now, on the testcase we have a TREE_CONSTANT CONSTRUCTOR containing
    TREE_CONSTANT NOP_EXPR of REAL_CST.  And, fold, which isn't recursive,
    doesn't optimize that into VECTOR_CST, while later on we are only able
    to optimize VECTOR_CST arithmetics, not arithmetics with vector
    CONSTRUCTORs.
    The following patch fixes that by rejecting CONSTRUCTORs with vector type
    in reduced_constant_expression_p regardless of whether they have
    CONSTRUCTOR_NO_CLEARING set or not, folding result in
cxx_eval_bare_aggregate
    even if nothing has changed but it wasn't non-constant and removing folding
    from the TREE_CONSTANT reduced_constant_expression_p short-cut.

    2022-10-21  Jakub Jelinek  <jakub@redhat.com>

            PR c++/107295
            * constexpr.cc (reduced_constant_expression_p) <case CONSTRUCTOR>:
            Return false for VECTOR_TYPE CONSTRUCTORs even without
            CONSTRUCTOR_NO_CLEARING set on them.
            (cxx_eval_bare_aggregate): If constant but !changed, fold before
            returning VECTOR_TYPE_P CONSTRUCTOR.
            (cxx_eval_constant_expression) <case CONSTRUCTOR>: Don't fold
            TREE_CONSTANT CONSTRUCTOR, just return it.

            * g++.dg/ext/vector42.C: New test.

  parent reply	other threads:[~2022-10-21 16:07 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-17 12:59 [Bug c++/107295] New: " marxin at gcc dot gnu.org
2022-10-17 12:59 ` [Bug c++/107295] " marxin at gcc dot gnu.org
2022-10-17 13:19 ` jakub at gcc dot gnu.org
2022-10-17 13:19 ` jakub at gcc dot gnu.org
2022-10-17 13:30 ` marxin at gcc dot gnu.org
2022-10-18  7:55 ` rguenth at gcc dot gnu.org
2022-10-18 10:03 ` jakub at gcc dot gnu.org
2022-10-18 10:55 ` jakub at gcc dot gnu.org
2022-10-21 16:07 ` cvs-commit at gcc dot gnu.org [this message]
2022-10-21 16:09 ` jakub at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-107295-4-ljJ6aNko4E@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).