public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH, i386]: Fix PR79804, ICE in print_reg
@ 2017-04-20 21:31 Uros Bizjak
  2017-04-21  7:55 ` Markus Trippelsdorf
  0 siblings, 1 reply; 3+ messages in thread
From: Uros Bizjak @ 2017-04-20 21:31 UTC (permalink / raw)
  To: gcc-patches

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

2017-04-20  Uros Bizjak  <ubizjak@gmail.com>

    PR target/79804
    * config/i386/i386.c (print_reg): Remove assert for disalowed
    regno values, call output_operand_lossage instead.

testsuite/ChangeLog:

2017-04-20  Uros Bizjak  <ubizjak@gmail.com>

    PR target/79804
    * gcc.target/i386/pr79804.c: New test.

Bootstrapped and regression tested on x86_64-linux-gnu {,-m32}.

Committed to mainline SVN.

Uros.

[-- Attachment #2: p.diff.txt --]
[-- Type: text/plain, Size: 1263 bytes --]

Index: config/i386/i386.c
===================================================================
--- config/i386/i386.c	(revision 246382)
+++ config/i386/i386.c	(working copy)
@@ -17637,13 +17637,17 @@ print_reg (rtx x, int code, FILE *file)
 
   regno = REGNO (x);
 
-  gcc_assert (regno != ARG_POINTER_REGNUM
-	      && regno != FRAME_POINTER_REGNUM
-	      && regno != FPSR_REG
-	      && regno != FPCR_REG);
-
-  if (regno == FLAGS_REG)
+  if (regno == ARG_POINTER_REGNUM
+      || regno == FRAME_POINTER_REGNUM
+      || regno == FPSR_REG
+      || regno == FPCR_REG)
     {
+      output_operand_lossage
+	("invalid use of register '%s'", reg_names[regno]);
+      return;
+    }
+  else if (regno == FLAGS_REG)
+    {
       output_operand_lossage ("invalid use of asm flag output");
       return;
     }
Index: testsuite/gcc.target/i386/pr79804.c
===================================================================
--- testsuite/gcc.target/i386/pr79804.c	(nonexistent)
+++ testsuite/gcc.target/i386/pr79804.c	(working copy)
@@ -0,0 +1,10 @@
+/* PR target/79804 */
+/* { dg-do compile } */
+/* { dg-options "" } */
+
+void foo (void)
+{
+  register int r20 asm ("20");
+
+  asm volatile ("# %0" : "=r"(r20));  /* { dg-error "invalid use of register" } */
+}

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

* Re: [PATCH, i386]: Fix PR79804, ICE in print_reg
  2017-04-20 21:31 [PATCH, i386]: Fix PR79804, ICE in print_reg Uros Bizjak
@ 2017-04-21  7:55 ` Markus Trippelsdorf
  2017-04-21 19:27   ` Uros Bizjak
  0 siblings, 1 reply; 3+ messages in thread
From: Markus Trippelsdorf @ 2017-04-21  7:55 UTC (permalink / raw)
  To: Uros Bizjak; +Cc: gcc-patches

On 2017.04.20 at 22:29 +0200, Uros Bizjak wrote:
> 
>     PR target/79804
>     * gcc.target/i386/pr79804.c: New test.
> 
> Bootstrapped and regression tested on x86_64-linux-gnu {,-m32}.
> 
> Committed to mainline SVN.
> --- testsuite/gcc.target/i386/pr79804.c	(nonexistent)
> +++ testsuite/gcc.target/i386/pr79804.c	(working copy)
> @@ -0,0 +1,10 @@
> +/* PR target/79804 */
> +/* { dg-do compile } */
> +/* { dg-options "" } */
> +
> +void foo (void)
> +{
> +  register int r20 asm ("20");
> +
> +  asm volatile ("# %0" : "=r"(r20));  /* { dg-error "invalid use of register" } */
> +}

The test fails without optimizations:

gcc/testsuite/gcc.target/i386/pr79804.c: In function ‘foo’:
gcc/testsuite/gcc.target/i386/pr79804.c:10:1: error: frame cannot be used in asm here
 }
 ^
gcc/testsuite/gcc.target/i386/pr79804.c:9:3: error: invalid 'asm': invalid use of register 'frame'
   asm volatile ("# %0" : "=r"(r20));  /* { dg-error "invalid use of register" } */
   ^~~


-- 
Markus

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

* Re: [PATCH, i386]: Fix PR79804, ICE in print_reg
  2017-04-21  7:55 ` Markus Trippelsdorf
@ 2017-04-21 19:27   ` Uros Bizjak
  0 siblings, 0 replies; 3+ messages in thread
From: Uros Bizjak @ 2017-04-21 19:27 UTC (permalink / raw)
  To: Markus Trippelsdorf; +Cc: gcc-patches

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

On Fri, Apr 21, 2017 at 7:15 AM, Markus Trippelsdorf
<markus@trippelsdorf.de> wrote:
> On 2017.04.20 at 22:29 +0200, Uros Bizjak wrote:
>>
>>     PR target/79804
>>     * gcc.target/i386/pr79804.c: New test.
>>
>> Bootstrapped and regression tested on x86_64-linux-gnu {,-m32}.
>>
>> Committed to mainline SVN.
>
> The test fails without optimizations:
>
> gcc/testsuite/gcc.target/i386/pr79804.c: In function ‘foo’:
> gcc/testsuite/gcc.target/i386/pr79804.c:10:1: error: frame cannot be used in asm here
>  }
>  ^
> gcc/testsuite/gcc.target/i386/pr79804.c:9:3: error: invalid 'asm': invalid use of register 'frame'
>    asm volatile ("# %0" : "=r"(r20));  /* { dg-error "invalid use of register" } */
>    ^~~

Oops, fixed with attached patch.

2017-04-21  Uros Bizjak  <ubizjak@gmail.com>

    * gcc.target/i386/pr79804.c: Add additional dg-error directive.

Thanks,
Uros.

[-- Attachment #2: t.diff.txt --]
[-- Type: text/plain, Size: 422 bytes --]

diff --git a/gcc/testsuite/gcc.target/i386/pr79804.c b/gcc/testsuite/gcc.target/i386/pr79804.c
index 4325131..c7dda69 100644
--- a/gcc/testsuite/gcc.target/i386/pr79804.c
+++ b/gcc/testsuite/gcc.target/i386/pr79804.c
@@ -7,4 +7,4 @@ void foo (void)
   register int r20 asm ("20");
 
   asm volatile ("# %0" : "=r"(r20));  /* { dg-error "invalid use of register" } */
-}
+}  /* { dg-error "cannot be used in asm here" } */

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

end of thread, other threads:[~2017-04-21 19:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-20 21:31 [PATCH, i386]: Fix PR79804, ICE in print_reg Uros Bizjak
2017-04-21  7:55 ` Markus Trippelsdorf
2017-04-21 19:27   ` Uros Bizjak

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