[Issue 6665] Regression(2.055) ICE(cg87.c): static double inside closure

2011-10-22 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6665


Walter Bright bugzi...@digitalmars.com changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||bugzi...@digitalmars.com
 Resolution||FIXED


--- Comment #8 from Walter Bright bugzi...@digitalmars.com 2011-10-22 
00:28:07 PDT ---
https://github.com/D-Programming-Language/dmd/commit/517098887b5dee1e91c69610b8c4056c17e191ce

https://github.com/D-Programming-Language/dmd/commit/6277161a9c606c6cdba37500a230e7d71a31d629

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 6665] Regression(2.055) ICE(cg87.c): static double inside closure

2011-10-19 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6665


Maksim Zholudev maxim...@gmail.com changed:

   What|Removed |Added

 CC||maxim...@gmail.com


--- Comment #7 from Maksim Zholudev maxim...@gmail.com 2011-10-19 07:37:08 
PDT ---
More investigation.

- test.d -
struct Foo
{
double[2][2] dat;

double foo(size_t i, size_t j)
{
return dat[i][j] = 0;
}
}

void main()
{
Foo a;
}
--

Tested on Linux 64bit with dmd 2.055:
dmd -m32 test.d  - OK
dmd -m64 test.d  - Internal error: ../ztc/cg87.c 202
dmd -m32 -release test.d - OK
dmd -m64 -release test.d - OK

There is no error in any of the following cases:
  * dat is one-dimensional
  * one of the indexes in Foo.foo is constant (e.g. dat[i][0] = 0)
  * int or real used instead of double (float still produces the error)

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 6665] Regression(2.055) ICE(cg87.c): static double inside closure

2011-10-13 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6665


David Simcha dsim...@yahoo.com changed:

   What|Removed |Added

 CC||dsim...@yahoo.com


--- Comment #4 from David Simcha dsim...@yahoo.com 2011-10-13 10:53:08 PDT ---
FWIW, I've found another way to reproduce this bug:

import std.range, std.algorithm;

double fun(double x) { return x; }

void main() {
map!(fun)(indexed([1.0, 2], [0, 1]));
}

Using DMD64 on Linux (This is a 64-bit specific issue, adding -m32 makes it go
away.  It also only happens with -release.)

dmd test.d -release
Internal error: ../ztc/cg87.c 202

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 6665] Regression(2.055) ICE(cg87.c): static double inside closure

2011-10-13 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6665



--- Comment #5 from David Simcha dsim...@yahoo.com 2011-10-13 11:37:07 PDT ---
Even more thoroughly reduced test case:

void main()
{
auto foo = Indexed([1.0f, 2, 3], [1, 2, 3]);
}

@property ref T front(T)(T[] a)
{
return a[0];
}

struct Indexed
{
float[] _source;
int[] _indices;

@property float front(float newVal)
{
return _source[_indices.front] = newVal;
}

}

$ dmd test.d -release
Internal error: ../ztc/cg87.c 202

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 6665] Regression(2.055) ICE(cg87.c): static double inside closure

2011-10-13 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6665



--- Comment #6 from David Simcha dsim...@yahoo.com 2011-10-13 11:38:40 PDT ---
BTW, all this stuff works on the latest GDC, so it's definitely not in any code
shared between DMD and GDC.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 6665] Regression(2.055) ICE(cg87.c): static double inside closure

2011-09-14 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6665


Don clugd...@yahoo.com.au changed:

   What|Removed |Added

   Keywords||ice-on-valid-code
 CC||clugd...@yahoo.com.au
Summary|Internal error: |Regression(2.055)
   |../ztc/cg87.c 202   |ICE(cg87.c): static double
   ||inside closure


--- Comment #1 from Don clugd...@yahoo.com.au 2011-09-14 05:16:24 PDT ---
Probably a result of the fix for bug 6505.
It may be 64 bit specific, I cannot reproduce on Windows. I'm assuming that the
imports are:

import std.algorithm;
import std.array;
import std.stdio;
import std.range;

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 6665] Regression(2.055) ICE(cg87.c): static double inside closure

2011-09-14 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6665



--- Comment #2 from iteronve...@gmail.com 2011-09-14 13:03:36 PDT ---
Yes, the imports are what you have listed.

This might be just a Linux issue.  Here are the results for 32-bit Linux:

Compiles but gives 'Segmentation fault'
void main(){

  auto f = (double m){ static double sum = 0.0; return sum += m * m; };
  double[] a = array(map!f(iota(1.0, 25.0, 1.0)));
  writeln(a);
}


Compiles but gives 'Segmentation fault'
void main(){

  auto f = (double m){ /* static double sum = 0.0;*/ return m * m; };
  double[] a = array(map!f(iota(1.0, 25.0, 1.0)));
  writeln(a);
}


Compiles and runs
void main(){

  auto f = (double m){ /* static double sum = 0.0;*/ return m * m; };
  double[] a = array(map!f(array(iota(1.0, 25.0, 1.0;
  writeln(a);
}


Compiles and runs
void main(){

  auto f = (double m){ static double sum = 0.0; return sum += m * m; };
  double[] a = array(map!f(array(iota(1.0, 25.0, 1.0;
  writeln(a);
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 6665] Regression(2.055) ICE(cg87.c): static double inside closure

2011-09-14 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6665



--- Comment #3 from Don clugd...@yahoo.com.au 2011-09-14 18:15:21 PDT ---
Compiling the first case with -inline gives an error: 
c:\dmd\windows\bin\..\..\src\phobos\std\algorithm.d(423): Error: function D
main
 is a nested function and cannot be accessed from array

which is completely wrong -- why does it think main() is a nested function???
So even on Windows this shows a serious problem with the inliner. But the
inlining bug isn't a regression, the same error message applies also as far
back as 2.035.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---