Thread overview
[Issue 22587] ternary with function call and assert(0) leads to cod1 assertion
Dec 17, 2021
mhh
Jan 09, 2022
mhh
Jan 14, 2022
kubo39@gmail.com
Aug 04, 2022
kdevel
Dec 15, 2022
Dlang Bot
Dec 15, 2022
Dlang Bot
Dec 15, 2022
Dlang Bot
December 17, 2021
https://issues.dlang.org/show_bug.cgi?id=22587

--- Comment #1 from mhh <maxhaton@gmail.com> ---
---
int front(int param)
{
    return param ? 1 : assert(0);
}
---
also triggers it

--
January 09, 2022
https://issues.dlang.org/show_bug.cgi?id=22587

--- Comment #2 from mhh <maxhaton@gmail.com> ---
More detail, seems to require -O to go boom

--
January 14, 2022
https://issues.dlang.org/show_bug.cgi?id=22587

kubo39@gmail.com <hinoda2002@outlook.jp> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hinoda2002@outlook.jp

--- Comment #3 from kubo39@gmail.com <hinoda2002@outlook.jp> ---
*** Issue 22675 has been marked as a duplicate of this issue. ***

--
August 04, 2022
https://issues.dlang.org/show_bug.cgi?id=22587

kdevel <kdevel@vogtner.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kdevel@vogtner.de

--- Comment #4 from kdevel <kdevel@vogtner.de> ---
(In reply to mhh from comment #2)
> More detail, seems to require -O to go boom

z1.d
----
void foo (int i)
{
   int j = i == 1
      ? 7
      : assert (0);
}

$ dmd z1
Illegal instruction
$  dmd --version
DMD64 D Compiler v2.100.0
Copyright (C) 1999-2022 by The D Language Foundation, All Rights Reserved
written by Walter Bright

--
December 15, 2022
https://issues.dlang.org/show_bug.cgi?id=22587

Dlang Bot <dlang-bot@dlang.rocks> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull

--- Comment #5 from Dlang Bot <dlang-bot@dlang.rocks> ---
@maxhaton created dlang/dmd pull request #14698 "Fix Issue 23549, 22587 - Lower certain noreturn expressions to a comm…" fixing this issue:

- Fix Issue 23549, 22587 - Lower certain noreturn expressions to a comma expression rather than a cast.

  This avoids a backend segfault.

  GDC already does this lowering so it may have to be made optional via a
frontend parameter.

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

--
December 15, 2022
https://issues.dlang.org/show_bug.cgi?id=22587

Dlang Bot <dlang-bot@dlang.rocks> changed:

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

--- Comment #6 from Dlang Bot <dlang-bot@dlang.rocks> ---
dlang/dmd pull request #14698 "Fix Issue 23549, 22587 - Lower certain noreturn expressions to a comm…" was merged into stable:

- 5dd1f2942482d730418af8d7d3c5f754122116b8 by mhh:
  Fix Issue 23549, 22587 - Lower certain noreturn expressions to a comma
expression rather than a cast.

  This avoids a backend segfault.

  GDC already does this lowering so it may have to be made optional via a
frontend parameter.

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

--
December 15, 2022
https://issues.dlang.org/show_bug.cgi?id=22587

--- Comment #7 from Dlang Bot <dlang-bot@dlang.rocks> ---
dlang/dmd pull request #14701 "merge stable" was merged into master:

- d836c8bcec16205644e3aacf15f1a1cf7d655dd5 by mhh:
  Fix Issue 23549, 22587 - Lower certain noreturn expressions to a comma
expression rather than a cast.

  This avoids a backend segfault.

  GDC already does this lowering so it may have to be made optional via a
frontend parameter.

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

--