Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handling of designated initialisers #1

Open
mpflanzer opened this issue May 31, 2015 · 0 comments
Open

Handling of designated initialisers #1

mpflanzer opened this issue May 31, 2015 · 0 comments
Labels

Comments

@mpflanzer
Copy link
Owner

If designated initialisers are used remove-unused-struct-field creduce fails to remove the designator from the initialiser list. The field and the initialiser(s) are nevertheless removed which leads to invalid code.

Run test-case with:
$ clang_delta --transformation=remove-unused-field --counter=1 test.cl

Test-case:

typedef const unsigned int test;
typedef test test_second;

int foo(long t)
{
    return t + 8;
}

struct T;

struct Z
{
    int z1;
};

struct W
{
    int w_a1[5];
    //int w1;
};

struct X
{
    int x1;
    int x_a1[5];
    struct W x_w1[2];
    struct Z x_z1;
};

void bar(struct W blubb)
{
    struct W i = blubb;
}

__kernel void entry(__global long *input)
{
    uint test1;
    int4 test2;

    struct T
    {
        int t1;
        struct Z t_z1;
        struct Z t_z2;
    };

    struct X x = {1, {11,12,13,14,15,}, {{{21,22}}, {{211}}}, {3}};

    struct T t;
    struct Z z = {0};
    struct W w = {.w_a1 = {0, 0, 0,}, };
    struct W *wp = &w;

    bar(w);
    foo(z.z1);


    //test1 = s.f;

    get_global_id(0);
}

Output:

typedef const unsigned int test;
typedef test test_second;

int foo(long t)
{
    return t + 8;
}

struct T;

struct Z
{
    int z1;
};

struct W
{

    //int w1;
};

struct X
{
    int x1;
    int x_a1[5];
    struct W x_w1[2];
    struct Z x_z1;
};

void bar(struct W blubb)
{
    struct W i = blubb;
}

__kernel void entry(__global long *input)
{
    uint test1;
    int4 test2;

    struct T
    {
        int t1;
        struct Z t_z1;
        struct Z t_z2;
    };

    struct X x = {1, {11,12,13,14,15,}, {{}, {}}, {3}};

    struct T t;
    struct Z z = {0};
    struct W w = {.w_a1 =  };
    struct W *wp = &w;

    bar(w);
    foo(z.z1);


    //test1 = s.f;

    get_global_id(0);
}
@mpflanzer mpflanzer added the bug label May 31, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant