public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug d/100999] New: d: foreach over a tuple doesn't work on 16-bit targets
@ 2021-06-09 18:10 ibuclaw at gdcproject dot org
  2021-06-11 18:16 ` [Bug d/100999] " cvs-commit at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: ibuclaw at gdcproject dot org @ 2021-06-09 18:10 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 100999
           Summary: d: foreach over a tuple doesn't work on 16-bit targets
           Product: gcc
           Version: 10.3.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: d
          Assignee: ibuclaw at gdcproject dot org
          Reporter: ibuclaw at gdcproject dot org
  Target Milestone: ---

There is an error if the index type isn't an int or long type.  This triggers
on 16-bit targets where the index would be size_t for looping over an array.
---
alias AliasSeq(TList...) = TList;
alias size_t = ushort;

void foo(int a, int b, int c)
{
    // OK
    foreach (size_t i, e; [0, 1, 2, 3]) { }

    // Errors
    static foreach (size_t i, e; [0, 1, 2, 3]) { }
    foreach (size_t i, e; AliasSeq!(0, 1, 2, 3)) { }
    static foreach (size_t i, e; AliasSeq!(0, 1, 2, 3)) { }
}

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

* [Bug d/100999] d: foreach over a tuple doesn't work on 16-bit targets
  2021-06-09 18:10 [Bug d/100999] New: d: foreach over a tuple doesn't work on 16-bit targets ibuclaw at gdcproject dot org
@ 2021-06-11 18:16 ` cvs-commit at gcc dot gnu.org
  2021-06-11 18:33 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-06-11 18:16 UTC (permalink / raw)
  To: gcc-bugs

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

--- 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:68f46862d33707450bdf70cfddd91ae2a12527a8

commit r12-1396-g68f46862d33707450bdf70cfddd91ae2a12527a8
Author: Iain Buclaw <ibuclaw@gdcproject.org>
Date:   Fri Jun 11 19:33:07 2021 +0200

    d: foreach over a tuple doesn't work on 16-bit targets (PR100999)

    Improves semantic passes in the front-end around the `foreach' and
    `static foreach' statements to be more resilient to compiling in a
    minimal D runtime environment.  Checking of the index type has been
    improved as well so now there won't be needless compiler errors when
    using 8 or 16-bit integers as index types when the size fits the
    expected loop range.

    gcc/d/ChangeLog:

            PR d/100999
            * dmd/MERGE: Merge upstream dmd 7a3808254.

    libphobos/ChangeLog:

            PR d/100999
            * src/MERGE: Merge upstream phobos 55bb17543.

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

* [Bug d/100999] d: foreach over a tuple doesn't work on 16-bit targets
  2021-06-09 18:10 [Bug d/100999] New: d: foreach over a tuple doesn't work on 16-bit targets ibuclaw at gdcproject dot org
  2021-06-11 18:16 ` [Bug d/100999] " cvs-commit at gcc dot gnu.org
@ 2021-06-11 18:33 ` cvs-commit at gcc dot gnu.org
  2021-06-11 21:09 ` cvs-commit at gcc dot gnu.org
  2021-06-11 21:10 ` ibuclaw at gdcproject dot org
  3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-06-11 18:33 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 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:a30552af7073aba16af6798a1e6cd0a345b06586

commit r11-8553-ga30552af7073aba16af6798a1e6cd0a345b06586
Author: Iain Buclaw <ibuclaw@gdcproject.org>
Date:   Fri Jun 11 19:33:07 2021 +0200

    d: foreach over a tuple doesn't work on 16-bit targets (PR100999)

    Improves semantic passes in the front-end around the `foreach' and
    `static foreach' statements to be more resilient to compiling in a
    minimal D runtime environment.  Checking of the index type has been
    improved as well so now there won't be needless compiler errors when
    using 8 or 16-bit integers as index types when the size fits the
    expected loop range.

    gcc/d/ChangeLog:

            PR d/100999
            * dmd/cond.c (lowerArrayAggregate): Run CTFE interpret on foreach
            input range.
            (createTupleType): Don't generate typeinfo when disabled.
            (lowerNonArrayAggregate): Suppress errors when running type
semantic.
            (staticForeachPrepare): Don't run CTFE interpret from here.
            * dmd/dinterpret.c (ctfeInterpret): Add more shortcut cases.
            * dmd/expression.c (Expression::checkPostblit): Don't generate
            typeinfo when type is missing from library.
            * dmd/expressionsem.c (resolvePropertiesX): Remove early error.
            * dmd/statementsem.c (StatementSemanticVisitor::declareVariable):
            Don't override index type.
            (StatementSemanticVisitor::makeTupleForeachBody): Check index type
is
            integral and index range fits type size.
            (StatementSemanticVisitor::visit (ForeachStatement*)): Adjust index
            range before testing.

    libphobos/ChangeLog:

            PR d/100999
            * src/std/typecons.d (template Proxy): Check for field or property
            functions as the else branch.

    gcc/testsuite/ChangeLog:

            PR d/100999
            * gdc.test/compilable/staticforeach.d: Add new tests.
            * gdc.test/fail_compilation/diag16976.d: Likewise.
            * gdc.test/fail_compilation/fail117.d: Likewise.
            * gdc.test/fail_compilation/fail238_m32.d: Likewise.
            * gdc.test/fail_compilation/fail238_m64.d: Likewise.
            * gdc.test/fail_compilation/fail7424b.d: Likewise.
            * gdc.test/fail_compilation/fail7424c.d: Likewise.
            * gdc.test/fail_compilation/fail7424d.d: Likewise.
            * gdc.test/fail_compilation/fail7424e.d: Likewise.
            * gdc.test/fail_compilation/fail7424f.d: Likewise.
            * gdc.test/fail_compilation/fail7424g.d: Likewise.
            * gdc.test/fail_compilation/fail7424h.d: Likewise.
            * gdc.test/fail_compilation/fail7424i.d: Likewise.
            * gdc.test/fail_compilation/fail9766.d: Likewise.
            * gdc.test/fail_compilation/ice9406.d: Likewise.
            * gdc.test/compilable/extra-files/minimal/object.d: New file.
            * gdc.test/compilable/interpret5.d: New test.
            * gdc.test/compilable/minimal3.d: New test.
            * gdc.test/compilable/test21742.d: New test.
            * gdc.test/compilable/test22006.d: New test.
            * gdc.test/fail_compilation/b12504.d: New test.
            * gdc.test/fail_compilation/fail22006.d: New test.
            * gdc.test/fail_compilation/test21927.d: New test.
            * gdc.test/fail_compilation/test21939.d: New test.

    (cherry picked from commit 68f46862d33707450bdf70cfddd91ae2a12527a8)

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

* [Bug d/100999] d: foreach over a tuple doesn't work on 16-bit targets
  2021-06-09 18:10 [Bug d/100999] New: d: foreach over a tuple doesn't work on 16-bit targets ibuclaw at gdcproject dot org
  2021-06-11 18:16 ` [Bug d/100999] " cvs-commit at gcc dot gnu.org
  2021-06-11 18:33 ` cvs-commit at gcc dot gnu.org
@ 2021-06-11 21:09 ` cvs-commit at gcc dot gnu.org
  2021-06-11 21:10 ` ibuclaw at gdcproject dot org
  3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-06-11 21:09 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

commit r10-9910-gecbe8af2c38e22d3db99a57e21531fd523700492
Author: Iain Buclaw <ibuclaw@gdcproject.org>
Date:   Fri Jun 11 19:33:07 2021 +0200

    d: foreach over a tuple doesn't work on 16-bit targets (PR100999)

    Improves semantic passes in the front-end around the `foreach' and
    `static foreach' statements to be more resilient to compiling in a
    minimal D runtime environment.  Checking of the index type has been
    improved as well so now there won't be needless compiler errors when
    using 8 or 16-bit integers as index types when the size fits the
    expected loop range.

    gcc/d/ChangeLog:

            PR d/100999
            * dmd/cond.c (lowerArrayAggregate): Run CTFE interpret on foreach
            input range.
            (createTupleType): Don't generate typeinfo when disabled.
            (lowerNonArrayAggregate): Suppress errors when running type
semantic.
            (staticForeachPrepare): Don't run CTFE interpret from here.
            * dmd/dinterpret.c (ctfeInterpret): Add more shortcut cases.
            * dmd/expression.c (resolvePropertiesX): Remove early error.
            (Expression::checkPostblit): Don't generate typeinfo when type is
            missing from library.
            * dmd/expressionsem.c (ExpressionSemanticVisitor): Set type of
            DotTemplateExp as void.
            * dmd/statementsem.c (StatementSemanticVisitor::declareVariable):
            Don't override index type.
            (StatementSemanticVisitor::makeTupleForeachBody): Check index type
is
            integral and index range fits type size.
            (StatementSemanticVisitor::visit (ForeachStatement*)): Adjust index
            range before testing.

    libphobos/ChangeLog:

            PR d/100999
            * src/std/typecons.d (template Proxy): Check for field or property
            functions as the else branch.

    gcc/testsuite/ChangeLog:

            PR d/100999
            * gdc.test/compilable/staticforeach.d: Add new tests.
            * gdc.test/fail_compilation/diag16976.d: Likewise.
            * gdc.test/fail_compilation/fail117.d: Likewise.
            * gdc.test/fail_compilation/fail238_m32.d: Likewise.
            * gdc.test/fail_compilation/fail238_m64.d: Likewise.
            * gdc.test/fail_compilation/fail7424b.d: Likewise.
            * gdc.test/fail_compilation/fail7424c.d: Likewise.
            * gdc.test/fail_compilation/fail7424d.d: Likewise.
            * gdc.test/fail_compilation/fail7424e.d: Likewise.
            * gdc.test/fail_compilation/fail7424f.d: Likewise.
            * gdc.test/fail_compilation/fail7424g.d: Likewise.
            * gdc.test/fail_compilation/fail7424h.d: Likewise.
            * gdc.test/fail_compilation/fail7424i.d: Likewise.
            * gdc.test/fail_compilation/fail9766.d: Likewise.
            * gdc.test/fail_compilation/ice9406.d: Likewise.
            * gdc.test/compilable/extra-files/minimal/object.d: New file.
            * gdc.test/compilable/interpret5.d: New test.
            * gdc.test/compilable/minimal3.d: New test.
            * gdc.test/compilable/test21742.d: New test.
            * gdc.test/compilable/test22006.d: New test.
            * gdc.test/fail_compilation/b12504.d: New test.
            * gdc.test/fail_compilation/fail22006.d: New test.
            * gdc.test/fail_compilation/test21927.d: New test.
            * gdc.test/fail_compilation/test21939.d: New test.

    (cherry picked from commit 68f46862d33707450bdf70cfddd91ae2a12527a8)

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

* [Bug d/100999] d: foreach over a tuple doesn't work on 16-bit targets
  2021-06-09 18:10 [Bug d/100999] New: d: foreach over a tuple doesn't work on 16-bit targets ibuclaw at gdcproject dot org
                   ` (2 preceding siblings ...)
  2021-06-11 21:09 ` cvs-commit at gcc dot gnu.org
@ 2021-06-11 21:10 ` ibuclaw at gdcproject dot org
  3 siblings, 0 replies; 5+ messages in thread
From: ibuclaw at gdcproject dot org @ 2021-06-11 21:10 UTC (permalink / raw)
  To: gcc-bugs

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

Iain Buclaw <ibuclaw at gdcproject dot org> changed:

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

--- Comment #4 from Iain Buclaw <ibuclaw at gdcproject dot org> ---
Fix committed

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

end of thread, other threads:[~2021-06-11 21:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-09 18:10 [Bug d/100999] New: d: foreach over a tuple doesn't work on 16-bit targets ibuclaw at gdcproject dot org
2021-06-11 18:16 ` [Bug d/100999] " cvs-commit at gcc dot gnu.org
2021-06-11 18:33 ` cvs-commit at gcc dot gnu.org
2021-06-11 21:09 ` cvs-commit at gcc dot gnu.org
2021-06-11 21:10 ` ibuclaw at gdcproject dot 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).