public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* patch to fix PR55458
@ 2012-11-27 22:04 Vladimir Makarov
  0 siblings, 0 replies; 3+ messages in thread
From: Vladimir Makarov @ 2012-11-27 22:04 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 584 bytes --]

   The following patch fixes

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55458

   The patch was successfully bootstrapped and tested on x86/x86-64.

   Committed as rev. 193871.

2012-11-27  Vladimir Makarov  <vmakarov@redhat.com>

         PR rtl-optimization/55458
         * lra-assigns.c: Include rtl-error.h.
         (assign_by_spills): Report about asm impossible constraints.
         * Makefile.in (lra-assigns.c): Add $(RTL_ERROR_H).

2012-11-27  Vladimir Makarov  <vmakarov@redhat.com>

         PR rtl-optimization/55458
         * gcc.target/i386/pr55458.c: New test.


[-- Attachment #2: pr55458.patch --]
[-- Type: text/x-patch, Size: 2738 bytes --]

Index: Makefile.in
===================================================================
--- Makefile.in	(revision 193870)
+++ Makefile.in	(working copy)
@@ -3261,7 +3261,7 @@ lra.o : lra.c $(CONFIG_H) $(SYSTEM_H) co
    $(FLAGS_H) $(FUNCTION_H) $(EXPR_H) $(BASIC_BLOCK_H) $(TM_P_H) \
    $(EXCEPT_H) ira.h $(LRA_INT_H)
 lra-assigns.o : lra-assigns.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
-   $(TM_H) $(RTL_H) $(REGS_H) insn-config.h $(DF_H) \
+   $(TM_H) $(RTL_H) $(RTL_ERROR_H) $(REGS_H) insn-config.h $(DF_H) \
    $(RECOG_H) output.h $(REGS_H) hard-reg-set.h $(FLAGS_H) $(FUNCTION_H) \
    $(EXPR_H) $(BASIC_BLOCK_H) $(TM_P_H) $(EXCEPT_H) ira.h \
    rtl-error.h sparseset.h $(LRA_INT_H)
Index: lra-assigns.c
===================================================================
--- lra-assigns.c	(revision 193870)
+++ lra-assigns.c	(working copy)
@@ -81,6 +81,7 @@ along with GCC; see the file COPYING3.	I
 #include "tm.h"
 #include "hard-reg-set.h"
 #include "rtl.h"
+#include "rtl-error.h"
 #include "tm_p.h"
 #include "target.h"
 #include "insn-config.h"
@@ -1209,7 +1210,34 @@ assign_by_spills (void)
 	}
       if (nfails == 0)
 	break;
-      lra_assert (iter == 0);
+      if (iter > 0)
+	{
+	  /* We did not assign hard regs to reload pseudos after two
+	     iteration.  It means something is wrong with asm insn
+	     constraints.  Report it.  */
+	  bool asm_p = false;
+	  bitmap_head failed_reload_insns;
+
+	  bitmap_initialize (&failed_reload_insns, &reg_obstack);
+	  for (i = 0; i < nfails; i++)
+	    bitmap_ior_into (&failed_reload_insns,
+			     &lra_reg_info[sorted_pseudos[i]].insn_bitmap);
+	  EXECUTE_IF_SET_IN_BITMAP (&failed_reload_insns, 0, u, bi)
+	    {
+	      insn = lra_insn_recog_data[u]->insn;
+	      if (asm_noperands (PATTERN (insn)) >= 0)
+		{
+		  asm_p = true;
+		  error_for_asm (insn,
+				 "%<asm%> operand has impossible constraints");
+		  /* Avoid further trouble with this insn.	*/
+		  PATTERN (insn) = gen_rtx_USE (VOIDmode, const0_rtx);
+		  lra_invalidate_insn_data (insn);
+		}
+	    }
+	  lra_assert (asm_p);
+	  break;
+	}
       /* This is a very rare event.  We can not assign a hard
 	 register to reload pseudo because the hard register was
 	 assigned to another reload pseudo on a previous
Index: testsuite/gcc.target/i386/pr55458.c
===================================================================
--- testsuite/gcc.target/i386/pr55458.c	(revision 0)
+++ testsuite/gcc.target/i386/pr55458.c	(working copy)
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target ilp32 } */
+/* { dg-options "-fPIC" } */
+
+int a, b, c;
+
+void
+foo (void)
+{
+  asm volatile ("":"+m" (a), "+m" (b), "+m" (c)); /* { dg-error "operand has impossible constraints" } */
+}

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: patch to fix PR55458
  2012-11-28 18:10 Uros Bizjak
@ 2012-11-28 18:15 ` Vladimir Makarov
  0 siblings, 0 replies; 3+ messages in thread
From: Vladimir Makarov @ 2012-11-28 18:15 UTC (permalink / raw)
  To: Uros Bizjak; +Cc: gcc-patches

On 12-11-28 1:10 PM, Uros Bizjak wrote:
> Hello!
>
>> The following patch fixes
>>
>> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55458
>>
>> The patch was successfully bootstrapped and tested on x86/x86-64.
>>
>> Committed as rev. 193871.
>>
>> 2012-11-27 Vladimir Makarov <vmakarov@redhat.com>
>>
>>          PR rtl-optimization/55458
>>          * lra-assigns.c: Include rtl-error.h.
>>          (assign_by_spills): Report about asm impossible constraints.
>>          * Makefile.in (lra-assigns.c): Add $(RTL_ERROR_H).
>>
>>
>> 2012-11-27 Vladimir Makarov <vmakarov@redhat.com>
>>
>>          PR rtl-optimization/55458
>>          * gcc.target/i386/pr55458.c: New test.
> Index: testsuite/gcc.target/i386/pr55458.c
> ===================================================================
> --- testsuite/gcc.target/i386/pr55458.c	(revision 0)
> +++ testsuite/gcc.target/i386/pr55458.c	(working copy)
> @@ -0,0 +1,11 @@
> +/* { dg-do compile } */
> +/* { dg-require-effective-target ilp32 } */
>
> Effective target should be ia32 in this case. x32 also matches ilp32,
> and since it has plenty of registers, doesn't error-out as expected.
>
> Fixed by attached patch.
>
> 2012-11-28  Uros Bizjak  <ubizjak@gmail.com>
>
> 	* gcc.target/i386/pr55458.c: Require ia32 target instead of ilp32.
>
> Tested on x86_64-pc-linux-gnu and committed to mainline SVN.
>
>
Thanks, Uros.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: patch to fix PR55458
@ 2012-11-28 18:10 Uros Bizjak
  2012-11-28 18:15 ` Vladimir Makarov
  0 siblings, 1 reply; 3+ messages in thread
From: Uros Bizjak @ 2012-11-28 18:10 UTC (permalink / raw)
  To: gcc-patches; +Cc: Vladimir Makarov

Hello!

> The following patch fixes
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55458
>
> The patch was successfully bootstrapped and tested on x86/x86-64.
>
> Committed as rev. 193871.
>
> 2012-11-27 Vladimir Makarov <vmakarov@redhat.com>
>
>         PR rtl-optimization/55458
>         * lra-assigns.c: Include rtl-error.h.
>         (assign_by_spills): Report about asm impossible constraints.
>         * Makefile.in (lra-assigns.c): Add $(RTL_ERROR_H).
>
>
> 2012-11-27 Vladimir Makarov <vmakarov@redhat.com>
>
>         PR rtl-optimization/55458
>         * gcc.target/i386/pr55458.c: New test.

Index: testsuite/gcc.target/i386/pr55458.c
===================================================================
--- testsuite/gcc.target/i386/pr55458.c	(revision 0)
+++ testsuite/gcc.target/i386/pr55458.c	(working copy)
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target ilp32 } */

Effective target should be ia32 in this case. x32 also matches ilp32,
and since it has plenty of registers, doesn't error-out as expected.

Fixed by attached patch.

2012-11-28  Uros Bizjak  <ubizjak@gmail.com>

	* gcc.target/i386/pr55458.c: Require ia32 target instead of ilp32.

Tested on x86_64-pc-linux-gnu and committed to mainline SVN.

Uros.

Index: gcc.target/i386/pr55458.c
===================================================================
--- gcc.target/i386/pr55458.c   (revision 193894)
+++ gcc.target/i386/pr55458.c   (working copy)
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
-/* { dg-require-effective-target ilp32 } */
+/* { dg-require-effective-target ia32 } */
 /* { dg-options "-fPIC" } */

 int a, b, c;

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-11-28 18:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-27 22:04 patch to fix PR55458 Vladimir Makarov
2012-11-28 18:10 Uros Bizjak
2012-11-28 18:15 ` Vladimir Makarov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).