<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - Clang allows address of array with 'register' storage-class to be taken"
   href="https://llvm.org/bugs/show_bug.cgi?id=26336">26336</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Clang allows address of array with 'register' storage-class to be taken
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>-New Bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>sneves@dei.uc.pt
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Example:

  extern int f(int *);

  int main() {
    register int x[1];  
    return f(x);
  }

The C99 standard, in footnote 100 of ยง6.7.1, states

<span class="quote">> However, whether or not addressable storage is actually used, the address 
> of any part of an object declared with storage-class specifier register
> cannot be computed, either explicitly (by use of the unary & operator as 
> discussed in 6.5.3.2) or implicitly (by converting an array name to a 
> pointer as discussed in 6.3.2.1).</span >

Clang already does the right thing for explicit & operators on register
variables. However it misses the implicit pointer decay of array types.
Thus the example above should fail with a "address of register variable 
requested" error message.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>