From 5f6705b7b57c0461766f784d6d495986163692bb Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Wed, 6 Nov 2019 09:08:39 +0100 Subject: [PATCH] re PR inline-asm/92352 (ICE in force_constant_size) PR inline-asm/92352 * gimplify.c (gimplify_asm_expr): Reject VLA in output or input operands with non-memory constraints. * c-c++-common/pr92352.c: New test. From-SVN: r277873 --- gcc/ChangeLog | 31 +++++++++++++++------------- gcc/c-family/ChangeLog | 10 +++++++++ gcc/gimplify.c | 15 +++++++++++--- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/c-c++-common/pr92352.c | 15 ++++++++++++++ 5 files changed, 59 insertions(+), 17 deletions(-) create mode 100644 gcc/testsuite/c-c++-common/pr92352.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e666a0ccf27..7fee0f37e9b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2019-11-06 Jakub Jelinek + + PR inline-asm/92352 + * gimplify.c (gimplify_asm_expr): Reject VLA in output or input + operands with non-memory constraints. + 2019-11-05 Martin Sebor PR tree-optimization/92373 @@ -530,10 +536,7 @@ PR middle-end/91647 PR middle-end/91463 PR middle-end/92312 - * c-family/c-pretty-print.c (direct_abstract_declarator): Print - bound in zero-length arrays. - * gcc/c-family/c.opt (-Wzero-length-bounds): New option. - * gcc/doc/invoke.texi (-Wzero-length-bounds): Document. + * doc/invoke.texi (-Wzero-length-bounds): Document. * gimple-match-head.c (try_conditional_simplification): Use memcpy instead of a hand-rolled loop to avoid PR 92323. * tree-vrp.c (vrp_prop::check_array_ref): Handle trailing arrays @@ -962,7 +965,7 @@ * tree-ssa-loop-niter.h (simplify_replace_tree): Change declaration. * tree-ssa-loop-niter.c (simplify_replace_tree): Add context parameter and make the valueize function pointer also take a void pointer. - * gcc/tree-ssa-sccvn.c (vn_valueize_wrapper): New function to wrap + * tree-ssa-sccvn.c (vn_valueize_wrapper): New function to wrap around vn_valueize, to call it without a context. (process_bb): Use vn_valueize_wrapper instead of vn_valueize. * tree-vect-loop.c (_loop_vec_info): Initialize epilogue_vinfos. @@ -3607,7 +3610,7 @@ 2019-10-12 John David Anglin - * gcc/config/pa/pa.c (pa_option_override): Remove trailing comma + * config/pa/pa.c (pa_option_override): Remove trailing comma from warning. 2019-10-12 Jakub Jelinek @@ -4009,7 +4012,7 @@ 2019-10-08 Dmitrij Pochepko PR tree-optimization/90836 - * gcc/match.pd (popcount): New pattern. + * match.pd (popcount): New pattern. 2019-10-08 Martin Sebor @@ -6878,7 +6881,7 @@ 2019-09-21 Martin Sebor PR middle-end/91830 - * gcc/gimple-ssa-warn-restrict.c (builtin_memref::set_base_and_offset): + * gimple-ssa-warn-restrict.c (builtin_memref::set_base_and_offset): Simplify computation of the offset of the referenced subobject. 2019-09-21 Iain Sandoe @@ -9388,15 +9391,15 @@ 2019-08-23 Wilco Dijkstra - * gcc/doc/invoke.texi (mneon-for-64bits): Deprecate option. - * gcc/config/arm/arm.opt (mneon-for-64bits): Deprecate option. - * gcc/config/arm/arm.h (TARGET_PREFER_NEON_64BITS): Remove. + * doc/invoke.texi (mneon-for-64bits): Deprecate option. + * config/arm/arm.opt (mneon-for-64bits): Deprecate option. + * config/arm/arm.h (TARGET_PREFER_NEON_64BITS): Remove. (prefer_neon_for_64bits): Remove. - * gcc/config/arm/arm.c (prefer_neon_for_64bits): Remove. + * config/arm/arm.c (prefer_neon_for_64bits): Remove. (tune_params): Remove PREF_NEON_64_FALSE uses. (arm_option_override): Remove prefer_neon selection code. (arm_print_tune_info): Remove prefer_neon_for_64bits. - * gcc/config/arm/arm-protos.h (tune_params): Remove + * config/arm/arm-protos.h (tune_params): Remove prefer_neon_for_64bits. (prefer_neon_for_64bits): Remove. @@ -11607,7 +11610,7 @@ 2019-08-13 Wilco Dijkstra PR target/81800 - * gcc/config/aarch64/aarch64.md (lrint): Disable lrint pattern if GPF + * config/aarch64/aarch64.md (lrint): Disable lrint pattern if GPF operand is larger than a long int. 2019-08-13 Richard Sandiford diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index 7f402960fc3..1859fddb4bf 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -21,6 +21,16 @@ * c-common.h (enum rid): Add RID_CONSTEVAL. * c-common.c (c_common_reswords): Add consteval. +2019-11-01 Martin Sebor + + PR middle-end/91679 + PR middle-end/91647 + PR middle-end/91463 + PR middle-end/92312 + * c-pretty-print.c (direct_abstract_declarator): Print + bound in zero-length arrays. + * c.opt (-Wzero-length-bounds): New option. + 2019-10-30 Nathan Sidwell * c-cppbuiltin.c (c_cpp_builtins): Add 'L' suffix to feature diff --git a/gcc/gimplify.c b/gcc/gimplify.c index d06b3ce5709..8feb2464b97 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -6235,8 +6235,13 @@ gimplify_asm_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p) is_inout = false; } - /* If we can't make copies, we can only accept memory. */ - if (TREE_ADDRESSABLE (TREE_TYPE (TREE_VALUE (link)))) + /* If we can't make copies, we can only accept memory. + Similarly for VLAs. */ + tree outtype = TREE_TYPE (TREE_VALUE (link)); + if (outtype != error_mark_node + && (TREE_ADDRESSABLE (outtype) + || !COMPLETE_TYPE_P (outtype) + || !tree_fits_poly_uint64_p (TYPE_SIZE_UNIT (outtype)))) { if (allows_mem) allows_reg = 0; @@ -6392,7 +6397,11 @@ gimplify_asm_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p) oconstraints, &allows_mem, &allows_reg); /* If we can't make copies, we can only accept memory. */ - if (TREE_ADDRESSABLE (TREE_TYPE (TREE_VALUE (link)))) + tree intype = TREE_TYPE (TREE_VALUE (link)); + if (intype != error_mark_node + && (TREE_ADDRESSABLE (intype) + || !COMPLETE_TYPE_P (intype) + || !tree_fits_poly_uint64_p (TYPE_SIZE_UNIT (intype)))) { if (allows_mem) allows_reg = 0; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 6e4820fb86e..a0f52ec2c5c 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-11-06 Jakub Jelinek + + PR inline-asm/92352 + * c-c++-common/pr92352.c: New test. + 2019-11-06 Xiong Hu Luo PR92090 diff --git a/gcc/testsuite/c-c++-common/pr92352.c b/gcc/testsuite/c-c++-common/pr92352.c new file mode 100644 index 00000000000..d714e9fa32a --- /dev/null +++ b/gcc/testsuite/c-c++-common/pr92352.c @@ -0,0 +1,15 @@ +/* PR inline-asm/92352 */ + +void +foo (int x) +{ + int var[x]; + asm volatile ("" : "+r" (var)); /* { dg-error "impossible constraint in 'asm'" } */ +} /* { dg-error "non-memory output 0 must stay in memory" "" { target *-*-* } .-1 } */ + +void +bar (int x) +{ + int var[x]; + asm volatile ("" : "+m" (var)); +} -- 2.30.2