aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite')
-rw-r--r--gcc/testsuite/ChangeLog114
-rw-r--r--gcc/testsuite/c-c++-common/analyzer/data-model-path-1.c2
-rw-r--r--gcc/testsuite/c-c++-common/analyzer/null-deref-pr108251-smp_fetch_ssl_fc_has_early.c4
-rw-r--r--gcc/testsuite/c-c++-common/analyzer/null-deref-pr108400-SoftEtherVPN-WebUi.c2
-rw-r--r--gcc/testsuite/c-c++-common/analyzer/sprintf-3.c44
-rw-r--r--gcc/testsuite/g++.dg/modules/dguide-7_a.C9
-rw-r--r--gcc/testsuite/g++.dg/modules/dguide-7_b.C10
-rw-r--r--gcc/testsuite/g++.dg/modules/dguide-7_c.C12
-rw-r--r--gcc/testsuite/g++.dg/modules/internal-13.C33
-rw-r--r--gcc/testsuite/g++.dg/modules/tpl-nttp-2_a.H14
-rw-r--r--gcc/testsuite/g++.dg/modules/tpl-nttp-2_b.C10
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/data-model-5.c2
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/data-model-5b.c2
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/data-model-5c.c2
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/torture/pr93647.c2
-rw-r--r--gcc/testsuite/gcc.target/aarch64/pr115258.c2
16 files changed, 255 insertions, 9 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index b196daf..aa5d296 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,117 @@
+2025-04-30 Nathaniel Shead <nathanieloshead@gmail.com>
+
+ PR c++/120023
+ * g++.dg/modules/dguide-7_a.C: New test.
+ * g++.dg/modules/dguide-7_b.C: New test.
+ * g++.dg/modules/dguide-7_c.C: New test.
+
+2025-04-30 Nathaniel Shead <nathanieloshead@gmail.com>
+
+ PR c++/119938
+ * g++.dg/modules/tpl-nttp-2_a.H: New test.
+ * g++.dg/modules/tpl-nttp-2_b.C: New test.
+
+2025-04-30 Nathaniel Shead <nathanieloshead@gmail.com>
+
+ PR c++/119551
+ PR c++/119996
+ * g++.dg/modules/internal-13.C: New test.
+
+2025-04-30 David Malcolm <dmalcolm@redhat.com>
+
+ PR analyzer/107017
+ * c-c++-common/analyzer/sprintf-3.c: New test, covering use of
+ sprintf with specific format strings. Doesn't yet find problems
+ as the analyzer doesn't yet understand the format strings.
+
+2025-04-30 David Malcolm <dmalcolm@redhat.com>
+
+ * c-c++-common/analyzer/data-model-path-1.c: Check for
+ "using NULL here" message.
+ * c-c++-common/analyzer/null-deref-pr108251-smp_fetch_ssl_fc_has_early.c:
+ Likewise. Check for "return of NULL" message.
+ * c-c++-common/analyzer/null-deref-pr108400-SoftEtherVPN-WebUi.c:
+ Likewise.
+ * gcc.dg/analyzer/data-model-5.c: Likewise.
+ * gcc.dg/analyzer/data-model-5b.c: Likewise.
+ * gcc.dg/analyzer/data-model-5c.c: Likewise.
+ * gcc.dg/analyzer/torture/pr93647.c: Likewise.
+
+2025-04-30 Richard Sandiford <richard.sandiford@arm.com>
+
+ * gcc.target/aarch64/pr115258.c: Add -mcmodel=small.
+
+2025-04-30 Patrick Palka <ppalka@redhat.com>
+
+ PR c++/119981
+ PR c++/119378
+ * g++.dg/cpp2a/lambda-targ15.C: New test.
+
+2025-04-30 Richard Biener <rguenther@suse.de>
+
+ Revert:
+ 2025-04-30 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/119960
+ * gcc.dg/vect/bb-slp-pr119960-1.c: New testcase.
+
+2025-04-30 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/119960
+ * gcc.dg/vect/bb-slp-pr119960-1.c: New testcase.
+
+2025-04-30 Richard Biener <rguenther@suse.de>
+
+ PR ipa/120006
+ * gcc.dg/torture/pr120006.c: New testcase.
+
+2025-04-30 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/120003
+ * gcc.dg/tree-ssa/ssa-thread-23.c: New testcase.
+ * gcc.dg/tree-ssa/ssa-dom-thread-7.c: Adjust.
+
+2025-04-30 Georg-Johann Lay <avr@gjlay.de>
+
+ Backported from master:
+ 2025-04-30 Georg-Johann Lay <avr@gjlay.de>
+
+ * gcc.target/avr/torture/pr119989.h: New file.
+ * gcc.target/avr/torture/pr119989-memx-1.c: New test.
+ * gcc.target/avr/torture/pr119989-memx-2.c: New test.
+ * gcc.target/avr/torture/pr119989-memx-3.c: New test.
+ * gcc.target/avr/torture/pr119989-memx-4.c: New test.
+ * gcc.target/avr/torture/pr119989-flashx-1.c: New test.
+ * gcc.target/avr/torture/pr119989-flashx-2.c: New test.
+ * gcc.target/avr/torture/pr119989-flashx-3.c: New test.
+ * gcc.target/avr/torture/pr119989-flashx-4.c: New test.
+
+2025-04-30 Kito Cheng <kito.cheng@sifive.com>
+
+ PR target/119832
+ * g++.target/riscv/pr119832.C: New test.
+
+2025-04-30 Jerry Zhang Jian <jerry.zhangjian@sifive.com>
+
+ * gcc.target/riscv/predef-19.c: set the march to rv64im_zve32x
+ instead of rv64gc_zve32x to avoid Zicsr implied by g. Extra m is
+ added to avoid current 'V' extension requires 'M' extension
+
+2025-04-30 Jennifer Schmitz <jschmitz@nvidia.com>
+
+ * gcc.target/aarch64/sve/ldst_ptrue_128_to_neon.c: New test.
+ * gcc.target/aarch64/sve/cond_arith_6.c: Adjust expected outcome.
+ * gcc.target/aarch64/sve/pcs/return_4_128.c: Likewise.
+ * gcc.target/aarch64/sve/pcs/return_5_128.c: Likewise.
+ * gcc.target/aarch64/sve/pcs/struct_3_128.c: Likewise.
+
+2025-04-30 yulong <shiyulong@iscas.ac.cn>
+
+ * gcc.target/riscv/rvv/xsfvector/sf_vc_f.c: New test.
+ * gcc.target/riscv/rvv/xsfvector/sf_vc_i.c: New test.
+ * gcc.target/riscv/rvv/xsfvector/sf_vc_v.c: New test.
+ * gcc.target/riscv/rvv/xsfvector/sf_vc_x.c: New test.
+
2025-04-29 Pengfei Li <Pengfei.Li2@arm.com>
* gcc.target/aarch64/simd/bic_orn_1.c: New file.
diff --git a/gcc/testsuite/c-c++-common/analyzer/data-model-path-1.c b/gcc/testsuite/c-c++-common/analyzer/data-model-path-1.c
index d7058ea..0609dc8 100644
--- a/gcc/testsuite/c-c++-common/analyzer/data-model-path-1.c
+++ b/gcc/testsuite/c-c++-common/analyzer/data-model-path-1.c
@@ -3,7 +3,7 @@
static int *__attribute__((noinline))
callee (void)
{
- return NULL;
+ return NULL; /* { dg-message "using NULL here" } */
}
void test_1 (void)
diff --git a/gcc/testsuite/c-c++-common/analyzer/null-deref-pr108251-smp_fetch_ssl_fc_has_early.c b/gcc/testsuite/c-c++-common/analyzer/null-deref-pr108251-smp_fetch_ssl_fc_has_early.c
index c5f1fa4..4f04e46 100644
--- a/gcc/testsuite/c-c++-common/analyzer/null-deref-pr108251-smp_fetch_ssl_fc_has_early.c
+++ b/gcc/testsuite/c-c++-common/analyzer/null-deref-pr108251-smp_fetch_ssl_fc_has_early.c
@@ -66,7 +66,7 @@ static inline struct connection *__objt_conn(enum obj_type *t)
static inline struct connection *objt_conn(enum obj_type *t)
{
if (!t || *t != OBJ_TYPE_CONN)
- return (struct connection *) ((void *)0);
+ return (struct connection *) ((void *)0); /* { dg-message "using NULL here" } */
return __objt_conn(t);
}
struct session {
@@ -85,7 +85,7 @@ smp_fetch_ssl_fc_has_early(const struct arg *args, struct sample *smp, const cha
SSL *ssl;
struct connection *conn;
- conn = objt_conn(smp->sess->origin);
+ conn = objt_conn(smp->sess->origin); /* { dg-message "return of NULL" } */
ssl = ssl_sock_get_ssl_object(conn);
if (!ssl)
return 0;
diff --git a/gcc/testsuite/c-c++-common/analyzer/null-deref-pr108400-SoftEtherVPN-WebUi.c b/gcc/testsuite/c-c++-common/analyzer/null-deref-pr108400-SoftEtherVPN-WebUi.c
index 9dcf7aa..0ebeeff 100644
--- a/gcc/testsuite/c-c++-common/analyzer/null-deref-pr108400-SoftEtherVPN-WebUi.c
+++ b/gcc/testsuite/c-c++-common/analyzer/null-deref-pr108400-SoftEtherVPN-WebUi.c
@@ -60,7 +60,7 @@ void WuExpireSessionKey(WEBUI *wu)
for(i=0; i<LIST_NUM(wu->Contexts); i++)
{
- STRMAP_ENTRY *entry = (STRMAP_ENTRY*)LIST_DATA(wu->Contexts, i);
+ STRMAP_ENTRY *entry = (STRMAP_ENTRY*)LIST_DATA(wu->Contexts, i); /* { dg-message "'entry' is NULL" } */
WU_CONTEXT *context = (WU_CONTEXT*)entry->Value; /* { dg-bogus "dereference of NULL 'entry'" "PR analyzer/108400" { xfail *-*-* } } */
if(context->ExpireDate < Tick64())
{
diff --git a/gcc/testsuite/c-c++-common/analyzer/sprintf-3.c b/gcc/testsuite/c-c++-common/analyzer/sprintf-3.c
new file mode 100644
index 0000000..ac5169e
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/analyzer/sprintf-3.c
@@ -0,0 +1,44 @@
+/* See e.g. https://en.cppreference.com/w/c/io/fprintf
+ and https://www.man7.org/linux/man-pages/man3/sprintf.3.html */
+
+extern int
+sprintf(char* dst, const char* fmt, ...)
+ __attribute__((__nothrow__));
+
+#include "../../gcc.dg/analyzer/analyzer-decls.h"
+
+void test_text_ok (void)
+{
+ char buf[16];
+ sprintf (buf, "hello world");
+}
+
+void test_text_oob (void)
+{
+ char buf[3];
+ sprintf (buf, "hello world"); /* { dg-warning "out-of-bounds" "PR analyzer/107017" { xfail *-*-* } } */
+}
+
+void test_percent_s_ok (void)
+{
+ char buf[16];
+ sprintf (buf, "%s", "foo");
+}
+
+void test_percent_s_oob (void)
+{
+ char buf[3];
+ sprintf (buf, "%s", "foo"); /* { dg-warning "out-of-bounds" "PR analyzer/107017" { xfail *-*-* } } */
+}
+
+void test_percent_i_ok (void)
+{
+ char buf[16];
+ sprintf (buf, "%i", "42");
+}
+
+void test_percent_i_oob (void)
+{
+ char buf[4];
+ sprintf (buf, "%i", "1066"); /* { dg-warning "out-of-bounds" "PR analyzer/107017" { xfail *-*-* } } */
+}
diff --git a/gcc/testsuite/g++.dg/modules/dguide-7_a.C b/gcc/testsuite/g++.dg/modules/dguide-7_a.C
new file mode 100644
index 0000000..8d0eb80
--- /dev/null
+++ b/gcc/testsuite/g++.dg/modules/dguide-7_a.C
@@ -0,0 +1,9 @@
+// PR c++/120023
+// { dg-additional-options "-fmodules" }
+// { dg-module-cmi M.S }
+
+export module M.S;
+
+namespace ns {
+ export template <typename T> struct S;
+}
diff --git a/gcc/testsuite/g++.dg/modules/dguide-7_b.C b/gcc/testsuite/g++.dg/modules/dguide-7_b.C
new file mode 100644
index 0000000..85246b2
--- /dev/null
+++ b/gcc/testsuite/g++.dg/modules/dguide-7_b.C
@@ -0,0 +1,10 @@
+// PR c++/120023
+// { dg-additional-options "-fmodules" }
+// { dg-module-cmi M.D }
+
+export module M.D;
+import M.S;
+
+namespace ns {
+ S(int) -> S<int>;
+}
diff --git a/gcc/testsuite/g++.dg/modules/dguide-7_c.C b/gcc/testsuite/g++.dg/modules/dguide-7_c.C
new file mode 100644
index 0000000..9579d9d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/modules/dguide-7_c.C
@@ -0,0 +1,12 @@
+// PR c++/120023
+// { dg-additional-options "-fmodules" }
+
+import M.S;
+import M.D;
+
+template <> struct ns::S<int> { S(int) {} };
+
+int main() {
+ ns::S s(123);
+ ns::S<int> s2 = s;
+}
diff --git a/gcc/testsuite/g++.dg/modules/internal-13.C b/gcc/testsuite/g++.dg/modules/internal-13.C
new file mode 100644
index 0000000..ce1454e
--- /dev/null
+++ b/gcc/testsuite/g++.dg/modules/internal-13.C
@@ -0,0 +1,33 @@
+// PR c++/119996
+// { dg-additional-options "-fmodules" }
+// { dg-module-cmi !M }
+// Similar to internal-11.C, but for potentially-constant variables.
+
+export module M;
+
+static int tu_local = 5;
+static int& foo() { return tu_local; }
+
+// For implementation reasons, we adjust [basic.link] p14.2 to restrict ignored
+// exposures to non-inline variables, since for inline variables without
+// dynamic initialisation we need to emit their initialiser for importer use.
+
+int& a = tu_local; // OK
+inline int& b = tu_local; // { dg-error "initialized to a TU-local value" }
+inline auto& bf = foo; // { dg-error "initialized to a TU-local value" }
+
+// But dynamic initialisers are fine, importers will just treat them as external.
+inline int& c = foo(); // OK
+
+// For consistency, we follow the same rules with templates, noting that
+// we still need to emit definitions with dynamic initializers so we error.
+template <typename T> int& d = tu_local; // OK
+template <typename T> inline int& e = tu_local; // { dg-error "exposes TU-local entity" }
+template <typename T> inline int& f = foo(); // { dg-error "exposes TU-local entity" }
+template <typename T> inline auto& ff = foo; // { dg-error "exposes TU-local entity" }
+
+// Note that non-references are OK, because an integer or enumeration
+// value is never TU-local: we fold these expressions early
+// (as we should, by [basic.link] p14.4).
+static const int const_val = 123;
+inline const int potentially_constant = const_val; // OK
diff --git a/gcc/testsuite/g++.dg/modules/tpl-nttp-2_a.H b/gcc/testsuite/g++.dg/modules/tpl-nttp-2_a.H
new file mode 100644
index 0000000..bfae11c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/modules/tpl-nttp-2_a.H
@@ -0,0 +1,14 @@
+// PR c++/119938
+// { dg-additional-options "-fmodules -std=c++20" }
+// { dg-module-cmi {} }
+
+struct A { int x; };
+
+template <A a> struct B { static_assert(a.x == 1); };
+using C = B<A{1}>;
+
+template <A a> void D() { static_assert(a.x == 2); };
+inline void E() { D<A{2}>(); }
+
+template <A a> struct F { static constexpr int result = a.x; };
+template <int=0> constexpr int G() { return F<A{3}>::result; };
diff --git a/gcc/testsuite/g++.dg/modules/tpl-nttp-2_b.C b/gcc/testsuite/g++.dg/modules/tpl-nttp-2_b.C
new file mode 100644
index 0000000..7e661cb
--- /dev/null
+++ b/gcc/testsuite/g++.dg/modules/tpl-nttp-2_b.C
@@ -0,0 +1,10 @@
+// PR c++/119938
+// { dg-additional-options "-fmodules -std=c++20" }
+
+import "tpl-nttp-2_a.H";
+
+int main() {
+ C c;
+ E();
+ static_assert(G() == 3);
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/data-model-5.c b/gcc/testsuite/gcc.dg/analyzer/data-model-5.c
index b71bad7..78e2752 100644
--- a/gcc/testsuite/gcc.dg/analyzer/data-model-5.c
+++ b/gcc/testsuite/gcc.dg/analyzer/data-model-5.c
@@ -60,7 +60,7 @@ base_obj *alloc_obj (type_obj *ob_type, size_t sz)
{
base_obj *obj = (base_obj *)malloc (sz);
if (!obj)
- return NULL;
+ return NULL; /* { dg-message "using NULL here" } */
obj->ob_type = ob_type;
obj->ob_refcnt = 1;
return obj;
diff --git a/gcc/testsuite/gcc.dg/analyzer/data-model-5b.c b/gcc/testsuite/gcc.dg/analyzer/data-model-5b.c
index cd6a4df..f66c8c4 100644
--- a/gcc/testsuite/gcc.dg/analyzer/data-model-5b.c
+++ b/gcc/testsuite/gcc.dg/analyzer/data-model-5b.c
@@ -44,7 +44,7 @@ base_obj *alloc_obj (type_obj *ob_type, size_t sz)
{
base_obj *obj = (base_obj *)malloc (sz);
if (!obj)
- return NULL;
+ return NULL; /* { dg-message "using NULL here" } */
obj->ob_type = ob_type;
obj->ob_refcnt = 1;
return obj;
diff --git a/gcc/testsuite/gcc.dg/analyzer/data-model-5c.c b/gcc/testsuite/gcc.dg/analyzer/data-model-5c.c
index ad4e1d2..1ce355f 100644
--- a/gcc/testsuite/gcc.dg/analyzer/data-model-5c.c
+++ b/gcc/testsuite/gcc.dg/analyzer/data-model-5c.c
@@ -38,7 +38,7 @@ base_obj *alloc_obj (type_obj *ob_type, size_t sz)
{
base_obj *obj = (base_obj *)malloc (sz);
if (!obj)
- return NULL;
+ return NULL; /* { dg-message "using NULL here" } */
obj->ob_type = ob_type;
obj->ob_refcnt = 1;
return obj;
diff --git a/gcc/testsuite/gcc.dg/analyzer/torture/pr93647.c b/gcc/testsuite/gcc.dg/analyzer/torture/pr93647.c
index fbfe570..194c99a 100644
--- a/gcc/testsuite/gcc.dg/analyzer/torture/pr93647.c
+++ b/gcc/testsuite/gcc.dg/analyzer/torture/pr93647.c
@@ -8,7 +8,7 @@ ky (int);
void
wd (void)
{
- tz = 0;
+ tz = 0; /* { dg-message "using NULL here" } */
ky (*tz); /* { dg-warning "dereference of NULL" } */
}
diff --git a/gcc/testsuite/gcc.target/aarch64/pr115258.c b/gcc/testsuite/gcc.target/aarch64/pr115258.c
index 9a489d4..f60b50a 100644
--- a/gcc/testsuite/gcc.target/aarch64/pr115258.c
+++ b/gcc/testsuite/gcc.target/aarch64/pr115258.c
@@ -1,4 +1,4 @@
-/* { dg-options "-O2" } */
+/* { dg-options "-O2 -mcmodel=small" } */
/* { dg-final { check-function-bodies "**" "" "" } } */
/*