From mint-bounce@lists.fishpool.fi Tue Jan 22 17:31:26 2008
X-Original-To: fnaumann@mail.boerde.de
Delivered-To: fnaumann@mail.boerde.de
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=googlemail.com; s=gamma;
h=domainkey-signature:received:received:date:from:to:cc:subject:message-id:in-reply-to:references:x-mailer:mime-version:content-type:content-transfer-encoding;
bh=A4CIrOhV/U71vVAczXvJUJffLNnr/RFFqG6/jLVoU8w=;
b=ly3lRs+zTPR24jczPDmpfL6aNDjA0YTZTpzaAsCynwACNVLEY6XSSQvMtcWi0OxIsh+35wNUCcykyUMIZqweDs6nn/oehb6OmE2bRI9sc+LWagWC+/sx7pZ7u4XGtjUikza7nXDm9J+yL2emejomsb7W/MziplThu0P5A51EGto=
DomainKey-Signature: a=rsa-sha1; c=nofws;
d=googlemail.com; s=gamma;
h=date:from:to:cc:subject:message-id:in-reply-to:references:x-mailer:mime-version:content-type:content-transfer-encoding;
b=b4BFsX6OkwI7MKKImmnZHPnI+dBZveJ3bUJM/jgNPq0oNIqpQVCW9kKL/PTGZPdDADV+A89h5al6hCMSeFNMAEWxygnx2Iamw/UCGqIRDTPNKTEW24ld9dHC4VEMVh0DtQkeLCkgF/XYCe6inC5EpkdKWbQ0gjEB20SUYGNB4sQ=
Date: Thu, 27 Dec 2007 12:07:41 +0100
From: Thomas Huth
To: mint@lists.fishpool.fi
Cc: dogbird@earthlink.net
Subject: Re: [MiNT] Stack problems with GCC 4
Message-ID: <20071227120741.78fb93e4@phineus>
In-Reply-To: <47707C52.6070609@earthlink.net>
References: <1198456590.9451.17.camel@localhost>
<477028EF.6020205@earthlink.net>
<47700A74.30938.1E33059@anodyne.cyberus.ca>
<47707C52.6070609@earthlink.net>
X-Mailer: Claws Mail 2.10.0 (GTK+ 2.12.0; powerpc-unknown-linux-gnu)
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
X-ecartis-version: Ecartis v1.0.0
Sender: mint-bounce@lists.fishpool.fi
Errors-To: mint-bounce@lists.fishpool.fi
X-original-sender: th.huth@googlemail.com
Precedence: bulk
List-help:
List-unsubscribe:
List-Id:
X-List-ID:
List-subscribe:
List-owner:
List-post:
X-Virus-Scanned: by amavisd-new at relay.boerde.de
X-Spam-Checker-Version: SpamAssassin 2.63 (2004-01-11) on relay.boerde.de
X-Spam-Status: No, hits=-1.0 tagged_above=-50.5 required=7.0 tests=BAYES_00
X-Spam-Level:
Status:
X-Status:
X-Keywords:
On Mon, 24 Dec 2007 21:43:14 -0600
josephus wrote:
> I have a K&R reference that says before you can put
> data into a pointer you must malloc that pointer. I am opening a
> passed in file name. I started with
> FILE * ptr;
>
> but I got a sigerr when I opened the file. to fix the sig err I
> malloced the pointer ptr. the sig err went away.
fopen will normally take care of allocating the memory for the FILE*,
you don't have to do that manually. So unless you've screwed up the
parameters for fopen, there really should be no segmentation fault or
something similar there.
> sigerrs are the most useless linux error. it tells you nothing.
Well, it tells you that your program did something stupid, e.g. it
accessed memory that is not part of it's address space. You can use
tools like "catchsegv" and "gdb" to debug such problems.
> I sometimes get spontaneous sigerrs. some I can fix and some I
> cannot. it works now, wait and hold your mouth right and it will
> fail. no changes in environment. so I end up trying to make it work.
Sounds like you're programming with a lot of dangling or illegal
pointers. You should make sure to initialize all unused pointer
variables to NULL, and also set pointer variables to NULL after you've
free()ed the memory again.
Thomas