From 53b9033c2c113edcf4e697a2c74ab850311b751a Mon Sep 17 00:00:00 2001 From: krebbel Date: Fri, 26 Nov 2010 14:07:16 +0000 Subject: [PATCH] 2010-11-26 Andreas Krebbel * config/s390/s390.c (print_operand_address): Replace assert with error message. (print_operand): Replace assertions, gcc_unreachable and fatal_insn with error messages. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@167177 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 7 +++++ gcc/config/s390/s390.c | 79 ++++++++++++++++++++++++++++++++++++++------------ 2 files changed, 67 insertions(+), 19 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a92635cd9a8..26694ac4d3e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2010-11-26 Andreas Krebbel + + * config/s390/s390.c (print_operand_address): Replace assert with + error message. + (print_operand): Replace assertions, gcc_unreachable and + fatal_insn with error messages. + 2010-11-26 Richard Guenther PR tree-optimization/46665 diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c index cdf8c21a48b..25807239e92 100644 --- a/gcc/config/s390/s390.c +++ b/gcc/config/s390/s390.c @@ -5130,7 +5130,11 @@ print_operand_address (FILE *file, rtx addr) if (s390_symref_operand_p (addr, NULL, NULL)) { - gcc_assert (TARGET_Z10); + if (!TARGET_Z10) + { + error ("symbolic memory references are only supported on z10 or later"); + return; + } output_addr_const (file, addr); return; } @@ -5197,7 +5201,7 @@ print_operand (FILE *file, rtx x, int code) else if (GET_CODE (x) == GT) fprintf (file, "h"); else - gcc_unreachable (); + error ("invalid comparison operator for 'E' output modifier"); return; case 'J': @@ -5217,7 +5221,7 @@ print_operand (FILE *file, rtx x, int code) assemble_name (file, get_some_local_dynamic_name ()); } else - gcc_unreachable (); + error ("invalid reference for 'J' output modifier"); return; case 'G': @@ -5229,11 +5233,21 @@ print_operand (FILE *file, rtx x, int code) struct s390_address ad; int ret; - gcc_assert (GET_CODE (x) == MEM); + if (!MEM_P (x)) + { + error ("memory reference expected for 'O' output modifier"); + return; + } + ret = s390_decompose_address (XEXP (x, 0), &ad); - gcc_assert (ret); - gcc_assert (!ad.base || REGNO_OK_FOR_BASE_P (REGNO (ad.base))); - gcc_assert (!ad.indx); + + if (!ret + || (ad.base && !REGNO_OK_FOR_BASE_P (REGNO (ad.base))) + || ad.indx) + { + error ("invalid address for 'O' output modifier"); + return; + } if (ad.disp) output_addr_const (file, ad.disp); @@ -5247,11 +5261,21 @@ print_operand (FILE *file, rtx x, int code) struct s390_address ad; int ret; - gcc_assert (GET_CODE (x) == MEM); + if (!MEM_P (x)) + { + error ("memory reference expected for 'R' output modifier"); + return; + } + ret = s390_decompose_address (XEXP (x, 0), &ad); - gcc_assert (ret); - gcc_assert (!ad.base || REGNO_OK_FOR_BASE_P (REGNO (ad.base))); - gcc_assert (!ad.indx); + + if (!ret + || (ad.base && !REGNO_OK_FOR_BASE_P (REGNO (ad.base))) + || ad.indx) + { + error ("invalid address for 'R' output modifier"); + return; + } if (ad.base) fprintf (file, "%s", reg_names[REGNO (ad.base)]); @@ -5265,11 +5289,20 @@ print_operand (FILE *file, rtx x, int code) struct s390_address ad; int ret; - gcc_assert (GET_CODE (x) == MEM); + if (!MEM_P (x)) + { + error ("memory reference expected for 'S' output modifier"); + return; + } ret = s390_decompose_address (XEXP (x, 0), &ad); - gcc_assert (ret); - gcc_assert (!ad.base || REGNO_OK_FOR_BASE_P (REGNO (ad.base))); - gcc_assert (!ad.indx); + + if (!ret + || (ad.base && !REGNO_OK_FOR_BASE_P (REGNO (ad.base))) + || ad.indx) + { + error ("invalid address for 'S' output modifier"); + return; + } if (ad.disp) output_addr_const (file, ad.disp); @@ -5287,7 +5320,7 @@ print_operand (FILE *file, rtx x, int code) else if (GET_CODE (x) == MEM) x = change_address (x, VOIDmode, plus_constant (XEXP (x, 0), 4)); else - gcc_unreachable (); + error ("register or memory expression expected for 'N' output modifier"); break; case 'M': @@ -5296,7 +5329,7 @@ print_operand (FILE *file, rtx x, int code) else if (GET_CODE (x) == MEM) x = change_address (x, VOIDmode, plus_constant (XEXP (x, 0), 8)); else - gcc_unreachable (); + error ("register or memory expression expected for 'M' output modifier"); break; case 'Y': @@ -5357,11 +5390,19 @@ print_operand (FILE *file, rtx x, int code) else if (code == 'h') fprintf (file, HOST_WIDE_INT_PRINT_DEC, ((CONST_DOUBLE_LOW (x) & 0xffff) ^ 0x8000) - 0x8000); else - gcc_unreachable (); + { + if (code == 0) + error ("invalid constant - try using an output modifier"); + else + error ("invalid constant for output modifier '%c'", code); + } break; default: - fatal_insn ("UNKNOWN in print_operand !?", x); + if (code == 0) + error ("invalid expression - try using an output modifier"); + else + error ("invalid expression for output modifier '%c'", code); break; } } -- 2.11.4.GIT