public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/106363] New: [modules] Can't selectively reexport imported declaration in same namespace
@ 2022-07-20  2:07 johelegp at gmail dot com
  2022-10-24 19:53 ` [Bug c++/106363] [13 Regression] " johelegp at gmail dot com
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: johelegp at gmail dot com @ 2022-07-20  2:07 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 106363
           Summary: [modules] Can't selectively reexport imported
                    declaration in same namespace
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: johelegp at gmail dot com
                CC: johelegp at gmail dot com
  Target Milestone: ---

See https://godbolt.org/z/a3GqTEs5P, which Clang accepts:
https://godbolt.org/z/svaGvz1bz.

mod2.cpp:
```C++
export module mod2;
namespace ns {
export int x = 0;
}
```

mod.cpp:
```C++
export module mod;
import mod2;
namespace ns {
export using ns::x;
}
```

test.cpp:
```C++
import mod;
int main() { return ns::x; }
```

Output:
```
[ 62%] Building CXX object CMakeFiles/mod.dir/mod.cpp.o
mod.cpp:1:8: internal compiler error: in decl_node, at cp/module.cc:8678
    1 | export module mod;
      |        ^~~~~~
0x221f229 internal_error(char const*, ...)
        ???:0
0x74c10d fancy_abort(char const*, int, char const*)
        ???:0
0x8fcc60 trees_out::decl_node(tree_node*, walk_kind)
        ???:0
0x8fd01d trees_out::tree_node(tree_node*)
        ???:0
0x905086 module_state::write_cluster(elf_out*, depset**, unsigned int,
depset::hash&, unsigned int*, unsigned int*)
        ???:0
0x906ace module_state::write_begin(elf_out*, cpp_reader*, module_state_config&,
unsigned int&)
        ???:0
0x9079f2 finish_module_processing(cpp_reader*)
        ???:0
0x87253d c_parse_final_cleanups()
        ???:0
0xb2d060 c_common_parse_file()
        ???:0
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++/106363] [13 Regression] [modules] Can't selectively reexport imported declaration in same namespace
  2022-07-20  2:07 [Bug c++/106363] New: [modules] Can't selectively reexport imported declaration in same namespace johelegp at gmail dot com
@ 2022-10-24 19:53 ` johelegp at gmail dot com
  2022-10-24 20:07 ` [Bug c++/106363] [13 Regression] [modules] ICE using-declaration of imported name in the " johelegp at gmail dot com
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: johelegp at gmail dot com @ 2022-10-24 19:53 UTC (permalink / raw)
  To: gcc-bugs

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

Johel Ernesto Guerrero Peña <johelegp at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[modules] Can't selectively |[13 Regression] [modules]
                   |reexport imported           |Can't selectively reexport
                   |declaration in same         |imported declaration in
                   |namespace                   |same namespace

--- Comment #1 from Johel Ernesto Guerrero Peña <johelegp at gmail dot com> ---
Reexporting is not the problem. The _using-declaration_ is.

Reproducer script:
```bash
#!/bin/bash
CXX=g++
echo "mod2 mod2.gcm
mod mod.gcm" > mm.txt
echo "export module mod2;
namespace ns {
export int x = 0;
}" > mod2.cpp
echo "export module mod;
import mod2;
namespace ns {
export using ns::x;
}" > mod.cpp
$CXX -std=c++23 -fmodules-ts -fmodule-mapper=mm.txt -c mod2.cpp
$CXX -std=c++23 -fmodules-ts -fmodule-mapper=mm.txt -c mod.cpp
```

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

* [Bug c++/106363] [13 Regression] [modules] ICE using-declaration of imported name in the same namespace
  2022-07-20  2:07 [Bug c++/106363] New: [modules] Can't selectively reexport imported declaration in same namespace johelegp at gmail dot com
  2022-10-24 19:53 ` [Bug c++/106363] [13 Regression] " johelegp at gmail dot com
@ 2022-10-24 20:07 ` johelegp at gmail dot com
  2022-11-29 16:48 ` pinskia at gcc dot gnu.org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: johelegp at gmail dot com @ 2022-10-24 20:07 UTC (permalink / raw)
  To: gcc-bugs

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

Johel Ernesto Guerrero Peña <johelegp at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|                            |12.2.0
      Known to fail|                            |13.0

--- Comment #2 from Johel Ernesto Guerrero Peña <johelegp at gmail dot com> ---
GCC 12.2 accepts: https://godbolt.org/z/4ExevrnWx.

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

* [Bug c++/106363] [13 Regression] [modules] ICE using-declaration of imported name in the same namespace
  2022-07-20  2:07 [Bug c++/106363] New: [modules] Can't selectively reexport imported declaration in same namespace johelegp at gmail dot com
  2022-10-24 19:53 ` [Bug c++/106363] [13 Regression] " johelegp at gmail dot com
  2022-10-24 20:07 ` [Bug c++/106363] [13 Regression] [modules] ICE using-declaration of imported name in the " johelegp at gmail dot com
@ 2022-11-29 16:48 ` pinskia at gcc dot gnu.org
  2022-12-22 14:57 ` rguenth at gcc dot gnu.org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-11-29 16:48 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

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

* [Bug c++/106363] [13 Regression] [modules] ICE using-declaration of imported name in the same namespace
  2022-07-20  2:07 [Bug c++/106363] New: [modules] Can't selectively reexport imported declaration in same namespace johelegp at gmail dot com
                   ` (2 preceding siblings ...)
  2022-11-29 16:48 ` pinskia at gcc dot gnu.org
@ 2022-12-22 14:57 ` rguenth at gcc dot gnu.org
  2023-04-26  6:56 ` [Bug c++/106363] [13/14 " rguenth at gcc dot gnu.org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-12-22 14:57 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2022-12-22
           Keywords|                            |ice-checking
     Ever confirmed|0                           |1

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed.  We run into

...
#if CHECKING_P
      gcc_assert (!import || importedness >= 0);
#endif

likely also an issue on the branch, but I didn't check.

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

* [Bug c++/106363] [13/14 Regression] [modules] ICE using-declaration of imported name in the same namespace
  2022-07-20  2:07 [Bug c++/106363] New: [modules] Can't selectively reexport imported declaration in same namespace johelegp at gmail dot com
                   ` (3 preceding siblings ...)
  2022-12-22 14:57 ` rguenth at gcc dot gnu.org
@ 2023-04-26  6:56 ` rguenth at gcc dot gnu.org
  2023-07-27  9:23 ` rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-04-26  6:56 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 13.1 is being released, retargeting bugs to GCC 13.2.

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

* [Bug c++/106363] [13/14 Regression] [modules] ICE using-declaration of imported name in the same namespace
  2022-07-20  2:07 [Bug c++/106363] New: [modules] Can't selectively reexport imported declaration in same namespace johelegp at gmail dot com
                   ` (4 preceding siblings ...)
  2023-04-26  6:56 ` [Bug c++/106363] [13/14 " rguenth at gcc dot gnu.org
@ 2023-07-27  9:23 ` rguenth at gcc dot gnu.org
  2023-12-16 23:39 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-07-27  9:23 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|13.2                        |13.3

--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 13.2 is being released, retargeting bugs to GCC 13.3.

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

* [Bug c++/106363] [13/14 Regression] [modules] ICE using-declaration of imported name in the same namespace
  2022-07-20  2:07 [Bug c++/106363] New: [modules] Can't selectively reexport imported declaration in same namespace johelegp at gmail dot com
                   ` (5 preceding siblings ...)
  2023-07-27  9:23 ` rguenth at gcc dot gnu.org
@ 2023-12-16 23:39 ` cvs-commit at gcc dot gnu.org
  2024-03-10  3:28 ` [Bug c++/106363] [13 " law at gcc dot gnu.org
  2024-03-13 17:48 ` ppalka at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-12-16 23:39 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Nathaniel Shead <nshead@gcc.gnu.org>:

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

commit r14-6636-gcb76f46c97e9f4e4869acceb77a000b6cc2cda0e
Author: Nathaniel Shead <nathanieloshead@gmail.com>
Date:   Sun Nov 12 11:54:43 2023 +1100

    c++: Seed namespaces for bindings [PR106363]

    Currently the first depset for an EK_BINDING is not seeded. This breaks
    the attached testcase as then the namespace is not considered referenced
    yet during streaming, but we've already finished importing.

    There doesn't seem to be any particular reason I could find for skipping
    the first depset for bindings, and removing the condition doesn't appear
    to cause any test failures, so this patch removes that check.

            PR c++/106363

    gcc/cp/ChangeLog:

            * module.cc (module_state::write_cluster): Don't skip first
            depset for bindings.

    gcc/testsuite/ChangeLog:

            * g++.dg/modules/pr106363_a.C: New test.
            * g++.dg/modules/pr106363_b.C: New test.

    Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>

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

* [Bug c++/106363] [13 Regression] [modules] ICE using-declaration of imported name in the same namespace
  2022-07-20  2:07 [Bug c++/106363] New: [modules] Can't selectively reexport imported declaration in same namespace johelegp at gmail dot com
                   ` (6 preceding siblings ...)
  2023-12-16 23:39 ` cvs-commit at gcc dot gnu.org
@ 2024-03-10  3:28 ` law at gcc dot gnu.org
  2024-03-13 17:48 ` ppalka at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: law at gcc dot gnu.org @ 2024-03-10  3:28 UTC (permalink / raw)
  To: gcc-bugs

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

Jeffrey A. Law <law at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[13/14 Regression]          |[13 Regression] [modules]
                   |[modules] ICE               |ICE using-declaration of
                   |using-declaration of        |imported name in the same
                   |imported name in the same   |namespace
                   |namespace                   |
                 CC|                            |law at gcc dot gnu.org

--- Comment #7 from Jeffrey A. Law <law at gcc dot gnu.org> ---
Fixed on the trunk.

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

* [Bug c++/106363] [13 Regression] [modules] ICE using-declaration of imported name in the same namespace
  2022-07-20  2:07 [Bug c++/106363] New: [modules] Can't selectively reexport imported declaration in same namespace johelegp at gmail dot com
                   ` (7 preceding siblings ...)
  2024-03-10  3:28 ` [Bug c++/106363] [13 " law at gcc dot gnu.org
@ 2024-03-13 17:48 ` ppalka at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: ppalka at gcc dot gnu.org @ 2024-03-13 17:48 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED
                 CC|                            |ppalka at gcc dot gnu.org
   Target Milestone|13.3                        |14.0

--- Comment #8 from Patrick Palka <ppalka at gcc dot gnu.org> ---
IIUC this checking-only ICE is not actually a regression so let's mark this as
fixed for 14 only.

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

end of thread, other threads:[~2024-03-13 17:48 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-20  2:07 [Bug c++/106363] New: [modules] Can't selectively reexport imported declaration in same namespace johelegp at gmail dot com
2022-10-24 19:53 ` [Bug c++/106363] [13 Regression] " johelegp at gmail dot com
2022-10-24 20:07 ` [Bug c++/106363] [13 Regression] [modules] ICE using-declaration of imported name in the " johelegp at gmail dot com
2022-11-29 16:48 ` pinskia at gcc dot gnu.org
2022-12-22 14:57 ` rguenth at gcc dot gnu.org
2023-04-26  6:56 ` [Bug c++/106363] [13/14 " rguenth at gcc dot gnu.org
2023-07-27  9:23 ` rguenth at gcc dot gnu.org
2023-12-16 23:39 ` cvs-commit at gcc dot gnu.org
2024-03-10  3:28 ` [Bug c++/106363] [13 " law at gcc dot gnu.org
2024-03-13 17:48 ` 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).