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/Wjump-misses-init-3.c10
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/analyzer-decls.h7
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/state-diagram-1-sarif.py32
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/state-diagram-1.c48
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/state-diagram-2.c17
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/state-diagram-3.c20
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/state-diagram-4.c8
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/state-diagram-5-html.c41
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/state-diagram-5-html.py29
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/state-diagram-5-sarif.c35
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/state-diagram-5-sarif.py73
-rw-r--r--gcc/testsuite/gcc.dg/bad-binary-ops-highlight-colors.c4
-rw-r--r--gcc/testsuite/gcc.dg/bitint-123.c26
-rw-r--r--gcc/testsuite/gcc.dg/bitintext.h29
-rw-r--r--gcc/testsuite/gcc.dg/builtin-dynamic-object-size-pr120780.c233
-rw-r--r--gcc/testsuite/gcc.dg/builtins-1.c7
-rw-r--r--gcc/testsuite/gcc.dg/c23-builtins-1.c22
-rw-r--r--gcc/testsuite/gcc.dg/countof-compat.c8
-rw-r--r--gcc/testsuite/gcc.dg/countof-compile.c124
-rw-r--r--gcc/testsuite/gcc.dg/countof-no-compat.c5
-rw-r--r--gcc/testsuite/gcc.dg/countof-pedantic-errors.c8
-rw-r--r--gcc/testsuite/gcc.dg/countof-pedantic.c8
-rw-r--r--gcc/testsuite/gcc.dg/countof-stdcountof.c24
-rw-r--r--gcc/testsuite/gcc.dg/countof-vla.c35
-rw-r--r--gcc/testsuite/gcc.dg/countof-vmt.c20
-rw-r--r--gcc/testsuite/gcc.dg/countof-zero-compile.c38
-rw-r--r--gcc/testsuite/gcc.dg/countof-zero.c31
-rw-r--r--gcc/testsuite/gcc.dg/countof.c120
-rw-r--r--gcc/testsuite/gcc.dg/crc-non-cst-poly-1.c11
-rw-r--r--gcc/testsuite/gcc.dg/cwsc1.c6
-rw-r--r--gcc/testsuite/gcc.dg/dfp/bitint-10.c49
-rw-r--r--gcc/testsuite/gcc.dg/dfp/bitint-9.c29
-rw-r--r--gcc/testsuite/gcc.dg/dfp/pr120631.c24
-rw-r--r--gcc/testsuite/gcc.dg/flex-array-counted-by-pr121000.c43
-rw-r--r--gcc/testsuite/gcc.dg/fold-copysign-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/format/colors.c4
-rw-r--r--gcc/testsuite/gcc.dg/format/diagnostic-ranges-html.py79
-rw-r--r--gcc/testsuite/gcc.dg/format/diagnostic-ranges.c6
-rw-r--r--gcc/testsuite/gcc.dg/gnu23-tag-composite-6.c31
-rw-r--r--gcc/testsuite/gcc.dg/gomp/declare-mapper-10.c61
-rw-r--r--gcc/testsuite/gcc.dg/gomp/declare-mapper-11.c33
-rw-r--r--gcc/testsuite/gcc.dg/gomp/declare-mapper-13.c13
-rw-r--r--gcc/testsuite/gcc.dg/gomp/udr-3.c8
-rw-r--r--gcc/testsuite/gcc.dg/guality/guality.h5
-rw-r--r--gcc/testsuite/gcc.dg/html-output/html-output.exp31
-rw-r--r--gcc/testsuite/gcc.dg/html-output/missing-semicolon.c13
-rw-r--r--gcc/testsuite/gcc.dg/html-output/missing-semicolon.py104
-rw-r--r--gcc/testsuite/gcc.dg/ipa/pr119318.c10
-rw-r--r--gcc/testsuite/gcc.dg/ipa/pr119852.c50
-rw-r--r--gcc/testsuite/gcc.dg/ipa/pr120044-1.c17
-rw-r--r--gcc/testsuite/gcc.dg/ipa/pr120044-2.c17
-rw-r--r--gcc/testsuite/gcc.dg/ipa/pr120295.c66
-rw-r--r--gcc/testsuite/gcc.dg/memcpy-6.c2
-rw-r--r--gcc/testsuite/gcc.dg/nonnull-12.c73
-rw-r--r--gcc/testsuite/gcc.dg/nonnull-13.c210
-rw-r--r--gcc/testsuite/gcc.dg/nonnull-14.c23
-rw-r--r--gcc/testsuite/gcc.dg/nonnull-9.c36
-rw-r--r--gcc/testsuite/gcc.dg/old-style-prom-4.c25
-rw-r--r--gcc/testsuite/gcc.dg/plugin/analyzer_cpython_plugin.cc1
-rw-r--r--gcc/testsuite/gcc.dg/plugin/analyzer_gil_plugin.cc9
-rw-r--r--gcc/testsuite/gcc.dg/plugin/analyzer_kernel_plugin.cc1
-rw-r--r--gcc/testsuite/gcc.dg/plugin/analyzer_known_fns_plugin.cc1
-rw-r--r--gcc/testsuite/gcc.dg/plugin/diagnostic-test-metadata-html.c15
-rw-r--r--gcc/testsuite/gcc.dg/plugin/diagnostic-test-metadata-html.py73
-rw-r--r--gcc/testsuite/gcc.dg/plugin/diagnostic-test-paths-2.c6
-rw-r--r--gcc/testsuite/gcc.dg/plugin/diagnostic-test-paths-2.py48
-rw-r--r--gcc/testsuite/gcc.dg/plugin/diagnostic-test-paths-3.c75
-rw-r--r--gcc/testsuite/gcc.dg/plugin/diagnostic-test-paths-4.c6
-rw-r--r--gcc/testsuite/gcc.dg/plugin/diagnostic-test-paths-4.py49
-rw-r--r--gcc/testsuite/gcc.dg/plugin/diagnostic-test-show-locus-bw-line-numbers.c6
-rw-r--r--gcc/testsuite/gcc.dg/plugin/diagnostic-test-show-locus.py115
-rw-r--r--gcc/testsuite/gcc.dg/plugin/diagnostic-test-xhtml-1.c19
-rw-r--r--gcc/testsuite/gcc.dg/plugin/diagnostic_group_plugin.cc3
-rw-r--r--gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_paths.cc10
-rw-r--r--gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_xhtml_format.cc985
-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.exp8
-rw-r--r--gcc/testsuite/gcc.dg/pr116546.c46
-rw-r--r--gcc/testsuite/gcc.dg/pr116892.c11
-rw-r--r--gcc/testsuite/gcc.dg/pr118948-1.c12
-rw-r--r--gcc/testsuite/gcc.dg/pr119039-1.c32
-rw-r--r--gcc/testsuite/gcc.dg/pr119039-2.c60
-rw-r--r--gcc/testsuite/gcc.dg/pr119160.c16
-rw-r--r--gcc/testsuite/gcc.dg/pr120074.c20
-rw-r--r--gcc/testsuite/gcc.dg/pr120277.c21
-rw-r--r--gcc/testsuite/gcc.dg/pr120303.c5
-rw-r--r--gcc/testsuite/gcc.dg/pr120353.c11
-rw-r--r--gcc/testsuite/gcc.dg/pr120354.c33
-rw-r--r--gcc/testsuite/gcc.dg/pr120380.c24
-rw-r--r--gcc/testsuite/gcc.dg/pr120381.c10
-rw-r--r--gcc/testsuite/gcc.dg/pr120447.c24
-rw-r--r--gcc/testsuite/gcc.dg/pr120480.c11
-rw-r--r--gcc/testsuite/gcc.dg/pr120510.c7
-rw-r--r--gcc/testsuite/gcc.dg/pr120525.c22
-rw-r--r--gcc/testsuite/gcc.dg/pr120630.c25
-rw-r--r--gcc/testsuite/gcc.dg/pr120638.c31
-rw-r--r--gcc/testsuite/gcc.dg/pr120661-1.c51
-rw-r--r--gcc/testsuite/gcc.dg/pr120661-2.c39
-rw-r--r--gcc/testsuite/gcc.dg/pr120701.c40
-rw-r--r--gcc/testsuite/gcc.dg/pr55152-2.c2
-rw-r--r--gcc/testsuite/gcc.dg/pr78408-1.c3
-rw-r--r--gcc/testsuite/gcc.dg/pr87600.h2
-rw-r--r--gcc/testsuite/gcc.dg/pr89313.c2
-rw-r--r--gcc/testsuite/gcc.dg/rtl/aarch64/vec-series-1.c35
-rw-r--r--gcc/testsuite/gcc.dg/rtl/aarch64/vec-series-2.c35
-rw-r--r--gcc/testsuite/gcc.dg/strlenopt-80.c2
-rw-r--r--gcc/testsuite/gcc.dg/torture/bitint-78.c102
-rw-r--r--gcc/testsuite/gcc.dg/torture/bitint-79.c191
-rw-r--r--gcc/testsuite/gcc.dg/torture/bitint-80.c191
-rw-r--r--gcc/testsuite/gcc.dg/torture/bitint-81.c174
-rw-r--r--gcc/testsuite/gcc.dg/torture/bitint-82.c94
-rw-r--r--gcc/testsuite/gcc.dg/torture/builtin-math-9.c86
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr117811.c5
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr119131-1.c1
-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/torture/pr120182.c42
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr120211-1.c20
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr120242.c30
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr120276.c20
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr120341-1.c11
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr120341-2.c13
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr120347.c13
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr120369-1.c9
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr120627.c27
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr120654.c22
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr120736.c21
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr120813.c27
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr120944.c34
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr120951-1.c12
-rw-r--r--gcc/testsuite/gcc.dg/tree-prof/afdo-crossmodule-1.c29
-rw-r--r--gcc/testsuite/gcc.dg/tree-prof/afdo-crossmodule-1b.c10
-rw-r--r--gcc/testsuite/gcc.dg/tree-prof/afdo-inline.c36
-rw-r--r--gcc/testsuite/gcc.dg/tree-prof/afdo-vpt-earlyinline.c38
-rw-r--r--gcc/testsuite/gcc.dg/tree-prof/clone-merge-1.c34
-rw-r--r--gcc/testsuite/gcc.dg/tree-prof/clone-test.c63
-rw-r--r--gcc/testsuite/gcc.dg/tree-prof/indir-call-prof-2.c6
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/20031106-6.c8
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/abs-4.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/backprop-6.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/cswtch-6.c43
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/forwprop-41.c1
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/gen-vect-28.c3
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ifcvt-fix-trunc-1.c19
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ifcvt-fix-trunc-2.c6
-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/phiprop-2.c27
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr108358-a.c33
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr114169-1.c39
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr114864.c15
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr120080.c26
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr120231-1.c67
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr120231-2.c107
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr120231-3.c40
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr31261.c6
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr35286.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr57361-1.c10
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr57361.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/split-path-6.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/split-path-7.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-7.c4
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/vrp124.c31
-rw-r--r--gcc/testsuite/gcc.dg/ubsan/pr120837.c32
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-pr115777.c15
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-pr119181.c15
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-pr119960-1.c15
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-pr120808.c12
-rw-r--r--gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul4-3.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul8-9.c1
-rw-r--r--gcc/testsuite/gcc.dg/vect/pr101145.c18
-rw-r--r--gcc/testsuite/gcc.dg/vect/pr120817.c41
-rw-r--r--gcc/testsuite/gcc.dg/vect/pr120922.c18
-rw-r--r--gcc/testsuite/gcc.dg/vect/pr121034.c17
-rw-r--r--gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s332.c1
-rw-r--r--gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s481.c1
-rw-r--r--gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s482.c1
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-early-break_133_pfa6.c2
-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
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-early-break_135-pr120211.c12
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-early-break_136-pr120357.c13
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-pr120927-2.c24
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-pr120927.c24
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-reduc-fma-1.c15
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-reduc-fma-2.c20
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-reduc-fma-3.c16
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-simd-clone-16e.c8
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-simd-clone-17e.c8
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-simd-clone-18e.c8
196 files changed, 5420 insertions, 1178 deletions
diff --git a/gcc/testsuite/gcc.dg/Wjump-misses-init-3.c b/gcc/testsuite/gcc.dg/Wjump-misses-init-3.c
new file mode 100644
index 0000000..c3110c4
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Wjump-misses-init-3.c
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-Wc++-compat" } */
+
+void f()
+{
+ goto skip; /* { dg-warning "jump skips variable initialization" } */
+ int i = 1;
+skip: ;
+}
+
diff --git a/gcc/testsuite/gcc.dg/analyzer/analyzer-decls.h b/gcc/testsuite/gcc.dg/analyzer/analyzer-decls.h
index 372a136..db0140b 100644
--- a/gcc/testsuite/gcc.dg/analyzer/analyzer-decls.h
+++ b/gcc/testsuite/gcc.dg/analyzer/analyzer-decls.h
@@ -30,6 +30,10 @@ extern void __analyzer_dump (void);
/* Emit a warning describing the size of the base region of (*ptr). */
extern void __analyzer_dump_capacity (const void *ptr);
+/* When reached, dump GraphViz .dot source to stderr for a diagram
+ describing the analyzer’s state. */
+extern void __analyzer_dump_dot (void);
+
/* Dump information about what decls have escaped at this point on the path. */
extern void __analyzer_dump_escaped (void);
@@ -58,6 +62,9 @@ extern void __analyzer_dump_region_model (void);
This is for use when debugging, and may be of use in DejaGnu tests. */
extern void __analyzer_dump_state (const char *name, ...);
+/* Dump copious information about the analyzer’s state when reached. */
+extern void __analyzer_dump_xml (void);
+
/* Emit a warning with text "TRUE", FALSE" or "UNKNOWN" based on the
truthfulness of the argument. */
extern void __analyzer_eval (int);
diff --git a/gcc/testsuite/gcc.dg/analyzer/state-diagram-1-sarif.py b/gcc/testsuite/gcc.dg/analyzer/state-diagram-1-sarif.py
new file mode 100644
index 0000000..d2967d4
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/state-diagram-1-sarif.py
@@ -0,0 +1,32 @@
+from sarif import *
+
+import pytest
+
+@pytest.fixture(scope='function', autouse=True)
+def sarif():
+ return sarif_from_env()
+
+def test_xml_state(sarif):
+ result = get_result_by_index(sarif, 0)
+
+ assert result['level'] == 'warning'
+ assert result['ruleId'] == '-Wanalyzer-use-after-free'
+
+ # TODO: check code flow
+ events = result["codeFlows"][0]["threadFlows"][0]['locations']
+
+ # Event "(1)": "entry to 'test'" (index == 0)
+ assert events[0]['location']['message']['text'] == "entry to 'test'"
+ state0 = get_xml_state(events, 0)
+ memory_regions = state0.find('memory-regions')
+ assert memory_regions is not None
+ stack = memory_regions.find('stack')
+ assert stack is not None
+ frame = stack.find('stack-frame')
+ assert frame.get('function') == 'test'
+
+ # Final event:
+ assert events[-1]['location']['message']['text'].startswith("use after 'free' of ")
+ state = get_xml_state(events, -1)
+ # TODO
+
diff --git a/gcc/testsuite/gcc.dg/analyzer/state-diagram-1.c b/gcc/testsuite/gcc.dg/analyzer/state-diagram-1.c
new file mode 100644
index 0000000..3d853d2
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/state-diagram-1.c
@@ -0,0 +1,48 @@
+/* { dg-additional-options "-fdiagnostics-add-output=sarif:xml-state=yes" } */
+
+#include "analyzer-decls.h"
+
+struct node
+{
+ struct node *m_next;
+ int m_val;
+};
+
+struct node *first;
+
+struct node *
+append_value (int value)
+{
+ struct node *n = __builtin_malloc (sizeof (struct node));
+ if (!n)
+ return 0;
+ n->m_val = value;
+
+ n->m_next = first;
+ first = n;
+
+ return n;
+}
+
+int g;
+
+void
+test ()
+{
+ if (!append_value (42))
+ return;
+ if (!append_value (1066))
+ return;
+ if (!append_value (1776))
+ return;
+
+ __builtin_free (first->m_next->m_next);
+ first->m_next->m_next->m_next->m_next = NULL; /* { dg-warning "-Wanalyzer-use-after-free" } */
+}
+
+/* Verify that some JSON was written to a file with the expected name. */
+/* { dg-final { verify-sarif-file } } */
+
+/* Use a Python script to verify various properties about the generated
+ .sarif file:
+ { dg-final { run-sarif-pytest state-diagram-1.c "state-diagram-1-sarif.py" } } */
diff --git a/gcc/testsuite/gcc.dg/analyzer/state-diagram-2.c b/gcc/testsuite/gcc.dg/analyzer/state-diagram-2.c
new file mode 100644
index 0000000..bde2bc4
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/state-diagram-2.c
@@ -0,0 +1,17 @@
+#include "analyzer-decls.h"
+#include <stdio.h>
+
+int g;
+int h;
+
+int
+test_pointer_to_global (FILE *f)
+{
+ int *p = &g;
+ int *q = &h;
+
+ fread (&g, sizeof (g), 1, f);
+ fread (&h, sizeof (h), 1, f);
+
+ return *p / *q; /* { dg-warning "-Wanalyzer-tainted-divisor" } */
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/state-diagram-3.c b/gcc/testsuite/gcc.dg/analyzer/state-diagram-3.c
new file mode 100644
index 0000000..a28553d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/state-diagram-3.c
@@ -0,0 +1,20 @@
+#include "analyzer-decls.h"
+
+int
+inner (int *p)
+{
+ return *p; /* { dg-warning "-Wanalyzer-use-of-uninitialized-value" } */
+}
+
+int
+middle (int *q)
+{
+ return inner (q);
+}
+
+int
+outer ()
+{
+ int i;
+ return middle (&i);
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/state-diagram-4.c b/gcc/testsuite/gcc.dg/analyzer/state-diagram-4.c
new file mode 100644
index 0000000..37c654f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/state-diagram-4.c
@@ -0,0 +1,8 @@
+#include "analyzer-decls.h"
+
+void test ()
+{
+ void *p = __builtin_malloc (1024);
+ __builtin_free (p);
+ __builtin_free (p); /* { dg-warning "-Wanalyzer-double-free" } */
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/state-diagram-5-html.c b/gcc/testsuite/gcc.dg/analyzer/state-diagram-5-html.c
new file mode 100644
index 0000000..274a951
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/state-diagram-5-html.c
@@ -0,0 +1,41 @@
+/* { dg-require-dot "" } */
+/* { dg-additional-options "-fdiagnostics-add-output=experimental-html:javascript=no,show-state-diagrams=yes" } */
+/* { dg-additional-options "-fdiagnostics-show-caret" } */
+
+#include "analyzer-decls.h"
+
+struct foo
+{
+ int m_ints[4];
+};
+
+struct bar
+{
+ struct foo m_foos[3];
+ int m_int;
+ char m_ch;
+};
+
+struct baz
+{
+ struct bar m_bars[2];
+ struct foo m_foos[5];
+};
+
+void test (void)
+{
+ struct baz baz_arr[2];
+ baz_arr[1].m_bars[1].m_foos[2].m_ints[1] = 42;
+ __analyzer_dump_path (); /* { dg-message "path" } */
+}
+
+/* We need -fdiagnostics-show-caret for the HTML output to show the source,
+ and thus to show event labels. */
+
+/* { dg-begin-multiline-output "" }
+ __analyzer_dump_path ();
+ { dg-end-multiline-output "" } */
+
+/* Use a Python script to verify various properties about the generated
+ .html file:
+ { dg-final { run-html-pytest state-diagram-5-html.c "state-diagram-5-html.py" } } */
diff --git a/gcc/testsuite/gcc.dg/analyzer/state-diagram-5-html.py b/gcc/testsuite/gcc.dg/analyzer/state-diagram-5-html.py
new file mode 100644
index 0000000..79374b2
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/state-diagram-5-html.py
@@ -0,0 +1,29 @@
+# Smoketest of HTML state diagram output
+
+from htmltest import *
+
+import pytest
+
+@pytest.fixture(scope='function', autouse=True)
+def html_tree():
+ return html_tree_from_env()
+
+def test_state_diagram(html_tree):
+ diag = get_diag_by_index(html_tree, 0)
+ assert diag is not None
+
+ path = diag.find('xhtml:div[@id="execution-path"]', ns)
+ assert path is not None
+
+ event_label = path.find('.//xhtml:span[@id="gcc-diag-0-event-0"]', ns)
+ assert event_label is not None
+ assert event_label.get('class') == 'event'
+
+ assert event_label.text == '(1) here'
+
+ state_diagram = event_label.find('xhtml:div[@class="state-diagram"]', ns)
+ assert state_diagram is not None
+ assert state_diagram.get('id') == 'gcc-diag-0-event-0-state-diagram'
+
+ svg = state_diagram.find('.//svg:svg', ns)
+ assert svg is not None
diff --git a/gcc/testsuite/gcc.dg/analyzer/state-diagram-5-sarif.c b/gcc/testsuite/gcc.dg/analyzer/state-diagram-5-sarif.c
new file mode 100644
index 0000000..28cf580
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/state-diagram-5-sarif.c
@@ -0,0 +1,35 @@
+/* { dg-additional-options "-fdiagnostics-add-output=sarif:xml-state=yes" } */
+
+#include "analyzer-decls.h"
+
+struct foo
+{
+ int m_ints[4];
+};
+
+struct bar
+{
+ struct foo m_foos[3];
+ int m_int;
+ char m_ch;
+};
+
+struct baz
+{
+ struct bar m_bars[2];
+ struct foo m_foos[5];
+};
+
+void test (void)
+{
+ struct baz baz_arr[2];
+ baz_arr[1].m_bars[1].m_foos[2].m_ints[1] = 42;
+ __analyzer_dump_path (); /* { dg-message "path" } */
+}
+
+/* Verify that some JSON was written to a file with the expected name. */
+/* { dg-final { verify-sarif-file } } */
+
+/* Use a Python script to verify various properties about the generated
+ .sarif file:
+ { dg-final { run-sarif-pytest state-diagram-5-sarif.c "state-diagram-5-sarif.py" } } */
diff --git a/gcc/testsuite/gcc.dg/analyzer/state-diagram-5-sarif.py b/gcc/testsuite/gcc.dg/analyzer/state-diagram-5-sarif.py
new file mode 100644
index 0000000..484da96
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/state-diagram-5-sarif.py
@@ -0,0 +1,73 @@
+import xml.etree.ElementTree as ET
+
+from sarif import *
+
+import pytest
+
+@pytest.fixture(scope='function', autouse=True)
+def sarif():
+ return sarif_from_env()
+
+def test_nested_types_in_xml_state(sarif):
+ result = get_result_by_index(sarif, 0)
+
+ assert result['level'] == 'note'
+
+ events = result["codeFlows"][0]["threadFlows"][0]['locations']
+
+ assert events[0]['location']['message']['text'] == 'here'
+ state = get_xml_state(events, 0)
+
+ memory_regions = state.find('memory-regions')
+ assert memory_regions is not None
+
+ stack = memory_regions.find('stack')
+ assert stack is not None
+
+ frame = stack.find('stack-frame')
+ assert frame.get('function') == 'test'
+
+ # We have:
+ # baz_arr[1].m_bars[1].m_foos[2].m_ints[1] = 42;
+
+ # Verify that we correctly expand from the analyzer's bit-offset
+ # representation to nested elements and fields.
+
+ # "baz_arr":
+ baz_arr = frame.find("variable[@name='baz_arr']")
+ assert baz_arr.get('type') == 'struct baz[2]'
+
+ # "baz_arr[1]":
+ baz_arr_1 = baz_arr.find("element[@index='1']")
+ assert baz_arr_1.get('type') == 'struct baz'
+
+ assert baz_arr.find("element[@index='0']") is None
+
+ # "baz_arr[1].m_bars":
+ baz_arr_1_m_bars = baz_arr_1.find("field[@name='m_bars']")
+ assert baz_arr_1_m_bars.get('type') == 'struct bar[2]'
+
+ # "baz_arr[1].m_bars[1]"
+ baz_arr_1_m_bars_1 = baz_arr_1_m_bars.find("element[@index='1']")
+ assert baz_arr_1_m_bars_1.get('type') == 'struct bar'
+
+ # "baz_arr[1].m_bars[1].m_foos"
+ baz_arr_1_m_bars_1_m_foos = baz_arr_1_m_bars_1.find("field[@name='m_foos']")
+ assert baz_arr_1_m_bars_1_m_foos.get('type') == 'struct foo[3]'
+
+ # "baz_arr[1].m_bars[1].m_foos[2]"
+ baz_arr_1_m_bars_1_m_foos_2 = baz_arr_1_m_bars_1_m_foos.find("element[@index='2']")
+ assert baz_arr_1_m_bars_1_m_foos_2.get('type') == 'struct foo'
+
+ # "baz_arr[1].m_bars[1].m_foos[2].m_ints"
+ baz_arr_1_m_bars_1_m_foos_2_m_ints = baz_arr_1_m_bars_1_m_foos_2.find('field[@name="m_ints"]')
+ assert baz_arr_1_m_bars_1_m_foos_2_m_ints.get('type') == 'int[4]'
+
+ # "baz_arr[1].m_bars[1].m_foos[2].m_ints[1]"
+ baz_arr_1_m_bars_1_m_foos_2_m_ints_1 = baz_arr_1_m_bars_1_m_foos_2_m_ints.find('element[@index="1"]')
+ assert baz_arr_1_m_bars_1_m_foos_2_m_ints_1.get('type') == 'int'
+
+ value = baz_arr_1_m_bars_1_m_foos_2_m_ints_1.find('value-of-region')
+ constant = value.find('constant')
+ assert constant.get('value') == '42'
+ assert constant.get('type') == 'int'
diff --git a/gcc/testsuite/gcc.dg/bad-binary-ops-highlight-colors.c b/gcc/testsuite/gcc.dg/bad-binary-ops-highlight-colors.c
index efbcdf3..da98f1a 100644
--- a/gcc/testsuite/gcc.dg/bad-binary-ops-highlight-colors.c
+++ b/gcc/testsuite/gcc.dg/bad-binary-ops-highlight-colors.c
@@ -23,8 +23,8 @@ int test_4 (void)
{ dg-end-multiline-output "" } */
/* { dg-begin-multiline-output "" }
- return callee_4a () + callee_4b ();
- ~~~~~~~~~~~~ ^ ~~~~~~~~~~~~
+ return callee_4a () + callee_4b ();
+ ~~~~~~~~~~~~ ^ ~~~~~~~~~~~~
| |
| T {aka struct t}
S {aka struct s}
diff --git a/gcc/testsuite/gcc.dg/bitint-123.c b/gcc/testsuite/gcc.dg/bitint-123.c
new file mode 100644
index 0000000..4d019a9
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/bitint-123.c
@@ -0,0 +1,26 @@
+/* PR middle-end/120547 */
+/* { dg-do run { target bitint } } */
+/* { dg-options "-O2" } */
+/* { dg-add-options float64 } */
+/* { dg-require-effective-target float64 } */
+
+#define CHECK(x, y) \
+ if ((_Float64) x != (_Float64) y \
+ || (_Float64) (x + 1) != (_Float64) (y + 1)) \
+ __builtin_abort ()
+
+int
+main ()
+{
+ unsigned long long a = 0x20000000000001ULL << 7;
+ volatile unsigned long long b = a;
+ CHECK (a, b);
+#if __BITINT_MAXWIDTH__ >= 4096
+ unsigned _BitInt(4096) c = ((unsigned _BitInt(4096)) 0x20000000000001ULL) << 253;
+ volatile unsigned _BitInt(4096) d = c;
+ CHECK (c, d);
+ unsigned _BitInt(4096) e = ((unsigned _BitInt(4096)) 0x20000000000001ULL) << 931;
+ volatile unsigned _BitInt(4096) f = e;
+ CHECK (e, f);
+#endif
+}
diff --git a/gcc/testsuite/gcc.dg/bitintext.h b/gcc/testsuite/gcc.dg/bitintext.h
new file mode 100644
index 0000000..99fedb3
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/bitintext.h
@@ -0,0 +1,29 @@
+[[gnu::noipa]] void
+do_copy (void *p, const void *q, __SIZE_TYPE__ r)
+{
+ __builtin_memcpy (p, q, r);
+}
+
+/* Macro to test whether (on targets where psABI requires it) _BitInt
+ with padding bits have those filled with sign or zero extension. */
+#if defined(__s390x__) || defined(__arm__) || defined(__loongarch__)
+#define BEXTC(x) \
+ do { \
+ if ((typeof (x)) -1 < 0) \
+ { \
+ _BitInt(sizeof (x) * __CHAR_BIT__) __x; \
+ do_copy (&__x, &(x), sizeof (__x)); \
+ if (__x != (x)) \
+ __builtin_abort (); \
+ } \
+ else \
+ { \
+ unsigned _BitInt(sizeof (x) * __CHAR_BIT__) __x; \
+ do_copy (&__x, &(x), sizeof (__x)); \
+ if (__x != (x)) \
+ __builtin_abort (); \
+ } \
+ } while (0)
+#else
+#define BEXTC(x) do { (void) (x); } while (0)
+#endif
diff --git a/gcc/testsuite/gcc.dg/builtin-dynamic-object-size-pr120780.c b/gcc/testsuite/gcc.dg/builtin-dynamic-object-size-pr120780.c
new file mode 100644
index 0000000..12e6c29
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/builtin-dynamic-object-size-pr120780.c
@@ -0,0 +1,233 @@
+/* { dg-do run } */
+/* { dg-options "-O2" } */
+
+#include "builtin-object-size-common.h"
+typedef __SIZE_TYPE__ size_t;
+#define NUM_MCAST_RATE 6
+
+#define MIN(a,b) ((a) < (b) ? (a) : (b))
+#define MAX(a,b) ((a) > (b) ? (a) : (b))
+
+struct inner
+{
+ int dummy[4];
+};
+
+struct container
+{
+ int mcast_rate[NUM_MCAST_RATE];
+ struct inner mesh;
+};
+
+static void
+test1_child (struct inner *ifmsh, size_t expected)
+{
+ struct container *sdata =
+ (struct container *) ((void *) ifmsh
+ - __builtin_offsetof (struct container, mesh));
+
+ if (__builtin_dynamic_object_size (sdata->mcast_rate, 1)
+ != sizeof (sdata->mcast_rate))
+ FAIL ();
+
+ if (__builtin_dynamic_object_size (&sdata->mesh, 1) != expected)
+ FAIL ();
+}
+
+void
+__attribute__((noinline))
+test1 (size_t sz)
+{
+ struct container *sdata = __builtin_malloc (sz);
+ struct inner *ifmsh = &sdata->mesh;
+
+ test1_child (ifmsh,
+ (sz > sizeof (sdata->mcast_rate)
+ ? sz - sizeof (sdata->mcast_rate) : 0));
+
+ __builtin_free (sdata);
+}
+
+struct container2
+{
+ int mcast_rate[NUM_MCAST_RATE];
+ union
+ {
+ int dummy;
+ double dbl;
+ struct inner mesh;
+ } u;
+};
+
+static void
+test2_child (struct inner *ifmsh, size_t sz)
+{
+ struct container2 *sdata =
+ (struct container2 *) ((void *) ifmsh
+ - __builtin_offsetof (struct container2, u.mesh));
+
+ if (__builtin_dynamic_object_size (sdata->mcast_rate, 1)
+ != sizeof (sdata->mcast_rate))
+ FAIL ();
+
+ size_t diff = sizeof (*sdata) - sz;
+ size_t expected = MIN(sizeof (double), MAX (sizeof (sdata->u), diff) - diff);
+
+ if (__builtin_dynamic_object_size (&sdata->u.dbl, 1) != expected)
+ FAIL ();
+
+ expected = MAX (sizeof (sdata->u.mesh), diff) - diff;
+ if (__builtin_dynamic_object_size (&sdata->u.mesh, 1) != expected)
+ FAIL ();
+}
+
+void
+__attribute__((noinline))
+test2 (size_t sz)
+{
+ struct container2 *sdata = __builtin_malloc (sz);
+ struct inner *ifmsh = &sdata->u.mesh;
+
+ test2_child (ifmsh, sz);;
+
+ __builtin_free (sdata);
+}
+
+struct container3
+{
+ int mcast_rate[NUM_MCAST_RATE];
+ char mesh[8];
+};
+
+static void
+test3_child (char ifmsh[], size_t expected)
+{
+ struct container3 *sdata =
+ (struct container3 *) ((void *) ifmsh
+ - __builtin_offsetof (struct container3, mesh));
+
+ if (__builtin_dynamic_object_size (sdata->mcast_rate, 1)
+ != sizeof (sdata->mcast_rate))
+ FAIL ();
+
+ if (__builtin_dynamic_object_size (sdata->mesh, 1) != expected)
+ FAIL ();
+}
+
+void
+__attribute__((noinline))
+test3 (size_t sz)
+{
+ struct container3 *sdata = __builtin_malloc (sz);
+ char *ifmsh = sdata->mesh;
+ size_t diff = sizeof (*sdata) - sz;
+
+ test3_child (ifmsh, MAX(sizeof (sdata->mesh), diff) - diff);
+
+ __builtin_free (sdata);
+}
+
+
+struct container4
+{
+ int mcast_rate[NUM_MCAST_RATE];
+ struct
+ {
+ int dummy;
+ struct inner mesh;
+ } s;
+};
+
+static void
+test4_child (struct inner *ifmsh, size_t expected)
+{
+ struct container4 *sdata =
+ (struct container4 *) ((void *) ifmsh
+ - __builtin_offsetof (struct container4, s.mesh));
+
+
+ if (__builtin_dynamic_object_size (sdata->mcast_rate, 1)
+ != sizeof (sdata->mcast_rate))
+ FAIL ();
+
+ if (__builtin_dynamic_object_size (&sdata->s.mesh, 1) != expected)
+ FAIL ();
+}
+
+void
+__attribute__((noinline))
+test4 (size_t sz)
+{
+ struct container4 *sdata = __builtin_malloc (sz);
+ struct inner *ifmsh = &sdata->s.mesh;
+ size_t diff = sizeof (*sdata) - sz;
+
+ test4_child (ifmsh, MAX(sizeof (sdata->s.mesh), diff) - diff);
+
+ __builtin_free (sdata);
+}
+
+struct container5
+{
+ int mcast_rate[NUM_MCAST_RATE];
+ struct
+ {
+ int dummy;
+ struct inner *mesh;
+ } s;
+};
+
+static void
+test5_child (struct inner **ifmsh, size_t expected)
+{
+ struct container5 *sdata =
+ (struct container5 *) ((void *) ifmsh
+ - __builtin_offsetof (struct container5, s.mesh));
+
+
+ if (__builtin_dynamic_object_size (sdata->mcast_rate, 1)
+ != sizeof (sdata->mcast_rate))
+ FAIL ();
+
+ if (__builtin_dynamic_object_size (&sdata->s.mesh, 1) != expected)
+ FAIL ();
+}
+
+void
+__attribute__((noinline))
+test5 (size_t sz)
+{
+ struct container5 *sdata = __builtin_malloc (sz);
+ struct inner **ifmsh = &sdata->s.mesh;
+ size_t diff = sizeof (*sdata) - sz;
+
+ test5_child (ifmsh, MAX(sizeof (sdata->s.mesh), diff) - diff);
+
+ __builtin_free (sdata);
+}
+
+int
+main (void)
+{
+ test1 (sizeof (struct container));
+ test1 (sizeof (struct container) - sizeof (int));
+ test1 (sizeof (int) * NUM_MCAST_RATE - 1);
+
+ test2 (sizeof (struct container2));
+ test2 (sizeof (struct container2) - sizeof (int));
+ test2 (sizeof (int) * NUM_MCAST_RATE - 1);
+
+ test3 (sizeof (struct container3));
+ test3 (sizeof (struct container3) - sizeof (int));
+ test3 (sizeof (int) * NUM_MCAST_RATE - 1);
+
+ test4 (sizeof (struct container4));
+ test4 (sizeof (struct container4) - sizeof (int));
+ test4 (sizeof (int) * NUM_MCAST_RATE - 1);
+
+ test5 (sizeof (struct container5));
+ test5 (sizeof (struct container5) - sizeof (int));
+ test5 (sizeof (int) * NUM_MCAST_RATE - 1);
+
+ DONE ();
+}
diff --git a/gcc/testsuite/gcc.dg/builtins-1.c b/gcc/testsuite/gcc.dg/builtins-1.c
index 6128642..8ddf370 100644
--- a/gcc/testsuite/gcc.dg/builtins-1.c
+++ b/gcc/testsuite/gcc.dg/builtins-1.c
@@ -114,16 +114,21 @@ _Complex long double test_##FN##l(_Complex long double x, _Complex long double y
/* Keep this list sorted alphabetically by function name. */
FPTEST1 (acos)
FPTEST1 (acosh)
+FPTEST1 (acospi)
FPTEST1 (asin)
FPTEST1 (asinh)
+FPTEST1 (asinpi)
FPTEST1 (atan)
FPTEST2 (atan2)
+FPTEST2 (atan2pi)
FPTEST1 (atanh)
+FPTEST1 (atanpi)
FPTEST1 (cbrt)
FPTEST1 (ceil)
FPTEST2 (copysign)
FPTEST1 (cos)
FPTEST1 (cosh)
+FPTEST1 (cospi)
FPTEST2 (drem)
FPTEST1 (erf)
FPTEST1 (erfc)
@@ -178,9 +183,11 @@ FPTEST1 (significand)
FPTEST1 (sin)
FPTEST3FPP23VOID (sincos)
FPTEST1 (sinh)
+FPTEST1 (sinpi)
FPTEST1 (sqrt)
FPTEST1 (tan)
FPTEST1 (tanh)
+FPTEST1 (tanpi)
FPTEST1 (tgamma)
FPTEST1 (trunc)
FPTEST1 (y0)
diff --git a/gcc/testsuite/gcc.dg/c23-builtins-1.c b/gcc/testsuite/gcc.dg/c23-builtins-1.c
index 39f0ea4..fe67964 100644
--- a/gcc/testsuite/gcc.dg/c23-builtins-1.c
+++ b/gcc/testsuite/gcc.dg/c23-builtins-1.c
@@ -3,11 +3,33 @@
/* { dg-do compile } */
/* { dg-options "-std=c23" } */
+/* Keep this list sorted alphabetically by function name. */
+int acospi (void); /* { dg-warning "conflicting types for built-in function" } */
+int acospif (void); /* { dg-warning "conflicting types for built-in function" } */
+int acospil (void); /* { dg-warning "conflicting types for built-in function" } */
+int asinpi (void); /* { dg-warning "conflicting types for built-in function" } */
+int asinpif (void); /* { dg-warning "conflicting types for built-in function" } */
+int asinpil (void); /* { dg-warning "conflicting types for built-in function" } */
+int atan2pi (void); /* { dg-warning "conflicting types for built-in function" } */
+int atan2pif (void); /* { dg-warning "conflicting types for built-in function" } */
+int atan2pil (void); /* { dg-warning "conflicting types for built-in function" } */
+int atanpi (void); /* { dg-warning "conflicting types for built-in function" } */
+int atanpif (void); /* { dg-warning "conflicting types for built-in function" } */
+int atanpil (void); /* { dg-warning "conflicting types for built-in function" } */
+int cospi (void); /* { dg-warning "conflicting types for built-in function" } */
+int cospif (void); /* { dg-warning "conflicting types for built-in function" } */
+int cospil (void); /* { dg-warning "conflicting types for built-in function" } */
int exp10 (void); /* { dg-warning "conflicting types for built-in function" } */
int exp10f (void); /* { dg-warning "conflicting types for built-in function" } */
int exp10l (void); /* { dg-warning "conflicting types for built-in function" } */
int roundeven (void); /* { dg-warning "conflicting types for built-in function" } */
int roundevenf (void); /* { dg-warning "conflicting types for built-in function" } */
int roundevenl (void); /* { dg-warning "conflicting types for built-in function" } */
+int sinpi (void); /* { dg-warning "conflicting types for built-in function" } */
+int sinpif (void); /* { dg-warning "conflicting types for built-in function" } */
+int sinpil (void); /* { dg-warning "conflicting types for built-in function" } */
int strdup (void); /* { dg-warning "conflicting types for built-in function" } */
int strndup (void); /* { dg-warning "conflicting types for built-in function" } */
+int tanpi (void); /* { dg-warning "conflicting types for built-in function" } */
+int tanpif (void); /* { dg-warning "conflicting types for built-in function" } */
+int tanpil (void); /* { dg-warning "conflicting types for built-in function" } */
diff --git a/gcc/testsuite/gcc.dg/countof-compat.c b/gcc/testsuite/gcc.dg/countof-compat.c
new file mode 100644
index 0000000..ab5b4ae
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/countof-compat.c
@@ -0,0 +1,8 @@
+/* { dg-do compile } */
+/* { dg-options "-std=c2y -pedantic-errors -Wc23-c2y-compat" } */
+
+#include <stdcountof.h>
+
+int a[1];
+int b[countof(a)];
+int c[_Countof(a)]; /* { dg-warning "ISO C does not support" } */
diff --git a/gcc/testsuite/gcc.dg/countof-compile.c b/gcc/testsuite/gcc.dg/countof-compile.c
new file mode 100644
index 0000000..afd5659
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/countof-compile.c
@@ -0,0 +1,124 @@
+/* { dg-do compile } */
+/* { dg-options "-std=c2y -pedantic-errors" } */
+
+#define NULL ((void *) 0)
+
+extern int x[];
+
+static int w[] = {1, 2, 3};
+
+void
+completed (void)
+{
+ int i = 42;
+ int a[] = {1, 2, i};
+
+ _Static_assert(_Countof (w) == 3);
+ _Static_assert(_Countof (a) == 3);
+}
+
+void
+incomplete (int p[])
+{
+ _Countof (x); /* { dg-error "incomplete" } */
+
+ /* We want to support array parameters in the future,
+ which should change this from "invalid" to "incomplete". */
+ _Countof (p); /* { dg-error "invalid" } */
+}
+
+void
+fam (void)
+{
+ struct {
+ int x;
+ int fam[];
+ } s;
+
+ _Countof (s.fam); /* { dg-error "incomplete" } */
+}
+
+void
+param (int n, int p[n])
+{
+ /* We want to support array parameters in the future,
+ which would make this work. */
+ _Countof (p); /* { dg-error "invalid" } */
+}
+
+void fix_fix (int i, char (*a)[3][5], int (*x)[_Countof (*a)],
+ short (*)[_Generic(x, int (*)[3]: 1)]);
+void fix_var (int i, char (*a)[3][i], int (*x)[_Countof (*a)],
+ short (*)[_Generic(x, int (*)[3]: 1)]);
+void fix_uns (int i, char (*a)[3][*], int (*x)[_Countof (*a)],
+ short (*)[_Generic(x, int (*)[3]: 1)]);
+
+void
+func (void)
+{
+ int i3[3];
+ int i5[5];
+ char c35[3][5];
+
+ fix_fix (5, &c35, &i3, NULL);
+ fix_fix (5, &c35, &i5, NULL); /* { dg-error "incompatible-pointer-types" } */
+
+ fix_var (5, &c35, &i3, NULL);
+ fix_var (5, &c35, &i5, NULL); /* { dg-error "incompatible-pointer-types" } */
+
+ fix_uns (5, &c35, &i3, NULL);
+ fix_uns (5, &c35, &i5, NULL); /* { dg-error "incompatible-pointer-types" } */
+}
+
+void
+non_arr(void)
+{
+ int x;
+ int *p;
+ struct s {
+ int x[3];
+ } s;
+
+ _Countof (x); /* { dg-error "invalid" } */
+ _Countof (int); /* { dg-error "invalid" } */
+ _Countof (s); /* { dg-error "invalid" } */
+ _Countof (struct s); /* { dg-error "invalid" } */
+ _Countof (&x); /* { dg-error "invalid" } */
+ _Countof (p); /* { dg-error "invalid" } */
+ _Countof (int *); /* { dg-error "invalid" } */
+ _Countof (&s.x); /* { dg-error "invalid" } */
+ _Countof (int (*)[3]); /* { dg-error "invalid" } */
+}
+
+static int f1();
+static int f2(); /* { dg-error "never defined" } */
+int a[10][9];
+int n;
+
+void
+syms(void)
+{
+ int b[n][n];
+
+ _Countof (a[f1()]);
+ _Countof (b[f2()]);
+}
+
+void
+no_parens(void)
+{
+ _Static_assert(_Countof a == 10);
+ _Static_assert(_Countof *a == 9);
+ _Static_assert(_Countof (int [3]) {} == 3);
+
+ _Countof int [3]; /* { dg-error "expected expression before" } */
+}
+
+void
+const_expr(void)
+{
+ int n = 7;
+
+ _Static_assert (_Countof (int [3][n]) == 3);
+ _Static_assert (_Countof (int [n][3]) == 7); /* { dg-error "not constant" } */
+}
diff --git a/gcc/testsuite/gcc.dg/countof-no-compat.c b/gcc/testsuite/gcc.dg/countof-no-compat.c
new file mode 100644
index 0000000..4a244cf
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/countof-no-compat.c
@@ -0,0 +1,5 @@
+/* { dg-do compile } */
+/* { dg-options "-std=c23 -pedantic-errors -Wno-c23-c2y-compat" } */
+
+int a[1];
+int b[_Countof(a)];
diff --git a/gcc/testsuite/gcc.dg/countof-pedantic-errors.c b/gcc/testsuite/gcc.dg/countof-pedantic-errors.c
new file mode 100644
index 0000000..5d5bedb
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/countof-pedantic-errors.c
@@ -0,0 +1,8 @@
+/* { dg-do compile } */
+/* { dg-options "-std=c23 -pedantic-errors" } */
+
+#include <stdcountof.h>
+
+int a[1];
+int b[countof(a)];
+int c[_Countof(a)]; /* { dg-error "ISO C does not support" } */
diff --git a/gcc/testsuite/gcc.dg/countof-pedantic.c b/gcc/testsuite/gcc.dg/countof-pedantic.c
new file mode 100644
index 0000000..408dc6f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/countof-pedantic.c
@@ -0,0 +1,8 @@
+/* { dg-do compile } */
+/* { dg-options "-std=c23 -pedantic" } */
+
+#include <stdcountof.h>
+
+int a[1];
+int b[countof(a)];
+int c[_Countof(a)]; /* { dg-warning "ISO C does not support" } */
diff --git a/gcc/testsuite/gcc.dg/countof-stdcountof.c b/gcc/testsuite/gcc.dg/countof-stdcountof.c
new file mode 100644
index 0000000..2fb0c63
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/countof-stdcountof.c
@@ -0,0 +1,24 @@
+/* { dg-do run } */
+/* { dg-options "-std=c2y -pedantic-errors" } */
+
+#include <stdcountof.h>
+
+#define assert(e) ((e) ? (void) 0 : __builtin_abort ())
+
+extern int strcmp (const char *, const char *);
+
+#ifndef countof
+#error "countof not defined"
+#endif
+
+int a[3];
+int b[countof a];
+
+#define str(x) #x
+#define xstr(x) str(x)
+
+int
+main (void)
+{
+ assert (strcmp (xstr(countof), "_Countof") == 0);
+}
diff --git a/gcc/testsuite/gcc.dg/countof-vla.c b/gcc/testsuite/gcc.dg/countof-vla.c
new file mode 100644
index 0000000..cc225df
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/countof-vla.c
@@ -0,0 +1,35 @@
+/* { dg-do compile } */
+/* { dg-options "-std=c2y -pedantic-errors -Wvla-parameter" } */
+
+void fix_fix (int i,
+ char (*a)[3][5],
+ int (*x)[_Countof (*a)],
+ short (*)[_Generic(x, int (*)[3]: 1)]);
+void fix_var (int i,
+ char (*a)[3][i], /* dg-warn "variable" */
+ int (*x)[_Countof (*a)],
+ short (*)[_Generic(x, int (*)[3]: 1)]);
+void fix_uns (int i,
+ char (*a)[3][*],
+ int (*x)[_Countof (*a)],
+ short (*)[_Generic(x, int (*)[3]: 1)]);
+
+void var_fix (int i,
+ char (*a)[i][5], /* dg-warn "variable" */
+ int (*x)[_Countof (*a)]); /* dg-warn "variable" */
+void var_var (int i,
+ char (*a)[i][i], /* dg-warn "variable" */
+ int (*x)[_Countof (*a)]); /* dg-warn "variable" */
+void var_uns (int i,
+ char (*a)[i][*], /* dg-warn "variable" */
+ int (*x)[_Countof (*a)]); /* dg-warn "variable" */
+
+void uns_fix (int i,
+ char (*a)[*][5],
+ int (*x)[_Countof (*a)]);
+void uns_var (int i,
+ char (*a)[*][i], /* dg-warn "variable" */
+ int (*x)[_Countof (*a)]);
+void uns_uns (int i,
+ char (*a)[*][*],
+ int (*x)[_Countof (*a)]);
diff --git a/gcc/testsuite/gcc.dg/countof-vmt.c b/gcc/testsuite/gcc.dg/countof-vmt.c
new file mode 100644
index 0000000..67467b0
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/countof-vmt.c
@@ -0,0 +1,20 @@
+/* { dg-do run } */
+/* { dg-options "-std=gnu2y" } */
+
+#define assert(e) ((e) ? (void) 0 : __builtin_abort ())
+
+void
+inner_vla_noeval (void)
+{
+ int i;
+
+ i = 3;
+ static_assert (_Countof (struct {int x[i++];}[3]) == 3);
+ assert (i == 3);
+}
+
+int
+main (void)
+{
+ inner_vla_noeval ();
+}
diff --git a/gcc/testsuite/gcc.dg/countof-zero-compile.c b/gcc/testsuite/gcc.dg/countof-zero-compile.c
new file mode 100644
index 0000000..b561186
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/countof-zero-compile.c
@@ -0,0 +1,38 @@
+/* { dg-do compile } */
+/* { dg-options "-std=gnu2y" } */
+
+static int z[0];
+static int y[_Countof (z)];
+
+_Static_assert(_Countof (y) == 0);
+
+void
+completed (void)
+{
+ int z[] = {};
+
+ static_assert (_Countof (z) == 0);
+}
+
+void zro_fix (int i,
+ char (*a)[0][5],
+ int (*x)[_Countof (*a)],
+ short (*)[_Generic(x, int (*)[0]: 1)]);
+void zro_var (int i,
+ char (*a)[0][i], /* dg-warn "variable" */
+ int (*x)[_Countof (*a)],
+ short (*)[_Generic(x, int (*)[0]: 1)]);
+void zro_uns (int i,
+ char (*a)[0][*],
+ int (*x)[_Countof (*a)],
+ short (*)[_Generic(x, int (*)[0]: 1)]);
+
+void
+const_expr(void)
+{
+ int n = 7;
+
+ _Static_assert (_Countof (int [0][3]) == 0);
+ _Static_assert (_Countof (int [0]) == 0);
+ _Static_assert (_Countof (int [0][n]) == 0);
+}
diff --git a/gcc/testsuite/gcc.dg/countof-zero.c b/gcc/testsuite/gcc.dg/countof-zero.c
new file mode 100644
index 0000000..27b5bdd
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/countof-zero.c
@@ -0,0 +1,31 @@
+/* { dg-do run } */
+/* { dg-options "-std=gnu2y" } */
+
+#define assert(e) ((e) ? (void) 0 : __builtin_abort ())
+
+void
+vla (void)
+{
+ unsigned n;
+
+ n = 0;
+ int z[n];
+ assert (_Countof (z) == 0);
+}
+
+void
+matrix_vla (void)
+{
+ int i;
+
+ i = 0;
+ assert (_Countof (int [i++][4]) == 0);
+ assert (i == 0 + 1);
+}
+
+int
+main (void)
+{
+ vla ();
+ matrix_vla ();
+}
diff --git a/gcc/testsuite/gcc.dg/countof.c b/gcc/testsuite/gcc.dg/countof.c
new file mode 100644
index 0000000..5344885
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/countof.c
@@ -0,0 +1,120 @@
+/* { dg-do run } */
+/* { dg-options "-std=c2y -pedantic-errors" } */
+
+#define assert(e) ((e) ? (void) 0 : __builtin_abort ())
+
+void
+array (void)
+{
+ short a[7];
+
+ static_assert (_Countof (a) == 7);
+ static_assert (_Countof (unsigned [99]) == 99);
+}
+
+void
+completed (void)
+{
+ int a[] = {1, 2, 3};
+
+ static_assert (_Countof (a) == 3);
+}
+
+void
+vla (void)
+{
+ unsigned n;
+
+ n = 99;
+ assert (_Countof (short [n - 10]) == 99 - 10);
+
+ int v[n / 2];
+ assert (_Countof (v) == 99 / 2);
+}
+
+void
+member (void)
+{
+ struct {
+ int a[8];
+ } s;
+
+ static_assert (_Countof (s.a) == 8);
+}
+
+void
+vla_eval (void)
+{
+ int i;
+
+ i = 7;
+ assert (_Countof (struct {int x;}[i++]) == 7);
+ assert (i == 7 + 1);
+
+ int v[i];
+ int (*p)[i];
+ p = &v;
+ assert (_Countof (*p++) == i);
+ assert (p - 1 == &v);
+}
+
+void
+array_noeval (void)
+{
+ long a[5];
+ long (*p)[_Countof (a)];
+
+ p = &a;
+ static_assert (_Countof (*p++) == 5);
+ assert (p == &a);
+}
+
+void
+matrix_fixed (void)
+{
+ int i;
+
+ static_assert (_Countof (int [7][4]) == 7);
+ i = 3;
+ static_assert (_Countof (int [7][i]) == 7);
+}
+
+void
+matrix_vla (void)
+{
+ int i, j;
+
+ i = 7;
+ assert (_Countof (int [i++][4]) == 7);
+ assert (i == 7 + 1);
+
+ i = 9;
+ j = 3;
+ assert (_Countof (int [i++][j]) == 9);
+ assert (i == 9 + 1);
+}
+
+void
+no_parens(void)
+{
+ int n = 3;
+ int a[7];
+ int v[n];
+
+ static_assert (_Countof a == 7);
+ assert (_Countof v == 3);
+}
+
+int
+main (void)
+{
+ array ();
+ completed ();
+ vla ();
+ member ();
+ vla_eval ();
+ array_noeval ();
+ matrix_fixed ();
+ matrix_vla ();
+ no_parens ();
+}
diff --git a/gcc/testsuite/gcc.dg/crc-non-cst-poly-1.c b/gcc/testsuite/gcc.dg/crc-non-cst-poly-1.c
new file mode 100644
index 0000000..0c3d905
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/crc-non-cst-poly-1.c
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-options "" } */
+
+/* PR middle-end/120709 */
+/* Make sure we don't ICE on a non-constant poly argument. */
+
+
+typedef unsigned char uint8_t;
+uint8_t crc8_data8(uint8_t crc, uint8_t data, uint8_t polynomial) {
+ return __builtin_rev_crc32_data8 (crc, data, polynomial); /* { dg-error "must be a constant" } */
+}
diff --git a/gcc/testsuite/gcc.dg/cwsc1.c b/gcc/testsuite/gcc.dg/cwsc1.c
index e793e26..cccf413 100644
--- a/gcc/testsuite/gcc.dg/cwsc1.c
+++ b/gcc/testsuite/gcc.dg/cwsc1.c
@@ -6,7 +6,11 @@
#elif defined(__i386__)
# define CHAIN "%ecx"
#elif defined(__aarch64__)
-# define CHAIN "x18"
+# if defined __vxworks
+# define CHAIN "x9"
+# else
+# define CHAIN "x18"
+# endif
#elif defined(__alpha__)
# define CHAIN "$1"
#elif defined(__arm__)
diff --git a/gcc/testsuite/gcc.dg/dfp/bitint-10.c b/gcc/testsuite/gcc.dg/dfp/bitint-10.c
new file mode 100644
index 0000000..4a73aeb
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/dfp/bitint-10.c
@@ -0,0 +1,49 @@
+/* PR middle-end/120631 */
+/* { dg-require-effective-target bitint } */
+/* { dg-options "-O2" } */
+
+#if __BITINT_MAXWIDTH__ >= 128
+_Decimal128 a = 123456789135792468012345678900000000000.0dl;
+_BitInt(128) b = 123456789135792468012345678900000000000wb;
+_Decimal64 c = 12345678913579000000000000000000000000.0dd;
+_BitInt(127) d = 12345678913579000000000000000000000000wb;
+#endif
+#if __BITINT_MAXWIDTH__ >= 256
+_Decimal128 m = 1234567891357924680123456789000000000000000000000000000000000000000000000000.0dl;
+_BitInt(256) n = 1234567891357924680123456789000000000000000000000000000000000000000000000000wb;
+_Decimal64 o = 1234567891357900000000000000000000000000000000000000000000000000000000000000.0dd;
+_BitInt(255) p = 1234567891357900000000000000000000000000000000000000000000000000000000000000wb;
+#endif
+
+int
+main ()
+{
+#if __BITINT_MAXWIDTH__ >= 128
+ if (a != b || (_BitInt(128)) a != b || c != d || (_BitInt(127)) c != d)
+ __builtin_abort ();
+ _Decimal128 e = 123456789135792468012345678900000000000.0dl;
+ _BitInt(128) f = 123456789135792468012345678900000000000wb;
+ _Decimal128 g = 123456789135792468012345678900000000000wb;
+ _BitInt(128) h = 123456789135792468012345678900000000000.0dl;
+ _Decimal64 i = 12345678913579000000000000000000000000.0dd;
+ _BitInt(128) j = 12345678913579000000000000000000000000wb;
+ _Decimal64 k = 12345678913579000000000000000000000000wb;
+ _BitInt(128) l = 12345678913579000000000000000000000000.0dd;
+ if (e != g || f != h || i != k || j != l)
+ __builtin_abort ();
+#endif
+#if __BITINT_MAXWIDTH__ >= 256
+ if (m != n || (_BitInt(256)) m != n || o != p || (_BitInt(255)) o != p)
+ __builtin_abort ();
+ _Decimal128 q = 1234567891357924680123456789000000000000000000000000000000000000000000000000.0dl;
+ _BitInt(256) r = 1234567891357924680123456789000000000000000000000000000000000000000000000000wb;
+ _Decimal128 s = 1234567891357924680123456789000000000000000000000000000000000000000000000000wb;
+ _BitInt(256) t = 1234567891357924680123456789000000000000000000000000000000000000000000000000.0dl;
+ _Decimal64 u = 1234567891357900000000000000000000000000000000000000000000000000000000000000.0dd;
+ _BitInt(255) v = 1234567891357900000000000000000000000000000000000000000000000000000000000000wb;
+ _Decimal64 w = 1234567891357900000000000000000000000000000000000000000000000000000000000000wb;
+ _BitInt(255) x = 1234567891357900000000000000000000000000000000000000000000000000000000000000.0dd;
+ if (q != s || r != t || u != w || v != x)
+ __builtin_abort ();
+#endif
+}
diff --git a/gcc/testsuite/gcc.dg/dfp/bitint-9.c b/gcc/testsuite/gcc.dg/dfp/bitint-9.c
new file mode 100644
index 0000000..3161487
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/dfp/bitint-9.c
@@ -0,0 +1,29 @@
+/* PR middle-end/120631 */
+/* { dg-require-effective-target bitint } */
+/* { dg-options "-O2" } */
+
+#if __BITINT_MAXWIDTH__ >= 2048
+_Decimal128 a = 123456789135792468012345678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0dl;
+_BitInt(2048) b = 123456789135792468012345678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000wb;
+_Decimal64 c = 123456789135790000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0dd;
+_BitInt(1536) d = 123456789135790000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000wb;
+#endif
+
+int
+main ()
+{
+#if __BITINT_MAXWIDTH__ >= 2048
+ if (a != b || (_BitInt(2048)) a != b || c != d || (_BitInt(1536)) c != d)
+ __builtin_abort ();
+ _Decimal128 e = 123456789135792468012345678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0dl;
+ _BitInt(2048) f = 123456789135792468012345678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000wb;
+ _Decimal128 g = 123456789135792468012345678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000wb;
+ _BitInt(2048) h = 123456789135792468012345678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0dl;
+ _Decimal64 i = 123456789135790000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0dd;
+ _BitInt(1536) j = 123456789135790000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000wb;
+ _Decimal64 k = 123456789135790000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000wb;
+ _BitInt(1536) l = 123456789135790000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0dd;
+ if (e != g || f != h || i != k || j != l)
+ __builtin_abort ();
+#endif
+}
diff --git a/gcc/testsuite/gcc.dg/dfp/pr120631.c b/gcc/testsuite/gcc.dg/dfp/pr120631.c
new file mode 100644
index 0000000..2533e9d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/dfp/pr120631.c
@@ -0,0 +1,24 @@
+/* PR middle-end/120631 */
+/* { dg-options "-O2" } */
+
+_Decimal64 a = 1234567891357900000.0dd;
+long long b = 1234567891357900000LL;
+_Decimal32 c = 1234567000000000000.0df;
+long long d = 1234567000000000000LL;
+
+int
+main ()
+{
+ if (a != b || (long long) a != b || c != d || (long long) c != d)
+ __builtin_abort ();
+ _Decimal64 e = 1234567891357900000.0dd;
+ long long f = 1234567891357900000LL;
+ _Decimal64 g = 1234567891357900000LL;
+ long long h = 1234567891357900000.0dd;
+ _Decimal32 i = 1234567000000000000.0df;
+ long long j = 1234567000000000000LL;
+ _Decimal32 k = 1234567000000000000LL;
+ long long l = 1234567000000000000.0df;
+ if (e != g || f != h || i != k || j != l)
+ __builtin_abort ();
+}
diff --git a/gcc/testsuite/gcc.dg/flex-array-counted-by-pr121000.c b/gcc/testsuite/gcc.dg/flex-array-counted-by-pr121000.c
new file mode 100644
index 0000000..5b9a2c6
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/flex-array-counted-by-pr121000.c
@@ -0,0 +1,43 @@
+/* PR middle-end/121000 */
+/* { dg-do run } */
+/* { dg-options "-O" } */
+
+#include "builtin-object-size-common.h"
+
+/* The parameter m must be const qualified to avoid the m is
+ marked as TREE_SIDE_EFFECTS in IR.
+ The __builtin_dynamic_object_size will be folded as -1 by
+ fold_builtin_object_size when m is NOT const qualified. */
+
+void
+foo (int n, const int m)
+{
+ typedef int A[m];
+ struct S { int n, m; A a[2]; A b[] __attribute__((counted_by (n))); } *p;
+ p = __builtin_malloc (sizeof (struct S) + sizeof (A) * n);
+ p->n = n;
+ p->m = m;
+ EXPECT (__builtin_dynamic_object_size (p->b, 1), sizeof (A) * n);
+}
+
+/* The parameter m1, m2 must be const qualified to avoid the m is
+ marked as TREE_SIDE_EFFECTS in IR.
+ The __builtin_dynamic_object_size will be folded as -1 by
+ fold_builtin_object_size when m1 or m2 is NOT const qualified. */
+void
+foo_1 (int n, const int m1, const int m2)
+{
+ typedef int A[m1][m2];
+ struct S { int n; A a[2]; A b[] __attribute__((counted_by (n))); } *p;
+ p = __builtin_malloc (sizeof (struct S) + sizeof (A) * n);
+ p->n = n;
+ EXPECT (__builtin_dynamic_object_size (p->b, 1), sizeof (A) * n);
+}
+
+int
+main ()
+{
+ foo (2, 10);
+ foo_1 (2, 10, 20);
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/fold-copysign-1.c b/gcc/testsuite/gcc.dg/fold-copysign-1.c
index 1f5141b..b65c08b 100644
--- a/gcc/testsuite/gcc.dg/fold-copysign-1.c
+++ b/gcc/testsuite/gcc.dg/fold-copysign-1.c
@@ -1,6 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-O -fdump-tree-cddce1" } */
-/* { dg-additional-options "-msse -mfpmath=sse" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
+/* { dg-additional-options "-msse2 -mfpmath=sse" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
/* { dg-additional-options "-mdouble=64" { target { avr-*-* } } } */
double foo (double x)
diff --git a/gcc/testsuite/gcc.dg/format/colors.c b/gcc/testsuite/gcc.dg/format/colors.c
index 43484b7..42cfd50 100644
--- a/gcc/testsuite/gcc.dg/format/colors.c
+++ b/gcc/testsuite/gcc.dg/format/colors.c
@@ -15,8 +15,8 @@ void test_mismatching_types (const char *msg)
warning: format '%i' expects argument of type 'int', but argument 2 has type 'const char *' [-Wformat=]
{ dg-end-multiline-output "" } */
/* { dg-begin-multiline-output "" }
- printf("hello %i", msg);
- ~^ ~~~
+ printf("hello %i", msg);
+ ~^ ~~~
| |
int const char *
%s
diff --git a/gcc/testsuite/gcc.dg/format/diagnostic-ranges-html.py b/gcc/testsuite/gcc.dg/format/diagnostic-ranges-html.py
new file mode 100644
index 0000000..b0b59d9
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/format/diagnostic-ranges-html.py
@@ -0,0 +1,79 @@
+from htmltest import *
+
+import pytest
+
+@pytest.fixture(scope='function', autouse=True)
+def html_tree():
+ return html_tree_from_env()
+
+def assert_highlighted_text(element, expected_highlight, expected_text):
+ assert_tag(element, 'span')
+ assert_class(element, expected_highlight)
+ assert element.text == expected_text
+
+def test_message(html_tree):
+ """
+ Verify that the quoted text in the message has the correct
+ highlight colors.
+ """
+ diag = get_diag_by_index(html_tree, 0)
+ msg = get_message_within_diag(diag)
+
+ assert_tag(msg[0], 'strong')
+ assert msg[0].text == 'warning: '
+
+ assert_tag(msg[1], 'span')
+ assert_class(msg[1], 'gcc-quoted-text')
+ assert_highlighted_text(msg[1][0], 'highlight-a', '%i')
+
+ assert_tag(msg[2], 'span')
+ assert_class(msg[2], 'gcc-quoted-text')
+ assert_highlighted_text(msg[2][0], 'highlight-a', 'int')
+
+ assert_tag(msg[3], 'span')
+ assert_class(msg[3], 'gcc-quoted-text')
+ assert_highlighted_text(msg[3][0], 'highlight-b', 'const char *')
+
+def test_annotations(html_tree):
+ """
+ Verify that the labels in the annotations have the correct
+ highlight colors.
+ """
+ diag = get_diag_by_index(html_tree, 0)
+ locus = get_locus_within_diag(diag)
+ tbody = locus.find('xhtml:tbody', ns)
+ assert tbody.attrib['class'] == 'line-span'
+
+ rows = tbody.findall('xhtml:tr', ns)
+
+ # Source row
+ row = rows[0]
+ tds = row.findall('xhtml:td', ns)
+ assert len(tds) == 2
+ assert_class(tds[1], 'source')
+ assert_highlighted_text(tds[1][0], 'highlight-a', '%i')
+ assert_highlighted_text(tds[1][1], 'highlight-b', 'msg')
+
+ # Underline row:
+ row = rows[1]
+ tds = row.findall('xhtml:td', ns)
+ assert len(tds) == 2
+ assert_class(tds[1], 'annotation')
+ assert_highlighted_text(tds[1][0], 'highlight-a', '~^')
+ assert_highlighted_text(tds[1][1], 'highlight-b', '~~~')
+
+ # vline row:
+ row = rows[2]
+ tds = row.findall('xhtml:td', ns)
+ assert len(tds) == 2
+ assert_class(tds[1], 'annotation')
+ assert_highlighted_text(tds[1][0], 'highlight-a', '|')
+ assert_highlighted_text(tds[1][1], 'highlight-b', '|')
+
+ # Label row:
+ row = rows[3]
+ tds = row.findall('xhtml:td', ns)
+ assert len(tds) == 2
+ assert_class(tds[1], 'annotation')
+ assert_highlighted_text(tds[1][0], 'highlight-a', 'int')
+ assert_highlighted_text(tds[1][1], 'highlight-b', 'const char *')
diff --git a/gcc/testsuite/gcc.dg/format/diagnostic-ranges.c b/gcc/testsuite/gcc.dg/format/diagnostic-ranges.c
index 2c33ce2..d3e334d 100644
--- a/gcc/testsuite/gcc.dg/format/diagnostic-ranges.c
+++ b/gcc/testsuite/gcc.dg/format/diagnostic-ranges.c
@@ -1,4 +1,4 @@
-/* { dg-options "-Wformat -fdiagnostics-show-caret" } */
+/* { dg-options "-Wformat -fdiagnostics-show-caret -fdiagnostics-add-output=experimental-html:javascript=no" } */
/* See PR 52952. */
@@ -390,3 +390,7 @@ void test_const_arrays (void)
double
{ dg-end-multiline-output "" } */
}
+
+/* Use a Python script to verify various properties about the generated
+ HTML file:
+ { dg-final { run-html-pytest diagnostic-ranges.c "diagnostic-ranges-html.py" } } */
diff --git a/gcc/testsuite/gcc.dg/gnu23-tag-composite-6.c b/gcc/testsuite/gcc.dg/gnu23-tag-composite-6.c
new file mode 100644
index 0000000..076c066
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gnu23-tag-composite-6.c
@@ -0,0 +1,31 @@
+/* { dg-do compile } */
+/* { dg-options "-std=gnu23" } */
+
+#define NEST(...) typeof(({ (__VA_ARGS__){ }; }))
+
+int f()
+{
+ typedef struct foo bar;
+ struct foo { NEST(struct foo { bar *x; }) *x; } *q;
+ typeof(q->x) p0;
+ typeof(q->x) p1;
+ 1 ? p0 : q;
+ 1 ? p1 : q;
+ 1 ? p0 : p1;
+}
+
+int g()
+{
+ typedef struct fo2 bar;
+ struct fo2 { NEST(struct fo2 { NEST(struct fo2 { bar *x; }) * x; }) *x; } *q;
+ typeof(q->x) p0;
+ typeof(q->x->x) p1;
+ typeof(q->x->x->x) p2;
+ 1 ? p0 : q;
+ 1 ? p1 : q;
+ 1 ? p2 : q;
+ 1 ? p0 : p1;
+ 1 ? p2 : p1;
+ 1 ? p0 : p2;
+}
+
diff --git a/gcc/testsuite/gcc.dg/gomp/declare-mapper-10.c b/gcc/testsuite/gcc.dg/gomp/declare-mapper-10.c
new file mode 100644
index 0000000..efc9c13
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gomp/declare-mapper-10.c
@@ -0,0 +1,61 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-fdump-tree-gimple" } */
+
+// "omp declare mapper" support -- check expansion in gimple.
+
+#include <stdlib.h>
+
+struct S {
+ int *ptr;
+ int size;
+};
+
+#define N 64
+
+#pragma omp declare mapper (struct S w) map(w.size, w.ptr, w.ptr[:w.size])
+#pragma omp declare mapper (foo:struct S w) map(to:w.size, w.ptr) \
+ map(w.ptr[:w.size])
+
+int main (int argc, char *argv[])
+{
+ struct S s;
+ s.ptr = (int *) malloc (sizeof (int) * N);
+ s.size = N;
+
+#pragma omp declare mapper (bar:struct S w) map(w.size, w.ptr, w.ptr[:w.size])
+
+#pragma omp target
+ {
+ for (int i = 0; i < N; i++)
+ s.ptr[i]++;
+ }
+
+#pragma omp target map(tofrom: s)
+ {
+ for (int i = 0; i < N; i++)
+ s.ptr[i]++;
+ }
+
+#pragma omp target map(mapper(default), tofrom: s)
+ {
+ for (int i = 0; i < N; i++)
+ s.ptr[i]++;
+ }
+
+#pragma omp target map(mapper(foo), alloc: s)
+ {
+ for (int i = 0; i < N; i++)
+ s.ptr[i]++;
+ }
+
+#pragma omp target map(mapper(bar), tofrom: s)
+ {
+ for (int i = 0; i < N; i++)
+ s.ptr[i]++;
+ }
+
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times {map\(struct:s \[len: 2\]\) map\(tofrom:s\.ptr \[len: [0-9]+\]\) map\(tofrom:s\.size \[len: [0-9]+\]\) map\(tofrom:\*_[0-9]+ \[len: _[0-9]+\]\) map\(attach:s\.ptr \[bias: 0\]\)} 4 "gimple" { target c++ } } } */
+/* { dg-final { scan-tree-dump-times {map\(struct:s \[len: 2\]\) map\(to:s\.ptr \[len: [0-9]+\]\) map\(to:s\.size \[len: [0-9]+\]\) map\(alloc:\*_[0-9]+ \[len: _[0-9]+\]\) map\(attach:s\.ptr \[bias: 0\]\)} 1 "gimple" { target c++ } } } */
diff --git a/gcc/testsuite/gcc.dg/gomp/declare-mapper-11.c b/gcc/testsuite/gcc.dg/gomp/declare-mapper-11.c
new file mode 100644
index 0000000..108a297
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gomp/declare-mapper-11.c
@@ -0,0 +1,33 @@
+// { dg-do compile }
+
+// Error-checking tests for "omp declare mapper".
+
+typedef struct {
+ int *ptr;
+ int size;
+} S;
+
+typedef struct {
+ int z;
+} Z;
+
+int main (int argc, char *argv[])
+{
+#pragma omp declare mapper (S v) map(v.size, v.ptr[:v.size])
+/* { dg-note "'#pragma omp declare mapper' previously declared here" "" { target c } .-1 } */
+
+ /* This one's a duplicate. */
+#pragma omp declare mapper (default: S v) map (to: v.size) map (v)
+/* { dg-error "redeclaration of '<default>' '#pragma omp declare mapper' for type 'S'" "" { target c } .-1 } */
+
+ /* ...and this one doesn't use a "base language identifier" for the mapper
+ name. */
+#pragma omp declare mapper (case: S v) map (to: v.size)
+/* { dg-error "expected identifier or 'default'" "" { target c } .-1 } */
+
+ /* A non-struct/class/union type isn't supposed to work. */
+#pragma omp declare mapper (name:Z [5]foo) map (foo[0].z)
+/* { dg-error "'Z\\\[5\\\]' is not a struct or union type in '#pragma omp declare mapper'" "" { target c } .-1 } */
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/gomp/declare-mapper-13.c b/gcc/testsuite/gcc.dg/gomp/declare-mapper-13.c
new file mode 100644
index 0000000..df2b4a5
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gomp/declare-mapper-13.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+
+struct S { int y; };
+
+struct V
+{
+ int x;
+ #pragma omp declare mapper (bar: struct S s: s) map(s) /* { dg-error "'#pragma omp declare mapper' not at file or block scope" } */
+ /* { dg-error "expected end of line before '\\(' token" "" { target *-*-* } .-1 } */
+ #pragma omp declare mapper (struct V z : z) map(z) /* { dg-error "'#pragma omp declare mapper' not at file or block scope" } */
+ /* { dg-error "expected end of line before '\\(' token" "" { target *-*-* } .-1 } */
+};
+
diff --git a/gcc/testsuite/gcc.dg/gomp/udr-3.c b/gcc/testsuite/gcc.dg/gomp/udr-3.c
index 96450cd..2c7a3bd 100644
--- a/gcc/testsuite/gcc.dg/gomp/udr-3.c
+++ b/gcc/testsuite/gcc.dg/gomp/udr-3.c
@@ -31,13 +31,13 @@ f2 ()
#pragma omp declare reduction (bar: struct S: omp_out.s += omp_in.s) initializer (bar (&omp_orig)) /* { dg-error "one of the initializer call arguments should be" } */
}
-#pragma omp declare reduction (+: struct U: omp_out.u *= omp_in.u) /* { dg-error "previous" } */
+#pragma omp declare reduction (+: struct U: omp_out.u *= omp_in.u) /* { dg-note "'#pragma omp declare reduction' previously declared here" } */
#pragma omp declare reduction (+: struct U: omp_out.u += omp_in.u) /* { dg-error "redeclaration of" } */
void
f3 ()
{
- #pragma omp declare reduction (f3: struct U: omp_out.u *= omp_in.u) /* { dg-error "previous" } */
+ #pragma omp declare reduction (f3: struct U: omp_out.u *= omp_in.u) /* { dg-note "'#pragma omp declare reduction' previously declared here" } */
#pragma omp declare reduction (f3: struct U: omp_out.u += omp_in.u) /* { dg-error "redeclaration of" } */
}
@@ -47,7 +47,7 @@ struct V
#pragma omp declare reduction (bar: struct S: omp_out.s += omp_in.s) /* { dg-error "not at file or block scope" } */
};
-#pragma omp declare reduction (n3: long: omp_out += omp_in) /* { dg-error "previous" } */
+#pragma omp declare reduction (n3: long: omp_out += omp_in) /* { dg-note "'#pragma omp declare reduction' previously declared here" } */
#pragma omp declare reduction (n3: long int: omp_out += omp_in) /* { dg-error "redeclaration of" } */
#pragma omp declare reduction (n3: short unsigned: omp_out += omp_in)
#pragma omp declare reduction (n3: short int: omp_out += omp_in)
@@ -55,7 +55,7 @@ struct V
void
f4 (void)
{
- #pragma omp declare reduction (f4: long: omp_out += omp_in) /* { dg-error "previous" } */
+ #pragma omp declare reduction (f4: long: omp_out += omp_in) /* { dg-note "'#pragma omp declare reduction' previously declared here" } */
#pragma omp declare reduction (f4: long int: omp_out += omp_in) /* { dg-error "redeclaration of" } */
#pragma omp declare reduction (f4: short unsigned: omp_out += omp_in)
#pragma omp declare reduction (f4: short int: omp_out += omp_in)
diff --git a/gcc/testsuite/gcc.dg/guality/guality.h b/gcc/testsuite/gcc.dg/guality/guality.h
index d41327c..48b59d2e 100644
--- a/gcc/testsuite/gcc.dg/guality/guality.h
+++ b/gcc/testsuite/gcc.dg/guality/guality.h
@@ -204,9 +204,10 @@ int volatile guality_attached;
of this wrapping, guality_main may not have an empty argument
list. */
-extern int guality_main (int argc, char *argv[]);
+extern int __attribute__((noipa))
+guality_main (int argc, char *argv[]);
-static void __attribute__((noinline))
+static void __attribute__((noipa))
guality_check (const char *name, gualchk_t value, int unknown_ok);
/* Set things up, run guality_main, then print a summary and quit. */
diff --git a/gcc/testsuite/gcc.dg/html-output/html-output.exp b/gcc/testsuite/gcc.dg/html-output/html-output.exp
new file mode 100644
index 0000000..1f977ca
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/html-output/html-output.exp
@@ -0,0 +1,31 @@
+# Copyright (C) 2012-2024 Free Software Foundation, Inc.
+#
+# This file is part of GCC.
+#
+# GCC is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# GCC is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GCC; see the file COPYING3. If not see
+# <http://www.gnu.org/licenses/>.
+
+# GCC testsuite that uses the `dg.exp' driver.
+
+# Load support procs.
+load_lib gcc-dg.exp
+
+# Initialize `dg'.
+dg-init
+
+# Main loop.
+dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.c]] "" ""
+
+# All done.
+dg-finish
diff --git a/gcc/testsuite/gcc.dg/html-output/missing-semicolon.c b/gcc/testsuite/gcc.dg/html-output/missing-semicolon.c
new file mode 100644
index 0000000..fe5f081
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/html-output/missing-semicolon.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-options "-fdiagnostics-add-output=experimental-html:javascript=no" } */
+
+/* Verify that basics of HTML output work. */
+
+int missing_semicolon (void)
+{
+ return 42 /* { dg-error "expected ';' before '.' token" } */
+}
+
+/* Use a Python script to verify various properties about the generated
+ .html file:
+ { dg-final { run-html-pytest missing-semicolon.c "missing-semicolon.py" } } */
diff --git a/gcc/testsuite/gcc.dg/html-output/missing-semicolon.py b/gcc/testsuite/gcc.dg/html-output/missing-semicolon.py
new file mode 100644
index 0000000..3adaa52
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/html-output/missing-semicolon.py
@@ -0,0 +1,104 @@
+# Verify that basics of HTML output work.
+#
+# For reference, we expect this textual output:
+#
+# PATH/missing-semicolon.c: In function ‘missing_semicolon’:
+# PATH/missing-semicolon.c:8:12: error: expected ‘;’ before ‘}’ token
+# 8 | return 42 /* { dg-error "expected ';' before '.' token" } */
+# | ^
+# | ;
+# 9 | }
+# | ~
+
+from htmltest import *
+
+import pytest
+
+@pytest.fixture(scope='function', autouse=True)
+def html_tree():
+ return html_tree_from_env()
+
+def test_basics(html_tree):
+ root = html_tree.getroot ()
+ assert root.tag == make_tag('html')
+
+ head = root.find('xhtml:head', ns)
+ assert head is not None
+
+ title = head.find('xhtml:title', ns)
+ assert title.text.endswith('gcc/testsuite/gcc.dg/html-output/missing-semicolon.c')
+
+ body = root.find('xhtml:body', ns)
+ assert body is not None
+
+ diag_list = body.find('xhtml:div', ns)
+ assert diag_list is not None
+ assert diag_list.attrib['class'] == 'gcc-diagnostic-list'
+
+ diag = diag_list.find('xhtml:div', ns)
+ assert diag is not None
+ assert diag.attrib['class'] == 'alert alert-danger'
+ assert diag.attrib['id'] == 'gcc-diag-0'
+
+ icon = diag.find('xhtml:span', ns)
+ assert icon.attrib['class'] == 'pficon pficon-error-circle-o'
+
+ # The message line:
+ message = diag.find("./xhtml:div[@class='gcc-message']", ns)
+ assert message is not None
+ # <html:div xmlns:html="http://www.w3.org/1999/xhtml" class="gcc-message" id="gcc-diag-0-message"><html:strong>error: </html:strong> expected '<html:span class="gcc-quoted-text">;</html:span>' before '<html:span class="gcc-quoted-text">}</html:span>' token</html:div>
+ assert message[0].tag == make_tag('strong')
+ assert message[0].text == 'error: '
+ assert message[0].tail == " expected '"
+ assert message[1].tag == make_tag('span')
+ assert message[1].attrib['class'] == 'gcc-quoted-text'
+ assert message[1].text == ';'
+ assert message[1].tail == "' before '"
+ assert message[2].tag == make_tag('span')
+ assert message[2].attrib['class'] == 'gcc-quoted-text'
+ assert message[2].text == '}'
+ assert message[2].tail == "' token"
+
+ # Logical location
+ logical_loc = diag.find("./xhtml:div[@id='logical-location']", ns)
+ assert logical_loc is not None
+ assert len(logical_loc) == 2
+ assert logical_loc[0].tag == make_tag('span')
+ assert logical_loc[0].text == 'Function '
+ assert logical_loc[1].tag == make_tag('span')
+ assert logical_loc[1].text == 'missing_semicolon'
+ assert logical_loc[1].attrib['class'] == 'gcc-quoted-text'
+
+ # Physical location
+ file_ = diag.find("./xhtml:div[@id='file']", ns)
+ assert file_ is not None
+ assert len(file_) == 2
+ assert file_[0].tag == make_tag('span')
+ assert file_[0].text == 'File '
+ assert file_[1].tag == make_tag('span')
+ assert file_[1].text.endswith('gcc/testsuite/gcc.dg/html-output/missing-semicolon.c')
+
+ line = diag.find("./xhtml:div[@id='line']", ns)
+ assert line is not None
+ assert len(line) == 2
+ assert line[0].tag == make_tag('span')
+ assert line[0].text == 'Line '
+ assert line[1].tag == make_tag('span')
+ assert line[1].text == '8'
+
+ column = diag.find("./xhtml:div[@id='column']", ns)
+ assert column is not None
+ assert len(column) == 2
+ assert column[0].tag == make_tag('span')
+ assert column[0].text == 'Column '
+ assert column[1].tag == make_tag('span')
+ assert column[1].text == '12'
+
+ # Suggested fix
+ fix = diag.find("./xhtml:div[@id='suggested-fix']", ns)
+ label = fix.find('xhtml:label', ns)
+ assert label.text == "Suggested fix"
+ pre = fix.find('xhtml:pre', ns)
+ assert pre is not None
+ assert pre.attrib['class'] == 'gcc-generated-patch'
+ assert pre.text.startswith('--- ')
diff --git a/gcc/testsuite/gcc.dg/ipa/pr119318.c b/gcc/testsuite/gcc.dg/ipa/pr119318.c
index f179aed..47698a5 100644
--- a/gcc/testsuite/gcc.dg/ipa/pr119318.c
+++ b/gcc/testsuite/gcc.dg/ipa/pr119318.c
@@ -30,8 +30,14 @@ int
main ()
{
W x = foo (0, (V) { 0, 5 });
- for (unsigned i = 0; i < sizeof(x)/sizeof(x[0]); i++)
+ for (unsigned i = 0; i < sizeof (x) / sizeof (x[0]); i++)
+#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ && __SIZEOF_INT__ == 4 && __SIZEOF_INT128__ == 16
if (x[i] != (i ? 0 : 0x1900000000))
- __builtin_abort();
+#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ && __SIZEOF_INT__ == 4 && __SIZEOF_INT128__ == 16
+ if (x[i] != (i ? 0 : ((__int128) 0x19) << 64))
+#else
+ if (0)
+#endif
+ __builtin_abort ();
return 0;
}
diff --git a/gcc/testsuite/gcc.dg/ipa/pr119852.c b/gcc/testsuite/gcc.dg/ipa/pr119852.c
new file mode 100644
index 0000000..eab8d212
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ipa/pr119852.c
@@ -0,0 +1,50 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -fdump-ipa-clones" } */
+
+typedef struct rtx_def *rtx;
+enum rtx_code {
+ LAST_AND_UNUSED_RTX_CODE};
+extern const char * const rtx_format[((int) LAST_AND_UNUSED_RTX_CODE)];
+struct rtx_def {
+ enum rtx_code code;
+};
+typedef int (*rtx_function) (rtx *, void *);
+extern int for_each_rtx (rtx *, rtx_function, void *);
+int
+replace_label (rtx *x, void *data)
+{
+ rtx l = *x;
+ if (l == (rtx) 0)
+ {
+ {
+ rtx new_c, new_l;
+ for_each_rtx (&new_c, replace_label, data);
+ }
+ }
+}
+static int
+for_each_rtx_1 (rtx exp, int n, rtx_function f, void *data)
+{
+ int result, i, j;
+ const char *format = (rtx_format[(int) (((enum rtx_code) (exp)->code))]);
+ rtx *x;
+ for (; format[n] != '\0'; n++)
+ {
+ switch (format[n])
+ {
+ case 'e':
+ result = (*f) (x, data);
+ {
+ result = for_each_rtx_1 (*x, i, f, data);
+ }
+ }
+ }
+}
+int
+for_each_rtx (rtx *x, rtx_function f, void *data)
+{
+ int i;
+ return for_each_rtx_1 (*x, i, f, data);
+}
+
+/* { dg-final { scan-ipa-dump-not "(null)" "ipa-clones" } } */
diff --git a/gcc/testsuite/gcc.dg/ipa/pr120044-1.c b/gcc/testsuite/gcc.dg/ipa/pr120044-1.c
new file mode 100644
index 0000000..f9fee3e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ipa/pr120044-1.c
@@ -0,0 +1,17 @@
+/* { dg-do run } */
+/* { dg-options "-O3 -fno-early-inlining -fno-tree-fre -fno-tree-pre -fno-code-hoisting -fno-inline" } */
+
+struct a {
+ int b;
+} const c;
+void d(char p, struct a e) {
+ while (e.b)
+ ;
+}
+static unsigned short f(const struct a g) {
+ d(g.b, g);
+ return g.b;
+}
+int main() {
+ return f(c);
+}
diff --git a/gcc/testsuite/gcc.dg/ipa/pr120044-2.c b/gcc/testsuite/gcc.dg/ipa/pr120044-2.c
new file mode 100644
index 0000000..5130791
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ipa/pr120044-2.c
@@ -0,0 +1,17 @@
+/* { dg-do run } */
+/* { dg-options "-O3 -fno-early-inlining -fno-tree-fre -fno-tree-pre -fno-code-hoisting -fno-ipa-cp" } */
+
+struct a {
+ int b;
+} const c;
+void d(char p, struct a e) {
+ while (e.b)
+ ;
+}
+static unsigned short f(const struct a g) {
+ d(g.b, g);
+ return g.b;
+}
+int main() {
+ return f(c);
+}
diff --git a/gcc/testsuite/gcc.dg/ipa/pr120295.c b/gcc/testsuite/gcc.dg/ipa/pr120295.c
new file mode 100644
index 0000000..4d5a266
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ipa/pr120295.c
@@ -0,0 +1,66 @@
+/* { dg-do run } */
+/* { dg-options "-O3" } */
+
+struct {
+ signed a;
+} b;
+int a, f, j, l;
+char c, k, g, e;
+short d[2] = {0};
+int *i = &j;
+
+volatile int glob_;
+void __attribute__((noipa)) sth (const char *, int a)
+{
+ glob_ = a;
+ return;
+}
+
+void marker_37() {
+ a++;
+ sth ("%d\n", a);
+}
+unsigned long long m(unsigned, char, unsigned, short);
+int n(int, unsigned char, long long);
+int o(long long, unsigned, unsigned);
+unsigned short p(void) {
+ int *r = &l;
+ *r |= ({
+ long long y = (m(c, c, 0, c), b.a);
+ y;
+ });
+ return 0;
+}
+unsigned long long m(unsigned q, char v, unsigned s, short u) {
+ unsigned short ab = 5;
+ if (n(q, ab, d[1]))
+ for (; g; g++)
+ ;
+ return c;
+}
+int n(int af, unsigned char e, long long ae) {
+ unsigned ag = 4;
+ int *ah = &f;
+ *ah = ({ short ad = o(af, f, ag); ad<0 || ad> e; });
+ return *i;
+}
+int o(long long aj, unsigned ai, unsigned ak) {
+ for (; e; e--) {
+ int *al = &f;
+ for (; k; k++)
+ *al = 0;
+ }
+ if (18446744073709551606UL != (unsigned long long) aj)
+ ;
+ else
+ marker_37();
+ return ak;
+}
+int f123() {
+ c = 0xf6;
+ p();
+ return 0;
+}
+int main() {
+ return f123();
+}
diff --git a/gcc/testsuite/gcc.dg/memcpy-6.c b/gcc/testsuite/gcc.dg/memcpy-6.c
index d4df039..49aec33 100644
--- a/gcc/testsuite/gcc.dg/memcpy-6.c
+++ b/gcc/testsuite/gcc.dg/memcpy-6.c
@@ -7,7 +7,7 @@
{ dg-do compile }
{ dg-options "-O0 -Wrestrict -fdump-tree-optimized" }
{ dg-skip-if "skip non-x86 targets" { ! { i?86-*-* x86_64-*-* } } }
- { dg-additional-options "-msse" { target i?86-*-* x86_64-*-* } } */
+ { dg-additional-options "-msse2" { target i?86-*-* x86_64-*-* } } */
char a[32];
diff --git a/gcc/testsuite/gcc.dg/nonnull-12.c b/gcc/testsuite/gcc.dg/nonnull-12.c
new file mode 100644
index 0000000..d3eb475
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/nonnull-12.c
@@ -0,0 +1,73 @@
+/* Test for the "nonnull_if_nonzero" function attribute. */
+/* { dg-do compile } */
+/* { dg-options "-Wnonnull" } */
+
+#include <stddef.h>
+
+extern void func1 (char *, char *, int, int)
+ __attribute__((nonnull_if_nonzero (1, 3, 4), nonnull_if_nonzero (2, 3, 4)));
+
+extern void func2 (char *, char *, unsigned long, unsigned long)
+ __attribute__((nonnull_if_nonzero (1, 3, 4)));
+
+enum E { E0 = 0, E1 = 1, E2 = __INT_MAX__ };
+extern void func3 (char *, int, char *, enum E, int, enum E)
+ __attribute__((nonnull_if_nonzero (1, 4, 6), nonnull_if_nonzero (3, 2, 5)));
+
+extern void func4 (long, char *, char *, long, long, long)
+ __attribute__((nonnull_if_nonzero (2, 1, 5)))
+ __attribute__((nonnull_if_nonzero (3, 4, 6)));
+
+void
+foo (int i1, int i2, int i3, char *cp1, char *cp2, char *cp3)
+{
+ func1 (cp1, cp2, i1, i2);
+ func1 (cp1, cp2, 0, 0);
+ func1 (cp1, cp2, 42, 42);
+ func1 (NULL, NULL, 0, 0);
+ func1 (NULL, NULL, 0, 42);
+ func1 (NULL, NULL, 42, 0);
+ func1 (NULL, NULL, i1, i2);
+
+ func1 (NULL, cp2, 42, 42); /* { dg-warning "argument 1 null where non-null expected because arguments 3 and 4 are nonzero" } */
+ func1 (cp1, NULL, 1, 1); /* { dg-warning "argument 2 null where non-null expected because arguments 3 and 4 are nonzero" } */
+
+ func2 (cp1, NULL, 17, 17);
+ func2 (NULL, cp2, 0, 0);
+ func2 (NULL, cp2, 0, 17);
+ func2 (NULL, cp2, 17, 0);
+ func2 (NULL, cp1, 2, 2); /* { dg-warning "argument 1 null where non-null expected because arguments 3 and 4 are nonzero" } */
+
+ func3 (NULL, i2, cp3, i3, i3, i2);
+ func3 (cp1, i2, NULL, i3, i3, i2);
+ func3 (NULL, i2, cp3, E0, i3, E0);
+ func3 (NULL, i2, cp3, E0, i3, E1);
+ func3 (NULL, i2, cp3, E1, i3, E0);
+ func3 (cp1, 0, NULL, E2, 0, E2);
+ func3 (cp1, 0, NULL, E2, 4, E2);
+ func3 (cp1, 4, NULL, E2, 0, E2);
+ func3 (NULL, i2, cp3, E2, i3, E2); /* { dg-warning "argument 1 null where non-null expected because arguments 4 and 6 are nonzero" } */
+ func3 (cp3, 5, NULL, i3, 1, i2); /* { dg-warning "argument 3 null where non-null expected because arguments 2 and 5 are nonzero" } */
+
+ func1 (i2 ? cp1 : NULL, cp2, i3, i3);
+ func1 (i2 ? NULL : cp1, cp2, i3, i3);
+ func1 (i2 ? (i3 ? cp1 : NULL) : cp2, cp3, i1, i1);
+ func1 (i1 ? cp1 : NULL, cp2, 0, 0);
+ func1 (i1 ? cp1 : NULL, cp2, 0, 4);
+ func1 (i1 ? cp1 : NULL, cp2, 4, 0);
+ func1 (i1 ? NULL : cp1, cp2, 0, 0);
+ func1 (i1 ? NULL : cp1, cp2, 0, 2);
+ func1 (i1 ? NULL : cp1, cp2, 3, 0);
+ func1 (i1 ? (i2 ? cp1 : NULL) : cp2, cp3, 0, 0);
+ func1 (i1 ? (i2 ? cp1 : NULL) : cp2, cp3, 0, 1);
+ func1 (i1 ? (i2 ? cp1 : NULL) : cp2, cp3, 2, 0);
+ func1 (i1 ? cp1 : NULL, cp2, 1, 2); /* { dg-warning "argument 1 null where non-null expected because arguments 3 and 4 are nonzero" } */
+ func1 (i1 ? NULL : cp1, cp2, 2, 3); /* { dg-warning "argument 1 null where non-null expected because arguments 3 and 4 are nonzero" } */
+ func1 (i1 ? (i2 ? cp1 : NULL) : cp2, cp3, 3, 4); /* { dg-warning "argument 1 null where non-null expected because arguments 3 and 4 are nonzero" } */
+
+ func4 (0, NULL, NULL, 0, 0, 0);
+ func4 (0, NULL, NULL, 0, 1, 2);
+ func4 (3, NULL, NULL, 4, 0, 0);
+ func4 (-1, NULL, cp1, 0, 42, 0); /* { dg-warning "argument 2 null where non-null expected because arguments 1 and 5 are nonzero" } */
+ func4 (0, cp1, NULL, 77, 0, 12); /* { dg-warning "argument 3 null where non-null expected because arguments 4 and 6 are nonzero" } */
+}
diff --git a/gcc/testsuite/gcc.dg/nonnull-13.c b/gcc/testsuite/gcc.dg/nonnull-13.c
new file mode 100644
index 0000000..15f2af0
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/nonnull-13.c
@@ -0,0 +1,210 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -Wnonnull" } */
+
+#define N(x, y, z) __attribute__ ((nonnull_if_nonzero (x, y, z)))
+
+void N (1, 2, 3) f1_1 (void *, int, int);
+
+void N (1, 3, 4) f2_1 (void *, void *, int, int);
+void N (1, 3, 4) N (2, 3, 4) f2_1_2 (void *, void *, int, int);
+
+void N (1, 4, 6) N (3, 5, 7) f3_1_3 (void *, void *, void *, int, int, int, int);
+
+void N (1, 5, 6) N (2, 5, 6) N (4, 5, 6) g4_1_2_4 (void *, void *, void *, void *, long, long);
+void N (1, 5, 6) N (3, 5, 6) N (4, 5, 6) g4_1_3_4 (void *, void *, void *, void *, long, long);
+void N (2, 5, 6) N (3, 5, 6) N (4, 5, 6) g4_2_3_4 (void *, void *, void *, void *, long, long);
+
+void N (1, 17, 18) N (3, 17, 18) N (5, 17, 18) N (7, 17, 18) N (11, 17, 18) N (13, 17, 18)
+g16_1_3_5_7_11_13 (void *, void *, void *, void *,
+ void *, void *, void *, void *,
+ void *, void *, void *, void *,
+ void *, void *, void *, void *, int, int);
+
+static void *null (void) { return 0; }
+
+void
+test (int t, long u, int v, long w)
+{
+ void *p0 = null ();
+ void *px = &px;
+
+ f1_1 (p0, 0, 0);
+ f1_1 (p0, 0, 4);
+ f1_1 (p0, 3, 0);
+ f1_1 (p0, t, v);
+ f1_1 (p0, t, 0);
+ f1_1 (p0, 0, v);
+ f1_1 (p0, 42, 1); /* { dg-warning "argument 1 null where non-null expected because arguments 2 and 3 are nonzero" } */
+ if (t && v)
+ f1_1 (p0, t, v); /* { dg-warning "argument 1 null where non-null expected because arguments 2 and 3 are nonzero" } */
+ f1_1 (px, 17, 17);
+
+ f2_1 (p0, px, 0, 0);
+ f2_1 (p0, px, 0, 3);
+ f2_1 (p0, px, 7, 0);
+ f2_1 (p0, px, t, v);
+ f2_1 (p0, px, t, 0);
+ f2_1 (p0, px, 0, v);
+ f2_1 (p0, px, 5, 3); /* { dg-warning "argument 1 null where non-null expected because arguments 3 and 4 are nonzero" } */
+ if (t > 4 && v > 8)
+ f2_1 (p0, px, t, v); /* { dg-warning "argument 1 null where non-null expected because arguments 3 and 4 are nonzero" } */
+ f2_1 (px, p0, 17, 17);
+ f2_1 (p0, p0, 0, 0);
+ f2_1 (p0, p0, 0, 4);
+ f2_1 (p0, p0, 2, 0);
+ if (t < 0 && v < -3)
+ f2_1 (p0, p0, t, v); /* { dg-warning "argument 1 null where non-null expected because arguments 3 and 4 are nonzero" } */
+
+ f2_1_2 (p0, p0, 0, 0);
+ f2_1_2 (p0, p0, 0, 1);
+ f2_1_2 (p0, p0, 2, 0);
+ f2_1_2 (p0, p0, t, v);
+ f2_1_2 (p0, p0, t, 0);
+ f2_1_2 (p0, p0, 0, v);
+ f2_1_2 (p0, px, 1, 2); /* { dg-warning "argument 1 null where non-null expected because arguments 3 and 4 are nonzero" } */
+ if (t > 8 && v >= 16)
+ f2_1_2 (p0, px, t, v); /* { dg-warning "argument 1 null where non-null expected because arguments 3 and 4 are nonzero" } */
+ f2_1_2 (px, p0, -3, -4); /* { dg-warning "argument 2 null where non-null expected because arguments 3 and 4 are nonzero" } */
+ if (t < -2 && v >= 32)
+ f2_1_2 (px, p0, t, v); /* { dg-warning "argument 2 null where non-null expected because arguments 3 and 4 are nonzero" } */
+ f2_1_2 (p0, p0, 8, 165); /* { dg-warning "argument 1 null where non-null expected because arguments 3 and 4 are nonzero" } */
+ /* { dg-warning "argument 2 null where non-null expected because arguments 3 and 4 are nonzero" "argument 2" { target *-*-* } .-1 } */
+ if (t > 7 && v < -2)
+ f2_1_2 (p0, p0, t, v); /* { dg-warning "argument 1 null where non-null expected because arguments 3 and 4 are nonzero" } */
+ /* { dg-warning "argument 2 null where non-null expected because arguments 3 and 4 are nonzero" "argument 2" { target *-*-* } .-1 } */
+
+ f3_1_3 (p0, p0, p0, 0, 0, 0, 0);
+ f3_1_3 (p0, p0, p0, 0, 5, 4, 0);
+ f3_1_3 (p0, p0, p0, 3, 0, 0, 6);
+ f3_1_3 (p0, p0, px, 0, 6, 0, 6);
+ f3_1_3 (p0, p0, px, 0, 6, 4, 6);
+ f3_1_3 (p0, p0, px, 3, 6, 0, 6);
+ f3_1_3 (px, p0, p0, 2, 0, 2, 0);
+ f3_1_3 (px, p0, p0, 2, 0, 2, 4);
+ f3_1_3 (px, p0, p0, 2, 6, 2, 0);
+ f3_1_3 (p0, p0, p0, t, t, v, v);
+ f3_1_3 (p0, p0, px, t, 6, v, 7);
+ f3_1_3 (px, p0, p0, 2, t, 3, v);
+ f3_1_3 (p0, px, px, 8, 2, 3, 5); /* { dg-warning "argument 1 null where non-null expected because arguments 4 and 6 are nonzero" } */
+ if (t > 9 && v < -19)
+ f3_1_3 (p0, px, px, t, 3, v, 2); /* { dg-warning "argument 1 null where non-null expected because arguments 4 and 6 are nonzero" } */
+ f3_1_3 (px, p0, px, 9, 10, 1, 2);
+ if (t > 11 && v > 3)
+ f3_1_3 (px, p0, px, t, t, v, v);
+ f3_1_3 (px, px, p0, 10, 11, 2, 3); /* { dg-warning "argument 3 null where non-null expected because arguments 5 and 7 are nonzero" } */
+ if (t < -5 && v > 2)
+ f3_1_3 (px, px, p0, 0, t, 2, v); /* { dg-warning "argument 3 null where non-null expected because arguments 5 and 7 are nonzero" } */
+ f3_1_3 (p0, p0, px, 11, 12, 1, 2); /* { dg-warning "argument 1 null where non-null expected because arguments 4 and 6 are nonzero" } */
+ if (t > 26 && v > 88)
+ f3_1_3 (p0, p0, px, t, 3, v, 2); /* { dg-warning "argument 1 null where non-null expected because arguments 4 and 6 are nonzero" } */
+ f3_1_3 (px, p0, p0, 12, 13, 1, 2); /* { dg-warning "argument 3 null where non-null expected because arguments 5 and 7 are nonzero" } */
+ if (t > 31 && v < -1)
+ f3_1_3 (px, p0, p0, 12, t, 2, v); /* { dg-warning "argument 3 null where non-null expected because arguments 5 and 7 are nonzero" } */
+ f3_1_3 (p0, p0, p0, 13, 14, 1, 2); /* { dg-warning "argument 1 null where non-null expected because arguments 4 and 6 are nonzero" } */
+ /* { dg-warning "argument 3 null where non-null expected because arguments 5 and 7 are nonzero" "argument 3" { target *-*-* } .-1 } */
+ if (t > 28 && v > 42)
+ f3_1_3 (p0, p0, p0, t, t + 1, v, v + 1); /* { dg-warning "argument 1 null where non-null expected because arguments 4 and 6 are nonzero" } */
+ /* { dg-warning "argument 3 null where non-null expected because arguments 5 and 7 are nonzero" "argument 3" { target *-*-* } .-1 } */
+
+ g4_1_2_4 (p0, px, px, px, u, w);
+ g4_1_2_4 (px, p0, px, px, u, w);
+ g4_1_2_4 (px, px, p0, px, u, w);
+ g4_1_2_4 (px, px, px, p0, u, w);
+ g4_1_2_4 (p0, px, px, px, 0, 0);
+ g4_1_2_4 (p0, px, px, px, 0, 2);
+ g4_1_2_4 (p0, px, px, px, 1, 0);
+ g4_1_2_4 (px, p0, px, px, 0, 0);
+ g4_1_2_4 (px, p0, px, px, 0, 3);
+ g4_1_2_4 (px, p0, px, px, 4, 0);
+ g4_1_2_4 (px, px, p0, px, 0, 0);
+ g4_1_2_4 (px, px, p0, px, 0, 5);
+ g4_1_2_4 (px, px, p0, px, 6, 0);
+ g4_1_2_4 (px, px, px, p0, 0, 0);
+ g4_1_2_4 (px, px, px, p0, 0, 7);
+ g4_1_2_4 (px, px, px, p0, 8, 0);
+ g4_1_2_4 (p0, px, px, px, 15, 2); /* { dg-warning "argument 1 null where non-null expected because arguments 5 and 6 are nonzero" } */
+ if (u && w)
+ g4_1_2_4 (p0, px, px, px, u, w); /* { dg-warning "argument 1 null where non-null expected because arguments 5 and 6 are nonzero" } */
+ g4_1_2_4 (px, p0, px, px, 16, 2); /* { dg-warning "argument 2 null where non-null expected because arguments 5 and 6 are nonzero" } */
+ if (u > 2 && w > 3)
+ g4_1_2_4 (px, p0, px, px, u, w); /* { dg-warning "argument 2 null where non-null expected because arguments 5 and 6 are nonzero" } */
+ g4_1_2_4 (px, px, p0, px, 17, 8);
+ if (u > 3 && w < -2)
+ g4_1_2_4 (px, px, p0, px, u, w);
+ g4_1_2_4 (px, px, px, p0, 18, 3); /* { dg-warning "argument 4 null where non-null expected because arguments 5 and 6 are nonzero" } */
+ if ((u < -2 || u > 10) && (w < -4 || w > 42))
+ g4_1_2_4 (px, px, px, p0, u, w); /* { dg-warning "argument 4 null where non-null expected because arguments 5 and 6 are nonzero" } */
+
+ g4_1_3_4 (p0, px, px, px, u, u);
+ g4_1_3_4 (px, p0, px, px, u, u);
+ g4_1_3_4 (px, px, p0, px, u, u);
+ g4_1_3_4 (px, px, px, p0, u, u);
+ g4_1_3_4 (p0, px, px, px, 0, 0);
+ g4_1_3_4 (p0, px, px, px, 0, 1);
+ g4_1_3_4 (p0, px, px, px, 2, 0);
+ g4_1_3_4 (px, p0, px, px, 0, 0);
+ g4_1_3_4 (px, p0, px, px, 0, 3);
+ g4_1_3_4 (px, p0, px, px, 4, 0);
+ g4_1_3_4 (px, px, p0, px, 0, 0);
+ g4_1_3_4 (px, px, p0, px, 0, 5);
+ g4_1_3_4 (px, px, p0, px, 6, 0);
+ g4_1_3_4 (px, px, px, p0, 0, 0);
+ g4_1_3_4 (px, px, px, p0, 0, 7);
+ g4_1_3_4 (px, px, px, p0, 8, 0);
+ g4_1_3_4 (p0, px, px, px, 20, 32); /* { dg-warning "argument 1 null where non-null expected because arguments 5 and 6 are nonzero" } */
+ if (u > 4 && w > 2)
+ g4_1_3_4 (p0, px, px, px, u, w); /* { dg-warning "argument 1 null where non-null expected because arguments 5 and 6 are nonzero" } */
+ g4_1_3_4 (px, p0, px, px, 21, 4);
+ if ((u > 6 || u < -24) && (w > 8 || w < -5))
+ g4_1_3_4 (px, p0, px, px, u, w);
+ g4_1_3_4 (px, px, p0, px, 22, 4); /* { dg-warning "argument 3 null where non-null expected because arguments 5 and 6 are nonzero" } */
+ if (u > 9 && w > 13)
+ g4_1_3_4 (px, px, p0, px, u - 3, w - 8); /* { dg-warning "argument 3 null where non-null expected because arguments 5 and 6 are nonzero" } */
+ g4_1_3_4 (px, px, px, p0, 23, 8); /* { dg-warning "argument 4 null where non-null expected because arguments 5 and 6 are nonzero" } */
+ if (u > 10 && w > 12)
+ g4_1_3_4 (px, px, px, p0, u, w); /* { dg-warning "argument 4 null where non-null expected because arguments 5 and 6 are nonzero" } */
+
+ g4_2_3_4 (p0, px, px, px, u, u);
+ g4_2_3_4 (px, p0, px, px, u, u);
+ g4_2_3_4 (px, px, p0, px, u, u);
+ g4_2_3_4 (px, px, px, p0, u, u);
+ g4_2_3_4 (p0, px, px, px, 0, 0);
+ g4_2_3_4 (p0, px, px, px, 0, 1);
+ g4_2_3_4 (p0, px, px, px, 2, 0);
+ g4_2_3_4 (px, p0, px, px, 0, 0);
+ g4_2_3_4 (px, p0, px, px, 0, 3);
+ g4_2_3_4 (px, p0, px, px, 4, 0);
+ g4_2_3_4 (px, px, p0, px, 0, 0);
+ g4_2_3_4 (px, px, p0, px, 0, 5);
+ g4_2_3_4 (px, px, p0, px, 6, 0);
+ g4_2_3_4 (px, px, px, p0, 0, 0);
+ g4_2_3_4 (px, px, px, p0, 0, 7);
+ g4_2_3_4 (px, px, px, p0, 8, 0);
+ g4_2_3_4 (p0, px, px, px, 1, 2);
+ if (u > 12 && w > 16)
+ g4_2_3_4 (p0, px, px, px, u, w);
+ g4_2_3_4 (px, p0, px, px, 2, 3); /* { dg-warning "argument 2 null where non-null expected because arguments 5 and 6 are nonzero" } */
+ if (u > 17 && w > 19)
+ g4_2_3_4 (px, p0, px, px, u - 3, w - 2); /* { dg-warning "argument 2 null where non-null expected because arguments 5 and 6 are nonzero" } */
+ g4_2_3_4 (px, px, p0, px, 3, 8); /* { dg-warning "argument 3 null where non-null expected because arguments 5 and 6 are nonzero" } */
+ if (u > 24 && w > 22)
+ g4_2_3_4 (px, px, p0, px, u, w); /* { dg-warning "argument 3 null where non-null expected because arguments 5 and 6 are nonzero" } */
+ g4_2_3_4 (px, px, px, p0, 4, 2); /* { dg-warning "argument 4 null where non-null expected because arguments 5 and 6 are nonzero" } */
+ if (u > 42 && w > 48)
+ g4_2_3_4 (px, px, px, p0, u, w); /* { dg-warning "argument 4 null where non-null expected because arguments 5 and 6 are nonzero" } */
+
+ g16_1_3_5_7_11_13 (px, px, px, px, px, px, px, px,
+ px, px, px, px, px, px, px, px, 17, 18);
+ g16_1_3_5_7_11_13 (p0, p0, p0, p0, p0, p0, p0, p0,
+ p0, p0, p0, p0, p0, p0, p0, p0, t, v);
+ g16_1_3_5_7_11_13 (p0, p0, p0, p0, p0, p0, p0, p0,
+ p0, p0, p0, p0, p0, p0, p0, p0, 0, 0);
+ g16_1_3_5_7_11_13 (p0, p0, p0, p0, p0, p0, p0, p0,
+ p0, p0, p0, p0, p0, p0, p0, p0, 0, 4);
+ g16_1_3_5_7_11_13 (p0, p0, p0, p0, p0, p0, p0, p0,
+ p0, p0, p0, p0, p0, p0, p0, p0, 3, 0);
+
+ g16_1_3_5_7_11_13 (px, p0, px, p0, px, p0, px, p0, p0, p0, px, p0, p0, p0, p0, p0, 2, 1); /* { dg-warning "argument 13 null where non-null expected because arguments 17 and 18 are nonzero" } */
+ if (t > 122 && v > 18)
+ g16_1_3_5_7_11_13 (px, p0, px, p0, px, p0, px, p0, p0, p0, px, p0, p0, p0, p0, p0, t, v); /* { dg-warning "argument 13 null where non-null expected because arguments 17 and 18 are nonzero" } */
+}
diff --git a/gcc/testsuite/gcc.dg/nonnull-14.c b/gcc/testsuite/gcc.dg/nonnull-14.c
new file mode 100644
index 0000000..6194dd0
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/nonnull-14.c
@@ -0,0 +1,23 @@
+/* Test for the "nonnull" function attribute on builtins. Use the
+ "__builtin_" style below so we don't need prototypes. */
+/* { dg-do compile } */
+/* { dg-options "-Wnonnull" } */
+
+#include <stddef.h>
+
+void
+foo (void *p, char *s)
+{
+ __builtin_fwrite (s, 0, 0, NULL); /* { dg-warning "null" "null pointer check" } */
+ __builtin_fwrite (s, 0, 2, NULL); /* { dg-warning "null" "null pointer check" } */
+ __builtin_fwrite (s, 1, 0, NULL); /* { dg-warning "null" "null pointer check" } */
+ __builtin_fwrite (NULL, 16, 0, p);
+ __builtin_fwrite (NULL, 0, 12, p);
+ __builtin_fwrite (NULL, 2, 3, p); /* { dg-warning "null" "null pointer check" } */
+ __builtin_fwrite_unlocked (s, 0, 0, NULL); /* { dg-warning "null" "null pointer check" } */
+ __builtin_fwrite_unlocked (s, 0, 2, NULL); /* { dg-warning "null" "null pointer check" } */
+ __builtin_fwrite_unlocked (s, 1, 0, NULL); /* { dg-warning "null" "null pointer check" } */
+ __builtin_fwrite_unlocked (NULL, 16, 0, p);
+ __builtin_fwrite_unlocked (NULL, 0, 12, p);
+ __builtin_fwrite_unlocked (NULL, 2, 3, p); /* { dg-warning "null" "null pointer check" } */
+}
diff --git a/gcc/testsuite/gcc.dg/nonnull-9.c b/gcc/testsuite/gcc.dg/nonnull-9.c
index c0f95ca..31e6c11 100644
--- a/gcc/testsuite/gcc.dg/nonnull-9.c
+++ b/gcc/testsuite/gcc.dg/nonnull-9.c
@@ -3,31 +3,42 @@
/* { dg-options "-std=gnu17 -pedantic-errors" } */
extern void func1 () __attribute__((nonnull_if_nonzero)); /* { dg-error "wrong number of arguments specified for 'nonnull_if_nonzero' attribute" } */
-/* { dg-message "expected 2, found 0" "" { target *-*-* } .-1 } */
+/* { dg-message "expected between 2 and 3, found 0" "" { target *-*-* } .-1 } */
extern void func2 (char *) __attribute__((nonnull_if_nonzero(1))); /* { dg-error "wrong number of arguments specified for 'nonnull_if_nonzero' attribute" } */
-/* { dg-message "expected 2, found 1" "" { target *-*-* } .-1 } */
+/* { dg-message "expected between 2 and 3, found 1" "" { target *-*-* } .-1 } */
-extern void func3 (char *) __attribute__((nonnull_if_nonzero(1, 2, 3))); /* { dg-error "wrong number of arguments specified for 'nonnull_if_nonzero' attribute" } */
-/* { dg-message "expected 2, found 3" "" { target *-*-* } .-1 } */
+extern void func3 (char *) __attribute__((nonnull_if_nonzero(1, 2, 3, 4))); /* { dg-error "wrong number of arguments specified for 'nonnull_if_nonzero' attribute" } */
+/* { dg-message "expected between 2 and 3, found 4" "" { target *-*-* } .-1 } */
extern void func4 (char *, int) __attribute__((nonnull_if_nonzero(3, 2))); /* { dg-warning "'nonnull_if_nonzero' attribute argument 1 value '3' exceeds the number of function parameters 2" } */
extern void func5 (char *, int) __attribute__((nonnull_if_nonzero(1, 3))); /* { dg-warning "nonnull_if_nonzero' attribute argument 2 value '3' exceeds the number of function parameters 2" } */
-extern void func6 (char *, int) __attribute__((nonnull_if_nonzero (foo, 2))); /* { dg-warning ".nonnull_if_nonzero. attribute argument 1 is invalid" } */
+extern void func6 (char *, int) __attribute__((nonnull_if_nonzero(1, 2, 3))); /* { dg-warning "nonnull_if_nonzero' attribute argument 3 value '3' exceeds the number of function parameters 2" } */
+
+extern void func7 (char *, int) __attribute__((nonnull_if_nonzero (foo, 2))); /* { dg-warning ".nonnull_if_nonzero. attribute argument 1 is invalid" } */
/* { dg-error ".foo. undeclared" "undeclared argument" { target *-*-* } .-1 } */
-extern void func7 (char *, int) __attribute__((nonnull_if_nonzero (1, bar))); /* { dg-warning ".nonnull_if_nonzero. attribute argument 2 is invalid" } */
+extern void func8 (char *, int) __attribute__((nonnull_if_nonzero (1, bar))); /* { dg-warning ".nonnull_if_nonzero. attribute argument 2 is invalid" } */
/* { dg-error ".bar. undeclared" "undeclared argument" { target *-*-* } .-1 } */
-extern void func8 (int, int) __attribute__((nonnull_if_nonzero(1, 2))); /* { dg-warning "'nonnull_if_nonzero' attribute argument 1 value '1' refers to parameter type 'int'" } */
+extern void func9 (char *, int) __attribute__((nonnull_if_nonzero (1, 2, baz))); /* { dg-warning ".nonnull_if_nonzero. attribute argument 3 is invalid" } */
+/* { dg-error ".baz. undeclared" "undeclared argument" { target *-*-* } .-1 } */
+
+extern void func10 (int, int) __attribute__((nonnull_if_nonzero(1, 2))); /* { dg-warning "'nonnull_if_nonzero' attribute argument 1 value '1' refers to parameter type 'int'" } */
+
+extern void func11 (char *, float) __attribute__((nonnull_if_nonzero(1, 2))); /* { dg-warning "'nonnull_if_nonzero' attribute argument 2 value '2' refers to parameter type 'float'" } */
+
+extern void func12 (char *, _Bool) __attribute__((nonnull_if_nonzero(1, 2))); /* { dg-warning "'nonnull_if_nonzero' attribute argument 2 value '2' refers to parameter type '_Bool'" } */
+
+extern void func13 (char *, char *) __attribute__((nonnull_if_nonzero(1, 2))); /* { dg-warning "'nonnull_if_nonzero' attribute argument 2 value '2' refers to parameter type 'char \\\*'" } */
-extern void func9 (char *, float) __attribute__((nonnull_if_nonzero(1, 2))); /* { dg-warning "'nonnull_if_nonzero' attribute argument 2 value '2' refers to parameter type 'float'" } */
+extern void func14 (char *, int, float) __attribute__((nonnull_if_nonzero(1, 2, 3))); /* { dg-warning "'nonnull_if_nonzero' attribute argument 3 value '3' refers to parameter type 'float'" } */
-extern void func10 (char *, _Bool) __attribute__((nonnull_if_nonzero(1, 2))); /* { dg-warning "'nonnull_if_nonzero' attribute argument 2 value '2' refers to parameter type '_Bool'" } */
+extern void func15 (char *, long, _Bool) __attribute__((nonnull_if_nonzero(1, 2, 3))); /* { dg-warning "'nonnull_if_nonzero' attribute argument 3 value '3' refers to parameter type '_Bool'" } */
-extern void func11 (char *, char *) __attribute__((nonnull_if_nonzero(1, 2))); /* { dg-warning "'nonnull_if_nonzero' attribute argument 2 value '2' refers to parameter type 'char \\\*'" } */
+extern void func17 (char *, int, char *) __attribute__((nonnull_if_nonzero(1, 2, 3))); /* { dg-warning "'nonnull_if_nonzero' attribute argument 3 value '3' refers to parameter type 'char \\\*'" } */
void
foo (void)
@@ -38,3 +49,8 @@ void
bar (void)
{
}
+
+void
+baz (void)
+{
+}
diff --git a/gcc/testsuite/gcc.dg/old-style-prom-4.c b/gcc/testsuite/gcc.dg/old-style-prom-4.c
new file mode 100644
index 0000000..3632fa6
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/old-style-prom-4.c
@@ -0,0 +1,25 @@
+/* { dg-do compile } */
+/* { dg-options "-std=gnu17" } */
+
+int g(float a, float b);
+int g(a, b)
+ float a;
+ float b;
+{
+}
+
+int f(float a, float (*b)()); /* { dg-error "prototype declaration" } */
+
+int f(a, b)
+ float a;
+ float (*b)(float); /* { dg-error "match prototype" } */
+{
+}
+
+int (*e(float a))(float (*b)());
+
+int (*e(a))(float (*b)(float)) /* { dg-error "conflicting types" } */
+ float a;
+{
+}
+
diff --git a/gcc/testsuite/gcc.dg/plugin/analyzer_cpython_plugin.cc b/gcc/testsuite/gcc.dg/plugin/analyzer_cpython_plugin.cc
index 0f1f864..1fe5b5c 100644
--- a/gcc/testsuite/gcc.dg/plugin/analyzer_cpython_plugin.cc
+++ b/gcc/testsuite/gcc.dg/plugin/analyzer_cpython_plugin.cc
@@ -2,6 +2,7 @@
/* { dg-options "-g" } */
#define INCLUDE_MEMORY
+#define INCLUDE_STRING
#define INCLUDE_VECTOR
#include "gcc-plugin.h"
#include "config.h"
diff --git a/gcc/testsuite/gcc.dg/plugin/analyzer_gil_plugin.cc b/gcc/testsuite/gcc.dg/plugin/analyzer_gil_plugin.cc
index 3cac3f8f..fa2f2fa 100644
--- a/gcc/testsuite/gcc.dg/plugin/analyzer_gil_plugin.cc
+++ b/gcc/testsuite/gcc.dg/plugin/analyzer_gil_plugin.cc
@@ -5,6 +5,7 @@
/* { dg-options "-g" } */
#define INCLUDE_MEMORY
+#define INCLUDE_STRING
#define INCLUDE_VECTOR
#include "gcc-plugin.h"
#include "config.h"
@@ -126,11 +127,11 @@ public:
if (change.is_global_p ())
{
if (change.m_new_state == m_sm.m_released_gil)
- return diagnostic_event::meaning (diagnostic_event::VERB_release,
- diagnostic_event::NOUN_lock);
+ return diagnostic_event::meaning (diagnostic_event::verb::release,
+ diagnostic_event::noun::lock);
else if (change.m_new_state == m_sm.get_start_state ())
- return diagnostic_event::meaning (diagnostic_event::VERB_acquire,
- diagnostic_event::NOUN_lock);
+ return diagnostic_event::meaning (diagnostic_event::verb::acquire,
+ diagnostic_event::noun::lock);
}
return diagnostic_event::meaning ();
}
diff --git a/gcc/testsuite/gcc.dg/plugin/analyzer_kernel_plugin.cc b/gcc/testsuite/gcc.dg/plugin/analyzer_kernel_plugin.cc
index 771ff75..18e054b 100644
--- a/gcc/testsuite/gcc.dg/plugin/analyzer_kernel_plugin.cc
+++ b/gcc/testsuite/gcc.dg/plugin/analyzer_kernel_plugin.cc
@@ -2,6 +2,7 @@
/* { dg-options "-g" } */
#define INCLUDE_MEMORY
+#define INCLUDE_STRING
#define INCLUDE_VECTOR
#include "gcc-plugin.h"
#include "config.h"
diff --git a/gcc/testsuite/gcc.dg/plugin/analyzer_known_fns_plugin.cc b/gcc/testsuite/gcc.dg/plugin/analyzer_known_fns_plugin.cc
index c7087f0..5a6e075 100644
--- a/gcc/testsuite/gcc.dg/plugin/analyzer_known_fns_plugin.cc
+++ b/gcc/testsuite/gcc.dg/plugin/analyzer_known_fns_plugin.cc
@@ -2,6 +2,7 @@
/* { dg-options "-g" } */
#define INCLUDE_MEMORY
+#define INCLUDE_STRING
#define INCLUDE_VECTOR
#include "gcc-plugin.h"
#include "config.h"
diff --git a/gcc/testsuite/gcc.dg/plugin/diagnostic-test-metadata-html.c b/gcc/testsuite/gcc.dg/plugin/diagnostic-test-metadata-html.c
new file mode 100644
index 0000000..df57b25
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/plugin/diagnostic-test-metadata-html.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-options "-fdiagnostics-set-output=experimental-html:javascript=no" } */
+/* { dg-additional-options "-fdiagnostics-show-caret -fdiagnostics-show-line-numbers" } */
+
+extern char *gets (char *s);
+
+void test_cwe (void)
+{
+ char buf[1024];
+ gets (buf);
+}
+
+/* Use a Python script to verify various properties about the generated
+ HTML file:
+ { dg-final { run-html-pytest diagnostic-test-metadata-html.c "diagnostic-test-metadata-html.py" } } */
diff --git a/gcc/testsuite/gcc.dg/plugin/diagnostic-test-metadata-html.py b/gcc/testsuite/gcc.dg/plugin/diagnostic-test-metadata-html.py
new file mode 100644
index 0000000..67fb241
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/plugin/diagnostic-test-metadata-html.py
@@ -0,0 +1,73 @@
+# Verify that metadata works in HTML output.
+
+from htmltest import *
+
+import pytest
+
+@pytest.fixture(scope='function', autouse=True)
+def html_tree():
+ return html_tree_from_env()
+
+def test_metadata(html_tree):
+ root = html_tree.getroot ()
+ assert root.tag == make_tag('html')
+
+ body = root.find('xhtml:body', ns)
+ assert body is not None
+
+ diag_list = body.find('xhtml:div', ns)
+ assert diag_list is not None
+ assert diag_list.attrib['class'] == 'gcc-diagnostic-list'
+
+ diag = diag_list.find('xhtml:div', ns)
+ assert diag is not None
+ assert diag.attrib['class'] == 'alert alert-warning'
+
+ icon = diag.find('xhtml:span', ns)
+ assert icon.attrib['class'] == 'pficon pficon-warning-triangle-o'
+
+ message = diag.find("./xhtml:div[@class='gcc-message']", ns)
+ assert message.attrib['id'] == 'gcc-diag-0-message'
+
+ assert message[0].tag == make_tag('strong')
+ assert message[0].text == 'warning: '
+ assert message[0].tail == " never use '"
+
+ assert message[1].tag == make_tag('span')
+ assert message[1].attrib['class'] == 'gcc-quoted-text'
+ assert message[1].text == 'gets'
+ assert message[1].tail == "' "
+
+ metadata = message[2]
+ assert metadata.attrib['class'] == 'gcc-metadata'
+ assert metadata[0].tag == make_tag('span')
+ assert metadata[0].attrib['class'] == 'gcc-metadata-item'
+ assert metadata[0].text == '['
+ assert metadata[0][0].tag == make_tag('a')
+ assert metadata[0][0].attrib['href'] == 'https://cwe.mitre.org/data/definitions/242.html'
+ assert metadata[0][0].text == 'CWE-242'
+ assert metadata[0][0].tail == ']'
+
+ assert metadata[1].tag == make_tag('span')
+ assert metadata[1].attrib['class'] == 'gcc-metadata-item'
+ assert metadata[1].text == '['
+ assert metadata[1][0].tag == make_tag('a')
+ assert metadata[1][0].attrib['href'] == 'https://example.com/'
+ assert metadata[1][0].text == 'STR34-C'
+ assert metadata[1][0].tail == ']'
+
+ src = diag.find('xhtml:table', ns)
+ assert src.attrib['class'] == 'locus'
+
+ tbody = src.find('xhtml:tbody', ns)
+ assert tbody.attrib['class'] == 'line-span'
+
+ rows = tbody.findall('xhtml:tr', ns)
+
+ quoted_src_tr = rows[0]
+ assert_quoted_line(quoted_src_tr,
+ ' 10', ' gets (buf);')
+
+ annotation_tr = rows[1]
+ assert_annotation_line(annotation_tr,
+ ' ^~~~~~~~~~')
diff --git a/gcc/testsuite/gcc.dg/plugin/diagnostic-test-paths-2.c b/gcc/testsuite/gcc.dg/plugin/diagnostic-test-paths-2.c
index b8134ae..dab9c38 100644
--- a/gcc/testsuite/gcc.dg/plugin/diagnostic-test-paths-2.c
+++ b/gcc/testsuite/gcc.dg/plugin/diagnostic-test-paths-2.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-fdiagnostics-show-caret -fdiagnostics-show-line-numbers -fdiagnostics-path-format=inline-events" } */
+/* { dg-options "-fdiagnostics-show-caret -fdiagnostics-show-line-numbers -fdiagnostics-path-format=inline-events -fdiagnostics-add-output=experimental-html:javascript=no" } */
#include <stddef.h>
#include <stdlib.h>
@@ -52,3 +52,7 @@ make_a_list_of_random_ints_badly(PyObject *self,
| (3) when calling 'PyList_Append', passing NULL from (1) as argument 1
{ dg-end-multiline-output "" } */
}
+
+/* Use a Python script to verify various properties about the generated
+ HTML file:
+ { dg-final { run-html-pytest diagnostic-test-paths-2.c "diagnostic-test-paths-2.py" } } */
diff --git a/gcc/testsuite/gcc.dg/plugin/diagnostic-test-paths-2.py b/gcc/testsuite/gcc.dg/plugin/diagnostic-test-paths-2.py
new file mode 100644
index 0000000..f0fed45
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/plugin/diagnostic-test-paths-2.py
@@ -0,0 +1,48 @@
+# Verify that execution paths work in HTML output.
+
+from htmltest import *
+
+import pytest
+
+@pytest.fixture(scope='function', autouse=True)
+def html_tree():
+ return html_tree_from_env()
+
+def test_paths(html_tree):
+ root = html_tree.getroot ()
+ assert root.tag == make_tag('html')
+
+ body = root.find('xhtml:body', ns)
+ assert body is not None
+
+ diag_list = body.find('xhtml:div', ns)
+ assert diag_list is not None
+ assert diag_list.attrib['class'] == 'gcc-diagnostic-list'
+
+ diag = diag_list.find('xhtml:div', ns)
+ assert diag is not None
+ assert diag.attrib['class'] == 'alert alert-danger'
+ assert diag.attrib['id'] == 'gcc-diag-0'
+
+ exec_path = diag.find("./xhtml:div[@id='execution-path']", ns)
+ assert exec_path is not None
+
+ label = exec_path.find('xhtml:label', ns)
+ assert label.text == 'Execution path with 3 events'
+
+ event_ranges = exec_path.find('xhtml:div', ns)
+ assert_class(event_ranges, 'event-ranges')
+
+ frame_margin = event_ranges.find('xhtml:table', ns)
+ assert_class(frame_margin, 'stack-frame-with-margin')
+
+ tr = frame_margin.find('xhtml:tr', ns)
+ assert tr is not None
+ tds = tr.findall('xhtml:td', ns)
+ assert len(tds) == 2
+
+ assert_class(tds[0], 'interprocmargin')
+
+ test_frame = tds[1]
+ assert_frame(test_frame, 'make_a_list_of_random_ints_badly')
+ assert_event_range_with_margin(test_frame[1])
diff --git a/gcc/testsuite/gcc.dg/plugin/diagnostic-test-paths-3.c b/gcc/testsuite/gcc.dg/plugin/diagnostic-test-paths-3.c
deleted file mode 100644
index a315d20..0000000
--- a/gcc/testsuite/gcc.dg/plugin/diagnostic-test-paths-3.c
+++ /dev/null
@@ -1,75 +0,0 @@
-/* { dg-do compile } */
-/* { dg-options "-fdiagnostics-format=json" } */
-
-#include <stddef.h>
-#include <stdlib.h>
-
-/* Minimal reimplementation of cpython API. */
-typedef struct PyObject {} PyObject;
-extern int PyArg_ParseTuple (PyObject *args, const char *fmt, ...);
-extern PyObject *PyList_New (int);
-extern PyObject *PyLong_FromLong(long);
-extern void PyList_Append(PyObject *list, PyObject *item);
-
-PyObject *
-make_a_list_of_random_ints_badly(PyObject *self,
- PyObject *args)
-{
- PyObject *list, *item;
- long count, i;
-
- if (!PyArg_ParseTuple(args, "i", &count)) {
- return NULL;
- }
-
- list = PyList_New(0);
-
- for (i = 0; i < count; i++) {
- item = PyLong_FromLong(random());
- PyList_Append(list, item);
- }
-
- return list;
-}
-
-/* { dg-begin-multiline-output "" }
-[{"kind": "error",
- "message": "passing NULL as argument 1 to 'PyList_Append' which requires a non-NULL parameter",
- "children": [],
- "column-origin": 1,
- "locations": [{"caret": {"file": "
- "line": 29,
- "display-column": 5,
- "byte-column": 5,
- "column": 5},
- "finish": {"file": "
- "line": 29,
- "display-column": 29,
- "byte-column": 29,
- "column": 29}}],
- "path": [{"location": {"file": "
- "line": 25,
- "display-column": 10,
- "byte-column": 10,
- "column": 10},
- "description": "when 'PyList_New' fails, returning NULL",
- "function": "make_a_list_of_random_ints_badly",
- "depth": 0},
- {"location": {"file": "
- "line": 27,
- "display-column": 17,
- "byte-column": 17,
- "column": 17},
- "description": "when 'i < count'",
- "function": "make_a_list_of_random_ints_badly",
- "depth": 0},
- {"location": {"file": "
- "line": 29,
- "display-column": 5,
- "byte-column": 5,
- "column": 5},
- "description": "when calling 'PyList_Append', passing NULL from (1) as argument 1",
- "function": "make_a_list_of_random_ints_badly",
- "depth": 0}],
- "escape-source": false}]
-{ dg-end-multiline-output "" } */
diff --git a/gcc/testsuite/gcc.dg/plugin/diagnostic-test-paths-4.c b/gcc/testsuite/gcc.dg/plugin/diagnostic-test-paths-4.c
index 847b6d4..7eb0c50 100644
--- a/gcc/testsuite/gcc.dg/plugin/diagnostic-test-paths-4.c
+++ b/gcc/testsuite/gcc.dg/plugin/diagnostic-test-paths-4.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-fdiagnostics-path-format=inline-events -fdiagnostics-show-caret -fdiagnostics-show-line-numbers" } */
+/* { dg-options "-fdiagnostics-path-format=inline-events -fdiagnostics-show-caret -fdiagnostics-show-line-numbers -fdiagnostics-add-output=experimental-html:javascript=no" } */
/* { dg-enable-nn-line-numbers "" } */
#include <stdio.h>
@@ -82,3 +82,7 @@ void test (void)
| | (9) calling 'fprintf'
|
{ dg-end-multiline-output "" } */
+
+/* Use a Python script to verify various properties about the generated
+ HTML file:
+ { dg-final { run-html-pytest diagnostic-test-paths-4.c "diagnostic-test-paths-4.py" } } */
diff --git a/gcc/testsuite/gcc.dg/plugin/diagnostic-test-paths-4.py b/gcc/testsuite/gcc.dg/plugin/diagnostic-test-paths-4.py
new file mode 100644
index 0000000..d2bc67c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/plugin/diagnostic-test-paths-4.py
@@ -0,0 +1,49 @@
+# Verify that interprocedural execution paths work in HTML output.
+
+from htmltest import *
+
+import pytest
+
+@pytest.fixture(scope='function', autouse=True)
+def html_tree():
+ return html_tree_from_env()
+
+def test_paths(html_tree):
+ diag = get_diag_by_index(html_tree, 0)
+ src = get_locus_within_diag (diag)
+
+ tbody = src.find('xhtml:tbody', ns)
+ assert_class(tbody, 'line-span')
+
+ rows = tbody.findall('xhtml:tr', ns)
+
+ quoted_src_tr = rows[0]
+ assert_quoted_line(quoted_src_tr,
+ ' 13', ' fprintf(stderr, "LOG: %s", msg); /* { dg-warning "call to \'fprintf\' from within signal handler" } */')
+
+ annotation_tr = rows[1]
+ assert_annotation_line(annotation_tr,
+ ' ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~')
+
+ exec_path = diag.find("./xhtml:div[@id='execution-path']", ns)
+ assert exec_path is not None
+
+ label = exec_path.find('xhtml:label', ns)
+ assert label.text == 'Execution path with 9 events'
+
+ event_ranges = exec_path.find('xhtml:div', ns)
+ assert_class(event_ranges, 'event-ranges')
+
+ test_frame_margin = event_ranges.find('xhtml:table', ns)
+ assert_class(test_frame_margin, 'stack-frame-with-margin')
+
+ tr = test_frame_margin.find('xhtml:tr', ns)
+ assert tr is not None
+ tds = tr.findall('xhtml:td', ns)
+ assert len(tds) == 2
+
+ assert_class(tds[0], 'interprocmargin')
+
+ test_frame = tds[1]
+ assert_frame(test_frame, 'test')
+ assert_event_range_with_margin(test_frame[1])
diff --git a/gcc/testsuite/gcc.dg/plugin/diagnostic-test-show-locus-bw-line-numbers.c b/gcc/testsuite/gcc.dg/plugin/diagnostic-test-show-locus-bw-line-numbers.c
index 1e8f73b..e81856a 100644
--- a/gcc/testsuite/gcc.dg/plugin/diagnostic-test-show-locus-bw-line-numbers.c
+++ b/gcc/testsuite/gcc.dg/plugin/diagnostic-test-show-locus-bw-line-numbers.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O -fdiagnostics-show-caret -fdiagnostics-show-line-numbers" } */
+/* { dg-options "-O -fdiagnostics-show-caret -fdiagnostics-show-line-numbers -fdiagnostics-add-output=experimental-html:javascript=no" } */
/* This is a collection of unittests for diagnostic_show_locus;
see the overview in diagnostic_plugin_test_show_locus.c.
@@ -118,3 +118,7 @@ void test_fixit_insert_newline (void)
{ dg-end-multiline-output "" } */
#endif
}
+
+/* Use a Python script to verify various properties about the generated
+ HTML file:
+ { dg-final { run-html-pytest diagnostic-test-show-locus-bw-line-numbers.c "diagnostic-test-show-locus.py" } } */
diff --git a/gcc/testsuite/gcc.dg/plugin/diagnostic-test-show-locus.py b/gcc/testsuite/gcc.dg/plugin/diagnostic-test-show-locus.py
new file mode 100644
index 0000000..aca1b6c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/plugin/diagnostic-test-show-locus.py
@@ -0,0 +1,115 @@
+# Verify that diagnostic-show-locus.cc works with HTML output.
+
+from htmltest import *
+
+import pytest
+
+@pytest.fixture(scope='function', autouse=True)
+def html_tree():
+ return html_tree_from_env()
+
+#def get_tr_within_thead(thead, idx)
+
+def get_ruler_text(thead, idx):
+ trs = thead.findall('xhtml:tr', ns)
+ tr = trs[idx]
+ tds = tr.findall('xhtml:td', ns)
+ assert len(tds) == 3
+ assert_class(tds[2], 'ruler')
+ return tds[2].text
+
+def test_very_wide_line(html_tree):
+ diag = get_diag_by_index(html_tree, 2)
+ src = get_locus_within_diag(diag)
+
+ # Check ruler
+ thead = src.find('xhtml:thead', ns)
+ assert_class(thead, 'ruler')
+ trs = thead.findall('xhtml:tr', ns)
+ assert len(trs) == 3
+
+ assert get_ruler_text(thead, 0) == ' 0 0 0 0 0 1 1 '
+ assert get_ruler_text(thead, 1) == ' 5 6 7 8 9 0 1 '
+ assert get_ruler_text(thead, 2) == '34567890123456789012345678901234567890123456789012345678901234567890123'
+
+ # Check quoted source
+ tbody = src.find('xhtml:tbody', ns)
+ assert_class(tbody, 'line-span')
+ trs = tbody.findall('xhtml:tr', ns)
+ assert len(trs) == 5
+ assert_quoted_line(trs[0], ' 43', ' float f = foo * bar; /* { dg-warning "95: test" } */')
+ assert_annotation_line(trs[1], ' ~~~~^~~~~')
+ assert_annotation_line(trs[2], ' |')
+ assert_annotation_line(trs[3], ' label 0')
+ assert_annotation_line(trs[4], ' bar * foo')
+
+def test_fixit_insert(html_tree):
+ diag = get_diag_by_index(html_tree, 3)
+ msg = get_message_within_diag(diag)
+ assert msg[0].text == 'warning: '
+ assert msg[0].tail == ' example of insertion hints'
+
+ src = get_locus_within_diag(diag)
+
+ # Check quoted source
+ tbody = src.find('xhtml:tbody', ns)
+ assert_class(tbody, 'line-span')
+ trs = tbody.findall('xhtml:tr', ns)
+ assert len(trs) == 3
+ assert_quoted_line(trs[0], ' 63', ' int a[2][2] = { 0, 1 , 2, 3 }; /* { dg-warning "insertion hints" } */')
+ assert_annotation_line(trs[1], ' ^~~~')
+ assert_annotation_line(trs[2], ' { }')
+
+def test_fixit_remove(html_tree):
+ diag = get_diag_by_index(html_tree, 4)
+ msg = get_message_within_diag(diag)
+ assert msg[0].text == 'warning: '
+ assert msg[0].tail == ' example of a removal hint'
+
+ src = get_locus_within_diag(diag)
+
+ # Check quoted source
+ tbody = src.find('xhtml:tbody', ns)
+ assert_class(tbody, 'line-span')
+ trs = tbody.findall('xhtml:tr', ns)
+ assert len(trs) == 3
+ assert_quoted_line(trs[0], ' 77', ' int a;; /* { dg-warning "example of a removal hint" } */')
+ assert_annotation_line(trs[1], ' ^')
+ assert_annotation_line(trs[2], ' -')
+
+def test_fixit_replace(html_tree):
+ diag = get_diag_by_index(html_tree, 5)
+ msg = get_message_within_diag(diag)
+ assert msg[0].text == 'warning: '
+ assert msg[0].tail == ' example of a replacement hint'
+
+ src = get_locus_within_diag(diag)
+
+ # Check quoted source
+ tbody = src.find('xhtml:tbody', ns)
+ assert_class(tbody, 'line-span')
+ trs = tbody.findall('xhtml:tr', ns)
+ assert len(trs) == 3
+ assert_quoted_line(trs[0], ' 91', ' gtk_widget_showall (dlg); /* { dg-warning "example of a replacement hint" } */')
+ assert_annotation_line(trs[1], ' ^~~~~~~~~~~~~~~~~~')
+ assert_annotation_line(trs[2], ' gtk_widget_show_all')
+
+def test_fixit_insert_newline(html_tree):
+ diag = get_diag_by_index(html_tree, 6)
+ msg = get_message_within_diag(diag)
+ assert msg[0].text == 'warning: '
+ assert msg[0].tail == ' example of newline insertion hint'
+
+ src = get_locus_within_diag(diag)
+
+ # Check quoted source
+ tbody = src.find('xhtml:tbody', ns)
+ assert_class(tbody, 'line-span')
+ trs = tbody.findall('xhtml:tr', ns)
+ assert len(trs) == 4
+ assert_quoted_line(trs[0], ' 109', ' x = a;')
+ assert_annotation_line(trs[1], ' break;',
+ expected_line_num=' +++',
+ expected_left_margin='+')
+ assert_quoted_line(trs[2], ' 110', " case 'b': /* { dg-warning \"newline insertion\" } */")
+ assert_annotation_line(trs[3], ' ^~~~~~~~')
diff --git a/gcc/testsuite/gcc.dg/plugin/diagnostic-test-xhtml-1.c b/gcc/testsuite/gcc.dg/plugin/diagnostic-test-xhtml-1.c
deleted file mode 100644
index da069ff..0000000
--- a/gcc/testsuite/gcc.dg/plugin/diagnostic-test-xhtml-1.c
+++ /dev/null
@@ -1,19 +0,0 @@
-/* { dg-do compile } */
-
-int missing_semicolon (void)
-{
- return 42
-}
-
-/* Verify some properties of the generated HTML. */
-
-/* { dg-begin-multiline-output "" }
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE html
- PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- { dg-end-multiline-output "" } */
-
-/* { dg-excess-errors "" } */
diff --git a/gcc/testsuite/gcc.dg/plugin/diagnostic_group_plugin.cc b/gcc/testsuite/gcc.dg/plugin/diagnostic_group_plugin.cc
index 5ec3418..4ade232 100644
--- a/gcc/testsuite/gcc.dg/plugin/diagnostic_group_plugin.cc
+++ b/gcc/testsuite/gcc.dg/plugin/diagnostic_group_plugin.cc
@@ -176,9 +176,10 @@ test_diagnostic_text_starter (diagnostic_text_output_format &text_output,
void
test_diagnostic_start_span_fn (const diagnostic_location_print_policy &,
- pretty_printer *pp,
+ to_text &sink,
expanded_location)
{
+ pretty_printer *pp = get_printer (sink);
pp_string (pp, "START_SPAN_FN: ");
pp_newline (pp);
}
diff --git a/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_paths.cc b/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_paths.cc
index 954538f..a7963fa 100644
--- a/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_paths.cc
+++ b/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_paths.cc
@@ -147,7 +147,9 @@ example_1 ()
{
auto_diagnostic_group d;
gcc_rich_location richloc (gimple_location (call_to_PyList_Append));
- simple_diagnostic_path path (global_dc->get_reference_printer ());
+ tree_logical_location_manager logical_loc_mgr;
+ simple_diagnostic_path path (logical_loc_mgr,
+ global_dc->get_reference_printer ());
diagnostic_event_id_t alloc_event_id
= path.add_event (gimple_location (call_to_PyList_New),
example_a_fun->decl, 0,
@@ -214,7 +216,8 @@ class test_diagnostic_path : public simple_diagnostic_path
{
public:
test_diagnostic_path (pretty_printer *event_pp)
- : simple_diagnostic_path (event_pp)
+ : simple_diagnostic_path (m_logical_loc_mgr,
+ event_pp)
{
}
diagnostic_event_id_t
@@ -262,6 +265,9 @@ class test_diagnostic_path : public simple_diagnostic_path
add_event (call_evloc.m_loc, call_evloc.m_fun->decl, caller_stack_depth,
"calling %qs", callee);
}
+
+private:
+ tree_logical_location_manager m_logical_loc_mgr;
};
static void
diff --git a/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_xhtml_format.cc b/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_xhtml_format.cc
deleted file mode 100644
index 24c6f8c..0000000
--- a/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_xhtml_format.cc
+++ /dev/null
@@ -1,985 +0,0 @@
-/* Verify that we can write a non-trivial diagnostic output format
- as a plugin (XHTML).
- Copyright (C) 2018-2024 Free Software Foundation, Inc.
- Contributed by David Malcolm <dmalcolm@redhat.com>.
-
-This file is part of GCC.
-
-GCC is free software; you can redistribute it and/or modify it under
-the terms of the GNU General Public License as published by the Free
-Software Foundation; either version 3, or (at your option) any later
-version.
-
-GCC is distributed in the hope that it will be useful, but WITHOUT ANY
-WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with GCC; see the file COPYING3. If not see
-<http://www.gnu.org/licenses/>. */
-
-
-#include "config.h"
-#define INCLUDE_LIST
-#define INCLUDE_MAP
-#define INCLUDE_MEMORY
-#define INCLUDE_VECTOR
-#include "system.h"
-#include "coretypes.h"
-#include "diagnostic.h"
-#include "diagnostic-metadata.h"
-#include "diagnostic-path.h"
-#include "cpplib.h"
-#include "logical-location.h"
-#include "diagnostic-client-data-hooks.h"
-#include "diagnostic-diagram.h"
-#include "text-art/canvas.h"
-#include "diagnostic-format.h"
-#include "diagnostic-buffer.h"
-#include "ordered-hash-map.h"
-#include "sbitmap.h"
-#include "selftest.h"
-#include "selftest-diagnostic.h"
-#include "selftest-diagnostic-show-locus.h"
-#include "text-range-label.h"
-#include "pretty-print-format-impl.h"
-#include "pretty-print-urlifier.h"
-#include "intl.h"
-#include "gcc-plugin.h"
-#include "plugin-version.h"
-
-namespace xml {
-
-/* Disable warnings about quoting issues in the pp_xxx calls below
- that (intentionally) don't follow GCC diagnostic conventions. */
-#if __GNUC__ >= 10
-# pragma GCC diagnostic push
-# pragma GCC diagnostic ignored "-Wformat-diag"
-#endif
-
-static void write_escaped_text (const char *text);
-
-struct node
-{
- virtual ~node () {}
- virtual void write_as_xml (pretty_printer *pp,
- int depth, bool indent) const = 0;
- void dump (FILE *out) const;
- void DEBUG_FUNCTION dump () const { dump (stderr); }
-};
-
-struct text : public node
-{
- text (label_text str)
- : m_str (std::move (str))
- {}
-
- void write_as_xml (pretty_printer *pp,
- int depth, bool indent) const final override;
-
- label_text m_str;
-};
-
-struct node_with_children : public node
-{
- void add_child (std::unique_ptr<node> node);
- void add_text (label_text str);
-
- std::vector<std::unique_ptr<node>> m_children;
-};
-
-struct document : public node_with_children
-{
- void write_as_xml (pretty_printer *pp,
- int depth, bool indent) const final override;
-};
-
-struct element : public node_with_children
-{
- element (const char *kind, bool preserve_whitespace)
- : m_kind (kind),
- m_preserve_whitespace (preserve_whitespace)
- {}
-
- void write_as_xml (pretty_printer *pp,
- int depth, bool indent) const final override;
-
- void set_attr (const char *name, label_text value);
-
- const char *m_kind;
- bool m_preserve_whitespace;
- std::map<const char *, label_text> m_attributes;
-};
-
-/* Implementation. */
-
-static void
-write_escaped_text (pretty_printer *pp, const char *text)
-{
- gcc_assert (text);
-
- for (const char *p = text; *p; ++p)
- {
- char ch = *p;
- switch (ch)
- {
- default:
- pp_character (pp, ch);
- break;
- case '\'':
- pp_string (pp, "&apos;");
- break;
- case '"':
- pp_string (pp, "&quot;");
- break;
- case '&':
- pp_string (pp, "&amp;");
- break;
- case '<':
- pp_string (pp, "&lt;");
- break;
- case '>':
- pp_string (pp, "&gt;");
- break;
- }
- }
-}
-
-/* struct node. */
-
-void
-node::dump (FILE *out) const
-{
- pretty_printer pp;
- pp.set_output_stream (out);
- write_as_xml (&pp, 0, true);
- pp_flush (&pp);
-}
-
-/* struct text : public node. */
-
-void
-text::write_as_xml (pretty_printer *pp, int /*depth*/, bool /*indent*/) const
-{
- write_escaped_text (pp, m_str.get ());
-}
-
-/* struct node_with_children : public node. */
-
-void
-node_with_children::add_child (std::unique_ptr<node> node)
-{
- gcc_assert (node.get ());
- m_children.push_back (std::move (node));
-}
-
-void
-node_with_children::add_text (label_text str)
-{
- gcc_assert (str.get ());
- add_child (std::make_unique <text> (std::move (str)));
-}
-
-
-/* struct document : public node_with_children. */
-
-void
-document::write_as_xml (pretty_printer *pp, int depth, bool indent) const
-{
- pp_string (pp, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
- pp_string (pp, "<!DOCTYPE html\n"
- " PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"\n"
- " \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">");
- for (auto &iter : m_children)
- iter->write_as_xml (pp, depth, indent);
-}
-
-/* struct element : public node_with_children. */
-
-void
-element::write_as_xml (pretty_printer *pp, int depth, bool indent) const
-{
- if (indent)
- {
- pp_newline (pp);
- for (int i = 0; i < depth; ++i)
- pp_string (pp, " ");
- }
-
- if (m_preserve_whitespace)
- indent = false;
-
- pp_printf (pp, "<%s", m_kind);
- for (auto &attr : m_attributes)
- {
- pp_printf (pp, " %s=\"", attr.first);
- write_escaped_text (pp, attr.second.get ());
- pp_string (pp, "\"");
- }
- if (m_children.empty ())
- pp_string (pp, " />");
- else
- {
- pp_string (pp, ">");
- for (auto &child : m_children)
- child->write_as_xml (pp, depth + 1, indent);
- if (indent)
- {
- pp_newline (pp);
- for (int i = 0; i < depth; ++i)
- pp_string (pp, " ");
- }
- pp_printf (pp, "</%s>", m_kind);
- }
-}
-
-void
-element::set_attr (const char *name, label_text value)
-{
- m_attributes[name] = std::move (value);
-}
-
-#if __GNUC__ >= 10
-# pragma GCC diagnostic pop
-#endif
-
-} // namespace xml
-
-class xhtml_builder;
-
-/* Concrete buffering implementation subclass for HTML output. */
-
-class diagnostic_xhtml_format_buffer : public diagnostic_per_format_buffer
-{
-public:
- friend class xhtml_builder;
- friend class xhtml_output_format;
-
- diagnostic_xhtml_format_buffer (xhtml_builder &builder)
- : m_builder (builder)
- {}
-
- void dump (FILE *out, int indent) const final override;
- bool empty_p () const final override;
- void move_to (diagnostic_per_format_buffer &dest) final override;
- void clear () final override;
- void flush () final override;
-
- void add_result (std::unique_ptr<xml::element> result)
- {
- m_results.push_back (std::move (result));
- }
-
-private:
- xhtml_builder &m_builder;
- std::vector<std::unique_ptr<xml::element>> m_results;
-};
-
-/* A class for managing XHTML output of diagnostics.
-
- Implemented:
- - message text
-
- Known limitations/missing functionality:
- - title for page
- - file/line/column
- - error vs warning
- - CWEs
- - rules
- - fix-it hints
- - paths
-*/
-
-class xhtml_builder
-{
-public:
- friend class diagnostic_xhtml_format_buffer;
-
- xhtml_builder (diagnostic_context &context,
- pretty_printer &pp,
- const line_maps *line_maps);
-
- void on_report_diagnostic (const diagnostic_info &diagnostic,
- diagnostic_t orig_diag_kind,
- diagnostic_xhtml_format_buffer *buffer);
- void emit_diagram (const diagnostic_diagram &diagram);
- void end_group ();
-
- std::unique_ptr<xml::element> take_current_diagnostic ()
- {
- return std::move (m_cur_diagnostic_element);
- }
-
- void flush_to_file (FILE *outf);
-
- const xml::document &get_document () const { return *m_document; }
-
- void set_printer (pretty_printer &pp)
- {
- m_printer = &pp;
- }
-
-private:
- std::unique_ptr<xml::element>
- make_element_for_diagnostic (const diagnostic_info &diagnostic,
- diagnostic_t orig_diag_kind);
-
- diagnostic_context &m_context;
- pretty_printer *m_printer;
- const line_maps *m_line_maps;
-
- std::unique_ptr<xml::document> m_document;
- xml::element *m_diagnostics_element;
- std::unique_ptr<xml::element> m_cur_diagnostic_element;
-};
-
-static std::unique_ptr<xml::element>
-make_div (label_text class_)
-{
- auto div = std::make_unique<xml::element> ("div", false);
- div->set_attr ("class", std::move (class_));
- return div;
-}
-
-static std::unique_ptr<xml::element>
-make_span (label_text class_)
-{
- auto span = std::make_unique<xml::element> ("span", true);
- span->set_attr ("class", std::move (class_));
- return span;
-}
-
-/* class diagnostic_xhtml_format_buffer : public diagnostic_per_format_buffer. */
-
-void
-diagnostic_xhtml_format_buffer::dump (FILE *out, int indent) const
-{
- fprintf (out, "%*sdiagnostic_xhtml_format_buffer:\n", indent, "");
- int idx = 0;
- for (auto &result : m_results)
- {
- fprintf (out, "%*sresult[%i]:\n", indent + 2, "", idx);
- result->dump (out);
- fprintf (out, "\n");
- ++idx;
- }
-}
-
-bool
-diagnostic_xhtml_format_buffer::empty_p () const
-{
- return m_results.empty ();
-}
-
-void
-diagnostic_xhtml_format_buffer::move_to (diagnostic_per_format_buffer &base)
-{
- diagnostic_xhtml_format_buffer &dest
- = static_cast<diagnostic_xhtml_format_buffer &> (base);
- for (auto &&result : m_results)
- dest.m_results.push_back (std::move (result));
- m_results.clear ();
-}
-
-void
-diagnostic_xhtml_format_buffer::clear ()
-{
- m_results.clear ();
-}
-
-void
-diagnostic_xhtml_format_buffer::flush ()
-{
- for (auto &&result : m_results)
- m_builder.m_diagnostics_element->add_child (std::move (result));
- m_results.clear ();
-}
-
-/* class xhtml_builder. */
-
-/* xhtml_builder's ctor. */
-
-xhtml_builder::xhtml_builder (diagnostic_context &context,
- pretty_printer &pp,
- const line_maps *line_maps)
-: m_context (context),
- m_printer (&pp),
- m_line_maps (line_maps)
-{
- gcc_assert (m_line_maps);
-
- m_document = std::make_unique<xml::document> ();
- {
- auto html_element = std::make_unique<xml::element> ("html", false);
- html_element->set_attr
- ("xmlns",
- label_text::borrow ("http://www.w3.org/1999/xhtml"));
- {
- {
- auto head_element = std::make_unique<xml::element> ("head", false);
- {
- auto title_element = std::make_unique<xml::element> ("title", true);
- label_text title (label_text::borrow ("Title goes here")); // TODO
- title_element->add_text (std::move (title));
- head_element->add_child (std::move (title_element));
- }
- html_element->add_child (std::move (head_element));
-
- auto body_element = std::make_unique<xml::element> ("body", false);
- {
- auto diagnostics_element
- = make_div (label_text::borrow ("gcc-diagnostic-list"));
- m_diagnostics_element = diagnostics_element.get ();
- body_element->add_child (std::move (diagnostics_element));
- }
- html_element->add_child (std::move (body_element));
- }
- }
- m_document->add_child (std::move (html_element));
- }
-}
-
-/* Implementation of "on_report_diagnostic" for XHTML output. */
-
-void
-xhtml_builder::on_report_diagnostic (const diagnostic_info &diagnostic,
- diagnostic_t orig_diag_kind,
- diagnostic_xhtml_format_buffer *buffer)
-{
- if (diagnostic.kind == DK_ICE || diagnostic.kind == DK_ICE_NOBT)
- {
- /* Print a header for the remaining output to stderr, and
- return, attempting to print the usual ICE messages to
- stderr. Hopefully this will be helpful to the user in
- indicating what's gone wrong (also for DejaGnu, for pruning
- those messages). */
- fnotice (stderr, "Internal compiler error:\n");
- }
-
- auto diag_element
- = make_element_for_diagnostic (diagnostic, orig_diag_kind);
- if (buffer)
- {
- gcc_assert (!m_cur_diagnostic_element);
- buffer->m_results.push_back (std::move (diag_element));
- }
- else
- {
- if (m_cur_diagnostic_element)
- /* Nested diagnostic. */
- m_cur_diagnostic_element->add_child (std::move (diag_element));
- else
- /* Top-level diagnostic. */
- m_cur_diagnostic_element = std::move (diag_element);
- }
-}
-
-std::unique_ptr<xml::element>
-xhtml_builder::make_element_for_diagnostic (const diagnostic_info &diagnostic,
- diagnostic_t orig_diag_kind)
-{
- class xhtml_token_printer : public token_printer
- {
- public:
- xhtml_token_printer (xhtml_builder &builder,
- xml::element &parent_element)
- : m_builder (builder)
- {
- m_open_elements.push_back (&parent_element);
- }
- void print_tokens (pretty_printer */*pp*/,
- const pp_token_list &tokens) final override
- {
- /* Implement print_tokens by adding child elements to
- m_parent_element. */
- for (auto iter = tokens.m_first; iter; iter = iter->m_next)
- switch (iter->m_kind)
- {
- default:
- gcc_unreachable ();
-
- case pp_token::kind::text:
- {
- pp_token_text *sub = as_a <pp_token_text *> (iter);
- /* The value might be in the obstack, so we may need to
- copy it. */
- insertion_element ().add_text
- (label_text::take (xstrdup (sub->m_value.get ())));
- }
- break;
-
- case pp_token::kind::begin_color:
- case pp_token::kind::end_color:
- /* These are no-ops. */
- break;
-
- case pp_token::kind::begin_quote:
- {
- insertion_element ().add_text (label_text::borrow (open_quote));
- push_element (make_span (label_text::borrow ("gcc-quoted-text")));
- }
- break;
- case pp_token::kind::end_quote:
- {
- pop_element ();
- insertion_element ().add_text (label_text::borrow (close_quote));
- }
- break;
-
- case pp_token::kind::begin_url:
- {
- pp_token_begin_url *sub = as_a <pp_token_begin_url *> (iter);
- auto anchor = std::make_unique<xml::element> ("a", true);
- anchor->set_attr ("href", std::move (sub->m_value));
- push_element (std::move (anchor));
- }
- break;
- case pp_token::kind::end_url:
- pop_element ();
- break;
- }
- }
-
- private:
- xml::element &insertion_element () const
- {
- return *m_open_elements.back ();
- }
- void push_element (std::unique_ptr<xml::element> new_element)
- {
- xml::element &current_top = insertion_element ();
- m_open_elements.push_back (new_element.get ());
- current_top.add_child (std::move (new_element));
- }
- void pop_element ()
- {
- m_open_elements.pop_back ();
- }
-
- xhtml_builder &m_builder;
- /* We maintain a stack of currently "open" elements.
- Children are added to the topmost open element. */
- std::vector<xml::element *> m_open_elements;
- };
-
- auto diag_element = make_div (label_text::borrow ("gcc-diagnostic"));
-
- // TODO: might be nice to emulate the text output format, but colorize it
-
- auto message_span = make_span (label_text::borrow ("gcc-message"));
- xhtml_token_printer tok_printer (*this, *message_span.get ());
- m_printer->set_token_printer (&tok_printer);
- pp_output_formatted_text (m_printer, m_context.get_urlifier ());
- m_printer->set_token_printer (nullptr);
- pp_clear_output_area (m_printer);
- diag_element->add_child (std::move (message_span));
-
- if (diagnostic.metadata)
- {
- int cwe = diagnostic.metadata->get_cwe ();
- if (cwe)
- {
- diag_element->add_text (label_text::borrow (" "));
- auto cwe_span = make_span (label_text::borrow ("gcc-cwe-metadata"));
- cwe_span->add_text (label_text::borrow ("["));
- {
- auto anchor = std::make_unique<xml::element> ("a", true);
- anchor->set_attr ("href", label_text::take (get_cwe_url (cwe)));
- pretty_printer pp;
- pp_printf (&pp, "CWE-%i", cwe);
- anchor->add_text
- (label_text::take (xstrdup (pp_formatted_text (&pp))));
- cwe_span->add_child (std::move (anchor));
- }
- cwe_span->add_text (label_text::borrow ("]"));
- diag_element->add_child (std::move (cwe_span));
- }
- }
-
- // TODO: show any rules
-
- label_text option_text = label_text::take
- (m_context.make_option_name (diagnostic.option_id,
- orig_diag_kind, diagnostic.kind));
- if (option_text.get ())
- {
- label_text option_url = label_text::take
- (m_context.make_option_url (diagnostic.option_id));
-
- diag_element->add_text (label_text::borrow (" "));
- auto option_span = make_span (label_text::borrow ("gcc-option"));
- option_span->add_text (label_text::borrow ("["));
- {
- if (option_url.get ())
- {
- auto anchor = std::make_unique<xml::element> ("a", true);
- anchor->set_attr ("href", std::move (option_url));
- anchor->add_text (std::move (option_text));
- option_span->add_child (std::move (anchor));
- }
- else
- option_span->add_text (std::move (option_text));
- option_span->add_text (label_text::borrow ("]"));
- }
- diag_element->add_child (std::move (option_span));
- }
-
- {
- auto pre = std::make_unique<xml::element> ("pre", true);
- pre->set_attr ("class", label_text::borrow ("gcc-annotated-source"));
- // TODO: ideally we'd like to capture elements within the following:
- diagnostic_show_locus (&m_context, m_context.m_source_printing,
- diagnostic.richloc, diagnostic.kind,
- m_printer);
- pre->add_text
- (label_text::take (xstrdup (pp_formatted_text (m_printer))));
- pp_clear_output_area (m_printer);
- diag_element->add_child (std::move (pre));
- }
-
- return diag_element;
-}
-
-/* Implementation of diagnostic_context::m_diagrams.m_emission_cb
- for XHTML output. */
-
-void
-xhtml_builder::emit_diagram (const diagnostic_diagram &/*diagram*/)
-{
- /* We must be within the emission of a top-level diagnostic. */
- gcc_assert (m_cur_diagnostic_element);
-
- // TODO
-}
-
-/* Implementation of "end_group_cb" for XHTML output. */
-
-void
-xhtml_builder::end_group ()
-{
- if (m_cur_diagnostic_element)
- m_diagnostics_element->add_child (std::move (m_cur_diagnostic_element));
-}
-
-/* Create a top-level object, and add it to all the results
- (and other entities) we've seen so far.
-
- Flush it all to OUTF. */
-
-void
-xhtml_builder::flush_to_file (FILE *outf)
-{
- auto top = m_document.get ();
- top->dump (outf);
- fprintf (outf, "\n");
-}
-
-class xhtml_output_format : public diagnostic_output_format
-{
-public:
- ~xhtml_output_format ()
- {
- /* Any diagnostics should have been handled by now.
- If not, then something's gone wrong with diagnostic
- groupings. */
- std::unique_ptr<xml::element> pending_diag
- = m_builder.take_current_diagnostic ();
- gcc_assert (!pending_diag);
- }
-
- void dump (FILE *out, int indent) const override
- {
- fprintf (out, "%*sxhtml_output_format\n", indent, "");
- diagnostic_output_format::dump (out, indent);
- }
-
- std::unique_ptr<diagnostic_per_format_buffer>
- make_per_format_buffer () final override
- {
- return std::make_unique<diagnostic_xhtml_format_buffer> (m_builder);
- }
- void set_buffer (diagnostic_per_format_buffer *base_buffer) final override
- {
- diagnostic_xhtml_format_buffer *buffer
- = static_cast<diagnostic_xhtml_format_buffer *> (base_buffer);
- m_buffer = buffer;
- }
-
- void on_begin_group () final override
- {
- /* No-op, */
- }
- void on_end_group () final override
- {
- m_builder.end_group ();
- }
- void
- on_report_diagnostic (const diagnostic_info &diagnostic,
- diagnostic_t orig_diag_kind) final override
- {
- m_builder.on_report_diagnostic (diagnostic, orig_diag_kind, m_buffer);
- }
- void on_diagram (const diagnostic_diagram &diagram) final override
- {
- m_builder.emit_diagram (diagram);
- }
- void after_diagnostic (const diagnostic_info &)
- {
- /* No-op, but perhaps could show paths here. */
- }
- bool follows_reference_printer_p () const final override
- {
- return false;
- }
- void update_printer () final override
- {
- m_printer = m_context.clone_printer ();
-
- /* Don't colorize the text. */
- pp_show_color (m_printer.get ()) = false;
-
- /* No textual URLs. */
- m_printer->set_url_format (URL_FORMAT_NONE);
-
- /* Update the builder to use the new printer. */
- m_builder.set_printer (*get_printer ());
- }
-
- const xml::document &get_document () const
- {
- return m_builder.get_document ();
- }
-
-protected:
- xhtml_output_format (diagnostic_context &context,
- const line_maps *line_maps)
- : diagnostic_output_format (context),
- m_builder (context, *get_printer (), line_maps),
- m_buffer (nullptr)
- {}
-
- xhtml_builder m_builder;
- diagnostic_xhtml_format_buffer *m_buffer;
-};
-
-class xhtml_stream_output_format : public xhtml_output_format
-{
-public:
- xhtml_stream_output_format (diagnostic_context &context,
- const line_maps *line_maps,
- FILE *stream)
- : xhtml_output_format (context, line_maps),
- m_stream (stream)
- {
- }
- ~xhtml_stream_output_format ()
- {
- m_builder.flush_to_file (m_stream);
- }
- bool machine_readable_stderr_p () const final override
- {
- return m_stream == stderr;
- }
-private:
- FILE *m_stream;
-};
-
-class xhtml_file_output_format : public xhtml_output_format
-{
-public:
- xhtml_file_output_format (diagnostic_context &context,
- const line_maps *line_maps,
- const char *base_file_name)
- : xhtml_output_format (context, line_maps),
- m_base_file_name (xstrdup (base_file_name))
- {
- }
- ~xhtml_file_output_format ()
- {
- char *filename = concat (m_base_file_name, ".xhtml", nullptr);
- free (m_base_file_name);
- m_base_file_name = nullptr;
- FILE *outf = fopen (filename, "w");
- if (!outf)
- {
- const char *errstr = xstrerror (errno);
- fnotice (stderr, "error: unable to open '%s' for writing: %s\n",
- filename, errstr);
- free (filename);
- return;
- }
- m_builder.flush_to_file (outf);
- fclose (outf);
- free (filename);
- }
- bool machine_readable_stderr_p () const final override
- {
- return false;
- }
-
-private:
- char *m_base_file_name;
-};
-
-/* Populate CONTEXT in preparation for XHTML output (either to stderr, or
- to a file). */
-
-static void
-diagnostic_output_format_init_xhtml (diagnostic_context &context,
- std::unique_ptr<xhtml_output_format> fmt)
-{
- /* Don't colorize the text. */
- pp_show_color (fmt->get_printer ()) = false;
- context.set_show_highlight_colors (false);
-
- context.set_output_format (std::move (fmt));
-}
-
-/* Populate CONTEXT in preparation for XHTML output to stderr. */
-
-void
-diagnostic_output_format_init_xhtml_stderr (diagnostic_context &context,
- const line_maps *line_maps)
-{
- gcc_assert (line_maps);
- auto format = std::make_unique<xhtml_stream_output_format> (context,
- line_maps,
- stderr);
- diagnostic_output_format_init_xhtml (context, std::move (format));
-}
-
-/* Populate CONTEXT in preparation for XHTML output to a file named
- BASE_FILE_NAME.xhtml. */
-
-void
-diagnostic_output_format_init_xhtml_file (diagnostic_context &context,
- const line_maps *line_maps,
- const char *base_file_name)
-{
- gcc_assert (line_maps);
- auto format = std::make_unique<xhtml_file_output_format> (context,
- line_maps,
- base_file_name);
- diagnostic_output_format_init_xhtml (context, std::move (format));
-}
-
-#if CHECKING_P
-
-namespace selftest {
-
-/* A subclass of xhtml_output_format for writing selftests.
- The XML output is cached internally, rather than written
- out to a file. */
-
-class test_xhtml_diagnostic_context : public test_diagnostic_context
-{
-public:
- test_xhtml_diagnostic_context ()
- {
- auto format = std::make_unique<xhtml_buffered_output_format> (*this,
- line_table);
- m_format = format.get (); // borrowed
- diagnostic_output_format_init_xhtml (*this, std::move (format));
- }
-
- const xml::document &get_document () const
- {
- return m_format->get_document ();
- }
-
-private:
- class xhtml_buffered_output_format : public xhtml_output_format
- {
- public:
- xhtml_buffered_output_format (diagnostic_context &context,
- const line_maps *line_maps)
- : xhtml_output_format (context, line_maps)
- {
- }
- bool machine_readable_stderr_p () const final override
- {
- return true;
- }
- };
-
- xhtml_output_format *m_format; // borrowed
-};
-
- /* Test of reporting a diagnostic at UNKNOWN_LOCATION to a
- diagnostic_context and examining the generated XML document.
- Verify various basic properties. */
-
-static void
-test_simple_log ()
-{
- test_xhtml_diagnostic_context dc;
-
- rich_location richloc (line_table, UNKNOWN_LOCATION);
- dc.report (DK_ERROR, richloc, nullptr, 0, "this is a test: %i", 42);
-
- const xml::document &doc = dc.get_document ();
-
- pretty_printer pp;
- doc.write_as_xml (&pp, 0, true);
- ASSERT_STREQ
- (pp_formatted_text (&pp),
- ("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
- "<!DOCTYPE html\n"
- " PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"\n"
- " \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n"
- "<html xmlns=\"http://www.w3.org/1999/xhtml\">\n"
- " <head>\n"
- " <title>Title goes here</title>\n"
- " </head>\n"
- " <body>\n"
- " <div class=\"gcc-diagnostic-list\">\n"
- " <div class=\"gcc-diagnostic\">\n"
- " <span class=\"gcc-message\">this is a test: 42</span>\n"
- " <pre class=\"gcc-annotated-source\"></pre>\n"
- " </div>\n"
- " </div>\n"
- " </body>\n"
- "</html>"));
-}
-
-/* Run all of the selftests within this file. */
-
-static void
-xhtml_format_selftests ()
-{
- test_simple_log ();
-}
-
-} // namespace selftest
-
-#endif /* CHECKING_P */
-
-/* Plugin hooks. */
-
-int plugin_is_GPL_compatible;
-
-/* Entrypoint for the plugin. */
-
-int
-plugin_init (struct plugin_name_args *plugin_info,
- struct plugin_gcc_version *version)
-{
- const char *plugin_name = plugin_info->base_name;
- int argc = plugin_info->argc;
- struct plugin_argument *argv = plugin_info->argv;
-
- if (!plugin_default_version_check (version, &gcc_version))
- return 1;
-
- global_dc->set_output_format
- (std::make_unique<xhtml_stream_output_format> (*global_dc,
- line_table,
- stderr));
-
-#if CHECKING_P
- selftest::xhtml_format_selftests ();
-#endif
-
- return 0;
-}
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..d1d7f5d 100644
--- a/gcc/testsuite/gcc.dg/plugin/plugin.exp
+++ b/gcc/testsuite/gcc.dg/plugin/plugin.exp
@@ -76,8 +76,6 @@ set plugin_test_list [list \
crash-test-ice-in-header-sarif-2.1.c \
crash-test-ice-in-header-sarif-2.2.c \
crash-test-write-though-null-sarif.c } \
- { diagnostic_plugin_xhtml_format.cc \
- diagnostic-test-xhtml-1.c } \
{ diagnostic_group_plugin.cc \
diagnostic-group-test-1.c } \
{ diagnostic_plugin_test_show_locus.cc \
@@ -107,6 +105,7 @@ set plugin_test_list [list \
diagnostic-test-inlining-4.c } \
{ diagnostic_plugin_test_metadata.cc
diagnostic-test-metadata.c \
+ diagnostic-test-metadata-html.c \
diagnostic-test-metadata-sarif.c } \
{ diagnostic_plugin_test_nesting.cc \
diagnostic-test-nesting-text-plain.c \
@@ -117,7 +116,6 @@ set plugin_test_list [list \
{ diagnostic_plugin_test_paths.cc \
diagnostic-test-paths-1.c \
diagnostic-test-paths-2.c \
- diagnostic-test-paths-3.c \
diagnostic-test-paths-4.c \
diagnostic-test-paths-5.c \
diagnostic-test-paths-multithreaded-inline-events.c \
@@ -138,7 +136,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/pr116546.c b/gcc/testsuite/gcc.dg/pr116546.c
new file mode 100644
index 0000000..b82dc27
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr116546.c
@@ -0,0 +1,46 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-evrp" } */
+
+extern long foo (void);
+extern long bar (void);
+
+long
+test1 (long n)
+{
+ n &= 7;
+ if (n == 4) {
+ if (n & 4)
+ return foo ();
+ else
+ return bar ();
+ }
+ return 0;
+}
+
+long
+test2 (long n)
+{
+ n &= 7;
+ if (n > 4) {
+ if (n & 4)
+ return foo ();
+ else
+ return bar ();
+ }
+ return 0;
+}
+
+long
+test3 (long n)
+{
+ n &= 7;
+ if (n >= 4) {
+ if (n & 4)
+ return foo ();
+ else
+ return bar ();
+ }
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-not "bar" "evrp" } } */
diff --git a/gcc/testsuite/gcc.dg/pr116892.c b/gcc/testsuite/gcc.dg/pr116892.c
new file mode 100644
index 0000000..7eb431b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr116892.c
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-options "-g -std=gnu23" } */
+
+enum fmt_type;
+
+void foo(const enum fmt_type a);
+
+enum [[gnu::packed]] fmt_type {
+ A
+} const a;
+
diff --git a/gcc/testsuite/gcc.dg/pr118948-1.c b/gcc/testsuite/gcc.dg/pr118948-1.c
new file mode 100644
index 0000000..2a46cf1
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr118948-1.c
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-options "" } */
+
+/* PR c/118948 */
+
+/* Used to ICE in tree_expr_nonnegative_p after an error. */
+
+void f(void) {
+ int i; /* { dg-note "previous" } */
+ for (i = 0; i < 2; i++) ;
+ float i; /* { dg-error "conflicting types for" } */
+}
diff --git a/gcc/testsuite/gcc.dg/pr119039-1.c b/gcc/testsuite/gcc.dg/pr119039-1.c
new file mode 100644
index 0000000..f91d5eb
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr119039-1.c
@@ -0,0 +1,32 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-evrp" } */
+
+extern void foo (void);
+extern void bar (void);
+extern void baz (void);
+
+/* Tests the ability to remove cases that are subranges. */
+
+void
+test (int i)
+{
+ if (i < 0 || i > 45)
+ return;
+ if (i >= 7 && i <= 8)
+ return;
+
+ switch (i)
+ {
+ case 1:
+ bar ();
+ break;
+ case 7 ... 8:
+ foo ();
+ case 14:
+ baz ();
+ break;
+ default:
+ break;
+ }
+}
+/* { dg-final { scan-tree-dump-not "foo " "evrp" } } */
diff --git a/gcc/testsuite/gcc.dg/pr119039-2.c b/gcc/testsuite/gcc.dg/pr119039-2.c
new file mode 100644
index 0000000..634b400
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr119039-2.c
@@ -0,0 +1,60 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-evrp" } */
+
+extern void good (void);
+extern void bad (void);
+
+/* Switch simplification should remove 'case 2:' because 'i' will always
+ * have its 0th bit set (odd). */
+
+void bitmask_elimination_1(int i)
+{
+ i = i | 1;
+
+ switch (i)
+ {
+ case 1:
+ good ();
+ break;
+
+ // This case should be removed;
+ case 2:
+ bad ();
+ break;
+
+ case 3:
+ good ();
+ break;
+
+ default:
+ break;
+ }
+}
+
+/* Switch simplification should remove 'case 20-28:' because 'i' will always
+ * be a multiple of 16. */
+void bitmask_elimination_2 (int i)
+{
+ int masked_val = i & 0xF0; // This zeroes out the lower 4 bits of 'i'
+
+ switch (masked_val)
+ {
+ case 0:
+ good (); // Reachable.
+ break;
+
+ // This entire cased should be removed;
+ case 20 ... 28:
+ bad ();
+ break;
+
+ case 32:
+ good (); // Reachable.
+ break;
+
+ default:
+ good ();
+ break;
+ }
+}
+/* { dg-final { scan-tree-dump-not "bad" "evrp" } } */
diff --git a/gcc/testsuite/gcc.dg/pr119160.c b/gcc/testsuite/gcc.dg/pr119160.c
index b4629a1..c3d9b81 100644
--- a/gcc/testsuite/gcc.dg/pr119160.c
+++ b/gcc/testsuite/gcc.dg/pr119160.c
@@ -1,8 +1,22 @@
/* { dg-do run } */
-/* { dg-options "-O2 -finstrument-functions-once -favoid-store-forwarding -fnon-call-exceptions -fschedule-insns -mgeneral-regs-only -Wno-psabi" } */
+/* { dg-options "-O2 -finstrument-functions-once -favoid-store-forwarding -fnon-call-exceptions -fschedule-insns -Wno-psabi" } */
+/* { dg-additional-options "-mgeneral-regs-only" { target { x86_64-*-* i?86-*-* arm*-*-* aarch64*-*-* } } } */
typedef __attribute__((__vector_size__ (32))) int V;
+/* Add empty implementations of __cyg_profile_func_enter() and
+ __cyg_profile_func_exit() to avoid problems on non-glibc
+ systems. */
+void __attribute__((no_instrument_function))
+__cyg_profile_func_enter(void *this_fn, void *call_site)
+{
+}
+
+void __attribute__((no_instrument_function))
+__cyg_profile_func_exit(void *this_fn, void *call_site)
+{
+}
+
void
foo (V v, V, V, V *r)
{
diff --git a/gcc/testsuite/gcc.dg/pr120074.c b/gcc/testsuite/gcc.dg/pr120074.c
new file mode 100644
index 0000000..3f31516
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr120074.c
@@ -0,0 +1,20 @@
+/* PR tree-optimization/120074 */
+/* { dg-do compile } */
+/* { dg-options "-O1 -fno-tree-copy-prop -fno-tree-forwprop -fno-tree-ccp" } */
+
+int foo (int);
+short a;
+int b;
+
+int
+bar (int d, int e)
+{
+ return d < 0 || d > __INT_MAX__ >> e;
+}
+
+int
+main ()
+{
+ int f = bar ((b ^ a) & 3, __SIZEOF_INT__ * __CHAR_BIT__ - 2);
+ foo (f);
+}
diff --git a/gcc/testsuite/gcc.dg/pr120277.c b/gcc/testsuite/gcc.dg/pr120277.c
new file mode 100644
index 0000000..f291e92
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr120277.c
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+int a, b;
+int c(int d, long e) {
+ switch (d) {
+ case 129:
+ a = 1;
+ case 128:
+ break;
+ default:
+ return 1;
+ }
+ *(int *)e = 0;
+}
+void f(int d, long e) { c(d, e); }
+void g() {
+ int h = b * sizeof(int);
+ f(h + 7, h);
+}
+void main() {}
diff --git a/gcc/testsuite/gcc.dg/pr120303.c b/gcc/testsuite/gcc.dg/pr120303.c
new file mode 100644
index 0000000..caeff92
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr120303.c
@@ -0,0 +1,5 @@
+/* { dg-do compile } */
+/* { dg-options "-std=c2y" } */
+
+int t = _Generic (char(1)); /* { dg-error "before numeric constant" } */
+
diff --git a/gcc/testsuite/gcc.dg/pr120353.c b/gcc/testsuite/gcc.dg/pr120353.c
new file mode 100644
index 0000000..6f8e4ac
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr120353.c
@@ -0,0 +1,11 @@
+/* PR120353: Test for -Wflex-array-member-not-at-end on structure with
+ typedef. */
+/* { dg-do compile } */
+/* { dg-options "-Wflex-array-member-not-at-end" } */
+
+typedef struct flex flex_t;
+struct flex { int n; int data[]; };
+struct out_flex_mid {flex_t flex_data; int m; }; /* { dg-warning "structure containing a flexible array member is not at the end of another structure" } */
+
+typedef struct flex flex_t1;
+struct out_flex_mid1 {flex_t1 flex_data1; int n; }; /* { dg-warning "structure containing a flexible array member is not at the end of another structure" } */
diff --git a/gcc/testsuite/gcc.dg/pr120354.c b/gcc/testsuite/gcc.dg/pr120354.c
new file mode 100644
index 0000000..6749737
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr120354.c
@@ -0,0 +1,33 @@
+/* PR120354: Test for -Wflex-array-member-not-at-end on union with
+ flexible array members. */
+/* { dg-do compile } */
+/* { dg-options "-Wflex-array-member-not-at-end" } */
+
+struct P {};
+union L {};
+
+union X {
+ int x[];
+ struct P y;
+};
+
+struct T {
+ union X x; /* { dg-warning "structure containing a flexible array member is not at the end of another structure" } */
+ int plug;
+};
+
+struct Q {
+ int len;
+ int data[];
+};
+
+union Y {
+ struct Q q;
+ union L y;
+};
+
+struct S {
+ union Y y; /* { dg-warning "structure containing a flexible array member is not at the end of another structure" } */
+ int plug;
+};
+
diff --git a/gcc/testsuite/gcc.dg/pr120380.c b/gcc/testsuite/gcc.dg/pr120380.c
new file mode 100644
index 0000000..10577a1
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr120380.c
@@ -0,0 +1,24 @@
+/* PR c/120380 */
+/* { dg-do compile } */
+
+struct pair_t {
+ char c;
+ int i;
+};
+typedef struct foo_ { /* { dg-error "no member" } */
+ struct foo_ { /* { dg-error "nested redefinition" } */
+ /* { dg-error "no member" "" { target *-*-* } .-1 } */
+ struct foo_ { /* { dg-error "nested redefinition" } */
+ int value;
+ }
+ } /* { dg-error "does not declare anything" } */
+ /* { dg-error "no semicolon" "" { target *-*-* } .-1 } */
+} __attribute__((packed)) foo; /* { dg-error "does not declare anything" } */
+ /* { dg-error "no semicolon" "" { target *-*-* } .-1 } */
+struct pair_t p = {0, 1};
+foo *addr = (foo *)&p.i;
+int main() {
+ addr->value = 0; /* { dg-error "has no member" } */
+ return 0;
+}
+
diff --git a/gcc/testsuite/gcc.dg/pr120381.c b/gcc/testsuite/gcc.dg/pr120381.c
new file mode 100644
index 0000000..5c017e6
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr120381.c
@@ -0,0 +1,10 @@
+/* PR120381 */
+/* { dg-do compile } */
+
+struct A {
+ struct A { /* { dg-error "nested redefinition" } */
+ struct A *p;
+ } *p;
+};
+int foo(const struct A *q) { return q->p == q; }
+
diff --git a/gcc/testsuite/gcc.dg/pr120447.c b/gcc/testsuite/gcc.dg/pr120447.c
new file mode 100644
index 0000000..bd51f9b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr120447.c
@@ -0,0 +1,24 @@
+/* { dg-options "-Ofast" } */
+/* { dg-additional-options "-mcpu=neoverse-v2" { target aarch64*-*-* } } */
+
+char g;
+long h;
+typedef struct {
+ void *data;
+} i;
+i* a;
+void b(i *j, char *p2);
+void c(char *d) {
+ d = d ? " and " : " or ";
+ b(a, d);
+}
+void b(i *j, char *p2) {
+ h = __builtin_strlen(p2);
+ while (g)
+ ;
+ int *k = j->data;
+ char *l = p2, *m = p2 + h;
+ l += 4;
+ while (l < m)
+ *k++ = *l++;
+}
diff --git a/gcc/testsuite/gcc.dg/pr120480.c b/gcc/testsuite/gcc.dg/pr120480.c
new file mode 100644
index 0000000..cf7b47a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr120480.c
@@ -0,0 +1,11 @@
+/* PR target/120480 */
+/* { dg-do compile } */
+/* { dg-options "-O0" } */
+
+struct S { int a, b, c; } s;
+
+void
+foo (void)
+{
+ struct S t = s;
+}
diff --git a/gcc/testsuite/gcc.dg/pr120510.c b/gcc/testsuite/gcc.dg/pr120510.c
new file mode 100644
index 0000000..d99c329
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr120510.c
@@ -0,0 +1,7 @@
+/* { dg-do compile } */
+/* { dg-options "-std=c23" } */
+
+void f (int [_Atomic]);
+void f (int [_Atomic]);
+void f (int [_Atomic]);
+
diff --git a/gcc/testsuite/gcc.dg/pr120525.c b/gcc/testsuite/gcc.dg/pr120525.c
new file mode 100644
index 0000000..5ab7a22
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr120525.c
@@ -0,0 +1,22 @@
+/* { dg-do compile { target fpic } } */
+/* { dg-options "-O2 -fpic -g" } */
+/* { dg-additional-options "-m31" { target s390x-*-* } } */
+
+typedef __SIZE_TYPE__ uintptr_t;
+static __thread uintptr_t start_sp;
+static inline uintptr_t
+__thread_stack_pointer (void)
+{
+ return (uintptr_t) __builtin_frame_address (0);
+}
+
+void
+update_data (void)
+{
+ if (__builtin_expect ((!start_sp), 0))
+ start_sp = __thread_stack_pointer ();
+
+ uintptr_t sp = __thread_stack_pointer ();
+ if (__builtin_expect ((sp > start_sp), 0))
+ start_sp = sp;
+}
diff --git a/gcc/testsuite/gcc.dg/pr120630.c b/gcc/testsuite/gcc.dg/pr120630.c
new file mode 100644
index 0000000..14b0aaf
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr120630.c
@@ -0,0 +1,25 @@
+/* PR middle-end/120630 */
+/* { dg-do run } */
+/* { dg-options "-O3 -fno-tree-loop-im -fno-tree-loop-optimize -fno-tree-ch" } */
+
+int a, c, d;
+
+void
+foo (int b)
+{
+ a = b;
+}
+
+int
+main ()
+{
+ while (d)
+ ;
+ for (c = 0; c > -3; c--)
+ {
+ long f = c;
+ foo (f >> 2);
+ }
+ if (a != -1)
+ __builtin_abort ();
+}
diff --git a/gcc/testsuite/gcc.dg/pr120638.c b/gcc/testsuite/gcc.dg/pr120638.c
new file mode 100644
index 0000000..4a057a0
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr120638.c
@@ -0,0 +1,31 @@
+/* PR tree-optimization/120638 */
+/* { dg-do run } */
+/* { dg-options "-O2 -ffast-math" } */
+
+extern float sqrtf (float x);
+
+__attribute__((noipa)) float
+foo (unsigned int s)
+{
+ return 0.5f / sqrtf (1.f + s);
+}
+
+__attribute__((noipa)) float
+bar (float s)
+{
+ if (s < 0.0 || s > 65535.0f)
+ __builtin_unreachable ();
+ return 0.5f / sqrtf (1.f + s);
+}
+
+int
+main ()
+{
+ if (__builtin_fabsf (foo (3) - 0.25f) > 0.00390625f
+ || __builtin_fabsf (foo (15) - 0.125f) > 0.00390625f
+ || __builtin_fabsf (foo (63) - 0.0625f) > 0.00390625f
+ || __builtin_fabsf (bar (3.0f) - 0.25f) > 0.00390625f
+ || __builtin_fabsf (bar (15.0f) - 0.125f) > 0.00390625f
+ || __builtin_fabsf (bar (63.0f) - 0.0625f) > 0.00390625f)
+ __builtin_abort ();
+}
diff --git a/gcc/testsuite/gcc.dg/pr120661-1.c b/gcc/testsuite/gcc.dg/pr120661-1.c
new file mode 100644
index 0000000..abf9210
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr120661-1.c
@@ -0,0 +1,51 @@
+/* { dg-do compile } */
+/* { dg-options "-std=c23 -Os" } */
+
+typedef __builtin_va_list __gnuc_va_list;
+typedef __gnuc_va_list va_list;
+
+int e, a, b;
+int f(int b, ...) {
+ va_list args;
+ __builtin_c23_va_start(args, b);
+ unsigned c = 1;
+ for (int d; d < b; ++d)
+ c = c ^ 1;
+ return c;
+}
+static int fn3(int l, int i, int n) {
+ int j;
+ goto k;
+r:
+ j = (f(e) + 1641730381) * l + 1189664732 * n + 1064 * i - 1545337304;
+ if (903562339 * j + n >= 0)
+ goto m;
+ goto ac;
+k:
+ if (0)
+ goto ad;
+ goto t;
+ad:
+ if (b)
+ goto s;
+ goto r;
+m:
+ goto ad;
+t:
+ j = l;
+ l = 800794 * j;
+ goto ad;
+s:
+ b = 2 * b + 1;
+ if (a + (long)j)
+ goto t;
+ i = n;
+ goto s;
+ac:
+}
+int main() {
+ if (a)
+ if (fn3(-1, 1, -1))
+ fn3(1, 0, 3);
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/pr120661-2.c b/gcc/testsuite/gcc.dg/pr120661-2.c
new file mode 100644
index 0000000..05d976d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr120661-2.c
@@ -0,0 +1,39 @@
+/* { dg-do compile } */
+/* { dg-options "-std=c23 -O2" } */
+
+typedef __builtin_va_list __gnuc_va_list;
+typedef __gnuc_va_list va_list;
+
+int a, c, d;
+int e(int b, ...) {
+ va_list args;
+ __builtin_c23_va_start(args, b);
+
+ int r = 0;
+ for (int i = 0; i < b; i++) {
+ int v = __builtin_va_arg(args, int);
+ r += v;
+ }
+ __builtin_va_end (args);
+ return r;
+}
+int f() { e(0); }
+int main() {
+ int h = 0, g = 0;
+ goto l;
+i:
+ if (f() * h)
+ goto k;
+j:
+ h = h - 2;
+k:
+ d = 1200000000 * h + 10;
+ g = (long)g + -1000000000 * d + 1;
+ if (a * h >= 0) {
+ if (g + (c - (long)1) >= 0)
+ goto i;
+ return 0;
+ }
+l:
+ goto j;
+}
diff --git a/gcc/testsuite/gcc.dg/pr120701.c b/gcc/testsuite/gcc.dg/pr120701.c
new file mode 100644
index 0000000..09f7b61
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr120701.c
@@ -0,0 +1,40 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+int a, b, c, e, f;
+int main() {
+ int d, g, i;
+j:
+ if (d >= 0)
+ goto k;
+ if (g >= 0)
+ goto l;
+k:
+ i = a + 3;
+m:
+ f = 652685095 + 818172564 * g;
+ if (-1101344938 * f - 1654872807 * d >= 0)
+ goto n;
+ goto l;
+o:
+ if (i) {
+ c = -b;
+ if (-c >= 0)
+ goto l;
+ g = b;
+ b = i + 5;
+ if (b * c)
+ goto n;
+ goto o;
+ }
+ if (e)
+ goto m;
+ goto j;
+n:
+ d = 978208086 * g - 1963072513;
+ if (d + i)
+ return 0;
+ goto k;
+l:
+ goto o;
+}
diff --git a/gcc/testsuite/gcc.dg/pr55152-2.c b/gcc/testsuite/gcc.dg/pr55152-2.c
index 24068cf..7533ab4 100644
--- a/gcc/testsuite/gcc.dg/pr55152-2.c
+++ b/gcc/testsuite/gcc.dg/pr55152-2.c
@@ -1,6 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-O -ffinite-math-only -fno-signed-zeros -fstrict-overflow -fdump-tree-optimized" } */
-/* { dg-additional-options "-msse -mfpmath=sse" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
+/* { dg-additional-options "-msse2 -mfpmath=sse" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
double g (double a)
{
diff --git a/gcc/testsuite/gcc.dg/pr78408-1.c b/gcc/testsuite/gcc.dg/pr78408-1.c
index a2d9306..feb9180 100644
--- a/gcc/testsuite/gcc.dg/pr78408-1.c
+++ b/gcc/testsuite/gcc.dg/pr78408-1.c
@@ -1,8 +1,7 @@
/* PR c/78408 */
/* { dg-do compile { target size32plus } } */
/* { dg-options "-O2 -fdump-tree-ccp-details -fdump-tree-forwprop-details" } */
-/* { dg-final { scan-tree-dump-times "after previous" 1 "ccp1" } } */
-/* { dg-final { scan-tree-dump-times "after previous" 16 "forwprop1" } } */
+/* { dg-final { scan-tree-dump-times "after previous" 17 "forwprop1" } } */
struct S { char a[33]; };
struct T { char a[65536]; };
diff --git a/gcc/testsuite/gcc.dg/pr87600.h b/gcc/testsuite/gcc.dg/pr87600.h
index af91f63..c89071eb 100644
--- a/gcc/testsuite/gcc.dg/pr87600.h
+++ b/gcc/testsuite/gcc.dg/pr87600.h
@@ -7,7 +7,7 @@
#elif defined (__i386__)
# define REG1 "%eax"
# define REG2 "%edx"
-#elif defined (__powerpc__) || defined (__POWERPC__)
+#elif defined (__powerpc__) || defined (__POWERPC__) || defined (__PPC__)
# define REG1 "r3"
# define REG2 "r4"
#elif defined (__s390__)
diff --git a/gcc/testsuite/gcc.dg/pr89313.c b/gcc/testsuite/gcc.dg/pr89313.c
index 76cb091..7de64da 100644
--- a/gcc/testsuite/gcc.dg/pr89313.c
+++ b/gcc/testsuite/gcc.dg/pr89313.c
@@ -8,7 +8,7 @@
# define REG "r0"
#elif defined (__i386__)
# define REG "%eax"
-#elif defined (__powerpc__) || defined (__POWERPC__)
+#elif defined (__powerpc__) || defined (__POWERPC__) || defined (__PPC__)
# define REG "r3"
#elif defined (__s390__)
# define REG "0"
diff --git a/gcc/testsuite/gcc.dg/rtl/aarch64/vec-series-1.c b/gcc/testsuite/gcc.dg/rtl/aarch64/vec-series-1.c
new file mode 100644
index 0000000..6f795c6
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/rtl/aarch64/vec-series-1.c
@@ -0,0 +1,35 @@
+/* { dg-do compile { target aarch64*-*-* } } */
+/* { dg-options "-O2 -msve-vector-bits=256 -mlittle-endian" } */
+
+#include <arm_sve.h>
+
+#pragma GCC target "+sve"
+
+svint64x2_t __RTL (startwith ("vregs")) foo ()
+{
+ (function "foo"
+ (insn-chain
+ (block 2
+ (edge-from entry (flags "FALLTHRU"))
+ (cnote 1 [bb 2] NOTE_INSN_BASIC_BLOCK)
+ (cnote 2 NOTE_INSN_FUNCTION_BEG)
+ (insn 3 (set (reg:VNx4DI <0>)
+ (const_vector:VNx4DI [(const_int 11)
+ (const_int 12)
+ (const_int 13)
+ (const_int 14)
+ (const_int 15)
+ (const_int 16)
+ (const_int 17)
+ (const_int 18)])))
+ (insn 4 (set (reg:VNx4DI v0) (reg:VNx4DI <0>)))
+ (insn 5 (use (reg:VNx4DI v0)))
+ (edge-to exit (flags "FALLTHRU"))
+ ) ;; block 2
+ ) ;; insn-chain
+ (crtl (return_rtx (reg:VNx4DI v0)))
+ ) ;; function
+}
+
+/* { dg-final { scan-assembler {\tindex\tz0\.d, #11, #1\n} } } */
+/* { dg-final { scan-assembler {\tindex\tz1\.d, #15, #1\n} } } */
diff --git a/gcc/testsuite/gcc.dg/rtl/aarch64/vec-series-2.c b/gcc/testsuite/gcc.dg/rtl/aarch64/vec-series-2.c
new file mode 100644
index 0000000..17e46cb
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/rtl/aarch64/vec-series-2.c
@@ -0,0 +1,35 @@
+/* { dg-do compile { target aarch64*-*-* } } */
+/* { dg-options "-O2 -msve-vector-bits=256 -mlittle-endian" } */
+
+#include <arm_sve.h>
+
+#pragma GCC target "+sve"
+
+svint64x2_t __RTL (startwith ("vregs")) foo ()
+{
+ (function "foo"
+ (insn-chain
+ (block 2
+ (edge-from entry (flags "FALLTHRU"))
+ (cnote 1 [bb 2] NOTE_INSN_BASIC_BLOCK)
+ (cnote 2 NOTE_INSN_FUNCTION_BEG)
+ (insn 3 (set (reg:VNx4DI <0>)
+ (const_vector:VNx4DI [(const_int -16)
+ (const_int -15)
+ (const_int -14)
+ (const_int -13)
+ (const_int -12)
+ (const_int -11)
+ (const_int -10)
+ (const_int -9)])))
+ (insn 4 (set (reg:VNx4DI v0) (reg:VNx4DI <0>)))
+ (insn 5 (use (reg:VNx4DI v0)))
+ (edge-to exit (flags "FALLTHRU"))
+ ) ;; block 2
+ ) ;; insn-chain
+ (crtl (return_rtx (reg:VNx4DI v0)))
+ ) ;; function
+}
+
+/* { dg-final { scan-assembler {\tindex\tz0\.d, #-16, #1\n} } } */
+/* { dg-final { scan-assembler {\tindex\tz1\.d, #-12, #1\n} } } */
diff --git a/gcc/testsuite/gcc.dg/strlenopt-80.c b/gcc/testsuite/gcc.dg/strlenopt-80.c
index 63d4eb1..0b16a41 100644
--- a/gcc/testsuite/gcc.dg/strlenopt-80.c
+++ b/gcc/testsuite/gcc.dg/strlenopt-80.c
@@ -6,7 +6,7 @@
{ dg-do compile { target { { aarch64*-*-* i?86-*-* x86_64-*-* } || { { powerpc*-*-* } && lp64 } } } }
{ dg-options "-O2 -Wall -fdump-tree-optimized" }
- { dg-additional-options "-msse" { target i?86-*-* x86_64-*-* } } */
+ { dg-additional-options "-msse2" { target i?86-*-* x86_64-*-* } } */
/* On powerpc configurations that have -mstrict-align by default,
the memcpy calls for ncpylog >= 3 are not turned into MEM_REFs.
diff --git a/gcc/testsuite/gcc.dg/torture/bitint-78.c b/gcc/testsuite/gcc.dg/torture/bitint-78.c
new file mode 100644
index 0000000..de092d6
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/bitint-78.c
@@ -0,0 +1,102 @@
+/* { dg-do run { target bitint } } */
+/* { dg-options "-std=c23 -pedantic-errors" } */
+/* { dg-skip-if "" { ! run_expensive_tests } { "*" } { "-O0" "-O2" } } */
+/* { dg-skip-if "" { ! run_expensive_tests } { "-flto" } { "" } } */
+
+#if __BITINT_MAXWIDTH__ >= 156
+struct S156 { unsigned _BitInt(156) a : 135; _BitInt(156) b : 2; };
+struct S156 s1 = { 18071796389618321960417503813958783219759uwb, 0 };
+struct S156 s2 = { 18071796389618321960417503813958783219759uwb, -1 };
+struct T156 { _BitInt(156) a : 2; unsigned _BitInt(156) b : 135; _BitInt(156) c : 2; };
+struct T156 s3 = { -1, 10623570996611319062233232245276988766900uwb, -1 };
+struct T156 s4 = { 0, 10623570996611319062233232245276988766900uwb, 0 };
+#endif
+#if __BITINT_MAXWIDTH__ >= 230
+struct U230 { _BitInt(230) a : 140, b : 140, c : 168; unsigned _BitInt(230) d : 135; _BitInt(230) e : 2; };
+struct U230 s5 = { -1, -1, -167793869854583920719725244652254633450201662238868wb, -1, -1 };
+struct U230 s6 = { 0, 0, -167793869854583920719725244652254633450201662238868wb, 0, 0 };
+#endif
+#if __BITINT_MAXWIDTH__ >= 412
+struct S412 { unsigned _BitInt(412) a : 391; _BitInt(412) b : 2; };
+struct S412 s7 = { 3345867579074605921998363891622879168820794533140203757607077179689806177940265164723139484043689737118576518770430659uwb, 0 };
+struct S412 s8 = { 3345867579074605921998363891622879168820794533140203757607077179689806177940265164723139484043689737118576518770430659uwb, -1 };
+struct T412 { _BitInt(412) a : 2; unsigned _BitInt(412) b : 391; _BitInt(412) c : 2; };
+struct T412 s9 = { -1, 4349534826165161048611343533362431993802129027379695873644854753645283352804798649538744513979417539155427766538864041uwb, -1 };
+struct T412 s10 = { 0, 4349534826165161048611343533362431993802129027379695873644854753645283352804798649538744513979417539155427766538864041uwb, 0 };
+#endif
+#if __BITINT_MAXWIDTH__ >= 486
+struct U486 { _BitInt(486) a : 396, b : 396, c : 424; unsigned _BitInt(486) d : 391; _BitInt(486) e : 2; };
+struct U486 s11 = { -1, -1, -13261086392773587186244717277670203234755842300010780483040284280064790949739084884446379147987979627678541509279207301027482398wb, -1, -1 };
+struct U486 s12 = { 0, 0, 13261086392773587186244717277670203234755842300010780483040284280064790949739084884446379147987979627678541509279207301027482398wb, 0, 0 };
+#endif
+
+#if __BITINT_MAXWIDTH__ >= 156
+__attribute__((noipa)) _BitInt(156)
+f1 (struct S156 *p)
+{
+ return p->a;
+}
+
+__attribute__((noipa)) _BitInt(156)
+f2 (struct T156 *q)
+{
+ return q->b;
+}
+#endif
+
+#if __BITINT_MAXWIDTH__ >= 230
+__attribute__((noipa)) _BitInt(230)
+f3 (struct U230 *q)
+{
+ return q->c;
+}
+#endif
+
+#if __BITINT_MAXWIDTH__ >= 412
+__attribute__((noipa)) _BitInt(412)
+f4 (struct S412 *p)
+{
+ return p->a;
+}
+#endif
+
+#if __BITINT_MAXWIDTH__ >= 486
+__attribute__((noipa)) _BitInt(412)
+f5 (struct T412 *q)
+{
+ return q->b;
+}
+
+__attribute__((noipa)) _BitInt(486)
+f6 (struct U486 *q)
+{
+ return q->c;
+}
+#endif
+
+int
+main ()
+{
+#if __BITINT_MAXWIDTH__ >= 156
+ if (f1 (&s1) != 18071796389618321960417503813958783219759wb
+ || f1 (&s2) != 18071796389618321960417503813958783219759wb
+ || f2 (&s3) != 10623570996611319062233232245276988766900wb
+ || f2 (&s4) != 10623570996611319062233232245276988766900wb
+#if __BITINT_MAXWIDTH__ >= 230
+ || f3 (&s5) != -167793869854583920719725244652254633450201662238868wb
+ || f3 (&s6) != -167793869854583920719725244652254633450201662238868wb
+#if __BITINT_MAXWIDTH__ >= 412
+ || f4 (&s7) != 3345867579074605921998363891622879168820794533140203757607077179689806177940265164723139484043689737118576518770430659uwb
+ || f4 (&s8) != 3345867579074605921998363891622879168820794533140203757607077179689806177940265164723139484043689737118576518770430659uwb
+ || f5 (&s9) != 4349534826165161048611343533362431993802129027379695873644854753645283352804798649538744513979417539155427766538864041uwb
+ || f5 (&s10) != 4349534826165161048611343533362431993802129027379695873644854753645283352804798649538744513979417539155427766538864041uwb
+#if __BITINT_MAXWIDTH__ >= 486
+ || f6 (&s11) != -13261086392773587186244717277670203234755842300010780483040284280064790949739084884446379147987979627678541509279207301027482398wb
+ || f6 (&s12) != 13261086392773587186244717277670203234755842300010780483040284280064790949739084884446379147987979627678541509279207301027482398wb
+#endif
+#endif
+#endif
+ || 0)
+ __builtin_abort ();
+#endif
+}
diff --git a/gcc/testsuite/gcc.dg/torture/bitint-79.c b/gcc/testsuite/gcc.dg/torture/bitint-79.c
new file mode 100644
index 0000000..bba686c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/bitint-79.c
@@ -0,0 +1,191 @@
+/* { dg-do run { target bitint } } */
+/* { dg-options "-std=c23 -pedantic-errors" } */
+/* { dg-skip-if "" { ! run_expensive_tests } { "*" } { "-O0" "-O2" } } */
+/* { dg-skip-if "" { ! run_expensive_tests } { "-flto" } { "" } } */
+
+#if __BITINT_MAXWIDTH__ >= 255
+struct S255 { unsigned _BitInt(255) a : 255, b : 255, c : 3, d : 254, e : 255; };
+struct T255 { unsigned _BitInt(255) a : 255, b : 255, c : 4, d : 254, e : 255; };
+
+__attribute__((noipa)) void
+foo255 (struct S255 *p, unsigned _BitInt(129) x, unsigned _BitInt(129) y)
+{
+ p->d = x + y;
+}
+
+__attribute__((noipa)) void
+bar255 (struct S255 *p, _BitInt(129) x, _BitInt(129) y)
+{
+ p->d = x + y;
+}
+
+__attribute__((noipa)) void
+baz255 (struct T255 *p, unsigned _BitInt(129) x, unsigned _BitInt(129) y)
+{
+ p->d = x + y;
+}
+
+__attribute__((noipa)) void
+qux255 (struct T255 *p, _BitInt(129) x, _BitInt(129) y)
+{
+ p->d = x + y;
+}
+#endif
+
+#if __BITINT_MAXWIDTH__ >= 2047
+struct S2047 { unsigned _BitInt(2047) a : 2047, b : 2047, c : 3, d : 2046, e : 2047; };
+struct T2047 { unsigned _BitInt(2047) a : 2047, b : 2047, c : 4, d : 2046, e : 2047; };
+
+__attribute__((noipa)) void
+foo2047 (struct S2047 *p, unsigned _BitInt(1025) x, unsigned _BitInt(1025) y)
+{
+ p->d = x + y;
+}
+
+__attribute__((noipa)) void
+bar2047 (struct S2047 *p, _BitInt(1025) x, _BitInt(1025) y)
+{
+ p->d = x + y;
+}
+
+__attribute__((noipa)) void
+baz2047 (struct T2047 *p, unsigned _BitInt(1025) x, unsigned _BitInt(1025) y)
+{
+ p->d = x + y;
+}
+
+__attribute__((noipa)) void
+qux2047 (struct T2047 *p, _BitInt(1025) x, _BitInt(1025) y)
+{
+ p->d = x + y;
+}
+#endif
+
+int
+main ()
+{
+#if __BITINT_MAXWIDTH__ >= 255
+ static struct S255 a255 = {
+ 53186120754797186577260219566323862446223402596797491351049671033889795175625uwb,
+ 11016010833798237411188512410350787877773522870186169967060431559664794296995uwb,
+ 3uwb,
+ 17651150055872917163600085508331814696406799705501438675213623161539428467390uwb,
+ 46115238973717368082068120592131885017219615546561407012172308861631873123384uwb };
+ foo255 (&a255, 173345522902299812179061392904021723586uwb,
+ 594746496877065132561656166247698268802uwb);
+ if (a255.a != 53186120754797186577260219566323862446223402596797491351049671033889795175625uwb
+ || a255.b != 11016010833798237411188512410350787877773522870186169967060431559664794296995uwb
+ || a255.c != 3uwb
+ || a255.d != 87527285937488017813968344288183569476uwb
+ || a255.e != 46115238973717368082068120592131885017219615546561407012172308861631873123384uwb)
+ __builtin_abort ();
+ bar255 (&a255, -295860968706196796751570199618630311203wb,
+ 250268150248006479289572648514855658614wb);
+ if (a255.a != 53186120754797186577260219566323862446223402596797491351049671033889795175625uwb
+ || a255.b != 11016010833798237411188512410350787877773522870186169967060431559664794296995uwb
+ || a255.c != 3uwb
+ || a255.d != (unsigned _BitInt(254)) -45592818458190317461997551103774652589wb
+ || a255.e != 46115238973717368082068120592131885017219615546561407012172308861631873123384uwb)
+ __builtin_abort ();
+ bar255 (&a255, 295860968706196796751570199618630311203wb,
+ -250268150248006479289572648514855658614wb);
+ if (a255.a != 53186120754797186577260219566323862446223402596797491351049671033889795175625uwb
+ || a255.b != 11016010833798237411188512410350787877773522870186169967060431559664794296995uwb
+ || a255.c != 3uwb
+ || a255.d != 45592818458190317461997551103774652589uwb
+ || a255.e != 46115238973717368082068120592131885017219615546561407012172308861631873123384uwb)
+ __builtin_abort ();
+ static struct T255 b255 = {
+ 22432197631110620165030705848624667816774533044127974798775792394287682890132uwb,
+ 10434238915154367848470352793005517845706642883922785811579699218726683347492uwb,
+ 6uwb,
+ 6417359791441959589900236647374232949533098859647531540992238539547709629124uwb,
+ 54440198277989626545578993065515754280754976615499904095101607562511754302923uwb };
+ baz255 (&b255, 173345522902299812179061392904021723586uwb,
+ 594746496877065132561656166247698268802uwb);
+ if (b255.a != 22432197631110620165030705848624667816774533044127974798775792394287682890132uwb
+ || b255.b != 10434238915154367848470352793005517845706642883922785811579699218726683347492uwb
+ || b255.c != 6uwb
+ || b255.d != 87527285937488017813968344288183569476uwb
+ || b255.e != 54440198277989626545578993065515754280754976615499904095101607562511754302923uwb)
+ __builtin_abort ();
+ qux255 (&b255, -295860968706196796751570199618630311203wb,
+ 250268150248006479289572648514855658614wb);
+ if (b255.a != 22432197631110620165030705848624667816774533044127974798775792394287682890132uwb
+ || b255.b != 10434238915154367848470352793005517845706642883922785811579699218726683347492uwb
+ || b255.c != 6uwb
+ || b255.d != (unsigned _BitInt(254)) -45592818458190317461997551103774652589wb
+ || b255.e != 54440198277989626545578993065515754280754976615499904095101607562511754302923uwb)
+ __builtin_abort ();
+ qux255 (&b255, 295860968706196796751570199618630311203wb,
+ -250268150248006479289572648514855658614wb);
+ if (b255.a != 22432197631110620165030705848624667816774533044127974798775792394287682890132uwb
+ || b255.b != 10434238915154367848470352793005517845706642883922785811579699218726683347492uwb
+ || b255.c != 6uwb
+ || b255.d != 45592818458190317461997551103774652589uwb
+ || b255.e != 54440198277989626545578993065515754280754976615499904095101607562511754302923uwb)
+ __builtin_abort ();
+#endif
+#if __BITINT_MAXWIDTH__ >= 2047
+ static struct S2047 a2047 = {
+ 6604638284533196604244471973541013618281533226364189685792053875666894057803336566484436573497392167130748586543934163550741401484647771763676964459636106203955755250170376364799937601505200975989859891863753738684249106942944581800126298385951473900411874226237184667785129620838843419470788411304260887793015638605531226504875060604515688332205834200447655374389292019856450089734989539345196623908433705347894829346923489476140677375811732806834772686417478318575505181306534740760690417577911023605293314367340174835343740361087598377394743326663660990223372181490299731215729287633035024377246940630447830332400uwb,
+ 9137501476482024007629903428591441562584201678803339450640010852682968378249451929368153750949595739310161107210507212794786347440833584007494934546214718055568442143768955715008628409876512331822501562467361613930394370954908550544883438576618916222169914979225020080371038560790263823334259485417483979863747127011670904476684110186667537336894469993151951433629276229957132898606324321221679211292427020775709202822704838337025228478551871438202955358400266599772607383213562964473056897194903298404105599382719634865500654814014675018495924284439422068568299533611891298495087865671200109507464285856856659661117uwb,
+ 3uwb,
+ 6027932121334914635743339798880634252001805340729236895908762444931865425992696360235548021447010270668149256635939999300326200737504862260957633927388112496321971644966176683706157552952742280869614447269028472263989432814406774181406202808062071176855917679050674332601759393282662520975644731312673967504693282468829790640767337337034204803704166900503628236123530078970304726919353159515533927888332084146716799866923553963246718794615364679636847688259516328750007477730553522038211483545111062280575802233656499706325920957127992496464266910119716144273601228015094027167828327389981800000899763861435249388920uwb,
+ 8804033128404257319436391796247922558656097909723817946206424086107376571363985431643405988715302457119922790818911593984275867659318063980148880188381721682101222175837894550825446110314568257002910318459491664340963523476389547801300395551742633087402381375954250806472095890015415996293082500961651310239841690830469614433038572525199550599988220404857171911882800074918573055686438920724369407729906538787728042731530804134671860407095239208695638067647644314590947763517887856674430537735913123875082727985637440472517467667915231517115684103964725547766722895041192409825339825853271319679650626338206521967332uwb };
+ foo2047 (&a2047, 96870374520559877232425023232449835594772020210727763784623672383466424139699010793947506821373137871851733734526750376478351875022731872925672817923968593208680325422683755493846732186980639465537989170494450817375451735480623479375546788222637312722297995519801563871171551494848869504437926131454949049313uwb,
+ 204286879211705664548598471253516036336450894944461293280538653272096106720692442407887688865006198655779005102679360128685207761954177030702942577918382309453894659175068179209177965184955019555984495374852658981484737374893252503438668707548935382902024863626525041196947938897658146003104268181146061978016uwb);
+ if (a2047.a != 6604638284533196604244471973541013618281533226364189685792053875666894057803336566484436573497392167130748586543934163550741401484647771763676964459636106203955755250170376364799937601505200975989859891863753738684249106942944581800126298385951473900411874226237184667785129620838843419470788411304260887793015638605531226504875060604515688332205834200447655374389292019856450089734989539345196623908433705347894829346923489476140677375811732806834772686417478318575505181306534740760690417577911023605293314367340174835343740361087598377394743326663660990223372181490299731215729287633035024377246940630447830332400uwb
+ || a2047.b != 9137501476482024007629903428591441562584201678803339450640010852682968378249451929368153750949595739310161107210507212794786347440833584007494934546214718055568442143768955715008628409876512331822501562467361613930394370954908550544883438576618916222169914979225020080371038560790263823334259485417483979863747127011670904476684110186667537336894469993151951433629276229957132898606324321221679211292427020775709202822704838337025228478551871438202955358400266599772607383213562964473056897194903298404105599382719634865500654814014675018495924284439422068568299533611891298495087865671200109507464285856856659661117uwb
+ || a2047.c != 3uwb
+ || a2047.d != 301157253732265541781023494485965871931222915155189057065162325655562530860391453201835195686379336527630738837206110505163559636976908903628615395842350902662574984597751934703024697371935659021522484545347109798860189110373875982814215495771572695624322859146326605068119490392507015507542194312601011027329uwb
+ || a2047.e != 8804033128404257319436391796247922558656097909723817946206424086107376571363985431643405988715302457119922790818911593984275867659318063980148880188381721682101222175837894550825446110314568257002910318459491664340963523476389547801300395551742633087402381375954250806472095890015415996293082500961651310239841690830469614433038572525199550599988220404857171911882800074918573055686438920724369407729906538787728042731530804134671860407095239208695638067647644314590947763517887856674430537735913123875082727985637440472517467667915231517115684103964725547766722895041192409825339825853271319679650626338206521967332uwb)
+ __builtin_abort ();
+ bar2047 (&a2047, -107041399279853750538644610804872546664073777262361485051257422505445403341239911024662125357507942225958473152601813095133468813115195351301813567477804225231126164403591882793618380878832817133932293901187006756344358795625819716260192657246036383263988109408466592090784140040462306716053681955947029302372wb,
+ 96987190807622698460264889519367881890066987668370388919983053615401815945974432823964979317479611113155186555311657934933783458381323251774060867490977621487683905191843744141366245874982592954856173370276396645258076888821241836201856003528789429151224936212560775299953235914854472460555840121467482998173wb);
+ if (a2047.a != 6604638284533196604244471973541013618281533226364189685792053875666894057803336566484436573497392167130748586543934163550741401484647771763676964459636106203955755250170376364799937601505200975989859891863753738684249106942944581800126298385951473900411874226237184667785129620838843419470788411304260887793015638605531226504875060604515688332205834200447655374389292019856450089734989539345196623908433705347894829346923489476140677375811732806834772686417478318575505181306534740760690417577911023605293314367340174835343740361087598377394743326663660990223372181490299731215729287633035024377246940630447830332400uwb
+ || a2047.b != 9137501476482024007629903428591441562584201678803339450640010852682968378249451929368153750949595739310161107210507212794786347440833584007494934546214718055568442143768955715008628409876512331822501562467361613930394370954908550544883438576618916222169914979225020080371038560790263823334259485417483979863747127011670904476684110186667537336894469993151951433629276229957132898606324321221679211292427020775709202822704838337025228478551871438202955358400266599772607383213562964473056897194903298404105599382719634865500654814014675018495924284439422068568299533611891298495087865671200109507464285856856659661117uwb
+ || a2047.c != 3uwb
+ || a2047.d != (unsigned _BitInt(2046)) -10054208472231052078379721285504664774006789593991096131274368890043587395265478200697146040028331112803286597290155160199685354733872099527752699986826603743442259211748138652252135003850224179076120530910610111086281906804577880058336653717246954112763173195905816790830904125607834255497841834479546304199wb
+ || a2047.e != 8804033128404257319436391796247922558656097909723817946206424086107376571363985431643405988715302457119922790818911593984275867659318063980148880188381721682101222175837894550825446110314568257002910318459491664340963523476389547801300395551742633087402381375954250806472095890015415996293082500961651310239841690830469614433038572525199550599988220404857171911882800074918573055686438920724369407729906538787728042731530804134671860407095239208695638067647644314590947763517887856674430537735913123875082727985637440472517467667915231517115684103964725547766722895041192409825339825853271319679650626338206521967332uwb)
+ __builtin_abort ();
+ bar2047 (&a2047, 107041399279853750538644610804872546664073777262361485051257422505445403341239911024662125357507942225958473152601813095133468813115195351301813567477804225231126164403591882793618380878832817133932293901187006756344358795625819716260192657246036383263988109408466592090784140040462306716053681955947029302372wb,
+ -96987190807622698460264889519367881890066987668370388919983053615401815945974432823964979317479611113155186555311657934933783458381323251774060867490977621487683905191843744141366245874982592954856173370276396645258076888821241836201856003528789429151224936212560775299953235914854472460555840121467482998173wb);
+ if (a2047.a != 6604638284533196604244471973541013618281533226364189685792053875666894057803336566484436573497392167130748586543934163550741401484647771763676964459636106203955755250170376364799937601505200975989859891863753738684249106942944581800126298385951473900411874226237184667785129620838843419470788411304260887793015638605531226504875060604515688332205834200447655374389292019856450089734989539345196623908433705347894829346923489476140677375811732806834772686417478318575505181306534740760690417577911023605293314367340174835343740361087598377394743326663660990223372181490299731215729287633035024377246940630447830332400uwb
+ || a2047.b != 9137501476482024007629903428591441562584201678803339450640010852682968378249451929368153750949595739310161107210507212794786347440833584007494934546214718055568442143768955715008628409876512331822501562467361613930394370954908550544883438576618916222169914979225020080371038560790263823334259485417483979863747127011670904476684110186667537336894469993151951433629276229957132898606324321221679211292427020775709202822704838337025228478551871438202955358400266599772607383213562964473056897194903298404105599382719634865500654814014675018495924284439422068568299533611891298495087865671200109507464285856856659661117uwb
+ || a2047.c != 3uwb
+ || a2047.d != 10054208472231052078379721285504664774006789593991096131274368890043587395265478200697146040028331112803286597290155160199685354733872099527752699986826603743442259211748138652252135003850224179076120530910610111086281906804577880058336653717246954112763173195905816790830904125607834255497841834479546304199uwb
+ || a2047.e != 8804033128404257319436391796247922558656097909723817946206424086107376571363985431643405988715302457119922790818911593984275867659318063980148880188381721682101222175837894550825446110314568257002910318459491664340963523476389547801300395551742633087402381375954250806472095890015415996293082500961651310239841690830469614433038572525199550599988220404857171911882800074918573055686438920724369407729906538787728042731530804134671860407095239208695638067647644314590947763517887856674430537735913123875082727985637440472517467667915231517115684103964725547766722895041192409825339825853271319679650626338206521967332uwb)
+ __builtin_abort ();
+ static struct T2047 b2047 = {
+ 8996238020280292957328835089241644192878840856627816196416318709508683098169814577226365258620493076815319486990268281142171221215928011006756119353814278158963533314155524133150379539663994828642659406032292079638106530616220996959709130065598293192861447528701351308436811527532025724876557041408124206634994855959829536357239366288943458437338903780905785942866502425145885283981390432237293769793723111403979497735186231144097215953553454988205125026498825957157417441121856068152040712774023846606695947287461796712589836037950807125680967643300197810011211640702778647554744354944603685620923084456614104269511uwb,
+ 10984318785160035171394274834520714981439611497142275792263219471171187866412794220589679181825290825434476603425001179842844662351028314167468349845879235198018132318905212119916242949709604719322253068999148260324480265586748667860001776565543787645340459243545680867668449541033392329858909661211654102449948990901244396803735089889644860800279108718607804327932252678544915255476214419499336896882183024344391755469834019036074623457176720435331996267496468629393048786381035430672504168120874305682383085268282415424323567923620247616970537420522283962923432940154412293415792945236923677598283314889480184388928uwb,
+ 6uwb,
+ 1798606950844195951030147598716811800015390660201512984851557206864623721164989116948214829831055619900979074616094715381713391051224334567599207518472773713480234276843296532963502302260253812173281125356773927761753111061777042155804806450961801268007533997704354588298664178382846967154936072745865025151298603472616831313827334985310238278265915811572231968955884887803234251471721609470596625338729927904093760632638752495449600773608705401930965052661588038833654673216098348474051355299310614202768960945808114868594476620223714044944623832011798187517371569683635328094981109544466514952661762483375701709483uwb,
+ 15898795864009764874305090919753114555137700112966361953790245810709040722233816733280023885873997896242958848192251646902459137691931517631544750216012143606605819071183153530372060489236262856491973841038138316548406269164589694469032205076355057742341341656583075897561909452907012289408703280249378682882696627977625379823499910638320190471165330121795134411615134572598658797215197404325870770080826927165671269527854053737471231889250113654062195345706056764060545970124448748001325886598996898661788527149728584429285239380904550684885882592015572632423663763016881296460620776131666328013362700459054902525252uwb };
+ baz2047 (&b2047, 96870374520559877232425023232449835594772020210727763784623672383466424139699010793947506821373137871851733734526750376478351875022731872925672817923968593208680325422683755493846732186980639465537989170494450817375451735480623479375546788222637312722297995519801563871171551494848869504437926131454949049313uwb,
+ 204286879211705664548598471253516036336450894944461293280538653272096106720692442407887688865006198655779005102679360128685207761954177030702942577918382309453894659175068179209177965184955019555984495374852658981484737374893252503438668707548935382902024863626525041196947938897658146003104268181146061978016uwb);
+ if (b2047.a != 8996238020280292957328835089241644192878840856627816196416318709508683098169814577226365258620493076815319486990268281142171221215928011006756119353814278158963533314155524133150379539663994828642659406032292079638106530616220996959709130065598293192861447528701351308436811527532025724876557041408124206634994855959829536357239366288943458437338903780905785942866502425145885283981390432237293769793723111403979497735186231144097215953553454988205125026498825957157417441121856068152040712774023846606695947287461796712589836037950807125680967643300197810011211640702778647554744354944603685620923084456614104269511uwb
+ || b2047.b != 10984318785160035171394274834520714981439611497142275792263219471171187866412794220589679181825290825434476603425001179842844662351028314167468349845879235198018132318905212119916242949709604719322253068999148260324480265586748667860001776565543787645340459243545680867668449541033392329858909661211654102449948990901244396803735089889644860800279108718607804327932252678544915255476214419499336896882183024344391755469834019036074623457176720435331996267496468629393048786381035430672504168120874305682383085268282415424323567923620247616970537420522283962923432940154412293415792945236923677598283314889480184388928uwb
+ || b2047.c != 6uwb
+ || b2047.d != 301157253732265541781023494485965871931222915155189057065162325655562530860391453201835195686379336527630738837206110505163559636976908903628615395842350902662574984597751934703024697371935659021522484545347109798860189110373875982814215495771572695624322859146326605068119490392507015507542194312601011027329uwb
+ || b2047.e != 15898795864009764874305090919753114555137700112966361953790245810709040722233816733280023885873997896242958848192251646902459137691931517631544750216012143606605819071183153530372060489236262856491973841038138316548406269164589694469032205076355057742341341656583075897561909452907012289408703280249378682882696627977625379823499910638320190471165330121795134411615134572598658797215197404325870770080826927165671269527854053737471231889250113654062195345706056764060545970124448748001325886598996898661788527149728584429285239380904550684885882592015572632423663763016881296460620776131666328013362700459054902525252uwb)
+ __builtin_abort ();
+ qux2047 (&b2047, -107041399279853750538644610804872546664073777262361485051257422505445403341239911024662125357507942225958473152601813095133468813115195351301813567477804225231126164403591882793618380878832817133932293901187006756344358795625819716260192657246036383263988109408466592090784140040462306716053681955947029302372wb,
+ 96987190807622698460264889519367881890066987668370388919983053615401815945974432823964979317479611113155186555311657934933783458381323251774060867490977621487683905191843744141366245874982592954856173370276396645258076888821241836201856003528789429151224936212560775299953235914854472460555840121467482998173wb);
+ if (b2047.a != 8996238020280292957328835089241644192878840856627816196416318709508683098169814577226365258620493076815319486990268281142171221215928011006756119353814278158963533314155524133150379539663994828642659406032292079638106530616220996959709130065598293192861447528701351308436811527532025724876557041408124206634994855959829536357239366288943458437338903780905785942866502425145885283981390432237293769793723111403979497735186231144097215953553454988205125026498825957157417441121856068152040712774023846606695947287461796712589836037950807125680967643300197810011211640702778647554744354944603685620923084456614104269511uwb
+ || b2047.b != 10984318785160035171394274834520714981439611497142275792263219471171187866412794220589679181825290825434476603425001179842844662351028314167468349845879235198018132318905212119916242949709604719322253068999148260324480265586748667860001776565543787645340459243545680867668449541033392329858909661211654102449948990901244396803735089889644860800279108718607804327932252678544915255476214419499336896882183024344391755469834019036074623457176720435331996267496468629393048786381035430672504168120874305682383085268282415424323567923620247616970537420522283962923432940154412293415792945236923677598283314889480184388928uwb
+ || b2047.c != 6uwb
+ || b2047.d != (unsigned _BitInt(2046)) -10054208472231052078379721285504664774006789593991096131274368890043587395265478200697146040028331112803286597290155160199685354733872099527752699986826603743442259211748138652252135003850224179076120530910610111086281906804577880058336653717246954112763173195905816790830904125607834255497841834479546304199wb
+ || b2047.e != 15898795864009764874305090919753114555137700112966361953790245810709040722233816733280023885873997896242958848192251646902459137691931517631544750216012143606605819071183153530372060489236262856491973841038138316548406269164589694469032205076355057742341341656583075897561909452907012289408703280249378682882696627977625379823499910638320190471165330121795134411615134572598658797215197404325870770080826927165671269527854053737471231889250113654062195345706056764060545970124448748001325886598996898661788527149728584429285239380904550684885882592015572632423663763016881296460620776131666328013362700459054902525252uwb)
+ __builtin_abort ();
+ qux2047 (&b2047, 107041399279853750538644610804872546664073777262361485051257422505445403341239911024662125357507942225958473152601813095133468813115195351301813567477804225231126164403591882793618380878832817133932293901187006756344358795625819716260192657246036383263988109408466592090784140040462306716053681955947029302372wb,
+ -96987190807622698460264889519367881890066987668370388919983053615401815945974432823964979317479611113155186555311657934933783458381323251774060867490977621487683905191843744141366245874982592954856173370276396645258076888821241836201856003528789429151224936212560775299953235914854472460555840121467482998173wb);
+ if (b2047.a != 8996238020280292957328835089241644192878840856627816196416318709508683098169814577226365258620493076815319486990268281142171221215928011006756119353814278158963533314155524133150379539663994828642659406032292079638106530616220996959709130065598293192861447528701351308436811527532025724876557041408124206634994855959829536357239366288943458437338903780905785942866502425145885283981390432237293769793723111403979497735186231144097215953553454988205125026498825957157417441121856068152040712774023846606695947287461796712589836037950807125680967643300197810011211640702778647554744354944603685620923084456614104269511uwb
+ || b2047.b != 10984318785160035171394274834520714981439611497142275792263219471171187866412794220589679181825290825434476603425001179842844662351028314167468349845879235198018132318905212119916242949709604719322253068999148260324480265586748667860001776565543787645340459243545680867668449541033392329858909661211654102449948990901244396803735089889644860800279108718607804327932252678544915255476214419499336896882183024344391755469834019036074623457176720435331996267496468629393048786381035430672504168120874305682383085268282415424323567923620247616970537420522283962923432940154412293415792945236923677598283314889480184388928uwb
+ || b2047.c != 6uwb
+ || b2047.d != 10054208472231052078379721285504664774006789593991096131274368890043587395265478200697146040028331112803286597290155160199685354733872099527752699986826603743442259211748138652252135003850224179076120530910610111086281906804577880058336653717246954112763173195905816790830904125607834255497841834479546304199uwb
+ || b2047.e != 15898795864009764874305090919753114555137700112966361953790245810709040722233816733280023885873997896242958848192251646902459137691931517631544750216012143606605819071183153530372060489236262856491973841038138316548406269164589694469032205076355057742341341656583075897561909452907012289408703280249378682882696627977625379823499910638320190471165330121795134411615134572598658797215197404325870770080826927165671269527854053737471231889250113654062195345706056764060545970124448748001325886598996898661788527149728584429285239380904550684885882592015572632423663763016881296460620776131666328013362700459054902525252uwb)
+ __builtin_abort ();
+#endif
+}
diff --git a/gcc/testsuite/gcc.dg/torture/bitint-80.c b/gcc/testsuite/gcc.dg/torture/bitint-80.c
new file mode 100644
index 0000000..283c0e0
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/bitint-80.c
@@ -0,0 +1,191 @@
+/* { dg-do run { target bitint } } */
+/* { dg-options "-std=c23 -pedantic-errors" } */
+/* { dg-skip-if "" { ! run_expensive_tests } { "*" } { "-O0" "-O2" } } */
+/* { dg-skip-if "" { ! run_expensive_tests } { "-flto" } { "" } } */
+
+#if __BITINT_MAXWIDTH__ >= 255
+struct S255 { unsigned _BitInt(255) a : 255, b : 255, c : 3, d : 235, e : 255; };
+struct T255 { unsigned _BitInt(255) a : 255, b : 255, c : 4, d : 235, e : 255; };
+
+__attribute__((noipa)) void
+foo255 (struct S255 *p, unsigned _BitInt(129) x, unsigned _BitInt(129) y)
+{
+ p->d = x + y;
+}
+
+__attribute__((noipa)) void
+bar255 (struct S255 *p, _BitInt(129) x, _BitInt(129) y)
+{
+ p->d = x + y;
+}
+
+__attribute__((noipa)) void
+baz255 (struct T255 *p, unsigned _BitInt(129) x, unsigned _BitInt(129) y)
+{
+ p->d = x + y;
+}
+
+__attribute__((noipa)) void
+qux255 (struct T255 *p, _BitInt(129) x, _BitInt(129) y)
+{
+ p->d = x + y;
+}
+#endif
+
+#if __BITINT_MAXWIDTH__ >= 2047
+struct S2047 { unsigned _BitInt(2047) a : 2047, b : 2047, c : 3, d : 2027, e : 2047; };
+struct T2047 { unsigned _BitInt(2047) a : 2047, b : 2047, c : 4, d : 2027, e : 2047; };
+
+__attribute__((noipa)) void
+foo2047 (struct S2047 *p, unsigned _BitInt(1025) x, unsigned _BitInt(1025) y)
+{
+ p->d = x + y;
+}
+
+__attribute__((noipa)) void
+bar2047 (struct S2047 *p, _BitInt(1025) x, _BitInt(1025) y)
+{
+ p->d = x + y;
+}
+
+__attribute__((noipa)) void
+baz2047 (struct T2047 *p, unsigned _BitInt(1025) x, unsigned _BitInt(1025) y)
+{
+ p->d = x + y;
+}
+
+__attribute__((noipa)) void
+qux2047 (struct T2047 *p, _BitInt(1025) x, _BitInt(1025) y)
+{
+ p->d = x + y;
+}
+#endif
+
+int
+main ()
+{
+#if __BITINT_MAXWIDTH__ >= 255
+ static struct S255 a255 = {
+ 53186120754797186577260219566323862446223402596797491351049671033889795175625uwb,
+ 11016010833798237411188512410350787877773522870186169967060431559664794296995uwb,
+ 3uwb,
+ 34443349379822557022031657812343704881254613790161917350775948942333289uwb,
+ 46115238973717368082068120592131885017219615546561407012172308861631873123384uwb };
+ foo255 (&a255, 173345522902299812179061392904021723586uwb,
+ 594746496877065132561656166247698268802uwb);
+ if (a255.a != 53186120754797186577260219566323862446223402596797491351049671033889795175625uwb
+ || a255.b != 11016010833798237411188512410350787877773522870186169967060431559664794296995uwb
+ || a255.c != 3uwb
+ || a255.d != 87527285937488017813968344288183569476uwb
+ || a255.e != 46115238973717368082068120592131885017219615546561407012172308861631873123384uwb)
+ __builtin_abort ();
+ bar255 (&a255, -295860968706196796751570199618630311203wb,
+ 250268150248006479289572648514855658614wb);
+ if (a255.a != 53186120754797186577260219566323862446223402596797491351049671033889795175625uwb
+ || a255.b != 11016010833798237411188512410350787877773522870186169967060431559664794296995uwb
+ || a255.c != 3uwb
+ || a255.d != (unsigned _BitInt(235)) -45592818458190317461997551103774652589wb
+ || a255.e != 46115238973717368082068120592131885017219615546561407012172308861631873123384uwb)
+ __builtin_abort ();
+ bar255 (&a255, 295860968706196796751570199618630311203wb,
+ -250268150248006479289572648514855658614wb);
+ if (a255.a != 53186120754797186577260219566323862446223402596797491351049671033889795175625uwb
+ || a255.b != 11016010833798237411188512410350787877773522870186169967060431559664794296995uwb
+ || a255.c != 3uwb
+ || a255.d != 45592818458190317461997551103774652589uwb
+ || a255.e != 46115238973717368082068120592131885017219615546561407012172308861631873123384uwb)
+ __builtin_abort ();
+ static struct T255 b255 = {
+ 22432197631110620165030705848624667816774533044127974798775792394287682890132uwb,
+ 10434238915154367848470352793005517845706642883922785811579699218726683347492uwb,
+ 6uwb,
+ 43803954908428856867451333914918080831779977386765104822182973124878391uwb,
+ 54440198277989626545578993065515754280754976615499904095101607562511754302923uwb };
+ baz255 (&b255, 173345522902299812179061392904021723586uwb,
+ 594746496877065132561656166247698268802uwb);
+ if (b255.a != 22432197631110620165030705848624667816774533044127974798775792394287682890132uwb
+ || b255.b != 10434238915154367848470352793005517845706642883922785811579699218726683347492uwb
+ || b255.c != 6uwb
+ || b255.d != 87527285937488017813968344288183569476uwb
+ || b255.e != 54440198277989626545578993065515754280754976615499904095101607562511754302923uwb)
+ __builtin_abort ();
+ qux255 (&b255, -295860968706196796751570199618630311203wb,
+ 250268150248006479289572648514855658614wb);
+ if (b255.a != 22432197631110620165030705848624667816774533044127974798775792394287682890132uwb
+ || b255.b != 10434238915154367848470352793005517845706642883922785811579699218726683347492uwb
+ || b255.c != 6uwb
+ || b255.d != (unsigned _BitInt(235)) -45592818458190317461997551103774652589wb
+ || b255.e != 54440198277989626545578993065515754280754976615499904095101607562511754302923uwb)
+ __builtin_abort ();
+ qux255 (&b255, 295860968706196796751570199618630311203wb,
+ -250268150248006479289572648514855658614wb);
+ if (b255.a != 22432197631110620165030705848624667816774533044127974798775792394287682890132uwb
+ || b255.b != 10434238915154367848470352793005517845706642883922785811579699218726683347492uwb
+ || b255.c != 6uwb
+ || b255.d != 45592818458190317461997551103774652589uwb
+ || b255.e != 54440198277989626545578993065515754280754976615499904095101607562511754302923uwb)
+ __builtin_abort ();
+#endif
+#if __BITINT_MAXWIDTH__ >= 2047
+ static struct S2047 a2047 = {
+ 6604638284533196604244471973541013618281533226364189685792053875666894057803336566484436573497392167130748586543934163550741401484647771763676964459636106203955755250170376364799937601505200975989859891863753738684249106942944581800126298385951473900411874226237184667785129620838843419470788411304260887793015638605531226504875060604515688332205834200447655374389292019856450089734989539345196623908433705347894829346923489476140677375811732806834772686417478318575505181306534740760690417577911023605293314367340174835343740361087598377394743326663660990223372181490299731215729287633035024377246940630447830332400uwb,
+ 9137501476482024007629903428591441562584201678803339450640010852682968378249451929368153750949595739310161107210507212794786347440833584007494934546214718055568442143768955715008628409876512331822501562467361613930394370954908550544883438576618916222169914979225020080371038560790263823334259485417483979863747127011670904476684110186667537336894469993151951433629276229957132898606324321221679211292427020775709202822704838337025228478551871438202955358400266599772607383213562964473056897194903298404105599382719634865500654814014675018495924284439422068568299533611891298495087865671200109507464285856856659661117uwb,
+ 3uwb,
+ 12047384745489858064414933953772839663477391272220883177150545757891750042677302445853708145531378904722301054376282458120945425051863649661639155209306286061040930046981057924193785105670446755260062214289266936409272622894864999608677838455560347293246296031941665889508903566959506861861990700494312980351508620223759760110137977058814130413350438372974774697932180418893315998700082240773617767158952812989924561352269321428579880535410771704240937834451503845844374401535603729059202374734334220483209556455967311418585395828630127849722973959209786392861438763563084218683015947661969541113478500403696370uwb,
+ 8804033128404257319436391796247922558656097909723817946206424086107376571363985431643405988715302457119922790818911593984275867659318063980148880188381721682101222175837894550825446110314568257002910318459491664340963523476389547801300395551742633087402381375954250806472095890015415996293082500961651310239841690830469614433038572525199550599988220404857171911882800074918573055686438920724369407729906538787728042731530804134671860407095239208695638067647644314590947763517887856674430537735913123875082727985637440472517467667915231517115684103964725547766722895041192409825339825853271319679650626338206521967332uwb };
+ foo2047 (&a2047, 96870374520559877232425023232449835594772020210727763784623672383466424139699010793947506821373137871851733734526750376478351875022731872925672817923968593208680325422683755493846732186980639465537989170494450817375451735480623479375546788222637312722297995519801563871171551494848869504437926131454949049313uwb,
+ 204286879211705664548598471253516036336450894944461293280538653272096106720692442407887688865006198655779005102679360128685207761954177030702942577918382309453894659175068179209177965184955019555984495374852658981484737374893252503438668707548935382902024863626525041196947938897658146003104268181146061978016uwb);
+ if (a2047.a != 6604638284533196604244471973541013618281533226364189685792053875666894057803336566484436573497392167130748586543934163550741401484647771763676964459636106203955755250170376364799937601505200975989859891863753738684249106942944581800126298385951473900411874226237184667785129620838843419470788411304260887793015638605531226504875060604515688332205834200447655374389292019856450089734989539345196623908433705347894829346923489476140677375811732806834772686417478318575505181306534740760690417577911023605293314367340174835343740361087598377394743326663660990223372181490299731215729287633035024377246940630447830332400uwb
+ || a2047.b != 9137501476482024007629903428591441562584201678803339450640010852682968378249451929368153750949595739310161107210507212794786347440833584007494934546214718055568442143768955715008628409876512331822501562467361613930394370954908550544883438576618916222169914979225020080371038560790263823334259485417483979863747127011670904476684110186667537336894469993151951433629276229957132898606324321221679211292427020775709202822704838337025228478551871438202955358400266599772607383213562964473056897194903298404105599382719634865500654814014675018495924284439422068568299533611891298495087865671200109507464285856856659661117uwb
+ || a2047.c != 3uwb
+ || a2047.d != 301157253732265541781023494485965871931222915155189057065162325655562530860391453201835195686379336527630738837206110505163559636976908903628615395842350902662574984597751934703024697371935659021522484545347109798860189110373875982814215495771572695624322859146326605068119490392507015507542194312601011027329uwb
+ || a2047.e != 8804033128404257319436391796247922558656097909723817946206424086107376571363985431643405988715302457119922790818911593984275867659318063980148880188381721682101222175837894550825446110314568257002910318459491664340963523476389547801300395551742633087402381375954250806472095890015415996293082500961651310239841690830469614433038572525199550599988220404857171911882800074918573055686438920724369407729906538787728042731530804134671860407095239208695638067647644314590947763517887856674430537735913123875082727985637440472517467667915231517115684103964725547766722895041192409825339825853271319679650626338206521967332uwb)
+ __builtin_abort ();
+ bar2047 (&a2047, -107041399279853750538644610804872546664073777262361485051257422505445403341239911024662125357507942225958473152601813095133468813115195351301813567477804225231126164403591882793618380878832817133932293901187006756344358795625819716260192657246036383263988109408466592090784140040462306716053681955947029302372wb,
+ 96987190807622698460264889519367881890066987668370388919983053615401815945974432823964979317479611113155186555311657934933783458381323251774060867490977621487683905191843744141366245874982592954856173370276396645258076888821241836201856003528789429151224936212560775299953235914854472460555840121467482998173wb);
+ if (a2047.a != 6604638284533196604244471973541013618281533226364189685792053875666894057803336566484436573497392167130748586543934163550741401484647771763676964459636106203955755250170376364799937601505200975989859891863753738684249106942944581800126298385951473900411874226237184667785129620838843419470788411304260887793015638605531226504875060604515688332205834200447655374389292019856450089734989539345196623908433705347894829346923489476140677375811732806834772686417478318575505181306534740760690417577911023605293314367340174835343740361087598377394743326663660990223372181490299731215729287633035024377246940630447830332400uwb
+ || a2047.b != 9137501476482024007629903428591441562584201678803339450640010852682968378249451929368153750949595739310161107210507212794786347440833584007494934546214718055568442143768955715008628409876512331822501562467361613930394370954908550544883438576618916222169914979225020080371038560790263823334259485417483979863747127011670904476684110186667537336894469993151951433629276229957132898606324321221679211292427020775709202822704838337025228478551871438202955358400266599772607383213562964473056897194903298404105599382719634865500654814014675018495924284439422068568299533611891298495087865671200109507464285856856659661117uwb
+ || a2047.c != 3uwb
+ || a2047.d != (unsigned _BitInt(2027)) -10054208472231052078379721285504664774006789593991096131274368890043587395265478200697146040028331112803286597290155160199685354733872099527752699986826603743442259211748138652252135003850224179076120530910610111086281906804577880058336653717246954112763173195905816790830904125607834255497841834479546304199wb
+ || a2047.e != 8804033128404257319436391796247922558656097909723817946206424086107376571363985431643405988715302457119922790818911593984275867659318063980148880188381721682101222175837894550825446110314568257002910318459491664340963523476389547801300395551742633087402381375954250806472095890015415996293082500961651310239841690830469614433038572525199550599988220404857171911882800074918573055686438920724369407729906538787728042731530804134671860407095239208695638067647644314590947763517887856674430537735913123875082727985637440472517467667915231517115684103964725547766722895041192409825339825853271319679650626338206521967332uwb)
+ __builtin_abort ();
+ bar2047 (&a2047, 107041399279853750538644610804872546664073777262361485051257422505445403341239911024662125357507942225958473152601813095133468813115195351301813567477804225231126164403591882793618380878832817133932293901187006756344358795625819716260192657246036383263988109408466592090784140040462306716053681955947029302372wb,
+ -96987190807622698460264889519367881890066987668370388919983053615401815945974432823964979317479611113155186555311657934933783458381323251774060867490977621487683905191843744141366245874982592954856173370276396645258076888821241836201856003528789429151224936212560775299953235914854472460555840121467482998173wb);
+ if (a2047.a != 6604638284533196604244471973541013618281533226364189685792053875666894057803336566484436573497392167130748586543934163550741401484647771763676964459636106203955755250170376364799937601505200975989859891863753738684249106942944581800126298385951473900411874226237184667785129620838843419470788411304260887793015638605531226504875060604515688332205834200447655374389292019856450089734989539345196623908433705347894829346923489476140677375811732806834772686417478318575505181306534740760690417577911023605293314367340174835343740361087598377394743326663660990223372181490299731215729287633035024377246940630447830332400uwb
+ || a2047.b != 9137501476482024007629903428591441562584201678803339450640010852682968378249451929368153750949595739310161107210507212794786347440833584007494934546214718055568442143768955715008628409876512331822501562467361613930394370954908550544883438576618916222169914979225020080371038560790263823334259485417483979863747127011670904476684110186667537336894469993151951433629276229957132898606324321221679211292427020775709202822704838337025228478551871438202955358400266599772607383213562964473056897194903298404105599382719634865500654814014675018495924284439422068568299533611891298495087865671200109507464285856856659661117uwb
+ || a2047.c != 3uwb
+ || a2047.d != 10054208472231052078379721285504664774006789593991096131274368890043587395265478200697146040028331112803286597290155160199685354733872099527752699986826603743442259211748138652252135003850224179076120530910610111086281906804577880058336653717246954112763173195905816790830904125607834255497841834479546304199uwb
+ || a2047.e != 8804033128404257319436391796247922558656097909723817946206424086107376571363985431643405988715302457119922790818911593984275867659318063980148880188381721682101222175837894550825446110314568257002910318459491664340963523476389547801300395551742633087402381375954250806472095890015415996293082500961651310239841690830469614433038572525199550599988220404857171911882800074918573055686438920724369407729906538787728042731530804134671860407095239208695638067647644314590947763517887856674430537735913123875082727985637440472517467667915231517115684103964725547766722895041192409825339825853271319679650626338206521967332uwb)
+ __builtin_abort ();
+ static struct T2047 b2047 = {
+ 8996238020280292957328835089241644192878840856627816196416318709508683098169814577226365258620493076815319486990268281142171221215928011006756119353814278158963533314155524133150379539663994828642659406032292079638106530616220996959709130065598293192861447528701351308436811527532025724876557041408124206634994855959829536357239366288943458437338903780905785942866502425145885283981390432237293769793723111403979497735186231144097215953553454988205125026498825957157417441121856068152040712774023846606695947287461796712589836037950807125680967643300197810011211640702778647554744354944603685620923084456614104269511uwb,
+ 10984318785160035171394274834520714981439611497142275792263219471171187866412794220589679181825290825434476603425001179842844662351028314167468349845879235198018132318905212119916242949709604719322253068999148260324480265586748667860001776565543787645340459243545680867668449541033392329858909661211654102449948990901244396803735089889644860800279108718607804327932252678544915255476214419499336896882183024344391755469834019036074623457176720435331996267496468629393048786381035430672504168120874305682383085268282415424323567923620247616970537420522283962923432940154412293415792945236923677598283314889480184388928uwb,
+ 6uwb,
+ 4790880321170629055903750609772895026632672846986739280016249738812459613115379765419988023638270768078558232945132784525166570715169427772424711358221632774714634926039540434297354515015370752168718157581893336796591613729772599089792047050683360727021739900497232167845699737421642365115219385074831571286354899965772412143441270198896667545966629183706673530731718536536465082401940906390967469028437946614351467520839911469740329315914999526738976943417735745760153747243156855057165807147066483580752278526914784843144575299178410593465362653960651398775135718996282702371931556709069927057814215337263088uwb,
+ 15898795864009764874305090919753114555137700112966361953790245810709040722233816733280023885873997896242958848192251646902459137691931517631544750216012143606605819071183153530372060489236262856491973841038138316548406269164589694469032205076355057742341341656583075897561909452907012289408703280249378682882696627977625379823499910638320190471165330121795134411615134572598658797215197404325870770080826927165671269527854053737471231889250113654062195345706056764060545970124448748001325886598996898661788527149728584429285239380904550684885882592015572632423663763016881296460620776131666328013362700459054902525252uwb };
+ baz2047 (&b2047, 96870374520559877232425023232449835594772020210727763784623672383466424139699010793947506821373137871851733734526750376478351875022731872925672817923968593208680325422683755493846732186980639465537989170494450817375451735480623479375546788222637312722297995519801563871171551494848869504437926131454949049313uwb,
+ 204286879211705664548598471253516036336450894944461293280538653272096106720692442407887688865006198655779005102679360128685207761954177030702942577918382309453894659175068179209177965184955019555984495374852658981484737374893252503438668707548935382902024863626525041196947938897658146003104268181146061978016uwb);
+ if (b2047.a != 8996238020280292957328835089241644192878840856627816196416318709508683098169814577226365258620493076815319486990268281142171221215928011006756119353814278158963533314155524133150379539663994828642659406032292079638106530616220996959709130065598293192861447528701351308436811527532025724876557041408124206634994855959829536357239366288943458437338903780905785942866502425145885283981390432237293769793723111403979497735186231144097215953553454988205125026498825957157417441121856068152040712774023846606695947287461796712589836037950807125680967643300197810011211640702778647554744354944603685620923084456614104269511uwb
+ || b2047.b != 10984318785160035171394274834520714981439611497142275792263219471171187866412794220589679181825290825434476603425001179842844662351028314167468349845879235198018132318905212119916242949709604719322253068999148260324480265586748667860001776565543787645340459243545680867668449541033392329858909661211654102449948990901244396803735089889644860800279108718607804327932252678544915255476214419499336896882183024344391755469834019036074623457176720435331996267496468629393048786381035430672504168120874305682383085268282415424323567923620247616970537420522283962923432940154412293415792945236923677598283314889480184388928uwb
+ || b2047.c != 6uwb
+ || b2047.d != 301157253732265541781023494485965871931222915155189057065162325655562530860391453201835195686379336527630738837206110505163559636976908903628615395842350902662574984597751934703024697371935659021522484545347109798860189110373875982814215495771572695624322859146326605068119490392507015507542194312601011027329uwb
+ || b2047.e != 15898795864009764874305090919753114555137700112966361953790245810709040722233816733280023885873997896242958848192251646902459137691931517631544750216012143606605819071183153530372060489236262856491973841038138316548406269164589694469032205076355057742341341656583075897561909452907012289408703280249378682882696627977625379823499910638320190471165330121795134411615134572598658797215197404325870770080826927165671269527854053737471231889250113654062195345706056764060545970124448748001325886598996898661788527149728584429285239380904550684885882592015572632423663763016881296460620776131666328013362700459054902525252uwb)
+ __builtin_abort ();
+ qux2047 (&b2047, -107041399279853750538644610804872546664073777262361485051257422505445403341239911024662125357507942225958473152601813095133468813115195351301813567477804225231126164403591882793618380878832817133932293901187006756344358795625819716260192657246036383263988109408466592090784140040462306716053681955947029302372wb,
+ 96987190807622698460264889519367881890066987668370388919983053615401815945974432823964979317479611113155186555311657934933783458381323251774060867490977621487683905191843744141366245874982592954856173370276396645258076888821241836201856003528789429151224936212560775299953235914854472460555840121467482998173wb);
+ if (b2047.a != 8996238020280292957328835089241644192878840856627816196416318709508683098169814577226365258620493076815319486990268281142171221215928011006756119353814278158963533314155524133150379539663994828642659406032292079638106530616220996959709130065598293192861447528701351308436811527532025724876557041408124206634994855959829536357239366288943458437338903780905785942866502425145885283981390432237293769793723111403979497735186231144097215953553454988205125026498825957157417441121856068152040712774023846606695947287461796712589836037950807125680967643300197810011211640702778647554744354944603685620923084456614104269511uwb
+ || b2047.b != 10984318785160035171394274834520714981439611497142275792263219471171187866412794220589679181825290825434476603425001179842844662351028314167468349845879235198018132318905212119916242949709604719322253068999148260324480265586748667860001776565543787645340459243545680867668449541033392329858909661211654102449948990901244396803735089889644860800279108718607804327932252678544915255476214419499336896882183024344391755469834019036074623457176720435331996267496468629393048786381035430672504168120874305682383085268282415424323567923620247616970537420522283962923432940154412293415792945236923677598283314889480184388928uwb
+ || b2047.c != 6uwb
+ || b2047.d != (unsigned _BitInt(2027)) -10054208472231052078379721285504664774006789593991096131274368890043587395265478200697146040028331112803286597290155160199685354733872099527752699986826603743442259211748138652252135003850224179076120530910610111086281906804577880058336653717246954112763173195905816790830904125607834255497841834479546304199wb
+ || b2047.e != 15898795864009764874305090919753114555137700112966361953790245810709040722233816733280023885873997896242958848192251646902459137691931517631544750216012143606605819071183153530372060489236262856491973841038138316548406269164589694469032205076355057742341341656583075897561909452907012289408703280249378682882696627977625379823499910638320190471165330121795134411615134572598658797215197404325870770080826927165671269527854053737471231889250113654062195345706056764060545970124448748001325886598996898661788527149728584429285239380904550684885882592015572632423663763016881296460620776131666328013362700459054902525252uwb)
+ __builtin_abort ();
+ qux2047 (&b2047, 107041399279853750538644610804872546664073777262361485051257422505445403341239911024662125357507942225958473152601813095133468813115195351301813567477804225231126164403591882793618380878832817133932293901187006756344358795625819716260192657246036383263988109408466592090784140040462306716053681955947029302372wb,
+ -96987190807622698460264889519367881890066987668370388919983053615401815945974432823964979317479611113155186555311657934933783458381323251774060867490977621487683905191843744141366245874982592954856173370276396645258076888821241836201856003528789429151224936212560775299953235914854472460555840121467482998173wb);
+ if (b2047.a != 8996238020280292957328835089241644192878840856627816196416318709508683098169814577226365258620493076815319486990268281142171221215928011006756119353814278158963533314155524133150379539663994828642659406032292079638106530616220996959709130065598293192861447528701351308436811527532025724876557041408124206634994855959829536357239366288943458437338903780905785942866502425145885283981390432237293769793723111403979497735186231144097215953553454988205125026498825957157417441121856068152040712774023846606695947287461796712589836037950807125680967643300197810011211640702778647554744354944603685620923084456614104269511uwb
+ || b2047.b != 10984318785160035171394274834520714981439611497142275792263219471171187866412794220589679181825290825434476603425001179842844662351028314167468349845879235198018132318905212119916242949709604719322253068999148260324480265586748667860001776565543787645340459243545680867668449541033392329858909661211654102449948990901244396803735089889644860800279108718607804327932252678544915255476214419499336896882183024344391755469834019036074623457176720435331996267496468629393048786381035430672504168120874305682383085268282415424323567923620247616970537420522283962923432940154412293415792945236923677598283314889480184388928uwb
+ || b2047.c != 6uwb
+ || b2047.d != 10054208472231052078379721285504664774006789593991096131274368890043587395265478200697146040028331112803286597290155160199685354733872099527752699986826603743442259211748138652252135003850224179076120530910610111086281906804577880058336653717246954112763173195905816790830904125607834255497841834479546304199uwb
+ || b2047.e != 15898795864009764874305090919753114555137700112966361953790245810709040722233816733280023885873997896242958848192251646902459137691931517631544750216012143606605819071183153530372060489236262856491973841038138316548406269164589694469032205076355057742341341656583075897561909452907012289408703280249378682882696627977625379823499910638320190471165330121795134411615134572598658797215197404325870770080826927165671269527854053737471231889250113654062195345706056764060545970124448748001325886598996898661788527149728584429285239380904550684885882592015572632423663763016881296460620776131666328013362700459054902525252uwb)
+ __builtin_abort ();
+#endif
+}
diff --git a/gcc/testsuite/gcc.dg/torture/bitint-81.c b/gcc/testsuite/gcc.dg/torture/bitint-81.c
new file mode 100644
index 0000000..9e7fa53
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/bitint-81.c
@@ -0,0 +1,174 @@
+/* { dg-do run { target bitint } } */
+/* { dg-options "-std=c23 -pedantic-errors" } */
+/* { dg-skip-if "" { ! run_expensive_tests } { "*" } { "-O0" "-O2" } } */
+/* { dg-skip-if "" { ! run_expensive_tests } { "-flto" } { "" } } */
+
+#if __BITINT_MAXWIDTH__ >= 2048
+struct S { unsigned _BitInt(2048) a : 2048, b : 2048, c : 17, d : 1984, e : 47; };
+
+__attribute__((noipa)) void
+foo (struct S *p, unsigned _BitInt(1024) x, unsigned _BitInt(1024) y)
+{
+ p->d = x + y;
+}
+
+__attribute__((noipa)) void
+bar (struct S *p, _BitInt(1024) x, _BitInt(1024) y)
+{
+ p->d = x + y;
+}
+
+__attribute__((noipa)) void
+baz (struct S *p, unsigned _BitInt(1920) x, unsigned _BitInt(1920) y)
+{
+ p->d = x + y;
+}
+
+__attribute__((noipa)) void
+qux (struct S *p, _BitInt(1920) x, _BitInt(1920) y)
+{
+ p->d = x + y;
+}
+
+__attribute__((noipa)) void
+corge (struct S *p, unsigned _BitInt(1900) x, unsigned _BitInt(1900) y)
+{
+ p->d = x + y;
+}
+
+__attribute__((noipa)) void
+garply (struct S *p, _BitInt(1900) x, _BitInt(1900) y)
+{
+ p->d = x + y;
+}
+
+__attribute__((noipa)) void
+freddy (struct S *p, unsigned _BitInt(1856) x, unsigned _BitInt(1856) y)
+{
+ p->d = x + y;
+}
+
+__attribute__((noipa)) void
+waldo (struct S *p, _BitInt(1856) x, _BitInt(1856) y)
+{
+ p->d = x + y;
+}
+#endif
+
+int
+main ()
+{
+#if __BITINT_MAXWIDTH__ >= 2048
+ static struct S a = {
+ -1, -1, 0,
+ 463917970028583783130221282302564969130016367896792751313667391101541961539304534496983866855440713410002431069759936351630526612549721249569957606098639059197777177066032356317311377246348044640151413769734055367388430457406812743413172658955449268511488689032363320539418931719008983635641503449973939023326362877468919468283037515857633928783609142892025498615118950347461620276675520332352617645525539262850089419854851129987768363578088495582892780293031963532530279743528517338149433293940566560543044220727331056862486476880117725416278405160480429664896200335164399009026428547582688918275uwb,
+ 0 };
+ a.c = -1; a.e = -1;
+ foo (&a, 104931473307998568376284944455816272419276290777426540227909077072607565781305910683656824567560123753706639375583615231475830225655977968417978331508801616912246729932071770026909197561252489929164753507156163716727743848177523298403504040861948797263925263359073704810875557925737265337616304489108966376158uwb,
+ 59920243355458337710161417863366293718453205838526168844643867766614610356796955200643446741760592218738700475637131838188996966576023003439875232851999584726009865342375796439481941924864368246882381830388251975603959739534065212652254710711469239923127731536814696621712112440700123429434845131596418309393uwb);
+ if (a.c != (unsigned _BitInt(17)) -1
+ || a.d != (unsigned _BitInt(1024)) (104931473307998568376284944455816272419276290777426540227909077072607565781305910683656824567560123753706639375583615231475830225655977968417978331508801616912246729932071770026909197561252489929164753507156163716727743848177523298403504040861948797263925263359073704810875557925737265337616304489108966376158uwb
+ + 59920243355458337710161417863366293718453205838526168844643867766614610356796955200643446741760592218738700475637131838188996966576023003439875232851999584726009865342375796439481941924864368246882381830388251975603959739534065212652254710711469239923127731536814696621712112440700123429434845131596418309393uwb)
+ || a.e != (unsigned _BitInt(47)) -1)
+ __builtin_abort ();
+ a.c = 0; a.e = 0;
+ a.d = 463917970028583783130221282302564969130016367896792751313667391101541961539304534496983866855440713410002431069759936351630526612549721249569957606098639059197777177066032356317311377246348044640151413769734055367388430457406812743413172658955449268511488689032363320539418931719008983635641503449973939023326362877468919468283037515857633928783609142892025498615118950347461620276675520332352617645525539262850089419854851129987768363578088495582892780293031963532530279743528517338149433293940566560543044220727331056862486476880117725416278405160480429664896200335164399009026428547582688918275uwb;
+ bar (&a, 57696900052508731507403549405758598034300143658103207319023779669222605350088754701899236130746881446668609696540074847952256437939432895408791375123523927312623997545422223335393957708478037810305856074599089747771505132758755976367296302409566647338223622914274236998855494169815473992397952258483243021302wb,
+ -72842517138334828284807942772540307802590837121353434029836391595120471219334627505967145432766876195584374614127318095866715782180696170716375533225237916165551049842450106822314457638403968810895466326295894575989547864175819099455892706907142084137837126096115084189997686278911334555694779991889737914097wb);
+ if (a.c != 0
+ || a.d != (unsigned _BitInt(1984)) (57696900052508731507403549405758598034300143658103207319023779669222605350088754701899236130746881446668609696540074847952256437939432895408791375123523927312623997545422223335393957708478037810305856074599089747771505132758755976367296302409566647338223622914274236998855494169815473992397952258483243021302wb
+ - 72842517138334828284807942772540307802590837121353434029836391595120471219334627505967145432766876195584374614127318095866715782180696170716375533225237916165551049842450106822314457638403968810895466326295894575989547864175819099455892706907142084137837126096115084189997686278911334555694779991889737914097wb)
+ || a.e != 0)
+ __builtin_abort ();
+ a.c = -1; a.e = -1;
+ a.d = 463917970028583783130221282302564969130016367896792751313667391101541961539304534496983866855440713410002431069759936351630526612549721249569957606098639059197777177066032356317311377246348044640151413769734055367388430457406812743413172658955449268511488689032363320539418931719008983635641503449973939023326362877468919468283037515857633928783609142892025498615118950347461620276675520332352617645525539262850089419854851129987768363578088495582892780293031963532530279743528517338149433293940566560543044220727331056862486476880117725416278405160480429664896200335164399009026428547582688918275uwb;
+ bar (&a, -57696900052508731507403549405758598034300143658103207319023779669222605350088754701899236130746881446668609696540074847952256437939432895408791375123523927312623997545422223335393957708478037810305856074599089747771505132758755976367296302409566647338223622914274236998855494169815473992397952258483243021302wb,
+ 72842517138334828284807942772540307802590837121353434029836391595120471219334627505967145432766876195584374614127318095866715782180696170716375533225237916165551049842450106822314457638403968810895466326295894575989547864175819099455892706907142084137837126096115084189997686278911334555694779991889737914097wb);
+ if (a.c != (unsigned _BitInt(17)) -1
+ || a.d != (unsigned _BitInt(1984)) (-57696900052508731507403549405758598034300143658103207319023779669222605350088754701899236130746881446668609696540074847952256437939432895408791375123523927312623997545422223335393957708478037810305856074599089747771505132758755976367296302409566647338223622914274236998855494169815473992397952258483243021302wb
+ + 72842517138334828284807942772540307802590837121353434029836391595120471219334627505967145432766876195584374614127318095866715782180696170716375533225237916165551049842450106822314457638403968810895466326295894575989547864175819099455892706907142084137837126096115084189997686278911334555694779991889737914097wb)
+ || a.e != (unsigned _BitInt(47)) -1)
+ __builtin_abort ();
+ a.c = -1; a.e = -1;
+ a.d = 463917970028583783130221282302564969130016367896792751313667391101541961539304534496983866855440713410002431069759936351630526612549721249569957606098639059197777177066032356317311377246348044640151413769734055367388430457406812743413172658955449268511488689032363320539418931719008983635641503449973939023326362877468919468283037515857633928783609142892025498615118950347461620276675520332352617645525539262850089419854851129987768363578088495582892780293031963532530279743528517338149433293940566560543044220727331056862486476880117725416278405160480429664896200335164399009026428547582688918275uwb;
+ baz (&a, 10046674427769604624104256297198144686571499244626667928387309298929376098027029576279399593953275611749179759608292175423884771453122373428446900092238297028886595955833507301142748242755116804512085361142982476735378897659094772516348752033708523603210976749488948779512595019051543682808058468854071972247830133684340816736701518783450117953852153823310129790997309466493287853621568286299778852505115809372004493209067461371542082762075506285274124778581566591915544298148128752861519967454244034597718098760883258950102015993032472578845214796865351706334956028690073732824uwb,
+ 30612973315144170166058778463435127763223804285434461900113576569307167284342964585999954156672087142162949891238018140546663093988389394093653346239026903138243323723125156926788354976614671206441524235029939884520999076249737807760807371468017378301855151655697275608111727393644387426955142126548487675753916845926686394733479586127697929204917657250622879488360082650822591661695896650131839942739510727482535722456341390110272939230980001298487239399637003898555616301235680415285050104075063794523896618439667653475267312346144285918918555551560640876816454019806981149346uwb);
+ if (a.c != (unsigned _BitInt(17)) -1
+ || a.d != (unsigned _BitInt(1920)) (10046674427769604624104256297198144686571499244626667928387309298929376098027029576279399593953275611749179759608292175423884771453122373428446900092238297028886595955833507301142748242755116804512085361142982476735378897659094772516348752033708523603210976749488948779512595019051543682808058468854071972247830133684340816736701518783450117953852153823310129790997309466493287853621568286299778852505115809372004493209067461371542082762075506285274124778581566591915544298148128752861519967454244034597718098760883258950102015993032472578845214796865351706334956028690073732824uwb
+ + 30612973315144170166058778463435127763223804285434461900113576569307167284342964585999954156672087142162949891238018140546663093988389394093653346239026903138243323723125156926788354976614671206441524235029939884520999076249737807760807371468017378301855151655697275608111727393644387426955142126548487675753916845926686394733479586127697929204917657250622879488360082650822591661695896650131839942739510727482535722456341390110272939230980001298487239399637003898555616301235680415285050104075063794523896618439667653475267312346144285918918555551560640876816454019806981149346uwb)
+ || a.e != (unsigned _BitInt(47)) -1)
+ __builtin_abort ();
+ a.c = 0; a.e = 0;
+ a.d = 463917970028583783130221282302564969130016367896792751313667391101541961539304534496983866855440713410002431069759936351630526612549721249569957606098639059197777177066032356317311377246348044640151413769734055367388430457406812743413172658955449268511488689032363320539418931719008983635641503449973939023326362877468919468283037515857633928783609142892025498615118950347461620276675520332352617645525539262850089419854851129987768363578088495582892780293031963532530279743528517338149433293940566560543044220727331056862486476880117725416278405160480429664896200335164399009026428547582688918275uwb;
+ qux (&a, 13016013079173103291099614189980806323842381205278317530930273134000041840366629398775140035115843810473709567772778302693082141789947769432915075175055773162235275161483274294215337459035077170772792870300959580270341613989326562524225424508425190735941052267862958598262374659588227320019762607908610630268016655402141784434304726674259917365365145444188910006023308330624708207712990521956652004155313903306577312390098183139445953080974727140041686581923442658014291404592915933601121276930660194063673671653456001711834226809501680465040298012239797363611423758621282776913wb,
+ -28446813692377976500941113458061042520266991028095510595278491516213231833343127954947958697833886839482306777092401391414122947073667300047514166155274861575977000665767593771951017640475352507402509527609607984675986413277164234921816991523476344394719439798762757430434241059844235758595109405173122010749636425151730743690113153472777458440898097338588818905573968955113497483813484624809156428527476374283821364764837699711517717561791530220504756111060769224676146577608338385717008304034083639716040512354106392262091939683382939797913585450175899702396573011461697333034wb);
+ if (a.c != 0
+ || a.d != (unsigned _BitInt(1984)) (13016013079173103291099614189980806323842381205278317530930273134000041840366629398775140035115843810473709567772778302693082141789947769432915075175055773162235275161483274294215337459035077170772792870300959580270341613989326562524225424508425190735941052267862958598262374659588227320019762607908610630268016655402141784434304726674259917365365145444188910006023308330624708207712990521956652004155313903306577312390098183139445953080974727140041686581923442658014291404592915933601121276930660194063673671653456001711834226809501680465040298012239797363611423758621282776913wb
+ - 28446813692377976500941113458061042520266991028095510595278491516213231833343127954947958697833886839482306777092401391414122947073667300047514166155274861575977000665767593771951017640475352507402509527609607984675986413277164234921816991523476344394719439798762757430434241059844235758595109405173122010749636425151730743690113153472777458440898097338588818905573968955113497483813484624809156428527476374283821364764837699711517717561791530220504756111060769224676146577608338385717008304034083639716040512354106392262091939683382939797913585450175899702396573011461697333034wb)
+ || a.e != 0)
+ __builtin_abort ();
+ a.c = -1; a.e = -1;
+ a.d = 463917970028583783130221282302564969130016367896792751313667391101541961539304534496983866855440713410002431069759936351630526612549721249569957606098639059197777177066032356317311377246348044640151413769734055367388430457406812743413172658955449268511488689032363320539418931719008983635641503449973939023326362877468919468283037515857633928783609142892025498615118950347461620276675520332352617645525539262850089419854851129987768363578088495582892780293031963532530279743528517338149433293940566560543044220727331056862486476880117725416278405160480429664896200335164399009026428547582688918275uwb;
+ qux (&a, -13016013079173103291099614189980806323842381205278317530930273134000041840366629398775140035115843810473709567772778302693082141789947769432915075175055773162235275161483274294215337459035077170772792870300959580270341613989326562524225424508425190735941052267862958598262374659588227320019762607908610630268016655402141784434304726674259917365365145444188910006023308330624708207712990521956652004155313903306577312390098183139445953080974727140041686581923442658014291404592915933601121276930660194063673671653456001711834226809501680465040298012239797363611423758621282776913wb,
+ 28446813692377976500941113458061042520266991028095510595278491516213231833343127954947958697833886839482306777092401391414122947073667300047514166155274861575977000665767593771951017640475352507402509527609607984675986413277164234921816991523476344394719439798762757430434241059844235758595109405173122010749636425151730743690113153472777458440898097338588818905573968955113497483813484624809156428527476374283821364764837699711517717561791530220504756111060769224676146577608338385717008304034083639716040512354106392262091939683382939797913585450175899702396573011461697333034wb);
+ if (a.c != (unsigned _BitInt(17)) -1
+ || a.d != (unsigned _BitInt(1984)) (-13016013079173103291099614189980806323842381205278317530930273134000041840366629398775140035115843810473709567772778302693082141789947769432915075175055773162235275161483274294215337459035077170772792870300959580270341613989326562524225424508425190735941052267862958598262374659588227320019762607908610630268016655402141784434304726674259917365365145444188910006023308330624708207712990521956652004155313903306577312390098183139445953080974727140041686581923442658014291404592915933601121276930660194063673671653456001711834226809501680465040298012239797363611423758621282776913wb
+ + 28446813692377976500941113458061042520266991028095510595278491516213231833343127954947958697833886839482306777092401391414122947073667300047514166155274861575977000665767593771951017640475352507402509527609607984675986413277164234921816991523476344394719439798762757430434241059844235758595109405173122010749636425151730743690113153472777458440898097338588818905573968955113497483813484624809156428527476374283821364764837699711517717561791530220504756111060769224676146577608338385717008304034083639716040512354106392262091939683382939797913585450175899702396573011461697333034wb)
+ || a.e != (unsigned _BitInt(47)) -1)
+ __builtin_abort ();
+ a.c = -1; a.e = -1;
+ a.d = 463917970028583783130221282302564969130016367896792751313667391101541961539304534496983866855440713410002431069759936351630526612549721249569957606098639059197777177066032356317311377246348044640151413769734055367388430457406812743413172658955449268511488689032363320539418931719008983635641503449973939023326362877468919468283037515857633928783609142892025498615118950347461620276675520332352617645525539262850089419854851129987768363578088495582892780293031963532530279743528517338149433293940566560543044220727331056862486476880117725416278405160480429664896200335164399009026428547582688918275uwb;
+ corge (&a, 64171754625068989919140837000994640111727112880534508544592426680368730902810558177004927067680584241787685314155807083650755609249723856651964519183899537071234738837290542998681042547778311707239561819724556440611184192044964070498288365795284868545819938858772217225078359446215623326392822749370924397592547178151227397770818626413099911326742674650698762654686406157275035696691347162817031065585247142657560604671730554635740625725423122837711895800895711658181231623745755808749163225238686251279789200140461667130974133295022126714627199940806900473151584805415195uwb,
+ 10507418314822331271773044775475398971761862686484059883353388622395900044257992245406697831431608445492518374055670273513238951235394317339987011165612885709605626614512380143227176716397144020233730021138060515517588833982427087228530305874044854732163307726421040484981309646463788817170356084893284995027973314236302612849097075836350102359164874937708745757469764621885202447442513857862352391464614086255770773793956362777147243363233935961477956934790795000772957425970578395645388729306937175617548119494347932433902865451670299375626936811709188316328877711066266uwb);
+ if (a.c != (unsigned _BitInt(17)) -1
+ || a.d != (unsigned _BitInt(1900)) (64171754625068989919140837000994640111727112880534508544592426680368730902810558177004927067680584241787685314155807083650755609249723856651964519183899537071234738837290542998681042547778311707239561819724556440611184192044964070498288365795284868545819938858772217225078359446215623326392822749370924397592547178151227397770818626413099911326742674650698762654686406157275035696691347162817031065585247142657560604671730554635740625725423122837711895800895711658181231623745755808749163225238686251279789200140461667130974133295022126714627199940806900473151584805415195uwb
+ + 10507418314822331271773044775475398971761862686484059883353388622395900044257992245406697831431608445492518374055670273513238951235394317339987011165612885709605626614512380143227176716397144020233730021138060515517588833982427087228530305874044854732163307726421040484981309646463788817170356084893284995027973314236302612849097075836350102359164874937708745757469764621885202447442513857862352391464614086255770773793956362777147243363233935961477956934790795000772957425970578395645388729306937175617548119494347932433902865451670299375626936811709188316328877711066266uwb)
+ || a.e != (unsigned _BitInt(47)) -1)
+ __builtin_abort ();
+ a.c = 0; a.e = 0;
+ a.d = 463917970028583783130221282302564969130016367896792751313667391101541961539304534496983866855440713410002431069759936351630526612549721249569957606098639059197777177066032356317311377246348044640151413769734055367388430457406812743413172658955449268511488689032363320539418931719008983635641503449973939023326362877468919468283037515857633928783609142892025498615118950347461620276675520332352617645525539262850089419854851129987768363578088495582892780293031963532530279743528517338149433293940566560543044220727331056862486476880117725416278405160480429664896200335164399009026428547582688918275uwb;
+ garply (&a, 5868498364266506524577605439874476245426686973426700959109780040518579902459120222835694740563157202759355683256866704897404738166990697509006899291520655587106188792963812978958796524525114633868734394698171505881029257971723149816101834255875674028498733002531852425394712442344661593840806267795078353686464213122490607069539130187483435521707186417019607510065332996787510980236995794693748424754247983911372699143281367405983607540070016093272958998509389591623580441329207441967951990849359776649279644251163115935521494220792988120247084691082546041345346792010242wb,
+ -11347197387388289958753680375659873990863802565165926783885510745013060725984194141674849668356803935504502347397858539486502925095461636911844100666788607295568532884580882894109301976999229938210427880195738078809053637249087573583682429867587279531387832617988923148433372488547498087660777174110005800619288934623468273334771375199931835359341800380427942391213375221877238129575165007900737487381149085076124736500637930425093008055570334609463897282935446073021835731133748226290709813024590427968994174853094349555317945926316079817123209552512780636562105208387802wb);
+ if (a.c != 0
+ || a.d != (unsigned _BitInt(1984)) (5868498364266506524577605439874476245426686973426700959109780040518579902459120222835694740563157202759355683256866704897404738166990697509006899291520655587106188792963812978958796524525114633868734394698171505881029257971723149816101834255875674028498733002531852425394712442344661593840806267795078353686464213122490607069539130187483435521707186417019607510065332996787510980236995794693748424754247983911372699143281367405983607540070016093272958998509389591623580441329207441967951990849359776649279644251163115935521494220792988120247084691082546041345346792010242wb
+ - 11347197387388289958753680375659873990863802565165926783885510745013060725984194141674849668356803935504502347397858539486502925095461636911844100666788607295568532884580882894109301976999229938210427880195738078809053637249087573583682429867587279531387832617988923148433372488547498087660777174110005800619288934623468273334771375199931835359341800380427942391213375221877238129575165007900737487381149085076124736500637930425093008055570334609463897282935446073021835731133748226290709813024590427968994174853094349555317945926316079817123209552512780636562105208387802wb)
+ || a.e != 0)
+ __builtin_abort ();
+ a.c = -1; a.e = -1;
+ a.d = 463917970028583783130221282302564969130016367896792751313667391101541961539304534496983866855440713410002431069759936351630526612549721249569957606098639059197777177066032356317311377246348044640151413769734055367388430457406812743413172658955449268511488689032363320539418931719008983635641503449973939023326362877468919468283037515857633928783609142892025498615118950347461620276675520332352617645525539262850089419854851129987768363578088495582892780293031963532530279743528517338149433293940566560543044220727331056862486476880117725416278405160480429664896200335164399009026428547582688918275uwb;
+ garply (&a, -5868498364266506524577605439874476245426686973426700959109780040518579902459120222835694740563157202759355683256866704897404738166990697509006899291520655587106188792963812978958796524525114633868734394698171505881029257971723149816101834255875674028498733002531852425394712442344661593840806267795078353686464213122490607069539130187483435521707186417019607510065332996787510980236995794693748424754247983911372699143281367405983607540070016093272958998509389591623580441329207441967951990849359776649279644251163115935521494220792988120247084691082546041345346792010242wb,
+ 11347197387388289958753680375659873990863802565165926783885510745013060725984194141674849668356803935504502347397858539486502925095461636911844100666788607295568532884580882894109301976999229938210427880195738078809053637249087573583682429867587279531387832617988923148433372488547498087660777174110005800619288934623468273334771375199931835359341800380427942391213375221877238129575165007900737487381149085076124736500637930425093008055570334609463897282935446073021835731133748226290709813024590427968994174853094349555317945926316079817123209552512780636562105208387802wb);
+ if (a.c != (unsigned _BitInt(17)) -1
+ || a.d != (unsigned _BitInt(1984)) (-5868498364266506524577605439874476245426686973426700959109780040518579902459120222835694740563157202759355683256866704897404738166990697509006899291520655587106188792963812978958796524525114633868734394698171505881029257971723149816101834255875674028498733002531852425394712442344661593840806267795078353686464213122490607069539130187483435521707186417019607510065332996787510980236995794693748424754247983911372699143281367405983607540070016093272958998509389591623580441329207441967951990849359776649279644251163115935521494220792988120247084691082546041345346792010242wb
+ + 11347197387388289958753680375659873990863802565165926783885510745013060725984194141674849668356803935504502347397858539486502925095461636911844100666788607295568532884580882894109301976999229938210427880195738078809053637249087573583682429867587279531387832617988923148433372488547498087660777174110005800619288934623468273334771375199931835359341800380427942391213375221877238129575165007900737487381149085076124736500637930425093008055570334609463897282935446073021835731133748226290709813024590427968994174853094349555317945926316079817123209552512780636562105208387802wb)
+ || a.e != (unsigned _BitInt(47)) -1)
+ __builtin_abort ();
+ a.c = -1; a.e = -1;
+ a.d = 463917970028583783130221282302564969130016367896792751313667391101541961539304534496983866855440713410002431069759936351630526612549721249569957606098639059197777177066032356317311377246348044640151413769734055367388430457406812743413172658955449268511488689032363320539418931719008983635641503449973939023326362877468919468283037515857633928783609142892025498615118950347461620276675520332352617645525539262850089419854851129987768363578088495582892780293031963532530279743528517338149433293940566560543044220727331056862486476880117725416278405160480429664896200335164399009026428547582688918275uwb;
+ freddy (&a, 469252210556625900395321429768118373804271568886989705934619437372829749132450328525095591418777876663202724364753274041797120201435942727547992144282707964490547818365755687730365454828375134854279482853064804665151021915981446605629215712706942096964289300397645214217794960755102650152979365923262599694610536124094997394321315947501858977257060703103733108840085012396782596975471783978125423726167181925777731261440167038194119207611413091278559852866397229440000783332669637577092646062124696818736270717467013532501981408774198349957822434112647379005uwb,
+ 94070362846521859801705045906377514499678063439381376804210675777018147620560698746550277910632595473262065531986582027530889487288929548537551849350646108895807918918852446632833846575499156686904909401606895792588697611268444788607535104014712049735819470354574164068246431532229132503353457795214808974265484177085433521985873683760061889599206572475727862420333264989214721uwb);
+ if (a.c != (unsigned _BitInt(17)) -1
+ || a.d != (unsigned _BitInt(1856)) (469252210556625900395321429768118373804271568886989705934619437372829749132450328525095591418777876663202724364753274041797120201435942727547992144282707964490547818365755687730365454828375134854279482853064804665151021915981446605629215712706942096964289300397645214217794960755102650152979365923262599694610536124094997394321315947501858977257060703103733108840085012396782596975471783978125423726167181925777731261440167038194119207611413091278559852866397229440000783332669637577092646062124696818736270717467013532501981408774198349957822434112647379005uwb
+ + 94070362846521859801705045906377514499678063439381376804210675777018147620560698746550277910632595473262065531986582027530889487288929548537551849350646108895807918918852446632833846575499156686904909401606895792588697611268444788607535104014712049735819470354574164068246431532229132503353457795214808974265484177085433521985873683760061889599206572475727862420333264989214721uwb)
+ || a.e != (unsigned _BitInt(47)) -1)
+ __builtin_abort ();
+ a.c = 0; a.e = 0;
+ a.d = 463917970028583783130221282302564969130016367896792751313667391101541961539304534496983866855440713410002431069759936351630526612549721249569957606098639059197777177066032356317311377246348044640151413769734055367388430457406812743413172658955449268511488689032363320539418931719008983635641503449973939023326362877468919468283037515857633928783609142892025498615118950347461620276675520332352617645525539262850089419854851129987768363578088495582892780293031963532530279743528517338149433293940566560543044220727331056862486476880117725416278405160480429664896200335164399009026428547582688918275uwb;
+ waldo (&a, 1077348803036394846628052386931031477092268876025321812336873307109206087913752615224874421161444982772998789879219858386748806555972198085260006113906211122468615028890545260489793232067037450746579377138953792376873515309768581358563731155642172915978701005830989320122620476563103717896150506580888344726125553209010077521592754225575655834325745455132336873236702283266289571810538207635029653566169955010183651423213982024692540900019767542204779117227674016120820660909981982885062591878726323250427606511922288639386683242905759109753373254316490315520wb,
+ -1985135610193680083664291948423326826338570203155603158942205167041487273165308445801199835862136626921357451386015509681859914819637185970790210070511326605854081763286684508027882510126294034064385106397322907046379158342618996640895074355907730050734884021065120984859890403437402777612953035357875244537844302334232817294878831239344832373356172440988052876809100011735694217824097948414358681171509506376373643145643902181072431032225879081947415698025494088413669737484685311564937312541325716542256136502054579138572508697290597615704140203423671499131wb);
+ if (a.c != 0
+ || a.d != (unsigned _BitInt(1984)) (1077348803036394846628052386931031477092268876025321812336873307109206087913752615224874421161444982772998789879219858386748806555972198085260006113906211122468615028890545260489793232067037450746579377138953792376873515309768581358563731155642172915978701005830989320122620476563103717896150506580888344726125553209010077521592754225575655834325745455132336873236702283266289571810538207635029653566169955010183651423213982024692540900019767542204779117227674016120820660909981982885062591878726323250427606511922288639386683242905759109753373254316490315520wb
+ - 1985135610193680083664291948423326826338570203155603158942205167041487273165308445801199835862136626921357451386015509681859914819637185970790210070511326605854081763286684508027882510126294034064385106397322907046379158342618996640895074355907730050734884021065120984859890403437402777612953035357875244537844302334232817294878831239344832373356172440988052876809100011735694217824097948414358681171509506376373643145643902181072431032225879081947415698025494088413669737484685311564937312541325716542256136502054579138572508697290597615704140203423671499131wb)
+ || a.e != 0)
+ __builtin_abort ();
+ a.c = -1; a.e = -1;
+ a.d = 463917970028583783130221282302564969130016367896792751313667391101541961539304534496983866855440713410002431069759936351630526612549721249569957606098639059197777177066032356317311377246348044640151413769734055367388430457406812743413172658955449268511488689032363320539418931719008983635641503449973939023326362877468919468283037515857633928783609142892025498615118950347461620276675520332352617645525539262850089419854851129987768363578088495582892780293031963532530279743528517338149433293940566560543044220727331056862486476880117725416278405160480429664896200335164399009026428547582688918275uwb;
+ waldo (&a, -1077348803036394846628052386931031477092268876025321812336873307109206087913752615224874421161444982772998789879219858386748806555972198085260006113906211122468615028890545260489793232067037450746579377138953792376873515309768581358563731155642172915978701005830989320122620476563103717896150506580888344726125553209010077521592754225575655834325745455132336873236702283266289571810538207635029653566169955010183651423213982024692540900019767542204779117227674016120820660909981982885062591878726323250427606511922288639386683242905759109753373254316490315520wb,
+ 1985135610193680083664291948423326826338570203155603158942205167041487273165308445801199835862136626921357451386015509681859914819637185970790210070511326605854081763286684508027882510126294034064385106397322907046379158342618996640895074355907730050734884021065120984859890403437402777612953035357875244537844302334232817294878831239344832373356172440988052876809100011735694217824097948414358681171509506376373643145643902181072431032225879081947415698025494088413669737484685311564937312541325716542256136502054579138572508697290597615704140203423671499131wb);
+ if (a.c != (unsigned _BitInt(17)) -1
+ || a.d != (unsigned _BitInt(1984)) (-1077348803036394846628052386931031477092268876025321812336873307109206087913752615224874421161444982772998789879219858386748806555972198085260006113906211122468615028890545260489793232067037450746579377138953792376873515309768581358563731155642172915978701005830989320122620476563103717896150506580888344726125553209010077521592754225575655834325745455132336873236702283266289571810538207635029653566169955010183651423213982024692540900019767542204779117227674016120820660909981982885062591878726323250427606511922288639386683242905759109753373254316490315520wb
+ + 1985135610193680083664291948423326826338570203155603158942205167041487273165308445801199835862136626921357451386015509681859914819637185970790210070511326605854081763286684508027882510126294034064385106397322907046379158342618996640895074355907730050734884021065120984859890403437402777612953035357875244537844302334232817294878831239344832373356172440988052876809100011735694217824097948414358681171509506376373643145643902181072431032225879081947415698025494088413669737484685311564937312541325716542256136502054579138572508697290597615704140203423671499131wb)
+ || a.e != (unsigned _BitInt(47)) -1)
+ __builtin_abort ();
+#endif
+}
diff --git a/gcc/testsuite/gcc.dg/torture/bitint-82.c b/gcc/testsuite/gcc.dg/torture/bitint-82.c
new file mode 100644
index 0000000..851d57a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/bitint-82.c
@@ -0,0 +1,94 @@
+/* { dg-do run { target bitint } } */
+/* { dg-options "-std=c23 -pedantic-errors" } */
+/* { dg-skip-if "" { ! run_expensive_tests } { "*" } { "-O0" "-O2" } } */
+/* { dg-skip-if "" { ! run_expensive_tests } { "-flto" } { "" } } */
+
+#if __BITINT_MAXWIDTH__ >= 532
+_BitInt(5) a = 2, b = -2;
+_BitInt(38) c = 12345, d = -12345;
+_BitInt(129) e = 147090211948845388976606115811401318743wb, f = -147090211948845388976606115811401318743wb;
+_BitInt(532) g = 34476769918317100226195145251004381172591594205376273814wb, h = -102116935649428556311918486808926113041433456371844211259677321wb;
+unsigned _BitInt(1) i = 1;
+unsigned _BitInt(17) j = 49127uwb;
+unsigned _BitInt(60) k = 588141367522129848uwb;
+unsigned _BitInt(205) l = 33991671979236490040668305838261113909013362173682935296620088uwb;
+unsigned _BitInt(475) z = 14834685124553929878903720794923785539321715423294864257448721201977655202426343038777008759878862591302200019811097993772912691139803983786083uwb;
+#endif
+
+#include "../bitintext.h"
+
+#if __BITINT_MAXWIDTH__ >= 532
+[[gnu::noipa]] _BitInt(217)
+f1 (_BitInt(9) a, unsigned _BitInt(12) b, _BitInt(36) c, unsigned _BitInt(105) d,
+ _BitInt(135) e, unsigned _BitInt(168) f, _BitInt(207) g, _BitInt(207) h,
+ unsigned _BitInt(531) i, _BitInt(36) j)
+{
+ BEXTC (a); BEXTC (b); BEXTC (c); BEXTC (d);
+ BEXTC (e); BEXTC (f); BEXTC (g); BEXTC (h);
+ BEXTC (i); BEXTC (j);
+ _BitInt(9) k = a + 1;
+ unsigned _BitInt(12) l = b - a;
+ _BitInt(36) m = c * j;
+ unsigned _BitInt(105) n = d >> (-2 * j);
+ _BitInt(135) o = e | -j;
+ unsigned _BitInt(168) p = f & 101010101010101010101010uwb;
+ _BitInt(207) q = g * j;
+ _BitInt(207) r = g + h;
+ unsigned _BitInt(531) s = i / j;
+ BEXTC (k); BEXTC (l); BEXTC (m); BEXTC (n);
+ BEXTC (o); BEXTC (p); BEXTC (q); BEXTC (r);
+ BEXTC (s);
+ unsigned _BitInt(105) t = d << (38 - j);
+ BEXTC (t);
+ _Atomic _BitInt(5) u = 15;
+ u += 8U;
+ BEXTC (u);
+ _BitInt(135) v = e << 28;
+ BEXTC (v);
+ unsigned _BitInt(475) w = z << (29 + j);
+ BEXTC (w);
+ return a + 4;
+}
+#endif
+
+int
+main ()
+{
+#if __BITINT_MAXWIDTH__ >= 532
+ BEXTC (a); BEXTC (b);
+ BEXTC (c); BEXTC (d);
+ BEXTC (e); BEXTC (f);
+ BEXTC (g); BEXTC (h);
+ BEXTC (i);
+ BEXTC (j);
+ BEXTC (k);
+ BEXTC (l);
+ BEXTC (z);
+ {
+ _BitInt(5) a = 2, b = -2;
+ _BitInt(38) c = 12345, d = -12345;
+ _BitInt(129) e = 147090211948845388976606115811401318743wb, f = -147090211948845388976606115811401318743wb;
+ _BitInt(532) g = 34476769918317100226195145251004381172591594205376273814wb, h = -102116935649428556311918486808926113041433456371844211259677321wb;
+ unsigned _BitInt(1) i = 1;
+ unsigned _BitInt(17) j = 49127uwb;
+ unsigned _BitInt(60) k = 588141367522129848uwb;
+ unsigned _BitInt(205) l = 33991671979236490040668305838261113909013362173682935296620088uwb;
+ BEXTC (a); BEXTC (b);
+ BEXTC (c); BEXTC (d);
+ BEXTC (e); BEXTC (f);
+ BEXTC (g); BEXTC (h);
+ BEXTC (i);
+ BEXTC (j);
+ BEXTC (k);
+ BEXTC (l);
+ }
+ _BitInt(217) m = f1 (57wb, 3927uwb, 10625699364wb, 23030359755638571619326514462579uwb,
+ 20797625176303404170317957140841712396356wb,
+ 111831871006433449872067089878311637796827405335256uwb,
+ 64853652491049541618437564623858346454131583900201311683495230wb,
+ 25108562626494976011700565632680191924545340440636663075662700wb,
+ 6366583146545926097709747296452085257498446783797668089081516596003270602920229800152065594152964557479773813310423759077951305431130758723519892452009351743676uwb,
+ -1);
+ BEXTC (m);
+#endif
+}
diff --git a/gcc/testsuite/gcc.dg/torture/builtin-math-9.c b/gcc/testsuite/gcc.dg/torture/builtin-math-9.c
new file mode 100644
index 0000000..ff79ee5
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/builtin-math-9.c
@@ -0,0 +1,86 @@
+/* Copyright (C) 1988-2025 Free Software Foundation, Inc.
+
+ Verify that built-in math function constant folding of constant
+ arguments is correctly performed by the compiler. */
+
+/* { dg-do link } */
+/* { dg-require-effective-target foldable_pi_based_trigonometry } */
+/* { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
+
+extern double acospi (double);
+extern double asinpi (double);
+extern double atanpi (double);
+extern double atan2pi (double, double);
+extern double cospi (double);
+extern double sinpi (double);
+extern double tanpi (double);
+
+/* All references to link_error should go away at compile-time. */
+extern void link_error (void);
+
+void
+test_normal ()
+{
+ if (acospi (0.5) < 0.3333 || acospi (0.5) > 0.3334 || acospi (-0.5) < 0.6666
+ || acospi (-0.5) > 0.6667)
+ link_error ();
+
+ if (asinpi (0.5) < 0.1666 || asinpi (0.5) > 0.1667 || asinpi (-0.5) < -0.1667
+ || asinpi (-0.5) > -0.1666)
+ link_error ();
+
+ if (atanpi (1.0) != 0.25 || atanpi (-1.0) > -0.25)
+ link_error ();
+
+ if (atan2pi (1.0, 1.0) > 0.2501 || atan2pi (1.0, 1.0) < 0.2499
+ || atan2pi (1.0, -1.0) < 0.7499 || atan2pi (1.0, -1.0) > 0.7501)
+ link_error ();
+
+ if (cospi (1.0 / 3) > 0.5001 || cospi (-1.0 / 3) < 0.4999
+ || cospi (4.0 / 3) > -0.4999 || cospi (4.0 / 3) < -0.5001)
+ link_error ();
+
+ if (sinpi (1.0 / 6) > 0.5001 || sinpi (-1.0 / 6) > -0.4999
+ || sinpi (5.0 / 6) < 0.4999 || sinpi (-7.0 / 6) > 0.5001)
+ link_error ();
+
+ if (tanpi (0.25) != 1.0000 || tanpi (-0.25) != -1.0000
+ || tanpi (1.25) != 1.0000 || tanpi (-1.25) != -1.0000)
+ link_error ();
+}
+
+void
+test_corner ()
+{
+ if (__builtin_signbit (acospi (1.0)))
+ link_error ();
+
+ if (__builtin_signbit (asinpi (0.0)) || !__builtin_signbit (asinpi (-0.0)))
+ link_error ();
+
+ if (__builtin_signbit (atanpi (0.0)) || !__builtin_signbit (atanpi (-0.0)))
+ link_error ();
+
+ if (__builtin_signbit (atan2pi (0.0, 0.0))
+ || !__builtin_signbit (atan2pi (-0.0, 0.0)) || atan2pi (0.0, -0.0) != 1
+ || atan2pi (-0.0, -0.0) != -1)
+ link_error ();
+
+ if (__builtin_signbit (cospi (0.5)) || __builtin_signbit (cospi (-0.5)))
+ link_error ();
+
+ if (__builtin_signbit (sinpi (1)) || !__builtin_signbit (sinpi (-1)))
+ link_error ();
+
+ if (__builtin_signbit (tanpi (2)) || __builtin_signbit (tanpi (-3))
+ || !__builtin_signbit (tanpi (5)) || !__builtin_signbit (tanpi (-6)))
+ link_error ();
+}
+
+int
+main ()
+{
+ test_normal ();
+ test_corner ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr117811.c b/gcc/testsuite/gcc.dg/torture/pr117811.c
index 13d7e13..05e8622 100644
--- a/gcc/testsuite/gcc.dg/torture/pr117811.c
+++ b/gcc/testsuite/gcc.dg/torture/pr117811.c
@@ -18,8 +18,13 @@ void __attribute__((noclone,noinline)) do_shift (v4 *vec, int shift)
int main ()
{
+#if __SIZEOF_INT__ >= 4
v4 vec = {0x1000000, 0x2000, 0x300, 0x40};
v4 vec2 = {0x100000, 0x200, 0x30, 0x4};
+#else
+ v4 vec = {0x4000, 0x2000, 0x300, 0x40};
+ v4 vec2 = {0x400, 0x200, 0x30, 0x4};
+#endif
do_shift (&vec, 4);
if (memcmp (&vec, &vec2, sizeof (v4)) != 0)
__builtin_abort ();
diff --git a/gcc/testsuite/gcc.dg/torture/pr119131-1.c b/gcc/testsuite/gcc.dg/torture/pr119131-1.c
index c62f702..1780035 100644
--- a/gcc/testsuite/gcc.dg/torture/pr119131-1.c
+++ b/gcc/testsuite/gcc.dg/torture/pr119131-1.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-require-effective-target dfp } */
+/* { dg-additional-options "-Wno-psabi" } */
/* PR target/119131 */
typedef __attribute__((__vector_size__ (64))) char 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/torture/pr120182.c b/gcc/testsuite/gcc.dg/torture/pr120182.c
new file mode 100644
index 0000000..5e2d171
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr120182.c
@@ -0,0 +1,42 @@
+/* { dg-do run { target { { *-*-linux* *-*-gnu* *-*-uclinux* } && mmap } } } */
+
+#include <unistd.h>
+#include <stdlib.h>
+#include <sys/mman.h>
+
+struct S
+{
+ struct S *next;
+};
+
+static void __attribute__((noipa))
+allocate(void *addr, unsigned long long size)
+{
+ void *ptr = mmap((void *)addr, size,
+ PROT_READ | PROT_WRITE,
+ MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED_NOREPLACE,
+ -1, 0);
+ if(ptr != addr)
+ exit(0);
+}
+
+int main (void)
+{
+ int size = 0x8000;
+ char *ptr = (char *)0x288000ull;
+ allocate((void *)ptr, size);
+
+ struct S *s1 = (struct S *)ptr;
+ struct S *s2 = (struct S *)256;
+ for (int i = 0; i < 3; i++)
+ {
+ for(char *addr = (char *)s1; addr < (char *)s1 + sizeof(*s1); ++addr)
+ *addr = 0;
+
+ if(s1->next)
+ s1->next = s1->next->next = s2;
+ else
+ s1->next = s2;
+ }
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr120211-1.c b/gcc/testsuite/gcc.dg/torture/pr120211-1.c
new file mode 100644
index 0000000..f9bc97c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr120211-1.c
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+
+int a, b, d;
+void e() {
+ do {
+ int f = 0;
+ while (1) {
+ int c = a;
+ for (; (c & 1) == 0; c = 1)
+ for (; c & 1;)
+ ;
+ if (a)
+ break;
+ f++;
+ }
+ b = f & 5;
+ if (b)
+ break;
+ } while (d++);
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr120242.c b/gcc/testsuite/gcc.dg/torture/pr120242.c
new file mode 100644
index 0000000..2d0f7de
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr120242.c
@@ -0,0 +1,30 @@
+/* { dg-do run } */
+/* { dg-additional-options "-fsigned-char -fno-strict-aliasing -fwrapv" } */
+
+char f1(char a, char b) {
+ return b == 0 ? a : b;
+}
+int f2(int a, int b) {
+ return b ? a : 0;
+}
+struct l {
+ unsigned m;
+ int n;
+};
+struct l ae;
+char af = -2;
+unsigned ah = 4;
+int aj = 8;
+int *test = &aj;
+int main() {
+ao:
+ if (f2(f1(4, af++), *test) <= 0) {
+ for (; ae.n; ae.n++)
+ ;
+ if (ah)
+ goto ao;
+ }
+ if (af != 1)
+ __builtin_abort ();
+ __builtin_exit (0);
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr120276.c b/gcc/testsuite/gcc.dg/torture/pr120276.c
new file mode 100644
index 0000000..9717a71
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr120276.c
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-march=armv8.2-a+sve" { target aarch64*-*-* } } */
+
+int a;
+char b[1];
+int c[18];
+void d(char *);
+void e() {
+ int f;
+ char *g;
+ a = 0;
+ for (; a < 18; a++) {
+ int h = f = 0;
+ for (; f < 4; f++) {
+ g[a * 4 + f] = c[a] >> h;
+ h += 8;
+ }
+ }
+ d(b);
+} \ No newline at end of file
diff --git a/gcc/testsuite/gcc.dg/torture/pr120341-1.c b/gcc/testsuite/gcc.dg/torture/pr120341-1.c
new file mode 100644
index 0000000..e23185b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr120341-1.c
@@ -0,0 +1,11 @@
+/* { dg-do run } */
+/* { dg-additional-options "-fallow-store-data-races" } */
+
+char a, *b;
+int main()
+{
+ b = "0";
+ if (a)
+ b[0]++;
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr120341-2.c b/gcc/testsuite/gcc.dg/torture/pr120341-2.c
new file mode 100644
index 0000000..7bcc96f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr120341-2.c
@@ -0,0 +1,13 @@
+/* { dg-do run } */
+/* { dg-additional-options "-fallow-store-data-races" } */
+
+char a, *b;
+int main()
+{
+ while (a)
+ {
+ b = "0";
+ b[0]++;
+ }
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr120347.c b/gcc/testsuite/gcc.dg/torture/pr120347.c
new file mode 100644
index 0000000..a2d187b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr120347.c
@@ -0,0 +1,13 @@
+/* { dg-do assemble } */
+/* { dg-additional-options "-march=armv7-a -mthumb" { target { arm_arch_v7a_ok && arm_thumb2_ok } } } */
+
+void *end;
+void **start;
+void main(void)
+{
+ for (; end; start++) {
+ if (*start)
+ return;
+ *start = start;
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr120369-1.c b/gcc/testsuite/gcc.dg/torture/pr120369-1.c
new file mode 100644
index 0000000..4c20fb0
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr120369-1.c
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+/* PR middle-end/120369 */
+
+/* Make sure cabs without a lhs does not cause an ICE. */
+void f()
+{
+ double _Complex z = 1.0;
+ __builtin_cabs(z);
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr120627.c b/gcc/testsuite/gcc.dg/torture/pr120627.c
new file mode 100644
index 0000000..f83cd53
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr120627.c
@@ -0,0 +1,27 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-fsigned-char -fno-strict-aliasing -fwrapv" } */
+
+unsigned char sub(unsigned char t, unsigned char u) { return t - u; }
+unsigned char mul(unsigned char t, unsigned char u) { return t * u; }
+int x(int aa, int ab) {
+ return ab >= 32 || aa > 18446744073709551615UL >> ab ? aa : aa << ab;
+}
+int ag;
+int ah = 249;
+char ap;
+static short ar[5][9];
+int *as = &ag;
+void bf(char cf) {
+ for (; ap <= 8; ap++) {
+ (ar[1][7] = mul(x(-1L, sub(cf, 247) / cf), ag <= 0)) || ar[1][4]++;
+ *as = ag;
+ }
+ return;
+}
+int main() {
+ bf(ah);
+ if (ar[1][7] != 255)
+ __builtin_abort ();
+ __builtin_exit (0);
+}
+
diff --git a/gcc/testsuite/gcc.dg/torture/pr120654.c b/gcc/testsuite/gcc.dg/torture/pr120654.c
new file mode 100644
index 0000000..aacfeea
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr120654.c
@@ -0,0 +1,22 @@
+/* { dg-do compile } */
+
+int a, c, e, f, h, j;
+long g, k;
+int b(int m) {
+ if (m || a)
+ return 1;
+ return 0.0f;
+}
+int d(int m, int p2) { return b(m) + m + (1 + p2 + p2); }
+int i() {
+ long l[] = {2, 9, 7, 8, g, g, 9, 0, 2, g};
+ e = l[c] << 6;
+}
+void n() {
+ long o;
+ int *p = __builtin_malloc(sizeof(int));
+ k = 1 % j;
+ for (; i() + f + h; o++)
+ if (p[d(j + 6, (int)k + 1992695866) + h + f + j + (int)k - 1 + o])
+ __builtin_free(p);
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr120736.c b/gcc/testsuite/gcc.dg/torture/pr120736.c
new file mode 100644
index 0000000..84f808a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr120736.c
@@ -0,0 +1,21 @@
+/* { dg-do run } */
+/* { dg-additional-options "-fsigned-char -fno-strict-aliasing -fwrapv" } */
+
+unsigned char aa (unsigned char ab, int o) { return ab > o ? ab : 0; }
+int p;
+int s;
+static unsigned char q = 255;
+int r;
+int *v = &s;
+int main() {
+ p = v != 0;
+ for (; r < 8; ++r) {
+ if (s)
+ break;
+ s = aa(p * q++, 6) <= 0;
+ }
+ if (q != 1)
+ __builtin_abort ();
+ __builtin_exit (0);
+}
+
diff --git a/gcc/testsuite/gcc.dg/torture/pr120813.c b/gcc/testsuite/gcc.dg/torture/pr120813.c
new file mode 100644
index 0000000..16adbe5
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr120813.c
@@ -0,0 +1,27 @@
+/* { dg-do run } */
+/* { dg-additional-options "-fsigned-char -fno-strict-aliasing -fwrapv" } */
+
+short s (short t, short u) { return u == 0 ? 0 : t / u; }
+int x[6];
+int y;
+unsigned ak = 1;
+unsigned short al = 65527;
+unsigned *am = &ak;
+int main() {
+ for (int i = 0; i < 6; i++) {
+ x[i] = i;
+ }
+ for (;;) {
+ unsigned long ar = 2080554998UL;
+ char as = 4;
+ if (s(34, al++) < ar)
+ if (*am)
+ break;
+ }
+ y = x[al & 5];
+ if ((y ^ 5UL) != 4)
+ __builtin_abort ();
+ __builtin_exit (0);
+}
+
+
diff --git a/gcc/testsuite/gcc.dg/torture/pr120944.c b/gcc/testsuite/gcc.dg/torture/pr120944.c
new file mode 100644
index 0000000..92f3c77
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr120944.c
@@ -0,0 +1,34 @@
+/* { dg-skip-if "" { *-*-* } { "-flto" } { "" } } */
+/* { dg-additional-options "-fdump-tree-optimized" } */
+
+#include <stdlib.h>
+
+typedef union {
+ int u32;
+ struct
+ {
+ int A:1;
+ int B:2;
+ int C:3;
+ };
+} u_t;
+
+typedef union {
+ volatile int u[3];
+ volatile struct {
+ u_t a;
+ int b;
+ int c;
+ };
+} DATA;
+
+void foo (volatile DATA *d)
+{
+ d->a.u32 = ~0;
+ u_t u = d->a;
+ int v = u.A;
+ if (v)
+ abort();
+}
+
+/* { dg-final { scan-tree-dump-times "if \\\(" 1 "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/torture/pr120951-1.c b/gcc/testsuite/gcc.dg/torture/pr120951-1.c
new file mode 100644
index 0000000..4e2b41d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr120951-1.c
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-options "-fnon-call-exceptions -fsignaling-nans" } */
+
+/* PR tree-optimization/120951 */
+
+/* cdce would create a trapping comparison inside a condition.
+ tests to make sure that does not happen. */
+
+double f(double r, double i) {
+ return __builtin_fmod(r, i);
+}
+
diff --git a/gcc/testsuite/gcc.dg/tree-prof/afdo-crossmodule-1.c b/gcc/testsuite/gcc.dg/tree-prof/afdo-crossmodule-1.c
new file mode 100644
index 0000000..574a085
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-prof/afdo-crossmodule-1.c
@@ -0,0 +1,29 @@
+/* { dg-require-effective-target lto } */
+/* { dg-additional-sources "afdo-crossmodule-1b.c" } */
+/* { dg-options "-O3 -flto -fdump-ipa-afdo_offline -fdump-tree-einline-details" } */
+/* { dg-require-profiling "-fauto-profile" } */
+volatile int c;
+
+int foo2 ()
+{
+ c++;
+ return 1;
+}
+int foo (int (*fooptr) ())
+{
+ return fooptr ();
+}
+extern int bar (int (*fooptr) (int (*)()));
+
+int
+main()
+{
+ int n = 1000000;
+ int s = 0;
+ for (int i = 0; i < n; i++)
+ s += bar (foo);
+ return n != s;
+}
+/* { dg-final-use-autofdo { scan-ipa-dump "Removing external inline: main:5 bar" "afdo_offline"} } */
+/* { dg-final-use-autofdo { scan-ipa-dump "Offlining function inlined to other module: bar:2 foo" "afdo_offline"} } */
+/* { dg-final-use-autofdo { scan-tree-dump "Indirect call -> speculative call foo.. => foo2" "einline"} } */
diff --git a/gcc/testsuite/gcc.dg/tree-prof/afdo-crossmodule-1b.c b/gcc/testsuite/gcc.dg/tree-prof/afdo-crossmodule-1b.c
new file mode 100644
index 0000000..dd53295
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-prof/afdo-crossmodule-1b.c
@@ -0,0 +1,10 @@
+extern int foo2 ();
+
+int bar (int (*fooptr) (int (*)()))
+{
+ return fooptr (foo2);
+}
+/* { dg-final-use-autofdo { scan-ipa-dump "Offlining function inlined to other module: main:5 bar" "afdo_offline"} } */
+/* { dg-final-use-autofdo { scan-ipa-dump "Offlining function inlined to other module: bar:2 main:5 foo" "afdo_offline"} } */
+/* It would be nice to speculate call to foo, but offlining does not preserve jump target
+ and currently afdo does not do cross-module indirect call promotion. */
diff --git a/gcc/testsuite/gcc.dg/tree-prof/afdo-inline.c b/gcc/testsuite/gcc.dg/tree-prof/afdo-inline.c
new file mode 100644
index 0000000..ded4068
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-prof/afdo-inline.c
@@ -0,0 +1,36 @@
+/* { dg-options "-O2 -fdump-tree-einline-details --param early-inlining-insns=1" } */
+/* { dg-require-profiling "-fauto-profile" } */
+volatile int a[1000];
+
+#define STR1(X) #X
+#define STR2(X) STR1(X)
+
+int reta (int i)
+asm(STR2(__USER_LABEL_PREFIX__) "renamed_reta");
+int test ()
+asm(STR2(__USER_LABEL_PREFIX__) "renamed_test");
+
+int reta (int i)
+{
+ if (a[i])
+ __builtin_printf ("It is one\n");
+ if (a[i] == 2)
+ __builtin_printf ("It is two\n");
+ return a[i];
+}
+int test ()
+{
+ int s = 0;
+ for (int pos = 0; pos < 1000; pos++)
+ reta(pos);
+ if (s)
+ __builtin_printf ("sum error\n");
+}
+int main()
+{
+ for (int i = 0; i < 10000; i++)
+ test();
+ return 0;
+}
+/* { dg-final-use-autofdo { scan-tree-dump "Inlining using auto-profile test" "einline"} } */
+/* { dg-final-use-autofdo { scan-tree-dump "Inlining using auto-profile reta.*transitively inlined to main" "einline"} } */
diff --git a/gcc/testsuite/gcc.dg/tree-prof/afdo-vpt-earlyinline.c b/gcc/testsuite/gcc.dg/tree-prof/afdo-vpt-earlyinline.c
new file mode 100644
index 0000000..b5c9024
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-prof/afdo-vpt-earlyinline.c
@@ -0,0 +1,38 @@
+/* { dg-options "-O2 -fdump-ipa-afdo-details -fdump-tree-einline-details --param early-inlining-insns=1" } */
+/* { dg-require-profiling "-fauto-profile" } */
+
+volatile int array[1000];
+int reta (int i)
+{
+ return array[i];
+}
+struct wrapptr
+{
+ int (*ret)(int);
+};
+int test (struct wrapptr *p)
+{
+ int s = 0;
+ int (*ret)(int) = p->ret;
+ for (int pos = 0; pos < 1000; pos++)
+ ret(pos);
+ if (s)
+ __builtin_printf ("sum error\n");
+}
+int main()
+{
+ for (int i = 0; i < 10000; i++)
+ {
+ struct wrapptr p={reta};
+
+
+
+ test(&p);
+ }
+ return 0;
+}
+/* { dg-final-use-autofdo { scan-tree-dump "Inlining using auto-profile test" "einline"} } */
+/* { dg-final-use-autofdo { scan-tree-dump "Checking indirect call -> direct call ret_" "einline"} } */
+/* { dg-final-use-autofdo { scan-tree-dump "looks good" "einline"} } */
+/* If we inlined reta->test->main, it will contian array[pos]. */
+/* { dg-final-use-autofdo { scan-tree-dump "array.pos_" "einline"} } */
diff --git a/gcc/testsuite/gcc.dg/tree-prof/clone-merge-1.c b/gcc/testsuite/gcc.dg/tree-prof/clone-merge-1.c
new file mode 100644
index 0000000..904dd0c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-prof/clone-merge-1.c
@@ -0,0 +1,34 @@
+/* { dg-options "-O3 -fno-early-inlining -fdump-ipa-afdo_offline-all" } */
+/* { dg-require-profiling "-fauto-profile" } */
+
+__attribute__ ((used))
+int a[1000];
+
+__attribute__ ((noinline))
+void
+test2(int sz)
+{
+ a[sz]++;
+ asm volatile (""::"m"(a));
+}
+
+__attribute__ ((noinline))
+void
+test1 (int sz)
+{
+ for (int i = 0; i < 1000; i++)
+ if (i % 2)
+ test2 (sz);
+ else
+ test2 (i);
+
+}
+int main()
+{
+ for (int i = 0; i < 1000; i++)
+ test1 (1000);
+ return 0;
+}
+/* We will have profiles for test2 and test2.constprop.0 that will have to be
+ merged, */
+/* { dg-final-use-autofdo { scan-ipa-dump "Merging duplicate instance: test2" "afdo_offline"} } */
diff --git a/gcc/testsuite/gcc.dg/tree-prof/clone-test.c b/gcc/testsuite/gcc.dg/tree-prof/clone-test.c
new file mode 100644
index 0000000..74d648b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-prof/clone-test.c
@@ -0,0 +1,63 @@
+/* { dg-options "-O3 -fno-early-inlining -fdump-ipa-afdo-all" } */
+/* { dg-require-profiling "-fauto-profile" } */
+
+#define N 5000
+__attribute__ ((used))
+int a[N+1];
+
+__attribute__ ((noinline))
+static void
+test2(int sz)
+{
+ a[sz]++;
+ asm volatile (""::"m"(a));
+}
+
+struct list
+{
+ struct list *next;
+ int val;
+};
+
+__attribute__ ((noinline))
+static int
+test3(volatile struct list l, int v)
+{
+ a [(l.val + v) % N] = v;
+}
+
+__attribute__ ((noinline))
+void
+test1 (int sz)
+{
+ volatile struct list l = {0};
+ __attribute__ ((noinline))
+ void inner(int i)
+ {
+ if (i % 2)
+ test2 (500);
+ if (i % 3)
+ test3 (l,200);
+ else
+ test2 (i);
+ }
+ for (int i = 0; i < N; i++)
+ inner(i);
+
+}
+
+int main()
+{
+ for (int i = 0; i < N; i++)
+ {
+ test1 (N);
+ }
+ return 0;
+}
+/* Profile will have test1.constprop.0 */
+/* { dg-final-use-autofdo { scan-ipa-dump "Annotating BB profile of test1" "afdo"} } */
+/* { dg-final-use-autofdo { scan-ipa-dump "Annotating BB profile of test2" "afdo"} } */
+/* Profile will have test3.constprop.0.isra.0 */
+/* { dg-final-use-autofdo { scan-ipa-dump "Annotating BB profile of test3" "afdo"} } */
+/* { dg-final-use-autofdo { scan-ipa-dump "Annotating BB profile of inner" "afdo"} } */
+
diff --git a/gcc/testsuite/gcc.dg/tree-prof/indir-call-prof-2.c b/gcc/testsuite/gcc.dg/tree-prof/indir-call-prof-2.c
index 1d64d9f..b6c0e4a 100644
--- a/gcc/testsuite/gcc.dg/tree-prof/indir-call-prof-2.c
+++ b/gcc/testsuite/gcc.dg/tree-prof/indir-call-prof-2.c
@@ -1,4 +1,4 @@
-/* { dg-options "-O2 -fno-early-inlining -fdump-ipa-profile-optimized -fdump-ipa-afdo-optimized" } */
+/* { dg-options "-O2 -fno-early-inlining -fdump-ipa-profile-details -fdump-tree-einline-details" } */
volatile int one;
static int
add1 (int val)
@@ -31,5 +31,5 @@ main (void)
}
/* { dg-final-use-not-autofdo { scan-ipa-dump "Indirect call -> direct call.* add1 .will resolve by ipa-profile" "profile"} } */
/* { dg-final-use-not-autofdo { scan-ipa-dump "Indirect call -> direct call.* sub1 .will resolve by ipa-profile" "profile"} } */
-/* { dg-final-use-autofdo { scan-ipa-dump "Inlining add1/1 into main/4." "afdo"} } */
-/* { dg-final-use-autofdo { scan-ipa-dump "Inlining sub1/2 into main/4." "afdo"} } */
+/* { dg-final-use-autofdo { scan-tree-dump "Inlining using auto-profile add1/. into do_op/. which is transitively inlined to main/" "einline"} } */
+/* { dg-final-use-autofdo { scan-tree-dump "Inlining using auto-profile sub1/. into do_op/. which is transitively inlined to main/" "einline"} } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/20031106-6.c b/gcc/testsuite/gcc.dg/tree-ssa/20031106-6.c
index 56d1887b..c7e0088 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/20031106-6.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/20031106-6.c
@@ -1,5 +1,7 @@
/* { dg-do compile } */
-/* { dg-options "-O1 -fno-tree-sra -fdump-tree-optimized" } */
+/* { dg-options "-O1 -fno-tree-sra -fdump-tree-optimized -fdump-tree-forwprop1-details" } */
+
+/* PR tree-optimization/14295 */
extern void link_error (void);
@@ -25,4 +27,6 @@ struct s foo (struct s r)
/* There should be no references to any of "temp_struct*"
temporaries. */
-/* { dg-final { scan-tree-dump-times "temp_struct" 0 "optimized" { xfail *-*-* } } } */
+/* { dg-final { scan-tree-dump-times "temp_struct" 0 "optimized" } } */
+/* Also check that forwprop pass did the copy prop. */
+/* { dg-final { scan-tree-dump-times "after previous" 3 "forwprop1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/abs-4.c b/gcc/testsuite/gcc.dg/tree-ssa/abs-4.c
index 4144d1c..f43018d 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/abs-4.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/abs-4.c
@@ -1,6 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-O1 -fdump-tree-optimized" } */
-/* { dg-additional-options "-msse -mfpmath=sse" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
+/* { dg-additional-options "-msse2 -mfpmath=sse" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
/* PR tree-optimization/109829 */
float abs_f(float x) { return __builtin_signbit(x) ? x : -x; }
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/backprop-6.c b/gcc/testsuite/gcc.dg/tree-ssa/backprop-6.c
index dbde681..efb53f1 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/backprop-6.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/backprop-6.c
@@ -1,6 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-O -fdump-tree-backprop-details" } */
-/* { dg-additional-options "-msse -mfpmath=sse" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
+/* { dg-additional-options "-msse2 -mfpmath=sse" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
void start (void *);
void end (void *);
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/cswtch-6.c b/gcc/testsuite/gcc.dg/tree-ssa/cswtch-6.c
new file mode 100644
index 0000000..d765a03
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/cswtch-6.c
@@ -0,0 +1,43 @@
+/* PR tree-optimization/120451 */
+/* { dg-do compile { target elf } } */
+/* { dg-options "-O2" } */
+
+void foo (int, int);
+
+__attribute__((noinline, noclone)) void
+f1 (int v, int w)
+{
+ int i, j;
+ if (w)
+ {
+ i = 129;
+ j = i - 1;
+ goto lab;
+ }
+ switch (v)
+ {
+ case 170:
+ j = 7;
+ i = 27;
+ break;
+ case 171:
+ i = 8;
+ j = 122;
+ break;
+ case 172:
+ i = 21;
+ j = -19;
+ break;
+ case 173:
+ i = 18;
+ j = 17;
+ break;
+ default:
+ __builtin_abort ();
+ }
+
+ lab:
+ foo (i, j);
+}
+
+/* { dg-final { scan-assembler ".rodata.cst16" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/forwprop-41.c b/gcc/testsuite/gcc.dg/tree-ssa/forwprop-41.c
index a1f0828..1c5b500 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/forwprop-41.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/forwprop-41.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-optimized -Wno-psabi -w" } */
+/* { dg-additional-options "-msse" { target i?86-*-* x86_64-*-* } } */
#define vector __attribute__((__vector_size__(16) ))
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/gen-vect-28.c b/gcc/testsuite/gcc.dg/tree-ssa/gen-vect-28.c
index 5c0ea58..4b3ce4e 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/gen-vect-28.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/gen-vect-28.c
@@ -9,7 +9,8 @@
/* unaligned store. */
-int main_1 (int off)
+int __attribute__((noipa))
+main_1 (int off)
{
int i;
char ia[N+OFF];
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ifcvt-fix-trunc-1.c b/gcc/testsuite/gcc.dg/tree-ssa/ifcvt-fix-trunc-1.c
new file mode 100644
index 0000000..801a53f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ifcvt-fix-trunc-1.c
@@ -0,0 +1,19 @@
+ /* { dg-do compile } */
+ /* { dg-options "-O2 -ftree-vectorize -fdump-tree-ifcvt-stats" } */
+
+void
+test (int *dst, float *arr, int *pred, int n)
+{
+ for (int i = 0; i < n; i++)
+ {
+ int pred_i = pred[i];
+ float arr_i = arr[i];
+
+ dst[i] = pred_i ? (int)arr_i : 5;
+ }
+}
+
+/* We expect this to fail if_convertible_loop_p so long as we have no
+ conditional IFN for FIX_TRUNC_EXPR. */
+
+/* { dg-final { scan-tree-dump-times "Applying if-conversion" 0 "ifcvt" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ifcvt-fix-trunc-2.c b/gcc/testsuite/gcc.dg/tree-ssa/ifcvt-fix-trunc-2.c
new file mode 100644
index 0000000..628b754
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ifcvt-fix-trunc-2.c
@@ -0,0 +1,6 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -ftree-vectorize -fno-trapping-math -fdump-tree-ifcvt-stats" } */
+
+#include "ifcvt-fix-trunc-1.c"
+
+/* { dg-final { scan-tree-dump-times "Applying if-conversion" 1 "ifcvt" } } */
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/phiprop-2.c b/gcc/testsuite/gcc.dg/tree-ssa/phiprop-2.c
new file mode 100644
index 0000000..ae0d181
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/phiprop-2.c
@@ -0,0 +1,27 @@
+/* { dg-do compile } */
+/* { dg-options "-O1 -fdump-tree-phiopt1 -fdump-tree-phiprop1-details" } */
+
+/* PR tree-optimization/116824 */
+
+int g(int i, int *tt)
+{
+ const int t = 10;
+ const int *a;
+ {
+ if (t < i)
+ {
+ *tt = 1;
+ a = &t;
+ }
+ else
+ {
+ *tt = 1;
+ a = &i;
+ }
+ }
+ return *a;
+}
+
+/* Check that phiprop1 can do the insert of the loads. */
+/* { dg-final { scan-tree-dump-times "Inserting PHI for result of load" 1 "phiprop1"} } */
+/* { dg-final { scan-tree-dump-times "MIN_EXPR " 1 "phiopt1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr108358-a.c b/gcc/testsuite/gcc.dg/tree-ssa/pr108358-a.c
new file mode 100644
index 0000000..342e1c1
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr108358-a.c
@@ -0,0 +1,33 @@
+/* { dg-do compile } */
+/* { dg-options "-Os -fdump-tree-optimized" } */
+
+/* PR tree-optimization/108358 */
+
+struct a {
+ int b;
+ int c;
+ short d;
+ int e;
+ int f;
+};
+struct g {
+ struct a f;
+ struct a h;
+};
+int i;
+void foo();
+void bar31_(void);
+int main() {
+ struct g j, l = {2, 1, 6, 1, 1, 7, 5, 1, 0, 1};
+ for (; i; ++i)
+ bar31_();
+ j = l;
+ struct g m = j;
+ struct g k = m;
+ if (k.h.b)
+ ;
+ else
+ foo();
+}
+/* The call to foo should be optimized away. */
+/* { dg-final { scan-tree-dump-not "foo " "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr114169-1.c b/gcc/testsuite/gcc.dg/tree-ssa/pr114169-1.c
new file mode 100644
index 0000000..37766fb
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr114169-1.c
@@ -0,0 +1,39 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-forwprop-details -fdump-tree-optimized" } */
+
+
+/* PR tree-optimization/114169 */
+
+#include <stdint.h>
+
+struct S1 {
+ uint32_t f0;
+ uint8_t f1;
+ uint64_t f2;
+ uint64_t f3;
+ int32_t f4;
+};
+
+union U8 {
+ struct S1 f0;
+ int32_t f1;
+ int64_t f2;
+ uint8_t f3;
+ const int64_t f4;
+};
+
+/* --- GLOBAL VARIABLES --- */
+struct S1 g_16 = {4294967293UL,1UL,1UL,0xA9C1C73B017290B1LL,0x5ADF851FL};
+union U8 g_37 = {{1UL,1UL,0x2361AE7D51263067LL,0xEEFD7F9B64A47447LL,0L}};
+struct S1 g_50 = {0x0CFC2012L,1UL,0x43E1243B3BE7B8BBLL,0x03C5CEC10C1A6FE1LL,1L};
+
+
+/* --- FORWARD DECLARATIONS --- */
+
+void func_32(union U8 e) {
+ e.f3 = e.f0.f4;
+ g_16 = e.f0 = g_50;
+}
+/* The union e should not make a difference here. */
+/* { dg-final { scan-tree-dump-times "after previous" 1 "forwprop1" } } */
+/* { dg-final { scan-tree-dump "g_16 = g_50;" "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr114864.c b/gcc/testsuite/gcc.dg/tree-ssa/pr114864.c
new file mode 100644
index 0000000..cd9b94c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr114864.c
@@ -0,0 +1,15 @@
+/* { dg-do run } */
+/* { dg-options "-O1 -fno-tree-dce -fno-tree-fre" } */
+
+struct a {
+ int b;
+} const c;
+void d(const struct a f) {}
+void e(const struct a f) {
+ f.b == 0 ? 1 : f.b;
+ d(f);
+}
+int main() {
+ e(c);
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr120080.c b/gcc/testsuite/gcc.dg/tree-ssa/pr120080.c
new file mode 100644
index 0000000..d71ef5e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr120080.c
@@ -0,0 +1,26 @@
+/* { dg-do compile } */
+/* { dg-options "-fgimple -O2" } */
+
+void __GIMPLE (ssa,startwith("switchlower1"))
+foo (int b)
+{
+ __BB(2):
+ switch (b) {default: L9; case 0: L5; case 5: L5; case 101: L5; }
+
+ __BB(3):
+L9:
+ switch (b) {default: L7; case 5: L6; case 101: L6; }
+
+ __BB(4):
+L6:
+ __builtin_unreachable ();
+
+ __BB(5):
+L7:
+ __builtin_trap ();
+
+ __BB(6):
+L5:
+ return;
+
+}
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr120231-1.c b/gcc/testsuite/gcc.dg/tree-ssa/pr120231-1.c
new file mode 100644
index 0000000..c1ce44f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr120231-1.c
@@ -0,0 +1,67 @@
+/* PR tree-optimization/120231 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+/* { dg-add-options float32 } */
+/* { dg-add-options float64 } */
+/* { dg-add-options float128 } */
+/* { dg-require-effective-target float32 } */
+/* { dg-require-effective-target float64 } */
+/* { dg-require-effective-target float128 } */
+/* { dg-final { scan-tree-dump-not "link_failure \\\(\\\);" "optimized" } } */
+
+void link_failure (void);
+
+void
+foo (_Float64 x)
+{
+ if (x >= -64.0f64 && x <= 0x1.p+140f64)
+ {
+ _Float32 z = x;
+ _Float128 w = z;
+ _Float128 v = x;
+ if (__builtin_isnan (z)
+ || __builtin_isnan (w)
+ || __builtin_isnan (v)
+ || z < -64.0f32
+ || w < -64.0f128
+ || __builtin_isinf (v)
+ || v < -64.0f128
+ || v > 0x1.p+140f128)
+ link_failure ();
+ }
+}
+
+void
+bar (_Float64 x)
+{
+ _Float32 z = x;
+ if (z >= -64.0f32 && z <= 0x1.p+38f32)
+ {
+ if (__builtin_isnan (x)
+ || __builtin_isinf (x)
+ || x < -0x1.000001p+6f64
+ || x > 0x1.000001p+38f64)
+ link_failure ();
+ }
+}
+
+void
+baz (_Float64 x)
+{
+ _Float128 w = x;
+ if (w >= -64.0f128 && w <= 0x1.p+1026f128)
+ {
+ if (__builtin_isnan (x)
+ || __builtin_isinf (x)
+ || x < -64.0f64)
+ link_failure ();
+ }
+ if (w >= 128.25f128 && w <= 0x1.p+1020f128)
+ {
+ if (__builtin_isnan (x)
+ || __builtin_isinf (x)
+ || x < 128.25f64
+ || x > 0x1.p+1020f64)
+ link_failure ();
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr120231-2.c b/gcc/testsuite/gcc.dg/tree-ssa/pr120231-2.c
new file mode 100644
index 0000000..d2b41ba
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr120231-2.c
@@ -0,0 +1,107 @@
+/* PR tree-optimization/120231 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+/* { dg-add-options float64 } */
+/* { dg-require-effective-target float64 } */
+/* { dg-final { scan-tree-dump-not "link_failure \\\(\\\);" "optimized" } } */
+
+void link_failure (void);
+
+static _Float64 __attribute__((noinline))
+f1 (signed char x)
+{
+ return x;
+}
+
+static _Float64 __attribute__((noinline))
+f2 (signed char x)
+{
+ if (x >= -37 && x <= 42)
+ return x;
+ return 0.0f64;
+}
+
+void
+f3 (signed char x)
+{
+ _Float64 y = f1 (x);
+ if (y < (_Float64) (-__SCHAR_MAX__ - 1) || y > (_Float64) __SCHAR_MAX__)
+ link_failure ();
+ y = f2 (x);
+ if (y < -37.0f64 || y > 42.0f64)
+ link_failure ();
+}
+
+static _Float64 __attribute__((noinline))
+f4 (long long x)
+{
+ return x;
+}
+
+static _Float64 __attribute__((noinline))
+f5 (long long x)
+{
+ if (x >= -0x3ffffffffffffffeLL && x <= 0x3ffffffffffffffeLL)
+ return x;
+ return 0.0f64;
+}
+
+void
+f6 (long long x)
+{
+ _Float64 y = f4 (x);
+ if (y < (_Float64) (-__LONG_LONG_MAX__ - 1) || y > (_Float64) __LONG_LONG_MAX__)
+ link_failure ();
+ y = f5 (x);
+ if (y < (_Float64) -0x3ffffffffffffffeLL || y > (_Float64) 0x3ffffffffffffffeLL)
+ link_failure ();
+}
+
+static signed char __attribute__((noinline))
+f7 (_Float64 x)
+{
+ if (x >= -78.5f64 && x <= 98.25f64)
+ return x;
+ return 0;
+}
+
+static unsigned char __attribute__((noinline))
+f8 (_Float64 x)
+{
+ if (x >= -0.75f64 && x <= 231.625f64)
+ return x;
+ return 31;
+}
+
+static long long __attribute__((noinline))
+f9 (_Float64 x)
+{
+ if (x >= -3372587051122780362.75f64 && x <= 3955322825938799366.25f64)
+ return x;
+ return 0;
+}
+
+static unsigned long long __attribute__((noinline))
+f10 (_Float64 x)
+{
+ if (x >= 31.25f64 && x <= 16751991430751148048.125f64)
+ return x;
+ return 4700;
+}
+
+void
+f11 (_Float64 x)
+{
+ signed char a = f7 (x);
+ if (a < -78 || a > 98)
+ link_failure ();
+ unsigned char b = f8 (x);
+ if (b > 231)
+ link_failure ();
+ long long c = f9 (x);
+ if (c < -3372587051122780160LL || c > 3955322825938799616LL)
+ link_failure ();
+ unsigned long long d = f10 (x);
+ if (d < 31 || d > 16751991430751148032ULL)
+ link_failure ();
+}
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr120231-3.c b/gcc/testsuite/gcc.dg/tree-ssa/pr120231-3.c
new file mode 100644
index 0000000..d578c5b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr120231-3.c
@@ -0,0 +1,40 @@
+/* PR tree-optimization/120231 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+/* { dg-add-options float64 } */
+/* { dg-require-effective-target float64 } */
+/* { dg-final { scan-tree-dump-not "link_failure \\\(\\\);" "optimized" } } */
+
+void link_failure (void);
+
+void
+foo (long long x)
+{
+ _Float64 y = x;
+ if (y >= -8577328745032543176.25f64 && y <= 699563045341050951.75f64)
+ {
+ if (x < -8577328745032544256LL || x > 699563045341051136LL)
+ link_failure ();
+ }
+ if (y >= -49919160463252.125f64 && y <= 757060336735329.625f64)
+ {
+ if (x < -49919160463252LL || x > 757060336735329LL)
+ link_failure ();
+ }
+}
+
+void
+bar (_Float64 x)
+{
+ long long y = x;
+ if (y >= -6923230004751524066LL && y <= 2202103129706786704LL)
+ {
+ if (x < -6923230004751524864.0f64 || x > 2202103129706786816.0f64)
+ link_failure ();
+ }
+ if (y >= -171621738469699LL && y <= 45962470357748LL)
+ {
+ if (x <= -1716217384696970.f64 || x >= 45962470357749.0f64)
+ link_failure ();
+ }
+}
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/tree-ssa/pr35286.c b/gcc/testsuite/gcc.dg/tree-ssa/pr35286.c
index 4429cc8..b4f8c7c 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/pr35286.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr35286.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -fno-code-hoisting -fno-tree-cselim -fdump-tree-pre-stats" } */
+/* { dg-options "-O2 -fno-code-hoisting -fno-tree-cselim -fno-ssa-phiopt -fdump-tree-pre-stats" } */
int g2;
struct A {
int a; int b;
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr57361-1.c b/gcc/testsuite/gcc.dg/tree-ssa/pr57361-1.c
new file mode 100644
index 0000000..dc4fadb
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr57361-1.c
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-O -fdump-tree-forwprop1-details" } */
+
+struct A { int x; double y; };
+void f (struct A *a) {
+ *a = *a;
+}
+
+/* xfailed until figuring out the best way to handle aliasing barriers. */
+/* { dg-final { scan-tree-dump "into a NOP" "forwprop1" { xfail *-*-* } } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr57361.c b/gcc/testsuite/gcc.dg/tree-ssa/pr57361.c
index 81f27b3..7e273db 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/pr57361.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr57361.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O -fdump-tree-dse1-details" } */
+/* { dg-options "-O -fdump-tree-dse1-details -fno-tree-forwprop" } */
struct A { int x; double y; };
void f (struct A *a) {
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/split-path-6.c b/gcc/testsuite/gcc.dg/tree-ssa/split-path-6.c
index 71e6362..e2b0a95 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/split-path-6.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/split-path-6.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -fsplit-paths -fno-tree-cselim -fdump-tree-split-paths-details -fno-finite-loops -fno-tree-dominator-opts -fno-tree-vrp -w" } */
+/* { dg-options "-O2 -fsplit-paths -fno-tree-cselim -fno-ssa-phiopt -fdump-tree-split-paths-details -fno-finite-loops -fno-tree-dominator-opts -fno-tree-vrp -w" } */
struct __sFILE
{
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/split-path-7.c b/gcc/testsuite/gcc.dg/tree-ssa/split-path-7.c
index 252fe06..35634ab 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/split-path-7.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/split-path-7.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -fsplit-paths -fno-tree-cselim -fno-tree-sink -fdump-tree-split-paths-details -w" } */
+/* { dg-options "-O2 -fsplit-paths -fno-tree-cselim -fno-ssa-phiopt -fno-tree-sink -fdump-tree-split-paths-details -w" } */
struct _reent
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-7.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-7.c
index 59891f2..1c2cfa4 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-7.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-7.c
@@ -11,8 +11,8 @@
to change decisions in switch expansion which in turn can expose new
jump threading opportunities. Skip the later tests on aarch64. */
/* { dg-final { scan-tree-dump-not "Jumps threaded" "dom3" { target { ! aarch64*-*-* } } } } */
-/* { dg-final { scan-tree-dump "Jumps threaded: 10" "thread2" { target { ! aarch64*-*-* } } } } */
-/* { dg-final { scan-tree-dump "Jumps threaded: 17" "thread2" { target { aarch64*-*-* } } } } */
+/* { dg-final { scan-tree-dump "Jumps threaded: 8" "thread2" { target { ! aarch64*-*-* } } } } */
+/* { dg-final { scan-tree-dump "Jumps threaded: 8" "thread2" { target { aarch64*-*-* } } } } */
enum STATE {
S0=0,
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp124.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp124.c
new file mode 100644
index 0000000..789b550
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp124.c
@@ -0,0 +1,31 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-evrp" } */
+
+/* Test removal of trailing zero mask ranges from signed values. */
+/* Mask off the lower 4 bits of an integer. */
+#define MASK 0XF
+
+void dead (int c);
+void keep();
+
+/* A signed character should have a range something like : */
+/* int [-INF, -16][0, 0][16, 2147483632] MASK 0xfffffff0 VALUE 0x0 */
+
+int
+foo2 (int c)
+{
+ c = c & ~MASK;
+ if (c == 0)
+ return 0;
+ if (c > -16)
+ {
+ keep ();
+ if (c < 16)
+ dead (c);
+ }
+ if (c > (__INT_MAX__ & ~MASK))
+ dead (c);
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-not "dead" "evrp" } } */
diff --git a/gcc/testsuite/gcc.dg/ubsan/pr120837.c b/gcc/testsuite/gcc.dg/ubsan/pr120837.c
new file mode 100644
index 0000000..97c85c7
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ubsan/pr120837.c
@@ -0,0 +1,32 @@
+/* PR c/120837 */
+/* { dg-do run } */
+/* { dg-options "-O1 -fsanitize=undefined -fno-sanitize-recover=undefined" } */
+
+[[gnu::noipa]] void
+bar (void **x, void **y)
+{
+ x[0] = 0;
+ x[1] = 0;
+ x[2] = 0;
+ y[0] = 0;
+ y[1] = 0;
+ y[2] = 0;
+ y[3] = 0;
+ y[4] = 0;
+}
+
+[[gnu::noipa]] void *
+foo (int x, int y)
+{
+ void *a[3];
+ void *b[5];
+ bar (a, b);
+ return (x > y ? b : a)[y - 1];
+}
+
+int
+main ()
+{
+ if (foo (2, 1) != 0)
+ __builtin_abort ();
+}
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-pr115777.c b/gcc/testsuite/gcc.dg/vect/bb-slp-pr115777.c
new file mode 100644
index 0000000..bba0dc7
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-pr115777.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+
+typedef unsigned int T;
+
+#define SWAP(A, B) do { T tmp = A; A = B; B = tmp; } while (0)
+
+void
+insertion_sort(T *v, int n)
+{
+ for (int i = 1; i < n; ++i)
+ for (int k = i; k > 0 && v[k-1] > v[k]; --k)
+ SWAP(v[k-1], v[k]);
+}
+
+/* { dg-final { scan-tree-dump "using element-wise load" "slp1" { target { { x86_64-*-* i?86-*-* } && { ! ia32 } } } } } */
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-pr119181.c b/gcc/testsuite/gcc.dg/vect/bb-slp-pr119181.c
new file mode 100644
index 0000000..b0d3e5a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-pr119181.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+void
+foo (int* a, int* restrict b)
+{
+ b[0] = a[0] * a[64];
+ b[1] = a[65] * a[1];
+ b[2] = a[2] * a[66];
+ b[3] = a[67] * a[3];
+ b[4] = a[68] * a[4];
+ b[5] = a[69] * a[5];
+ b[6] = a[6] * a[70];
+ b[7] = a[7] * a[71];
+}
+
+/* { dg-final { scan-tree-dump-times "optimized: basic block" 1 "slp2" { target vect_int_mult } } } */
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-pr119960-1.c b/gcc/testsuite/gcc.dg/vect/bb-slp-pr119960-1.c
new file mode 100644
index 0000000..955fc7e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-pr119960-1.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target vect_double } */
+
+double foo (double *dst, double *src, int b)
+{
+ double y = src[1];
+ if (b)
+ {
+ dst[0] = src[0];
+ dst[1] = y;
+ }
+ return y;
+}
+
+/* { dg-final { scan-tree-dump "optimized: basic block part vectorized" "slp2" { target vect_double } } } */
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-pr120808.c b/gcc/testsuite/gcc.dg/vect/bb-slp-pr120808.c
new file mode 100644
index 0000000..acb7472
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-pr120808.c
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-ffp-contract=on" } */
+/* { dg-additional-options "-mfma -mfpmath=sse" { target { x86_64-*-* i?86-*-* } } } */
+
+void f(double x[restrict], double *y, double *z)
+{
+ x[0] = x[0] * y[0] + z[0];
+ x[1] = x[1] * y[1] - z[1];
+}
+
+/* The following should check for SLP build covering the loads. */
+/* { dg-final { scan-tree-dump "Found VEC_FMSUBADD pattern" "slp2" { target { x86_64-*-* i?86-*-* } } } } */
diff --git a/gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul4-3.c b/gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul4-3.c
index 85e3021..b5a7f18 100644
--- a/gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul4-3.c
+++ b/gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul4-3.c
@@ -45,4 +45,4 @@ void foo2 (int64_t *__restrict a,
/* { dg-final { scan-tree-dump-not "Preferring smaller LMUL loop because it has unexpected spills" "vect" } } */
/* { dg-final { scan-tree-dump-times "Maximum lmul = 8" 1 "vect" } } */
/* { dg-final { scan-tree-dump-times "Maximum lmul = 4" 1 "vect" } } */
-/* { dg-final { scan-tree-dump-times "Maximum lmul = 2" 1 "vect" } } */
+/* { dg-final { scan-tree-dump-times "Maximum lmul = 2" 3 "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul8-9.c b/gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul8-9.c
index 793d164..5623458 100644
--- a/gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul8-9.c
+++ b/gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul8-9.c
@@ -14,6 +14,5 @@ foo (int64_t *__restrict a, int64_t init, int n)
/* { dg-final { scan-assembler {e64,m8} } } */
/* { dg-final { scan-assembler-not {csrr} } } */
/* { dg-final { scan-tree-dump-not "Preferring smaller LMUL loop because it has unexpected spills" "vect" } } */
-/* { dg-final { scan-tree-dump-times "Maximum lmul = 8" 1 "vect" } } */
/* { dg-final { scan-tree-dump-times "Maximum lmul = 4" 1 "vect" } } */
/* { dg-final { scan-tree-dump-times "Maximum lmul = 2" 1 "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/pr101145.c b/gcc/testsuite/gcc.dg/vect/pr101145.c
index cd11c03..c055ae6 100644
--- a/gcc/testsuite/gcc.dg/vect/pr101145.c
+++ b/gcc/testsuite/gcc.dg/vect/pr101145.c
@@ -2,7 +2,7 @@
/* { dg-additional-options "-O3" } */
#include <limits.h>
-unsigned __attribute__ ((noinline))
+unsigned __attribute__ ((noipa))
foo (int *__restrict__ a, int *__restrict__ b, unsigned l, unsigned n)
{
while (n < ++l)
@@ -10,7 +10,7 @@ foo (int *__restrict__ a, int *__restrict__ b, unsigned l, unsigned n)
return l;
}
-unsigned __attribute__ ((noinline))
+unsigned __attribute__ ((noipa))
foo_1 (int *__restrict__ a, int *__restrict__ b, unsigned l, unsigned)
{
while (UINT_MAX - 64 < ++l)
@@ -18,7 +18,7 @@ foo_1 (int *__restrict__ a, int *__restrict__ b, unsigned l, unsigned)
return l;
}
-unsigned __attribute__ ((noinline))
+unsigned __attribute__ ((noipa))
foo_2 (int *__restrict__ a, int *__restrict__ b, unsigned l, unsigned n)
{
l = UINT_MAX - 32;
@@ -27,7 +27,7 @@ foo_2 (int *__restrict__ a, int *__restrict__ b, unsigned l, unsigned n)
return l;
}
-unsigned __attribute__ ((noinline))
+unsigned __attribute__ ((noipa))
foo_3 (int *__restrict__ a, int *__restrict__ b, unsigned l, unsigned n)
{
while (n <= ++l)
@@ -35,7 +35,7 @@ foo_3 (int *__restrict__ a, int *__restrict__ b, unsigned l, unsigned n)
return l;
}
-unsigned __attribute__ ((noinline))
+unsigned __attribute__ ((noipa))
foo_4 (int *__restrict__ a, int *__restrict__ b, unsigned l, unsigned n)
{ // infininate
while (0 <= ++l)
@@ -43,7 +43,7 @@ foo_4 (int *__restrict__ a, int *__restrict__ b, unsigned l, unsigned n)
return l;
}
-unsigned __attribute__ ((noinline))
+unsigned __attribute__ ((noipa))
foo_5 (int *__restrict__ a, int *__restrict__ b, unsigned l, unsigned n)
{
//no loop
@@ -53,7 +53,7 @@ foo_5 (int *__restrict__ a, int *__restrict__ b, unsigned l, unsigned n)
return l;
}
-unsigned __attribute__ ((noinline))
+unsigned __attribute__ ((noipa))
bar (int *__restrict__ a, int *__restrict__ b, unsigned l, unsigned n)
{
while (--l < n)
@@ -61,7 +61,7 @@ bar (int *__restrict__ a, int *__restrict__ b, unsigned l, unsigned n)
return l;
}
-unsigned __attribute__ ((noinline))
+unsigned __attribute__ ((noipa))
bar_1 (int *__restrict__ a, int *__restrict__ b, unsigned l, unsigned)
{
while (--l < 64)
@@ -69,7 +69,7 @@ bar_1 (int *__restrict__ a, int *__restrict__ b, unsigned l, unsigned)
return l;
}
-unsigned __attribute__ ((noinline))
+unsigned __attribute__ ((noipa))
bar_2 (int *__restrict__ a, int *__restrict__ b, unsigned l, unsigned n)
{
l = 32;
diff --git a/gcc/testsuite/gcc.dg/vect/pr120817.c b/gcc/testsuite/gcc.dg/vect/pr120817.c
new file mode 100644
index 0000000..199189a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/pr120817.c
@@ -0,0 +1,41 @@
+/* { dg-additional-options "-O1" } */
+/* { dg-require-effective-target aarch64_sve_hw { target aarch64*-*-* } } */
+/* { dg-additional-options "-march=armv8-a+sve -mtune=neoverse-n2" { target aarch64*-*-* } } */
+
+#include "tree-vect.h"
+
+typedef struct {
+ int _M_current;
+} __normal_iterator;
+
+typedef struct {
+ char _M_elems[5];
+} array_5;
+
+__normal_iterator __trans_tmp_1 = {-5};
+
+__attribute__((noipa))
+array_5 copySourceIntoTarget() {
+ array_5 target;
+ char* target_it = target._M_elems;
+
+ while (__trans_tmp_1._M_current != 0) {
+ *target_it = 1;
+ __trans_tmp_1._M_current++;
+ target_it++;
+ }
+
+ return target;
+}
+
+int main ()
+{
+ check_vect ();
+
+ array_5 res = copySourceIntoTarget();
+
+#pragma GCC novector
+ for (int i = 0; i < 5; i++)
+ if (res._M_elems[i] != 1)
+ __builtin_abort ();
+}
diff --git a/gcc/testsuite/gcc.dg/vect/pr120922.c b/gcc/testsuite/gcc.dg/vect/pr120922.c
new file mode 100644
index 0000000..1a7247a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/pr120922.c
@@ -0,0 +1,18 @@
+/* { dg-require-effective-target vect_int } */
+/* { dg-additional-options "-fsigned-char -fno-strict-aliasing -fwrapv" } */
+/* { dg-additional-options "-march=rv64gcv_zvl1024b -mrvv-vector-bits=zvl -mrvv-max-lmul=m8 -O3" { target { riscv_v } } } */
+
+char g;
+unsigned char h;
+int i[9][6];
+int main() {
+ int k[5];
+ if (g)
+ goto l;
+ for (; h <= 5; h++)
+ i[0][h] = *k;
+l:
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump "loop vectorized" "vect" { target riscv_v } } } */
diff --git a/gcc/testsuite/gcc.dg/vect/pr121034.c b/gcc/testsuite/gcc.dg/vect/pr121034.c
new file mode 100644
index 0000000..de20781
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/pr121034.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-O3" } */
+
+int b, e;
+char c, d;
+unsigned g;
+int abs(int);
+void f() {
+ char *a = &d;
+ int h;
+ for (; e; e++) {
+ h = 0;
+ for (; h < 16; h++)
+ g += __builtin_abs(a[h] - c);
+ a += b;
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s332.c b/gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s332.c
index 0d55d0d..21a9c5a 100644
--- a/gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s332.c
+++ b/gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s332.c
@@ -3,6 +3,7 @@
/* { dg-additional-options "--param vect-epilogues-nomask=0" } */
/* { dg-require-effective-target vect_float } */
+/* { dg-require-effective-target vect_early_break_hw } */
/* { dg-add-options vect_early_break } */
#include "tsvc.h"
diff --git a/gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s481.c b/gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s481.c
index 5539f0f..e443338 100644
--- a/gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s481.c
+++ b/gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s481.c
@@ -3,6 +3,7 @@
/* { dg-additional-options "--param vect-epilogues-nomask=0" } */
/* { dg-require-effective-target vect_float } */
+/* { dg-require-effective-target vect_early_break_hw } */
/* { dg-add-options vect_early_break } */
#include "tsvc.h"
diff --git a/gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s482.c b/gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s482.c
index 73bed5d..146df40 100644
--- a/gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s482.c
+++ b/gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s482.c
@@ -3,6 +3,7 @@
/* { dg-additional-options "--param vect-epilogues-nomask=0" } */
/* { dg-require-effective-target vect_float } */
+/* { dg-require-effective-target vect_early_break_hw } */
/* { dg-add-options vect_early_break } */
#include "tsvc.h"
diff --git a/gcc/testsuite/gcc.dg/vect/vect-early-break_133_pfa6.c b/gcc/testsuite/gcc.dg/vect/vect-early-break_133_pfa6.c
index ee123df..7787d03 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-early-break_133_pfa6.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-early-break_133_pfa6.c
@@ -20,4 +20,4 @@ unsigned test4(char x, char *vect_a, char *vect_b, int n)
return ret;
}
-/* { dg-final { scan-tree-dump "Versioning for alignment will be applied" "vect" } } */
+/* { dg-final { scan-tree-dump "Both peeling and versioning will be applied" "vect" } } */
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); }
diff --git a/gcc/testsuite/gcc.dg/vect/vect-early-break_135-pr120211.c b/gcc/testsuite/gcc.dg/vect/vect-early-break_135-pr120211.c
new file mode 100644
index 0000000..664b60d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-early-break_135-pr120211.c
@@ -0,0 +1,12 @@
+/* { dg-add-options vect_early_break } */
+/* { dg-additional-options "-O3 -fno-tree-copy-prop -fno-tree-dominator-opts -fno-tree-loop-ivcanon -fno-tree-pre -fno-code-hoisting" } */
+
+int a, b[1];
+int main() {
+ int c = 0;
+ for (; c < 1; c++) {
+ while (a)
+ c++;
+ b[c] = 0;
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/vect/vect-early-break_136-pr120357.c b/gcc/testsuite/gcc.dg/vect/vect-early-break_136-pr120357.c
new file mode 100644
index 0000000..8a51cfc
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-early-break_136-pr120357.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-add-options vect_early_break } */
+/* { dg-additional-options "-O3" } */
+
+char a;
+unsigned long long t[2][22];
+int u[22];
+void f(void)
+{
+ for (int v = 0; v < 22; v++)
+ for (_Bool w = 0; w < (u[v] < 0) + 1; w = 1)
+ a *= 0 != t[w][v];
+}
diff --git a/gcc/testsuite/gcc.dg/vect/vect-pr120927-2.c b/gcc/testsuite/gcc.dg/vect/vect-pr120927-2.c
new file mode 100644
index 0000000..e38cebe
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-pr120927-2.c
@@ -0,0 +1,24 @@
+/* { dg-additional-options "--param vect-partial-vector-usage=1" } */
+/* { dg-additional-options "-mavx512bw -mavx512vl" { target avx512f_runtime } } */
+
+#include "tree-vect.h"
+
+static const double __attribute__((aligned(__BIGGEST_ALIGNMENT__))) a[] = { 1., 2., 3., 4., 5. };
+
+void __attribute__((noipa))
+foo (double *b, double *bp, double c, int n)
+{
+ for (int i = 0; i < n; ++i)
+ b[i] = bp[i] = a[i] * c;
+}
+
+int main()
+{
+ double b[6], bp[6];
+ b[5] = bp[5] = 13.;
+ check_vect ();
+ foo (b, bp, 3., 5);
+ if (b[5] != 13. || bp[5] != 13.)
+ abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/vect/vect-pr120927.c b/gcc/testsuite/gcc.dg/vect/vect-pr120927.c
new file mode 100644
index 0000000..793593f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-pr120927.c
@@ -0,0 +1,24 @@
+/* { dg-additional-options "--param vect-partial-vector-usage=1" } */
+/* { dg-additional-options "-mavx512bw -mavx512vl" { target avx512f_runtime } } */
+
+#include "tree-vect.h"
+
+static const double a[] = { 1., 2., 3., 4., 5. };
+
+void __attribute__((noipa))
+foo (double *b, double *bp, double c, int n)
+{
+ for (int i = 0; i < n; ++i)
+ b[i] = bp[i] = a[i] * c;
+}
+
+int main()
+{
+ double b[6], bp[6];
+ b[5] = bp[5] = 13.;
+ check_vect ();
+ foo (b, bp, 3., 5);
+ if (b[5] != 13. || bp[5] != 13.)
+ abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/vect/vect-reduc-fma-1.c b/gcc/testsuite/gcc.dg/vect/vect-reduc-fma-1.c
new file mode 100644
index 0000000..e958b43
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-reduc-fma-1.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-mfma" { target { x86_64-*-* i?86-*-* } } } */
+
+double f(double x[], long n)
+{
+ double r0 = 0, r1 = 0;
+ for (; n; x += 2, n--) {
+ r0 = __builtin_fma(x[0], x[0], r0);
+ r1 = __builtin_fma(x[1], x[1], r1);
+ }
+ return r0 + r1;
+}
+
+/* We should vectorize this as SLP reduction. */
+/* { dg-final { scan-tree-dump "loop vectorized using 16 byte vectors and unroll factor 1" "vect" { target { x86_64-*-* i?86-*-* } } } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-reduc-fma-2.c b/gcc/testsuite/gcc.dg/vect/vect-reduc-fma-2.c
new file mode 100644
index 0000000..ea1ca97
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-reduc-fma-2.c
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-ffp-contract=on" } */
+/* { dg-additional-options "-mfma" { target { x86_64-*-* i?86-*-* } } } */
+
+static double muladd(double x, double y, double z)
+{
+ return x * y + z;
+}
+double g(double x[], long n)
+{
+ double r0 = 0, r1 = 0;
+ for (; n; x += 2, n--) {
+ r0 = muladd(x[0], x[0], r0);
+ r1 = muladd(x[1], x[1], r1);
+ }
+ return r0 + r1;
+}
+
+/* We should vectorize this as SLP reduction. */
+/* { dg-final { scan-tree-dump "loop vectorized using 16 byte vectors and unroll factor 1" "vect" { target { x86_64-*-* i?86-*-* } } } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-reduc-fma-3.c b/gcc/testsuite/gcc.dg/vect/vect-reduc-fma-3.c
new file mode 100644
index 0000000..10ceced
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-reduc-fma-3.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-ffast-math" } */
+/* { dg-additional-options "-mfma" { target { x86_64-*-* i?86-*-* } } } */
+
+double f(double x[], long n)
+{
+ double r0 = 0, r1 = 0;
+ for (; n; x += 2, n--) {
+ r0 = __builtin_fma(x[0], x[0], r0);
+ r1 = __builtin_fma(x[1], x[1], r1);
+ }
+ return r0 + r1;
+}
+
+/* We should vectorize this as SLP reduction, higher VF possible. */
+/* { dg-final { scan-tree-dump "optimized: loop vectorized" "vect" { target { x86_64-*-* i?86-*-* } } } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-simd-clone-16e.c b/gcc/testsuite/gcc.dg/vect/vect-simd-clone-16e.c
index f80b0e0..2f7cdfb 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-simd-clone-16e.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-simd-clone-16e.c
@@ -6,11 +6,9 @@
#include "vect-simd-clone-16.c"
/* Ensure the the in-branch simd clones are used on targets that support them.
- Some targets use another call for the epilogue loops.
- Some targets use pairs of vectors and do twice the calls. */
-/* { dg-final { scan-tree-dump-times {[\n\r] [^\n]* = foo\.simdclone} 2 "vect" { target { { ! avx_runtime } && { ! { { i?86-*-* x86_64-*-* } && { ! lp64 } } } } } } } */
-/* { dg-final { scan-tree-dump-times {[\n\r] [^\n]* = foo\.simdclone} 3 "vect" { target { avx_runtime && { ! { { i?86-*-* x86_64-*-* } && { ! lp64 } } } } } } } */
-/* { dg-final { scan-tree-dump-times {[\n\r] [^\n]* = foo\.simdclone} 4 "vect" { target { { ! avx_runtime } && { { i?86-*-* x86_64-*-* } && { ! lp64 } } } } } } */
+ Some targets use another call for the epilogue loops. */
+/* { dg-final { scan-tree-dump-times {[\n\r] [^\n]* = foo\.simdclone} 2 "vect" { target { ! avx_runtime } } } } */
+/* { dg-final { scan-tree-dump-times {[\n\r] [^\n]* = foo\.simdclone} 3 "vect" { target avx_runtime } } } */
/* The LTO test produces two dump files and we scan the wrong one. */
/* { dg-skip-if "" { *-*-* } { "-flto" } { "" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-simd-clone-17e.c b/gcc/testsuite/gcc.dg/vect/vect-simd-clone-17e.c
index c7c510b..8f10aff 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-simd-clone-17e.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-simd-clone-17e.c
@@ -6,11 +6,9 @@
#include "vect-simd-clone-17.c"
/* Ensure the the in-branch simd clones are used on targets that support them.
- Some targets use another call for the epilogue loops.
- Some targets use pairs of vectors and do twice the calls. */
-/* { dg-final { scan-tree-dump-times {[\n\r] [^\n]* = foo\.simdclone} 2 "vect" { target { { ! avx_runtime } && { ! { { i?86-*-* x86_64-*-* } && { ! lp64 } } } } } } } */
-/* { dg-final { scan-tree-dump-times {[\n\r] [^\n]* = foo\.simdclone} 3 "vect" { target { avx_runtime && { ! { { i?86-*-* x86_64-*-* } && { ! lp64 } } } } } } } */
-/* { dg-final { scan-tree-dump-times {[\n\r] [^\n]* = foo\.simdclone} 4 "vect" { target { { ! avx_runtime } && { { i?86-*-* x86_64-*-* } && { ! lp64 } } } } } } */
+ Some targets use another call for the epilogue loops. */
+/* { dg-final { scan-tree-dump-times {[\n\r] [^\n]* = foo\.simdclone} 2 "vect" { target { ! avx_runtime } } } } */
+/* { dg-final { scan-tree-dump-times {[\n\r] [^\n]* = foo\.simdclone} 3 "vect" { target avx_runtime } } } */
/* The LTO test produces two dump files and we scan the wrong one. */
/* { dg-skip-if "" { *-*-* } { "-flto" } { "" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-simd-clone-18e.c b/gcc/testsuite/gcc.dg/vect/vect-simd-clone-18e.c
index e00c3d78..142fcc8 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-simd-clone-18e.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-simd-clone-18e.c
@@ -6,11 +6,9 @@
#include "vect-simd-clone-18.c"
/* Ensure the the in-branch simd clones are used on targets that support them.
- Some targets use another call for the epilogue loops.
- Some targets use pairs of vectors and do twice the calls. */
-/* { dg-final { scan-tree-dump-times {[\n\r] [^\n]* = foo\.simdclone} 2 "vect" { target { { ! avx_runtime } && { ! { { i?86-*-* x86_64-*-* } && { ! lp64 } } } } } } } */
-/* { dg-final { scan-tree-dump-times {[\n\r] [^\n]* = foo\.simdclone} 3 "vect" { target { avx_runtime && { ! { { i?86-*-* x86_64-*-* } && { ! lp64 } } } } } } } */
-/* { dg-final { scan-tree-dump-times {[\n\r] [^\n]* = foo\.simdclone} 4 "vect" { target { { ! avx_runtime } && { { i?86-*-* x86_64-*-* } && { ! lp64 } } } } } } */
+ Some targets use another call for the epilogue loops. */
+/* { dg-final { scan-tree-dump-times {[\n\r] [^\n]* = foo\.simdclone} 2 "vect" { target { ! avx_runtime } } } } */
+/* { dg-final { scan-tree-dump-times {[\n\r] [^\n]* = foo\.simdclone} 3 "vect" { target avx_runtime } } } */
/* The LTO test produces two dump files and we scan the wrong one. */
/* { dg-skip-if "" { *-*-* } { "-flto" } { "" } } */