From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by listman.redhat.com (Postfix) with ESMTP id B95513EB48 for ; Mon, 8 Jul 2002 22:42:45 -0400 (EDT) Received: (from mail@localhost) by int-mx1.corp.redhat.com (8.11.6/8.11.6) id g692gjg24492 for axp-list@listman.redhat.com; Mon, 8 Jul 2002 22:42:45 -0400 Received: from mx1.redhat.com (mx1.redhat.com [172.16.48.31]) by int-mx1.corp.redhat.com (8.11.6/8.11.6) with SMTP id g692gja24488 for ; Mon, 8 Jul 2002 22:42:45 -0400 Received: from mailserver.iplink.net (IDENT:root@smtp.iplink.net [192.139.81.186]) by mx1.redhat.com (8.11.6/8.11.6) with SMTP id g692WM910653 for ; Mon, 8 Jul 2002 22:32:22 -0400 Received: from romeo.iplink.net ([206.108.4.57]:19638 "EHLO iplink.net") by ml.comspec.com with ESMTP id ; Mon, 8 Jul 2002 22:42:27 -0400 Message-ID: <3D2A4D92.5080508@iplink.net> Date: Mon, 08 Jul 2002 22:42:26 -0400 From: Alvin Starr User-Agent: Mozilla/5.0 (X11; U; Linux alpha; en-US; rv:1.0.0) Gecko/20020607 X-Accept-Language: en-us, en MIME-Version: 1.0 To: axp-list@redhat.com Subject: Re: Floating point on alpha References: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Loop: axp-list@redhat.com Sender: axp-list-admin@redhat.com Errors-To: axp-list-admin@redhat.com X-BeenThere: axp-list@redhat.com X-Mailman-Version: 2.0.1 Precedence: bulk Reply-To: axp-list@redhat.com List-Help: List-Post: List-Subscribe: , List-Id: Linux and Red Hat on Alpha processors List-Unsubscribe: , List-Archive: Donsbach, Jeff wrote: > Purify would flag this usage of "a" as a "UMR" or uninitialized memory read. I.e. it is a lurking bug. Stack variables are not required to be initialized to zero as the code seems to assume. > > > >>-----Original Message----- >>From: Linus Gasser [mailto:ineiti@gmx.net] >>Sent: Tuesday, July 02, 2002 8:11 AM >>To: axp-list@redhat.com >>Subject: Floating point on alpha >> >> >>Hi all, >>I have a general question for alphas: from time to time when >>I try to compile >>a program for my alpha (PC164), I run into problems with >>doubles. For example >> >>{ >> double a; >> >> if ( a ){ It has always been my impression that testing a float for 0 is in general not a good idea. If you set it to 0 you will usualy get the response you expect but there are a number of issues around floating point numbers and the formats they are kept in. Like +0 and -0 not being quite the same as 0. The other thing is that you can get a number very close to 0 but is not quite 0. There is a certain amount of ambiguity about floting point numbers and it just does not seem good form to use them as boolean values. There are more floating point formats out there than you can shake a stick at and you need to be carefull when using them. >> printf( "love\n" ); >> } else { >> printf( "peace\n" ); >> } >>} >> >>seems to run w/o problems on an i386 and produces "peace" as >>output. Now, on >>an alpha (can't test it right now, but try it out and tell >>me), it segfaults, >>cause 'a' is not defined. Seems logical to me. But as it runs >>on i386, lots >>of programs have this kind of logic (gnome-print had it, >>breakout2 had it, >>scribus had it, noteedit has it (note the had/has and try to >>figure out which >>program I'd like to run on my alpha ;-) ). >> Now my question: is it possible to remove this behaviour with a good >>compiler-switch? Because going over these programs, searching for >>non-initialised doubles gets on my nerves. OK, I should, as >>it is really bad >>programming, and I could contribute like this (and did >>sometimes). But >>still... Any hints? >> >>Ineiti >> >>PS: if this 'magic' compiler switch doesn't exist, I have a >>question about gdb >>with libraries and how to use the '-g' switch in this case. >>Just to find >>those #@$%-variables... -- Alvin Starr || voice: (416)585-9971 Interlink Connectivity || fax: (416)585-9974 alvin@iplink.net ||