Thread overview
[Bug 235] ICE with array slice assign on 32 bit
Aug 14, 2016
Iain Buclaw
Oct 22, 2016
Iain Buclaw
Oct 22, 2016
Iain Buclaw
Oct 29, 2016
Johannes Pfau
August 14, 2016
http://bugzilla.gdcproject.org/show_bug.cgi?id=235

--- Comment #1 from Iain Buclaw <ibuclaw@gdcproject.org> ---
I guess the right way to go about it is to separate save_expr into lvalue and rvalue variants.  Probably the best way to ensure we don't try to initialize a temporary.

Places that really need save_expr I guess would then just call save_expr directly.

-- 
You are receiving this mail because:
You are watching all bug changes.
October 22, 2016
http://bugzilla.gdcproject.org/show_bug.cgi?id=235

--- Comment #2 from Iain Buclaw <ibuclaw@gdcproject.org> ---
Looks like something recursive is going on.

---
$ gdc bug235.d -m32 -fdump-tree-original=stdout

;; Function func1 (_D6bug2355func1FZAa)
;; enabled by -tree-original

{
  return <retval> = {.length=0, .ptr=0B};
}

;; Function test1 (_D6bug2355test1FZv)
;; enabled by -tree-original

gdc: internal compiler error: Segmentation fault (program cc1d)
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
---

It hangs for a while before the segfault.  Best guess would be stack overflow.

-- 
You are receiving this mail because:
You are watching all bug changes.
October 22, 2016
http://bugzilla.gdcproject.org/show_bug.cgi?id=235

--- Comment #3 from Iain Buclaw <ibuclaw@gdcproject.org> ---
In compound_expr
---
if (TREE_CODE (arg1) == TARGET_EXPR)
  {
    // If the rhs is a TARGET_EXPR, then build the compound expression
    // inside the target_expr's initializer.  This helps the compiler
    // to eliminate unnecessary temporaries.
    tree init = compound_expr(arg0, TREE_OPERAND (arg1, 1));
    TREE_OPERAND (arg1, 1) = init;

    return arg1;
  }
---

(gdb) call debug_generic_expr (arg1)
TARGET_EXPR <D.3436, func1 () [return slot optimization]>

---

(gdb) call debug_generic_expr (init)
{
  char * D.3438;
  uint D.3437;

  D.3437 = (TARGET_EXPR <D.3436, func1 () [return slot optimization]>).length;
  D.3438 = (TARGET_EXPR <D.3436, func1 () [return slot optimization]>).ptr;
  while (1)
    {
      if (D.3437 == 0) break;
      *D.3438 = 121;
      D.3438++ ;
      D.3437-- ;
    }
}, func1 () [return slot optimization];

---

This is where the recursion comes from.  On x86_64 no TARGET_EXPR is created. I'd say the creation of a TARGET_EXPR may be dubious anyway.  Hmm...

-- 
You are receiving this mail because:
You are watching all bug changes.
October 29, 2016
http://bugzilla.gdcproject.org/show_bug.cgi?id=235

Johannes Pfau <johannespfau@gmail.com> changed:

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

--- Comment #4 from Johannes Pfau <johannespfau@gmail.com> ---
https://github.com/D-Programming-GDC/GDC/commit/30764bdc2b7587f672eb51dd8704575db30010f6

-- 
You are receiving this mail because:
You are watching all bug changes.