[llvm-bugs] [Bug 40890] 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.

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Feb 27 09:08:50 PST 2019


https://bugs.llvm.org/show_bug.cgi?id=40890

            Bug ID: 40890
           Summary: After r349561, Assertion failed: (EVResult.Val.isInt()
                    && "Expression did not evaluate to integer"), function
                    EvaluateKnownConstInt, file
                    tools/clang/lib/AST/ExprConstant.cpp, line 11056.
           Product: new-bugs
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: dimitry at andric.com
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org

After https://reviews.llvm.org/rL349561 ("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:

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

#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.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190227/eec1ec46/attachment.html>


More information about the llvm-bugs mailing list