re PR inline-asm/92352 (ICE in force_constant_size)
authorJakub Jelinek <jakub@gcc.gnu.org>
Wed, 6 Nov 2019 08:08:39 +0000 (09:08 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Wed, 6 Nov 2019 08:08:39 +0000 (09:08 +0100)
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
gcc/c-family/ChangeLog
gcc/gimplify.c
gcc/testsuite/ChangeLog
gcc/testsuite/c-c++-common/pr92352.c [new file with mode: 0644]

index e666a0ccf27257b724a7693029316c9642333433..7fee0f37e9bffecf65496a71feaaebf41a8e68c6 100644 (file)
@@ -1,3 +1,9 @@
+2019-11-06  Jakub Jelinek  <jakub@redhat.com>
+
+       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  <msebor@redhat.com>
 
        PR tree-optimization/92373
        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
        * 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.
 
 2019-10-12  John David Anglin  <danglin@gcc.gnu.org>
 
-       * 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  <jakub@redhat.com>
 2019-10-08  Dmitrij Pochepko <dmitrij.pochepko@bell-sw.com>
 
        PR tree-optimization/90836
-       * gcc/match.pd (popcount): New pattern.
+       * match.pd (popcount): New pattern.
 
 2019-10-08  Martin Sebor  <msebor@redhat.com>
 
 2019-09-21  Martin Sebor  <msebor@redhat.com>
 
        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  <iain@sandoe.co.uk>
 
 2019-08-23  Wilco Dijkstra  <wdijkstr@arm.com>
 
-       * 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.
 
 2019-08-13  Wilco Dijkstra  <wdijkstr@arm.com>
 
        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  <richard.sandiford@arm.com>
index 7f402960fc3486e489fa21a47dadf808ee96e91b..1859fddb4bf18ec859d8451d8a2eddd18e4d59f8 100644 (file)
        * c-common.h (enum rid): Add RID_CONSTEVAL.
        * c-common.c (c_common_reswords): Add consteval.
 
+2019-11-01  Martin Sebor  <msebor@redhat.com>
+
+       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  <nathan@acm.org>
 
        * c-cppbuiltin.c (c_cpp_builtins): Add 'L' suffix to feature
index d06b3ce570982008f1eb4c98376637961a4e402c..8feb2464b97daec28c0772d44be764e43717c3db 100644 (file)
@@ -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;
index 6e4820fb86eb575337b1c7b54a098f7ffd6a74cc..a0f52ec2c5cda4ee6a9437e8f79e26be83239b1e 100644 (file)
@@ -1,3 +1,8 @@
+2019-11-06  Jakub Jelinek  <jakub@redhat.com>
+
+       PR inline-asm/92352
+       * c-c++-common/pr92352.c: New test.
+
 2019-11-06  Xiong Hu Luo  <luoxhu@linux.ibm.com>
 
        PR92090
diff --git a/gcc/testsuite/c-c++-common/pr92352.c b/gcc/testsuite/c-c++-common/pr92352.c
new file mode 100644 (file)
index 0000000..d714e9f
--- /dev/null
@@ -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));
+}