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

            Bug ID: 50988
           Summary: type mismatch assertion violation when generating code
                    for function declaration
           Product: new-bugs
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: new bugs
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected]

Created attachment 25002
  --> https://bugs.llvm.org/attachment.cgi?id=25002&action=edit
trace and additional information

The following code crashed Clang when adding debug information. 

static int d, b, k;
static char c[];
static int e[];
static int *f = e;
static short h();
short h() {
  int *n = &b;
  char *o = &d;
  *n = ((&c == o) > 40, 1); /* HERE */
  return 0;
}
int main() { h(); }

Compile: clang-13  0e836490069ceb4a485d852034e50a9c_878_test2520436154.c -o
del.o

Version: the trace here is created from the trunk of today compiled with an
address sanitizer.
clang version 13.0.0 (https://github.com/llvm/llvm-project.git
5db826e4ce63a4d45a4695e5486841d08b86cd24)
Target: x86_64-unknown-linux-gnu

I am not sure that the bugs are actually related, because this trace doesn't
pass through the loop vectorization part, but I still tested with the fix for
bug #45943; the crash still happens, as well as with previous versions:
clang-13, clang-12 and clang-10.

It failed with an assertion violation:
llvm/include/llvm/IR/Instructions.h:1215: void llvm::ICmpInst::AssertOK():
Assertion `getOperand(0)->getType() == getOperand(1)->getType() && "Both
operands to ICmp instruction are not of the same type!"' failed.


Trace: see the attachment. 

One interesting thing is that removing the line "static short h();" eliminates
the crash.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to