From: "Alex Bennée" <alex.bennee@linaro.org>
To: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>
Cc: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>,
"cota@braap.org" <cota@braap.org>,
"jhauser@eecs.berkeley.edu" <jhauser@eecs.berkeley.edu>,
"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
Denis Lunev <den@virtuozzo.com>
Subject: Re: [Qemu-devel] [PATCH] Fix: fp-test uninitialized member floatX::exp
Date: Tue, 13 Aug 2019 13:21:54 +0100 [thread overview]
Message-ID: <8736i5ntlp.fsf@linaro.org> (raw)
In-Reply-To: <573f907d-5016-60c1-c727-c5444a418e1b@virtuozzo.com>
Andrey Shinkevich <andrey.shinkevich@virtuozzo.com> writes:
> PINGING...
Sorry about the delay. I did attempt see if the existing code threw up
any errors when built with clang's undefined sanitizer. I think this is
because xPtr->exp will only get read if none of the xPtr->isFOO returns
false. In all those cases xPtr->exp is set.
What pointed you towards this missing initialisations?
>
> On 30/07/2019 13:13, Andrey Shinkevich wrote:
>> Not all the paths in the functions, such as f16ToFloatX(), initialize
>> the member 'exp' of the structure floatX.
>>
>> Signed-off-by: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>
>> ---
>> source/slowfloat.c | 4 ++++
>> 1 file changed, 4 insertions(+)
>>
>> diff --git a/tests/fp/berkeley-testfloat-3/source/slowfloat.c b/tests/fp/berkeley-testfloat-3/source/slowfloat.c
>> index 4e84656..6e0f0a6 100644
>> --- a/tests/fp/berkeley-testfloat-3/source/slowfloat.c
>> +++ b/tests/fp/berkeley-testfloat-3/source/slowfloat.c
>> @@ -623,6 +623,7 @@ static void f16ToFloatX( float16_t a, struct floatX *xPtr )
>> xPtr->isInf = false;
>> xPtr->isZero = false;
>> xPtr->sign = ((uiA & 0x8000) != 0);
>> + xPtr->exp = 0;
>> exp = uiA>>10 & 0x1F;
>> sig64 = uiA & 0x03FF;
>> sig64 <<= 45;
>> @@ -759,6 +760,7 @@ static void f32ToFloatX( float32_t a, struct floatX *xPtr )
>> xPtr->isInf = false;
>> xPtr->isZero = false;
>> xPtr->sign = ((uiA & 0x80000000) != 0);
>> + xPtr->exp = 0;
>> exp = uiA>>23 & 0xFF;
>> sig64 = uiA & 0x007FFFFF;
>> sig64 <<= 32;
>> @@ -895,6 +897,7 @@ static void f64ToFloatX( float64_t a, struct floatX *xPtr )
>> xPtr->isInf = false;
>> xPtr->isZero = false;
>> xPtr->sign = ((uiA & UINT64_C( 0x8000000000000000 )) != 0);
>> + xPtr->exp = 0;
>> exp = uiA>>52 & 0x7FF;
>> sig64 = uiA & UINT64_C( 0x000FFFFFFFFFFFFF );
>> if ( exp == 0x7FF ) {
>> @@ -1220,6 +1223,7 @@ static void f128MToFloatX( const float128_t *aPtr, struct floatX *xPtr )
>> xPtr->isZero = false;
>> uiA64 = uiAPtr->v64;
>> xPtr->sign = ((uiA64 & UINT64_C( 0x8000000000000000 )) != 0);
>> + xPtr->exp = 0;
>> exp = uiA64>>48 & 0x7FFF;
>> sig.v64 = uiA64 & UINT64_C( 0x0000FFFFFFFFFFFF );
>> sig.v0 = uiAPtr->v0;
>>
--
Alex Bennée
next prev parent reply other threads:[~2019-08-13 12:22 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-30 10:13 [Qemu-devel] [PATCH] Fix: fp-test uninitialized member floatX::exp Andrey Shinkevich
2019-08-13 12:03 ` Andrey Shinkevich
2019-08-13 12:21 ` Alex Bennée [this message]
2019-08-20 17:01 ` Andrey Shinkevich
2019-08-27 15:05 ` Andrey Shinkevich
2019-08-27 15:59 ` Alex Bennée
2019-08-29 15:50 ` Andrey Shinkevich
2019-08-20 15:16 ` Andrey Shinkevich
2019-08-20 15:21 ` Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8736i5ntlp.fsf@linaro.org \
--to=alex.bennee@linaro.org \
--cc=andrey.shinkevich@virtuozzo.com \
--cc=cota@braap.org \
--cc=den@virtuozzo.com \
--cc=jhauser@eecs.berkeley.edu \
--cc=qemu-devel@nongnu.org \
--cc=vsementsov@virtuozzo.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.