<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 - type mismatch assertion violation when generating code for function declaration"
   href="https://bugs.llvm.org/show_bug.cgi?id=50988">50988</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>type mismatch assertion violation when generating code for function declaration
          </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>Linux
          </td>
        </tr>

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

        <tr>
          <th>Severity</th>
          <td>enhancement
          </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>k.even-mendoza@imperial.ac.uk
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=25002" name="attach_25002" title="trace and additional information">attachment 25002</a> <a href="attachment.cgi?id=25002&action=edit" title="trace and additional information">[details]</a></span>
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 (<a href="https://github.com/llvm/llvm-project.git">https://github.com/llvm/llvm-project.git</a>
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
<a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [LoopVectorizer] Assertion "Both operands to ICmp instruction are not of the same type!" failed."
   href="show_bug.cgi?id=45943">bug #45943</a>; 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.</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>