Bug 97042 - valgrind problems with subl $0x80000000, %reg
Summary: valgrind problems with subl $0x80000000, %reg
Status: RESOLVED WORKSFORME
Alias: None
Product: valgrind
Classification: Developer tools
Component: memcheck (show other bugs)
Version: 2.2.0
Platform: RedHat Enterprise Linux Linux
: NOR normal
Target Milestone: ---
Assignee: Julian Seward
URL:
Keywords: investigated, triaged
Depends on:
Blocks:
 
Reported: 2005-01-15 01:02 UTC by Jakub Jelinek
Modified: 2018-11-12 16:01 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Testcase (918 bytes, text/plain)
2005-01-15 01:03 UTC, Jakub Jelinek
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jakub Jelinek 2005-01-15 01:02:25 UTC
For details see http://gcc.gnu.org/PR18089

The following testcase when compiled with recent gcc CVS or with -DUSE_ASM
triggers valgrind's Conditional jump or move depends on uninitialised value(s),
although it doesn't depend on unitialized bits.
If subl $0x80000000, %reg is replaced with xorl $0x80000000, %reg (which appart
from %eflags that are ignored anyway should have identical behaviour), the
warning is not printed (correctly).
Comment 1 Jakub Jelinek 2005-01-15 01:03:51 UTC
Created attachment 9099 [details]
Testcase
Comment 2 Jeremy Fitzhardinge 2005-01-19 00:51:51 UTC
The problem is that there are some undefined bits in %eax when subl is run, and memcheck's undefinedness-propagation algorithm ends up making all of %eax undefined.  Because xor is bitwise, the undefinedness is contained, and eventually removed by the subsequent shifts.

Someone (Tridge?) proposed a precise algorithm for tracking definedness, but I don't think anyone has looked at implementing it yet.
Comment 3 Nicholas Nethercote 2005-01-19 04:51:28 UTC
This looks similar to the constants used for the fast strlen() code, which 
are usually 0x80808080, I think.  I think Julian may have made some 
progress with the accurate addition/subtraction tracking in Memcheck (it 
was Paul Mackerras that worked it out), in his own tree.


Comment 4 Julian Seward 2005-01-19 20:55:19 UTC
Memcheck does get tripped up on this kind of stuff -- we know various
specific trouble cases.  Recently I've completely rewritten the memcheck
engine, with a result that it tracks addition, subtraction, equality
comparison, floating point and SIMD integer operations much more accurately,
giving a reduced false-positive rate.  


> ------- Additional Comments From njn25 cam ac uk  2005-01-19 04:51 -------
> This looks similar to the constants used for the fast strlen() code, which
> are usually 0x80808080, I think.  I think Julian may have made some
> progress with the accurate addition/subtraction tracking in Memcheck (it
> was Paul Mackerras that worked it out), in his own tree.

Comment 5 Nicholas Nethercote 2009-07-02 06:14:59 UTC
I'm closing crashing and similar bugs that are more than two years old.  If
you still see this problem with Valgrind 3.4.1 please reopen the bug report.
Thanks.
Comment 6 Andrew Crouthamel 2018-09-19 04:36:08 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least 15 days. Please provide the requested information as soon as possible and set the bug status as REPORTED. Due to regular bug tracker maintenance, if the bug is still in NEEDSINFO status with no change in 30 days the bug will be closed as RESOLVED > WORKSFORME due to lack of needed information.

For more information about our bug triaging procedures please read the wiki located here: https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please mark the bug as REPORTED so that the KDE team knows that the bug is ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 7 Bug Janitor Service 2018-11-12 16:01:10 UTC
This bug has been in NEEDSINFO status with no change for at least
30 days. The bug is now closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

Thank you for helping us make KDE software even better for everyone!