From Bugzilla Helper: User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.1) Gecko/20020823 Netscape/7.0 Description of problem: When I tried to compile a very simple program to call ipv6 related functions,including gethostbyname2, gethostbyname2_r, or getipnodebyname, a problem happened. You can find what i encountered in the following: [garros@ipv6 ip6test]$ gcc -o gethostbyname2 gethostbyname2.c gcc: Internal error: Segmentation fault (program as) Please submit a full bug report. See <URL:http://bugzilla.redhat.com/bugzilla/> for instructions. For saving your effort, I have enclosed my simple progam that i tested. In addition, I used 'gcc version 3.2 20020903' on redhat 8.0 (kernel 2.4.18-4). How reproducible: Always Steps to Reproduce: 1.gcc gethostbyname2.c Additional info: # This is gethostbyname2.c # #include <sys/types.h> #include <sys/socket.h> #include <netdb.h> #include <stdio.h> main(int argc, char **argv) { struct hostent *hp; char *s; char dname[40]; /* if((hp=getipnodebyname(argv[1],AF_INET6,0,err_num))==(struct hostent *)NULL) { */ if((hp=gethostbyname2(argv[1],AF_INET6))==(struct hostent *)NULL) { /* if(gethostbyname2_r(argv[1],AF_INET6,hp,NULL,0,NULL,NULL)==NULL){ */ fprintf(stderr,"Error occurred.\n"); exit(1); } if ((s = strchr(hp->h_name, '.')) != NULL) { strcpy(dname,++s); } fprintf(stdout,"hostname = %s, domainname = %s\n",hp->h_name,dname); fprintf(stderr,"h_addrtype = %d, h_length = %d, h_addr = %s\n", hp->h_addrtype, hp->h_length, hp->h_addr); }
Cannot reproduce it. Furthermore, from your error message it is gas, not gcc which segfaults, so you'd need attach assembly which as is segfaulting on (reproduceably).
I hardly understand your comment. Then what is your suggestion or your solution? What does it mean by "attach assebly"? by the way, the following tells me that internal error happened in gcc, doesn't it? ++ [garros@ip6 ip6test]$ gcc gethostbyname2.c gcc: Internal error: Segmentation fault (program as) Please submit a full bug report. See <URL:http://bugzilla.redhat.com/bugzilla/> for instructions. [garros@ip6 ip6test]$ gcc -v Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.2/specs Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --host=i386-redhat-linux --with-system-zlib --enable-__cxa_atexit Thread model: posix gcc version 3.2 20020903 (Red Hat Linux 8.0 3.2-7)
I have also been unable to reproduce this problem with the source code you provided. You might want to run a thorough stress test on your system to ensure it is not hardware related. Many gcc faults can be credited to quirky hardware. "memtest86" is a good start - http://www.memtest86.com
It tells you program as segfaulted and thus gcc driver couldn't build the program. By attaching assembly I mean that you do: gcc -S gethostbyname2.c and attach gethostbyname2.s it creates, provided that running as -o gethostbyname2.o gethostbyname2.s segfaults reproduceably. If not, it is most probably hardware problem.
No feedback, closing.