View mode: basic / threaded / horizontal-split · Log in · Help
March 24, 2004
body and in statement with gdc
Hello, 

in file socket.d i get an error message: 
gdc -c socket.d 
socket.d:
In function `add': 
socket.d:0: interner Compiler-Fehler: Speicherzugriffsfehler
Please submit a full bug report, 
with preprocessed source if appropriate. 
See
<URL:http://gcc.gnu.org/bugs.html> for instructions. 

the function add start
in line  780 . 

Here is a code snip 

typedef int socket_t = -1; 
const
socket_t INVALID_SOCKET = socket_t.init; 
void add(socket_t s) 
//      /*
in 
       { 
               version(Win32) 
               {
assert(count < max); //added too many sockets; specify a higher max in the
constructor 
               } 
       } 
       body 
//        */ 
       {
version(Win32) 
               { 
                       uint c = count;
first[c] = s; 
                       count = c + 1; 
               }
else version(linux) 
               {
//bts(cast(uint*)&first[fdelt(s)], cast(uint)s % nfdbits); 
               }
else 
               { 
                       static assert(0);
}
} 


You can put this in a file and try to compile there appear the same error
message. 
I believe the problem is the "in" and "body" statements. 

Manfred
March 24, 2004
Re: body and in statement with gdc
> I believe the problem is the "in" and "body" statements. 

I found the minimal code of this problem.

void bug()
in {
   version (Win32) { // it's safe when it is 'linux' (on Linux)
   }
}
body {
}

And I found another fatal bug:

void bug() {
   char[][int] a;
   int[] i = a.keys;
}

> gdc -c bug_assoc_key.d 
bug_assoc_key.d: In function `bug':
bug_assoc_key.d:0: internal compiler error: in emit_move_insn, at expr.c:3165
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.

And not fatal bug:

void bug() {
   typedef double D;
   D d = cast(D)0.0;
}

> gdc -c bug_typedef_double_cast.d
bug_typedef_double_cast.d: In function `bug':
bug_typedef_double_cast.d:0: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.

And I cannot judge whether it's a bug or not:

void bug() {
   int d = 1;
   d /= 1.0;
}

> gdc -c bug_double_div.d
bug_double_div.d: In function `bug':
bug_double_div.d:0: internal compiler error: in expand_fix, at optabs.c:4905
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.

------------------
shinichiro.h
 s31552@mail.ecc.u-tokyo.ac.jp
 http://user.ecc.u-tokyo.ac.jp/~s31552/wp/
March 24, 2004
Re: body and in statement with gdc
I'm sorry I post continuously.

I found another fatal bug:

class Base {
       void bug() {}
}
class Derived : Base {
       void bug() { super.bug(); }    // call Derived::bug!
}
int main() {
       Base b = new Derived();
       b.bug();
       return 0;
}

It can be compiled and linked, but it fail with segmentation fault.
Because super.bug() call Derived::bug() recursively.

------------------
shinichiro.h
 s31552@mail.ecc.u-tokyo.ac.jp
 http://user.ecc.u-tokyo.ac.jp/~s31552/wp/
Top | Discussion index | About this forum | D home