Hi!

On Thu, Nov 22, 2012 at 08:29:36PM -0500, Vladimir Makarov wrote:
>   The following patch fixes
> 
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55430
> 
>   The patch was successfully bootstrapped and tested on x86/x86-64.
> 
>   Committed as rev. 193742.
> 
> 2012-11-22  Vladimir Makarov  <vmaka...@redhat.com>
> 
>         PR middle-end/55430
>         * lra.c: Move #include "hard-reg-set.h" before #include "rtl.h".
>         (new_insn_reg): Update biggest_mode.
>         (collect_non_operand_hard_regs): Check eliminable regs too.
>         (initialize_lra_reg_info_element): Initialize biggest_mode.
>         (add_regs_to_insn_regno_info): Ignore non-allocatable
>         non-eliminable hard regs.
>         (lra.c): Move setting lra_no_alloc_regs before
>         init_insn_recog_data.
>         * lra-constraints.c (simplify_operand_subreg): Add a comment.
>         (lra_constraints): Ignore equivalent memory of
>         regs occuring in paradoxical subregs.
>         * lra-lives.c (lra_create_live_ranges): Add a comment.

You haven't committed a testcase for this.  I've adjusted my testcase
to match what e.g. gcc.dg/20030711-1.c testcase does (to make sure it
will work even on weirdo effective target mmap targets).  Ok for trunk?

And thanks for the bugfix.

2012-11-23  Jakub Jelinek  <ja...@redhat.com>

        PR middle-end/55430
        * gcc.dg/pr55430.c: New test.

--- gcc/testsuite/gcc.dg/pr55430.c.jj   2012-11-23 15:40:04.724649106 +0100
+++ gcc/testsuite/gcc.dg/pr55430.c      2012-11-23 15:27:15.000000000 +0100
@@ -0,0 +1,43 @@
+/* PR middle-end/55430 */
+/* { dg-do run { target mmap } } */
+/* { dg-options "-O2" } */
+
+#include <stddef.h>
+#include <stdio.h>
+#include <sys/mman.h>
+#ifndef MAP_ANONYMOUS
+#define MAP_ANONYMOUS MAP_ANON
+#endif
+#ifndef MAP_ANON
+#define MAP_ANON 0
+#endif
+#include <stdlib.h>
+
+struct S
+{
+  unsigned int s1 : 8;
+  unsigned int s2 : 2;
+};
+
+__attribute__((noinline, noclone)) int
+foo (int x, int y, struct S *z, unsigned int w)
+{
+  if (z[y].s2 == x && z[y].s1 == w)
+    return 1;
+  return 0;
+}
+
+int
+main ()
+{
+  char *p = mmap (NULL, 131072, PROT_READ | PROT_WRITE,
+                 MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
+  if (p == MAP_FAILED)
+    return 0;
+  if (munmap (p + 65536, 65536) < 0)
+    return 0;
+  if ((65536 / sizeof (struct S)) * sizeof (struct S) != 65536)
+    return 0;
+  struct S *s = (struct S *) (p + 65536);
+  return foo (0, 0, s - 1, 0) != 1;
+}

        Jakub

Reply via email to