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

* [Bug c++/108560] builtin_va_arg_pack_len is documented to return size_t, but actually returns int
  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 ` jakub at gcc dot gnu.org
  2023-01-26 16:17 ` [Bug other/108560] " jakub at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-01-26 16:14 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
This is a bug in the documentation, introduced with
r0-103077-gab940b73bfabe2cec4
which was meant to be a documentation formatting only change.

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

* [Bug other/108560] builtin_va_arg_pack_len is documented to return size_t, but actually returns int
  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 ` jakub at gcc dot gnu.org
  2023-01-27 10:18 ` cvs-commit at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-01-26 16:17 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
           Assignee|unassigned at gcc dot gnu.org      |jakub at gcc dot gnu.org
   Last reconfirmed|                            |2023-01-26
             Status|UNCONFIRMED                 |ASSIGNED

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 54353
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54353&action=edit
gcc13-pr108560.patch

Untested fix.

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

* [Bug other/108560] builtin_va_arg_pack_len is documented to return size_t, but actually returns int
  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
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-01-27 10:18 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:16f30680f403891556da2ad6329fcef9dc9b47db

commit r13-5437-g16f30680f403891556da2ad6329fcef9dc9b47db
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Fri Jan 27 11:17:35 2023 +0100

    doc: Fix up return type of __builtin_va_arg_pack_len [PR108560]

    __builtin_va_arg_pack_len as implemented returned int since its
introduction
    in 2007.  The initial documentation didn't mention any return type,
    which changed in 2010 in r0-103077-gab940b73bfabe2cec4 during some
    documentation formatting cleanups
    https://gcc.gnu.org/legacy-ml/gcc-patches/2010-09/msg01632.html
    I can understand that for formatting some type was needed there
    but what exactly hasn't been really discussed.

    So, I think we should change documentation to match the implementation,
    rather than change implementation to match the documentation.
    Most people don't use more than 2147483647 arguments to inline functions,
    and on poor targets with 16-bit ints I bet even having more than 65535
    arguments to inline functions would be highly unexpected.

    2023-01-27  Jakub Jelinek  <jakub@redhat.com>

            PR other/108560
            * doc/extend.texi: Fix up return type of __builtin_va_arg_pack_len
            from size_t to int.

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

* [Bug other/108560] builtin_va_arg_pack_len is documented to return size_t, but actually returns int
  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
                   ` (2 preceding siblings ...)
  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
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-01-27 10:19 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

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

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Fixed.

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

* [Bug other/108560] builtin_va_arg_pack_len is documented to return size_t, but actually returns int
  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
                   ` (3 preceding siblings ...)
  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
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-02-10 17:46 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-12 branch has been updated by Jakub Jelinek
<jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:ca1e81324ab9915b745e724945db4a108777f46d

commit r12-9145-gca1e81324ab9915b745e724945db4a108777f46d
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Fri Jan 27 11:17:35 2023 +0100

    doc: Fix up return type of __builtin_va_arg_pack_len [PR108560]

    __builtin_va_arg_pack_len as implemented returned int since its
introduction
    in 2007.  The initial documentation didn't mention any return type,
    which changed in 2010 in r0-103077-gab940b73bfabe2cec4 during some
    documentation formatting cleanups
    https://gcc.gnu.org/legacy-ml/gcc-patches/2010-09/msg01632.html
    I can understand that for formatting some type was needed there
    but what exactly hasn't been really discussed.

    So, I think we should change documentation to match the implementation,
    rather than change implementation to match the documentation.
    Most people don't use more than 2147483647 arguments to inline functions,
    and on poor targets with 16-bit ints I bet even having more than 65535
    arguments to inline functions would be highly unexpected.

    2023-01-27  Jakub Jelinek  <jakub@redhat.com>

            PR other/108560
            * doc/extend.texi: Fix up return type of __builtin_va_arg_pack_len
            from size_t to int.

    (cherry picked from commit 16f30680f403891556da2ad6329fcef9dc9b47db)

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

* [Bug other/108560] builtin_va_arg_pack_len is documented to return size_t, but actually returns int
  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
                   ` (4 preceding siblings ...)
  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
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-05-02 20:13 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Jakub Jelinek
<jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:4dd44d0c899897da041d2dcc088bed6e11abd80a

commit r11-10703-g4dd44d0c899897da041d2dcc088bed6e11abd80a
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Fri Jan 27 11:17:35 2023 +0100

    doc: Fix up return type of __builtin_va_arg_pack_len [PR108560]

    __builtin_va_arg_pack_len as implemented returned int since its
introduction
    in 2007.  The initial documentation didn't mention any return type,
    which changed in 2010 in r0-103077-gab940b73bfabe2cec4 during some
    documentation formatting cleanups
    https://gcc.gnu.org/legacy-ml/gcc-patches/2010-09/msg01632.html
    I can understand that for formatting some type was needed there
    but what exactly hasn't been really discussed.

    So, I think we should change documentation to match the implementation,
    rather than change implementation to match the documentation.
    Most people don't use more than 2147483647 arguments to inline functions,
    and on poor targets with 16-bit ints I bet even having more than 65535
    arguments to inline functions would be highly unexpected.

    2023-01-27  Jakub Jelinek  <jakub@redhat.com>

            PR other/108560
            * doc/extend.texi: Fix up return type of __builtin_va_arg_pack_len
            from size_t to int.

    (cherry picked from commit 16f30680f403891556da2ad6329fcef9dc9b47db)

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

* [Bug other/108560] builtin_va_arg_pack_len is documented to return size_t, but actually returns int
  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
                   ` (5 preceding siblings ...)
  2023-05-02 20:13 ` cvs-commit at gcc dot gnu.org
@ 2023-05-03 15:20 ` cvs-commit at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-05-03 15:20 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Jakub Jelinek
<jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:5ebdbf03c7fb77c2535faca020e25a16658e8cb6

commit r10-11358-g5ebdbf03c7fb77c2535faca020e25a16658e8cb6
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Fri Jan 27 11:17:35 2023 +0100

    doc: Fix up return type of __builtin_va_arg_pack_len [PR108560]

    __builtin_va_arg_pack_len as implemented returned int since its
introduction
    in 2007.  The initial documentation didn't mention any return type,
    which changed in 2010 in r0-103077-gab940b73bfabe2cec4 during some
    documentation formatting cleanups
    https://gcc.gnu.org/legacy-ml/gcc-patches/2010-09/msg01632.html
    I can understand that for formatting some type was needed there
    but what exactly hasn't been really discussed.

    So, I think we should change documentation to match the implementation,
    rather than change implementation to match the documentation.
    Most people don't use more than 2147483647 arguments to inline functions,
    and on poor targets with 16-bit ints I bet even having more than 65535
    arguments to inline functions would be highly unexpected.

    2023-01-27  Jakub Jelinek  <jakub@redhat.com>

            PR other/108560
            * doc/extend.texi: Fix up return type of __builtin_va_arg_pack_len
            from size_t to int.

    (cherry picked from commit 16f30680f403891556da2ad6329fcef9dc9b47db)

^ 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).