Jump to page: 1 2 3
Thread overview
32-bit DMD compiled programs prints "segmentation fault"
Nov 01, 2019
Gilmar Júnior
Nov 01, 2019
Seb
Nov 02, 2019
Walter Bright
Nov 02, 2019
Suleyman
Nov 03, 2019
Walter Bright
Nov 03, 2019
Suleyman
Nov 03, 2019
Exil
Nov 03, 2019
Suleyman
Nov 03, 2019
Exil
Nov 03, 2019
Suleyman
Nov 05, 2019
Exil
Nov 05, 2019
H. S. Teoh
Nov 05, 2019
Adam D. Ruppe
Nov 05, 2019
kinke
Nov 05, 2019
kinke
Nov 05, 2019
kinke
Nov 06, 2019
Exil
Nov 06, 2019
Jonathan Marler
Nov 06, 2019
Ethan
Nov 06, 2019
Jonathan Marler
Nov 06, 2019
Ethan
Nov 06, 2019
Exil
November 01, 2019
Hello, D programs compiled with 32-bit DMD are not working. I compiled with dmd and also tested rdmd using version 2.086.0-0 for both 32-bit and the 64-bit with -m32 directive, and it didn't work. I also tested the nightly version I downloaded today and the execution continues to print "segmentation fault (core dumped)". The same error does NOT occur when using LDC.
November 01, 2019
On Friday, 1 November 2019 at 21:16:23 UTC, Gilmar Júnior wrote:
> Hello, D programs compiled with 32-bit DMD are not working. I compiled with dmd and also tested rdmd using version 2.086.0-0 for both 32-bit and the 64-bit with -m32 directive, and it didn't work. I also tested the nightly version I downloaded today and the execution continues to print "segmentation fault (core dumped)". The same error does NOT occur when using LDC.

This unfortunately is a well-known issue:

https://issues.dlang.org/show_bug.cgi?id=19116

tl;dr: use LDC. It's better maintained, faster, has support for tons of architectures etc.

Alternatively, you could also switch to ld.gold which you probably want to do anyhow if you can (faster link times!) or x86_64.

November 01, 2019
On 11/1/2019 4:03 PM, Seb wrote:
> On Friday, 1 November 2019 at 21:16:23 UTC, Gilmar Júnior wrote:
>> Hello, D programs compiled with 32-bit DMD are not working. I compiled with dmd and also tested rdmd using version 2.086.0-0 for both 32-bit and the 64-bit with -m32 directive, and it didn't work. I also tested the nightly version I downloaded today and the execution continues to print "segmentation fault (core dumped)". The same error does NOT occur when using LDC.
> 
> This unfortunately is a well-known issue:
> 
> https://issues.dlang.org/show_bug.cgi?id=19116
> 
> tl;dr: use LDC. It's better maintained, faster, has support for tons of architectures etc.
> 
> Alternatively, you could also switch to ld.gold which you probably want to do anyhow if you can (faster link times!) or x86_64.
> 

Why does the PIE code gen work fine on Linux but not Debian?

(It passes all the 32 bit tests on the autotester.)
November 02, 2019
On Saturday, 2 November 2019 at 00:04:27 UTC, Walter Bright wrote:
> Why does the PIE code gen work fine on Linux but not Debian?
>
> (It passes all the 32 bit tests on the autotester.)

GCC 6 enabled PIE by default, you have to disable it manually with `-no-pie`. The auto-tester uses and ancient GCC version which is not affected.
November 03, 2019
On Friday, 1 November 2019 at 23:03:23 UTC, Seb wrote:
> tl;dr: use LDC. It's better maintained,

How many people are maintaining LDC in comparison to DMD?


November 03, 2019
On Sunday, 3 November 2019 at 00:15:29 UTC, Exil wrote:
> On Friday, 1 November 2019 at 23:03:23 UTC, Seb wrote:
>> tl;dr: use LDC. It's better maintained,
>
> How many people are maintaining LDC in comparison to DMD?

That wouldn't be a fair question because frontend development is backend agnostic, and the backend of LDC is a separate project project LLVM.
November 02, 2019
On 11/2/2019 10:06 AM, Suleyman wrote:
> On Saturday, 2 November 2019 at 00:04:27 UTC, Walter Bright wrote:
>> Why does the PIE code gen work fine on Linux but not Debian?
>>
>> (It passes all the 32 bit tests on the autotester.)
> 
> GCC 6 enabled PIE by default, you have to disable it manually with `-no-pie`. The auto-tester uses and ancient GCC version which is not affected.

Yes, but I'd like to know exactly what code sequence generated by dmd is not working, vs what ldc is generating that does work.
November 03, 2019
On Sunday, 3 November 2019 at 04:34:18 UTC, Suleyman wrote:
> On Sunday, 3 November 2019 at 00:15:29 UTC, Exil wrote:
>> On Friday, 1 November 2019 at 23:03:23 UTC, Seb wrote:
>>> tl;dr: use LDC. It's better maintained,
>>
>> How many people are maintaining LDC in comparison to DMD?
>
> That wouldn't be a fair question because frontend development is backend agnostic, and the backend of LDC is a separate project project LLVM.

Those kinds of decisions are in part what affect the maintainability of a project, so it would be a fair assessment to include.
November 03, 2019
On Sunday, 3 November 2019 at 18:35:41 UTC, Exil wrote:
>> [...]
>
> Those kinds of decisions are in part what affect the maintainability of a project, so it would be a fair assessment to include.

Let's just say it's a lot less than LLVM maintainers. Usually the backend just works but we could use some more backend contributors.
Translating the backend from C to D was a step in the right direction, but it still looks like C. Maybe it can be modernized. But Walter has a pile of more important work at all levels, language, frontend, and backend, so lesser the dependence on Walter is except for getting approval the more can be achieved in parallel.

November 03, 2019
On Sunday, 3 November 2019 at 04:36:50 UTC, Walter Bright wrote:
> On 11/2/2019 10:06 AM, Suleyman wrote:
>> On Saturday, 2 November 2019 at 00:04:27 UTC, Walter Bright wrote:
>>> Why does the PIE code gen work fine on Linux but not Debian?
>>>
>>> (It passes all the 32 bit tests on the autotester.)
>> 
>> GCC 6 enabled PIE by default, you have to disable it manually with `-no-pie`. The auto-tester uses and ancient GCC version which is not affected.
>
> Yes, but I'd like to know exactly what code sequence generated by dmd is not working, vs what ldc is generating that does work.

There is nothing wrong with DMD, the problem is in the coordination with the linker.
For example:
```
extern(C):

void printf(const char*, ...);

int g = 10;

void main()
{
    printf("OK\n");
    int i = g;      // crash
    printf("%d\n", i);
}
```
Note: compile the program with -betterC to avoid linking druntime.

This program crashes, but if you add the -fPIC switch it works.

LDC has -fPIC by default.

« First   ‹ Prev
1 2 3