--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-O2 -fnon-call-exceptions -fdump-tree-optimized" } */
+
+/* PR tree-optimization/117234 */
+/* PAREN_EXPR should not be declared as trapping. */
+
+float f1(float a)
+{
+ try {
+ return __builtin_assoc_barrier (a);
+ } catch(...)
+ { __builtin_trap (); }
+}
+
+/* { dg-final { scan-tree-dump-not "__builtin_trap" "optimized" } } */
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-O2 -fnon-call-exceptions -fdump-tree-optimized" } */
+
+/* PR tree-optimization/117234 */
+/* VEC_DUPLICATE_EXPR should not be declared as trapping. */
+#include <arm_sve.h>
+
+svfloat32_t f(float a)
+{
+ try {
+ return svdup_f32(a);
+ } catch(...)
+ { __builtin_trap (); }
+}
+
+/* { dg-final { scan-tree-dump-not "__builtin_trap" "optimized" } } */
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-lim-details" } */
+
+/* PR tree-optimization/117234 */
+/* PAREN_EXPR should not be declared as
+ a trapping. */
+
+float f1(float a, int t, _Bool *b, float c)
+{
+ float tt = 0;
+ for (int i = 0; i < t; i++)
+ {
+ if (b[i])
+ tt *= -__builtin_assoc_barrier (-a);
+ }
+ return tt;
+}
+
+/* There should be 3 `invariant up to level`, two for each `-` and one
+ for the PAREN_EXPR. */
+/* { dg-final { scan-tree-dump-times "invariant up to level" 3 "lim2" } } */
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-lim-details" } */
+
+/* PR tree-optimization/117234 */
+/* VEC_DUPLICATE_EXPR should not be declared as
+ a trapping. */
+#include <arm_sve.h>
+
+svfloat32_t f(float a, int t, _Bool *b)
+{
+ svfloat32_t tt = svdup_f32(0.0);
+ for (int i =0 ;i < t; i++)
+ {
+ if (b[i])
+ tt = svadd_f32_z(svptrue_b32(),tt,svdup_f32(a));
+ }
+ return tt;
+}
+
+/* There should be 1 `invariant up to level`, one for the VEC_DUPLICATE_EXPR. */
+/* { dg-final { scan-tree-dump-times "invariant up to level" 1 "lim2" } } */
case COMPLEX_EXPR:
case CONSTRUCTOR:
+ case VEC_DUPLICATE_EXPR:
+ case PAREN_EXPR:
/* Constructing an object cannot trap. */
return false;