public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/99528] New: [modules] ICE with iostream& vector
@ 2021-03-10 20:39 nathan at gcc dot gnu.org
  2021-03-10 20:39 ` [Bug c++/99528] " nathan at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: nathan at gcc dot gnu.org @ 2021-03-10 20:39 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 99528
           Summary: [modules] ICE with iostream& vector
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: nathan at gcc dot gnu.org
  Target Milestone: ---

I broke something.

#include <iostream>
#include <vector>

int main(){
  std::cout << "Hello World!" << std::endl;
  std::vector<int> v;
  v.push_back(0);
  std::cout << v[0] << std::endl;
  return 0;
}

build iostream & vector as header units, then build:
n file included from
../x86_64-pc-linux-gnu/libstdc++-v3/include/bits/ios_base.h:46,
                 from ../x86_64-pc-linux-gnu/libstdc++-v3/include/ios:42,
                 from ../x86_64-pc-linux-gnu/libstdc++-v3/include/ostream:38,
                 from ../x86_64-pc-linux-gnu/libstdc++-v3/include/iostream:39,
of module ./../x86_64-pc-linux-gnu/libstdc++-v3/include/iostream, imported at
m.cc:1:
../x86_64-pc-linux-gnu/libstdc++-v3/include/system_error: In instantiation of
'struct std::is_error_code_enum<const char*>':
../x86_64-pc-linux-gnu/libstdc++-v3/include/system_error:189:39:   required by
substitution of 'template<class _ErrorCodeEnum, class>
std::error_code::error_code(_ErrorCodeEnum) [with _ErrorCodeEnum = const char*;
<template-parameter-1-2> = <missing>]'
m.cc:5:16:   required from here
../x86_64-pc-linux-gnu/libstdc++-v3/include/system_error:60:51: internal
compiler error: tree check: expected template_decl, have function_decl in
decl_value, at cp/module.cc:7938
   60 |     struct is_error_code_enum : public false_type { };
      |                                                   ^
0x1acdd53 tree_check_failed(tree_node const*, char const*, int, char const*,
...)
        ../../../src/gcc/tree.c:9816
0xad685c tree_check(tree_node*, char const*, int, char const*, tree_code)
        ../../../src/gcc/tree.h:3353
0xcc2df7 trees_in::decl_value()
        ../../../src/gcc/cp/module.cc:7938
0xcc8e49 trees_in::tree_node(bool)
        ../../../src/gcc/cp/module.cc:9174

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

* [Bug c++/99528] [modules] ICE with iostream& vector
  2021-03-10 20:39 [Bug c++/99528] New: [modules] ICE with iostream& vector nathan at gcc dot gnu.org
@ 2021-03-10 20:39 ` nathan at gcc dot gnu.org
  2021-03-10 21:12 ` nathan at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: nathan at gcc dot gnu.org @ 2021-03-10 20:39 UTC (permalink / raw)
  To: gcc-bugs

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

Nathan Sidwell <nathan at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |nathan at gcc dot gnu.org
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2021-03-10

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

* [Bug c++/99528] [modules] ICE with iostream& vector
  2021-03-10 20:39 [Bug c++/99528] New: [modules] ICE with iostream& vector nathan at gcc dot gnu.org
  2021-03-10 20:39 ` [Bug c++/99528] " nathan at gcc dot gnu.org
@ 2021-03-10 21:12 ` nathan at gcc dot gnu.org
  2021-03-11 17:50 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: nathan at gcc dot gnu.org @ 2021-03-10 21:12 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Nathan Sidwell <nathan at gcc dot gnu.org> ---
// bug.h
template<typename _Tp>
class new_allocator
{
public:
  template<typename _Tp1>
  new_allocator(const new_allocator<_Tp1>&) noexcept { }
};

extern template class new_allocator<char>;
// bug_a.H
#include "bug.h"
// bug_b.H
#include "bug.h"
// bug_c.C
import "bug_a.H";
import "bug_b.H";

/cc1plus -quiet -fmodule-header bug_a.H && ./cc1plus -quiet -fmodule-header
bug_b.H && ./cc1plus -quiet -fmodules-ts bug_c.C -fno-module-lazy 
bug_c.C:3:18: internal compiler error: tree check: expected template_decl, have
function_decl in decl_value, at cp/module.cc:7938
    3 | import "bug_b.H";
      |                  ^
0x1acdd53 tree_check_failed(tree_node const*, char const*, int, char const*,
...)
        ../../../src/gcc/tree.c:9816
0xad685c tree_check(tree_node*, char const*, int, char const*, tree_code)
        ../../../src/gcc/tree.h:3353
0xcc2df7 trees_in::decl_value()
        ../../../src/gcc/cp/module.cc:7938
0xcc8e49 trees_in::tree_node(bool)
        ../../../src/gcc/cp/module.cc:9174
0xce2a7f module_state::read_cluster(unsigned int)
        ../../../src/gcc/cp/module.cc:14858
0xcebdc6 module_state::load_section(unsigned int, binding_slot*)
        ../../../src/gcc/cp/module.cc:18129
0xcebaf0 module_state::read_language(bool)
        ../../../src/gcc/cp/module.cc:18058
0xcee601 direct_import
        ../../../src/gcc/cp/module.cc:18920

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

* [Bug c++/99528] [modules] ICE with iostream& vector
  2021-03-10 20:39 [Bug c++/99528] New: [modules] ICE with iostream& vector nathan at gcc dot gnu.org
  2021-03-10 20:39 ` [Bug c++/99528] " nathan at gcc dot gnu.org
  2021-03-10 21:12 ` nathan at gcc dot gnu.org
@ 2021-03-11 17:50 ` cvs-commit at gcc dot gnu.org
  2021-03-11 17:50 ` nathan at gcc dot gnu.org
  2021-03-15 12:42 ` nathan at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-03-11 17:50 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Nathan Sidwell <nathan@gcc.gnu.org>:

https://gcc.gnu.org/g:edc61d34eb4212d5547e9f628b5f7f4d15ee0060

commit r11-7626-gedc61d34eb4212d5547e9f628b5f7f4d15ee0060
Author: Nathan Sidwell <nathan@acm.org>
Date:   Thu Mar 11 05:39:11 2021 -0800

    c++: template partial instantiation mismatch [PR 99528]

    This turned out to be an existing problem, which had been hidden by
    other bugs.  Templated members of templated classes can end up
    instantiating the template itself, and we were not handling the
    mergeableness of that correctly.

            PR c++/99528
            gcc/cp/
            * module.cc (enum merge_kind): Delete MK_type_tmpl_spec,
            MK_decl_tmpl_spec.
            (trees_in::decl_value): Adjust add_mergeable_specialization call.
            (trees_out::get_merge_kind): Adjust detecting a partial template
            instantiation.
            (trees_out::key_mergeable): Adjust handling same.
            (trees_in::key_mergeabvle): Likewise.
            gcc/testsuite/
            * g++.dg/modules/pr99528.h: New.
            * g++.dg/modules/pr99528_a.H: New.
            * g++.dg/modules/pr99528_b.H: New.
            * g++.dg/modules/pr99528_c.C: New.

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

* [Bug c++/99528] [modules] ICE with iostream& vector
  2021-03-10 20:39 [Bug c++/99528] New: [modules] ICE with iostream& vector nathan at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2021-03-11 17:50 ` cvs-commit at gcc dot gnu.org
@ 2021-03-11 17:50 ` nathan at gcc dot gnu.org
  2021-03-15 12:42 ` nathan at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: nathan at gcc dot gnu.org @ 2021-03-11 17:50 UTC (permalink / raw)
  To: gcc-bugs

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

Nathan Sidwell <nathan at gcc dot gnu.org> changed:

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

--- Comment #3 from Nathan Sidwell <nathan at gcc dot gnu.org> ---
edc61d34eb4 2021-03-11 | c++: template partial instantiation mismatch [PR
99528]

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

* [Bug c++/99528] [modules] ICE with iostream& vector
  2021-03-10 20:39 [Bug c++/99528] New: [modules] ICE with iostream& vector nathan at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2021-03-11 17:50 ` nathan at gcc dot gnu.org
@ 2021-03-15 12:42 ` nathan at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: nathan at gcc dot gnu.org @ 2021-03-15 12:42 UTC (permalink / raw)
  To: gcc-bugs

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

Nathan Sidwell <nathan at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |alexander.lelyakin@googlema
                   |                            |il.com

--- Comment #4 from Nathan Sidwell <nathan at gcc dot gnu.org> ---
*** Bug 99481 has been marked as a duplicate of this bug. ***

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

end of thread, other threads:[~2021-03-15 12:42 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-10 20:39 [Bug c++/99528] New: [modules] ICE with iostream& vector nathan at gcc dot gnu.org
2021-03-10 20:39 ` [Bug c++/99528] " nathan at gcc dot gnu.org
2021-03-10 21:12 ` nathan at gcc dot gnu.org
2021-03-11 17:50 ` cvs-commit at gcc dot gnu.org
2021-03-11 17:50 ` nathan at gcc dot gnu.org
2021-03-15 12:42 ` nathan 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).