<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 - After r349561, Assertion failed: (EVResult.Val.isInt() && "Expression did not evaluate to integer"), function EvaluateKnownConstInt, file tools/clang/lib/AST/ExprConstant.cpp, line 11056."
   href="https://bugs.llvm.org/show_bug.cgi?id=40890">40890</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>After r349561, Assertion failed: (EVResult.Val.isInt() && "Expression did not evaluate to integer"), function EvaluateKnownConstInt, file tools/clang/lib/AST/ExprConstant.cpp, line 11056.
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </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>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>dimitry@andric.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>After <a href="https://reviews.llvm.org/rL349561">https://reviews.llvm.org/rL349561</a> ("Emit ASM input in a constant
context"), valgrind's getoffset.c file no longer compiles, with an assertion:

Assertion failed: (EVResult.Val.isInt() && "Expression did not evaluate to
integer"), function EvaluateKnownConstInt, file
/home/dim/src/llvm/trunk/tools/clang/lib/AST/ExprConstant.cpp, line 11056.

This is due to the rather awful (but necessary) __asm__ construct here:

<a href="https://sourceware.org/git/?p=valgrind.git;a=blob;f=VEX/auxprogs/genoffsets.c;h=1f680e4f6cbe51fb9a71af3a9e291699794a40da;hb=HEAD#l70">https://sourceware.org/git/?p=valgrind.git;a=blob;f=VEX/auxprogs/genoffsets.c;h=1f680e4f6cbe51fb9a71af3a9e291699794a40da;hb=HEAD#l70</a>

#define GENOFFSET(_structUppercase,_structLowercase,_fieldname)  \
   __asm__ __volatile__ ( \
      "\n#define OFFSET_" \
      VG_STRINGIFY(_structLowercase) "_" \
      VG_STRINGIFY(_fieldname) \
      " xyzzy%0\n" : /*out*/ \
                   : /*in*/ "n" \
         (my_offsetof(VexGuest##_structUppercase##State, \
          guest_##_fieldname)) \
   )
[...]
void foo ( void )
{
   // x86
   GENOFFSET(X86,x86,EAX);
   GENOFFSET(X86,x86,EBX);

and so on.

Minimized, this becomes:

/* clang -cc1 -triple x86_64-- -S genoffsets-min.c */

typedef struct {
  unsigned guest_EAX;
} VexGuestX86State;

void foo(void)
{
  __asm__ __volatile__ (
    "\n#define OFFSET_x86_EAX xyzzy%0\n"
    :
    : "n" (&((VexGuestX86State*)0)->guest_EAX)
  );
}

This is a regression from clang 7.0.0 and 7.0.1, which would compile this
construct just fine.</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>