On Fri, Jan 12, 2018 at 10:49:45AM -0800, H. S. Teoh via Digitalmars-d-learn
wrote:
> On Fri, Jan 12, 2018 at 11:09:47AM +, kdevel via Digitalmars-d-learn
> wrote:
> [...]
[...]
> > https://issues.dlang.org/show_bug.cgi?id=18232
>
> Yep, definitely a codegen bug. Apparently, local
On Fri, Jan 12, 2018 at 11:09:47AM +, kdevel via Digitalmars-d-learn wrote:
[...]
> On Friday, 12 January 2018 at 02:16:39 UTC, Adam D. Ruppe wrote:
[...]
> > I'd file this as a compiler codegen bug.
>
> https://issues.dlang.org/show_bug.cgi?id=18232
Yep, definitely a codegen bug.
Thanks for the quick answer!
On Friday, 12 January 2018 at 02:16:39 UTC, Adam D. Ruppe wrote:
On Friday, 12 January 2018 at 00:54:03 UTC, kdevel wrote:
$ dmd crash.d
$ ./crash
Nicholas Wilson is right that you can use = "" to work around
it, but with strings, null is supposed to behave the
On Friday, 12 January 2018 at 00:54:03 UTC, kdevel wrote:
$ dmd crash.d
$ ./crash
Nicholas Wilson is right that you can use = "" to work around it,
but with strings, null is supposed to behave the same way.
And this gives different (each wrong) behavior on -m32 vs -m64,
which leads me to
On 01/12/2018 02:45 AM, Nicholas Wilson wrote:
because you don't initialise `s` in
string toString ()
{
string s;
return s;
}
so it defaults to `string s = null;` thus giving a segfault.
try `string s = "";` instead.
A null string is a perfectly fine empty string.
On Friday, 12 January 2018 at 01:45:37 UTC, Nicholas Wilson wrote:
so it defaults to `string s = null;` thus giving a segfault.
null and "" are basically the same for strings. that's not the
problem.
On Friday, 12 January 2018 at 00:54:03 UTC, kdevel wrote:
crash.d
```
import std.stdio;
union U {
float f;
int i;
string toString ()
{
string s;
return s;
}
}
void main ()
{
U u;
writeln (u);
}
```
$ dmd crash.d
$ ./crash
because you don't initialise `s` in
crash.d
```
import std.stdio;
union U {
float f;
int i;
string toString ()
{
string s;
return s;
}
}
void main ()
{
U u;
writeln (u);
}
```
$ dmd crash.d
$ ./crash
std.exception.ErrnoException@/.../dmd2/linux/bin64/../../src/phobos/std/stdio.d(2776):
(Bad