From: Andrew Pinski Date: Tue, 15 Jul 2008 12:52:56 +0000 (+0000) Subject: re PR target/31568 (ICE with invalid %y operand (inline-asm)) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=cb8cc791fdc4912ebf3cbe935f7912569e4e6ac3;p=gcc.git re PR target/31568 (ICE with invalid %y operand (inline-asm)) 2008-07-15 Andrew Pinski PR target/31568 * config/rs6000/rs6000.c (print_operand ): Don't use gcc_assert, instead call output_operand_lossage. 2008-07-15 Andrew Pinski PR target/31568 * gcc.target/powerpc/asm-y.c: New testcase. From-SVN: r137837 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 78c6f4388c7..e0ce324800f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2008-07-15 Andrew Pinski + + PR target/31568 + * config/rs6000/rs6000.c (print_operand ): Don't use + gcc_assert, instead call output_operand_lossage. + 2008-07-15 Kai Tietz * builtins.c (std_canonical_va_list): Treat structure based diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 214b6922b5c..57e8d5a874d 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -12288,9 +12288,13 @@ print_operand (FILE *file, rtx x, int code) fprintf (file, "0,%s", reg_names[REGNO (tmp)]); else { - gcc_assert (GET_CODE (tmp) == PLUS - && REG_P (XEXP (tmp, 0)) - && REG_P (XEXP (tmp, 1))); + if (!GET_CODE (tmp) == PLUS + || !REG_P (XEXP (tmp, 0)) + || !REG_P (XEXP (tmp, 1))) + { + output_operand_lossage ("invalid %%y value, try using the 'Z' constraint"); + break; + } if (REGNO (XEXP (tmp, 0)) == 0) fprintf (file, "%s,%s", reg_names[ REGNO (XEXP (tmp, 1)) ], diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 3e7162570e1..4526d9fcb83 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2008-07-15 Andrew Pinski + + PR target/31568 + * gcc.target/powerpc/asm-y.c: New testcase. + 2008-07-14 Eric Botcazou * case_optimization1.ad[sb]: New test. diff --git a/gcc/testsuite/gcc.target/powerpc/asm-y.c b/gcc/testsuite/gcc.target/powerpc/asm-y.c new file mode 100644 index 00000000000..7d5a6a61795 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/asm-y.c @@ -0,0 +1,11 @@ +/* { dg-do compile } */ +/* { dg-options "-O1" } */ + +/* Test that %yN does not cause an internal error if used incorrectly. */ + +int f(int *a) +{ + asm ("#%y0" : "=m"(a[2])); /* { dg-error "try using the 'Z' constraint" } */ + asm ("#%y0" : "=m"(a[1])); /* { dg-error "try using the 'Z' constraint" } */ + asm ("#%y0" : "=m"(a[0])); +}