<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </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 - Syntax warning in TableGen'd XXGenMCCodeEmitter.inc calling APInt LoadIntFromMemory utility function"
   href="https://bugs.llvm.org/show_bug.cgi?id=46629">46629</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Syntax warning in TableGen'd XXGenMCCodeEmitter.inc calling APInt LoadIntFromMemory utility function
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>tools
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>10.0
          </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>TableGen
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>chris.sears@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>TableGen supports large instructions, in my case, bits<128> Inst; This makes
TableGen generate APInt Insts rather than uint64_t or smaller. This is rarely
exercised code and so when I include the generated XXGenMCCodeEmitter.inc file,
I get a warning:

    warning: cast from 'const unsigned long long *' to 'unsigned char *' drops
const qualifier [-Wcast-qual]
    LoadIntFromMemory(Inst, (uint8_t*)&InstBits[opcode * 2], 16);

It's complaining because InstBits is declared as

    static const uint64_t InstBits[]

whereas LoadIntFromMemory()'s second argument is declared as 

    uint8_t *Src

Removing the const from InstBits does make the error message go away but it
seems to me that adding const to the LoadIntFromMemory Src argument is the
better solution. However, that may cause more warnings.</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>