public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/111934] New: ICE  internal compiler error: in discriminator_for_local_entity, at cp/mangle.cc:2065
@ 2023-10-23 12:09 vincenzo.innocente at cern dot ch
  2023-10-23 12:09 ` [Bug c++/111934] " vincenzo.innocente at cern dot ch
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: vincenzo.innocente at cern dot ch @ 2023-10-23 12:09 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 111934
           Summary: ICE  internal compiler error: in
                    discriminator_for_local_entity, at cp/mangle.cc:2065
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: vincenzo.innocente at cern dot ch
  Target Milestone: ---

#ifdef ICE
#include <iostream>
#endif

struct  Me {

  static Me & me() {
    thread_local auto me = std::make_unique_ptr<Me>();
    return *me;
  }

};


int main() {
  return 0;
}

c++ -O3 -Wall -pthread ice13.cpp
ice13.cpp: In static member function 'static Me& Me::me()':
ice13.cpp:8:33: error: 'make_unique_ptr' is not a member of 'std'
    8 |     thread_local auto me = std::make_unique_ptr<Me>();
      |                                 ^~~~~~~~~~~~~~~
ice13.cpp:8:51: error: expected primary-expression before '>' token
    8 |     thread_local auto me = std::make_unique_ptr<Me>();
      |                                                   ^
ice13.cpp:8:53: error: expected primary-expression before ')' token
    8 |     thread_local auto me = std::make_unique_ptr<Me>();
      |                                                     ^


======================================================================


ctest]$ c++ -O3 -Wall -pthread ice13.cpp -DICE
ice13.cpp: In static member function 'static Me& Me::me()':
ice13.cpp:8:33: error: 'make_unique_ptr' is not a member of 'std'
    8 |     thread_local auto me = std::make_unique_ptr<Me>();
      |                                 ^~~~~~~~~~~~~~~
ice13.cpp:8:51: error: expected primary-expression before '>' token
    8 |     thread_local auto me = std::make_unique_ptr<Me>();
      |                                                   ^
ice13.cpp:8:53: error: expected primary-expression before ')' token
    8 |     thread_local auto me = std::make_unique_ptr<Me>();
      |                                                     ^
ice13.cpp: At global scope:
ice13.cpp:8:23: internal compiler error: in discriminator_for_local_entity, at
cp/mangle.cc:2065
    8 |     thread_local auto me = std::make_unique_ptr<Me>();
      |                       ^~
0x7de25d discriminator_for_local_entity
        ../../gcc_src/gcc/cp/mangle.cc:2065
0xb92a4a write_local_name
        ../../gcc_src/gcc/cp/mangle.cc:2164
0xb92a4a write_name
        ../../gcc_src/gcc/cp/mangle.cc:1071
0xb94e46 write_encoding
        ../../gcc_src/gcc/cp/mangle.cc:864
0xb94f5b write_mangled_name
        ../../gcc_src/gcc/cp/mangle.cc:810
0xb95740 mangle_decl_string
        ../../gcc_src/gcc/cp/mangle.cc:4092
0xb9592a get_mangled_id
        ../../gcc_src/gcc/cp/mangle.cc:4113
0xb9592a mangle_decl(tree_node*)
        ../../gcc_src/gcc/cp/mangle.cc:4151
0x16512bd decl_assembler_name(tree_node*)
        ../../gcc_src/gcc/tree.cc:715
0xe4a329 symbol_table::insert_to_assembler_name_hash(symtab_node*, bool)
        ../../gcc_src/gcc/symtab.cc:175
0xe4a48c symbol_table::symtab_initialize_asm_name_hash()
        ../../gcc_src/gcc/symtab.cc:267
0xe4ae84 symbol_table::symtab_initialize_asm_name_hash()
        ../../gcc_src/gcc/symtab.cc:1078
0xe4ae84 symtab_node::get_for_asmname(tree_node const*)
        ../../gcc_src/gcc/symtab.cc:1066
0xe5fc61 handle_alias_pairs
        ../../gcc_src/gcc/cgraphunit.cc:1528
0xe64fa7 symbol_table::finalize_compilation_unit()
        ../../gcc_src/gcc/cgraphunit.cc:2541
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

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

* [Bug c++/111934] ICE  internal compiler error: in discriminator_for_local_entity, at cp/mangle.cc:2065
  2023-10-23 12:09 [Bug c++/111934] New: ICE internal compiler error: in discriminator_for_local_entity, at cp/mangle.cc:2065 vincenzo.innocente at cern dot ch
@ 2023-10-23 12:09 ` vincenzo.innocente at cern dot ch
  2023-10-23 17:14 ` pinskia at gcc dot gnu.org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: vincenzo.innocente at cern dot ch @ 2023-10-23 12:09 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from vincenzo Innocente <vincenzo.innocente at cern dot ch> ---
sorry missed the version

gcc version 14.0.0 20231021 (experimental) [master r14-4817-g405a4140fc3] (GCC)

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

* [Bug c++/111934] ICE  internal compiler error: in discriminator_for_local_entity, at cp/mangle.cc:2065
  2023-10-23 12:09 [Bug c++/111934] New: ICE internal compiler error: in discriminator_for_local_entity, at cp/mangle.cc:2065 vincenzo.innocente at cern dot ch
  2023-10-23 12:09 ` [Bug c++/111934] " vincenzo.innocente at cern dot ch
@ 2023-10-23 17:14 ` pinskia at gcc dot gnu.org
  2023-10-24  9:31 ` vincenzo.innocente at cern dot ch
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-10-23 17:14 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Could not reproduce it with r14-4823-g8abddb187b33480d8827f44ec655f45734a1749d
.

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

* [Bug c++/111934] ICE  internal compiler error: in discriminator_for_local_entity, at cp/mangle.cc:2065
  2023-10-23 12:09 [Bug c++/111934] New: ICE internal compiler error: in discriminator_for_local_entity, at cp/mangle.cc:2065 vincenzo.innocente at cern dot ch
  2023-10-23 12:09 ` [Bug c++/111934] " vincenzo.innocente at cern dot ch
  2023-10-23 17:14 ` pinskia at gcc dot gnu.org
@ 2023-10-24  9:31 ` vincenzo.innocente at cern dot ch
  2023-11-12 23:33 ` pinskia at gcc dot gnu.org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: vincenzo.innocente at cern dot ch @ 2023-10-24  9:31 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from vincenzo Innocente <vincenzo.innocente at cern dot ch> ---
with
gcc version 14.0.0 20231024 (experimental) [master r14-4877-g724badcadf8] (GCC)
I get the same ICE.

Please note that one needs to include "iostream"
(in my test compile with "-DICE")
to trigger the ICE.
w/o it just emits the syntax error as one would expect.

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

* [Bug c++/111934] ICE  internal compiler error: in discriminator_for_local_entity, at cp/mangle.cc:2065
  2023-10-23 12:09 [Bug c++/111934] New: ICE internal compiler error: in discriminator_for_local_entity, at cp/mangle.cc:2065 vincenzo.innocente at cern dot ch
                   ` (2 preceding siblings ...)
  2023-10-24  9:31 ` vincenzo.innocente at cern dot ch
@ 2023-11-12 23:33 ` pinskia at gcc dot gnu.org
  2023-11-12 23:37 ` pinskia at gcc dot gnu.org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-11-12 23:33 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
This is interesting, I cannot reproduce it locally with
r14-5371-g93e92b2e5d6866 .
but with the version in godbolt I could (r14-5368-ge0787da263322f).

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

* [Bug c++/111934] ICE  internal compiler error: in discriminator_for_local_entity, at cp/mangle.cc:2065
  2023-10-23 12:09 [Bug c++/111934] New: ICE internal compiler error: in discriminator_for_local_entity, at cp/mangle.cc:2065 vincenzo.innocente at cern dot ch
                   ` (3 preceding siblings ...)
  2023-11-12 23:33 ` pinskia at gcc dot gnu.org
@ 2023-11-12 23:37 ` pinskia at gcc dot gnu.org
  2023-11-12 23:42 ` pinskia at gcc dot gnu.org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-11-12 23:37 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I tried `--param  ggc-min-expand=0  --param ggc-min-heapsize=0` and it still
does not ICE.

The exact command line I tried:
```
[apinski@xeond2 upstream-gcc-match]$ ~/upstream-gcc-match/bin/gcc t.cc -DICE -g
-g0 -Wall -pthread -O3 --param  ggc-min-expand=0  --param ggc-min-heapsize=0
```

One difference between my build and godbolt is I don't use
`--enable-libstdcxx-debug ` .

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

* [Bug c++/111934] ICE  internal compiler error: in discriminator_for_local_entity, at cp/mangle.cc:2065
  2023-10-23 12:09 [Bug c++/111934] New: ICE internal compiler error: in discriminator_for_local_entity, at cp/mangle.cc:2065 vincenzo.innocente at cern dot ch
                   ` (4 preceding siblings ...)
  2023-11-12 23:37 ` pinskia at gcc dot gnu.org
@ 2023-11-12 23:42 ` pinskia at gcc dot gnu.org
  2023-11-12 23:53 ` pinskia at gcc dot gnu.org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-11-12 23:42 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Created attachment 56565
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=56565&action=edit
unreduced testcase

Ok, with this preprocessed source I am able to reproduce it locally.
I have not looked into what is the difference on why I could reproduce it with
the headers I have.

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

* [Bug c++/111934] ICE  internal compiler error: in discriminator_for_local_entity, at cp/mangle.cc:2065
  2023-10-23 12:09 [Bug c++/111934] New: ICE internal compiler error: in discriminator_for_local_entity, at cp/mangle.cc:2065 vincenzo.innocente at cern dot ch
                   ` (5 preceding siblings ...)
  2023-11-12 23:42 ` pinskia at gcc dot gnu.org
@ 2023-11-12 23:53 ` pinskia at gcc dot gnu.org
  2023-11-12 23:59 ` pinskia at gcc dot gnu.org
  2023-11-13  0:01 ` [Bug c++/111934] ICE internal compiler error: in discriminator_for_local_entity after undefined decl defining a `thread_local auto` and weakref/alias attribute had been used before pinskia at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-11-12 23:53 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Created attachment 56566
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=56566&action=edit
Reduced testcase

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

* [Bug c++/111934] ICE  internal compiler error: in discriminator_for_local_entity, at cp/mangle.cc:2065
  2023-10-23 12:09 [Bug c++/111934] New: ICE internal compiler error: in discriminator_for_local_entity, at cp/mangle.cc:2065 vincenzo.innocente at cern dot ch
                   ` (6 preceding siblings ...)
  2023-11-12 23:53 ` pinskia at gcc dot gnu.org
@ 2023-11-12 23:59 ` pinskia at gcc dot gnu.org
  2023-11-13  0:01 ` [Bug c++/111934] ICE internal compiler error: in discriminator_for_local_entity after undefined decl defining a `thread_local auto` and weakref/alias attribute had been used before pinskia at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-11-12 23:59 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2023-11-12
             Status|UNCONFIRMED                 |NEW
           Keywords|needs-reduction             |

--- Comment #8 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed.

Note the difference between my build and the others is due to:
# if __GLIBC_PREREQ(2, 34)
// Since glibc 2.34 all pthreads functions are usable without linking to
// libpthread.
#  define _GLIBCXX_GTHREAD_USE_WEAK 0
# endif

That is I have a newer glibc which causes __weakref__ not to be needed/used
here.

So next time please attach the preprocessed source when running into a bug in
the front-end, because different versions of glibc might produce different
preprocessed sources and not able to reproduce the issue.

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

* [Bug c++/111934] ICE  internal compiler error: in discriminator_for_local_entity after undefined decl defining a `thread_local auto` and weakref/alias attribute had been used before
  2023-10-23 12:09 [Bug c++/111934] New: ICE internal compiler error: in discriminator_for_local_entity, at cp/mangle.cc:2065 vincenzo.innocente at cern dot ch
                   ` (7 preceding siblings ...)
  2023-11-12 23:59 ` pinskia at gcc dot gnu.org
@ 2023-11-13  0:01 ` pinskia at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-11-13  0:01 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|ICE  internal compiler      |ICE  internal compiler
                   |error: in                   |error: in
                   |discriminator_for_local_ent |discriminator_for_local_ent
                   |ity, at cp/mangle.cc:2065   |ity after undefined decl
                   |                            |defining a `thread_local
                   |                            |auto` and weakref/alias
                   |                            |attribute had been used
                   |                            |before

--- Comment #9 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
note alias attribute also causes the ICE.

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

end of thread, other threads:[~2023-11-13  0:01 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-23 12:09 [Bug c++/111934] New: ICE internal compiler error: in discriminator_for_local_entity, at cp/mangle.cc:2065 vincenzo.innocente at cern dot ch
2023-10-23 12:09 ` [Bug c++/111934] " vincenzo.innocente at cern dot ch
2023-10-23 17:14 ` pinskia at gcc dot gnu.org
2023-10-24  9:31 ` vincenzo.innocente at cern dot ch
2023-11-12 23:33 ` pinskia at gcc dot gnu.org
2023-11-12 23:37 ` pinskia at gcc dot gnu.org
2023-11-12 23:42 ` pinskia at gcc dot gnu.org
2023-11-12 23:53 ` pinskia at gcc dot gnu.org
2023-11-12 23:59 ` pinskia at gcc dot gnu.org
2023-11-13  0:01 ` [Bug c++/111934] ICE internal compiler error: in discriminator_for_local_entity after undefined decl defining a `thread_local auto` and weakref/alias attribute had been used before pinskia 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).