public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/102998] New: Wrong documentation for -Warray-parameter
@ 2021-10-29 11:00 roland.illig at gmx dot de
  2021-10-29 11:02 ` [Bug c/102998] " roland.illig at gmx dot de
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: roland.illig at gmx dot de @ 2021-10-29 11:00 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 102998
           Summary: Wrong documentation for -Warray-parameter
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: roland.illig at gmx dot de
  Target Milestone: ---

https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html says:
> For example, the warning triggers for the following redeclarations because
> the first one allows an array of any size to be passed to f while the second
> one with the keyword static specifies that the array argument must have at
> least four elements.
>
> void f (int[static 4]);
> void f (int[]);           // warning (inconsistent array form)

1. The words 'first' and 'second' should be swapped.
2. Why should there be a warning? The array from malloc is large enough, it has
exactly 4 elements.

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

* [Bug c/102998] Wrong documentation for -Warray-parameter
  2021-10-29 11:00 [Bug c/102998] New: Wrong documentation for -Warray-parameter roland.illig at gmx dot de
@ 2021-10-29 11:02 ` roland.illig at gmx dot de
  2021-10-29 21:14 ` egallager at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: roland.illig at gmx dot de @ 2021-10-29 11:02 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Roland Illig <roland.illig at gmx dot de> ---
> for the following redeclarations

That's wrong. There is only 1 redeclaration in the code that follows.

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

* [Bug c/102998] Wrong documentation for -Warray-parameter
  2021-10-29 11:00 [Bug c/102998] New: Wrong documentation for -Warray-parameter roland.illig at gmx dot de
  2021-10-29 11:02 ` [Bug c/102998] " roland.illig at gmx dot de
@ 2021-10-29 21:14 ` egallager at gcc dot gnu.org
  2024-01-20  0:44 ` sandra at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: egallager at gcc dot gnu.org @ 2021-10-29 21:14 UTC (permalink / raw)
  To: gcc-bugs

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

Eric Gallager <egallager at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |diagnostic
                 CC|                            |egallager at gcc dot gnu.org,
                   |                            |msebor at gcc dot gnu.org

--- Comment #2 from Eric Gallager <egallager at gcc dot gnu.org> ---
Martin Sebor added this warning; cc-ing him

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

* [Bug c/102998] Wrong documentation for -Warray-parameter
  2021-10-29 11:00 [Bug c/102998] New: Wrong documentation for -Warray-parameter roland.illig at gmx dot de
  2021-10-29 11:02 ` [Bug c/102998] " roland.illig at gmx dot de
  2021-10-29 21:14 ` egallager at gcc dot gnu.org
@ 2024-01-20  0:44 ` sandra at gcc dot gnu.org
  2024-01-20  1:43 ` sandra at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: sandra at gcc dot gnu.org @ 2024-01-20  0:44 UTC (permalink / raw)
  To: gcc-bugs

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

sandra at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |sandra at gcc dot gnu.org
           Assignee|unassigned at gcc dot gnu.org      |sandra at gcc dot gnu.org

--- Comment #3 from sandra at gcc dot gnu.org ---
The argument to malloc is 4, but it's given in bytes, not array elements.  I
can tweak this example to make it more clear that the array is too small.

There are other problems here too; -Warray-parameter isn't listed in the
Options Summary section, it doesn't say what N defaults to if you omit it, or 
that the negative form is equivalent to -Warray-parameter=0.

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

* [Bug c/102998] Wrong documentation for -Warray-parameter
  2021-10-29 11:00 [Bug c/102998] New: Wrong documentation for -Warray-parameter roland.illig at gmx dot de
                   ` (2 preceding siblings ...)
  2024-01-20  0:44 ` sandra at gcc dot gnu.org
@ 2024-01-20  1:43 ` sandra at gcc dot gnu.org
  2024-01-20 14:39 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: sandra at gcc dot gnu.org @ 2024-01-20  1:43 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from sandra at gcc dot gnu.org ---
Hmmm, I ran into PR113515 with this example.

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

* [Bug c/102998] Wrong documentation for -Warray-parameter
  2021-10-29 11:00 [Bug c/102998] New: Wrong documentation for -Warray-parameter roland.illig at gmx dot de
                   ` (3 preceding siblings ...)
  2024-01-20  1:43 ` sandra at gcc dot gnu.org
@ 2024-01-20 14:39 ` cvs-commit at gcc dot gnu.org
  2024-01-20 16:25 ` sandra at gcc dot gnu.org
  2024-01-20 17:18 ` pinskia at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-01-20 14:39 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Sandra Loosemore <sandra@gcc.gnu.org>:

https://gcc.gnu.org/g:8fd992a3dfa8c3e00d4a41846de2061ff6c5652a

commit r14-8304-g8fd992a3dfa8c3e00d4a41846de2061ff6c5652a
Author: Sandra Loosemore <sandra@codesourcery.com>
Date:   Sat Jan 20 14:30:17 2024 +0000

    Correct documentation for -Warray-parameter [PR102998]

    gcc/ChangeLog
            PR c/102998
            * doc/invoke.texi (Option Summary): Add -Warray-parameter.
            (Warning Options): Correct/edit discussion of -Warray-parameter
            to make the first example less confusing, and fill in missing info.

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

* [Bug c/102998] Wrong documentation for -Warray-parameter
  2021-10-29 11:00 [Bug c/102998] New: Wrong documentation for -Warray-parameter roland.illig at gmx dot de
                   ` (4 preceding siblings ...)
  2024-01-20 14:39 ` cvs-commit at gcc dot gnu.org
@ 2024-01-20 16:25 ` sandra at gcc dot gnu.org
  2024-01-20 17:18 ` pinskia at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: sandra at gcc dot gnu.org @ 2024-01-20 16:25 UTC (permalink / raw)
  To: gcc-bugs

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

sandra at gcc dot gnu.org changed:

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

--- Comment #6 from sandra at gcc dot gnu.org ---
Fixed.

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

* [Bug c/102998] Wrong documentation for -Warray-parameter
  2021-10-29 11:00 [Bug c/102998] New: Wrong documentation for -Warray-parameter roland.illig at gmx dot de
                   ` (5 preceding siblings ...)
  2024-01-20 16:25 ` sandra at gcc dot gnu.org
@ 2024-01-20 17:18 ` pinskia at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-01-20 17:18 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |14.0

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

end of thread, other threads:[~2024-01-20 17:18 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-29 11:00 [Bug c/102998] New: Wrong documentation for -Warray-parameter roland.illig at gmx dot de
2021-10-29 11:02 ` [Bug c/102998] " roland.illig at gmx dot de
2021-10-29 21:14 ` egallager at gcc dot gnu.org
2024-01-20  0:44 ` sandra at gcc dot gnu.org
2024-01-20  1:43 ` sandra at gcc dot gnu.org
2024-01-20 14:39 ` cvs-commit at gcc dot gnu.org
2024-01-20 16:25 ` sandra at gcc dot gnu.org
2024-01-20 17:18 ` pinskia 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).