From 9517e33332fedbeb98a80a96b4ee434c4bca1023 Mon Sep 17 00:00:00 2001 From: Uros Bizjak Date: Wed, 22 Feb 2012 20:12:09 +0100 Subject: [PATCH] re PR target/52330 (pr50305.c: valgrind problem on invalid asm) PR target/52330 * config/i386/i386.c (ix86_print_operand) : Error out if x is not offsettable memory reference. testsuite/ChangeLog: PR target/52330 * gcc.target/i386/pr52330.c: New test. From-SVN: r184488 --- gcc/ChangeLog | 32 +++++++++++++------------ gcc/config/i386/i386.c | 7 ++++++ gcc/testsuite/ChangeLog | 17 +++++++------ gcc/testsuite/gcc.target/i386/pr52330.c | 7 ++++++ 4 files changed, 41 insertions(+), 22 deletions(-) create mode 100644 gcc/testsuite/gcc.target/i386/pr52330.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 70b924b62f2..48488afcf01 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2012-02-22 Uros Bizjak + + PR target/52330 + * config/i386/i386.c (ix86_print_operand) : Error out if x + is not offsettable memory reference. + 2012-02-22 Georg-Johann Lay PR target/18145 @@ -7,7 +13,7 @@ 2012-02-22 Georg-Johann Lay * config/avr/avr.h (avr_accumulate_outgoing_args): Return int. - * config/avr/avr.c (avr_accumulate_outgoing_args): Return int. + * config/avr/avr.c (avr_accumulate_outgoing_args): Return int. 2012-02-22 Rainer Orth @@ -422,8 +428,7 @@ 2012-02-14 Bernd Schmidt * haifa-sched.c (prune_ready_list): Ensure that if there is a - sched-group insn, it either remains alone or the entire list is - pruned. + sched-group insn, it either remains alone or the entire list is pruned. 2012-02-14 Jonathan Wakely @@ -543,8 +548,8 @@ * gcc.c (LINK_COMMAND_SPEC): Deal with -fgnu-tm. (GTM_SELF_SPECS): Define if not already defined. (driver_self_specs): Add GTM_SELF_SPECS. - * config/darwin.h (LINK_COMMAND_SPEC_A): Deal with -fgnu-tm. - (GTM_SELF_SPECS): Define. + * config/darwin.h (LINK_COMMAND_SPEC_A): Deal with -fgnu-tm. + (GTM_SELF_SPECS): Define. * config/i386/cygwin.h (GTM_SELF_SPECS): Likewise. * config/i386/mingw32.h (GTM_SELF_SPECS): Likewise. @@ -553,13 +558,11 @@ * cselib.c (expand_loc): Return sp, fp, hfp or cfa base reg right away if seen. - * cselib.c (dump_cselib_val): Don't assume l->setting_insn is - non-NULL. + * cselib.c (dump_cselib_val): Don't assume l->setting_insn is non-NULL. PR middle-end/52230 - * omp-low.c (expand_omp_for): If a static schedule without - chunk size has NULL region->cont, force fd.chunk_size to be - integer_zero_node. + * omp-low.c (expand_omp_for): If a static schedule without chunk size + has NULL region->cont, force fd.chunk_size to be integer_zero_node. 2012-02-13 Andrew MacLeod @@ -583,7 +586,7 @@ disallow changes from SFmode to mode with different size in FP regs. 2012-02-12 Robert Millan - Gerald Pfeifer + Gerald Pfeifer * ginclude/stddef.h [__FreeBSD_kernel__] (__size_t): Do not define. Tweak comment. @@ -607,8 +610,7 @@ 2012-02-11 Jakub Jelinek PR debug/52132 - * reg-stack.c (subst_stack_regs_in_debug_insn): Don't use - get_true_reg. + * reg-stack.c (subst_stack_regs_in_debug_insn): Don't use get_true_reg. 2012-02-11 Uros Bizjak @@ -969,8 +971,8 @@ * config/mips/mips-dspr2.md (mips_prepend): Mask operand 3 rather than operand 2. -2012-02-02 Jan Hubicka - Tom de Vries +2012-02-02 Jan Hubicka + Tom de Vries PR middle-end/51998 * cgraphunit.c (cgraph_analyze_function): Break cyclic aliases. diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 7c5ed4da579..24dbc492e84 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -14091,6 +14091,13 @@ ix86_print_operand (FILE *file, rtx x, int code) return; case 'H': + if (!offsettable_memref_p (x)) + { + output_operand_lossage ("operand is not an offsettable memory " + "reference, invalid operand " + "code 'H'"); + return; + } /* It doesn't actually matter what mode we use here, as we're only going to use this for printing. */ x = adjust_address_nv (x, DImode, 8); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index d52a3c94018..9134d73d439 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2012-02-22 Uros Bizjak + + PR target/52330 + * gcc.target/i386/pr52330.c: New test. + 2012-02-22 Tobias Burnus PR fortran/52335 @@ -10,8 +15,7 @@ 2012-02-21 Kai Tietz - * gcc.dg/bf-ms-layout-3.c: Mark char typed bitfield - as extension. + * gcc.dg/bf-ms-layout-3.c: Mark char typed bitfield as extension. 2012-02-21 Richard Guenther @@ -154,10 +158,9 @@ 2012-02-14 Hans-Peter Nilsson - * lib/target-supports.exp (check_effective_target_fgnu_tm): New - proc. + * lib/target-supports.exp (check_effective_target_fgnu_tm): New proc. * gfortran.dg/trans-mem-skel.f90: Gate test on effective_target - fgnu_tm. + fgnu_tm. * gcc.dg/lto/trans-mem-1_0.c, gcc.dg/lto/trans-mem-2_0.c, gcc.dg/lto/trans-mem-3_0.c, gcc.dg/lto/trans-mem-4_0.c: Ditto. * gcc.dg/tm/tm.exp: Gate the whole of gcc.dg/tm on @@ -531,8 +534,8 @@ * gcc.target/mips/mips-prepend-1.c: New test. -2012-02-02 Jan Hubicka - Tom de Vries +2012-02-02 Jan Hubicka + Tom de Vries PR middle-end/51998 * testsuite/gcc.dg/alias-12.c: New testcase. diff --git a/gcc/testsuite/gcc.target/i386/pr52330.c b/gcc/testsuite/gcc.target/i386/pr52330.c new file mode 100644 index 00000000000..22ba0b21aed --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr52330.c @@ -0,0 +1,7 @@ +/* { dg-do compile } */ +/* { dg-options "-O0" } */ + +void foo (int a) +{ + asm volatile ("# %H0" : : "r" (a)); /* { dg-error "not an offsettable" } */ +}