X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-workers-bounces using -f From: Martin Str|mberg Message-Id: <200203022210.XAA05451@father.ludd.luth.se> Subject: Re: libm signed/unsigned warnings In-Reply-To: <8011-Sat02Mar2002205420+0200-eliz@is.elta.co.il> from Eli Zaretskii at "Mar 2, 2002 08:54:20 pm" To: djgpp-workers AT delorie DOT com Date: Sat, 2 Mar 2002 23:10:35 +0100 (MET) X-Mailer: ELM [version 2.4ME+ PL54 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Reply-To: djgpp-workers AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp-workers AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk According to Eli Zaretskii: > > From: Martin Str|mberg > > - if((j<<(52-k))==ly) yisint = 2-(j&1); > > + if((((__uint32_t)(j))<<(52-k))==ly) yisint = 2-(j&1); > > This seems okay, but is mighty ugly. Can you find a better way of > shutting up GCC in this case? Perhaps. But I'd really like somebody who understands the code to make more extensive changes. > > - if(((t1&sign)==sign)&&(s1&sign)==0) s0 += 1; > > + if((t1&sign)&&(s1&sign)==0) s0 += 1; > > ix0 -= t; > > if (ix1 < t1) ix0 -= 1; > > ix1 -= t1; > > > > __int32_t sign = (int)0x80000000U; > > __uint32_t t1,s1; > > > > (t1&sign)==sign checks if the sign bit is set or not. The comparision > > with sign should be uneccessary. > > I don't understand the original problem here: both t1 and sign are > int's, so why does GCC complain? What is the exact language of the > warning? No. t1 is unsigned. > > - if(ix>0x80000000U) z = (invsqrtpi*cc)/__ieee754_sqrtf(x); > > + if((__uint32_t)ix>0x80000000U) z = (invsqrtpi*cc)/__ieee754_sqrtf(x); > > I tend to think that this is a bug in the original code, since ix is > computed a few lines above this like so: > > ix = hx&0x7fffffff; > > So its high bit can never be set, and the comparison should always > fail. Am I missing something? I'm missing which file we're talking about... > Perhaps you could add a call to abort() into that if clause, and see > if it ever gets called when you run the cygnus test suite from djtst. Anyway the abort() is a good idea. Right, MartinS