public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/114888] New: ICE when cross compiling binutils
@ 2024-04-29 12:09 lordrasmus at gmail dot com
  2024-04-29 13:41 ` [Bug c++/114888] " jakub at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: lordrasmus at gmail dot com @ 2024-04-29 12:09 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 114888
           Summary: ICE when cross compiling binutils
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: lordrasmus at gmail dot com
  Target Milestone: ---

Created attachment 58071
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=58071&action=edit
aarch64.i

compiling binutils fails on Fedora 40

binutils was configured like this

../binutils-2.28/configure '--build=x86_64-build_pc-linux-gnu'
'--host=x86_64-build_pc-linux-gnu' '--target=arm-bbs-linux-gnueabihf'
'--disable-werror' '--enable-ld=default' '--enable-gold=yes' '--enable-threads'
'--enable-plugins' '--with-pkgversion=crosstool-NG ' '--disable-multilib'
'--with-float=hard'


i have build gcc from source and compiled the failed file

here ist the output

../../binutils-2.28/gold/aarch64.cc: In constructor
‘{anonymous}::Stub_template_repertoire<big_endian>::Stub_template_repertoire()’:
../../binutils-2.28/gold/aarch64.cc:800:141: internal compiler error: in
comptypes, at cp/typeck.cc:1681
0x7ca470 comptypes(tree_node*, tree_node*, int)
        ../../gcc/gcc/cp/typeck.cc:1681
0xcaf094 cp_build_binary_op(op_location_t const&, tree_code, tree_node*,
tree_node*, int)
        ../../gcc/gcc/cp/typeck.cc:5505
0xa1a67b build_new_op(op_location_t const&, tree_code, int, tree_node*,
tree_node*, tree_node*, tree_node*, tree_node**, int)
        ../../gcc/gcc/cp/call.cc:7516
0xc9e710 build_x_binary_op(op_location_t const&, tree_code, tree_node*,
tree_code, tree_node*, tree_code, tree_node*, tree_node**, int)
        ../../gcc/gcc/cp/typeck.cc:4735
0xb9d700 cp_parser_binary_expression
        ../../gcc/gcc/cp/parser.cc:10579
0xb9e234 cp_parser_assignment_expression
        ../../gcc/gcc/cp/parser.cc:10737
0xb9f37d cp_parser_constant_expression
        ../../gcc/gcc/cp/parser.cc:11027
0xba0446 cp_parser_initializer_clause
        ../../gcc/gcc/cp/parser.cc:26144
0xb9fa81 cp_parser_initializer_list
        ../../gcc/gcc/cp/parser.cc:26439
0xb9fa81 cp_parser_braced_list
        ../../gcc/gcc/cp/parser.cc:26186
0xba04ac cp_parser_initializer_clause
        ../../gcc/gcc/cp/parser.cc:26149
0xba5214 cp_parser_initializer
        ../../gcc/gcc/cp/parser.cc:26083
0xbdb253 cp_parser_init_declarator
        ../../gcc/gcc/cp/parser.cc:23571
0xbaecb4 cp_parser_simple_declaration
        ../../gcc/gcc/cp/parser.cc:15900
0xbd4e60 cp_parser_declaration_statement
        ../../gcc/gcc/cp/parser.cc:14936
0xbdcd9e cp_parser_statement
        ../../gcc/gcc/cp/parser.cc:12892
0xbb1b97 cp_parser_statement_seq_opt
        ../../gcc/gcc/cp/parser.cc:13418
0xbb1dc7 cp_parser_compound_statement
        ../../gcc/gcc/cp/parser.cc:13272
0xbd4fd5 cp_parser_function_body
        ../../gcc/gcc/cp/parser.cc:25987
0xbd4fd5 cp_parser_ctor_initializer_opt_and_function_body
        ../../gcc/gcc/cp/parser.cc:26038

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

* [Bug c++/114888] ICE when cross compiling binutils
  2024-04-29 12:09 [Bug c++/114888] New: ICE when cross compiling binutils lordrasmus at gmail dot com
@ 2024-04-29 13:41 ` jakub at gcc dot gnu.org
  2024-04-29 13:59 ` [Bug c++/114888] [14 Regression] " jakub at gcc dot gnu.org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-04-29 13:41 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Reduced testcase:
template <typename> struct A {
  struct B {} *b;
  static const int c { sizeof (b) / sizeof (b[0]) };
};
A<int> c;
const int d = A<int>::c;

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

* [Bug c++/114888] [14 Regression] ICE when cross compiling binutils
  2024-04-29 12:09 [Bug c++/114888] New: ICE when cross compiling binutils lordrasmus at gmail dot com
  2024-04-29 13:41 ` [Bug c++/114888] " jakub at gcc dot gnu.org
@ 2024-04-29 13:59 ` jakub at gcc dot gnu.org
  2024-04-29 14:11 ` [Bug c++/114888] [14/15 " ppalka at gcc dot gnu.org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-04-29 13:59 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|ICE when cross compiling    |[14 Regression] ICE when
                   |binutils                    |cross compiling binutils
   Target Milestone|---                         |14.0
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
                 CC|                            |ppalka at gcc dot gnu.org
   Last reconfirmed|                            |2024-04-29

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Started with r14-4793-gdad311874ac3b3cf4eca1c04f67cae80c953f7b8

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

* [Bug c++/114888] [14/15 Regression] ICE when cross compiling binutils
  2024-04-29 12:09 [Bug c++/114888] New: ICE when cross compiling binutils lordrasmus at gmail dot com
  2024-04-29 13:41 ` [Bug c++/114888] " jakub at gcc dot gnu.org
  2024-04-29 13:59 ` [Bug c++/114888] [14 Regression] " jakub at gcc dot gnu.org
@ 2024-04-29 14:11 ` ppalka at gcc dot gnu.org
  2024-04-29 14:13 ` jakub at gcc dot gnu.org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: ppalka at gcc dot gnu.org @ 2024-04-29 14:11 UTC (permalink / raw)
  To: gcc-bugs

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

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[14 Regression] ICE when    |[14/15 Regression] ICE when
                   |cross compiling binutils    |cross compiling binutils
           Keywords|                            |ice-checking,
                   |                            |ice-on-valid-code
           Assignee|unassigned at gcc dot gnu.org      |ppalka at gcc dot gnu.org
             Status|NEW                         |ASSIGNED

--- Comment #3 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Seems we're missing a dependence check in the sizeof / sizeof code:

diff --git a/gcc/cp/typeck.cc b/gcc/cp/typeck.cc
index e5a52dc2b39..284f6e29e36 100644
--- a/gcc/cp/typeck.cc
+++ b/gcc/cp/typeck.cc
@@ -5500,7 +5500,7 @@ cp_build_binary_op (const op_location_t &location,
            type0 = TREE_TYPE (type0);
          if (!TYPE_P (type1))
            type1 = TREE_TYPE (type1);
-         if (type0
+         if (type0 && type1
              && INDIRECT_TYPE_P (type0)
              && same_type_p (TREE_TYPE (type0), type1))
            {

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

* [Bug c++/114888] [14/15 Regression] ICE when cross compiling binutils
  2024-04-29 12:09 [Bug c++/114888] New: ICE when cross compiling binutils lordrasmus at gmail dot com
                   ` (2 preceding siblings ...)
  2024-04-29 14:11 ` [Bug c++/114888] [14/15 " ppalka at gcc dot gnu.org
@ 2024-04-29 14:13 ` jakub at gcc dot gnu.org
  2024-04-29 14:18 ` jakub at gcc dot gnu.org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-04-29 14:13 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to Patrick Palka from comment #3)
> Seems we're missing a dependence check in the sizeof / sizeof code:
> 
> diff --git a/gcc/cp/typeck.cc b/gcc/cp/typeck.cc
> index e5a52dc2b39..284f6e29e36 100644
> --- a/gcc/cp/typeck.cc
> +++ b/gcc/cp/typeck.cc
> @@ -5500,7 +5500,7 @@ cp_build_binary_op (const op_location_t &location,
>             type0 = TREE_TYPE (type0);
>           if (!TYPE_P (type1))
>             type1 = TREE_TYPE (type1);
> -         if (type0
> +         if (type0 && type1
>               && INDIRECT_TYPE_P (type0)
>               && same_type_p (TREE_TYPE (type0), type1))
>             {

Yeah, I was about to suggest that too (just with && on a separate line.
I wonder if TREE_TYPE (type0) could be NULL even when type0 is INDIRECT_TYPE_P,
if yes,
we should be testing also && TREE_TYPE (type0) after the INDIRECT_TYPE_P check.

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

* [Bug c++/114888] [14/15 Regression] ICE when cross compiling binutils
  2024-04-29 12:09 [Bug c++/114888] New: ICE when cross compiling binutils lordrasmus at gmail dot com
                   ` (3 preceding siblings ...)
  2024-04-29 14:13 ` jakub at gcc dot gnu.org
@ 2024-04-29 14:18 ` jakub at gcc dot gnu.org
  2024-04-29 14:23 ` ppalka at gcc dot gnu.org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-04-29 14:18 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Though, I think both build_pointer_type and build_reference_type would segfault
if it was called on NULL_TREE to_type, and I don't see any spot in the FE that
would create pointer/reference types without those routines.  SO I think just
&& type1 should be right.

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

* [Bug c++/114888] [14/15 Regression] ICE when cross compiling binutils
  2024-04-29 12:09 [Bug c++/114888] New: ICE when cross compiling binutils lordrasmus at gmail dot com
                   ` (4 preceding siblings ...)
  2024-04-29 14:18 ` jakub at gcc dot gnu.org
@ 2024-04-29 14:23 ` ppalka at gcc dot gnu.org
  2024-04-30  1:14 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: ppalka at gcc dot gnu.org @ 2024-04-29 14:23 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Yeah I think the TREE_TYPE of a compound type should never be null, at least as
far as type dependence is concerned.

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

* [Bug c++/114888] [14/15 Regression] ICE when cross compiling binutils
  2024-04-29 12:09 [Bug c++/114888] New: ICE when cross compiling binutils lordrasmus at gmail dot com
                   ` (5 preceding siblings ...)
  2024-04-29 14:23 ` ppalka at gcc dot gnu.org
@ 2024-04-30  1:14 ` cvs-commit at gcc dot gnu.org
  2024-04-30  1:21 ` cvs-commit at gcc dot gnu.org
  2024-04-30  1:21 ` ppalka at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-04-30  1:14 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Patrick Palka <ppalka@gcc.gnu.org>:

https://gcc.gnu.org/g:3900e944b0ac9db77380c5bb8635977dfd3b0691

commit r15-56-g3900e944b0ac9db77380c5bb8635977dfd3b0691
Author: Patrick Palka <ppalka@redhat.com>
Date:   Mon Apr 29 21:14:18 2024 -0400

    c++: ICE with templated sizeof(E1) / sizeof(E2) [PR114888]

    In the sizeof / sizeof operator expression handling we're missing
    a dependence check for the second operand.

            PR c++/114888

    gcc/cp/ChangeLog:

            * typeck.cc (cp_build_binary_op) <case *_DIV_*>: Add missing
            dependence check for the second sizeof operand.

    gcc/testsuite/ChangeLog:

            * g++.dg/template/sizeof19.C: New test.

    Reviewed-by: Jason Merrill <jason@redhat.com>

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

* [Bug c++/114888] [14/15 Regression] ICE when cross compiling binutils
  2024-04-29 12:09 [Bug c++/114888] New: ICE when cross compiling binutils lordrasmus at gmail dot com
                   ` (6 preceding siblings ...)
  2024-04-30  1:14 ` cvs-commit at gcc dot gnu.org
@ 2024-04-30  1:21 ` cvs-commit at gcc dot gnu.org
  2024-04-30  1:21 ` ppalka at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-04-30  1:21 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-14 branch has been updated by Patrick Palka
<ppalka@gcc.gnu.org>:

https://gcc.gnu.org/g:3c925ac349b03ae9439c632fb1c042cdc8d78f40

commit r14-10149-g3c925ac349b03ae9439c632fb1c042cdc8d78f40
Author: Patrick Palka <ppalka@redhat.com>
Date:   Mon Apr 29 21:14:18 2024 -0400

    c++: ICE with templated sizeof(E1) / sizeof(E2) [PR114888]

    In the sizeof / sizeof operator expression handling we're missing
    a dependence check for the second operand.

            PR c++/114888

    gcc/cp/ChangeLog:

            * typeck.cc (cp_build_binary_op) <case *_DIV_*>: Add missing
            dependence check for the second sizeof operand.

    gcc/testsuite/ChangeLog:

            * g++.dg/template/sizeof19.C: New test.

    Reviewed-by: Jason Merrill <jason@redhat.com>
    (cherry picked from commit 3900e944b0ac9db77380c5bb8635977dfd3b0691)

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

* [Bug c++/114888] [14/15 Regression] ICE when cross compiling binutils
  2024-04-29 12:09 [Bug c++/114888] New: ICE when cross compiling binutils lordrasmus at gmail dot com
                   ` (7 preceding siblings ...)
  2024-04-30  1:21 ` cvs-commit at gcc dot gnu.org
@ 2024-04-30  1:21 ` ppalka at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: ppalka at gcc dot gnu.org @ 2024-04-30  1:21 UTC (permalink / raw)
  To: gcc-bugs

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

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|ASSIGNED                    |RESOLVED

--- Comment #9 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Fixed.

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

end of thread, other threads:[~2024-04-30  1:21 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-29 12:09 [Bug c++/114888] New: ICE when cross compiling binutils lordrasmus at gmail dot com
2024-04-29 13:41 ` [Bug c++/114888] " jakub at gcc dot gnu.org
2024-04-29 13:59 ` [Bug c++/114888] [14 Regression] " jakub at gcc dot gnu.org
2024-04-29 14:11 ` [Bug c++/114888] [14/15 " ppalka at gcc dot gnu.org
2024-04-29 14:13 ` jakub at gcc dot gnu.org
2024-04-29 14:18 ` jakub at gcc dot gnu.org
2024-04-29 14:23 ` ppalka at gcc dot gnu.org
2024-04-30  1:14 ` cvs-commit at gcc dot gnu.org
2024-04-30  1:21 ` cvs-commit at gcc dot gnu.org
2024-04-30  1:21 ` ppalka 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).