Testcase for subtle if conversion bug.
authorChristoph Mallon <christoph.mallon@gmx.de>
Fri, 29 Jun 2007 17:16:44 +0000 (17:16 +0000)
committerChristoph Mallon <christoph.mallon@gmx.de>
Fri, 29 Jun 2007 17:16:44 +0000 (17:16 +0000)
[r14856]

ir/be/test/fehler34.c [new file with mode: 0644]

diff --git a/ir/be/test/fehler34.c b/ir/be/test/fehler34.c
new file mode 100644 (file)
index 0000000..ef9992d
--- /dev/null
@@ -0,0 +1,31 @@
+/* Very subtle if conversion bug: print is correct, return value is incorrect */
+
+#ifdef __GNUC__
+#define NO_INLINE __attribute__((noinline))
+#else
+#define NO_INLINE __declspec(noinline)
+#endif
+
+static inline int f(unsigned int x)
+{
+       if (x == 0xFFFFFFFF)
+               return 0;
+       else
+               return x;
+}
+
+
+unsigned int q = 89497;
+
+
+int NO_INLINE main2(void)
+{
+       printf("%d = 1\n", f(q) != 0);
+       return f(q) != 0;
+}
+
+
+int main(void)
+{
+       return !main2();
+}