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]

[PTR-PLUS] Fix foldaddr-1.c

To fix this testcase, we just needed to add some folding of PLUS_EXPR into 
POINTER_PLUS_EXPR when one of the arguments is a pointer type (since there 
is a strip nop, we get the base variable).  This causes some regressions, 
one due to loc_descriptor_from_tree_1 not handling POINTER_PLUS_EXPR which 
should be handled the same as PLUS_EXPR.  The other regression is due to 
getting better aliasing for a testcase and we now remove a dead store as 
the code is depending on undefined behavior anyways as we are getting the 
address of the variable and subtracting one.  Fixed that regression by 
changing the testcase so it uses a global variable instead.

Note this causes debugvlafunction-1.c to be optimized better than the 
mainline (this is why we get a POINTER_PLUS_EXPR now).

Committed after a bootstrap/test on i686-linux-gnu with no regressions.

Andrew Pinski


        * fold-const.c (fold_binary <case POINTER_PLUS_EXPR>);
        Add comment on why you get INT +p INT.
        (fold_binary <case PLUS_EXPR>): Add folding of PTR+INT into
        PTR p+ INT.
        * dwarf2out.c (loc_descriptor_from_tree_1):
        Handle POINT_PLUS_EXPR as a PLUS_EXPR.

        * gcc.dg/max-1.c: Change local variable a to be a global one.

Attachment: fixfoldaddr-1.diff.txt
Description: Text document

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