Thread overview | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
May 31, 2013 Segfault on simple program? | ||||
---|---|---|---|---|
| ||||
import std.stdio ;
void foo ( int[] array ) {
foreach ( i ; array ) { writeln ( i ) ; }
}
void main () {
foo ( [ 1, 2, 3 ] ) ;
}
On both DMD 2.062 and 2.063 this compiles OK but causes a segfault. I'm running Kubuntu Raring 64-bit. Any hints?
--
Shriramana Sharma ஶ்ரீரமணஶர்மா श्रीरमणशर्मा
|
May 31, 2013 Re: Segfault on simple program? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Shriramana Sharma | Shriramana Sharma:
> On both DMD 2.062 and 2.063 this compiles OK but causes a segfault.
> I'm running Kubuntu Raring 64-bit. Any hints?
I have no hints. But on Windows32 I see no segfault. And the online 64 bit Linux (dpaste) gives no errors.
Bye,
bearophile
|
May 31, 2013 Re: Segfault on simple program? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Shriramana Sharma | On Friday, 31 May 2013 at 17:14:46 UTC, Shriramana Sharma wrote:
> import std.stdio ;
>
> void foo ( int[] array ) {
> foreach ( i ; array ) { writeln ( i ) ; }
> }
>
> void main () {
> foo ( [ 1, 2, 3 ] ) ;
> }
>
> On both DMD 2.062 and 2.063 this compiles OK but causes a segfault.
> I'm running Kubuntu Raring 64-bit. Any hints?
Can't reproduce this. Any chance of a stacktrace and/or disassembly?
|
May 31, 2013 Re: Segfault on simple program? | ||||
---|---|---|---|---|
| ||||
Posted in reply to John Colvin | On Fri, May 31, 2013 at 11:46 PM, John Colvin <john.loughran.colvin@gmail.com> wrote: > > Can't reproduce this. Any chance of a stacktrace and/or disassembly? Please give instructions as to how I can get either of those two for you. Would you like the binary produced? -- Shriramana Sharma ஶ்ரீரமணஶர்மா श्रीरमणशर्मा |
May 31, 2013 Re: Segfault on simple program? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Shriramana Sharma | On Friday, 31 May 2013 at 18:22:44 UTC, Shriramana Sharma wrote: > On Fri, May 31, 2013 at 11:46 PM, John Colvin > <john.loughran.colvin@gmail.com> wrote: >> >> Can't reproduce this. Any chance of a stacktrace and/or disassembly? > > Please give instructions as to how I can get either of those two for > you. Would you like the binary produced? given a program named "test" in the current directory gdb ./test run #will segfault bt full and copy the output. |
May 31, 2013 Re: Segfault on simple program? | ||||
---|---|---|---|---|
| ||||
Posted in reply to John Colvin | On Sat, Jun 1, 2013 at 12:07 AM, John Colvin <john.loughran.colvin@gmail.com> wrote: > given a program named "test" in the current directory > > gdb ./test > run #will segfault > bt full > > and copy the output. Did it (after installing libc6-dbg just in case) but it doesn't seem to be very useful: (gdb) bt full #0 0x000000000043dd20 in _d_dso_registry () No symbol table info available. #1 0x000000000043862f in ?? () No symbol table info available. #2 0x0000000000000001 in ?? () No symbol table info available. #3 0x0000000000463898 in TypeInfo_PS3std5array17__T8AppenderTAxaZ8Appender4Data.__init() () No symbol table info available. #4 0x0000000000460bc8 in ?? () No symbol table info available. #5 0x0000000000460db8 in ?? () No symbol table info available. #6 0x0000000000460610 in ?? () No symbol table info available. #7 0x0000000000460bc8 in ?? () No symbol table info available. #8 0x0000000000000040 in ?? () No symbol table info available. #9 0x000000000045790d in __libc_csu_init () No symbol table info available. #10 0x00007ffff760ee35 in __libc_start_main (main=0x43b0d0 <main>, argc=1, ubp_av=0x7fffffffdf58, init=0x4578b0 <__libc_csu_init>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffdf48) at libc-start.c:219 result = <optimized out> unwind_buf = {cancel_jmp_buf = {{jmp_buf = {0, 140737351945365, 140733193388033, 0, 1, 140737343639840, 0, 0}, mask_was_saved = 4392416}}, priv = {pad = {0x7ffff7def725 <_dl_runtime_resolve+53>, 0x1c, 0x4578b0 <__libc_csu_init>, 0x7fffffffdf58}, data = { prev = 0x7ffff7def725 <_dl_runtime_resolve+53>, cleanup = 0x1c, canceltype = 4552880}}} not_first_call = <optimized out> #11 0x0000000000430609 in _start () No symbol table info available. -- Shriramana Sharma ஶ்ரீரமணஶர்மா श्रीरमणशर्मा |
June 01, 2013 Re: Segfault on simple program? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Shriramana Sharma | On Friday, 31 May 2013 at 17:14:46 UTC, Shriramana Sharma wrote:
> import std.stdio ;
>
> void foo ( int[] array ) {
> foreach ( i ; array ) { writeln ( i ) ; }
> }
>
> void main () {
> foo ( [ 1, 2, 3 ] ) ;
> }
>
> On both DMD 2.062 and 2.063 this compiles OK but causes a segfault.
> I'm running Kubuntu Raring 64-bit. Any hints?
Works for me ubuntu 64.
Do you have both versions installed?
Would it compile if you used the wrong druntime / phobos libraries?
|
June 01, 2013 Re: Segfault on simple program? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Anthony Goins | On Sat, Jun 1, 2013 at 6:02 AM, Anthony Goins <neontotem@gmail.com> wrote: > > Works for me ubuntu 64. > Do you have both versions installed? Of course not. The later install from the distributed DEB (from dlang.org) overwrites the earlier one by apt install. > Would it compile if you used the wrong druntime / phobos libraries? I don't have any D-related packages on my system other than the stock DMD AMD64 package. Even libphobos2-4.6-dev which is available for Raring is not installed. -- Shriramana Sharma ஶ்ரீரமணஶர்மா श्रीरमणशर्मा |
June 01, 2013 Re: Segfault on simple program? | ||||
---|---|---|---|---|
| ||||
On Sat, Jun 1, 2013 at 6:39 AM, Shriramana Sharma <samjnaa@gmail.com> wrote: > I don't have any D-related packages on my system other than the stock DMD AMD64 package. Even libphobos2-4.6-dev which is available for Raring is not installed. That was actually slightly incorrect. I had installed gdc apart from dmd -- just to see how the two work out. It's only after that I installed gdc (I had only used dmd) that D programs segfaulted. Now I went into /var/log/ and extracted yesterday's installation details from dpkg.log and purged all the packages that gdc pulled in -- mostly it was old gcc-4.6 and related files. Nevertheless, the horrible fact is that not only this program I initially posted on this thread but any and all D programs I compile produce a segfault! Please help! -- Shriramana Sharma ஶ்ரீரமணஶர்மா श्रीरमणशर्मा |
June 01, 2013 Re: Segfault on simple program? | ||||
---|---|---|---|---|
| ||||
On Sat, Jun 1, 2013 at 1:27 PM, Shriramana Sharma <samjnaa@gmail.com> wrote: > > Nevertheless, the horrible fact is that not only this program I initially posted on this thread but any and all D programs I compile produce a segfault! All programs compiled by *DMD* produce a segfault. Programs compiled by GDC work just fine. What is this, some sort of incompatibility between compilers? Like GDC went and told my system "hey look only D programs compiled by me should work"?! I couldn't try LDC since they don't have Ubuntu packages and I couldn't figure out how to install the binary tarball. Please help! -- Shriramana Sharma ஶ்ரீரமணஶர்மா श्रीरमणशर्मा |
Copyright © 1999-2021 by the D Language Foundation