public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug inline-asm/55934] New: [4.8 Regression] LRA inline asm error recovery
@ 2013-01-10 10:01 jakub at gcc dot gnu.org
  2013-01-10 10:02 ` [Bug inline-asm/55934] " jakub at gcc dot gnu.org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: jakub at gcc dot gnu.org @ 2013-01-10 10:01 UTC (permalink / raw)
  To: gcc-bugs


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

             Bug #: 55934
           Summary: [4.8 Regression] LRA inline asm error recovery
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: inline-asm
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: jakub@gcc.gnu.org


_Complex float
foo (void)
{
  _Complex float x;
  __asm ("" : "=x" (x)); /* { dg-error "impossible register constraint" } */
  return x;
}

on x86_64 used to ICE since the introduction of LRA (before that it has been
just issuing error on the asm).  Starting with
http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=193871
this got fixed, but already (guess) starting with
http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=193901
it issues both the expected error and also ICE after it.


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

* [Bug inline-asm/55934] [4.8 Regression] LRA inline asm error recovery
  2013-01-10 10:01 [Bug inline-asm/55934] New: [4.8 Regression] LRA inline asm error recovery jakub at gcc dot gnu.org
@ 2013-01-10 10:02 ` jakub at gcc dot gnu.org
  2013-01-10 21:17 ` pinskia at gcc dot gnu.org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu.org @ 2013-01-10 10:02 UTC (permalink / raw)
  To: gcc-bugs


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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |error-recovery, ra
           Priority|P3                          |P2
                 CC|                            |vmakarov at gcc dot gnu.org
   Target Milestone|---                         |4.8.0


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

* [Bug inline-asm/55934] [4.8 Regression] LRA inline asm error recovery
  2013-01-10 10:01 [Bug inline-asm/55934] New: [4.8 Regression] LRA inline asm error recovery jakub at gcc dot gnu.org
  2013-01-10 10:02 ` [Bug inline-asm/55934] " jakub at gcc dot gnu.org
@ 2013-01-10 21:17 ` pinskia at gcc dot gnu.org
  2013-01-11 12:49 ` steven at gcc dot gnu.org
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu.org @ 2013-01-10 21:17 UTC (permalink / raw)
  To: gcc-bugs


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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-invalid-code
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2013-01-10
                 CC|                            |pinskia at gcc dot gnu.org
     Ever Confirmed|0                           |1

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> 2013-01-10 21:17:05 UTC ---
Confirmed.


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

* [Bug inline-asm/55934] [4.8 Regression] LRA inline asm error recovery
  2013-01-10 10:01 [Bug inline-asm/55934] New: [4.8 Regression] LRA inline asm error recovery jakub at gcc dot gnu.org
  2013-01-10 10:02 ` [Bug inline-asm/55934] " jakub at gcc dot gnu.org
  2013-01-10 21:17 ` pinskia at gcc dot gnu.org
@ 2013-01-11 12:49 ` steven at gcc dot gnu.org
  2013-01-11 12:51 ` steven at gcc dot gnu.org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: steven at gcc dot gnu.org @ 2013-01-11 12:49 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #2 from Steven Bosscher <steven at gcc dot gnu.org> 2013-01-11 12:49:16 UTC ---
This is trivially fixed with the following patch:

Index: lra-assigns.c
===================================================================
--- lra-assigns.c       (revision 195104)
+++ lra-assigns.c       (working copy)
@@ -1240,6 +1240,9 @@ assign_by_spills (void)
                  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_set_insn_deleted (insn);
                }
            }
          lra_assert (asm_p);


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

* [Bug inline-asm/55934] [4.8 Regression] LRA inline asm error recovery
  2013-01-10 10:01 [Bug inline-asm/55934] New: [4.8 Regression] LRA inline asm error recovery jakub at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2013-01-11 12:49 ` steven at gcc dot gnu.org
@ 2013-01-11 12:51 ` steven at gcc dot gnu.org
  2013-01-11 12:59 ` jakub at gcc dot gnu.org
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: steven at gcc dot gnu.org @ 2013-01-11 12:51 UTC (permalink / raw)
  To: gcc-bugs


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

Steven Bosscher <steven at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
                 CC|                            |steven at gcc dot gnu.org
         AssignedTo|unassigned at gcc dot       |steven at gcc dot gnu.org
                   |gnu.org                     |

--- Comment #3 from Steven Bosscher <steven at gcc dot gnu.org> 2013-01-11 12:50:57 UTC ---
(In reply to comment #2)
> This is trivially fixed with the following patch:

Correction: should be fixed by that patch, but actually is not...
Investigating.


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

* [Bug inline-asm/55934] [4.8 Regression] LRA inline asm error recovery
  2013-01-10 10:01 [Bug inline-asm/55934] New: [4.8 Regression] LRA inline asm error recovery jakub at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2013-01-11 12:51 ` steven at gcc dot gnu.org
@ 2013-01-11 12:59 ` jakub at gcc dot gnu.org
  2013-01-11 16:10 ` pinskia at gcc dot gnu.org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu.org @ 2013-01-11 12:59 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> 2013-01-11 12:59:33 UTC ---
Please also consider asm goto like:
void bar (int);

void
foo (_Complex float x)
{
  asm volatile goto ("" : : "x" (x) : : foo); /* { dg-error "impossible
constraint" } */
  bar (1);
foo:
  bar (2);
}

Turning a JUMP_INSN pattern into (use (const_int 0)) might not work well,
though apparently reload.c does that too.  Perhaps it is lucky enough with it,
as if reload results in errors, following passes are skipped.


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

* [Bug inline-asm/55934] [4.8 Regression] LRA inline asm error recovery
  2013-01-10 10:01 [Bug inline-asm/55934] New: [4.8 Regression] LRA inline asm error recovery jakub at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2013-01-11 12:59 ` jakub at gcc dot gnu.org
@ 2013-01-11 16:10 ` pinskia at gcc dot gnu.org
  2013-01-16 21:00 ` steven at gcc dot gnu.org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu.org @ 2013-01-11 16:10 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> 2013-01-11 16:09:46 UTC ---
I should mention that Investigated this a little before and found the
instruction which was causing the ICE was not the inline-asm but a clobber of
the pseduregister which was in the complex mode.


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

* [Bug inline-asm/55934] [4.8 Regression] LRA inline asm error recovery
  2013-01-10 10:01 [Bug inline-asm/55934] New: [4.8 Regression] LRA inline asm error recovery jakub at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2013-01-11 16:10 ` pinskia at gcc dot gnu.org
@ 2013-01-16 21:00 ` steven at gcc dot gnu.org
  2013-01-17 10:45 ` jakub at gcc dot gnu.org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: steven at gcc dot gnu.org @ 2013-01-16 21:00 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #6 from Steven Bosscher <steven at gcc dot gnu.org> 2013-01-16 20:59:17 UTC ---
I had expected the following patch to fix the issue:

        * lra-assigns.c (assign_by_spills): Throw away the pattern of asms
        that have operands with impossible constraints.
        * lra-constraints.c (process_alt_operands): Verify that a class
        selected from constraints on asms is valid for the operand mode.

Index: lra-assigns.c
===================================================================
--- lra-assigns.c       (revision 195104)
+++ lra-assigns.c       (working copy)
@@ -1240,6 +1240,9 @@ assign_by_spills (void)
                  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_set_insn_deleted (insn);
                }
            }
          lra_assert (asm_p);
Index: lra-constraints.c
===================================================================
--- lra-constraints.c   (revision 195104)
+++ lra-constraints.c   (working copy)
@@ -1809,6 +1809,20 @@ process_alt_operands (int only_alternati
            }
          while ((p += len), c);

+         /* For asms, verify that the class for this alternative is possible
+            for the mode that is specified.  */
+         if (INSN_CODE (curr_insn) < 0)
+           {
+             int i;
+             gcc_assert (n_alternatives == 1);
+             for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
+               if (HARD_REGNO_MODE_OK (i, mode)
+                   && in_hard_reg_set_p (reg_class_contents[this_alternative],
mode, i))
+                 break;
+             if (i == FIRST_PSEUDO_REGISTER)
+               return false;
+           }
+
          /* Record which operands fit this alternative.  */
          if (win)
            {




But this results in a different error message than before:
$ ./cc1 -quiet -O2 t.c
t.c: In function 'foo':
t.c:5:3: error: inconsistent operand constraints in an 'asm'
   __asm ("" : "=x" (x)); /* { dg-error "impossible register constraint" } */
   ^

Personally I don't care one way or the other: impossible or inconsistent,
bottom line it's a bad constraint. What do others think about this?


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

* [Bug inline-asm/55934] [4.8 Regression] LRA inline asm error recovery
  2013-01-10 10:01 [Bug inline-asm/55934] New: [4.8 Regression] LRA inline asm error recovery jakub at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2013-01-16 21:00 ` steven at gcc dot gnu.org
@ 2013-01-17 10:45 ` jakub at gcc dot gnu.org
  2013-01-24 10:31 ` steven at gcc dot gnu.org
  2013-01-24 10:31 ` steven at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu.org @ 2013-01-17 10:45 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> 2013-01-17 10:45:20 UTC ---
I don't care much about the error wording, I've put into dg-error just what gcc
was reporting before (and after it emitted ICE).


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

* [Bug inline-asm/55934] [4.8 Regression] LRA inline asm error recovery
  2013-01-10 10:01 [Bug inline-asm/55934] New: [4.8 Regression] LRA inline asm error recovery jakub at gcc dot gnu.org
                   ` (7 preceding siblings ...)
  2013-01-17 10:45 ` jakub at gcc dot gnu.org
@ 2013-01-24 10:31 ` steven at gcc dot gnu.org
  2013-01-24 10:31 ` steven at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: steven at gcc dot gnu.org @ 2013-01-24 10:31 UTC (permalink / raw)
  To: gcc-bugs


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

Steven Bosscher <steven at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED

--- Comment #9 from Steven Bosscher <steven at gcc dot gnu.org> 2013-01-24 10:31:06 UTC ---
.


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

* [Bug inline-asm/55934] [4.8 Regression] LRA inline asm error recovery
  2013-01-10 10:01 [Bug inline-asm/55934] New: [4.8 Regression] LRA inline asm error recovery jakub at gcc dot gnu.org
                   ` (8 preceding siblings ...)
  2013-01-24 10:31 ` steven at gcc dot gnu.org
@ 2013-01-24 10:31 ` steven at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: steven at gcc dot gnu.org @ 2013-01-24 10:31 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #8 from Steven Bosscher <steven at gcc dot gnu.org> 2013-01-24 10:30:29 UTC ---
Author: steven
Date: Thu Jan 24 10:30:26 2013
New Revision: 195420

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=195420
Log:
gcc/

    PR inline-asm/55934
    * lra-assigns.c (assign_by_spills): Throw away the pattern of asms
    that have operands with impossible constraints.
    Add a FIXME for a speed-up opportunity.
    * lra-constraints.c (process_alt_operands): Verify that a class
    selected from constraints on asms is valid for the operand mode.
    (curr_insn_transform): Remove incorrect comment.

testsuite/

    PR inline-asm/55934
    * gcc.target/i386/pr55934.c: New test.


Added:
    trunk/gcc/testsuite/gcc.target/i386/pr55934.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/lra-assigns.c
    trunk/gcc/lra-constraints.c
    trunk/gcc/testsuite/ChangeLog


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

end of thread, other threads:[~2013-01-24 10:31 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-10 10:01 [Bug inline-asm/55934] New: [4.8 Regression] LRA inline asm error recovery jakub at gcc dot gnu.org
2013-01-10 10:02 ` [Bug inline-asm/55934] " jakub at gcc dot gnu.org
2013-01-10 21:17 ` pinskia at gcc dot gnu.org
2013-01-11 12:49 ` steven at gcc dot gnu.org
2013-01-11 12:51 ` steven at gcc dot gnu.org
2013-01-11 12:59 ` jakub at gcc dot gnu.org
2013-01-11 16:10 ` pinskia at gcc dot gnu.org
2013-01-16 21:00 ` steven at gcc dot gnu.org
2013-01-17 10:45 ` jakub at gcc dot gnu.org
2013-01-24 10:31 ` steven at gcc dot gnu.org
2013-01-24 10:31 ` steven at gcc dot gnu.org

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).