This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix ICEs in expand_builtin_expect (PR middle-end/31959)


--- gcc/testsuite/gcc.dg/pr31959-1.c.jj 2007-06-19 18:44:16.000000000 +0200
+++ gcc/testsuite/gcc.dg/pr31959-1.c    2007-06-19 18:49:57.000000000 +0200
@@ -0,0 +1,26 @@
+/* PR middle-end/31959 */
+/* { dg-do compile } */
+/* { dg-options "-Werror -O2" } */
+/* { dg-message "warnings being treated as errors" "" {target "*-*-*"} 0 } */
+
+struct A { int i; };
+
+static inline struct A *
+baz (struct A *x)
+{
+  return x;
+}
+static inline struct A *
+bar (const struct A *x)
+{
+  return baz ((struct A *) x); /* { dg-error "discards qualifiers" } */
+}
+
+void *
+foo (struct A *x, int y)
+{
+  void *p = (void *) 0;
+  if (__builtin_expect (y >= 6, 0))
+    p = bar (x);
+  return p;
+}

This testcase really should not, produce a warning/error at all. Please see PR 29478 about that issue.

Thanks,
Andrew Pinski


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]