This is the mail archive of the gcc-bugs@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]
Other format: [Raw text]

[Bug middle-end/36859] New: Caller/callee mismatch for vararg on stack


locate_and_pad_parm never align parameters on stack for
callers. It only caps parameter alignment to 
PREFERRED_STACK_BOUNDARY.  But std_gimplify_va_arg_expr
tries to align stack for callee:

  /* va_list pointer is aligned to PARM_BOUNDARY.  If argument actually
     requires greater alignment, we must perform dynamic alignment.  */
  if (boundary > align 
      && !integer_zerop (TYPE_SIZE (type)))
    {
      t = build2 (MODIFY_EXPR, TREE_TYPE (valist), valist_tmp,
                  fold_build2 (POINTER_PLUS_EXPR, TREE_TYPE (valist),
                               valist_tmp, size_int (boundary - 1))); 
      gimplify_and_add (t, pre_p);

      t = fold_convert (sizetype, valist_tmp);
      t = build2 (MODIFY_EXPR, TREE_TYPE (valist), valist_tmp,
                  fold_convert (TREE_TYPE (valist),
                                fold_build2 (BIT_AND_EXPR, sizetype, t,
                                             size_int (-boundary))));
      gimplify_and_add (t, pre_p);
    }
  else
    boundary = align;

We have a mismatch between caller and callee. I have a testcase for ia32.
But it depends on PR 36858.


-- 
           Summary: Caller/callee mismatch for vararg on stack
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: hjl dot tools at gmail dot com
 BugsThisDependsOn: 36858


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36859


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