https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69708

kugan at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kugan at gcc dot gnu.org

--- Comment #2 from kugan at gcc dot gnu.org ---
In ipa-prop.c, function ipa_compute_jump_functions_for_edge called from
determine_locally_known_aggregate_parts doesn't compute jump functions for
aggregates when they are initialized during definition.

If I change the testcase to following, it works.

typedef struct F {
    int (*call)(int);
} F;

static int g(F f, int x) {
    x = f.call(x);
    x = f.call(x);
    x = f.call(x);
    x = f.call(x);
    x = f.call(x);
    x = f.call(x);
    x = f.call(x);
    x = f.call(x);
    return x;
}

static int sq(int x) {
    return x * x;
}

static F f = {sq};
//static const F f = {sq};

void dosomething(int);

int h(int x) {
    f.call = sq;
    dosomething(g(f, x));
    dosomething(g((F){sq}, x));
}

I guess, for the varpool_node corresponding to static const F f = {sq};, we
have to check hat the initialization are constant and create the jump function.

I still haven't figured out how I can get the initialization list for the
structure. Any pointers?

varpool_node *node = varpool_node::get (arg); should get me to the varpool
node.

Reply via email to