[Bug middle-end/86505] [6/7/8/9 Regression] __builtin_va_arg_pack_len() computes the number of arguments wrongly

2018-08-02 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86505

Richard Biener  changed:

   What|Removed |Added

   Assignee|unassigned at gcc dot gnu.org  |rguenth at gcc dot 
gnu.org

--- Comment #3 from Richard Biener  ---
Created attachment 44491
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=44491=edit
candidate patch

I am testing this patch which fixes the testcase.  Test coverage is low though.

[Bug middle-end/86505] [6/7/8/9 Regression] __builtin_va_arg_pack_len() computes the number of arguments wrongly

2018-07-16 Thread rpirrera at aitek dot it
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86505

--- Comment #2 from rpirrera at aitek dot it ---
Any news on the fix?

[Bug middle-end/86505] [6/7/8/9 Regression] __builtin_va_arg_pack_len() computes the number of arguments wrongly

2018-07-12 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86505

Richard Biener  changed:

   What|Removed |Added

   Priority|P3  |P2
 Status|UNCONFIRMED |ASSIGNED
  Known to work||4.4.7
Version|unknown |8.1.0
   Keywords||wrong-code
   Last reconfirmed||2018-07-12
  Component|c   |middle-end
 Ever confirmed|0   |1
Summary|__builtin_va_arg_pack_len() |[6/7/8/9 Regression]
   |computes the number of  |__builtin_va_arg_pack_len()
   |arguments wrongly   |computes the number of
   ||arguments wrongly
   Target Milestone|--- |6.5
  Known to fail||4.5.2, 6.4.0, 7.3.0, 8.1.0,
   ||9.0

--- Comment #1 from Richard Biener  ---
Confirmed.  This is because funA is inlined as follows

__attribute__((always_inline))
funB (unsigned int param)
{
  int D.1995;
  int D.1994;
  unsigned int param;
  int D.1981;
  int _4;
  int _6;

   :
  param_5 = param_2(D);
  _6 = __builtin_va_arg_pack_len ();

   :
:
  _7 = _6;
  _4 = _7;

   :
:
  return _4;

}

here obviously while va_arg_pack_len is correctly not resolved it needs
to be adjusted by the additional variadic args that got passed to funA.

The testcase is somewhat artificial because we refuse to inline once
variadic args are accessed in the callee but still it shows a bug.

I will try to fix that.