- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

= 0.5;
}
}
}
int main(int argc, char** argv[])
{
int i ,j;
short flag;
float x1, x2, x3, x4, x5, x6;
int dim;
flag = 0;
/* initialize all array entries to 0.5 */
init_buffer(g_buffer);
/* make it appear as if the array dimensions are not known
* at compile time */
assert(argc==1);
dim = argc*DIM;
for (i = 1; i < dim; i++)
{
for (j = 0; j < dim; j++)
{
x1 = g_buffer

;
x2 = g_buffer[i-1];
/* this condition should never be true */
if ((x1 == 0) || (x2 == 0))
{
flag = 1;
}
else
{
x3 = x1 * x1;
x4 = x1 * x3;
x5 = x2 * x2;
/* this condition should never be true */
if ((x4 * 0.1) > x5)
{
flag = 1;
}
else
{
x6 = x2 * x5;
/* this condition should never be true */
if (x3 < (x6 * 0.1))
{
flag = 1;
}
}
}
}
}
/* The result should always be 0, but with optimizations enabled we get the result 1. */
printf("Result: %d\n", flag);
return 0;
}
[/cpp]

Link Copied

7 Replies

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page