public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug d/106623] New: internal compiler error: Segmentation fault at gimple-expr.cc:88
@ 2022-08-15 12:09 ibuclaw at gdcproject dot org
  2022-08-15 19:37 ` [Bug d/106623] " cvs-commit at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: ibuclaw at gdcproject dot org @ 2022-08-15 12:09 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 106623
           Summary: internal compiler error: Segmentation fault at
                    gimple-expr.cc:88
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: d
          Assignee: ibuclaw at gdcproject dot org
          Reporter: ibuclaw at gdcproject dot org
  Target Milestone: ---

When compiling with -O1 and above.

---
private struct _Complex(T) { T re; T im; }
enum __c_complex_double : _Complex!double;

pragma(inline, true)
size_t hashOf()(scope const double val)
{
    return *cast(size_t*)&val;
}

pragma(inline, true)
size_t hashOf()(scope const _Complex!double val, size_t seed = 0)
{
    return hashOf(val.re) + hashOf(val.im);
}

pragma(inline, true)
size_t hashOf()(__c_complex_double val, size_t seed = 0)
{
    return hashOf(cast(_Complex!double) val, seed);
}

int main()
{
    __c_complex_double val;
    return cast(int)hashOf(val);
}
---

The conflating between native complex and struct representation in the code
generation bites us in the optimization pass.

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

* [Bug d/106623] internal compiler error: Segmentation fault at gimple-expr.cc:88
  2022-08-15 12:09 [Bug d/106623] New: internal compiler error: Segmentation fault at gimple-expr.cc:88 ibuclaw at gdcproject dot org
@ 2022-08-15 19:37 ` cvs-commit at gcc dot gnu.org
  2022-08-15 20:34 ` cvs-commit at gcc dot gnu.org
  2022-08-15 20:43 ` ibuclaw at gdcproject dot org
  2 siblings, 0 replies; 4+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-08-15 19:37 UTC (permalink / raw)
  To: gcc-bugs

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

--- 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:e206fecaac29f559f4990312b875604eb1ce3ef3

commit r13-2057-ge206fecaac29f559f4990312b875604eb1ce3ef3
Author: Iain Buclaw <ibuclaw@gdcproject.org>
Date:   Mon Aug 15 17:51:03 2022 +0200

    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.

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

* [Bug d/106623] internal compiler error: Segmentation fault at gimple-expr.cc:88
  2022-08-15 12:09 [Bug d/106623] New: internal compiler error: Segmentation fault at gimple-expr.cc:88 ibuclaw at gdcproject dot org
  2022-08-15 19:37 ` [Bug d/106623] " cvs-commit at gcc dot gnu.org
@ 2022-08-15 20:34 ` cvs-commit at gcc dot gnu.org
  2022-08-15 20:43 ` ibuclaw at gdcproject dot org
  2 siblings, 0 replies; 4+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-08-15 20:34 UTC (permalink / raw)
  To: gcc-bugs

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

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

commit r12-8688-gdc230a0c690794cd45cc4065fa13303fd6cdfc40
Author: Iain Buclaw <ibuclaw@gdcproject.org>
Date:   Mon Aug 15 17:51:03 2022 +0200

    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)

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

* [Bug d/106623] internal compiler error: Segmentation fault at gimple-expr.cc:88
  2022-08-15 12:09 [Bug d/106623] New: internal compiler error: Segmentation fault at gimple-expr.cc:88 ibuclaw at gdcproject dot org
  2022-08-15 19:37 ` [Bug d/106623] " cvs-commit at gcc dot gnu.org
  2022-08-15 20:34 ` cvs-commit at gcc dot gnu.org
@ 2022-08-15 20:43 ` ibuclaw at gdcproject dot org
  2 siblings, 0 replies; 4+ messages in thread
From: ibuclaw at gdcproject dot org @ 2022-08-15 20:43 UTC (permalink / raw)
  To: gcc-bugs

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

Iain Buclaw <ibuclaw at gdcproject dot org> changed:

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

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

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

end of thread, other threads:[~2022-08-15 20:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-15 12:09 [Bug d/106623] New: internal compiler error: Segmentation fault at gimple-expr.cc:88 ibuclaw at gdcproject dot org
2022-08-15 19:37 ` [Bug d/106623] " cvs-commit at gcc dot gnu.org
2022-08-15 20:34 ` cvs-commit at gcc dot gnu.org
2022-08-15 20:43 ` 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).