From owner-freebsd-hackers Sat Dec 19 12:20:44 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id MAA13280 for freebsd-hackers-outgoing; Sat, 19 Dec 1998 12:20:44 -0800 (PST) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from hydrogen.fircrest.net (mg-20664222-16.ricochet.net [206.64.222.16]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id MAA13263 for ; Sat, 19 Dec 1998 12:20:36 -0800 (PST) (envelope-from gurney_j@efn.org) Received: (from jmg@localhost) by hydrogen.fircrest.net (8.9.1/8.8.7) id MAA12496; Sat, 19 Dec 1998 12:20:27 -0800 (PST) Message-ID: <19981219122025.22295@hydrogen.nike.efn.org> Date: Sat, 19 Dec 1998 12:20:25 -0800 From: John-Mark Gurney To: FreeBSD Hackers Subject: _rtld_bind_start Segfault Mime-Version: 1.0 Content-Type: multipart/mixed; boundary=ZO5zC0uMSeAMfFXi X-Mailer: Mutt 0.69 Reply-To: John-Mark Gurney Organization: Cu Networking X-Operating-System: FreeBSD 3.0-CURRENT i386 X-PGP-Fingerprint: B7 EC EF F8 AE ED A7 31 96 7A 22 B3 D8 56 36 F4 X-Files: The truth is out there X-URL: http://resnet.uoregon.edu/~gurney_j/ Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG --ZO5zC0uMSeAMfFXi Content-Type: text/plain; charset=us-ascii has anyone else encountered stange segfaults when calling libc functions late in yor program? I have run across a couple programs that would segfault upon calling a libc function, but if you "prebound" it in your program by calling that function earlier, you don't run into any problems... also, if you have main return instead of calling exit, the program will segfault at address 0x13.... attached is the file that I first saw this problem... this file isn't my code, but some code that I want sent to help find an unrelated problem in... I am running on 3.0-R with a partially updated kernel (mainly cam updated)... and I just tested this on bento.freebsd.org and it behaves the same... (blah.c in /tmp on bento) there are two ifdefs.. if you compile the program without any special defines, it segfaults when it hits the first printf... if you define BIND_PRINTF, it will run, but segfault upon the return... if you define CALL_EXIT, it will exit normally, but there is no reason that you should have to specially bind and call exit from a program... any ideas? -- John-Mark Gurney Voice: +1 541 684 8449 Cu Networking P.O. Box 5693, 97405 Live in Peace, destroy Micro$oft, support free software, run FreeBSD Don't trust anyone you don't have the source for --ZO5zC0uMSeAMfFXi Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="blah.c" #include #define MAX 20 int main() { int A[MAX][MAX]; int B[MAX][MAX]; int C[MAX][MAX]; /* result AB */ int i, j, k; /* loop vars */ int temp; /* holds C(i,j) while computing */ int counter1 = 0; /* number of times first branch executed */ int counter2 = 0; /* number of times second branch executed */ #ifdef BIND_PRINTF printf(""); #endif for (j = 0; j < MAX; j++) { for (i = 0; i < MAX; i++); { A[i][j] = i - j; B[i][j] = i + j; } } temp = 0; for (j = 0; j < MAX; j++) { for (i = 0; i < MAX; i++) { for (k = 0; k < MAX; k++) { temp += A[i][k]*B[k][j]; } C[i][j] = temp; printf("temp: %d\n",temp); if (temp > 0) { temp = -1; counter1++; } if (temp < 0) { temp = 0; counter2++; } } } printf("New value was > 0 %d times\n",counter1); printf("After if, value was < 0 %d times\n",counter2); #ifdef CALL_EXIT exit(0); #endif return 0; } --ZO5zC0uMSeAMfFXi-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message