public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug d/108842] New: Cannot use enum array with -fno-druntime
@ 2023-02-18  7:34 zach-gcc at cs dot stanford.edu
  2023-07-07 19:21 ` [Bug d/108842] " cvs-commit at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: zach-gcc at cs dot stanford.edu @ 2023-02-18  7:34 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 108842
           Summary: Cannot use enum array with -fno-druntime
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: d
          Assignee: ibuclaw at gdcproject dot org
          Reporter: zach-gcc at cs dot stanford.edu
  Target Milestone: ---

I have test.d:

```
enum int[] x = [0, 1, 2];
```

and an object.d:

```
module object;
```

I get an error when I try to compile:

```
$ gdc -c -fno-druntime test.d
test.d:1:16: error: expression '[0, 1, 2]' requires 'object.TypeInfo' and
cannot be used with '-fno-rtti'
    1 | enum int[] x = [0, 1, 2];
      |                ^
test.d:1:16: error: 'object.TypeInfo' could not be found, but is implicitly
used
    1 | enum int[] x = [0, 1, 2];
      |                ^
```

This compiles fine with DMD and LDC with `-betterC` and the same object.d
(custom runtime).

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

* [Bug d/108842] Cannot use enum array with -fno-druntime
  2023-02-18  7:34 [Bug d/108842] New: Cannot use enum array with -fno-druntime zach-gcc at cs dot stanford.edu
@ 2023-07-07 19:21 ` cvs-commit at gcc dot gnu.org
  2023-07-07 19:22 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-07-07 19:21 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Iain Buclaw <ibuclaw@gcc.gnu.org>:

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

commit r14-2385-gf934c5753849f7c48c6a3abfcd73b8f6008e8371
Author: Iain Buclaw <ibuclaw@gdcproject.org>
Date:   Fri Jul 7 21:06:07 2023 +0200

    d: Fix PR 108842: Cannot use enum array with -fno-druntime

    Restrict the generating of CONST_DECLs for D manifest constants to just
    scalars without pointers.  It shouldn't happen that a reference to a
    manifest constant has not been expanded within a function body during
    codegen, but it has been found to occur in older versions of the D
    front-end (PR98277), so if the decl of a non-scalar constant is
    requested, just return its initializer as an expression.

            PR d/108842

    gcc/d/ChangeLog:

            * decl.cc (DeclVisitor::visit (VarDeclaration *)): Only emit scalar
            manifest constants.
            (get_symbol_decl): Don't generate CONST_DECL for non-scalar
manifest
            constants.
            * imports.cc (ImportVisitor::visit (VarDeclaration *)): New method.

    gcc/testsuite/ChangeLog:

            * gdc.dg/pr98277.d: Add more tests.
            * gdc.dg/pr108842.d: New test.

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

* [Bug d/108842] Cannot use enum array with -fno-druntime
  2023-02-18  7:34 [Bug d/108842] New: Cannot use enum array with -fno-druntime zach-gcc at cs dot stanford.edu
  2023-07-07 19:21 ` [Bug d/108842] " cvs-commit at gcc dot gnu.org
@ 2023-07-07 19:22 ` cvs-commit at gcc dot gnu.org
  2023-07-07 19:25 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-07-07 19:22 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-13 branch has been updated by Iain Buclaw
<ibuclaw@gcc.gnu.org>:

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

commit r13-7547-gacd679a7944a4fde8a7ed9ac739749deff9f71ba
Author: Iain Buclaw <ibuclaw@gdcproject.org>
Date:   Fri Jul 7 21:06:07 2023 +0200

    d: Fix PR 108842: Cannot use enum array with -fno-druntime

    Restrict the generating of CONST_DECLs for D manifest constants to just
    scalars without pointers.  It shouldn't happen that a reference to a
    manifest constant has not been expanded within a function body during
    codegen, but it has been found to occur in older versions of the D
    front-end (PR98277), so if the decl of a non-scalar constant is
    requested, just return its initializer as an expression.

            PR d/108842

    gcc/d/ChangeLog:

            * decl.cc (DeclVisitor::visit (VarDeclaration *)): Only emit scalar
            manifest constants.
            (get_symbol_decl): Don't generate CONST_DECL for non-scalar
manifest
            constants.
            * imports.cc (ImportVisitor::visit (VarDeclaration *)): New method.

    gcc/testsuite/ChangeLog:

            * gdc.dg/pr98277.d: Add more tests.
            * gdc.dg/pr108842.d: New test.

    (cherry picked from commit f934c5753849f7c48c6a3abfcd73b8f6008e8371)

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

* [Bug d/108842] Cannot use enum array with -fno-druntime
  2023-02-18  7:34 [Bug d/108842] New: Cannot use enum array with -fno-druntime zach-gcc at cs dot stanford.edu
  2023-07-07 19:21 ` [Bug d/108842] " cvs-commit at gcc dot gnu.org
  2023-07-07 19:22 ` cvs-commit at gcc dot gnu.org
@ 2023-07-07 19:25 ` cvs-commit at gcc dot gnu.org
  2023-07-07 20:00 ` cvs-commit at gcc dot gnu.org
  2023-07-07 20:01 ` ibuclaw at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-07-07 19:25 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-12 branch has been updated by Iain Buclaw
<ibuclaw@gcc.gnu.org>:

https://gcc.gnu.org/g:0444c2065aef569aa16e43cffc564c202a59af33

commit r12-9759-g0444c2065aef569aa16e43cffc564c202a59af33
Author: Iain Buclaw <ibuclaw@gdcproject.org>
Date:   Fri Jul 7 21:06:07 2023 +0200

    d: Fix PR 108842: Cannot use enum array with -fno-druntime

    Restrict the generating of CONST_DECLs for D manifest constants to just
    scalars without pointers.  It shouldn't happen that a reference to a
    manifest constant has not been expanded within a function body during
    codegen, but it has been found to occur in older versions of the D
    front-end (PR98277), so if the decl of a non-scalar constant is
    requested, just return its initializer as an expression.

            PR d/108842

    gcc/d/ChangeLog:

            * decl.cc (DeclVisitor::visit (VarDeclaration *)): Only emit scalar
            manifest constants.
            (get_symbol_decl): Don't generate CONST_DECL for non-scalar
manifest
            constants.
            * imports.cc (ImportVisitor::visit (VarDeclaration *)): New method.

    gcc/testsuite/ChangeLog:

            * gdc.dg/pr98277.d: Add more tests.
            * gdc.dg/pr108842.d: New test.

    (cherry picked from commit f934c5753849f7c48c6a3abfcd73b8f6008e8371)

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

* [Bug d/108842] Cannot use enum array with -fno-druntime
  2023-02-18  7:34 [Bug d/108842] New: Cannot use enum array with -fno-druntime zach-gcc at cs dot stanford.edu
                   ` (2 preceding siblings ...)
  2023-07-07 19:25 ` cvs-commit at gcc dot gnu.org
@ 2023-07-07 20:00 ` cvs-commit at gcc dot gnu.org
  2023-07-07 20:01 ` ibuclaw at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-07-07 20:00 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Iain Buclaw
<ibuclaw@gcc.gnu.org>:

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

commit r11-10898-geef069fe8b22229509a783c9ecb2eb659df4f5ab
Author: Iain Buclaw <ibuclaw@gdcproject.org>
Date:   Fri Jul 7 21:06:07 2023 +0200

    d: Fix PR 108842: Cannot use enum array with -fno-druntime

    Restrict the generating of CONST_DECLs for D manifest constants to just
    scalars without pointers.  It shouldn't happen that a reference to a
    manifest constant has not been expanded within a function body during
    codegen, but it has been found to occur in older versions of the D
    front-end (PR98277), so if the decl of a non-scalar constant is
    requested, just return its initializer as an expression.

            PR d/108842

    gcc/d/ChangeLog:

            * decl.cc (DeclVisitor::visit (VarDeclaration *)): Only emit scalar
            manifest constants.
            (get_symbol_decl): Don't generate CONST_DECL for non-scalar
manifest
            constants.
            * imports.cc (ImportVisitor::visit (VarDeclaration *)): New method.

    gcc/testsuite/ChangeLog:

            * gdc.dg/pr98277.d: Add more tests.
            * gdc.dg/pr108842.d: New test.

    (cherry picked from commit f934c5753849f7c48c6a3abfcd73b8f6008e8371)

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

* [Bug d/108842] Cannot use enum array with -fno-druntime
  2023-02-18  7:34 [Bug d/108842] New: Cannot use enum array with -fno-druntime zach-gcc at cs dot stanford.edu
                   ` (3 preceding siblings ...)
  2023-07-07 20:00 ` cvs-commit at gcc dot gnu.org
@ 2023-07-07 20:01 ` ibuclaw at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: ibuclaw at gcc dot gnu.org @ 2023-07-07 20:01 UTC (permalink / raw)
  To: gcc-bugs

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

ibuclaw at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
                 CC|                            |ibuclaw at gcc dot gnu.org
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #5 from ibuclaw at gcc dot gnu.org ---
Fix committed and backported.

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

end of thread, other threads:[~2023-07-07 20:01 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-18  7:34 [Bug d/108842] New: Cannot use enum array with -fno-druntime zach-gcc at cs dot stanford.edu
2023-07-07 19:21 ` [Bug d/108842] " cvs-commit at gcc dot gnu.org
2023-07-07 19:22 ` cvs-commit at gcc dot gnu.org
2023-07-07 19:25 ` cvs-commit at gcc dot gnu.org
2023-07-07 20:00 ` cvs-commit at gcc dot gnu.org
2023-07-07 20:01 ` ibuclaw 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).