aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.dg')
-rw-r--r--gcc/testsuite/gcc.dg/builtin-assume-aligned-1.c10
-rw-r--r--gcc/testsuite/gcc.dg/cpp/escape-3.i2
-rw-r--r--gcc/testsuite/gcc.dg/debug/btf/btf-prune-4.c61
-rw-r--r--gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-btf-decl-tag-4.c28
-rw-r--r--gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-btf-decl-tag-5.c35
-rw-r--r--gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-btf-decl-tag-6.c24
-rw-r--r--gcc/testsuite/gcc.dg/fold-vecperm-1.c4
-rw-r--r--gcc/testsuite/gcc.dg/gnu-compoundlit-1.c26
-rw-r--r--gcc/testsuite/gcc.dg/gnu-compoundlit-2.c20
-rw-r--r--gcc/testsuite/gcc.dg/pointer-counted-by-10.c8
-rw-r--r--gcc/testsuite/gcc.dg/pointer-counted-by-4-void.c6
-rw-r--r--gcc/testsuite/gcc.dg/pointer-counted-by.c3
-rw-r--r--gcc/testsuite/gcc.dg/pr116815.c57
-rw-r--r--gcc/testsuite/gcc.dg/pr41488.c2
-rw-r--r--gcc/testsuite/gcc.dg/pr68090.c7
-rw-r--r--gcc/testsuite/gcc.dg/pr91191.c20
-rw-r--r--gcc/testsuite/gcc.dg/pr97986-1.c27
-rw-r--r--gcc/testsuite/gcc.dg/pr97986-2.c15
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr122497-1.c13
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr122502.c21
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ctz-ch.c23
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ctz-char.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ctz-complement-char.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ctz-complement-int.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ctz-complement-long-long.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ctz-complement-long.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ctz-int.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ctz-long-long.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ctz-long.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr122478.c17
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr92834.c6
-rw-r--r--gcc/testsuite/gcc.dg/vect/slp-reduc-13.c66
-rw-r--r--gcc/testsuite/gcc.dg/vect/slp-widen-mult-half.c1
-rw-r--r--gcc/testsuite/gcc.dg/vect/tree-vect.h2
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-widen-mult-const-s16.c1
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-widen-mult-const-u16.c1
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-widen-mult-half-u8.c1
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-widen-mult-half.c1
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-widen-mult-u16.c1
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-widen-mult-u8-s16-s32.c1
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-widen-mult-u8-u32.c1
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-widen-mult-u8.c1
-rw-r--r--gcc/testsuite/gcc.dg/vla-init-4.c2
-rw-r--r--gcc/testsuite/gcc.dg/vla-init-5.c2
44 files changed, 502 insertions, 30 deletions
diff --git a/gcc/testsuite/gcc.dg/builtin-assume-aligned-1.c b/gcc/testsuite/gcc.dg/builtin-assume-aligned-1.c
index a74ecce..01aa884 100644
--- a/gcc/testsuite/gcc.dg/builtin-assume-aligned-1.c
+++ b/gcc/testsuite/gcc.dg/builtin-assume-aligned-1.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O3 -fdump-tree-optimized" } */
+/* { dg-options "-O3 -fno-tree-vectorize -fdump-tree-optimized-alias" } */
void
test1 (double *out1, double *out2, double *out3, double *in1,
@@ -19,6 +19,8 @@ test1 (double *out1, double *out2, double *out3, double *in1,
}
}
+/* { dg-final { scan-tree-dump-times " ALIGN = 16, MISALIGN = 0" 5 "optimized" } } */
+
void
test2 (double *out1, double *out2, double *out3, double *in1,
double *in2, int len)
@@ -37,4 +39,8 @@ test2 (double *out1, double *out2, double *out3, double *in1,
}
}
-/* { dg-final { scan-tree-dump-not "__builtin_assume_aligned" "optimized" } } */
+
+/* { dg-final { scan-tree-dump-times " ALIGN = 32" 5 "optimized" } } */
+/* { dg-final { scan-tree-dump-times " ALIGN = 32, MISALIGN = 16" 4 "optimized" } } */
+/* { dg-final { scan-tree-dump-times " ALIGN = 32, MISALIGN = 0" 1 "optimized" } } */
+
diff --git a/gcc/testsuite/gcc.dg/cpp/escape-3.i b/gcc/testsuite/gcc.dg/cpp/escape-3.i
index 6eb7dc4..cb47581 100644
--- a/gcc/testsuite/gcc.dg/cpp/escape-3.i
+++ b/gcc/testsuite/gcc.dg/cpp/escape-3.i
@@ -13,4 +13,4 @@ int foo (int a, int b)
}
/* Test for "/some\\directory" instead of "/some\\\\directory" */
-/* { dg-final { scan-assembler { "/some\\\\directory" } } } */
+/* { dg-final { scan-assembler "/some\\\\\\\\directory" } } */
diff --git a/gcc/testsuite/gcc.dg/debug/btf/btf-prune-4.c b/gcc/testsuite/gcc.dg/debug/btf/btf-prune-4.c
new file mode 100644
index 0000000..3f19559
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/btf/btf-prune-4.c
@@ -0,0 +1,61 @@
+/* Test that -gprune-btf does not prune at typedefs. */
+
+/* { dg-do compile } */
+/* { dg-options "-gbtf -gprune-btf -dA" } */
+
+/* We must have the full definitions of td1 and td3. Neither are pruned.
+ td2 will be skipped entirely, only because the only reference to
+ it is through struct inner, which is pruned because inner itself
+ is only used as a pointer member.
+
+ In general, we must never get an anonymous FWD; the only FWD in this
+ case will be for 'inner' */
+
+/* Exactly 1 FWD for inner and no anonymous FWD. */
+/* { dg-final { scan-assembler-times "TYPE \[0-9\]+ BTF_KIND_FWD" 1 } } */
+/* { dg-final { scan-assembler-not "TYPE \[0-9\]+ BTF_KIND_FWD ''" } } */
+/* { dg-final { scan-assembler " BTF_KIND_FWD 'inner'" } } */
+
+/* One anonymous struct for td1 and one anonymous union for td3. */
+/* { dg-final { scan-assembler-times "TYPE \[0-9\]+ BTF_KIND_STRUCT ''" 1 } } */
+/* { dg-final { scan-assembler-times "TYPE \[0-9\]+ BTF_KIND_UNION ''" 1 } } */
+
+/* The two remaining typedefs. */
+/* { dg-final { scan-assembler " BTF_KIND_TYPEDEF 'td1'" } } */
+/* { dg-final { scan-assembler " BTF_KIND_TYPEDEF 'td3'" } } */
+
+typedef struct {
+ int x;
+ char c;
+} td1;
+
+typedef struct {
+ long l;
+ char b[4];
+} td2;
+
+typedef union {
+ long l;
+ unsigned short s[2];
+} td3;
+
+struct inner {
+ char a;
+ td2 *ptd;
+ long z;
+};
+
+struct A {
+ td1 *pt;
+ struct inner *in;
+ unsigned long l[4];
+};
+
+struct A foo;
+
+struct B {
+ int x;
+ td3 **ppptd3;
+};
+
+struct B bar;
diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-btf-decl-tag-4.c b/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-btf-decl-tag-4.c
new file mode 100644
index 0000000..6fdcdc6
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-btf-decl-tag-4.c
@@ -0,0 +1,28 @@
+/* Test DWARF generation for decl_tags on global decls appearing multiple
+ times with different decl_tags. PR122248. */
+/* { dg-do compile } */
+/* { dg-options "-gdwarf -dA" } */
+
+#define __tag1 __attribute__((btf_decl_tag ("tag1")))
+#define __tag2 __attribute__((btf_decl_tag ("tag2")))
+#define __tag3 __attribute__((btf_decl_tag ("tag3")))
+#define __tag4 __attribute__((btf_decl_tag ("tag4")))
+
+int foo __tag1;
+int foo __tag2;
+
+/* Result: foo has __tag1 and __tag2. */
+
+int bar __tag3;
+int bar;
+
+/* Result: bar has __tag3. */
+
+int baz;
+int baz __tag4;
+
+/* Result: baz has __tag4. */
+
+/* { dg-final { scan-assembler-times "DIE \\(\[^\n\]*\\) DW_TAG_GNU_annotation" 4 } } */
+/* { dg-final { scan-assembler-times " DW_AT_GNU_annotation" 4 } } */
+
diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-btf-decl-tag-5.c b/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-btf-decl-tag-5.c
new file mode 100644
index 0000000..c7cb60c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-btf-decl-tag-5.c
@@ -0,0 +1,35 @@
+/* Test DWARF generation for decl_tags on global decls appearing multiple
+ times with different decl_tags. PR122248. */
+/* { dg-do compile } */
+/* { dg-options "-gdwarf -dA" } */
+
+#define __tag1 __attribute__((btf_decl_tag ("tag1")))
+#define __tag2 __attribute__((btf_decl_tag ("tag2")))
+#define __tag3 __attribute__((btf_decl_tag ("tag3")))
+
+struct S
+{
+ int x;
+ char c;
+};
+
+extern struct S foo __tag1;
+struct S foo __tag2;
+
+/* Result: non-completing variable DIE for 'foo' has tag1, and the
+ completing DIE (with AT_specification) for 'foo' has tag2 -> tag1. */
+
+extern int a __tag3;
+int a;
+
+/* Result: non-completing variable DIE for a has tag3, and the
+ completing DIE (with AT_specification) for 'a' also refers to tag3. */
+
+/* { dg-final { scan-assembler-times "DIE \\(\[^\n\]*\\) DW_TAG_GNU_annotation" 3 } } */
+
+/* 5 AT_GNU annotations:
+ - foo -> tag1
+ - foo -> tag2 -> tag1
+ - a -> tag3
+ - a -> tag3 */
+/* { dg-final { scan-assembler-times " DW_AT_GNU_annotation" 5 } } */
diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-btf-decl-tag-6.c b/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-btf-decl-tag-6.c
new file mode 100644
index 0000000..dd89d11
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-btf-decl-tag-6.c
@@ -0,0 +1,24 @@
+/* Test DWARF generation for decl_tags on global decls appearing multiple
+ times with different decl_tags. PR122248. */
+/* { dg-do compile } */
+/* { dg-options "-gdwarf -dA" } */
+
+#define __tag1 __attribute__((btf_decl_tag ("tag1")))
+#define __tag2 __attribute__((btf_decl_tag ("tag2")))
+#define __tag3 __attribute__((btf_decl_tag ("tag3")))
+
+__tag1
+extern int
+do_thing (int);
+
+__tag2
+__tag3
+int
+do_thing (int x)
+{
+ return x * x;
+}
+
+/* Result: do_thing has all 3 tags. */
+/* { dg-final { scan-assembler-times "DIE \\(\[^\n\]*\\) DW_TAG_GNU_annotation" 3 } } */
+/* { dg-final { scan-assembler-times " DW_AT_GNU_annotation" 3 } } */
diff --git a/gcc/testsuite/gcc.dg/fold-vecperm-1.c b/gcc/testsuite/gcc.dg/fold-vecperm-1.c
index 5d4456b..878d392 100644
--- a/gcc/testsuite/gcc.dg/fold-vecperm-1.c
+++ b/gcc/testsuite/gcc.dg/fold-vecperm-1.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-optimized" } */
+/* { dg-options "-O2 -fdump-tree-forwprop3" } */
typedef int v4si __attribute__((vector_size(16)));
typedef short v8hi __attribute__((vector_size(16)));
@@ -20,4 +20,4 @@ int128 concat (int128 a, int128 b) {
return res;
}
-/* { dg-final { scan-tree-dump-times "VEC_PERM_EXPR" 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "VEC_PERM_EXPR" 1 "forwprop3" } } */
diff --git a/gcc/testsuite/gcc.dg/gnu-compoundlit-1.c b/gcc/testsuite/gcc.dg/gnu-compoundlit-1.c
new file mode 100644
index 0000000..a7f3496
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gnu-compoundlit-1.c
@@ -0,0 +1,26 @@
+/* { dg-do compile } */
+/* { dg-options "-std=gnu23" } */
+
+int g(int n, int (*p)[n]);
+int f(int n)
+{
+ return g(n, &(int[n]){ });
+}
+
+void h(int n)
+{
+ (int[n]){ 1 }; /* { dg-error "empty initializer" } */
+}
+
+void i(int n)
+{
+ (static int[3]){ };
+ (static int[n]){ }; /* { dg-error "storage size" } */
+ (constexpr int[3]){ };
+ (constexpr int[n]){ }; /* { dg-error "storage size" } */
+ (register int[3]){ }; /* { dg-error "register" } */
+ (register int[n]){ }; /* { dg-error "register" } */
+ (_Thread_local int[3]){ }; /* { dg-error "_Thread_local" } */
+ (_Thread_local int[n]){ }; /* { dg-error "_Thread_local" } */
+}
+
diff --git a/gcc/testsuite/gcc.dg/gnu-compoundlit-2.c b/gcc/testsuite/gcc.dg/gnu-compoundlit-2.c
new file mode 100644
index 0000000..dcc5775
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gnu-compoundlit-2.c
@@ -0,0 +1,20 @@
+/* { dg-do run } */
+/* { dg-options "-std=gnu23 -Wall" } */
+
+[[gnu::noinline,gnu::noipa]]
+static bool f(int n)
+{
+ struct foo { char a[n]; };
+ struct foo x = { };
+
+ return 0 == __builtin_memcmp(&x, &(struct foo){ }, sizeof x);
+}
+
+int main()
+{
+ if (!f(7))
+ __builtin_abort();
+
+ return 0;
+}
+
diff --git a/gcc/testsuite/gcc.dg/pointer-counted-by-10.c b/gcc/testsuite/gcc.dg/pointer-counted-by-10.c
new file mode 100644
index 0000000..e2bd018
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pointer-counted-by-10.c
@@ -0,0 +1,8 @@
+/* Testing the correct usage of attribute counted_by for pointer to void. */
+/* { dg-do compile } */
+/* { dg-options "-O0 -Wpointer-arith" } */
+
+struct pointer_array {
+ int count;
+ void *array __attribute__ ((counted_by (count))); /* { dg-warning "attribute is used for a pointer to void" } */
+};
diff --git a/gcc/testsuite/gcc.dg/pointer-counted-by-4-void.c b/gcc/testsuite/gcc.dg/pointer-counted-by-4-void.c
new file mode 100644
index 0000000..71bac95
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pointer-counted-by-4-void.c
@@ -0,0 +1,6 @@
+/* Test the attribute counted_by for pointer field and its usage in
+ * __builtin_dynamic_object_size. */
+/* { dg-do run } */
+/* { dg-options "-O2" } */
+#define PTR_TYPE void
+#include "pointer-counted-by-4.c"
diff --git a/gcc/testsuite/gcc.dg/pointer-counted-by.c b/gcc/testsuite/gcc.dg/pointer-counted-by.c
index 0f18828..5e9ebef 100644
--- a/gcc/testsuite/gcc.dg/pointer-counted-by.c
+++ b/gcc/testsuite/gcc.dg/pointer-counted-by.c
@@ -49,9 +49,10 @@ struct pointer_array_6 {
int *array_6 __attribute__ ((counted_by (days)));
};
+/* counted_by is allowed for pointer to void when GNU extension is enabled. */
struct pointer_array_7 {
int count;
- void *array_7 __attribute__ ((counted_by (count))); /* { dg-error "attribute is not allowed for a pointer to void" } */
+ void *array_7 __attribute__ ((counted_by (count)));
};
struct pointer_array_8 {
diff --git a/gcc/testsuite/gcc.dg/pr116815.c b/gcc/testsuite/gcc.dg/pr116815.c
new file mode 100644
index 0000000..b5f1330
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr116815.c
@@ -0,0 +1,57 @@
+/* PR target/116815 */
+/* { dg-do run } */
+/* { dg-options "-O2" } */
+
+[[gnu::always_inline]]
+inline unsigned min (unsigned a, unsigned b)
+{
+ return (a < b) ? a : b;
+}
+
+[[gnu::always_inline]]
+inline unsigned max (unsigned a, unsigned b)
+{
+ return (a > b) ? a : b;
+}
+
+[[gnu::noipa]] unsigned
+umaxadd (unsigned a, unsigned b)
+{
+ return max (a + b, a);
+}
+
+[[gnu::noipa]] unsigned
+umaxsub (unsigned a, unsigned b)
+{
+ return max (a - b, a);
+}
+
+[[gnu::noipa]] unsigned
+uminadd (unsigned a, unsigned b)
+{
+ return min (a + b, a);
+}
+
+[[gnu::noipa]] unsigned
+uminsub (unsigned a, unsigned b)
+{
+ return min (a - b, a);
+}
+
+int
+main ()
+{
+ /* Overflows to 0x30000000. */
+ if (umaxadd (0x90000000, 0xa0000000) != 0x90000000)
+ __builtin_abort ();
+
+ if (uminadd (0x90000000, 0xa0000000) != 0x30000000)
+ __builtin_abort ();
+
+ /* Underflows to 0x60000000. */
+ if (umaxsub (0x00000000, 0xa0000000) != 0x60000000)
+ __builtin_abort ();
+
+ if (uminsub (0x00000000, 0xa0000000) != 0x00000000)
+ __builtin_abort ();
+}
diff --git a/gcc/testsuite/gcc.dg/pr41488.c b/gcc/testsuite/gcc.dg/pr41488.c
index 1e4bf19..a7ba367 100644
--- a/gcc/testsuite/gcc.dg/pr41488.c
+++ b/gcc/testsuite/gcc.dg/pr41488.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-ivcanon-scev" } */
+/* { dg-options "-O2 -fno-tree-scev-cprop -fdump-tree-ivcanon-scev" } */
struct struct_t
{
diff --git a/gcc/testsuite/gcc.dg/pr68090.c b/gcc/testsuite/gcc.dg/pr68090.c
index 87b3b93..84e0ca4 100644
--- a/gcc/testsuite/gcc.dg/pr68090.c
+++ b/gcc/testsuite/gcc.dg/pr68090.c
@@ -1,13 +1,18 @@
/* PR c/68090 */
/* { dg-do compile } */
-/* { dg-options "" } */
+/* { dg-options "--pedantic-error" } */
void
fn (int i)
{
(int[(0, 1)]) { 0 }; /* { dg-error "compound literal has variable size" } */
+ /* { dg-error "variable-size" "" { target *-*-* } .-1 } */
(int[i]) { 0 }; /* { dg-error "compound literal has variable size" } */
+ /* { dg-error "variable-size" "" { target *-*-* } .-1 } */
(int[(0, i)]) { 0 }; /* { dg-error "compound literal has variable size" } */
+ /* { dg-error "variable-size" "" { target *-*-* } .-1 } */
(int [][i]){ 0 }; /* { dg-error "compound literal has variable size" } */
+ /* { dg-error "variable-size" "" { target *-*-* } .-1 } */
(int [][(1, 2)]){ 0 }; /* { dg-error "compound literal has variable size" } */
+ /* { dg-error "variable-size" "" { target *-*-* } .-1 } */
}
diff --git a/gcc/testsuite/gcc.dg/pr91191.c b/gcc/testsuite/gcc.dg/pr91191.c
new file mode 100644
index 0000000..7bf727e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr91191.c
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-evrp" } */
+
+unsigned char reg(_Bool b) {
+ union U {
+ unsigned char f0;
+ _Bool f1;
+ };
+ union U u;
+ u.f1 = b;
+ if (u.f0 > 1) {
+ // This cannot happen
+ // if b is only allowed
+ // to be 0 or 1:
+ return 42;
+ }
+ return 13;
+}
+
+/* { dg-final { scan-tree-dump "return 13" "evrp" } } */
diff --git a/gcc/testsuite/gcc.dg/pr97986-1.c b/gcc/testsuite/gcc.dg/pr97986-1.c
new file mode 100644
index 0000000..87ee3d8
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr97986-1.c
@@ -0,0 +1,27 @@
+/* { dg-do run } */
+/* { dg-options "-std=gnu23" } */
+
+#include <stdarg.h>
+
+int f(int n, ...)
+{
+ __label__ b, d;
+ va_list ap;
+ va_start(ap, n);
+ _Static_assert(5 == sizeof(va_arg(ap, char[5]))); /* { dg-warning "array type" } */
+ void g(void) { n++; goto b; }
+ int *a = va_arg((g(), ap), int[n]); /* { dg-warning "array type" } */
+b:
+ void h(void) { n++; goto d; }
+ typeof(va_arg(ap, int[(h(), n)])) c; /* { dg-warning "array type" } */
+d:
+ return n;
+}
+
+int main()
+{
+ if (9 != f(7))
+ __builtin_abort();
+ return 0;
+}
+
diff --git a/gcc/testsuite/gcc.dg/pr97986-2.c b/gcc/testsuite/gcc.dg/pr97986-2.c
new file mode 100644
index 0000000..fc23a57
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr97986-2.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-options "-std=c90" } */
+
+#include <stdarg.h>
+
+
+int f(int n, ...)
+{
+ va_list ap;
+ va_start(ap, n);
+ _Static_assert(5 == sizeof(va_arg(ap, char[5])));
+ va_arg(ap, int[n]); /* { dg-error "array type" } */
+ int * a = va_arg(ap, int[3]); /* { dg-error "invalid use of non-lvalue array" } */
+}
+
diff --git a/gcc/testsuite/gcc.dg/torture/pr122497-1.c b/gcc/testsuite/gcc.dg/torture/pr122497-1.c
new file mode 100644
index 0000000..8b027ca
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr122497-1.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* PR tree-optimization/122497 */
+
+/* This was ICEing during SCCP
+ trying to simplify a reference back to the phi
+ which was removed. */
+
+char g_2[1][2];
+int g_4, g_5;
+void main() {
+ for (; g_4; g_4 -= 1)
+ g_5 = g_2[g_4 + 2][g_4];
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr122502.c b/gcc/testsuite/gcc.dg/torture/pr122502.c
new file mode 100644
index 0000000..5e2cb2e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr122502.c
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+
+short int *ts;
+
+void
+c2 (unsigned long long int s4, int ns)
+{
+ short int *b2 = (short int *)&ns;
+
+ while (ns != 0)
+ {
+ int xn;
+
+ for (xn = 0; xn < 3; ++xn)
+ for (*b2 = 0; *b2 < 2; ++*b2)
+ s4 += xn;
+ if (s4 != 0)
+ b2 = ts;
+ ++ns;
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ctz-ch.c b/gcc/testsuite/gcc.dg/tree-ssa/ctz-ch.c
new file mode 100644
index 0000000..5d72597
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ctz-ch.c
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+
+typedef unsigned long BITMAP_WORD;
+
+bool
+bmp_iter_set (BITMAP_WORD bits, unsigned *bit_no)
+{
+ /* If our current word is nonzero, it contains the bit we want. */
+ if (bits)
+ {
+ while (!(bits & 1))
+ {
+ bits >>= 1;
+ *bit_no += 1;
+ }
+ return true;
+ }
+
+ return false;
+}
+
+/* { dg-final { scan-tree-dump-times "__builtin_ctz|\\.CTZ" 1 "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ctz-char.c b/gcc/testsuite/gcc.dg/tree-ssa/ctz-char.c
index 3cd166a..fa8b7f3 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ctz-char.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ctz-char.c
@@ -1,6 +1,6 @@
/* { dg-do run } */
/* { dg-require-effective-target ctz } */
-/* { dg-options "-O2 -fno-tree-ch -fdump-tree-optimized" } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
#define PREC (__CHAR_BIT__)
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ctz-complement-char.c b/gcc/testsuite/gcc.dg/tree-ssa/ctz-complement-char.c
index b9afe88..5ebc321 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ctz-complement-char.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ctz-complement-char.c
@@ -1,6 +1,6 @@
/* { dg-do run } */
/* { dg-require-effective-target ctz } */
-/* { dg-options "-O2 -fdump-tree-optimized" } */
+/* { dg-options "-O2 -fno-tree-ch -fdump-tree-optimized" } */
#define PREC (__CHAR_BIT__)
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ctz-complement-int.c b/gcc/testsuite/gcc.dg/tree-ssa/ctz-complement-int.c
index d2702a6..0ce4b6b 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ctz-complement-int.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ctz-complement-int.c
@@ -1,6 +1,6 @@
/* { dg-do run } */
/* { dg-require-effective-target ctz } */
-/* { dg-options "-O2 -fdump-tree-optimized" } */
+/* { dg-options "-O2 -fno-tree-ch -fdump-tree-optimized" } */
#define PREC (__CHAR_BIT__ * __SIZEOF_INT__)
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ctz-complement-long-long.c b/gcc/testsuite/gcc.dg/tree-ssa/ctz-complement-long-long.c
index 1ea0d5d..f98bec0 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ctz-complement-long-long.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ctz-complement-long-long.c
@@ -1,6 +1,6 @@
/* { dg-do run } */
/* { dg-require-effective-target ctzll } */
-/* { dg-options "-O2 -fdump-tree-optimized" } */
+/* { dg-options "-O2 -fno-tree-ch -fdump-tree-optimized" } */
#define PREC (__CHAR_BIT__ * __SIZEOF_LONG_LONG__)
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ctz-complement-long.c b/gcc/testsuite/gcc.dg/tree-ssa/ctz-complement-long.c
index 80fb02d..8edb372 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ctz-complement-long.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ctz-complement-long.c
@@ -1,6 +1,6 @@
/* { dg-do run } */
/* { dg-require-effective-target ctzl } */
-/* { dg-options "-O2 -fdump-tree-optimized" } */
+/* { dg-options "-O2 -fno-tree-ch -fdump-tree-optimized" } */
#define PREC (__CHAR_BIT__ * __SIZEOF_LONG__)
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ctz-int.c b/gcc/testsuite/gcc.dg/tree-ssa/ctz-int.c
index 7f63493..2bf3ae6 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ctz-int.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ctz-int.c
@@ -1,6 +1,6 @@
/* { dg-do run } */
/* { dg-require-effective-target ctz } */
-/* { dg-options "-O2 -fno-tree-ch -fdump-tree-optimized" } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
#define PREC (__CHAR_BIT__ * __SIZEOF_INT__)
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ctz-long-long.c b/gcc/testsuite/gcc.dg/tree-ssa/ctz-long-long.c
index 924f61b..2e15948 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ctz-long-long.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ctz-long-long.c
@@ -1,6 +1,6 @@
/* { dg-do run } */
/* { dg-require-effective-target ctzll } */
-/* { dg-options "-O2 -fno-tree-ch -fdump-tree-optimized" } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
#define PREC (__CHAR_BIT__ * __SIZEOF_LONG_LONG__)
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ctz-long.c b/gcc/testsuite/gcc.dg/tree-ssa/ctz-long.c
index 178945d..2e3be65 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ctz-long.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ctz-long.c
@@ -1,6 +1,6 @@
/* { dg-do run } */
/* { dg-require-effective-target ctzl } */
-/* { dg-options "-O2 -fno-tree-ch -fdump-tree-optimized" } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
#define PREC (__CHAR_BIT__ * __SIZEOF_LONG__)
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr122478.c b/gcc/testsuite/gcc.dg/tree-ssa/pr122478.c
new file mode 100644
index 0000000..a39c91b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr122478.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+/* { dg-additional-options "-fgimple" } */
+
+unsigned char __GIMPLE (ssa)
+foo (unsigned short mask__701)
+{
+ _Bool _19;
+ unsigned char _180;
+
+__BB(2):
+ _19 = __BIT_FIELD_REF <_Bool> (mask__701, 1, 12);
+ _180 = __VIEW_CONVERT<unsigned char>(_19);
+ return _180;
+}
+
+/* { dg-final { scan-tree-dump-times "VIEW_CONVERT_EXPR" 1 "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr92834.c b/gcc/testsuite/gcc.dg/tree-ssa/pr92834.c
index 889048d..70acf74 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/pr92834.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr92834.c
@@ -1,8 +1,8 @@
/* PR tree-optimization/92834 */
/* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-optimized" } */
-/* { dg-final { scan-tree-dump-times "MIN_EXPR <" 8 "optimized" } } */
-/* { dg-final { scan-tree-dump-times "MAX_EXPR <" 8 "optimized" } } */
+/* { dg-options "-O2 -fdump-tree-phiopt1" } */
+/* { dg-final { scan-tree-dump-times "MIN_EXPR <" 16 "phiopt1" } } */
+/* { dg-final { scan-tree-dump-times "MAX_EXPR <" 16 "phiopt1" } } */
static inline unsigned
umax1 (unsigned a, unsigned b)
diff --git a/gcc/testsuite/gcc.dg/vect/slp-reduc-13.c b/gcc/testsuite/gcc.dg/vect/slp-reduc-13.c
new file mode 100644
index 0000000..00e91fc
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/slp-reduc-13.c
@@ -0,0 +1,66 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target vect_int } */
+/* { dg-additional-options "-fgimple" } */
+
+int q[2];
+
+void __GIMPLE (ssa,guessed_local(16535624),startwith("loop"))
+foo (int * r)
+{
+ int i;
+ int sum2;
+ int sum1;
+ int _1;
+ long unsigned int _2;
+ long unsigned int _3;
+ int * _4;
+ int _24;
+ __SIZETYPE__ _6;
+ __SIZETYPE__ _7;
+ int * _8;
+ int _9;
+ int _13;
+ unsigned int _30;
+ unsigned int _31;
+
+ __BB(2,guessed_local(16535624)):
+ goto __BB3(precise(134217728));
+
+ __BB(3,loop_header(1),guessed_local(1057206200)):
+ sum1_5 = __PHI (__BB5: sum1_18, __BB2: 0);
+ sum2_26 = __PHI (__BB5: sum2_19, __BB2: 0);
+ i_28 = __PHI (__BB5: i_20, __BB2: 0);
+ _31 = __PHI (__BB5: _30, __BB2: 64u);
+ _1 = i_28 * 2;
+ _2 = (long unsigned int) _1;
+ _3 = _2 * 4ul;
+ _4 = r_17(D) + _3;
+ _24 = __MEM <int> (_4);
+ /* Deliberately have swapped operands here */
+ sum1_18 = sum1_5 + _24;
+ _13 = _1 + 1;
+ _6 = (__SIZETYPE__) _13;
+ _7 = _6 * 4ul;
+ _8 = r_17(D) + _7;
+ _9 = __MEM <int> (_8);
+ /* versus here. */
+ sum2_19 = _9 + sum2_26;
+ i_20 = i_28 + 1;
+ _30 = _31 - 1u;
+ if (_30 != 0u)
+ goto __BB5(guessed(132118446));
+ else
+ goto __BB4(guessed(2099282));
+
+ __BB(5,guessed_local(1040670576)):
+ goto __BB3(precise(134217728));
+
+ __BB(4,guessed_local(16535624)):
+ sum1_33 = __PHI (__BB3: sum1_18);
+ sum2_32 = __PHI (__BB3: sum2_19);
+ q[0] = sum1_33;
+ q[1] = sum2_32;
+ return;
+}
+
+/* { dg-final { scan-tree-dump "SLP discovery of size 2 reduction group succeeded" "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/slp-widen-mult-half.c b/gcc/testsuite/gcc.dg/vect/slp-widen-mult-half.c
index b69ade3..72811eb 100644
--- a/gcc/testsuite/gcc.dg/vect/slp-widen-mult-half.c
+++ b/gcc/testsuite/gcc.dg/vect/slp-widen-mult-half.c
@@ -1,7 +1,6 @@
/* Disabling epilogues until we find a better way to deal with scans. */
/* { dg-additional-options "--param vect-epilogues-nomask=0" } */
/* { dg-require-effective-target vect_int } */
-/* { dg-additional-options "-mlasx" { target loongarch*-*-* } } */
#include "tree-vect.h"
diff --git a/gcc/testsuite/gcc.dg/vect/tree-vect.h b/gcc/testsuite/gcc.dg/vect/tree-vect.h
index 1e4b56e..37908c9 100644
--- a/gcc/testsuite/gcc.dg/vect/tree-vect.h
+++ b/gcc/testsuite/gcc.dg/vect/tree-vect.h
@@ -76,6 +76,8 @@ check_vect (void)
}
#elif defined(__mips_msa)
asm volatile ("or.v $w0,$w0,$w0");
+#elif defined(__loongarch__)
+ asm volatile ("vor.v\t$vr0,$vr0,$vr0");
#endif
signal (SIGILL, SIG_DFL);
}
diff --git a/gcc/testsuite/gcc.dg/vect/vect-widen-mult-const-s16.c b/gcc/testsuite/gcc.dg/vect/vect-widen-mult-const-s16.c
index 53c9b84..dfbb217 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-widen-mult-const-s16.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-widen-mult-const-s16.c
@@ -2,7 +2,6 @@
/* { dg-additional-options "--param vect-epilogues-nomask=0" } */
/* { dg-require-effective-target vect_int } */
/* { dg-additional-options "-fno-ipa-icf" } */
-/* { dg-additional-options "-mlasx" { target loongarch*-*-*} } */
#include "tree-vect.h"
diff --git a/gcc/testsuite/gcc.dg/vect/vect-widen-mult-const-u16.c b/gcc/testsuite/gcc.dg/vect/vect-widen-mult-const-u16.c
index e9db828..c2ad58f 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-widen-mult-const-u16.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-widen-mult-const-u16.c
@@ -2,7 +2,6 @@
/* { dg-additional-options "--param vect-epilogues-nomask=0" } */
/* { dg-require-effective-target vect_int } */
/* { dg-additional-options "-fno-ipa-icf" } */
-/* { dg-additional-options "-mlasx" { target loongarch*-*-*} } */
#include "tree-vect.h"
diff --git a/gcc/testsuite/gcc.dg/vect/vect-widen-mult-half-u8.c b/gcc/testsuite/gcc.dg/vect/vect-widen-mult-half-u8.c
index 607f317..bfdcbaa 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-widen-mult-half-u8.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-widen-mult-half-u8.c
@@ -2,7 +2,6 @@
/* { dg-additional-options "--param vect-epilogues-nomask=0" } */
/* { dg-require-effective-target vect_int } */
/* { dg-additional-options "-fno-ipa-icf" } */
-/* { dg-additional-options "-mlasx" { target loongarch*-*-*} } */
#include "tree-vect.h"
diff --git a/gcc/testsuite/gcc.dg/vect/vect-widen-mult-half.c b/gcc/testsuite/gcc.dg/vect/vect-widen-mult-half.c
index cd13d82..e46b0cc 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-widen-mult-half.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-widen-mult-half.c
@@ -1,7 +1,6 @@
/* Disabling epilogues until we find a better way to deal with scans. */
/* { dg-additional-options "--param vect-epilogues-nomask=0" } */
/* { dg-require-effective-target vect_int } */
-/* { dg-additional-options "-mlasx" { target loongarch*-*-*} } */
#include "tree-vect.h"
diff --git a/gcc/testsuite/gcc.dg/vect/vect-widen-mult-u16.c b/gcc/testsuite/gcc.dg/vect/vect-widen-mult-u16.c
index 258d253..14411ef 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-widen-mult-u16.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-widen-mult-u16.c
@@ -1,7 +1,6 @@
/* Disabling epilogues until we find a better way to deal with scans. */
/* { dg-additional-options "--param vect-epilogues-nomask=0" } */
/* { dg-require-effective-target vect_int } */
-/* { dg-additional-options "-mlasx" { target loongarch*-*-*} } */
#include <stdarg.h>
#include "tree-vect.h"
diff --git a/gcc/testsuite/gcc.dg/vect/vect-widen-mult-u8-s16-s32.c b/gcc/testsuite/gcc.dg/vect/vect-widen-mult-u8-s16-s32.c
index 3baafca..f40def5 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-widen-mult-u8-s16-s32.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-widen-mult-u8-s16-s32.c
@@ -1,7 +1,6 @@
/* Disabling epilogues until we find a better way to deal with scans. */
/* { dg-additional-options "--param vect-epilogues-nomask=0" } */
/* { dg-require-effective-target vect_int } */
-/* { dg-additional-options "-mlasx" { target loongarch*-*-*} } */
#include <stdarg.h>
#include "tree-vect.h"
diff --git a/gcc/testsuite/gcc.dg/vect/vect-widen-mult-u8-u32.c b/gcc/testsuite/gcc.dg/vect/vect-widen-mult-u8-u32.c
index bcfbe19..6386639 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-widen-mult-u8-u32.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-widen-mult-u8-u32.c
@@ -1,6 +1,5 @@
/* { dg-additional-options "--param vect-epilogues-nomask=0" } */
/* { dg-require-effective-target vect_int } */
-/* { dg-additional-options "-mlasx" { target loongarch*-*-* } } */
#include <stdarg.h>
#include "tree-vect.h"
diff --git a/gcc/testsuite/gcc.dg/vect/vect-widen-mult-u8.c b/gcc/testsuite/gcc.dg/vect/vect-widen-mult-u8.c
index e3bf13b..78ad74b 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-widen-mult-u8.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-widen-mult-u8.c
@@ -1,6 +1,5 @@
/* { dg-additional-options "--param vect-epilogues-nomask=0" } */
/* { dg-require-effective-target vect_int } */
-/* { dg-additional-options "-mlasx" { target loongarch*-*-*} } */
#include <stdarg.h>
#include "tree-vect.h"
diff --git a/gcc/testsuite/gcc.dg/vla-init-4.c b/gcc/testsuite/gcc.dg/vla-init-4.c
index 06351d0..7d1aa5b 100644
--- a/gcc/testsuite/gcc.dg/vla-init-4.c
+++ b/gcc/testsuite/gcc.dg/vla-init-4.c
@@ -4,4 +4,4 @@
/* { dg-options "" } */
const int i = 1;
-void foo() { char *p = (char [i]){ "" }; } /* { dg-error "compound literal has variable size" } */
+void foo() { char *p = (char [i]){ "" }; } /* { dg-error "variable-sized object" } */
diff --git a/gcc/testsuite/gcc.dg/vla-init-5.c b/gcc/testsuite/gcc.dg/vla-init-5.c
index aa9f491..2c249ec 100644
--- a/gcc/testsuite/gcc.dg/vla-init-5.c
+++ b/gcc/testsuite/gcc.dg/vla-init-5.c
@@ -4,4 +4,4 @@
/* { dg-options "" } */
const int i = 1;
-void foo() { void *p = (char [][i]){ "" }; } /* { dg-error "compound literal has variable size" } */
+void foo() { void *p = (char [][i]){ "" }; } /* { dg-error "variable-sized object" } */