public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/108560] New: builtin_va_arg_pack_len is documented to return size_t, but actually returns int
@ 2023-01-26 15:50 jens.seifert at de dot ibm.com
  2023-01-26 16:14 ` [Bug c++/108560] " jakub at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: jens.seifert at de dot ibm.com @ 2023-01-26 15:50 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 108560
           Summary: builtin_va_arg_pack_len is documented to return
                    size_t, but actually returns int
           Product: gcc
           Version: 12.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jens.seifert at de dot ibm.com
  Target Milestone: ---

#include <stdio.h>

bool test(const char *fmt, size_t numTokens, ...)
{
    return __builtin_va_arg_pack_len() != numTokens;
}

Compiled with -Wsign-compare results in:
<source>: In function 'bool test(const char*, size_t, ...)':
<source>:5:40: warning: comparison of integer expressions of different
signedness: 'int' and 'size_t' {aka 'long unsigned int'} [-Wsign-compare]
    5 |     return __builtin_va_arg_pack_len() != numTokens;
      |            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
<source>:5:37: error: invalid use of '__builtin_va_arg_pack_len ()'
    5 |     return __builtin_va_arg_pack_len() != numTokens;
      |            ~~~~~~~~~~~~~~~~~~~~~~~~~^~
Compiler returned: 1

Documentation:
https://gcc.gnu.org/onlinedocs/gcc/Constructing-Calls.html
indicates a size_t return type
Built-in Function: size_t __builtin_va_arg_pack_len ()

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2023-05-03 15:20 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-26 15:50 [Bug c++/108560] New: builtin_va_arg_pack_len is documented to return size_t, but actually returns int jens.seifert at de dot ibm.com
2023-01-26 16:14 ` [Bug c++/108560] " jakub at gcc dot gnu.org
2023-01-26 16:17 ` [Bug other/108560] " jakub at gcc dot gnu.org
2023-01-27 10:18 ` cvs-commit at gcc dot gnu.org
2023-01-27 10:19 ` jakub at gcc dot gnu.org
2023-02-10 17:46 ` cvs-commit at gcc dot gnu.org
2023-05-02 20:13 ` cvs-commit at gcc dot gnu.org
2023-05-03 15:20 ` cvs-commit at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).