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

rpirrera at aitek dot it changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|FIXED                       |---

--- Comment #12 from rpirrera at aitek dot it ---
I have found another issue with __builtin_va_arg_pack_len() that happens when
the functions that uses __builtin_va_arg_pack() calls another function that
uses __builtin_va_arg_pack_len(), the argument len is miscalculated as you can
see in the attached example.
This was working in GCC version 4.4.7.


/*************** TESTBUILTIN BEGIN ****************/
static inline __attribute__(( __always_inline__)) int 
funA(unsigned int param, ...) 
{ 
    return __builtin_va_arg_pack_len(); 
}

static inline __attribute__(( __always_inline__)) int
funB(unsigned int param, ...)
{ 
    return funA(param,  2, 4, __builtin_va_arg_pack()); 
}

int 
testBuiltin(void) 
{ 
    printf(ANSI_BOLD "%s" ANSI_RESET " ... ", __FUNCTION__);

    int rc = funB(0,1,2); 
    if (rc != 4) {
        return 1;
    }

    return 0;
}

Thank you!

Reply via email to