This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: How to debug ssa optimizer

    The documentation of MODIFY_EXPR and ADDR_EXPR (i.e. comments in
    tree.def) says exactly nothing about types.

*None* of the documentation about the tree nodes says anything about types,
but we do require that MODIFY_EXPR (like, e.g., PLUS_EXPR) have the same
types on the node and both operands (or at least compatible types).

    Naively, the type of the ADDR_EXPR ought to be <pointer_type type
    <array_type char []>>, which is not the type of the source-language
    expression per C semantics -- in fact it is impossible to express that
    type in C (although it would be possible if the array had a definite

That's indeed what the type is.

    I think the C front end is treating ADDR_EXPR as having a built-in
    NOP_EXPR, so it can get the language-semantic expected type,
    <pointer_type char *>, without inserting another node in the AST.  The
    tree-ssa optimizers are obviously happy with this, so I see no actual
    problem here.

Well, they aren't happy anymore!  Something I changed made this matter.
What's happening is that the <INDIRECT_REF <ADDR_EXPR <VAR_DECL ...>>> is
being folding into just the VAR_DECL, which certainly has the wrong type.

Before I went to bed last night, I tracked this down into the C front end at
a place where a ??? comment made it clear it was doing the wrong thing.
Adding a conversion didn't help, but I'll perue again this morning.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]