public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/107382] New: [13 Regression] ICE in cp_common_type, at cp/typeck.cc:436
@ 2022-10-24 17:54 gscfq@t-online.de
  2022-10-24 18:04 ` [Bug c++/107382] " pinskia at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: gscfq@t-online.de @ 2022-10-24 17:54 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 107382
           Summary: [13 Regression] ICE in cp_common_type, at
                    cp/typeck.cc:436
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gscfq@t-online.de
  Target Milestone: ---

Started between 20221009 and 20221016, with -m16 or -m32 :


$ cat z1.cc
void f (float a, int* b) {
  a -= b;
}


$ gcc-13-20221023 -c z1.cc -m32 -std=c++11
z1.cc: In function 'void f(float, int*)':
z1.cc:2:8: internal compiler error: in cp_common_type, at cp/typeck.cc:436
    2 |   a -= b;
      |        ^
0x959f32 cp_common_type
        ../../gcc/cp/typeck.cc:434
0x96114d cp_build_binary_op(op_location_t const&, tree_code, tree_node*,
tree_node*, int)
        ../../gcc/cp/typeck.cc:6182
0x96a2cd cp_build_modify_expr(unsigned int, tree_node*, tree_code, tree_node*,
int)
        ../../gcc/cp/typeck.cc:9539
0x7a88e6 build_new_op(op_location_t const&, tree_code, int, tree_node*,
tree_node*, tree_node*, tree_node*, tree_node**, int)
        ../../gcc/cp/call.cc:7054
0x96afa8 build_x_modify_expr(unsigned int, tree_node*, tree_code, tree_node*,
tree_node*, int)
        ../../gcc/cp/typeck.cc:9746
0x8ac37c cp_parser_assignment_expression
        ../../gcc/cp/parser.cc:10468
0x8ad862 cp_parser_expression
        ../../gcc/cp/parser.cc:10597
0x8b0b27 cp_parser_expression_statement
        ../../gcc/cp/parser.cc:12702
0x8bd6d5 cp_parser_statement
        ../../gcc/cp/parser.cc:12491
0x8be724 cp_parser_statement_seq_opt
        ../../gcc/cp/parser.cc:12853
0x8be7df cp_parser_compound_statement
        ../../gcc/cp/parser.cc:12805
0x8de708 cp_parser_function_body
        ../../gcc/cp/parser.cc:25179
0x8de708 cp_parser_ctor_initializer_opt_and_function_body
        ../../gcc/cp/parser.cc:25230
0x8debc6 cp_parser_function_definition_after_declarator
        ../../gcc/cp/parser.cc:31387
0x8dfd49 cp_parser_function_definition_from_specifiers_and_declarator
        ../../gcc/cp/parser.cc:31304
0x8dfd49 cp_parser_init_declarator
        ../../gcc/cp/parser.cc:22633
0x8bb8a2 cp_parser_simple_declaration
        ../../gcc/cp/parser.cc:15284
0x8e5aa8 cp_parser_declaration
        ../../gcc/cp/parser.cc:14970
0x8e6480 cp_parser_translation_unit
        ../../gcc/cp/parser.cc:5076
0x8e6480 c_parse_file()
        ../../gcc/cp/parser.cc:48856

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/107382] [13 Regression] ICE in cp_common_type, at cp/typeck.cc:436
  2022-10-24 17:54 [Bug c++/107382] New: [13 Regression] ICE in cp_common_type, at cp/typeck.cc:436 gscfq@t-online.de
@ 2022-10-24 18:04 ` pinskia at gcc dot gnu.org
  2022-10-24 18:04 ` pinskia at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-10-24 18:04 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=107383

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Most likely very similar to PR 107383 on what introduced the bug and maybe even
the fix ...

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/107382] [13 Regression] ICE in cp_common_type, at cp/typeck.cc:436
  2022-10-24 17:54 [Bug c++/107382] New: [13 Regression] ICE in cp_common_type, at cp/typeck.cc:436 gscfq@t-online.de
  2022-10-24 18:04 ` [Bug c++/107382] " pinskia at gcc dot gnu.org
@ 2022-10-24 18:04 ` pinskia at gcc dot gnu.org
  2022-10-24 18:37 ` marxin at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-10-24 18:04 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |13.0

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/107382] [13 Regression] ICE in cp_common_type, at cp/typeck.cc:436
  2022-10-24 17:54 [Bug c++/107382] New: [13 Regression] ICE in cp_common_type, at cp/typeck.cc:436 gscfq@t-online.de
  2022-10-24 18:04 ` [Bug c++/107382] " pinskia at gcc dot gnu.org
  2022-10-24 18:04 ` pinskia at gcc dot gnu.org
@ 2022-10-24 18:37 ` marxin at gcc dot gnu.org
  2022-10-25  6:58 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: marxin at gcc dot gnu.org @ 2022-10-24 18:37 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org,
                   |                            |marxin at gcc dot gnu.org
   Last reconfirmed|                            |2022-10-24
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW

--- Comment #2 from Martin Liška <marxin at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #1)
> Most likely very similar to PR 107383 on what introduced the bug and maybe
> even the fix ...

Yes, started with very same revision r13-3290-g98e341130f87984a.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/107382] [13 Regression] ICE in cp_common_type, at cp/typeck.cc:436
  2022-10-24 17:54 [Bug c++/107382] New: [13 Regression] ICE in cp_common_type, at cp/typeck.cc:436 gscfq@t-online.de
                   ` (2 preceding siblings ...)
  2022-10-24 18:37 ` marxin at gcc dot gnu.org
@ 2022-10-25  6:58 ` rguenth 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
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-10-25  6:58 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P1

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/107382] [13 Regression] ICE in cp_common_type, at cp/typeck.cc:436
  2022-10-24 17:54 [Bug c++/107382] New: [13 Regression] ICE in cp_common_type, at cp/typeck.cc:436 gscfq@t-online.de
                   ` (3 preceding siblings ...)
  2022-10-25  6:58 ` rguenth 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
  5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-10-25 18:07 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |DUPLICATE
             Status|NEW                         |RESOLVED

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
The PR107383 fix fixes this too.

*** This bug has been marked as a duplicate of bug 107383 ***

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/107382] [13 Regression] ICE in cp_common_type, at cp/typeck.cc:436
  2022-10-24 17:54 [Bug c++/107382] New: [13 Regression] ICE in cp_common_type, at cp/typeck.cc:436 gscfq@t-online.de
                   ` (4 preceding siblings ...)
  2022-10-25 18:07 ` jakub at gcc dot gnu.org
@ 2022-10-27  8:27 ` cvs-commit at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-10-27  8:27 UTC (permalink / raw)
  To: gcc-bugs

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

--- 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.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-10-27  8:27 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-24 17:54 [Bug c++/107382] New: [13 Regression] ICE in cp_common_type, at cp/typeck.cc:436 gscfq@t-online.de
2022-10-24 18:04 ` [Bug c++/107382] " pinskia at gcc dot gnu.org
2022-10-24 18:04 ` pinskia at gcc dot gnu.org
2022-10-24 18:37 ` marxin at gcc dot gnu.org
2022-10-25  6:58 ` rguenth 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 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).