First Last Prev Next    No search results available
Details
: [instcombine] miscompilation of setcc or setcc in some cases
Bug#: 548
: libraries
: Scalar Optimizations
Status: RESOLVED
Resolution: FIXED
: All
: All
: 1.4
: P2
: critical
: 1.5

:
: miscompilation
:
:
  Show dependency tree - Show dependency graph
People
Reporter: Markus F.X.J. Oberhumer <markus@oberhumer.com>
Assigned To: Unassigned LLVM Bugs <unassignedbugs@nondot.org>

Attachments


Note

You need to log in before you can comment on or make changes to this bug.

Related actions


Description:   Opened: 2005-04-19 00:28
The current (20050418) CVS version miscompiles this small program.

int foo(int s) {
  return (s == -1 || s > 0);
}

int bar(void) {
  return foo(-1);
}
------- Comment #1 From Chris Lattner 2005-04-19 00:44:43 -------
hrm, that would be bad.   How can I reproduce this?  Using:

llvm-gcc t.c -c -o - | llvm-dis

compiles bar into "ret int 1", which is correct.  What are you using?

-Chris
------- Comment #2 From Markus F.X.J. Oberhumer 2005-04-19 00:50:10 -------
I get this:


/* Function Bodies */

int foo(int l1_s) {

  return ((int )(l1_s > -1));
}


int bar(void) {

  return 0;
}

------- Comment #3 From Chris Lattner 2005-04-19 00:52:11 -------
What command are you using?  I definitely do not get that.

-Chris
------- Comment #4 From Chris Lattner 2005-04-19 00:55:52 -------
ah, by changing the program a bit I was able to trigger this problem.

I'm on it.

-Chris
------- Comment #5 From Chris Lattner 2005-04-19 01:07:04 -------
This looks like a bug in a patch that went in Sep 28, 2004.  Thanks a lot for
bringing this to my attention.  Here's the fix:

http://mail.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20050418/025474.html

-Chris
------- Comment #6 From Markus F.X.J. Oberhumer 2005-04-19 01:13:13 -------
Many thanks for the quick fix. Still I wonder how this could get unnoticed for
such a long time...

~Markus

First Last Prev Next    No search results available