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++/107383] [13 Regression] ICE in cp_build_binary_op, at cp/typeck.cc:6181 Date: Thu, 27 Oct 2022 08:27:32 +0000 [thread overview] Message-ID: <bug-107383-4-TrEjfuJKNC@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-107383-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107383 --- Comment #4 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:bfb7994a9fb0b10767d12b8d670c081014ad8b01 commit r13-3522-gbfb7994a9fb0b10767d12b8d670c081014ad8b01 Author: Jakub Jelinek <jakub@redhat.com> Date: Thu Oct 27 10:24:45 2022 +0200 c++: Fix excess precision related ICE on invalid binop [PR107382, PR107383] The following tests ICE in the gcc_assert (common); in cp_build_binary_op. I've missed that while for * common is set always, while for +, - and / it is in some cases not. If it is not, then if (!result_type && arithmetic_types_p && (shorten || common || short_compare)) condition is false, then the following if (may_need_excess_precision && (orig_type0 != type0 || orig_type1 != type1) && build_type == NULL_TREE) would fail the assertion there and if there wouldn't be excess precision, if (code == SPACESHIP_EXPR) would be false (for SPACESHIP_EXPR we always have build_type set like for other comparisons) and then trigger if (!result_type) { if (complain & tf_error) { binary_op_rich_location richloc (location, orig_op0, orig_op1, true); error_at (&richloc, "invalid operands of types %qT and %qT to binary %qO", TREE_TYPE (orig_op0), TREE_TYPE (orig_op1), code); } return error_mark_node; } So, if result_type is NULL, we don't really need to compute semantic_result_type because nothing will use it anyway and can get fall through into the error/return error_mark_node; case. 2022-10-27 Jakub Jelinek <jakub@redhat.com> PR c++/107382 PR c++/107383 * typeck.cc (cp_build_binary_op): Don't compute semantic_result_type if result_type is NULL. * g++.dg/diagnostic/bad-binary-ops2.C: New test.
next prev parent reply other threads:[~2022-10-27 8:27 UTC|newest] Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-10-24 17:55 [Bug c++/107383] New: " gscfq@t-online.de 2022-10-24 18:02 ` [Bug c++/107383] " pinskia at gcc dot gnu.org 2022-10-25 6:59 ` rguenth at gcc dot gnu.org 2022-10-25 18:03 ` jakub at gcc dot gnu.org 2022-10-25 18:07 ` jakub at gcc dot gnu.org 2022-10-27 8:27 ` cvs-commit at gcc dot gnu.org [this message] 2022-10-27 8:28 ` 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-107383-4-TrEjfuJKNC@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: linkBe 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).