Jump to page: 1 2
Thread overview
Is this a bug?
Nov 26, 2013
Jerry
Nov 27, 2013
bearophile
Nov 27, 2013
growler
Nov 27, 2013
H. S. Teoh
Nov 27, 2013
Jerry
Nov 27, 2013
Jerry
Nov 27, 2013
H. S. Teoh
Nov 27, 2013
evilrat
Nov 27, 2013
Philippe Sigaud
Nov 27, 2013
Jerry
Nov 27, 2013
deadalnix
Nov 27, 2013
Jerry
Nov 27, 2013
H. S. Teoh
Nov 27, 2013
H. S. Teoh
Nov 28, 2013
Kenji Hara
Dec 02, 2013
H. S. Teoh
Dec 02, 2013
Jerry
Nov 27, 2013
Orfeo
Nov 27, 2013
David Eagen
November 26, 2013
If I read correctly, the following is legal code.  If you comment out one of the case statements, it does the expected thing.  With 4 or more, it crashes.  This is with dmd 2.064.2 on Debian.

If it's a bug, I'll file a report.  Thanks!

class BB {}
class DD : CC {}
class CC : BB {
  static CC create(string s) {
    // Succeeds with 3 cases, fails with 4
    switch (s) {
    case "en":
    case "it":
    case "ru":
    case "ko": return new DD;
    default: throw new Exception("blech");
    }
  }
}

void main() {
    CC.create("en");
}

jlquinn@wyvern:~/d$ ~/dmd2/linux/bin64/dmd switchbug.d -g
jlquinn@wyvern:~/d$ ./switchbug
Segmentation fault (core dumped)



November 27, 2013
Jerry:

> This is with dmd 2.064.2 on Debian.
> If it's a bug, I'll file a report.  Thanks!

I see no crash on Windows 32 bit.

Bye,
bearophile
November 27, 2013
On Wednesday, 27 November 2013 at 00:55:21 UTC, bearophile wrote:
> Jerry:
>
>> This is with dmd 2.064.2 on Debian.
>> If it's a bug, I'll file a report.  Thanks!
>
> I see no crash on Windows 32 bit.
>
> Bye,
> bearophile

No crash on Fedora 19 x86_64

Cheers G.
November 27, 2013
On Tue, Nov 26, 2013 at 06:33:28PM -0500, Jerry wrote:
> If I read correctly, the following is legal code.  If you comment out one of the case statements, it does the expected thing.  With 4 or more, it crashes.  This is with dmd 2.064.2 on Debian.
> 
> If it's a bug, I'll file a report.  Thanks!
> 
> class BB {}
> class DD : CC {}
> class CC : BB {
>   static CC create(string s) {
>     // Succeeds with 3 cases, fails with 4
>     switch (s) {
>     case "en":
>     case "it":
>     case "ru":
>     case "ko": return new DD;
>     default: throw new Exception("blech");
>     }
>   }
> }
> 
> void main() {
>     CC.create("en");
> }
> 
> jlquinn@wyvern:~/d$ ~/dmd2/linux/bin64/dmd switchbug.d -g
> jlquinn@wyvern:~/d$ ./switchbug
> Segmentation fault (core dumped)
[...]

No crash on dmd git HEAD, Debian/unstable (x86_64).


T

-- 
"Outlook not so good." That magic 8-ball knows everything! I'll ask about Exchange Server next. -- (Stolen from the net)
November 27, 2013
On Tuesday, 26 November 2013 at 23:33:30 UTC, Jerry wrote:
> This is with dmd 2.064.2 on Debian.

windows 64 bit no crash.
November 27, 2013
No crash on Linux (Kubuntu) 32bits, DMD 2.064.2.

Works with 5 or 6 case's also.
November 27, 2013
"H. S. Teoh" <hsteoh@quickfur.ath.cx> writes:

> On Tue, Nov 26, 2013 at 06:33:28PM -0500, Jerry wrote:
>> If I read correctly, the following is legal code.  If you comment out one of the case statements, it does the expected thing.  With 4 or more, it crashes.  This is with dmd 2.064.2 on Debian.
>> 
>> If it's a bug, I'll file a report.  Thanks!
>> 
>> class BB {}
>> class DD : CC {}
>> class CC : BB {
>>   static CC create(string s) {
>>     // Succeeds with 3 cases, fails with 4
>>     switch (s) {
>>     case "en":
>>     case "it":
>>     case "ru":
>>     case "ko": return new DD;
>>     default: throw new Exception("blech");
>>     }
>>   }
>> }
>> 
>> void main() {
>>     CC.create("en");
>> }
>> 
>> jlquinn@wyvern:~/d$ ~/dmd2/linux/bin64/dmd switchbug.d -g
>> jlquinn@wyvern:~/d$ ./switchbug
>> Segmentation fault (core dumped)
> [...]
>
> No crash on dmd git HEAD, Debian/unstable (x86_64).
>

If I build dmd from the sources, the program works.  It's only the precompiled dmd executable that generates a broken binary.
November 27, 2013
Jerry <jlquinn@optonline.net> writes:

> "H. S. Teoh" <hsteoh@quickfur.ath.cx> writes:
>
>> On Tue, Nov 26, 2013 at 06:33:28PM -0500, Jerry wrote:
>>> If I read correctly, the following is legal code.  If you comment out one of the case statements, it does the expected thing.  With 4 or more, it crashes.  This is with dmd 2.064.2 on Debian.
>>> 
>>> If it's a bug, I'll file a report.  Thanks!
>>> 
>>> class BB {}
>>> class DD : CC {}
>>> class CC : BB {
>>>   static CC create(string s) {
>>>     // Succeeds with 3 cases, fails with 4
>>>     switch (s) {
>>>     case "en":
>>>     case "it":
>>>     case "ru":
>>>     case "ko": return new DD;
>>>     default: throw new Exception("blech");
>>>     }
>>>   }
>>> }
>>> 
>>> void main() {
>>>     CC.create("en");
>>> }
>>> 
>>> jlquinn@wyvern:~/d$ ~/dmd2/linux/bin64/dmd switchbug.d -g
>>> jlquinn@wyvern:~/d$ ./switchbug
>>> Segmentation fault (core dumped)
>> [...]
>>
>> No crash on dmd git HEAD, Debian/unstable (x86_64).
>>
>
> If I build dmd from the sources, the program works.  It's only the precompiled dmd executable that generates a broken binary.

Sorry, not true.  I had the extra case commented out.  Uncommenting it still gives me a crashing program.
November 27, 2013
Philippe Sigaud <philippe.sigaud@gmail.com> writes:

> No crash on Linux (Kubuntu) 32bits, DMD 2.064.2.
>
> Works with 5 or 6 case's also.

This is actually Ubuntu 12.10 64 bit.  The last mysterious crash I had was due to the use of gold vs ld.  It seems Debian and Ubuntu are the only ones using gold at the moment.

I'm wondering if this problem is the same kind of thing.

Jerry
November 27, 2013
On Wednesday, 27 November 2013 at 07:09:17 UTC, Jerry wrote:
> Philippe Sigaud <philippe.sigaud@gmail.com> writes:
>
>> No crash on Linux (Kubuntu) 32bits, DMD 2.064.2.
>>
>> Works with 5 or 6 case's also.
>
> This is actually Ubuntu 12.10 64 bit.  The last mysterious crash I had
> was due to the use of gold vs ld.  It seems Debian and Ubuntu are the
> only ones using gold at the moment.
>
> I'm wondering if this problem is the same kind of thing.
>
> Jerry

Yes, I faced quite a lot of trouble with gold and dmd. They simply do not mix.
« First   ‹ Prev
1 2