]> git.ipfire.org Git - thirdparty/gcc.git/commit
d: Fix internal compiler error: Segmentation fault at gimple-expr.cc:88
authorIain Buclaw <ibuclaw@gdcproject.org>
Mon, 15 Aug 2022 15:51:03 +0000 (17:51 +0200)
committerIain Buclaw <ibuclaw@gdcproject.org>
Mon, 15 Aug 2022 20:32:54 +0000 (22:32 +0200)
commitdc230a0c690794cd45cc4065fa13303fd6cdfc40
tree9e8b2f8101ecca35d7e5ffc9ab0edd3688d6dc38
parent0dd50365ba1556cc3b9e8b24551e978f9de14eec
d: Fix internal compiler error: Segmentation fault at gimple-expr.cc:88

Because complex types are deprecated in the language, the new way to
expose native complex types is by defining an enum with a basetype of a
library-defined struct that is implicitly treated as-if it is native.
As casts are not implicitly added by the front-end when downcasting from
enum to its underlying type, we must insert an explicit cast during the
code generation pass.

PR d/106623

gcc/d/ChangeLog:

* d-codegen.cc (underlying_complex_expr): New function.
(d_build_call): Handle passing native complex objects as the
library-defined equivalent.
* d-tree.h (underlying_complex_expr): Declare.
* expr.cc (ExprVisitor::visit (DotVarExp *)): Call
underlying_complex_expr instead of build_vconvert.

gcc/testsuite/ChangeLog:

* gdc.dg/torture/pr106623.d: New test.

(cherry picked from commit e206fecaac29f559f4990312b875604eb1ce3ef3)
gcc/d/d-codegen.cc
gcc/d/d-tree.h
gcc/d/expr.cc
gcc/testsuite/gdc.dg/torture/pr106623.d [new file with mode: 0644]