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/plugin/location-overflow-test-pr116047-1.h6
-rw-r--r--gcc/testsuite/gcc.dg/plugin/location-overflow-test-pr116047-2.h1
-rw-r--r--gcc/testsuite/gcc.dg/plugin/location-overflow-test-pr116047.c5
-rw-r--r--gcc/testsuite/gcc.dg/plugin/location-overflow-test-pr120061-1.h6
-rw-r--r--gcc/testsuite/gcc.dg/plugin/location-overflow-test-pr120061-2.h1
-rw-r--r--gcc/testsuite/gcc.dg/plugin/location-overflow-test-pr120061.c6
-rw-r--r--gcc/testsuite/gcc.dg/plugin/location_overflow_plugin.cc15
-rw-r--r--gcc/testsuite/gcc.dg/plugin/plugin.exp4
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr120043.c10
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr120122-1.c51
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/phi-opt-40.c7
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/phi-opt-41.c4
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr31261.c6
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-early-break_134-pr120089.c66
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-early-break_135-pr120143.c18
15 files changed, 194 insertions, 12 deletions
diff --git a/gcc/testsuite/gcc.dg/plugin/location-overflow-test-pr116047-1.h b/gcc/testsuite/gcc.dg/plugin/location-overflow-test-pr116047-1.h
new file mode 100644
index 0000000..3dd6434
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/plugin/location-overflow-test-pr116047-1.h
@@ -0,0 +1,6 @@
+
+
+
+
+#include "location-overflow-test-pr116047-2.h"
+static_assert (__LINE__ == 6, "");
diff --git a/gcc/testsuite/gcc.dg/plugin/location-overflow-test-pr116047-2.h b/gcc/testsuite/gcc.dg/plugin/location-overflow-test-pr116047-2.h
new file mode 100644
index 0000000..048f715
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/plugin/location-overflow-test-pr116047-2.h
@@ -0,0 +1 @@
+int i;
diff --git a/gcc/testsuite/gcc.dg/plugin/location-overflow-test-pr116047.c b/gcc/testsuite/gcc.dg/plugin/location-overflow-test-pr116047.c
new file mode 100644
index 0000000..75161fa
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/plugin/location-overflow-test-pr116047.c
@@ -0,0 +1,5 @@
+/* PR preprocessor/116047 */
+/* { dg-do preprocess } */
+/* { dg-options "-nostdinc -std=c23 -fplugin-arg-location_overflow_plugin-value=0x4ffe0180" } */
+#include "location-overflow-test-pr116047-1.h"
+/* { dg-final { scan-file location-overflow-test-pr116047.i "static_assert\[^\n\r]\*6\[^\n\r]\*== 6" } } */
diff --git a/gcc/testsuite/gcc.dg/plugin/location-overflow-test-pr120061-1.h b/gcc/testsuite/gcc.dg/plugin/location-overflow-test-pr120061-1.h
new file mode 100644
index 0000000..ebf7704
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/plugin/location-overflow-test-pr120061-1.h
@@ -0,0 +1,6 @@
+
+
+
+
+#include "location-overflow-test-pr120061-2.h"
+
diff --git a/gcc/testsuite/gcc.dg/plugin/location-overflow-test-pr120061-2.h b/gcc/testsuite/gcc.dg/plugin/location-overflow-test-pr120061-2.h
new file mode 100644
index 0000000..048f715
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/plugin/location-overflow-test-pr120061-2.h
@@ -0,0 +1 @@
+int i;
diff --git a/gcc/testsuite/gcc.dg/plugin/location-overflow-test-pr120061.c b/gcc/testsuite/gcc.dg/plugin/location-overflow-test-pr120061.c
new file mode 100644
index 0000000..e8e8038
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/plugin/location-overflow-test-pr120061.c
@@ -0,0 +1,6 @@
+/* PR preprocessor/120061 */
+/* { dg-do preprocess } */
+/* { dg-options "-nostdinc -std=c23 -fplugin-arg-location_overflow_plugin-value=0x61000000" } */
+#include "location-overflow-test-pr120061-1.h"
+static_assert (__LINE__ == 5, "");
+/* { dg-final { scan-file location-overflow-test-pr120061.i "static_assert\[^\n\r]\*5\[^\n\r]\*== 5" } } */
diff --git a/gcc/testsuite/gcc.dg/plugin/location_overflow_plugin.cc b/gcc/testsuite/gcc.dg/plugin/location_overflow_plugin.cc
index f731b14..f770d35 100644
--- a/gcc/testsuite/gcc.dg/plugin/location_overflow_plugin.cc
+++ b/gcc/testsuite/gcc.dg/plugin/location_overflow_plugin.cc
@@ -85,9 +85,18 @@ plugin_init (struct plugin_name_args *plugin_info,
error_at (UNKNOWN_LOCATION, "missing plugin argument");
/* With 64-bit locations, the thresholds are larger, so shift the base
- location argument accordingly. */
+ location argument accordingly, basically remap the GCC 14 32-bit
+ location_t argument values to 64-bit location_t counterparts. There
+ is one exception for values slightly before the 32-bit location_t
+ LINE_MAP_MAX_LOCATION_WITH_PACKED_RANGES (0x50000000). In that case
+ remap them to the same amount before the 64-bit location_t
+ LINE_MAP_MAX_LOCATION_WITH_PACKED_RANGES -
+ ((location_t) 0x50000000) << 31. */
gcc_assert (sizeof (location_t) == sizeof (uint64_t));
- base_location = 1 + ((base_location - 1) << 31);
+ if (base_location >= 0x4f000000 && base_location <= 0x4fffffff)
+ base_location += (((location_t) 0x50000000) << 31) - 0x50000000;
+ else
+ base_location = 1 + ((base_location - 1) << 31);
register_callback (plugin_info->base_name,
PLUGIN_PRAGMAS,
@@ -107,7 +116,7 @@ plugin_init (struct plugin_name_args *plugin_info,
break;
default:
- error_at (UNKNOWN_LOCATION, "unrecognized value for plugin argument");
+ break;
}
return 0;
diff --git a/gcc/testsuite/gcc.dg/plugin/plugin.exp b/gcc/testsuite/gcc.dg/plugin/plugin.exp
index 90c9162..96e76d2 100644
--- a/gcc/testsuite/gcc.dg/plugin/plugin.exp
+++ b/gcc/testsuite/gcc.dg/plugin/plugin.exp
@@ -138,7 +138,9 @@ set plugin_test_list [list \
{ location_overflow_plugin.cc \
location-overflow-test-1.c \
location-overflow-test-2.c \
- location-overflow-test-pr83173.c } \
+ location-overflow-test-pr83173.c \
+ location-overflow-test-pr116047.c \
+ location-overflow-test-pr120061.c } \
{ must_tail_call_plugin.cc \
must-tail-call-1.c \
must-tail-call-2.c } \
diff --git a/gcc/testsuite/gcc.dg/torture/pr120043.c b/gcc/testsuite/gcc.dg/torture/pr120043.c
new file mode 100644
index 0000000..ae27468
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr120043.c
@@ -0,0 +1,10 @@
+/* { dg-do run } */
+/* { dg-additional-options "-fallow-store-data-races" } */
+
+const int a;
+int *b;
+int main()
+{
+ &a != b || (*b = 1);
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr120122-1.c b/gcc/testsuite/gcc.dg/torture/pr120122-1.c
new file mode 100644
index 0000000..dde41d8
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr120122-1.c
@@ -0,0 +1,51 @@
+/* { dg-do run } */
+/* PR tree-optimization/120122 */
+
+#include <stdbool.h>
+
+struct Value {
+ int type;
+ union {
+ bool boolean;
+ long long t;
+ };
+};
+
+static struct Value s_item_mem;
+
+/* truthy was being miscompiled for the value.type==2 case,
+ because we would have a VCE from unsigned char to bool
+ that went from being conditional in the value.type==1 case
+ to unconditional when `value.type!=0`.
+ The move of the VCE from conditional to unconditional,
+ needs to changed into a convert (NOP_EXPR). */
+static bool truthy(void) __attribute__((noipa));
+static bool
+truthy(void)
+{
+ bool tt = false;
+ for(int i = 0; i < 10; i++)
+ {
+ struct Value value = s_item_mem;
+ if (value.type == 0)
+ tt = tt | 0;
+ else if (value.type == 1)
+ tt = tt | value.boolean;
+ else
+ tt = tt | 1;
+ }
+ return tt;
+}
+
+int
+main(void)
+{
+ s_item_mem.type = 2;
+ s_item_mem.t = -1;
+ bool b1 = !truthy();
+ s_item_mem.type = 1;
+ s_item_mem.boolean = b1;
+ bool b = truthy();
+ if (b1 != b) __builtin_abort();
+ if (b) __builtin_abort();
+}
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-40.c b/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-40.c
index a9011ce..7062916 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-40.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-40.c
@@ -20,6 +20,7 @@ int f1(int x)
/* { dg-final { scan-tree-dump-times "if " 1 "phiopt1" } } */
/* { dg-final { scan-tree-dump-not "if " "phiopt2" } } */
-/* { dg-final { scan-tree-dump-times "ABS_EXPR <" 2 "phiopt1" } } */
-/* { dg-final { scan-tree-dump-times "ABS_EXPR <" 1 "phiopt2" } } */
-/* { dg-final { scan-tree-dump-times "ABSU_EXPR <" 1 "phiopt2" } } */
+/* The ABS_EXPR in f gets rewritten to ABSU_EXPR as phiopt can't prove it was not undefined when moving it. */
+/* { dg-final { scan-tree-dump-times "ABS_EXPR <" 1 "phiopt1" } } */
+/* { dg-final { scan-tree-dump-times "ABSU_EXPR <" 1 "phiopt1" } } */
+/* { dg-final { scan-tree-dump-times "ABSU_EXPR <" 2 "phiopt2" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-41.c b/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-41.c
index 9774e28..817d4fe 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-41.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-41.c
@@ -29,6 +29,6 @@ int fge(int a, unsigned char b)
return a > 0 ? a : -a;
}
-
+/* The ABS_EXPR gets rewritten to ABSU_EXPR as phiopt can't prove it was not undefined when moving it. */
/* { dg-final { scan-tree-dump-not "if " "phiopt1" } } */
-/* { dg-final { scan-tree-dump-times "ABS_EXPR <" 4 "phiopt1" } } */
+/* { dg-final { scan-tree-dump-times "ABSU_EXPR <" 4 "phiopt1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr31261.c b/gcc/testsuite/gcc.dg/tree-ssa/pr31261.c
index 127300f..dafb4c4 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/pr31261.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr31261.c
@@ -14,8 +14,8 @@ f2 (long int b)
return (16 + (b & 7)) & 15;
}
-char
-f3 (char c)
+signed char
+f3 (signed char c)
{
return -(c & 63) & 31;
}
@@ -34,7 +34,7 @@ f5 (int e)
/* { dg-final { scan-tree-dump-times "return -a \& 7;" 1 "original" } } */
/* { dg-final { scan-tree-dump-times "return b \& 7;" 1 "original" } } */
-/* { dg-final { scan-tree-dump-times "return \\(char\\) -\\(unsigned char\\) c \& 31;" 1 "original" } } */
+/* { dg-final { scan-tree-dump-times "return \\(signed char\\) -\\(unsigned char\\) c \& 31;" 1 "original" } } */
/* { dg-final { scan-tree-dump-times "return \\(int\\) \\(12 - \\(unsigned int\\) d\\) \& 7;" 1 "original" { target { ! int16 } } } } */
/* { dg-final { scan-tree-dump-times "return \\(int\\) \\(12 - \\(unsigned short\\) d\\) \& 7;" 1 "original" { target { int16 } } } } */
/* { dg-final { scan-tree-dump-times "return 12 - \\(e \& 7\\) \& 15;" 1 "original" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-early-break_134-pr120089.c b/gcc/testsuite/gcc.dg/vect/vect-early-break_134-pr120089.c
new file mode 100644
index 0000000..4d8199c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-early-break_134-pr120089.c
@@ -0,0 +1,66 @@
+/* { dg-add-options vect_early_break } */
+/* { dg-additional-options "-funswitch-loops" } */
+
+#include "tree-vect.h"
+
+typedef int type;
+typedef type Vec2[2];
+
+struct BytesVec {
+ type d[100];
+};
+
+__attribute__((noipa)) struct BytesVec
+buildVertexBufferData(const Vec2 *origVertices, bool needsZW,
+ unsigned paddingSize, unsigned long t) {
+ const unsigned vertexCount = t;
+ struct BytesVec data = (struct BytesVec){.d = {0}};
+ type *nextVertexPtr = data.d;
+
+ for (unsigned vertexIdx = 0u; vertexIdx < vertexCount; ++vertexIdx) {
+
+ if (vertexIdx > t)
+ __builtin_trap();
+ __builtin_memcpy(nextVertexPtr, &origVertices[vertexIdx],
+ 2 * sizeof(type));
+ nextVertexPtr += 2;
+
+ if (needsZW) {
+ nextVertexPtr += 2;
+ }
+
+ nextVertexPtr += paddingSize;
+ }
+
+ return data;
+}
+Vec2 origVertices[] = {
+ {0, 1}, {2, 3}, {4, 5}, {6, 7},
+ {8, 9}, {10, 11}, {12, 13}, {14, 15},
+ {16, 17}, {18, 19}, {20, 21}, {22, 23},
+ {24, 25}, {26, 27}, {27, 28}, {29, 30},
+};
+
+int main()
+{
+ check_vect ();
+ struct BytesVec vec
+ = buildVertexBufferData(origVertices, false, 0,
+ sizeof(origVertices) / sizeof(origVertices[0]));
+
+ int errors = 0;
+ for (unsigned i = 0; i < 100; i++) {
+ if (i / 2 < sizeof(origVertices) / sizeof(origVertices[0])) {
+ int ii = i;
+ int e = origVertices[ii / 2][ii % 2];
+ if (vec.d[i] != e)
+ errors++;
+ } else {
+ if (vec.d[i] != 0)
+ errors++;
+ }
+ }
+ if (errors)
+ __builtin_abort();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/vect/vect-early-break_135-pr120143.c b/gcc/testsuite/gcc.dg/vect/vect-early-break_135-pr120143.c
new file mode 100644
index 0000000..1ee30a8
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-early-break_135-pr120143.c
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+/* { dg-add-options vect_early_break } */
+/* { dg-additional-options "-O3 -fwhole-program" } */
+
+short a;
+extern _Bool b[][23];
+short g = 6;
+int v[4];
+int x[3];
+void c(short g, int v[], int x[]) {
+ for (;;)
+ for (unsigned y = 0; y < 023; y++) {
+ b[y][y] = v[y];
+ for (_Bool aa = 0; aa < (_Bool)g; aa = x[y])
+ a = a > 0;
+ }
+}
+int main() { c(g, v, x); }