public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug d/101490] New: ICE at convert_expr(tree_node*, Type*, Type*)
@ 2021-07-17 18:00 SztfG at yandex dot ru
  2021-07-25 23:10 ` [Bug d/101490] " ibuclaw at gdcproject dot org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: SztfG at yandex dot ru @ 2021-07-17 18:00 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 101490
           Summary: ICE at convert_expr(tree_node*, Type*, Type*)
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: d
          Assignee: ibuclaw at gdcproject dot org
          Reporter: SztfG at yandex dot ru
  Target Milestone: ---

testcase:

import std.stdio;

struct test
{
  int[0] foo;
};

void main()
{
  test* t;
  auto a = cast(typeof((*t).foo)[0])t.foo;
  writeln(a);
}


/opt/wandbox/gdc-head/lib/gcc/x86_64-pc-linux-gnu/12.0.0/include/d/std/format.d:
In function 'formatValue':
/opt/wandbox/gdc-head/lib/gcc/x86_64-pc-linux-gnu/12.0.0/include/d/std/format.d:2605:23:
internal compiler error: Floating point exception
 2605 |     formatValue(w, obj[], f);
      |                       ^
0xc2df5f crash_signal
        ../../source/gcc/toplev.c:328
0x7b78c4 convert_expr(tree_node*, Type*, Type*)
        ../../source/gcc/d/d-convert.cc:476
0x7c9a5e ExprVisitor::visit(SliceExp*)
        ../../source/gcc/d/expr.cc:1382
0x7c74c0 build_expr(Expression*, bool, bool)
        ../../source/gcc/d/expr.cc:3129
0x7b60d1 d_build_call(TypeFunction*, tree_node*, tree_node*,
Array<Expression*>*)
        ../../source/gcc/d/d-codegen.cc:2042
0x7c8f34 ExprVisitor::visit(CallExp*)
        ../../source/gcc/d/expr.cc:1886
0x7c74c0 build_expr(Expression*, bool, bool)
        ../../source/gcc/d/expr.cc:3129
0x7c755b build_expr_dtor(Expression*)
        ../../source/gcc/d/expr.cc:3152
0x7d3cf1 IRVisitor::visit(ExpStatement*)
        ../../source/gcc/d/toir.cc:1120
0x7d37bf IRVisitor::build_stmt(Statement*)
        ../../source/gcc/d/toir.cc:274
0x7d37bf IRVisitor::visit(CompoundStatement*)
        ../../source/gcc/d/toir.cc:1137
0x7d37bf IRVisitor::visit(CompoundStatement*)
        ../../source/gcc/d/toir.cc:1127
0x7d2e12 IRVisitor::build_stmt(Statement*)
        ../../source/gcc/d/toir.cc:274
0x7d2e12 build_function_body(FuncDeclaration*)
        ../../source/gcc/d/toir.cc:1549
0x7c6623 DeclVisitor::visit(FuncDeclaration*)
        ../../source/gcc/d/decl.cc:945
0x7c5b2f DeclVisitor::build_dsymbol(Dsymbol*)
        ../../source/gcc/d/decl.cc:146
0x7c5b2f DeclVisitor::visit(TemplateInstance*)
        ../../source/gcc/d/decl.cc:341
0x7c5b2f DeclVisitor::visit(TemplateInstance*)
        ../../source/gcc/d/decl.cc:332
0x7c31d6 DeclVisitor::build_dsymbol(Dsymbol*)
        ../../source/gcc/d/decl.cc:146
0x7c31d6 build_decl_tree(Dsymbol*)
        ../../source/gcc/d/decl.cc:986
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

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

* [Bug d/101490] ICE at convert_expr(tree_node*, Type*, Type*)
  2021-07-17 18:00 [Bug d/101490] New: ICE at convert_expr(tree_node*, Type*, Type*) SztfG at yandex dot ru
@ 2021-07-25 23:10 ` ibuclaw at gdcproject dot org
  2021-07-28 11:18 ` cvs-commit at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: ibuclaw at gdcproject dot org @ 2021-07-25 23:10 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Iain Buclaw <ibuclaw at gdcproject dot org> ---
Reduced test
---
struct test
{
    int[0] foo;
}

void main()
{
    test* t;
    auto a = cast(typeof(t.foo)[0])t.foo;
    write(a);
}

void write(S)(S args)
{
    foreach (arg; args)
    {
    }
}

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

* [Bug d/101490] ICE at convert_expr(tree_node*, Type*, Type*)
  2021-07-17 18:00 [Bug d/101490] New: ICE at convert_expr(tree_node*, Type*, Type*) SztfG at yandex dot ru
  2021-07-25 23:10 ` [Bug d/101490] " ibuclaw at gdcproject dot org
@ 2021-07-28 11:18 ` cvs-commit at gcc dot gnu.org
  2021-07-28 11:36 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-07-28 11:18 UTC (permalink / raw)
  To: gcc-bugs

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

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

commit r12-2564-gc936c39f86c74b3bfc6831f694b3165296c99dc0
Author: Iain Buclaw <ibuclaw@gdcproject.org>
Date:   Mon Jul 26 15:11:42 2021 +0200

    d: fix ICE at convert_expr(tree_node*, Type*, Type*) (PR101490)

    Both the front-end and code generator had a modulo by zero bug when testing
if
    a conversion from a static array to dynamic array was valid.

            PR d/101490

    gcc/d/ChangeLog:

            * dmd/MERGE: Merge upstream dmd 27e388b4c.
            * d-codegen.cc (build_array_index): Handle void arrays same as
byte.
            * d-convert.cc (convert_expr): Handle converting to zero-sized
arrays.

    gcc/testsuite/ChangeLog:

            * gdc.dg/pr101490.d: New test.

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

* [Bug d/101490] ICE at convert_expr(tree_node*, Type*, Type*)
  2021-07-17 18:00 [Bug d/101490] New: ICE at convert_expr(tree_node*, Type*, Type*) SztfG at yandex dot ru
  2021-07-25 23:10 ` [Bug d/101490] " ibuclaw at gdcproject dot org
  2021-07-28 11:18 ` cvs-commit at gcc dot gnu.org
@ 2021-07-28 11:36 ` cvs-commit at gcc dot gnu.org
  2021-07-28 11:50 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-07-28 11:36 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 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:45be6e80884d452c927c24e43b9018e2aa141c64

commit r11-8809-g45be6e80884d452c927c24e43b9018e2aa141c64
Author: Iain Buclaw <ibuclaw@gdcproject.org>
Date:   Mon Jul 26 15:11:42 2021 +0200

    d: fix ICE at convert_expr(tree_node*, Type*, Type*) (PR101490)

    Both the front-end and code generator had a modulo by zero bug when testing
if
    a conversion from a static array to dynamic array was valid.

            PR d/101490

    gcc/d/ChangeLog:

            * d-codegen.cc (build_array_index): Handle void arrays same as
byte.
            * d-convert.cc (convert_expr): Handle converting to zero-sized
arrays.
            * dmd/dcast.c (castTo): Handle casting to zero-sized arrays.

    gcc/testsuite/ChangeLog:

            * gdc.dg/pr101490.d: New test.
            * gdc.test/fail_compilation/fail22144.d: New test.

    (cherry picked from commit c936c39f86c74b3bfc6831f694b3165296c99dc0)

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

* [Bug d/101490] ICE at convert_expr(tree_node*, Type*, Type*)
  2021-07-17 18:00 [Bug d/101490] New: ICE at convert_expr(tree_node*, Type*, Type*) SztfG at yandex dot ru
                   ` (2 preceding siblings ...)
  2021-07-28 11:36 ` cvs-commit at gcc dot gnu.org
@ 2021-07-28 11:50 ` cvs-commit at gcc dot gnu.org
  2021-07-28 11:57 ` cvs-commit at gcc dot gnu.org
  2021-07-28 12:47 ` ibuclaw at gdcproject dot org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-07-28 11:50 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 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:77e743d9c90de66b39058a797f99d540d69e2940

commit r10-10007-g77e743d9c90de66b39058a797f99d540d69e2940
Author: Iain Buclaw <ibuclaw@gdcproject.org>
Date:   Mon Jul 26 15:11:42 2021 +0200

    d: fix ICE at convert_expr(tree_node*, Type*, Type*) (PR101490)

    Both the front-end and code generator had a modulo by zero bug when testing
if
    a conversion from a static array to dynamic array was valid.

            PR d/101490

    gcc/d/ChangeLog:

            * d-codegen.cc (build_array_index): Handle void arrays same as
byte.
            * d-convert.cc (convert_expr): Handle converting to zero-sized
arrays.
            * dmd/dcast.c (castTo): Handle casting to zero-sized arrays.

    gcc/testsuite/ChangeLog:

            * gdc.dg/pr101490.d: New test.
            * gdc.test/fail_compilation/fail22144.d: New test.

    (cherry picked from commit c936c39f86c74b3bfc6831f694b3165296c99dc0)

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

* [Bug d/101490] ICE at convert_expr(tree_node*, Type*, Type*)
  2021-07-17 18:00 [Bug d/101490] New: ICE at convert_expr(tree_node*, Type*, Type*) SztfG at yandex dot ru
                   ` (3 preceding siblings ...)
  2021-07-28 11:50 ` cvs-commit at gcc dot gnu.org
@ 2021-07-28 11:57 ` cvs-commit at gcc dot gnu.org
  2021-07-28 12:47 ` ibuclaw at gdcproject dot org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-07-28 11:57 UTC (permalink / raw)
  To: gcc-bugs

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

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

https://gcc.gnu.org/g:5a67fcd15dc42969dc97a9ebb292cd53f9bc0a16

commit r9-9650-g5a67fcd15dc42969dc97a9ebb292cd53f9bc0a16
Author: Iain Buclaw <ibuclaw@gdcproject.org>
Date:   Mon Jul 26 15:11:42 2021 +0200

    d: fix ICE at convert_expr(tree_node*, Type*, Type*) (PR101490)

    Both the front-end and code generator had a modulo by zero bug when testing
if
    a conversion from a static array to dynamic array was valid.

            PR d/101490

    gcc/d/ChangeLog:

            * d-codegen.cc (build_array_index): Handle void arrays same as
byte.
            * d-convert.cc (convert_expr): Handle converting to zero-sized
arrays.
            * dmd/dcast.c (castTo): Handle casting to zero-sized arrays.

    gcc/testsuite/ChangeLog:

            * gdc.dg/pr101490.d: New test.
            * gdc.test/fail_compilation/fail22144.d: New test.

    (cherry picked from commit c936c39f86c74b3bfc6831f694b3165296c99dc0)

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

* [Bug d/101490] ICE at convert_expr(tree_node*, Type*, Type*)
  2021-07-17 18:00 [Bug d/101490] New: ICE at convert_expr(tree_node*, Type*, Type*) SztfG at yandex dot ru
                   ` (4 preceding siblings ...)
  2021-07-28 11:57 ` cvs-commit at gcc dot gnu.org
@ 2021-07-28 12:47 ` ibuclaw at gdcproject dot org
  5 siblings, 0 replies; 7+ messages in thread
From: ibuclaw at gdcproject dot org @ 2021-07-28 12:47 UTC (permalink / raw)
  To: gcc-bugs

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

Iain Buclaw <ibuclaw at gdcproject dot org> changed:

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

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

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

end of thread, other threads:[~2021-07-28 12:47 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-17 18:00 [Bug d/101490] New: ICE at convert_expr(tree_node*, Type*, Type*) SztfG at yandex dot ru
2021-07-25 23:10 ` [Bug d/101490] " ibuclaw at gdcproject dot org
2021-07-28 11:18 ` cvs-commit at gcc dot gnu.org
2021-07-28 11:36 ` cvs-commit at gcc dot gnu.org
2021-07-28 11:50 ` cvs-commit at gcc dot gnu.org
2021-07-28 11:57 ` cvs-commit at gcc dot gnu.org
2021-07-28 12:47 ` 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).