This is the mail archive of the gcc@gcc.gnu.org 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]

bug in combine_stack_adjustments


Compile on the x86 with -O2:

typedef union tree_node *tree;
struct tree_common
{
  union tree_node *type;
};
typedef struct {
  int r[(11 + sizeof (int))/(sizeof (int))];
} realvaluetype;
extern realvaluetype ereal_negate (realvaluetype);
union real_extract 
{
  realvaluetype d;
  int i[sizeof (realvaluetype) / sizeof (int)];
};
union tree_node;
struct tree_real_cst
{
  realvaluetype real_cst;
};
union tree_node
{
  struct tree_common common;
  struct tree_real_cst real_cst;
 };
tree
fold (expr) 
     tree expr;
{
  register tree t = expr;
  tree type = ((expr)->common.type);
  register tree arg0 = (tree) ((void *)0), arg1 = (tree) ((void *)0);
  t = build_real (type, ereal_negate (((arg0)->real_cst.real_cst)));
  return t;
}


You'll find that the call to "ereal_negate" gets incorrectly deleted.
This happens during combine_stack_adjustments:

We end up calling flow_delete_insn from combine_stack_adjustments_for_block
with this insn:

(call_insn 31 30 33 (parallel[ 
            (call (mem:QI (symbol_ref:SI ("ereal_negate")) 0)
                (const_int 16 [0x10]))
            (set (reg:SI 7 esp)
                (plus:SI (reg:SI 7 esp)
                    (const_int 0 [0x0])))
        ] ) 452 {*call_pop_pic} (nil)
    (nil)
    (nil))

Obviously we can't delete a call, no matter what the status of the stack
adjustment.  I also wonder if it is safe to delete stack adjustments
for call_pops, but I'll let you figure that out :-)



This causes GCC to mis-compile itself which in turn causes a number of
c-torture failures when testing the stage3 compiler.

jeff


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