public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug d/106139] New: d: aggregate value used where floating point was expected
@ 2022-06-29 13:31 ibuclaw at gdcproject dot org
  2022-06-29 21:10 ` [Bug d/106139] " ibuclaw at gdcproject dot org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: ibuclaw at gdcproject dot org @ 2022-06-29 13:31 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 106139
           Summary: d: aggregate value used where floating point was
                    expected
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: d
          Assignee: ibuclaw at gdcproject dot org
          Reporter: ibuclaw at gdcproject dot org
  Target Milestone: ---

Casting from vector to static array is permitted, and the frontend generates a
reinterpret cast, but casting back the other way results in an error.
---
__vector(int[4]) vec = [1,2,3,4];
int[4] arr;

arr = cast(int[4])vec;            // OK
vec = cast(__vector(int[4]))arr;  // Error

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

* [Bug d/106139] d: aggregate value used where floating point was expected
  2022-06-29 13:31 [Bug d/106139] New: d: aggregate value used where floating point was expected ibuclaw at gdcproject dot org
@ 2022-06-29 21:10 ` ibuclaw at gdcproject dot org
  2022-06-29 21:11 ` cvs-commit at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: ibuclaw at gdcproject dot org @ 2022-06-29 21:10 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Iain Buclaw <ibuclaw at gdcproject dot org> ---
Note, gdc-11 and gdc-10 error as a result to a different issue.
---
cannot resolve type for cast(__vector(int[8]))arr
---

Fix was made in a newer version of upstream dmd, so that'll be handled in the
backport.

https://github.com/dlang/dmd/pull/10532

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

* [Bug d/106139] d: aggregate value used where floating point was expected
  2022-06-29 13:31 [Bug d/106139] New: d: aggregate value used where floating point was expected ibuclaw at gdcproject dot org
  2022-06-29 21:10 ` [Bug d/106139] " ibuclaw at gdcproject dot org
@ 2022-06-29 21:11 ` cvs-commit at gcc dot gnu.org
  2022-07-04 13:16 ` 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 @ 2022-06-29 21:11 UTC (permalink / raw)
  To: gcc-bugs

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

--- 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:329bef49da30158d30fed1106002bb71674776bd

commit r13-1351-g329bef49da30158d30fed1106002bb71674776bd
Author: Iain Buclaw <ibuclaw@gdcproject.org>
Date:   Wed Jun 29 21:52:39 2022 +0200

    d: Fix error: aggregate value used where floating point was expected

    Casting from vector to static array is permitted, and the frontend
    generates a reinterpret cast, but casting back the other way resulted in
    an error.  This has been fixed to be properly handled in the code
    generation pass of VectorExp, and the conversion for lvalue and rvalue
    handling done in convert_expr and convert_for_rvalue respectively.

            PR d/106139

    gcc/d/ChangeLog:

            * d-convert.cc (convert_expr): Handle casting from array to vector.
            (convert_for_rvalue): Rewrite vector to array casts of the same
            element type into a constructor.
            (convert_for_assignment): Return calling convert_for_rvalue.
            * expr.cc (ExprVisitor::visit (VectorExp *)): Handle generating a
            vector expression from a static array.
            * toir.cc (IRVisitor::visit (ReturnStatement *)): Call
            convert_for_rvalue on return value.

    gcc/testsuite/ChangeLog:

            * gdc.dg/pr106139a.d: New test.
            * gdc.dg/pr106139b.d: New test.
            * gdc.dg/pr106139c.d: New test.
            * gdc.dg/pr106139d.d: New test.

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

* [Bug d/106139] d: aggregate value used where floating point was expected
  2022-06-29 13:31 [Bug d/106139] New: d: aggregate value used where floating point was expected ibuclaw at gdcproject dot org
  2022-06-29 21:10 ` [Bug d/106139] " ibuclaw at gdcproject dot org
  2022-06-29 21:11 ` cvs-commit at gcc dot gnu.org
@ 2022-07-04 13:16 ` cvs-commit at gcc dot gnu.org
  2022-07-04 15:54 ` 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 @ 2022-07-04 13:16 UTC (permalink / raw)
  To: gcc-bugs

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

--- 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:32dfb075ad31413af9086ce546b5f5317a916d34

commit r12-8548-g32dfb075ad31413af9086ce546b5f5317a916d34
Author: Iain Buclaw <ibuclaw@gdcproject.org>
Date:   Wed Jun 29 21:52:39 2022 +0200

    d: Fix error: aggregate value used where floating point was expected

    Casting from vector to static array is permitted, and the frontend
    generates a reinterpret cast, but casting back the other way resulted in
    an error.  This has been fixed to be properly handled in the code
    generation pass of VectorExp, and the conversion for lvalue and rvalue
    handling done in convert_expr and convert_for_rvalue respectively.

            PR d/106139

    gcc/d/ChangeLog:

            * d-convert.cc (convert_expr): Handle casting from array to vector.
            (convert_for_rvalue): Rewrite vector to array casts of the same
            element type into a constructor.
            (convert_for_assignment): Return calling convert_for_rvalue.
            * expr.cc (ExprVisitor::visit (VectorExp *)): Handle generating a
            vector expression from a static array.
            * toir.cc (IRVisitor::visit (ReturnStatement *)): Call
            convert_for_rvalue on return value.

    gcc/testsuite/ChangeLog:

            * gdc.dg/pr106139a.d: New test.
            * gdc.dg/pr106139b.d: New test.
            * gdc.dg/pr106139c.d: New test.
            * gdc.dg/pr106139d.d: New test.

    (cherry picked from commit 329bef49da30158d30fed1106002bb71674776bd)

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

* [Bug d/106139] d: aggregate value used where floating point was expected
  2022-06-29 13:31 [Bug d/106139] New: d: aggregate value used where floating point was expected ibuclaw at gdcproject dot org
                   ` (2 preceding siblings ...)
  2022-07-04 13:16 ` cvs-commit at gcc dot gnu.org
@ 2022-07-04 15:54 ` cvs-commit at gcc dot gnu.org
  2022-07-05  9:40 ` cvs-commit at gcc dot gnu.org
  2022-07-05  9:50 ` ibuclaw at gdcproject dot org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-07-04 15:54 UTC (permalink / raw)
  To: gcc-bugs

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

--- 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:488759b7ea16972c4dfbb62926cd71996b1f77a7

commit r11-10109-g488759b7ea16972c4dfbb62926cd71996b1f77a7
Author: Iain Buclaw <ibuclaw@gdcproject.org>
Date:   Wed Jun 29 21:52:39 2022 +0200

    d: Fix error: aggregate value used where floating point was expected

    Casting from vector to static array is permitted, and the frontend
    generates a reinterpret cast, but casting back the other way resulted in
    an error.  This has been fixed to be properly handled in the code
    generation pass of VectorExp, and the conversion for lvalue and rvalue
    handling done in convert_expr and convert_for_rvalue respectively.

            PR d/106139

    gcc/d/ChangeLog:

            * d-convert.cc (convert_expr): Handle casting from array to vector.
            (convert_for_rvalue): Rewrite vector to array casts of the same
            element type into a constructor.
            (convert_for_assignment): Return calling convert_for_rvalue.
            * dmd/expressionsem.c (ExpressionSemanticVisitor::visit): Run
semantic
            on vector expression after lowering.
            * expr.cc (ExprVisitor::visit (VectorExp *)): Handle generating a
            vector expression from a static array.
            * toir.cc (IRVisitor::visit (ReturnStatement *)): Call
            convert_for_rvalue on return value.

    gcc/testsuite/ChangeLog:

            * gdc.dg/pr106139a.d: New test.
            * gdc.dg/pr106139b.d: New test.
            * gdc.dg/pr106139c.d: New test.
            * gdc.dg/pr106139d.d: New test.
            * gdc.test/fail_compilation/ice20264.d: New test.

    (cherry picked from commit 329bef49da30158d30fed1106002bb71674776bd)

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

* [Bug d/106139] d: aggregate value used where floating point was expected
  2022-06-29 13:31 [Bug d/106139] New: d: aggregate value used where floating point was expected ibuclaw at gdcproject dot org
                   ` (3 preceding siblings ...)
  2022-07-04 15:54 ` cvs-commit at gcc dot gnu.org
@ 2022-07-05  9:40 ` cvs-commit at gcc dot gnu.org
  2022-07-05  9:50 ` ibuclaw at gdcproject dot org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-07-05  9:40 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 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:0b909ae026e5aaf2ce42ef5c33128dbc06d29803

commit r10-10885-g0b909ae026e5aaf2ce42ef5c33128dbc06d29803
Author: Iain Buclaw <ibuclaw@gdcproject.org>
Date:   Wed Jun 29 21:52:39 2022 +0200

    d: Fix error: aggregate value used where floating point was expected

    Casting from vector to static array is permitted, and the frontend
    generates a reinterpret cast, but casting back the other way resulted in
    an error.  This has been fixed to be properly handled in the code
    generation pass of VectorExp, and the conversion for lvalue and rvalue
    handling done in convert_expr and convert_for_rvalue respectively.

            PR d/106139

    gcc/d/ChangeLog:

            * d-convert.cc (convert_expr): Handle casting from array to vector.
            (convert_for_rvalue): Rewrite vector to array casts of the same
            element type into a constructor.
            (convert_for_assignment): Return calling convert_for_rvalue.
            * dmd/expressionsem.c (ExpressionSemanticVisitor::visit): Run
semantic
            on vector expression after lowering.
            * expr.cc (ExprVisitor::visit (VectorExp *)): Handle generating a
            vector expression from a static array.

    gcc/testsuite/ChangeLog:

            * gdc.dg/pr106139a.d: New test.
            * gdc.dg/pr106139b.d: New test.
            * gdc.dg/pr106139c.d: New test.
            * gdc.dg/pr106139d.d: New test.
            * gdc.test/fail_compilation/ice20264.d: New test.

    (cherry picked from commit 488759b7ea16972c4dfbb62926cd71996b1f77a7)

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

* [Bug d/106139] d: aggregate value used where floating point was expected
  2022-06-29 13:31 [Bug d/106139] New: d: aggregate value used where floating point was expected ibuclaw at gdcproject dot org
                   ` (4 preceding siblings ...)
  2022-07-05  9:40 ` cvs-commit at gcc dot gnu.org
@ 2022-07-05  9:50 ` ibuclaw at gdcproject dot org
  5 siblings, 0 replies; 7+ messages in thread
From: ibuclaw at gdcproject dot org @ 2022-07-05  9:50 UTC (permalink / raw)
  To: gcc-bugs

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

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, and backported.

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

end of thread, other threads:[~2022-07-05  9:50 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-29 13:31 [Bug d/106139] New: d: aggregate value used where floating point was expected ibuclaw at gdcproject dot org
2022-06-29 21:10 ` [Bug d/106139] " ibuclaw at gdcproject dot org
2022-06-29 21:11 ` cvs-commit at gcc dot gnu.org
2022-07-04 13:16 ` cvs-commit at gcc dot gnu.org
2022-07-04 15:54 ` cvs-commit at gcc dot gnu.org
2022-07-05  9:40 ` cvs-commit at gcc dot gnu.org
2022-07-05  9:50 ` 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).