[Bug tree-optimization/80122] __builtin_va_arg_pack() and __builtin_va_arg_pack_len() does not work correctly
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!
[Bug c/86505] New: __builtin_va_arg_pack_len() computes the number of arguments wrongly
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86505 Bug ID: 86505 Summary: __builtin_va_arg_pack_len() computes the number of arguments wrongly Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: rpirrera at aitek dot it Target Milestone: --- 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. #include /*** 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) { int rc = funB(0,1,2); if (rc != 4) { return 1; } return 0; } int main(void) { int rc; rc = testBuiltin(); if (rc == 1) { printf("Test Failed!\n"); return rc; } printf("Test Succeeded!\n"); return rc; } Thank you!
[Bug tree-optimization/80122] __builtin_va_arg_pack() and __builtin_va_arg_pack_len() does not work correctly
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80122 --- Comment #14 from rpirrera at aitek dot it --- (In reply to Richard Biener from comment #13) > Can you please open a new bugreport? Btw, your snippet doesn't compile > because you miss ANSI_BOLD and friends, removing it and adding a #include > makes it compile fine (but not link, a main is missing). > So in the new bugreport you open please provide a _complete_ testcase. Opened a new bugreport here: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86505. Thank you.
[Bug middle-end/86505] [6/7/8/9 Regression] __builtin_va_arg_pack_len() computes the number of arguments wrongly
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 Regression] __builtin_va_arg_pack_len() computes the number of arguments wrongly
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86505 --- Comment #9 from rpirrera at aitek dot it --- The patch cannot be applied to the compiler we are using (GCC 5), we get a function not defined error. Is it possible to have a patch for GCC 5 too? Thank you.
[Bug c/80122] New: __builtin_va_arg_pack() and __builtin_va_arg_pack_len() does not work correctly
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80122 Bug ID: 80122 Summary: __builtin_va_arg_pack() and __builtin_va_arg_pack_len() does not work correctly Product: gcc Version: 4.8.5 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: rpirrera at aitek dot it Target Milestone: --- Created attachment 41007 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41007&action=edit test __builtin_va_arg_pack() __builtin_va_arg_pack() has changed behavior from version 4.4.7. In case of only an always inline function all work correctly but if the always inline function passes the __builtin_va_arg_pack() to another always inline function the computed __builtin_va_arg_pack_len() is 0 instead of the number of variable arguments. In attachment you will find a test program reproducing the issue.
[Bug c/80122] __builtin_va_arg_pack() and __builtin_va_arg_pack_len() does not work correctly
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80122 --- Comment #2 from rpirrera at aitek dot it --- There is no work around for this bug? Core parts of our code relied on __builtin_va_arg_pack() and __builtin_va_arg_pack_len() to work and now all silently fails.
[Bug tree-optimization/80122] __builtin_va_arg_pack() and __builtin_va_arg_pack_len() does not work correctly
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80122 --- Comment #6 from rpirrera at aitek dot it --- How this work now? We can expect a back port to versions 5.4 and 6.3 of this patch? Or this will exist only in the future version 7.x? Thank you!
[Bug tree-optimization/80122] __builtin_va_arg_pack() and __builtin_va_arg_pack_len() does not work correctly
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80122 --- Comment #8 from rpirrera at aitek dot it --- OK we have applied the patch onto the 5.4.0 version of GCC and it is working correctly. Thank you for your support!