From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12817 invoked by alias); 22 Apr 2003 18:24:43 -0000 Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org Received: (qmail 12806 invoked from network); 22 Apr 2003 18:24:42 -0000 Received: from unknown (HELO smtp2.usherbrooke.ca) (132.210.13.6) by sources.redhat.com with SMTP; 22 Apr 2003 18:24:42 -0000 Received: from www01.usherb.ca (IDENT:root@imp.usherb.ca [132.210.13.57]) by smtp2.usherbrooke.ca (8.11.6/8.11.6) with ESMTP id h3MIObT20183; Tue, 22 Apr 2003 14:24:37 -0400 Received: (from apache@localhost) by www01.usherb.ca (8.11.6/8.11.6) id h3MIObc23257; Tue, 22 Apr 2003 14:24:37 -0400 X-Authentication-Warning: www01.usherb.ca: apache set sender to dikande@hermes.usherb.ca using -f To: Daniel Bolgheroni Subject: Re: Segmentation fault Causes Message-ID: <1051035877.3ea588e50a611@imp.usherb.ca> Date: Tue, 22 Apr 2003 18:24:00 -0000 From: =?ISO-8859-1?Q?Dikand=E9_Alain_Mo=EFse?= Cc: gcc-help@gcc.gnu.org References: <20030224045442.GA25932@uol.com.br> In-Reply-To: <20030224045442.GA25932@uol.com.br> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit User-Agent: IMP/PHP IMAP webmail program 2.2.8 X-Originating-IP: 132.210.22.81 X-MailScanner-Information: Veuillez consulter le http://www.usherbrooke.ca/vers/virus-courriel X-MailScanner: Aucun code suspect =?ISO-8859-1?Q?d=E9tect=E9?= X-MailScanner-SpamCheck: n'est pas un polluriel, SpamAssassin (score=-27.4, requis 5, BAYES_01, IN_REP_TO, QUOTED_EMAIL_TEXT, REFERENCES, REPLY_WITH_QUOTES, USER_AGENT, X_AUTH_WARNING) X-SW-Source: 2003-04/txt/msg00200.txt.bz2 .. Most of core dumping signals indicate bad pointer adresses to your outputs/inputs. Check that your program is not trying to access a memory location outside its address. Bad use of pointers cause bus errors and segmentation violations are typically out-of-bounds array references, and/or references through uninitialized or mangled pointers. Look very closely in your program for bizarre things like that. A frequent example of bad use of pointers adress in C is: int b; scanf("%d", b); When compiled, you will have the "segmentation fault" signal. Instead, with the correct version: int c; scanf("%d", &c); No "segmentation fault message(core file) is given(generated). In C++, a typical example is: int* q=new int[150]; cout<< q[100]; instead of the correct version: int* Q=new int[200]; cout << Q[199] Good Kuck.. En réponse à Daniel Bolgheroni : > What are the causes that a program can give an error "Segmentation fault > (core dumped)"? > > I'm compiling a program I'm writing but I getting some of this error > messages executing it. I looked into gcc FAQ and gcc 2.95 manual, but I > found no references to this problem. > > I'm using the following version of gcc: > > gcc version 2.95.3 20010315 (release) (NetBSD nb3) > > Thank you. > > > DIKANDÉ ALAIN MOÏSE Present: CERPEMA, Département de Physique, fac. Sciences, Univ. Sherbrooke J1k-2R1 Québec, Canada. tel: (819)821-8000 ext. 3043. Permanent: Département de Physique, Faculté des Sciences, Université de Douala BP 24157 Douala, Cameroun. "Le mépris des autres et des choses, plutôt que nous grandir, nous rabaisse et met en péril notre capacité de compréhension du monde et de l' humanité". Albert Einstein.