https://gcc.gnu.org/bugzilla/show_bug.cgi?id=128751

Uroš Bizjak <ubizjak at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2026-11-15
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
   Target Milestone|---                         |14.5

--- Comment #4 from Uroš Bizjak <ubizjak at gmail dot com> ---
If GCC's reading (an now also clang's) is correct, then the patch can be as
simple as:

--cut here--
diff --git a/gcc/config/i386/i386.cc b/gcc/config/i386/i386.cc
index 36443b499e7..e50d6654eed 100644
--- a/gcc/config/i386/i386.cc
+++ b/gcc/config/i386/i386.cc
@@ -3297,6 +3300,13 @@ function_arg_advance_64 (CUMULATIVE_ARGS *cum,
machine_mode mode,
     }
   else
     {
+      /* An empty class takes no space on the stack, even when
+        classify_argument gives it a register class (e.g. for
+        an unnamed bit-field).  Don't advance over it, otherwise
+        va_start computes a wrong overflow_arg_area.  */
+      if (type && TYPE_EMPTY_P (type))
+       return 0;
+
       int align = ix86_function_arg_boundary (mode, type) / BITS_PER_WORD;
       cum->words = ROUND_UP (cum->words, align);
       cum->words += words;
--cut here--

Reply via email to