Skip to content

Incorrect tests in dwarf.exp #6

Description

@greno4ka

# I found several incorrect tests in dwarf.exp!

When I make check on i586, I have next results:

libdwarftest.so->treetest({ 2, nil, nil })       = { 3, nil, nil }
libdwarftest.so->treetest({ 3, nil, { 4, nil, nil } } <unfinished ...>
libdwarftest.so->treetest({ 4, nil, nil })       = { 5, nil, nil }
<... treetest resumed> )                         = { 4, nil, { 5, nil, nil } }
<... treetest resumed> )                         = { 2, { 3, nil, nil }, { 4, nil, { 5, nil, nil } } }

It seems that they are right, but they fail tests

On x86_64 the picture is following:

libdwarftest.so->treetest({ 2, nil, nil })       = nil
libdwarftest.so->treetest({ 3, nil, { 4, nil, nil } } <unfinished ...>
libdwarftest.so->treetest({ 4, nil, nil })       = nil
<... treetest resumed> )                         = { 5, nil, nil }
<... treetest resumed> )                         = { 2, { 3, nil, nil }, { 4, nil, { 5, nil, nil } } }

The tests are passed, but I think values are wrong.
Probably solution is to add some actions with tree in treetest function, such as this.

struct tree treetest(struct tree* t)
{
    if(t->left  != NULL) printf("%d",treetest(t->left).x);
    if(t->right != NULL) printf("%d",treetest(t->right).x);
    t->x++;
    return *t;
}

With such addition, the results on x86_64 the same as on i586. I propose, that gcc optimizes this function. Even with -O0.

Please, can you verify your tests?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions