<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/57114>57114</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            clang: Incorrect warning using -Warray-parameter
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          uecker
      </td>
    </tr>
</table>

<pre>
    First:   Thank you so much for implementing these warnings! This is highly appreciated!

Here is a minor nit: Clang warns for parameters declared using [*] when followed by
another declaration using [3] or [n] or similar, but this is not correct. [*] is used to declare
an array of unspecified size. As such it is consistent with a later declaration that 
specifies a bound. Calling this a mismatch is misleading.

Also a definition can never use [*], so it is then not possible to
use [*] in a declaration without getting this warning at the place of a definition.
The intended use of [*] looks like this:

extern void foo(int n, int a[*]); // unspecified
void foo(int n, int a[n]) { ... } // should not warn!

A use case is where the bound depends on information which may not be
available at the point of the declaration, so one wants to leave it unspecified
at this point:

// header 1
extern void process_geometry(int n, float (*element)[n][*][*]);
// header 2
enum { DIMENSIONS = 2 }; // change to 3 for 3D simulation
// impl 1
void process_geometry(int n, float (*element)[n][DIMENSION][DIMENSIONS]) { ... }
// use
#include "header1"
#include "header2"
... 
  float (*elements)[n][DIMENSIONS][DIMENSIONS] = malloc(sizeof *elemnts)
  process_geometry(n, elemnts);

Of course, this is rather obscure, but there is also no good reason to break this.
(GCC also gets this wrong).




</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJylVU2T6yYQ_DXyZWpdFv4-6OC1s8ke8t5hX1WOr5CELWIELkB2nF-fBkm2vOvkkiqvFgrome4ZmtyU1-xNWueT6YaIflRcH-lqGnKG6qaoaG8syfqkRC20l_pAvhJO0IVbjZlLWIpD0hF-lTxU6kr8dLKikNyLEqvJZJdMNu33N2FF2Miplhq4WsawW8WBGxBdDHfiltfCC-uoFIXiVpTUuBA7m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