llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

track bit-level constraints

Open llvmbot opened this issue 18 years ago • 15 comments

Bugzilla Link 3098
Version unspecified
OS All
Reporter LLVM Bugzilla Contributor
CC @tkremenek,@socketpair,@xuzhongxing

Extended Description

From SVN revision 59590:

[14] Taking false branch. 221 if (priv->plot_flags & APPLY_SHIFT) 222 { 223 spoints = goo_canvas_points_new (fdata->dparams.nchan); 224 for (i = 0; i < fdata->dparams.nchan; i++) 225 { 226 spoints->coords[2i] = (double)i * fdata->dparams.msi / 1e6; 227 spoints->coords[2i+1] = pshifted[i] * 180 / M_PI; /* rad2deg */ 228 } 229 free (pshifted); 230 }

[15] Taking false branch. 232 if (!shift_only) 233 { 234 mg_2d_plot_add_data_with_tag (MG_2D_PLOT (priv->plot), 235 mg_plot_data_new_from_points (points, data->colour), "phase_response"); 236 }

[16] Taking true branch. 237 if (priv->plot_flags & APPLY_SHIFT) 238 { 239 mg_2d_plot_add_data_with_tag (MG_2D_PLOT (priv->plot),

[17] Pass-by-value argument ('spoints') in function is undefined. 240 mg_plot_data_new_from_points (spoints, "red"), "phase_response_with_shift");

Branches [14] and [16] refer to the same conditional and it can't change between the two, I'm not sure how [17] could ever possibly be true.

llvmbot avatar Nov 19 '08 09:11 llvmbot

mentioned in issue llvm/llvm-bugzilla-archive#7152

tkremenek avatar Nov 27 '21 05:11 tkremenek

mentioned in issue llvm/llvm-bugzilla-archive#6150

tkremenek avatar Nov 27 '21 05:11 tkremenek

mentioned in issue llvm/llvm-bugzilla-archive#4173

tkremenek avatar Nov 27 '21 01:11 tkremenek

*** Bug llvm/llvm-bugzilla-archive#28187 has been marked as a duplicate of this bug. ***

devincoughlin avatar Jun 21 '16 01:06 devincoughlin

We have some ideas of a bitwise constraint checker in addition to our range constraint checker, but no one's actually sat down and built it. I should add that to the Open Projects page at http://clang-analyzer.llvm.org/open_projects.html.

belkadan avatar Apr 03 '14 20:04 belkadan

*** Bug llvm/llvm-bugzilla-archive#10199 has been marked as a duplicate of this bug. ***

belkadan avatar Apr 03 '14 20:04 belkadan

*** Bug llvm/llvm-bugzilla-archive#19046 has been marked as a duplicate of this bug. ***

belkadan avatar Apr 03 '14 20:04 belkadan

Just hit this today; any plans? Looking at the various reports, even just handling "simple" cases -- where mutation of both operands is impossible between checks -- would be very useful.

Also, looks like Bug 10199 and Bug 17538 are duplicates too.

llvmbot avatar Nov 22 '13 19:11 llvmbot

*** Bug llvm/llvm-bugzilla-archive#6150 has been marked as a duplicate of this bug. ***

tkremenek avatar Apr 05 '11 22:04 tkremenek

*** Bug llvm/llvm-bugzilla-archive#7152 has been marked as a duplicate of this bug. ***

tkremenek avatar May 17 '10 19:05 tkremenek

A very small test case:


void testfunc(int myval) { char *myptr = (char *)0; char buf[1024];

if (myval & 0x0f)
    myptr = buf;
if (myval & 0x0f)
    *myptr = '!';

}

While bit-level constraints would be great, it would reduce false positives just to detect when conditionals are identical.

llvmbot avatar Oct 01 '09 08:10 llvmbot

*** Bug llvm/llvm-bugzilla-archive#4173 has been marked as a duplicate of this bug. ***

tkremenek avatar Jul 16 '09 00:07 tkremenek

This false positive is caused by two things:

(a) We don't track field values yet.

I've added support for initializing global structs to symbolic value.

(b) We need to model the effect of doing a bitmask using '&', which projects out bits of an integer, testing them for 0 or 1. We need to model such bits symbolically.

We need bit-support infrastructure for this.

xuzhongxing avatar Nov 19 '08 13:11 xuzhongxing

This false positive is caused by two things:

(a) We don't track field values yet.

(b) We need to model the effect of doing a bitmask using '&', which projects out bits of an integer, testing them for 0 or 1. We need to model such bits symbolically.

tkremenek avatar Nov 19 '08 09:11 tkremenek

assigned to @tkremenek

llvmbot avatar Nov 19 '08 09:11 llvmbot