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/Walloca-14.c2
-rw-r--r--gcc/testsuite/gcc.dg/Wattributes-5.c13
-rw-r--r--gcc/testsuite/gcc.dg/Wsign-compare-1.c83
-rw-r--r--gcc/testsuite/gcc.dg/asan/pr81186.c18
-rw-r--r--gcc/testsuite/gcc.dg/asan/pr81460.c8
-rw-r--r--gcc/testsuite/gcc.dg/assign-warn-1.c60
-rw-r--r--gcc/testsuite/gcc.dg/assign-warn-2.c60
-rw-r--r--gcc/testsuite/gcc.dg/attr-noipa.c189
-rw-r--r--gcc/testsuite/gcc.dg/builtin-stringop-chk-1.c1
-rw-r--r--gcc/testsuite/gcc.dg/builtin-unreachable-6.c2
-rw-r--r--gcc/testsuite/gcc.dg/c90-const-expr-5.c4
-rw-r--r--gcc/testsuite/gcc.dg/c99-const-expr-5.c4
-rw-r--r--gcc/testsuite/gcc.dg/compare1.c8
-rw-r--r--gcc/testsuite/gcc.dg/compare2.c48
-rw-r--r--gcc/testsuite/gcc.dg/compare3.c88
-rw-r--r--gcc/testsuite/gcc.dg/compare4.c4
-rw-r--r--gcc/testsuite/gcc.dg/compare5.c4
-rw-r--r--gcc/testsuite/gcc.dg/compare7.c2
-rw-r--r--gcc/testsuite/gcc.dg/compare8.c6
-rw-r--r--gcc/testsuite/gcc.dg/compare9.c8
-rw-r--r--gcc/testsuite/gcc.dg/conv-2.c16
-rw-r--r--gcc/testsuite/gcc.dg/debug/dwarf2/stacked-qualified-types-3.c2
-rw-r--r--gcc/testsuite/gcc.dg/diagnostic-types-1.c57
-rw-r--r--gcc/testsuite/gcc.dg/guality/pr25967-1.c70
-rw-r--r--gcc/testsuite/gcc.dg/guality/pr25967-2.c64
-rw-r--r--gcc/testsuite/gcc.dg/guality/pr68037-1.c12
-rw-r--r--gcc/testsuite/gcc.dg/init-bad-7.c2
-rw-r--r--gcc/testsuite/gcc.dg/ipa/ipa-pta-18.c26
-rw-r--r--gcc/testsuite/gcc.dg/ipa/ipa-sra-11.c39
-rw-r--r--gcc/testsuite/gcc.dg/ipa/pr81520.c11
-rw-r--r--gcc/testsuite/gcc.dg/ipa/pr81696.c26
-rw-r--r--gcc/testsuite/gcc.dg/no-strict-overflow-7.c6
-rw-r--r--gcc/testsuite/gcc.dg/noncompile/pr81289.c8
-rw-r--r--gcc/testsuite/gcc.dg/overflow-warn-1.c6
-rw-r--r--gcc/testsuite/gcc.dg/overflow-warn-2.c6
-rw-r--r--gcc/testsuite/gcc.dg/overflow-warn-3.c6
-rw-r--r--gcc/testsuite/gcc.dg/overflow-warn-4.c6
-rw-r--r--gcc/testsuite/gcc.dg/parm-impl-decl-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/parm-impl-decl-3.c2
-rw-r--r--gcc/testsuite/gcc.dg/pie-7.c7
-rw-r--r--gcc/testsuite/gcc.dg/pie-static-1.c9
-rw-r--r--gcc/testsuite/gcc.dg/pie-static-2.c9
-rw-r--r--gcc/testsuite/gcc.dg/pointer-array-atomic.c16
-rw-r--r--gcc/testsuite/gcc.dg/pr11492.c2
-rw-r--r--gcc/testsuite/gcc.dg/pr26865.c2
-rw-r--r--gcc/testsuite/gcc.dg/pr35430.c2
-rw-r--r--gcc/testsuite/gcc.dg/pr44290-1.c3
-rw-r--r--gcc/testsuite/gcc.dg/pr44290-2.c3
-rw-r--r--gcc/testsuite/gcc.dg/pr46932.c16
-rw-r--r--gcc/testsuite/gcc.dg/pr56727-1.c23
-rw-r--r--gcc/testsuite/gcc.dg/pr56727-2.c17
-rw-r--r--gcc/testsuite/gcc.dg/pr57371-5.c10
-rw-r--r--gcc/testsuite/gcc.dg/pr60087.c2
-rw-r--r--gcc/testsuite/gcc.dg/pr61162-2.c8
-rw-r--r--gcc/testsuite/gcc.dg/pr61162.c6
-rw-r--r--gcc/testsuite/gcc.dg/pr67730-2.c8
-rw-r--r--gcc/testsuite/gcc.dg/pr69156.c2
-rw-r--r--gcc/testsuite/gcc.dg/pr70174.c2
-rw-r--r--gcc/testsuite/gcc.dg/pr70920-2.c4
-rw-r--r--gcc/testsuite/gcc.dg/pr70920-4.c4
-rw-r--r--gcc/testsuite/gcc.dg/pr78582.c1
-rw-r--r--gcc/testsuite/gcc.dg/pr79499.c13
-rw-r--r--gcc/testsuite/gcc.dg/pr81455.c15
-rw-r--r--gcc/testsuite/gcc.dg/pr81564.c21
-rw-r--r--gcc/testsuite/gcc.dg/pr81578.c12
-rw-r--r--gcc/testsuite/gcc.dg/pr81588.c26
-rw-r--r--gcc/testsuite/gcc.dg/pr81621.c5
-rw-r--r--gcc/testsuite/gcc.dg/pr81650.c9
-rw-r--r--gcc/testsuite/gcc.dg/pr81695.c11
-rw-r--r--gcc/testsuite/gcc.dg/pr81737.c6
-rw-r--r--gcc/testsuite/gcc.dg/pr81795.c14
-rw-r--r--gcc/testsuite/gcc.dg/predict-15.c17
-rw-r--r--gcc/testsuite/gcc.dg/string-opt-1.c51
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr25967-1.c63
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr25967-2.c58
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr70992-2.c9
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr70992.c41
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr78218.c11
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr80163.c1
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr81181.c30
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr81297.c16
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr81500.c13
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr81510-2.c19
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr81510.c29
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr81571.c13
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr81573.c16
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/assoc-2.c19
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/attr-hotcold-2.c13
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr81388-1.c6
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr81588.c15
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr81620-1.c20
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr81620-2.c25
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr81627.c28
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr81744.c13
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/predcom-dse-1.c62
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/predcom-dse-10.c44
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/predcom-dse-11.c51
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/predcom-dse-2.c62
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/predcom-dse-3.c108
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/predcom-dse-4.c61
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/predcom-dse-5.c63
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/predcom-dse-6.c65
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/predcom-dse-7.c63
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/predcom-dse-8.c60
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/predcom-dse-9.c90
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/reassoc-23.c7
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/slsr-4.c8
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/split-path-5.c18
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-dce-3.c9
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/vrp24.c10
-rw-r--r--gcc/testsuite/gcc.dg/ubsan/pr81505.c17
-rw-r--r--gcc/testsuite/gcc.dg/unclosed-init.c3
-rw-r--r--gcc/testsuite/gcc.dg/uninit-23.c4
-rw-r--r--gcc/testsuite/gcc.dg/vect/no-section-anchors-vect-69.c4
-rw-r--r--gcc/testsuite/gcc.dg/vect/pr80815-3.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/pr81136.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/pr81410.c7
-rw-r--r--gcc/testsuite/gcc.dg/vect/pr81633.c33
-rw-r--r--gcc/testsuite/gcc.dg/vect/section-anchors-vect-69.c3
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-28.c3
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-33-big-array.c3
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-70.c3
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-87.c3
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-88.c3
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-91.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-93.c4
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-alias-check-3.c120
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-alias-check-4.c35
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-alias-check-5.c19
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-alias-check-6.c16
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-alias-check-7.c16
131 files changed, 2579 insertions, 297 deletions
diff --git a/gcc/testsuite/gcc.dg/Walloca-14.c b/gcc/testsuite/gcc.dg/Walloca-14.c
index f3e3f579439..ea48227f7e8 100644
--- a/gcc/testsuite/gcc.dg/Walloca-14.c
+++ b/gcc/testsuite/gcc.dg/Walloca-14.c
@@ -9,6 +9,6 @@ g (int *p)
extern void f (void *);
void *q = __builtin_alloca (p); /* { dg-warning "passing argument 1" } */
- /* { dg-warning "unbounded use of 'alloca'" "unbounded" { target *-*-* } 11 } */
+ /* { dg-warning "unbounded use of 'alloca'" "unbounded" { target *-*-* } .-1 } */
f (q);
}
diff --git a/gcc/testsuite/gcc.dg/Wattributes-5.c b/gcc/testsuite/gcc.dg/Wattributes-5.c
new file mode 100644
index 00000000000..34483391e6d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Wattributes-5.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-options -Wattributes } */
+
+void __attribute__((_foobar)) foo() { } /* { dg-warning "attribute directive ignored" } */
+void __attribute__((_xformat__)) foo2() { } /* { dg-warning "attribute directive ignored" } */
+void __attribute__((xformat__)) foo3() { } /* { dg-warning "attribute directive ignored" } */
+void __attribute__((__xformat)) foo4() { } /* { dg-warning "attribute directive ignored" } */
+void __attribute__((_)) foo5() { } /* { dg-warning "attribute directive ignored" } */
+void __attribute__((_)) foo6() { } /* { dg-warning "attribute directive ignored" } */
+void __attribute__((__)) foo7() { } /* { dg-warning "attribute directive ignored" } */
+void __attribute__((___)) foo8() { } /* { dg-warning "attribute directive ignored" } */
+void __attribute__((____)) foo9() { } /* { dg-warning "attribute directive ignored" } */
+void __attribute__((_____)) foo10() { } /* { dg-warning "attribute directive ignored" } */
diff --git a/gcc/testsuite/gcc.dg/Wsign-compare-1.c b/gcc/testsuite/gcc.dg/Wsign-compare-1.c
new file mode 100644
index 00000000000..be3bd2fcbd8
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Wsign-compare-1.c
@@ -0,0 +1,83 @@
+/* PR c/81417 */
+/* { dg-do compile } */
+/* { dg-options "-Wsign-compare -fdiagnostics-show-caret" } */
+
+unsigned int
+f0 (int x, unsigned int y)
+{
+ return x ? y : -1; /* { dg-warning "18:operand of \\?: changes signedness from 'int' to 'unsigned int'" } */
+/* { dg-begin-multiline-output "" }
+ return x ? y : -1;
+ ^~
+ { dg-end-multiline-output "" } */
+}
+
+unsigned int
+f1 (int xxx, unsigned int yyy)
+{
+ return xxx ? yyy : -1; /* { dg-warning "22:operand of \\?: changes signedness from 'int' to 'unsigned int'" } */
+/* { dg-begin-multiline-output "" }
+ return xxx ? yyy : -1;
+ ^~
+ { dg-end-multiline-output "" } */
+}
+
+unsigned int
+f2 (int xxx, unsigned int yyy)
+{
+ return xxx ? -1 : yyy; /* { dg-warning "16:operand of \\?: changes signedness from 'int' to 'unsigned int'" } */
+/* { dg-begin-multiline-output "" }
+ return xxx ? -1 : yyy;
+ ^~
+ { dg-end-multiline-output "" } */
+}
+
+unsigned int
+f3 (unsigned int yyy)
+{
+ return yyy ?: -1; /* { dg-warning "17:operand of \\?: changes signedness from 'int' to 'unsigned int'" } */
+/* { dg-begin-multiline-output "" }
+ return yyy ?: -1;
+ ^~
+ { dg-end-multiline-output "" } */
+}
+
+unsigned int
+f4 (int xxx, unsigned yyy, short uuu)
+{
+ return xxx ? yyy : uuu; /* { dg-warning "22:operand of \\?: changes signedness from 'short int' to 'unsigned int'" } */
+/* { dg-begin-multiline-output "" }
+ return xxx ? yyy : uuu;
+ ^~~
+ { dg-end-multiline-output "" } */
+}
+
+unsigned int
+f5 (int xxx, unsigned yyy, short uuu)
+{
+ return xxx ? uuu : yyy; /* { dg-warning "16:operand of \\?: changes signedness from 'short int' to 'unsigned int'" } */
+/* { dg-begin-multiline-output "" }
+ return xxx ? uuu : yyy;
+ ^~~
+ { dg-end-multiline-output "" } */
+}
+
+unsigned int
+f6 (int xxx, unsigned yyy, signed char uuu)
+{
+ return xxx ? yyy : uuu; /* { dg-warning "22:operand of \\?: changes signedness from 'signed char' to 'unsigned int'" } */
+/* { dg-begin-multiline-output "" }
+ return xxx ? yyy : uuu;
+ ^~~
+ { dg-end-multiline-output "" } */
+}
+
+unsigned int
+f7 (int xxx, unsigned yyy, signed char uuu)
+{
+ return xxx ? uuu : yyy; /* { dg-warning "16:operand of \\?: changes signedness from 'signed char' to 'unsigned int'" } */
+/* { dg-begin-multiline-output "" }
+ return xxx ? uuu : yyy;
+ ^~~
+ { dg-end-multiline-output "" } */
+}
diff --git a/gcc/testsuite/gcc.dg/asan/pr81186.c b/gcc/testsuite/gcc.dg/asan/pr81186.c
new file mode 100644
index 00000000000..7f0f672ca40
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/asan/pr81186.c
@@ -0,0 +1,18 @@
+/* PR sanitizer/81186 */
+/* { dg-do run } */
+
+int
+main ()
+{
+ __label__ l;
+ void f ()
+ {
+ int a[123];
+
+ goto l;
+ }
+
+ f ();
+l:
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/asan/pr81460.c b/gcc/testsuite/gcc.dg/asan/pr81460.c
new file mode 100644
index 00000000000..00c1bb7c9f2
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/asan/pr81460.c
@@ -0,0 +1,8 @@
+/* PR sanitizer/80460 */
+/* { dg-do compile } */
+
+int
+f (int a, struct { int b[a]; } c) /* { dg-warning "anonymous struct declared inside parameter list will not be visible outside of this definition or declaration" } */
+{
+ return c.b[0];
+}
diff --git a/gcc/testsuite/gcc.dg/assign-warn-1.c b/gcc/testsuite/gcc.dg/assign-warn-1.c
index f26a5447ea0..365025724c4 100644
--- a/gcc/testsuite/gcc.dg/assign-warn-1.c
+++ b/gcc/testsuite/gcc.dg/assign-warn-1.c
@@ -50,63 +50,63 @@ TESTRET(dfe, void *, fp); /* { dg-warning "ISO C forbids return between function
TESTARG(sua, int *, unsigned int *); /* { dg-warning "pointer targets in passing argument 1 of 'suaF' differ in signedness" } */
TESTARP(sub, int *, unsigned int *); /* { dg-warning "pointer targets in passing argument 1 of 'subFp.x' differ in signedness" } */
-TESTASS(suc, int *, unsigned int *); /* { dg-warning "pointer targets in assignment differ in signedness" } */
-TESTINI(sud, int *, unsigned int *); /* { dg-warning "pointer targets in initialization differ in signedness" } */
-TESTRET(sue, int *, unsigned int *); /* { dg-warning "pointer targets in return differ in signedness" } */
+TESTASS(suc, int *, unsigned int *); /* { dg-warning "pointer targets in assignment from 'unsigned int \\*' to 'int \\*' differ in signedness" } */
+TESTINI(sud, int *, unsigned int *); /* { dg-warning "pointer targets in initialization of 'int \\*' from 'unsigned int \\*' differ in signedness" } */
+TESTRET(sue, int *, unsigned int *); /* { dg-warning "pointer targets in returning 'unsigned int \\*' from a function with return type 'int \\*' differ in signedness" } */
TESTARG(usa, unsigned int *, int *); /* { dg-warning "pointer targets in passing argument 1 of 'usaF' differ in signedness" } */
TESTARP(usb, unsigned int *, int *); /* { dg-warning "pointer targets in passing argument 1 of 'usbFp.x' differ in signedness" } */
-TESTASS(usc, unsigned int *, int *); /* { dg-warning "pointer targets in assignment differ in signedness" } */
-TESTINI(usd, unsigned int *, int *); /* { dg-warning "pointer targets in initialization differ in signedness" } */
-TESTRET(use, unsigned int *, int *); /* { dg-warning "pointer targets in return differ in signedness" } */
+TESTASS(usc, unsigned int *, int *); /* { dg-warning "pointer targets in assignment from 'int \\*' to 'unsigned int \\*' differ in signedness" } */
+TESTINI(usd, unsigned int *, int *); /* { dg-warning "pointer targets in initialization of 'unsigned int \\*' from 'int \\*' differ in signedness" } */
+TESTRET(use, unsigned int *, int *); /* { dg-warning "pointer targets in returning 'int \\*' from a function with return type 'unsigned int \\*' differ in signedness" } */
TESTARG(cua, char *, unsigned char *); /* { dg-warning "pointer targets in passing argument 1 of 'cuaF' differ in signedness" } */
TESTARP(cub, char *, unsigned char *); /* { dg-warning "pointer targets in passing argument 1 of 'cubFp.x' differ in signedness" } */
-TESTASS(cuc, char *, unsigned char *); /* { dg-warning "pointer targets in assignment differ in signedness" } */
-TESTINI(cud, char *, unsigned char *); /* { dg-warning "pointer targets in initialization differ in signedness" } */
-TESTRET(cue, char *, unsigned char *); /* { dg-warning "pointer targets in return differ in signedness" } */
+TESTASS(cuc, char *, unsigned char *); /* { dg-warning "pointer targets in assignment from 'unsigned char \\*' to 'char \\*' differ in signedness" } */
+TESTINI(cud, char *, unsigned char *); /* { dg-warning "pointer targets in initialization of 'char \\*' from 'unsigned char \\*' differ in signedness" } */
+TESTRET(cue, char *, unsigned char *); /* { dg-warning "pointer targets in returning 'unsigned char \\*' from a function with return type 'char \\*' differ in signedness" } */
TESTARG(uca, unsigned char *, char *); /* { dg-warning "pointer targets in passing argument 1 of 'ucaF' differ in signedness" } */
TESTARP(ucb, unsigned char *, char *); /* { dg-warning "pointer targets in passing argument 1 of 'ucbFp.x' differ in signedness" } */
-TESTASS(ucc, unsigned char *, char *); /* { dg-warning "pointer targets in assignment differ in signedness" } */
-TESTINI(ucd, unsigned char *, char *); /* { dg-warning "pointer targets in initialization differ in signedness" } */
-TESTRET(uce, unsigned char *, char *); /* { dg-warning "pointer targets in return differ in signedness" } */
+TESTASS(ucc, unsigned char *, char *); /* { dg-warning "pointer targets in assignment from 'char \\*' to 'unsigned char \\*' differ in signedness" } */
+TESTINI(ucd, unsigned char *, char *); /* { dg-warning "pointer targets in initialization of 'unsigned char \\*' from 'char \\*' differ in signedness" } */
+TESTRET(uce, unsigned char *, char *); /* { dg-warning "pointer targets in returning 'char \\*' from a function with return type 'unsigned char \\*' differ in signedness" } */
TESTARG(csa, char *, signed char *); /* { dg-warning "pointer targets in passing argument 1 of 'csaF' differ in signedness" } */
TESTARP(csb, char *, signed char *); /* { dg-warning "pointer targets in passing argument 1 of 'csbFp.x' differ in signedness" } */
-TESTASS(csc, char *, signed char *); /* { dg-warning "pointer targets in assignment differ in signedness" } */
-TESTINI(csd, char *, signed char *); /* { dg-warning "pointer targets in initialization differ in signedness" } */
-TESTRET(cse, char *, signed char *); /* { dg-warning "pointer targets in return differ in signedness" } */
+TESTASS(csc, char *, signed char *); /* { dg-warning "pointer targets in assignment from 'signed char \\*' to 'char \\*' differ in signedness" } */
+TESTINI(csd, char *, signed char *); /* { dg-warning "pointer targets in initialization of 'char \\*' from 'signed char \\*' differ in signedness" } */
+TESTRET(cse, char *, signed char *); /* { dg-warning "pointer targets in returning 'signed char \\*' from a function with return type 'char \\*' differ in signedness" } */
TESTARG(sca, signed char *, char *); /* { dg-warning "pointer targets in passing argument 1 of 'scaF' differ in signedness" } */
TESTARP(scb, signed char *, char *); /* { dg-warning "pointer targets in passing argument 1 of 'scbFp.x' differ in signedness" } */
-TESTASS(scc, signed char *, char *); /* { dg-warning "pointer targets in assignment differ in signedness" } */
-TESTINI(scd, signed char *, char *); /* { dg-warning "pointer targets in initialization differ in signedness" } */
-TESTRET(sce, signed char *, char *); /* { dg-warning "pointer targets in return differ in signedness" } */
+TESTASS(scc, signed char *, char *); /* { dg-warning "pointer targets in assignment from 'char \\*' to 'signed char \\*' differ in signedness" } */
+TESTINI(scd, signed char *, char *); /* { dg-warning "pointer targets in initialization of 'signed char \\*' from 'char \\*' differ in signedness" } */
+TESTRET(sce, signed char *, char *); /* { dg-warning "pointer targets in returning 'char \\*' from a function with return type 'signed char \\*' differ in signedness" } */
TESTARG(cia, char *, int *); /* { dg-warning "passing argument 1 of 'ciaF' from incompatible pointer type" } */
TESTARP(cib, char *, int *); /* { dg-warning "passing argument 1 of 'cibFp.x' from incompatible pointer type" } */
-TESTASS(cic, char *, int *); /* { dg-warning "assignment from incompatible pointer type" } */
-TESTINI(cid, char *, int *); /* { dg-warning "initialization from incompatible pointer type" } */
-TESTRET(cie, char *, int *); /* { dg-warning "return from incompatible pointer type" } */
+TESTASS(cic, char *, int *); /* { dg-warning "assignment to 'char \\*' from incompatible pointer type 'int \\*'" } */
+TESTINI(cid, char *, int *); /* { dg-warning "initialization of 'char \\*' from incompatible pointer type 'int \\*'" } */
+TESTRET(cie, char *, int *); /* { dg-warning "returning 'int \\*' from a function with incompatible return type 'char \\*'" } */
TESTARG(ica, int *, char *); /* { dg-warning "passing argument 1 of 'icaF' from incompatible pointer type" } */
TESTARP(icb, int *, char *); /* { dg-warning "passing argument 1 of 'icbFp.x' from incompatible pointer type" } */
-TESTASS(icc, int *, char *); /* { dg-warning "assignment from incompatible pointer type" } */
-TESTINI(icd, int *, char *); /* { dg-warning "initialization from incompatible pointer type" } */
-TESTRET(ice, int *, char *); /* { dg-warning "return from incompatible pointer type" } */
+TESTASS(icc, int *, char *); /* { dg-warning "assignment to 'int \\*' from incompatible pointer type 'char \\*'" } */
+TESTINI(icd, int *, char *); /* { dg-warning "initialization of 'int \\*' from incompatible pointer type 'char \\*'" } */
+TESTRET(ice, int *, char *); /* { dg-warning "returning 'char \\*' from a function with incompatible return type 'int \\*'" } */
TESTARG(ciia, char *, int); /* { dg-warning "passing argument 1 of 'ciiaF' makes pointer from integer without a cast" } */
TESTARP(ciib, char *, int); /* { dg-warning "passing argument 1 of 'ciibFp.x' makes pointer from integer without a cast" } */
-TESTASS(ciic, char *, int); /* { dg-warning "assignment makes pointer from integer without a cast" } */
-TESTINI(ciid, char *, int); /* { dg-warning "initialization makes pointer from integer without a cast" } */
-TESTRET(ciie, char *, int); /* { dg-warning "return makes pointer from integer without a cast" } */
+TESTASS(ciic, char *, int); /* { dg-warning "assignment to 'char \\*' from 'int' makes pointer from integer without a cast" } */
+TESTINI(ciid, char *, int); /* { dg-warning "initialization of 'char \\*' from 'int' makes pointer from integer without a cast" } */
+TESTRET(ciie, char *, int); /* { dg-warning "returning 'int' from a function with return type 'char \\*' makes pointer from integer without a cast" } */
TESTARG(iica, int, char *); /* { dg-warning "passing argument 1 of 'iicaF' makes integer from pointer without a cast" } */
TESTARP(iicb, int, char *); /* { dg-warning "passing argument 1 of 'iicbFp.x' makes integer from pointer without a cast" } */
-TESTASS(iicc, int, char *); /* { dg-warning "assignment makes integer from pointer without a cast" } */
-TESTINI(iicd, int, char *); /* { dg-warning "initialization makes integer from pointer without a cast" } */
-TESTRET(iice, int, char *); /* { dg-warning "return makes integer from pointer without a cast" } */
+TESTASS(iicc, int, char *); /* { dg-warning "assignment to 'int' from 'char \\*' makes integer from pointer without a cast" } */
+TESTINI(iicd, int, char *); /* { dg-warning "initialization of 'int' from 'char \\*' makes integer from pointer without a cast" } */
+TESTRET(iice, int, char *); /* { dg-warning "returning 'char \\*' from a function with return type 'int' makes integer from pointer without a cast" } */
struct s { int a; };
diff --git a/gcc/testsuite/gcc.dg/assign-warn-2.c b/gcc/testsuite/gcc.dg/assign-warn-2.c
index 1e5eb1ca6e5..0c8a8ee7833 100644
--- a/gcc/testsuite/gcc.dg/assign-warn-2.c
+++ b/gcc/testsuite/gcc.dg/assign-warn-2.c
@@ -51,63 +51,63 @@ TESTRET(dfe, void *, fp); /* { dg-error "ISO C forbids return between function p
TESTARG(sua, int *, unsigned int *); /* { dg-error "pointer targets in passing argument 1 of 'suaF' differ in signedness" } */
TESTARP(sub, int *, unsigned int *); /* { dg-error "pointer targets in passing argument 1 of 'subFp.x' differ in signedness" } */
-TESTASS(suc, int *, unsigned int *); /* { dg-error "pointer targets in assignment differ in signedness" } */
-TESTINI(sud, int *, unsigned int *); /* { dg-error "pointer targets in initialization differ in signedness" } */
-TESTRET(sue, int *, unsigned int *); /* { dg-error "pointer targets in return differ in signedness" } */
+TESTASS(suc, int *, unsigned int *); /* { dg-error "pointer targets in assignment from 'unsigned int \\*' to 'int \\*' differ in signedness" } */
+TESTINI(sud, int *, unsigned int *); /* { dg-error "pointer targets in initialization of 'int \\*' from 'unsigned int \\*' differ in signedness" } */
+TESTRET(sue, int *, unsigned int *); /* { dg-error "pointer targets in returning 'unsigned int \\*' from a function with return type 'int \\*' differ in signedness" } */
TESTARG(usa, unsigned int *, int *); /* { dg-error "pointer targets in passing argument 1 of 'usaF' differ in signedness" } */
TESTARP(usb, unsigned int *, int *); /* { dg-error "pointer targets in passing argument 1 of 'usbFp.x' differ in signedness" } */
-TESTASS(usc, unsigned int *, int *); /* { dg-error "pointer targets in assignment differ in signedness" } */
-TESTINI(usd, unsigned int *, int *); /* { dg-error "pointer targets in initialization differ in signedness" } */
-TESTRET(use, unsigned int *, int *); /* { dg-error "pointer targets in return differ in signedness" } */
+TESTASS(usc, unsigned int *, int *); /* { dg-error "pointer targets in assignment from 'int \\*' to 'unsigned int \\*' differ in signedness" } */
+TESTINI(usd, unsigned int *, int *); /* { dg-error "pointer targets in initialization of 'unsigned int \\*' from 'int \\*' differ in signedness" } */
+TESTRET(use, unsigned int *, int *); /* { dg-error "pointer targets in returning 'int \\*' from a function with return type 'unsigned int \\*' differ in signedness" } */
TESTARG(cua, char *, unsigned char *); /* { dg-error "pointer targets in passing argument 1 of 'cuaF' differ in signedness" } */
TESTARP(cub, char *, unsigned char *); /* { dg-error "pointer targets in passing argument 1 of 'cubFp.x' differ in signedness" } */
-TESTASS(cuc, char *, unsigned char *); /* { dg-error "pointer targets in assignment differ in signedness" } */
-TESTINI(cud, char *, unsigned char *); /* { dg-error "pointer targets in initialization differ in signedness" } */
-TESTRET(cue, char *, unsigned char *); /* { dg-error "pointer targets in return differ in signedness" } */
+TESTASS(cuc, char *, unsigned char *); /* { dg-error "pointer targets in assignment from 'unsigned char \\*' to 'char \\*' differ in signedness" } */
+TESTINI(cud, char *, unsigned char *); /* { dg-error "pointer targets in initialization of 'char \\*' from 'unsigned char \\*' differ in signedness" } */
+TESTRET(cue, char *, unsigned char *); /* { dg-error "pointer targets in returning 'unsigned char \\*' from a function with return type 'char \\*' differ in signedness" } */
TESTARG(uca, unsigned char *, char *); /* { dg-error "pointer targets in passing argument 1 of 'ucaF' differ in signedness" } */
TESTARP(ucb, unsigned char *, char *); /* { dg-error "pointer targets in passing argument 1 of 'ucbFp.x' differ in signedness" } */
-TESTASS(ucc, unsigned char *, char *); /* { dg-error "pointer targets in assignment differ in signedness" } */
-TESTINI(ucd, unsigned char *, char *); /* { dg-error "pointer targets in initialization differ in signedness" } */
-TESTRET(uce, unsigned char *, char *); /* { dg-error "pointer targets in return differ in signedness" } */
+TESTASS(ucc, unsigned char *, char *); /* { dg-error "pointer targets in assignment from 'char \\*' to 'unsigned char \\*' differ in signedness" } */
+TESTINI(ucd, unsigned char *, char *); /* { dg-error "pointer targets in initialization of 'unsigned char \\*' from 'char \\*' differ in signedness" } */
+TESTRET(uce, unsigned char *, char *); /* { dg-error "pointer targets in returning 'char \\*' from a function with return type 'unsigned char \\*' differ in signedness" } */
TESTARG(csa, char *, signed char *); /* { dg-error "pointer targets in passing argument 1 of 'csaF' differ in signedness" } */
TESTARP(csb, char *, signed char *); /* { dg-error "pointer targets in passing argument 1 of 'csbFp.x' differ in signedness" } */
-TESTASS(csc, char *, signed char *); /* { dg-error "pointer targets in assignment differ in signedness" } */
-TESTINI(csd, char *, signed char *); /* { dg-error "pointer targets in initialization differ in signedness" } */
-TESTRET(cse, char *, signed char *); /* { dg-error "pointer targets in return differ in signedness" } */
+TESTASS(csc, char *, signed char *); /* { dg-error "pointer targets in assignment from 'signed char \\*' to 'char \\*' differ in signedness" } */
+TESTINI(csd, char *, signed char *); /* { dg-error "pointer targets in initialization of 'char \\*' from 'signed char \\*' differ in signedness" } */
+TESTRET(cse, char *, signed char *); /* { dg-error "pointer targets in returning 'signed char \\*' from a function with return type 'char \\*' differ in signedness" } */
TESTARG(sca, signed char *, char *); /* { dg-error "pointer targets in passing argument 1 of 'scaF' differ in signedness" } */
TESTARP(scb, signed char *, char *); /* { dg-error "pointer targets in passing argument 1 of 'scbFp.x' differ in signedness" } */
-TESTASS(scc, signed char *, char *); /* { dg-error "pointer targets in assignment differ in signedness" } */
-TESTINI(scd, signed char *, char *); /* { dg-error "pointer targets in initialization differ in signedness" } */
-TESTRET(sce, signed char *, char *); /* { dg-error "pointer targets in return differ in signedness" } */
+TESTASS(scc, signed char *, char *); /* { dg-error "pointer targets in assignment from 'char \\*' to 'signed char \\*' differ in signedness" } */
+TESTINI(scd, signed char *, char *); /* { dg-error "pointer targets in initialization of 'signed char \\*' from 'char \\*' differ in signedness" } */
+TESTRET(sce, signed char *, char *); /* { dg-error "pointer targets in returning 'char \\*' from a function with return type 'signed char \\*' differ in signedness" } */
TESTARG(cia, char *, int *); /* { dg-error "passing argument 1 of 'ciaF' from incompatible pointer type" } */
TESTARP(cib, char *, int *); /* { dg-error "passing argument 1 of 'cibFp.x' from incompatible pointer type" } */
-TESTASS(cic, char *, int *); /* { dg-error "assignment from incompatible pointer type" } */
-TESTINI(cid, char *, int *); /* { dg-error "initialization from incompatible pointer type" } */
-TESTRET(cie, char *, int *); /* { dg-error "return from incompatible pointer type" } */
+TESTASS(cic, char *, int *); /* { dg-error "assignment to 'char \\*' from incompatible pointer type 'int \\*'" } */
+TESTINI(cid, char *, int *); /* { dg-error "initialization of 'char \\*' from incompatible pointer type 'int \\*'" } */
+TESTRET(cie, char *, int *); /* { dg-error "returning 'int \\*' from a function with incompatible return type 'char \\*'" } */
TESTARG(ica, int *, char *); /* { dg-error "passing argument 1 of 'icaF' from incompatible pointer type" } */
TESTARP(icb, int *, char *); /* { dg-error "passing argument 1 of 'icbFp.x' from incompatible pointer type" } */
-TESTASS(icc, int *, char *); /* { dg-error "assignment from incompatible pointer type" } */
-TESTINI(icd, int *, char *); /* { dg-error "initialization from incompatible pointer type" } */
-TESTRET(ice, int *, char *); /* { dg-error "return from incompatible pointer type" } */
+TESTASS(icc, int *, char *); /* { dg-error "assignment to 'int \\*' from incompatible pointer type 'char \\*'" } */
+TESTINI(icd, int *, char *); /* { dg-error "initialization of 'int \\*' from incompatible pointer type 'char \\*'" } */
+TESTRET(ice, int *, char *); /* { dg-error "returning 'char \\*' from a function with incompatible return type 'int \\*'" } */
TESTARG(ciia, char *, int); /* { dg-error "passing argument 1 of 'ciiaF' makes pointer from integer without a cast" } */
TESTARP(ciib, char *, int); /* { dg-error "passing argument 1 of 'ciibFp.x' makes pointer from integer without a cast" } */
-TESTASS(ciic, char *, int); /* { dg-error "assignment makes pointer from integer without a cast" } */
-TESTINI(ciid, char *, int); /* { dg-error "initialization makes pointer from integer without a cast" } */
-TESTRET(ciie, char *, int); /* { dg-error "return makes pointer from integer without a cast" } */
+TESTASS(ciic, char *, int); /* { dg-error "assignment to 'char \\*' from 'int' makes pointer from integer without a cast" } */
+TESTINI(ciid, char *, int); /* { dg-error "initialization of 'char \\*' from 'int' makes pointer from integer without a cast" } */
+TESTRET(ciie, char *, int); /* { dg-error "returning 'int' from a function with return type 'char \\*' makes pointer from integer without a cast" } */
TESTARG(iica, int, char *); /* { dg-error "passing argument 1 of 'iicaF' makes integer from pointer without a cast" } */
TESTARP(iicb, int, char *); /* { dg-error "passing argument 1 of 'iicbFp.x' makes integer from pointer without a cast" } */
-TESTASS(iicc, int, char *); /* { dg-error "assignment makes integer from pointer without a cast" } */
-TESTINI(iicd, int, char *); /* { dg-error "initialization makes integer from pointer without a cast" } */
-TESTRET(iice, int, char *); /* { dg-error "return makes integer from pointer without a cast" } */
+TESTASS(iicc, int, char *); /* { dg-error "assignment to 'int' from 'char \\*' makes integer from pointer without a cast" } */
+TESTINI(iicd, int, char *); /* { dg-error "initialization of 'int' from 'char \\*' makes integer from pointer without a cast" } */
+TESTRET(iice, int, char *); /* { dg-error "returning 'char \\*' from a function with return type 'int' makes integer from pointer without a cast" } */
struct s { int a; };
diff --git a/gcc/testsuite/gcc.dg/attr-noipa.c b/gcc/testsuite/gcc.dg/attr-noipa.c
new file mode 100644
index 00000000000..e2349b6a418
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/attr-noipa.c
@@ -0,0 +1,189 @@
+/* Test the noipa attribute. */
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+/* { dg-require-effective-target alloca } */
+
+static inline int __attribute__((noipa))
+fn1 (void) /* { dg-warning "inline function \[^\n\]* given attribute noinline" "" } */
+{
+ return 1;
+}
+
+/* Verify the function is not inlined into its caller. */
+
+static __attribute__((noipa)) int
+fn2 (int x, int y)
+{
+ return x + y;
+}
+
+int
+fn3 (int x)
+{
+ return fn2 (x, 0);
+}
+
+/* { dg-final { scan-tree-dump "= fn2 \\(" "optimized" } } */
+
+void fn4 (char *);
+
+/* Verify the function is not cloned. */
+
+__attribute__((__noipa__)) static int
+fn5 (int x, int y)
+{
+ char *p = __builtin_alloca (x + y);
+ fn4 (p);
+ return x + y;
+}
+
+int
+fn6 (int x)
+{
+ return fn5 (x, 2);
+}
+
+/* { dg-final { scan-tree-dump "= fn5 \\(" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "fn5\\.constprop" "optimized" } } */
+
+/* Verify we still remove unused function calls, even if they have
+ noipa attribute. */
+
+static void fn7 (void) __attribute__((noipa));
+static void
+fn7 (void)
+{
+}
+
+/* { dg-final { scan-tree-dump-not "fn7 \\(" "optimized" } } */
+
+/* Verify noipa functions are not ICF optimized. */
+
+static __attribute__((noipa)) int
+fn8 (int x)
+{
+ return x + 12;
+}
+
+static __attribute__((noipa)) int
+fn9 (int x)
+{
+ return x + 12;
+}
+
+int
+fn10 (int x)
+{
+ return fn8 (x) + fn9 (x);
+}
+
+/* { dg-final { scan-tree-dump "fn8 \\(int" "optimized" } } */
+/* { dg-final { scan-tree-dump "fn9 \\(int" "optimized" } } */
+
+/* Verify IPA-VRP is not performed. */
+
+void fn11 (void);
+
+static int __attribute__((noipa))
+fn12 (int x)
+{
+ if (x < 6 || x >= 29)
+ fn11 ();
+}
+
+void
+fn13 (int x)
+{
+ fn12 (6 + (x & 15));
+}
+
+/* { dg-final { scan-tree-dump "fn11 \\(\\)" "optimized" } } */
+
+void fn14 (void);
+
+__attribute__((noipa)) static int
+fn15 (int x)
+{
+ return x & 7;
+}
+
+int
+fn16 (int x)
+{
+ x = fn15 (x);
+ if (x < 0 || x >= 7)
+ fn14 ();
+}
+
+/* { dg-final { scan-tree-dump "fn14 \\(\\)" "optimized" } } */
+
+/* Verify IPA BIT CP is not performed. */
+
+void fn17 (void);
+
+__attribute__((noipa)) static int
+fn18 (int x)
+{
+ if (x & 8)
+ fn17 ();
+}
+
+void
+fn19 (void)
+{
+ fn18 (1);
+ fn18 (2);
+ fn18 (4);
+ fn18 (16);
+ fn18 (32);
+ fn18 (64);
+}
+
+/* { dg-final { scan-tree-dump "fn17 \\(\\)" "optimized" } } */
+
+/* Ensure pure/const discovery is not performed. */
+
+int var1;
+void fn20 (void);
+
+__attribute__((noipa)) static int
+fn21 (int x, int y)
+{
+ return x * y;
+}
+
+int
+fn22 (void)
+{
+ var1 = 7;
+ asm volatile ("" : "+g" (var1) : : "memory");
+ int a = var1;
+ int b = fn21 (a, a);
+ if (a != var1)
+ fn20 ();
+ return b;
+}
+
+/* { dg-final { scan-tree-dump "fn20 \\(\\)" "optimized" } } */
+
+/* Verify IPA alignment propagation is not performed. */
+
+static __attribute__ ((aligned(16))) char var2[32];
+void fn23 (void);
+
+__attribute__((noipa)) static void
+fn24 (char *p)
+{
+ if ((((__UINTPTR_TYPE__) p) & 15) != 0)
+ fn23 ();
+ asm ("");
+}
+
+void
+fn25 (void)
+{
+ fn24 (var2);
+ fn24 (var2 + 16);
+}
+
+/* { dg-final { scan-tree-dump "fn20 \\(\\)" "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/builtin-stringop-chk-1.c b/gcc/testsuite/gcc.dg/builtin-stringop-chk-1.c
index e2655785444..35cc6dc93bb 100644
--- a/gcc/testsuite/gcc.dg/builtin-stringop-chk-1.c
+++ b/gcc/testsuite/gcc.dg/builtin-stringop-chk-1.c
@@ -2,7 +2,6 @@
are emitted properly. */
/* { dg-do compile } */
/* { dg-options "-O2 -Wno-format -std=gnu99 -ftrack-macro-expansion=0" } */
-/* { dg-additional-options "-mstructure-size-boundary=8" { target arm*-*-* } } */
// { dg-skip-if "packed attribute missing for t" { "epiphany-*-*" } }
extern void abort (void);
diff --git a/gcc/testsuite/gcc.dg/builtin-unreachable-6.c b/gcc/testsuite/gcc.dg/builtin-unreachable-6.c
index d2596e95c3f..2f8ca369546 100644
--- a/gcc/testsuite/gcc.dg/builtin-unreachable-6.c
+++ b/gcc/testsuite/gcc.dg/builtin-unreachable-6.c
@@ -16,5 +16,5 @@ lab2:
goto *x;
}
-/* { dg-final { scan-tree-dump-times "lab \\\[\[0-9.\]+%\\\]" 1 "fab1" } } */
+/* { dg-final { scan-tree-dump-times "lab:" 1 "fab1" } } */
/* { dg-final { scan-tree-dump-times "__builtin_unreachable" 1 "fab1" } } */
diff --git a/gcc/testsuite/gcc.dg/c90-const-expr-5.c b/gcc/testsuite/gcc.dg/c90-const-expr-5.c
index 9f5cdef8399..e7422eb6020 100644
--- a/gcc/testsuite/gcc.dg/c90-const-expr-5.c
+++ b/gcc/testsuite/gcc.dg/c90-const-expr-5.c
@@ -15,8 +15,8 @@ f (void)
{
/* (V *)0 is a null pointer constant, so the assignment should be
diagnosed. */
- q = (j ? p : (V *)0); /* { dg-error "5:assignment from incompatible pointer type" } */
- q = (j ? p : (void *)0); /* { dg-error "5:assignment from incompatible pointer type" } */
+ q = (j ? p : (V *)0); /* { dg-error "5:assignment to 'long int \\*' from incompatible pointer type 'int \\*'" } */
+ q = (j ? p : (void *)0); /* { dg-error "5:assignment to 'long int \\*' from incompatible pointer type 'int \\*'" } */
/* And this conversion should be valid. */
(void (*)(void))(V *)0;
(void (*)(void))(void *)0;
diff --git a/gcc/testsuite/gcc.dg/c99-const-expr-5.c b/gcc/testsuite/gcc.dg/c99-const-expr-5.c
index 3bfa7f6fe27..693b97d018c 100644
--- a/gcc/testsuite/gcc.dg/c99-const-expr-5.c
+++ b/gcc/testsuite/gcc.dg/c99-const-expr-5.c
@@ -15,8 +15,8 @@ f (void)
{
/* (V *)0 is a null pointer constant, so the assignment should be
diagnosed. */
- q = (j ? p : (V *)0); /* { dg-error "assignment from incompatible pointer type" } */
- q = (j ? p : (void *)0); /* { dg-error "assignment from incompatible pointer type" } */
+ q = (j ? p : (V *)0); /* { dg-error "assignment to 'long int \\*' from incompatible pointer type 'int \\*'" } */
+ q = (j ? p : (void *)0); /* { dg-error "assignment to 'long int \\*' from incompatible pointer type 'int \\*'" } */
/* And this conversion should be valid. */
(void (*)(void))(V *)0;
(void (*)(void))(void *)0;
diff --git a/gcc/testsuite/gcc.dg/compare1.c b/gcc/testsuite/gcc.dg/compare1.c
index 17ba3ee2098..ebab8c2cbf7 100644
--- a/gcc/testsuite/gcc.dg/compare1.c
+++ b/gcc/testsuite/gcc.dg/compare1.c
@@ -22,20 +22,20 @@ enum mm2
int f(enum mm1 x)
{
- return x == (tf?DI:SI); /* { dg-bogus "signed and unsigned" "case 1" } */
+ return x == (tf?DI:SI); /* { dg-bogus "changes signedness" "case 1" } */
}
int g(enum mm1 x)
{
- return x == (tf?DI:-1); /* { dg-bogus "signed and unsigned" "case 2" } */
+ return x == (tf?DI:-1); /* { dg-bogus "changes signedness" "case 2" } */
}
int h(enum mm2 x)
{
- return x == (tf?DI2:SI2); /* { dg-bogus "signed and unsigned" "case 3" } */
+ return x == (tf?DI2:SI2); /* { dg-bogus "changes signedness" "case 3" } */
}
int i(enum mm2 x)
{
- return x == (tf?DI2:-1); /* { dg-warning "signed and unsigned" "case 4" } */
+ return x == (tf?DI2:-1); /* { dg-warning "different signedness" "case 4" } */
}
diff --git a/gcc/testsuite/gcc.dg/compare2.c b/gcc/testsuite/gcc.dg/compare2.c
index 0625eb9c3f6..f742e95f605 100644
--- a/gcc/testsuite/gcc.dg/compare2.c
+++ b/gcc/testsuite/gcc.dg/compare2.c
@@ -9,50 +9,50 @@ int tf = 1;
void f(int x, unsigned int y)
{
/* ?: branches are constants. */
- x > (tf?64:128); /* { dg-bogus "signed and unsigned" "case 1" } */
- y > (tf?64:128); /* { dg-bogus "signed and unsigned" "case 2" } */
+ x > (tf?64:128); /* { dg-bogus "changes signedness" "case 1" } */
+ y > (tf?64:128); /* { dg-bogus "changes signedness" "case 2" } */
/* ?: branches are (recursively) constants. */
- x > (tf?64:(tf?128:256)); /* { dg-bogus "signed and unsigned" "case 3" } */
- y > (tf?64:(tf?128:256)); /* { dg-bogus "signed and unsigned" "case 4" } */
+ x > (tf?64:(tf?128:256)); /* { dg-bogus "changes signedness" "case 3" } */
+ y > (tf?64:(tf?128:256)); /* { dg-bogus "changes signedness" "case 4" } */
/* ?: branches are signed constants. */
- x > (tf?64:-1); /* { dg-bogus "signed and unsigned" "case 5" } */
- y > (tf?64:-1); /* { dg-warning "signed and unsigned" "case 6" } */
+ x > (tf?64:-1); /* { dg-bogus "changes signedness" "case 5" } */
+ y > (tf?64:-1); /* { dg-warning "different signedness" "case 6" } */
/* ?: branches are (recursively) signed constants. */
- x > (tf?64:(tf?128:-1)); /* { dg-bogus "signed and unsigned" "case 7" } */
- y > (tf?64:(tf?128:-1)); /* { dg-warning "signed and unsigned" "case 8" } */
+ x > (tf?64:(tf?128:-1)); /* { dg-bogus "changes signedness" "case 7" } */
+ y > (tf?64:(tf?128:-1)); /* { dg-warning "different signedness" "case 8" } */
/* Statement expression. */
- x > ({tf; 64;}); /* { dg-bogus "signed and unsigned" "case 9" } */
- y > ({tf; 64;}); /* { dg-bogus "signed and unsigned" "case 10" } */
+ x > ({tf; 64;}); /* { dg-bogus "changes signedness" "case 9" } */
+ y > ({tf; 64;}); /* { dg-bogus "changes signedness" "case 10" } */
/* Statement expression with recursive ?: . */
- x > ({tf; tf?64:(tf?128:256);}); /* { dg-bogus "signed and unsigned" "case 11" } */
- y > ({tf; tf?64:(tf?128:256);}); /* { dg-bogus "signed and unsigned" "case 12" } */
+ x > ({tf; tf?64:(tf?128:256);}); /* { dg-bogus "changes signedness" "case 11" } */
+ y > ({tf; tf?64:(tf?128:256);}); /* { dg-bogus "changes signedness" "case 12" } */
/* Statement expression with signed ?:. */
- x > ({tf; tf?64:-1;}); /* { dg-bogus "signed and unsigned" "case 13" } */
- y > ({tf; tf?64:-1;}); /* { dg-warning "signed and unsigned" "case 14" } */
+ x > ({tf; tf?64:-1;}); /* { dg-bogus "changes signedness" "case 13" } */
+ y > ({tf; tf?64:-1;}); /* { dg-warning "different signedness" "case 14" } */
/* Statement expression with recursive signed ?:. */
- x > ({tf; tf?64:(tf?128:-1);}); /* { dg-bogus "signed and unsigned" "case 15" } */
- y > ({tf; tf?64:(tf?128:-1);}); /* { dg-warning "signed and unsigned" "case 16" } */
+ x > ({tf; tf?64:(tf?128:-1);}); /* { dg-bogus "changes signedness" "case 15" } */
+ y > ({tf; tf?64:(tf?128:-1);}); /* { dg-warning "different signedness" "case 16" } */
/* ?: branches are constants. */
- tf ? x : (tf?64:32); /* { dg-bogus "conditional expression" "case 17" } */
- tf ? y : (tf?64:32); /* { dg-bogus "conditional expression" "case 18" } */
+ tf ? x : (tf?64:32); /* { dg-bogus "changes signedness" "case 17" } */
+ tf ? y : (tf?64:32); /* { dg-bogus "changes signedness" "case 18" } */
/* ?: branches are signed constants. */
- tf ? x : (tf?64:-1); /* { dg-bogus "conditional expression" "case 19" } */
- tf ? y : (tf?64:-1); /* { dg-warning "conditional expression" "case 20" } */
+ tf ? x : (tf?64:-1); /* { dg-bogus "changes signedness" "case 19" } */
+ tf ? y : (tf?64:-1); /* { dg-warning "changes signedness" "case 20" } */
/* ?: branches are (recursively) constants. */
- tf ? x : (tf?64:(tf?128:256)); /* { dg-bogus "conditional expression" "case 21" } */
- tf ? y : (tf?64:(tf?128:256)); /* { dg-bogus "conditional expression" "case 22" } */
+ tf ? x : (tf?64:(tf?128:256)); /* { dg-bogus "changes signedness" "case 21" } */
+ tf ? y : (tf?64:(tf?128:256)); /* { dg-bogus "changes signedness" "case 22" } */
/* ?: branches are (recursively) signed constants. */
- tf ? x : (tf?64:(tf?128:-1)); /* { dg-bogus "conditional expression" "case 23" } */
- tf ? y : (tf?64:(tf?128:-1)); /* { dg-warning "conditional expression" "case 24" } */
+ tf ? x : (tf?64:(tf?128:-1)); /* { dg-bogus "changes signedness" "case 23" } */
+ tf ? y : (tf?64:(tf?128:-1)); /* { dg-warning "changes signedness" "case 24" } */
}
diff --git a/gcc/testsuite/gcc.dg/compare3.c b/gcc/testsuite/gcc.dg/compare3.c
index eda3faf2754..836231fb870 100644
--- a/gcc/testsuite/gcc.dg/compare3.c
+++ b/gcc/testsuite/gcc.dg/compare3.c
@@ -11,49 +11,49 @@ void f(int x, unsigned int y)
/* Test comparing conditional expressions containing truth values.
This can occur explicitly, or e.g. when (foo?2:(bar?1:0)) is
optimized into (foo?2:(bar!=0)). */
- x > (tf?64:(tf!=x)); /* { dg-bogus "signed and unsigned" "case 1" } */
- y > (tf?64:(tf!=x)); /* { dg-bogus "signed and unsigned" "case 2" } */
- x > (tf?(tf!=x):64); /* { dg-bogus "signed and unsigned" "case 3" } */
- y > (tf?(tf!=x):64); /* { dg-bogus "signed and unsigned" "case 4" } */
-
- x > (tf?64:(tf==x)); /* { dg-bogus "signed and unsigned" "case 5" } */
- y > (tf?64:(tf==x)); /* { dg-bogus "signed and unsigned" "case 6" } */
- x > (tf?(tf==x):64); /* { dg-bogus "signed and unsigned" "case 7" } */
- y > (tf?(tf==x):64); /* { dg-bogus "signed and unsigned" "case 8" } */
-
- x > (tf?64:(tf>x)); /* { dg-bogus "signed and unsigned" "case 9" } */
- y > (tf?64:(tf>x)); /* { dg-bogus "signed and unsigned" "case 10" } */
- x > (tf?(tf>x):64); /* { dg-bogus "signed and unsigned" "case 11" } */
- y > (tf?(tf>x):64); /* { dg-bogus "signed and unsigned" "case 12" } */
-
- x < (tf?64:(tf<x)); /* { dg-bogus "signed and unsigned" "case 13" } */
- y < (tf?64:(tf<x)); /* { dg-bogus "signed and unsigned" "case 14" } */
- x < (tf?(tf<x):64); /* { dg-bogus "signed and unsigned" "case 15" } */
- y < (tf?(tf<x):64); /* { dg-bogus "signed and unsigned" "case 16" } */
-
- x > (tf?64:(tf>=x)); /* { dg-bogus "signed and unsigned" "case 17" } */
- y > (tf?64:(tf>=x)); /* { dg-bogus "signed and unsigned" "case 18" } */
- x > (tf?(tf>=x):64); /* { dg-bogus "signed and unsigned" "case 19" } */
- y > (tf?(tf>=x):64); /* { dg-bogus "signed and unsigned" "case 20" } */
-
- x > (tf?64:(tf<=x)); /* { dg-bogus "signed and unsigned" "case 21" } */
- y > (tf?64:(tf<=x)); /* { dg-bogus "signed and unsigned" "case 22" } */
- x > (tf?(tf<=x):64); /* { dg-bogus "signed and unsigned" "case 23" } */
- y > (tf?(tf<=x):64); /* { dg-bogus "signed and unsigned" "case 24" } */
-
- x > (tf?64:(tf&&x)); /* { dg-bogus "signed and unsigned" "case 25" } */
- y > (tf?64:(tf&&x)); /* { dg-bogus "signed and unsigned" "case 26" } */
- x > (tf?(tf&&x):64); /* { dg-bogus "signed and unsigned" "case 27" } */
- y > (tf?(tf&&x):64); /* { dg-bogus "signed and unsigned" "case 28" } */
-
- x > (tf?64:(tf||x)); /* { dg-bogus "signed and unsigned" "case 29" } */
- y > (tf?64:(tf||x)); /* { dg-bogus "signed and unsigned" "case 30" } */
- x > (tf?(tf||x):64); /* { dg-bogus "signed and unsigned" "case 31" } */
- y > (tf?(tf||x):64); /* { dg-bogus "signed and unsigned" "case 32" } */
-
- x > (tf?64:(!tf)); /* { dg-bogus "signed and unsigned" "case 33" } */
- y > (tf?64:(!tf)); /* { dg-bogus "signed and unsigned" "case 34" } */
- x > (tf?(!tf):64); /* { dg-bogus "signed and unsigned" "case 35" } */
- y > (tf?(!tf):64); /* { dg-bogus "signed and unsigned" "case 36" } */
+ x > (tf?64:(tf!=x)); /* { dg-bogus "changes signedness" "case 1" } */
+ y > (tf?64:(tf!=x)); /* { dg-bogus "changes signedness" "case 2" } */
+ x > (tf?(tf!=x):64); /* { dg-bogus "changes signedness" "case 3" } */
+ y > (tf?(tf!=x):64); /* { dg-bogus "changes signedness" "case 4" } */
+
+ x > (tf?64:(tf==x)); /* { dg-bogus "changes signedness" "case 5" } */
+ y > (tf?64:(tf==x)); /* { dg-bogus "changes signedness" "case 6" } */
+ x > (tf?(tf==x):64); /* { dg-bogus "changes signedness" "case 7" } */
+ y > (tf?(tf==x):64); /* { dg-bogus "changes signedness" "case 8" } */
+
+ x > (tf?64:(tf>x)); /* { dg-bogus "changes signedness" "case 9" } */
+ y > (tf?64:(tf>x)); /* { dg-bogus "changes signedness" "case 10" } */
+ x > (tf?(tf>x):64); /* { dg-bogus "changes signedness" "case 11" } */
+ y > (tf?(tf>x):64); /* { dg-bogus "changes signedness" "case 12" } */
+
+ x < (tf?64:(tf<x)); /* { dg-bogus "changes signedness" "case 13" } */
+ y < (tf?64:(tf<x)); /* { dg-bogus "changes signedness" "case 14" } */
+ x < (tf?(tf<x):64); /* { dg-bogus "changes signedness" "case 15" } */
+ y < (tf?(tf<x):64); /* { dg-bogus "changes signedness" "case 16" } */
+
+ x > (tf?64:(tf>=x)); /* { dg-bogus "changes signedness" "case 17" } */
+ y > (tf?64:(tf>=x)); /* { dg-bogus "changes signedness" "case 18" } */
+ x > (tf?(tf>=x):64); /* { dg-bogus "changes signedness" "case 19" } */
+ y > (tf?(tf>=x):64); /* { dg-bogus "changes signedness" "case 20" } */
+
+ x > (tf?64:(tf<=x)); /* { dg-bogus "changes signedness" "case 21" } */
+ y > (tf?64:(tf<=x)); /* { dg-bogus "changes signedness" "case 22" } */
+ x > (tf?(tf<=x):64); /* { dg-bogus "changes signedness" "case 23" } */
+ y > (tf?(tf<=x):64); /* { dg-bogus "changes signedness" "case 24" } */
+
+ x > (tf?64:(tf&&x)); /* { dg-bogus "changes signedness" "case 25" } */
+ y > (tf?64:(tf&&x)); /* { dg-bogus "changes signedness" "case 26" } */
+ x > (tf?(tf&&x):64); /* { dg-bogus "changes signedness" "case 27" } */
+ y > (tf?(tf&&x):64); /* { dg-bogus "changes signedness" "case 28" } */
+
+ x > (tf?64:(tf||x)); /* { dg-bogus "changes signedness" "case 29" } */
+ y > (tf?64:(tf||x)); /* { dg-bogus "changes signedness" "case 30" } */
+ x > (tf?(tf||x):64); /* { dg-bogus "changes signedness" "case 31" } */
+ y > (tf?(tf||x):64); /* { dg-bogus "changes signedness" "case 32" } */
+
+ x > (tf?64:(!tf)); /* { dg-bogus "changes signedness" "case 33" } */
+ y > (tf?64:(!tf)); /* { dg-bogus "changes signedness" "case 34" } */
+ x > (tf?(!tf):64); /* { dg-bogus "changes signedness" "case 35" } */
+ y > (tf?(!tf):64); /* { dg-bogus "changes signedness" "case 36" } */
}
diff --git a/gcc/testsuite/gcc.dg/compare4.c b/gcc/testsuite/gcc.dg/compare4.c
index e5dad4d1e45..299d488edf6 100644
--- a/gcc/testsuite/gcc.dg/compare4.c
+++ b/gcc/testsuite/gcc.dg/compare4.c
@@ -10,7 +10,7 @@ int foo(int x, int y, unsigned u)
{
/* A COMPOUND_EXPR is non-negative if the last element is known to
be non-negative. */
- if (u < (bar(), -1)) /*{ dg-warning "9:signed and unsigned" "COMPOUND_EXPR" }*/
+ if (u < (bar(), -1)) /*{ dg-warning "9:different signedness" "COMPOUND_EXPR" }*/
return x;
if (u < (bar(), 10))
return x;
@@ -34,7 +34,7 @@ int foo(int x, int y, unsigned u)
/* A MODIFY_EXPR is non-negative if the new value is known to be
non-negative. */
- if (u < (x = -1)) /* { dg-warning "9:signed and unsigned" "MODIFY_EXPR" } */
+ if (u < (x = -1)) /* { dg-warning "9:different signedness" "MODIFY_EXPR" } */
return x;
if (u < (x = 10))
return x;
diff --git a/gcc/testsuite/gcc.dg/compare5.c b/gcc/testsuite/gcc.dg/compare5.c
index f19c575efb7..3a502f12de9 100644
--- a/gcc/testsuite/gcc.dg/compare5.c
+++ b/gcc/testsuite/gcc.dg/compare5.c
@@ -10,7 +10,7 @@ int foo(int x, int y, unsigned u)
{
/* A *_DIV_EXPR is non-negative if both operands are. */
- if (u < ((x=-22)/33)) /* { dg-warning "signed and unsigned" "DIV_EXPR" } */
+ if (u < ((x=-22)/33)) /* { dg-warning "different signedness" "DIV_EXPR" } */
return x;
if (u < ((x=22)/33))
@@ -25,7 +25,7 @@ int foo(int x, int y, unsigned u)
/* A *_MOD_EXPR is non-negative if the first operand is. */
- if (u < ((x=-22)%33)) /* { dg-warning "signed and unsigned" "MOD_EXPR" } */
+ if (u < ((x=-22)%33)) /* { dg-warning "different signedness" "MOD_EXPR" } */
return x;
if (u < ((x=22)%-33))
diff --git a/gcc/testsuite/gcc.dg/compare7.c b/gcc/testsuite/gcc.dg/compare7.c
index e2fbc04bfc2..b6fe6e78334 100644
--- a/gcc/testsuite/gcc.dg/compare7.c
+++ b/gcc/testsuite/gcc.dg/compare7.c
@@ -6,5 +6,5 @@
int f(unsigned a, int b)
{
- return a < b; /* { dg-bogus "signed and unsigned" } */
+ return a < b; /* { dg-bogus "changes signedness" } */
}
diff --git a/gcc/testsuite/gcc.dg/compare8.c b/gcc/testsuite/gcc.dg/compare8.c
index d723c45a095..d09b69c53a2 100644
--- a/gcc/testsuite/gcc.dg/compare8.c
+++ b/gcc/testsuite/gcc.dg/compare8.c
@@ -4,18 +4,18 @@
int
f(unsigned short a1, unsigned short a2, unsigned int b)
{
- return ((a1+a2)|5) > b ? 2 : 3; /* { dg-bogus "signed and unsigned" } */
+ return ((a1+a2)|5) > b ? 2 : 3; /* { dg-bogus "changes signedness" } */
}
int
g(unsigned short a1, unsigned short a2, unsigned int b)
{
- return ((a1+a2)&5) > b ? 2 : 3; /* { dg-bogus "signed and unsigned" } */
+ return ((a1+a2)&5) > b ? 2 : 3; /* { dg-bogus "changes signedness" } */
}
int
h(unsigned short a1, unsigned short a2, unsigned int b)
{
- return ((a1+a2)^5) > b ? 2 : 3; /* { dg-bogus "signed and unsigned" } */
+ return ((a1+a2)^5) > b ? 2 : 3; /* { dg-bogus "changes signedness" } */
}
diff --git a/gcc/testsuite/gcc.dg/compare9.c b/gcc/testsuite/gcc.dg/compare9.c
index 02150cb1fb6..fba61e42a48 100644
--- a/gcc/testsuite/gcc.dg/compare9.c
+++ b/gcc/testsuite/gcc.dg/compare9.c
@@ -22,20 +22,20 @@ enum mm2
int f(enum mm1 x)
{
- return x == (tf?DI:SI); /* { dg-bogus "signed and unsigned" "case 1" } */
+ return x == (tf?DI:SI); /* { dg-bogus "changes signedness" "case 1" } */
}
int g(enum mm1 x)
{
- return x == (tf?DI:-1); /* { dg-bogus "signed and unsigned" "case 2" } */
+ return x == (tf?DI:-1); /* { dg-bogus "changes signedness" "case 2" } */
}
int h(enum mm2 x)
{
- return x == (tf?DI2:SI2); /* { dg-bogus "signed and unsigned" "case 3" } */
+ return x == (tf?DI2:SI2); /* { dg-bogus "changes signedness" "case 3" } */
}
int i(enum mm2 x)
{
- return x == (tf?DI2:-1); /* { dg-bogus "signed and unsigned" "case 4" } */
+ return x == (tf?DI2:-1); /* { dg-bogus "changes signedness" "case 4" } */
}
diff --git a/gcc/testsuite/gcc.dg/conv-2.c b/gcc/testsuite/gcc.dg/conv-2.c
index 388dee3d746..83468cdad1c 100644
--- a/gcc/testsuite/gcc.dg/conv-2.c
+++ b/gcc/testsuite/gcc.dg/conv-2.c
@@ -12,15 +12,15 @@ int main()
unsigned char *ucp;
signed char *scp;
- ulp = lp; /* { dg-warning " pointer targets in assignment differ in signedness" } */
- lp = ulp; /* { dg-warning " pointer targets in assignment differ in signedness" } */
+ ulp = lp; /* { dg-warning " pointer targets in assignment from 'long int \\*' to 'long unsigned int \\*' differ in signedness" } */
+ lp = ulp; /* { dg-warning " pointer targets in assignment from 'long unsigned int \\*' to 'long int \\*' differ in signedness" } */
f1(ulp); /* { dg-warning " differ in signedness" } */
f2(lp); /* { dg-warning " differ in signedness" } */
- cp = ucp; /* { dg-warning " pointer targets in assignment differ in signedness" } */
- cp = scp; /* { dg-warning " pointer targets in assignment differ in signedness" } */
- ucp = scp; /* { dg-warning " pointer targets in assignment differ in signedness" } */
- ucp = cp; /* { dg-warning " pointer targets in assignment differ in signedness" } */
- scp = ucp; /* { dg-warning " pointer targets in assignment differ in signedness" } */
- scp = cp; /* { dg-warning " pointer targets in assignment differ in signedness" } */
+ cp = ucp; /* { dg-warning " pointer targets in assignment from 'unsigned char \\*' to 'char \\*' differ in signedness" } */
+ cp = scp; /* { dg-warning " pointer targets in assignment from 'signed char \\*' to 'char \\*' differ in signedness" } */
+ ucp = scp; /* { dg-warning " pointer targets in assignment from 'signed char \\*' to 'unsigned char \\*' differ in signedness" } */
+ ucp = cp; /* { dg-warning " pointer targets in assignment from 'char \\*' to 'unsigned char \\*' differ in signedness" } */
+ scp = ucp; /* { dg-warning " pointer targets in assignment from 'unsigned char \\*' to 'signed char \\*' differ in signedness" } */
+ scp = cp; /* { dg-warning " pointer targets in assignment from 'char \\*' to 'signed char \\*' differ in signedness" } */
}
diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/stacked-qualified-types-3.c b/gcc/testsuite/gcc.dg/debug/dwarf2/stacked-qualified-types-3.c
index dac4405b36c..efa3fa0b1f2 100644
--- a/gcc/testsuite/gcc.dg/debug/dwarf2/stacked-qualified-types-3.c
+++ b/gcc/testsuite/gcc.dg/debug/dwarf2/stacked-qualified-types-3.c
@@ -31,4 +31,4 @@ char * _Atomic restrict h;
char * _Atomic i;
char * restrict j;
-/* { dg-final { scan-assembler-times "DIE \\(\[^\n\]*\\) DW_TAG_(?:const|volatile|atomic|restrict)_type" 8 { xfail { powerpc-ibm-aix* } } } } */
+/* { dg-final { scan-assembler-times "DIE \\(\[^\n\]*\\) DW_TAG_(?:const|volatile|atomic|restrict)_type" 8 } } */
diff --git a/gcc/testsuite/gcc.dg/diagnostic-types-1.c b/gcc/testsuite/gcc.dg/diagnostic-types-1.c
new file mode 100644
index 00000000000..fc4b104df05
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/diagnostic-types-1.c
@@ -0,0 +1,57 @@
+/* PR c/81233 */
+/* { dg-do compile } */
+/* { dg-options "-Wc++-compat -Wpedantic" } */
+/* Test we're printing the types, like the good compiler we are. */
+
+enum E1 { A } e;
+enum E2 { B };
+extern void foo_E (enum E1); /* { dg-message "expected 'enum E1' but argument is of type 'int'" } */
+extern void foo (char *); /* { dg-message "expected 'char \\*' but argument is of type 'int \\*'" } */
+extern void foo2 (int *); /* { dg-message "expected 'int \\*' but argument is of type 'int'" } */
+extern void foo3 (int); /* { dg-message "expected 'int' but argument is of type 'int \\*'" } */
+extern void foo4 (int *); /* { dg-message "expected 'int \\*' but argument is of type 'unsigned int \\*'" } */
+
+char *
+fn0 (int *p, char *q)
+{
+ p = q; /* { dg-warning "assignment to 'int \\*' from incompatible pointer type 'char \\*'" } */
+ int *r = q; /* { dg-warning "initialization of 'int \\*' from incompatible pointer type 'char \\*'" } */
+ foo (r); /* { dg-warning "passing argument 1 of 'foo' from incompatible pointer type" } */
+ return p; /* { dg-warning "returning 'int \\*' from a function with incompatible return type 'char \\*'" } */
+}
+
+int *
+fn1 (int *p)
+{
+ p = 1; /* { dg-warning "assignment to 'int \\*' from 'int' makes pointer from integer without a cast" } */
+ int *q = 1; /* { dg-warning "initialization of 'int \\*' from 'int' makes pointer from integer without a cast" } */
+ foo2 (1); /* { dg-warning "passing argument 1 of 'foo2' makes pointer from integer without a cast" } */
+ return 1; /* { dg-warning "returning 'int' from a function with return type 'int \\*' makes pointer from integer without a cast" } */
+}
+
+int
+fn2 (int i, int *p)
+{
+ i = p; /* { dg-warning "assignment to 'int' from 'int \\*' makes integer from pointer without a cast" } */
+ int j = p; /* { dg-warning "initialization of 'int' from 'int \\*' makes integer from pointer without a cast" } */
+ foo3 (p); /* { dg-warning "passing argument 1 of 'foo3' makes integer from pointer without a cast" } */
+ return p; /* { dg-warning "returning 'int \\*' from a function with return type 'int' makes integer from pointer without a cast" } */
+}
+
+int *
+fn3 (int *p, unsigned int *u)
+{
+ p = u; /* { dg-warning "pointer targets in assignment from 'unsigned int \\*' to 'int \\*' differ in signedness" } */
+ int *q = u; /* { dg-warning "pointer targets in initialization of 'int \\*' from 'unsigned int \\*' differ in signedness" } */
+ foo4 (u); /* { dg-warning "pointer targets in passing argument 1 of 'foo4' differ in signedness" } */
+ return u; /* { dg-warning "pointer targets in returning 'unsigned int \\*' from a function with return type 'int \\*' differ in signedness" } */
+}
+
+enum E1
+fn4 (void)
+{
+ foo_E (B); /* { dg-warning "enum conversion when passing argument" } */
+ e = 0; /* { dg-warning "enum conversion from 'int' to 'enum E1' in assignment is invalid" } */
+ enum E1 f = 0; /* { dg-warning "enum conversion from 'int' to 'enum E1' in initialization is invalid" } */
+ return 0; /* { dg-warning "enum conversion from 'int' to 'enum E1' in return is invalid" } */
+}
diff --git a/gcc/testsuite/gcc.dg/guality/pr25967-1.c b/gcc/testsuite/gcc.dg/guality/pr25967-1.c
new file mode 100644
index 00000000000..0924d1c03c1
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/guality/pr25967-1.c
@@ -0,0 +1,70 @@
+/* { dg-do run { target i?86-*-* x86_64-*-* } } */
+/* { dg-options "-g -mgeneral-regs-only" } */
+
+extern void exit (int);
+
+typedef unsigned int uword_t __attribute__ ((mode (__word__)));
+
+#define ERROR 0x12345670
+#define IP 0x12345671
+#define CS 0x12345672
+#define FLAGS 0x12345673
+#define SP 0x12345674
+#define SS 0x12345675
+
+#define STRING(x) XSTRING(x)
+#define XSTRING(x) #x
+#define ASMNAME(cname) ASMNAME2 (__USER_LABEL_PREFIX__, cname)
+#define ASMNAME2(prefix, cname) XSTRING (prefix) cname
+
+struct interrupt_frame
+{
+ uword_t ip;
+ uword_t cs;
+ uword_t flags;
+ uword_t sp;
+ uword_t ss;
+};
+
+__attribute__((naked, used))
+void
+fn (void)
+{
+ register uword_t *sp __asm__("sp");
+ uword_t error = *sp;
+ struct interrupt_frame *frame = (struct interrupt_frame *) (sp + 1);
+ if (ERROR != error) /* BREAK */
+ __builtin_abort ();
+ if (IP != frame->ip)
+ __builtin_abort ();
+ if (CS != frame->cs)
+ __builtin_abort ();
+ if (FLAGS != frame->flags)
+ __builtin_abort ();
+ if (SP != frame->sp)
+ __builtin_abort ();
+ if (SS != frame->ss)
+ __builtin_abort ();
+
+ exit (0);
+}
+
+int
+main ()
+{
+ asm ("push $" STRING (SS) "; \
+ push $" STRING (SP) "; \
+ push $" STRING (FLAGS) "; \
+ push $" STRING (CS) "; \
+ push $" STRING (IP) "; \
+ push $" STRING (ERROR) "; \
+ jmp " ASMNAME ("fn"));
+ return 0;
+}
+
+/* { dg-final { gdb-test 36 "error" "0x12345670" } } */
+/* { dg-final { gdb-test 36 "frame->ip" "0x12345671" } } */
+/* { dg-final { gdb-test 36 "frame->cs" "0x12345672" } } */
+/* { dg-final { gdb-test 36 "frame->flags" "0x12345673" } } */
+/* { dg-final { gdb-test 36 "frame->sp" "0x12345674" } } */
+/* { dg-final { gdb-test 36 "frame->ss" "0x12345675" } } */
diff --git a/gcc/testsuite/gcc.dg/guality/pr25967-2.c b/gcc/testsuite/gcc.dg/guality/pr25967-2.c
new file mode 100644
index 00000000000..c3b59e21251
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/guality/pr25967-2.c
@@ -0,0 +1,64 @@
+/* { dg-do run { target i?86-*-* x86_64-*-* } } */
+/* { dg-options "-g -mgeneral-regs-only" } */
+
+extern void exit (int);
+
+typedef unsigned int uword_t __attribute__ ((mode (__word__)));
+
+#define IP 0x12345671
+#define CS 0x12345672
+#define FLAGS 0x12345673
+#define SP 0x12345674
+#define SS 0x12345675
+
+#define STRING(x) XSTRING(x)
+#define XSTRING(x) #x
+#define ASMNAME(cname) ASMNAME2 (__USER_LABEL_PREFIX__, cname)
+#define ASMNAME2(prefix, cname) XSTRING (prefix) cname
+
+struct interrupt_frame
+{
+ uword_t ip;
+ uword_t cs;
+ uword_t flags;
+ uword_t sp;
+ uword_t ss;
+};
+
+__attribute__((naked, used))
+void
+fn (void)
+{
+ register uword_t *sp __asm__("sp");
+ struct interrupt_frame *frame = (struct interrupt_frame *) sp;
+ if (IP != frame->ip) /* BREAK */
+ __builtin_abort ();
+ if (CS != frame->cs)
+ __builtin_abort ();
+ if (FLAGS != frame->flags)
+ __builtin_abort ();
+ if (SP != frame->sp)
+ __builtin_abort ();
+ if (SS != frame->ss)
+ __builtin_abort ();
+
+ exit (0);
+}
+
+int
+main ()
+{
+ asm ("push $" STRING (SS) "; \
+ push $" STRING (SP) "; \
+ push $" STRING (FLAGS) "; \
+ push $" STRING (CS) "; \
+ push $" STRING (IP) "; \
+ jmp " ASMNAME ("fn"));
+ return 0;
+}
+
+/* { dg-final { gdb-test 34 "frame->ip" "0x12345671" } } */
+/* { dg-final { gdb-test 34 "frame->cs" "0x12345672" } } */
+/* { dg-final { gdb-test 34 "frame->flags" "0x12345673" } } */
+/* { dg-final { gdb-test 34 "frame->sp" "0x12345674" } } */
+/* { dg-final { gdb-test 34 "frame->ss" "0x12345675" } } */
diff --git a/gcc/testsuite/gcc.dg/guality/pr68037-1.c b/gcc/testsuite/gcc.dg/guality/pr68037-1.c
index 74f61ec5f96..44cab58659f 100644
--- a/gcc/testsuite/gcc.dg/guality/pr68037-1.c
+++ b/gcc/testsuite/gcc.dg/guality/pr68037-1.c
@@ -59,9 +59,9 @@ main ()
return 0;
}
-/* { dg-final { gdb-test 31 "error" "0x12345670" } } */
-/* { dg-final { gdb-test 31 "frame->ip" "0x12345671" } } */
-/* { dg-final { gdb-test 31 "frame->cs" "0x12345672" } } */
-/* { dg-final { gdb-test 31 "frame->flags" "0x12345673" } } */
-/* { dg-final { gdb-test 31 "frame->sp" "0x12345674" } } */
-/* { dg-final { gdb-test 31 "frame->ss" "0x12345675" } } */
+/* { dg-final { gdb-test 33 "error" "0x12345670" } } */
+/* { dg-final { gdb-test 33 "frame->ip" "0x12345671" } } */
+/* { dg-final { gdb-test 33 "frame->cs" "0x12345672" } } */
+/* { dg-final { gdb-test 33 "frame->flags" "0x12345673" } } */
+/* { dg-final { gdb-test 33 "frame->sp" "0x12345674" } } */
+/* { dg-final { gdb-test 33 "frame->ss" "0x12345675" } } */
diff --git a/gcc/testsuite/gcc.dg/init-bad-7.c b/gcc/testsuite/gcc.dg/init-bad-7.c
index 738ed605060..de5e570978c 100644
--- a/gcc/testsuite/gcc.dg/init-bad-7.c
+++ b/gcc/testsuite/gcc.dg/init-bad-7.c
@@ -8,4 +8,4 @@ struct f
};
char b[10];
-struct f g = {b}; /* { dg-warning "initialization from incompatible pointer type|near initialization for" } */
+struct f g = {b}; /* { dg-warning "initialization of 'int \\*' from incompatible pointer type|near initialization for" } */
diff --git a/gcc/testsuite/gcc.dg/ipa/ipa-pta-18.c b/gcc/testsuite/gcc.dg/ipa/ipa-pta-18.c
new file mode 100644
index 00000000000..01b09764097
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ipa/ipa-pta-18.c
@@ -0,0 +1,26 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -fipa-pta -fdump-ipa-pta2-details -fdump-tree-fre3-details" } */
+
+static int __attribute__((noipa))
+foo (int *p, int *q)
+{
+ *p = 1;
+ *q = 0;
+ return *p;
+}
+
+extern void abort (void);
+
+int main()
+{
+ int a, b;
+ if (foo (&a, &b) != 1)
+ abort ();
+ return 0;
+}
+
+/* Verify we can disambiguate *p and *q in foo. */
+
+/* { dg-final { scan-ipa-dump "foo.arg0 = &a" "pta2" } } */
+/* { dg-final { scan-ipa-dump "foo.arg1 = &b" "pta2" } } */
+/* { dg-final { scan-tree-dump-not "Replaced \\\*p_2\\\(D\\\) with 1" "fre3" } } */
diff --git a/gcc/testsuite/gcc.dg/ipa/ipa-sra-11.c b/gcc/testsuite/gcc.dg/ipa/ipa-sra-11.c
new file mode 100644
index 00000000000..e91423a62fb
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ipa/ipa-sra-11.c
@@ -0,0 +1,39 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -fipa-sra -fdump-tree-eipa_sra-details" } */
+
+struct bovid
+{
+ float red;
+ int green;
+ void *blue;
+};
+
+extern int printf (const char *, ...);
+extern void abort (void);
+
+static int
+__attribute__((noipa))
+ox (struct bovid cow)
+{
+ if (cow.green != 6)
+ abort ();
+
+ printf ("green: %f\nblue: %p\nblue again: %p\n", cow.green,
+ cow.blue, cow.blue);
+ return 0;
+}
+
+int
+main (int argc, char *argv[])
+{
+ struct bovid cow;
+
+ cow.red = 7.4;
+ cow.green = 6;
+ cow.blue = &cow;
+
+ ox (cow);
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-not "About to replace expr" "eipa_sra" } } */
diff --git a/gcc/testsuite/gcc.dg/ipa/pr81520.c b/gcc/testsuite/gcc.dg/ipa/pr81520.c
new file mode 100644
index 00000000000..b5d33d2dc96
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ipa/pr81520.c
@@ -0,0 +1,11 @@
+/* PR ipa/81520 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -fPIC" } */
+/* { dg-require-effective-target fpic } */
+
+char
+a (int b)
+{
+ a (b);
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/ipa/pr81696.c b/gcc/testsuite/gcc.dg/ipa/pr81696.c
new file mode 100644
index 00000000000..2d3d63ff0bb
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ipa/pr81696.c
@@ -0,0 +1,26 @@
+/* { dg-options "-O2 -fdump-ipa-icf-details" } */
+
+int
+main (int argc, char **argv)
+{
+ __label__ lab4, lab5, lab6;
+
+ void foo (void) { goto lab4; }
+ void foo2 (void) { goto lab4; }
+ void bar (void) { goto lab5; }
+ void baz (void) { goto lab6; }
+
+ if (argc)
+ foo ();
+ else
+ foo2 ();
+
+ lab4:;
+ bar ();
+ lab5:;
+ baz ();
+ lab6:;
+ return 0;
+}
+
+/* { dg-final { scan-ipa-dump "Equal symbols: 1" "icf" } } */
diff --git a/gcc/testsuite/gcc.dg/no-strict-overflow-7.c b/gcc/testsuite/gcc.dg/no-strict-overflow-7.c
index 19e1b55bb12..0e73d486f22 100644
--- a/gcc/testsuite/gcc.dg/no-strict-overflow-7.c
+++ b/gcc/testsuite/gcc.dg/no-strict-overflow-7.c
@@ -3,8 +3,8 @@
/* Source: Ian Lance Taylor. Dual of strict-overflow-6.c. */
-/* We can only simplify the conditional when using strict overflow
- semantics. */
+/* We can simplify the conditional because pointer overflow always has
+ undefined semantics. */
int
foo (char* p)
@@ -12,4 +12,4 @@ foo (char* p)
return p + 1000 < p;
}
-/* { dg-final { scan-tree-dump "\[+\]\[ \]*1000" "optimized" } } */
+/* { dg-final { scan-tree-dump "return 0" "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/noncompile/pr81289.c b/gcc/testsuite/gcc.dg/noncompile/pr81289.c
new file mode 100644
index 00000000000..dd211466718
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/noncompile/pr81289.c
@@ -0,0 +1,8 @@
+/* PR c/81289 */
+/* { dg-do compile } */
+
+int
+fn (int mm)
+{
+ mm == *&&
+} /* { dg-error "expected identifier" } */
diff --git a/gcc/testsuite/gcc.dg/overflow-warn-1.c b/gcc/testsuite/gcc.dg/overflow-warn-1.c
index 8eb322579cf..a9d9fbae148 100644
--- a/gcc/testsuite/gcc.dg/overflow-warn-1.c
+++ b/gcc/testsuite/gcc.dg/overflow-warn-1.c
@@ -47,10 +47,10 @@ static int sc = INT_MAX + 1; /* { dg-warning "25:integer overflow in expression"
constants. The third has the overflow in an unevaluated
subexpression, so is a null pointer constant. */
void *p = 0 * (INT_MAX + 1); /* { dg-warning "integer overflow in expression" } */
-/* { dg-warning "initialization makes pointer from integer without a cast" "null" { target *-*-* } .-1 } */
+/* { dg-warning "initialization of 'void \\*' from 'int' makes pointer from integer without a cast" "null" { target *-*-* } .-1 } */
void *q = 0 * (1 / 0); /* { dg-warning "division by zero" } */
-/* { dg-error "initializer element is not computable at load time" "constant" { target *-*-* } .-1 } */
-/* { dg-warning "initialization makes pointer from integer without a cast" "null" { target *-*-* } .-2 } */
+/* { dg-error "initializer element is not constant" "constant" { target *-*-* } .-1 } */
+/* { dg-warning "initialization of 'void \\*' from 'int' makes pointer from integer without a cast" "null" { target *-*-* } .-2 } */
void *r = (1 ? 0 : INT_MAX+1);
void
diff --git a/gcc/testsuite/gcc.dg/overflow-warn-2.c b/gcc/testsuite/gcc.dg/overflow-warn-2.c
index f048d6dae2a..9232800fb2e 100644
--- a/gcc/testsuite/gcc.dg/overflow-warn-2.c
+++ b/gcc/testsuite/gcc.dg/overflow-warn-2.c
@@ -47,10 +47,10 @@ static int sc = INT_MAX + 1; /* { dg-warning "integer overflow in expression" }
constants. The third has the overflow in an unevaluated
subexpression, so is a null pointer constant. */
void *p = 0 * (INT_MAX + 1); /* { dg-warning "integer overflow in expression" } */
-/* { dg-warning "initialization makes pointer from integer without a cast" "null" { target *-*-* } .-1 } */
+/* { dg-warning "initialization of 'void \\*' from 'int' makes pointer from integer without a cast" "null" { target *-*-* } .-1 } */
void *q = 0 * (1 / 0); /* { dg-warning "division by zero" } */
-/* { dg-error "initializer element is not computable at load time" "constant" { target *-*-* } .-1 } */
-/* { dg-warning "initialization makes pointer from integer without a cast" "null" { target *-*-* } .-2 } */
+/* { dg-error "initializer element is not constant" "constant" { target *-*-* } .-1 } */
+/* { dg-warning "initialization of 'void \\*' from 'int' makes pointer from integer without a cast" "null" { target *-*-* } .-2 } */
void *r = (1 ? 0 : INT_MAX+1);
void
diff --git a/gcc/testsuite/gcc.dg/overflow-warn-3.c b/gcc/testsuite/gcc.dg/overflow-warn-3.c
index 664011e401d..f64047795c7 100644
--- a/gcc/testsuite/gcc.dg/overflow-warn-3.c
+++ b/gcc/testsuite/gcc.dg/overflow-warn-3.c
@@ -53,10 +53,10 @@ static int sc = INT_MAX + 1; /* { dg-warning "integer overflow in expression" }
subexpression, so is a null pointer constant. */
void *p = 0 * (INT_MAX + 1); /* { dg-warning "integer overflow in expression" } */
/* { dg-warning "overflow in constant expression" "constant" { target *-*-* } .-1 } */
-/* { dg-warning "initialization makes pointer from integer without a cast" "null" { target *-*-* } .-2 } */
+/* { dg-warning "initialization of 'void \\*' from 'int' makes pointer from integer without a cast" "null" { target *-*-* } .-2 } */
void *q = 0 * (1 / 0); /* { dg-warning "division by zero" } */
-/* { dg-error "initializer element is not computable at load time" "constant" { target *-*-* } .-1 } */
-/* { dg-warning "initialization makes pointer from integer without a cast" "null" { target *-*-* } .-2 } */
+/* { dg-error "initializer element is not constant" "constant" { target *-*-* } .-1 } */
+/* { dg-warning "initialization of 'void \\*' from 'int' makes pointer from integer without a cast" "null" { target *-*-* } .-2 } */
void *r = (1 ? 0 : INT_MAX+1);
void
diff --git a/gcc/testsuite/gcc.dg/overflow-warn-4.c b/gcc/testsuite/gcc.dg/overflow-warn-4.c
index 52677ce897a..eb595aa7914 100644
--- a/gcc/testsuite/gcc.dg/overflow-warn-4.c
+++ b/gcc/testsuite/gcc.dg/overflow-warn-4.c
@@ -53,10 +53,10 @@ static int sc = INT_MAX + 1; /* { dg-warning "integer overflow in expression" }
subexpression, so is a null pointer constant. */
void *p = 0 * (INT_MAX + 1); /* { dg-warning "integer overflow in expression" } */
/* { dg-error "overflow in constant expression" "constant" { target *-*-* } .-1 } */
-/* { dg-error "initialization makes pointer from integer without a cast" "null" { target *-*-* } .-2 } */
+/* { dg-error "initialization of 'void \\*' from 'int' makes pointer from integer without a cast" "null" { target *-*-* } .-2 } */
void *q = 0 * (1 / 0); /* { dg-warning "division by zero" } */
-/* { dg-error "initializer element is not computable at load time" "constant" { target *-*-* } .-1 } */
-/* { dg-error "initialization makes pointer from integer without a cast" "null" { target *-*-* } .-2 } */
+/* { dg-error "initializer element is not constant" "constant" { target *-*-* } .-1 } */
+/* { dg-error "initialization of 'void \\*' from 'int' makes pointer from integer without a cast" "null" { target *-*-* } .-2 } */
void *r = (1 ? 0 : INT_MAX+1);
void
diff --git a/gcc/testsuite/gcc.dg/parm-impl-decl-1.c b/gcc/testsuite/gcc.dg/parm-impl-decl-1.c
index 5c7ddb0a259..c1219273c75 100644
--- a/gcc/testsuite/gcc.dg/parm-impl-decl-1.c
+++ b/gcc/testsuite/gcc.dg/parm-impl-decl-1.c
@@ -7,7 +7,7 @@
/* Implicit function declaration in attribute in definition (testcase
from bug). */
int
-foo (int __attribute__ ((__mode__ (vector_size(8)))) i) /* { dg-warning "'__mode__' attribute ignored" } */
+foo (int __attribute__ ((__mode__ (vector_size(8)))) i) /* { dg-warning "'mode' attribute ignored" } */
{
return (long long) i;
}
diff --git a/gcc/testsuite/gcc.dg/parm-impl-decl-3.c b/gcc/testsuite/gcc.dg/parm-impl-decl-3.c
index 904295258d7..20197b52402 100644
--- a/gcc/testsuite/gcc.dg/parm-impl-decl-3.c
+++ b/gcc/testsuite/gcc.dg/parm-impl-decl-3.c
@@ -4,7 +4,7 @@
/* { dg-options "-g -std=gnu89" } */
int
-foo (int __attribute__ ((__mode__ (vector_size(8)))) i) /* { dg-warning "'__mode__' attribute ignored" } */
+foo (int __attribute__ ((__mode__ (vector_size(8)))) i) /* { dg-warning "'mode' attribute ignored" } */
{
return (long long) i;
}
diff --git a/gcc/testsuite/gcc.dg/pie-7.c b/gcc/testsuite/gcc.dg/pie-7.c
new file mode 100644
index 00000000000..e118a98bafd
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pie-7.c
@@ -0,0 +1,7 @@
+/* { dg-do run { target pie } } */
+/* { dg-options "-fno-pie -no-pie" } */
+
+int main(void)
+{
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/pie-static-1.c b/gcc/testsuite/gcc.dg/pie-static-1.c
new file mode 100644
index 00000000000..4273049be7b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pie-static-1.c
@@ -0,0 +1,9 @@
+/* { dg-do run } */
+/* { dg-require-effective-target static } */
+/* { dg-require-effective-target pie } */
+/* { dg-options "-static -fpie -pie" } */
+
+int main(void)
+{
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/pie-static-2.c b/gcc/testsuite/gcc.dg/pie-static-2.c
new file mode 100644
index 00000000000..a673c997af8
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pie-static-2.c
@@ -0,0 +1,9 @@
+/* { dg-do run } */
+/* { dg-require-effective-target pie } */
+/* { dg-require-effective-target static } */
+/* { dg-options "-fpie -pie -static" } */
+
+int main(void)
+{
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/pointer-array-atomic.c b/gcc/testsuite/gcc.dg/pointer-array-atomic.c
index 55b58e84e35..bb63797b237 100644
--- a/gcc/testsuite/gcc.dg/pointer-array-atomic.c
+++ b/gcc/testsuite/gcc.dg/pointer-array-atomic.c
@@ -6,8 +6,8 @@ void transpose0(double* out, _Atomic double* in) { }
void transpose1(double out[2][2], _Atomic double in[2][2]) { }
void transpose2(double out[2][2][2], _Atomic double in[2][2][2]) { }
// return
-int (*x2(_Atomic int x[3][3]))[3] { return x; } /* { dg-warning "return from incompatible pointer type" } */
-_Atomic int (*x3(int x[3][3]))[3] { return x; } /* { dg-warning "return from incompatible pointer type" } */
+int (*x2(_Atomic int x[3][3]))[3] { return x; } /* { dg-warning "returning '_Atomic int \\(\\*\\)\\\[3\\\]' from a function with incompatible return type" } */
+_Atomic int (*x3(int x[3][3]))[3] { return x; } /* { dg-warning "returning 'int \\(\\*\\)\\\[3\\\]' from a function with incompatible return type" } */
void test(void)
{
double x0[2];
@@ -31,13 +31,13 @@ void test(void)
transpose2(y2, o2); /* { dg-warning "passing argument 2 of 'transpose2' from incompatible pointer type" } */
transpose2(y2, x2); /* { dg-warning "passing argument 2 of 'transpose2' from incompatible pointer type" } */
// initialization
- _Atomic double (*x0p) = x0; /* { dg-warning "initialization from incompatible pointer type" } */
- _Atomic double (*x1p)[2] = x1; /* { dg-warning "initialization from incompatible pointer type" } */
- _Atomic double (*x2p)[2][2] = x2; /* { dg-warning "initialization from incompatible pointer type" } */
+ _Atomic double (*x0p) = x0; /* { dg-warning "initialization of '_Atomic double \\*' from incompatible pointer type" } */
+ _Atomic double (*x1p)[2] = x1; /* { dg-warning "initialization of '_Atomic double \\(\\*\\)\\\[2\\\]' from incompatible pointer type" } */
+ _Atomic double (*x2p)[2][2] = x2; /* { dg-warning "initialization of '_Atomic double \\(\\*\\)\\\[2\\\]\\\[2\\\]' from incompatible pointer type" } */
// assignment
- x0p = x0; /* { dg-warning "assignment from incompatible pointer type" } */
- x1p = x1; /* { dg-warning "assignment from incompatible pointer type" } */
- x2p = x2; /* { dg-warning "assignment from incompatible pointer type" } */
+ x0p = x0; /* { dg-warning "assignment to '_Atomic double \\*' from incompatible pointer type" } */
+ x1p = x1; /* { dg-warning "assignment to '_Atomic double \\(\\*\\)\\\[2\\\]' from incompatible pointer type" } */
+ x2p = x2; /* { dg-warning "assignment to '_Atomic double \\(\\*\\)\\\[2\\\]\\\[2\\\]' from incompatible pointer type" } */
// subtraction
&(x0[1]) - &(z0[0]); /* { dg-error "invalid operands to binary" } */
&(x1[1]) - &(z1[0]); /* { dg-error "invalid operands to binary" } */
diff --git a/gcc/testsuite/gcc.dg/pr11492.c b/gcc/testsuite/gcc.dg/pr11492.c
index cf17712dde1..86435a83e79 100644
--- a/gcc/testsuite/gcc.dg/pr11492.c
+++ b/gcc/testsuite/gcc.dg/pr11492.c
@@ -5,7 +5,7 @@ int main( void )
{
unsigned int a;
unsigned char b;
- for ( a = 0, b = 2; a > b * 100; a++ ) /* { dg-bogus "comparison between signed and unsigned integer" } */
+ for ( a = 0, b = 2; a > b * 100; a++ ) /* { dg-bogus "comparison of integer expressions of different signedness" } */
{ ; }
return 0;
diff --git a/gcc/testsuite/gcc.dg/pr26865.c b/gcc/testsuite/gcc.dg/pr26865.c
index d9f1fe0d3a1..f49d1d29f9c 100644
--- a/gcc/testsuite/gcc.dg/pr26865.c
+++ b/gcc/testsuite/gcc.dg/pr26865.c
@@ -4,5 +4,5 @@
void
foo (void)
{
- char *e = alloca (100); /* { dg-warning "implicit declaration|initialization makes" } */
+ char *e = alloca (100); /* { dg-warning "implicit declaration|initialization of 'char \\*' from 'int' makes" } */
}
diff --git a/gcc/testsuite/gcc.dg/pr35430.c b/gcc/testsuite/gcc.dg/pr35430.c
index ab5e4cac8a5..7365ccfcf94 100644
--- a/gcc/testsuite/gcc.dg/pr35430.c
+++ b/gcc/testsuite/gcc.dg/pr35430.c
@@ -6,5 +6,5 @@ void
foo (__complex__ int i)
{
i == 0u;
- i == ~1u; /* { dg-warning "comparison between signed and unsigned integer expressions" } */
+ i == ~1u; /* { dg-warning "comparison of integer expressions of different signedness" } */
}
diff --git a/gcc/testsuite/gcc.dg/pr44290-1.c b/gcc/testsuite/gcc.dg/pr44290-1.c
index c036db654f3..05d2454fc31 100644
--- a/gcc/testsuite/gcc.dg/pr44290-1.c
+++ b/gcc/testsuite/gcc.dg/pr44290-1.c
@@ -1,4 +1,5 @@
-/* { dg-do compile { target arm*-*-* avr-*-* mcore-*-* rx-*-* spu-*-* } } */
+/* { dg-do compile } */
+/* { dg-require-effective-target naked_functions } */
/* { dg-options "-O2 -fdump-tree-optimized" } */
static void __attribute__((naked))
diff --git a/gcc/testsuite/gcc.dg/pr44290-2.c b/gcc/testsuite/gcc.dg/pr44290-2.c
index 17615366267..07335109114 100644
--- a/gcc/testsuite/gcc.dg/pr44290-2.c
+++ b/gcc/testsuite/gcc.dg/pr44290-2.c
@@ -1,4 +1,5 @@
-/* { dg-do compile { target arm*-*-* avr-*-* mcore-*-* rx-*-* spu-*-* } } */
+/* { dg-do compile } */
+/* { dg-require-effective-target naked_functions } */
/* { dg-options "-O2 -fdump-tree-optimized" } */
static unsigned long __attribute__((naked))
diff --git a/gcc/testsuite/gcc.dg/pr46932.c b/gcc/testsuite/gcc.dg/pr46932.c
new file mode 100644
index 00000000000..4eb1a99e1bd
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr46932.c
@@ -0,0 +1,16 @@
+/* { dg-options "-O2 -fdump-rtl-auto_inc_dec" } */
+
+/* Build on targets which have pre increment. */
+/* { dg-do compile { target aarch64*-*-* arm*-*-* rs6000-*-* powerpc*-*-* arc*-*-* m32r-*-* tic6x-*-* } } */
+
+/* Check that accesses based on the frame pointer do not
+ use auto increment. */
+
+extern void foo(char*);
+void t01(char t)
+{
+ char c = t;
+ foo(&c);
+}
+
+/* { dg-final { scan-rtl-dump-not "success" "auto_inc_dec" } } */
diff --git a/gcc/testsuite/gcc.dg/pr56727-1.c b/gcc/testsuite/gcc.dg/pr56727-1.c
new file mode 100644
index 00000000000..ffc133545e7
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr56727-1.c
@@ -0,0 +1,23 @@
+/* { dg-do compile { target fpic } } */
+/* { dg-options "-O2 -fPIC" } */
+/* { dg-final { scan-assembler-not "@(PLT|plt)" { target i?86-*-* x86_64-*-* powerpc*-*-* } } } */
+
+#define define_func(type) \
+ void f_ ## type (type b) { f_ ## type (0); } \
+ void __attribute__((noinline, noclone)) f_noinline_ ## type (type b) \
+ { f_noinline_ ## type (0); }
+
+define_func(char)
+define_func(short)
+define_func(int)
+define_func(long)
+
+int foo(int n)
+{
+ return (n == 1 || n == 2) ? 1 : foo(n-1) * foo(n-2);
+}
+
+int __attribute__((noinline, noclone)) foo_noinline(int n)
+{
+ return (n == 1 || n == 2) ? 1 : foo_noinline(n-1) * foo_noinline(n-2);
+}
diff --git a/gcc/testsuite/gcc.dg/pr56727-2.c b/gcc/testsuite/gcc.dg/pr56727-2.c
new file mode 100644
index 00000000000..62a74d1ea31
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr56727-2.c
@@ -0,0 +1,17 @@
+/* { dg-do compile { target fpic } } */
+/* { dg-options "-O2 -fPIC" } */
+/* { dg-require-alias "" } */
+/* { dg-final { scan-assembler "@(PLT|plt)" { target i?86-*-* x86_64-*-* powerpc*-*-linux* } } } */
+
+__attribute__((noinline, noclone))
+void f (short b)
+{
+ f (0);
+}
+
+static void g (short) __attribute__ ((alias ("f")));
+
+void h ()
+{
+ g (0);
+}
diff --git a/gcc/testsuite/gcc.dg/pr57371-5.c b/gcc/testsuite/gcc.dg/pr57371-5.c
new file mode 100644
index 00000000000..ddad25db622
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr57371-5.c
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-O -fdump-tree-optimized" } */
+/* { dg-require-effective-target dfp } */
+
+/* We do not support DFPs. */
+
+int foo(short x) {
+ /* { dg-final { scan-tree-dump "\\(_Decimal32\\)" "optimized" } } */
+ return (_Decimal32) x != 0;
+}
diff --git a/gcc/testsuite/gcc.dg/pr60087.c b/gcc/testsuite/gcc.dg/pr60087.c
index 9cdd5897354..c6cf7aa4607 100644
--- a/gcc/testsuite/gcc.dg/pr60087.c
+++ b/gcc/testsuite/gcc.dg/pr60087.c
@@ -10,5 +10,5 @@ foo (unsigned int ui, int i)
b = 0 != ~uc; /* { dg-warning "9:promoted ~unsigned is always non-zero" } */
b = 2 != ~uc; /* { dg-warning "9:comparison of promoted ~unsigned with constant" } */
b = uc == ~uc; /* { dg-warning "10:comparison of promoted ~unsigned with unsigned" } */
- b = i == ui; /* { dg-warning "9:comparison between signed and unsigned integer expressions" } */
+ b = i == ui; /* { dg-warning "9:comparison of integer expressions of different signedness" } */
}
diff --git a/gcc/testsuite/gcc.dg/pr61162-2.c b/gcc/testsuite/gcc.dg/pr61162-2.c
index 1045408d736..4aa8493d1a3 100644
--- a/gcc/testsuite/gcc.dg/pr61162-2.c
+++ b/gcc/testsuite/gcc.dg/pr61162-2.c
@@ -8,7 +8,7 @@ struct s { int a; };
enum e
fn1 (void)
{
- return 0; /* { dg-warning "10:enum conversion in return" } */
+ return 0; /* { dg-warning "10:enum conversion from 'int' to 'enum e' in return" } */
}
int
@@ -26,19 +26,19 @@ fn3 (void)
int
fn4 (int *a)
{
- return a; /* { dg-warning "10:return makes integer from pointer without a cast" } */
+ return a; /* { dg-warning "10:returning 'int \\*' from a function with return type 'int' makes integer from pointer without a cast" } */
}
int *
fn5 (int a)
{
- return a; /* { dg-warning "10:return makes pointer from integer without a cast" } */
+ return a; /* { dg-warning "10:returning 'int' from a function with return type 'int \\*' makes pointer from integer without a cast" } */
}
unsigned int *
fn6 (int *i)
{
- return i; /* { dg-warning "10:pointer targets in return differ" } */
+ return i; /* { dg-warning "10:pointer targets in returning 'int \\*' from a function with return type 'unsigned int \\*' differ" } */
}
void *
diff --git a/gcc/testsuite/gcc.dg/pr61162.c b/gcc/testsuite/gcc.dg/pr61162.c
index 8dcb0c8ed40..7ed0741e6c0 100644
--- a/gcc/testsuite/gcc.dg/pr61162.c
+++ b/gcc/testsuite/gcc.dg/pr61162.c
@@ -6,7 +6,7 @@ enum e { A };
enum e
fn1 (void)
{
- enum e e, q = 0; /* { dg-warning "17:enum conversion in initialization is invalid" } */
- e = 0; /* { dg-warning "5:enum conversion in assignment is invalid" } */
- 1; return 0; /* { dg-warning "13:enum conversion in return is invalid" } */
+ enum e e, q = 0; /* { dg-warning "17:enum conversion from 'int' to 'enum e' in initialization is invalid" } */
+ e = 0; /* { dg-warning "5:enum conversion from 'int' to 'enum e' in assignment is invalid" } */
+ 1; return 0; /* { dg-warning "13:enum conversion from 'int' to 'enum e' in return is invalid" } */
}
diff --git a/gcc/testsuite/gcc.dg/pr67730-2.c b/gcc/testsuite/gcc.dg/pr67730-2.c
index 29d726754bf..260cc3e3821 100644
--- a/gcc/testsuite/gcc.dg/pr67730-2.c
+++ b/gcc/testsuite/gcc.dg/pr67730-2.c
@@ -9,14 +9,14 @@ extern void bar (int);
int
fn1 (void)
{
- int a = NULL; /* { dg-warning "initialization makes integer from pointer" } */
- a = NULL; /* { dg-warning "assignment makes integer from pointer" } */
+ int a = NULL; /* { dg-warning "initialization of 'int' from 'void \\*' makes integer from pointer" } */
+ a = NULL; /* { dg-warning "assignment to 'int' from 'void \\*' makes integer from pointer" } */
bar (NULL); /* { dg-warning "passing argument 1" } */
- return NULL; /* { dg-warning "return makes integer from pointer" } */
+ return NULL; /* { dg-warning "returning 'void \\*' from a function with return type 'int' makes integer from pointer" } */
}
int
fn2 (void)
{
- RETURN; /* { dg-warning "return makes integer from pointer" } */
+ RETURN; /* { dg-warning "returning 'void \\*' from a function with return type 'int' makes integer from pointer" } */
}
diff --git a/gcc/testsuite/gcc.dg/pr69156.c b/gcc/testsuite/gcc.dg/pr69156.c
index b22aaec4706..1addfa3f6aa 100644
--- a/gcc/testsuite/gcc.dg/pr69156.c
+++ b/gcc/testsuite/gcc.dg/pr69156.c
@@ -5,6 +5,6 @@
_Bool
foo ()
{
- _Bool (*f) () = __builtin_abs; /* { dg-warning "initialization from incompatible pointer type" } */
+ _Bool (*f) () = __builtin_abs; /* { dg-warning "initialization of '_Bool \\(\\*\\)\\(\\)' from incompatible pointer type" } */
return f (0);
}
diff --git a/gcc/testsuite/gcc.dg/pr70174.c b/gcc/testsuite/gcc.dg/pr70174.c
index 8a3bc904fad..59d231e1623 100644
--- a/gcc/testsuite/gcc.dg/pr70174.c
+++ b/gcc/testsuite/gcc.dg/pr70174.c
@@ -7,5 +7,5 @@ struct S { int f : 4; } a;
void
foo (void)
{
- a.f = foo; /* { dg-warning "assignment makes integer from pointer without a cast" } */
+ a.f = foo; /* { dg-warning "assignment to 'signed char:4' from 'void \\(\\*\\)\\(void\\)' makes integer from pointer without a cast" } */
}
diff --git a/gcc/testsuite/gcc.dg/pr70920-2.c b/gcc/testsuite/gcc.dg/pr70920-2.c
index 2db9897bad5..98072247e94 100644
--- a/gcc/testsuite/gcc.dg/pr70920-2.c
+++ b/gcc/testsuite/gcc.dg/pr70920-2.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-forwprop-details" } */
+/* { dg-options "-O2 -fdump-tree-ccp1-details" } */
#include <stdint.h>
@@ -18,4 +18,4 @@ foo (int *a)
}
}
-/* { dg-final { scan-tree-dump "gimple_simplified to if \\(a_\[0-9\]*\\(D\\) == 0B\\)" "forwprop1" } } */
+/* { dg-final { scan-tree-dump "gimple_simplified to if \\(a_\[0-9\]*\\(D\\) == 0B\\)" "ccp1" } } */
diff --git a/gcc/testsuite/gcc.dg/pr70920-4.c b/gcc/testsuite/gcc.dg/pr70920-4.c
index e9c2b9587e5..70973cb162a 100644
--- a/gcc/testsuite/gcc.dg/pr70920-4.c
+++ b/gcc/testsuite/gcc.dg/pr70920-4.c
@@ -1,6 +1,6 @@
/* { dg-do compile } */
/* { dg-require-effective-target lp64 } */
-/* { dg-options "-O2 -fdump-tree-forwprop-details -Wno-int-to-pointer-cast" } */
+/* { dg-options "-O2 -fdump-tree-ccp1 -Wno-int-to-pointer-cast" } */
#include <stdint.h>
@@ -19,4 +19,4 @@ foo (int a)
}
}
-/* { dg-final { scan-tree-dump "if \\(_\[0-9\]* == 0\\)" "forwprop1" } } */
+/* { dg-final { scan-tree-dump "if \\(a_\[0-9\]*\\(D\\) == 0\\)" "ccp1" } } */
diff --git a/gcc/testsuite/gcc.dg/pr78582.c b/gcc/testsuite/gcc.dg/pr78582.c
index 51e3a1f09ed..6d125cf8bab 100644
--- a/gcc/testsuite/gcc.dg/pr78582.c
+++ b/gcc/testsuite/gcc.dg/pr78582.c
@@ -1,6 +1,7 @@
/* PR target/78582. */
/* { dg-options "-fprofile-generate" } */
/* { dg-do compile } */
+/* { dg-require-effective-target nonlocal_goto } */
#include <setjmp.h>
diff --git a/gcc/testsuite/gcc.dg/pr79499.c b/gcc/testsuite/gcc.dg/pr79499.c
new file mode 100644
index 00000000000..509549ff2fd
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr79499.c
@@ -0,0 +1,13 @@
+/* PR middle-end/79499 */
+/* { dg-do compile { target split_stack } } */
+/* { dg-options "-O2 -fsplit-stack -fno-omit-frame-pointer" } */
+
+struct S { struct S *a, *b; };
+
+void
+foo (struct S *x)
+{
+ do
+ x->b = x->a;
+ while (x = x->a);
+}
diff --git a/gcc/testsuite/gcc.dg/pr81455.c b/gcc/testsuite/gcc.dg/pr81455.c
new file mode 100644
index 00000000000..8ab88639ee8
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr81455.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-options "-O -funswitch-loops" } */
+
+void
+jh (unsigned int aw, int sn)
+{
+ int xs;
+
+ for (xs = 0; xs < 1; ++xs)
+ aw &= 1;
+
+ while (aw < 1 || ++sn < 1)
+ {
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/pr81564.c b/gcc/testsuite/gcc.dg/pr81564.c
new file mode 100644
index 00000000000..13519991f17
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr81564.c
@@ -0,0 +1,21 @@
+/* PR middle-end/81564 ICE in group_case_labels_stmt(). */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+struct a {
+ int b;
+ int c;
+};
+
+void
+foo (void)
+{
+ struct a *e;
+ switch (e->c)
+ {
+ case 7:
+ case 3:
+ if (__builtin_expect(!0, 0))
+ __builtin_unreachable();
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/pr81578.c b/gcc/testsuite/gcc.dg/pr81578.c
new file mode 100644
index 00000000000..a6ef77f20c0
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr81578.c
@@ -0,0 +1,12 @@
+/* PR tree-optimization/81578 */
+/* { dg-do compile { target pthread } } */
+/* { dg-options "-O2 -ftree-parallelize-loops=2" } */
+
+int
+foo (int *x)
+{
+ int i, r = 1;
+ for (i = 0; i != 1024; i++)
+ r *= x[i] < 0;
+ return r;
+}
diff --git a/gcc/testsuite/gcc.dg/pr81588.c b/gcc/testsuite/gcc.dg/pr81588.c
new file mode 100644
index 00000000000..4e83607f2a8
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr81588.c
@@ -0,0 +1,26 @@
+/* PR tree-optimization/81588 */
+/* { dg-do run } */
+/* { dg-options "-O2" } */
+
+long long int a = 5011877430933453486LL, c = 1;
+unsigned short b = 24847;
+
+#include "tree-ssa/pr81588.c"
+
+int
+main ()
+{
+ foo ();
+ if (c != 0)
+ __builtin_abort ();
+ a = 24846;
+ c = 1;
+ foo ();
+ if (c != 1)
+ __builtin_abort ();
+ a = -5;
+ foo ();
+ if (c != 0)
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/pr81621.c b/gcc/testsuite/gcc.dg/pr81621.c
new file mode 100644
index 00000000000..fb41eab8961
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr81621.c
@@ -0,0 +1,5 @@
+/* PR target/81621 */
+/* { dg-do compile { target freorder } } */
+/* { dg-options "-Og -fno-split-wide-types -freorder-blocks-and-partition" } */
+
+#include "graphite/scop-10.c"
diff --git a/gcc/testsuite/gcc.dg/pr81650.c b/gcc/testsuite/gcc.dg/pr81650.c
new file mode 100644
index 00000000000..99e84ded30d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr81650.c
@@ -0,0 +1,9 @@
+/* PR driver/81650 */
+/* { dg-do compile } */
+/* { dg-options "-Walloc-size-larger-than=9223372036854775807" } */
+
+void *
+foo (void)
+{
+ return __builtin_malloc (5);
+}
diff --git a/gcc/testsuite/gcc.dg/pr81695.c b/gcc/testsuite/gcc.dg/pr81695.c
new file mode 100644
index 00000000000..c3452580f1c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr81695.c
@@ -0,0 +1,11 @@
+/* PR middle-end/81695 */
+/* { dg-do compile } */
+/* { dg-options "" } */
+
+int z[] = { };
+
+int
+main (void)
+{
+ __builtin_printf ("%d\n", *(z + 1));
+}
diff --git a/gcc/testsuite/gcc.dg/pr81737.c b/gcc/testsuite/gcc.dg/pr81737.c
new file mode 100644
index 00000000000..493358956ef
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr81737.c
@@ -0,0 +1,6 @@
+/* PR middle-end/81737 */
+/* { dg-do compile } */
+/* { dg-options "" } */
+
+extern int a[];
+void fn1() { (a + 0)[1]; }
diff --git a/gcc/testsuite/gcc.dg/pr81795.c b/gcc/testsuite/gcc.dg/pr81795.c
new file mode 100644
index 00000000000..b035bd0b530
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr81795.c
@@ -0,0 +1,14 @@
+/* PR c/81795 */
+/* { dg-do compile } */
+/* { dg-options "-Wc++-compat" } */
+
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wc++-compat"
+
+struct S { int f; }; /* { dg-bogus "note: originally defined here" } */
+typedef int S; /* { dg-bogus "invalid in C\[+\]\[+\]" } */
+
+typedef int T; /* { dg-bogus "note: originally defined here" } */
+struct T { int f; }; /* { dg-bogus "invalid in C\[+\]\[+\]" } */
+
+#pragma GCC diagnostic pop
diff --git a/gcc/testsuite/gcc.dg/predict-15.c b/gcc/testsuite/gcc.dg/predict-15.c
new file mode 100644
index 00000000000..2a8c3ea8597
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/predict-15.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-profile_estimate" } */
+
+int main(int argc, char **argv)
+{
+ if (argc == 123)
+ goto exit;
+ else
+ {
+ return 0;
+ }
+
+exit:
+ return 1;
+}
+
+/* { dg-final { scan-tree-dump "goto heuristics of edge" "profile_estimate"} } */
diff --git a/gcc/testsuite/gcc.dg/string-opt-1.c b/gcc/testsuite/gcc.dg/string-opt-1.c
index bc0f30098fa..2f060732bf0 100644
--- a/gcc/testsuite/gcc.dg/string-opt-1.c
+++ b/gcc/testsuite/gcc.dg/string-opt-1.c
@@ -1,11 +1,52 @@
-/* Ensure mempcpy is not "optimized" into memcpy followed by addition. */
+/* Ensure mempcpy is "optimized" into memcpy followed by addition. */
/* { dg-do compile } */
/* { dg-options "-O2" } */
-void *
-fn (char *x, char *y, int z)
+char *buffer;
+char *test;
+
+#define SIZE 100
+
+char *
+__attribute__((noinline))
+my_memcpy (char *d, char *s, unsigned l)
+{
+ return __builtin_memcpy (d, s, l);
+}
+
+char *
+__attribute__((noinline))
+my_mempcpy (char *d, char *s, unsigned l)
+{
+ return __builtin_mempcpy (d, s, l);
+}
+
+void
+run_test (char *d, char *s, unsigned l)
{
- return __builtin_mempcpy (x, y, z);
+ char *r = my_mempcpy (d, s, l);
+ if (r != d + l)
+ __builtin_abort ();
+
+ r = my_memcpy (d, s, l);
+ if (r != d)
+ __builtin_abort ();
+}
+
+int
+main (void)
+{
+ const char* const foo = "hello world";
+ unsigned l = __builtin_strlen (foo) + 1;
+
+ buffer = __builtin_malloc (SIZE);
+ __builtin_memcpy (buffer, foo, l);
+ test = __builtin_malloc (SIZE);
+
+ run_test (test, buffer, l);
+
+ return 0;
}
-/* { dg-final { scan-assembler-not "memcpy" } } */
+/* { dg-final { scan-assembler-not "\<mempcpy\>" } } */
+/* { dg-final { scan-assembler "memcpy" } } */
diff --git a/gcc/testsuite/gcc.dg/torture/pr25967-1.c b/gcc/testsuite/gcc.dg/torture/pr25967-1.c
new file mode 100644
index 00000000000..fd26a8b8ce3
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr25967-1.c
@@ -0,0 +1,63 @@
+/* { dg-do run { target i?86-*-* x86_64-*-* } } */
+/* { dg-options "-mgeneral-regs-only" } */
+
+extern void exit (int);
+
+typedef unsigned int uword_t __attribute__ ((mode (__word__)));
+
+#define ERROR 0x12345670
+#define IP 0x12345671
+#define CS 0x12345672
+#define FLAGS 0x12345673
+#define SP 0x12345674
+#define SS 0x12345675
+
+#define STRING(x) XSTRING(x)
+#define XSTRING(x) #x
+#define ASMNAME(cname) ASMNAME2 (__USER_LABEL_PREFIX__, cname)
+#define ASMNAME2(prefix, cname) XSTRING (prefix) cname
+
+struct interrupt_frame
+{
+ uword_t ip;
+ uword_t cs;
+ uword_t flags;
+ uword_t sp;
+ uword_t ss;
+};
+
+__attribute__((naked, used))
+void
+fn (void)
+{
+ register uword_t *sp __asm__("sp");
+ uword_t error = *sp;
+ struct interrupt_frame *frame = (struct interrupt_frame *) (sp + 1);
+ if (ERROR != error) /* BREAK */
+ __builtin_abort ();
+ if (IP != frame->ip)
+ __builtin_abort ();
+ if (CS != frame->cs)
+ __builtin_abort ();
+ if (FLAGS != frame->flags)
+ __builtin_abort ();
+ if (SP != frame->sp)
+ __builtin_abort ();
+ if (SS != frame->ss)
+ __builtin_abort ();
+
+ exit (0);
+}
+
+int
+main ()
+{
+ asm ("push $" STRING (SS) "; \
+ push $" STRING (SP) "; \
+ push $" STRING (FLAGS) "; \
+ push $" STRING (CS) "; \
+ push $" STRING (IP) "; \
+ push $" STRING (ERROR) "; \
+ jmp " ASMNAME ("fn"));
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr25967-2.c b/gcc/testsuite/gcc.dg/torture/pr25967-2.c
new file mode 100644
index 00000000000..4a0dd78c0ad
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr25967-2.c
@@ -0,0 +1,58 @@
+/* { dg-do run { target i?86-*-* x86_64-*-* } } */
+/* { dg-options "-mgeneral-regs-only" } */
+
+extern void exit (int);
+
+typedef unsigned int uword_t __attribute__ ((mode (__word__)));
+
+#define IP 0x12345671
+#define CS 0x12345672
+#define FLAGS 0x12345673
+#define SP 0x12345674
+#define SS 0x12345675
+
+#define STRING(x) XSTRING(x)
+#define XSTRING(x) #x
+#define ASMNAME(cname) ASMNAME2 (__USER_LABEL_PREFIX__, cname)
+#define ASMNAME2(prefix, cname) XSTRING (prefix) cname
+
+struct interrupt_frame
+{
+ uword_t ip;
+ uword_t cs;
+ uword_t flags;
+ uword_t sp;
+ uword_t ss;
+};
+
+__attribute__((naked, used))
+void
+fn (void)
+{
+ register uword_t *sp __asm__("sp");
+ struct interrupt_frame *frame = (struct interrupt_frame *) sp;
+ if (IP != frame->ip) /* BREAK */
+ __builtin_abort ();
+ if (CS != frame->cs)
+ __builtin_abort ();
+ if (FLAGS != frame->flags)
+ __builtin_abort ();
+ if (SP != frame->sp)
+ __builtin_abort ();
+ if (SS != frame->ss)
+ __builtin_abort ();
+
+ exit (0);
+}
+
+int
+main ()
+{
+ asm ("push $" STRING (SS) "; \
+ push $" STRING (SP) "; \
+ push $" STRING (FLAGS) "; \
+ push $" STRING (CS) "; \
+ push $" STRING (IP) "; \
+ jmp " ASMNAME ("fn"));
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr70992-2.c b/gcc/testsuite/gcc.dg/torture/pr70992-2.c
new file mode 100644
index 00000000000..c5d2c5f2683
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr70992-2.c
@@ -0,0 +1,9 @@
+/* PR middle-end/70992 */
+/* { dg-do compile } */
+
+unsigned int *od;
+int
+fn (void)
+{
+ return (0 % 0 + 1) * *od * 2; /* { dg-warning "division by zero" } */
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr70992.c b/gcc/testsuite/gcc.dg/torture/pr70992.c
new file mode 100644
index 00000000000..56728e09d1b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr70992.c
@@ -0,0 +1,41 @@
+/* PR middle-end/70992 */
+/* { dg-do compile } */
+
+typedef unsigned int uint32_t;
+typedef int int32_t;
+
+uint32_t
+fn (uint32_t so)
+{
+ return (so + so) * (0x80000000 / 0 + 1); /* { dg-warning "division by zero" } */
+}
+
+uint32_t
+fn5 (uint32_t so)
+{
+ return (0x80000000 / 0 + 1) * (so + so); /* { dg-warning "division by zero" } */
+}
+
+uint32_t
+fn6 (uint32_t so)
+{
+ return (0x80000000 / 0 - 1) * (so + so); /* { dg-warning "division by zero" } */
+}
+
+uint32_t
+fn2 (uint32_t so)
+{
+ return (so + so) * (0x80000000 / 0 - 1); /* { dg-warning "division by zero" } */
+}
+
+int32_t
+fn3 (int32_t so)
+{
+ return (so + so) * (0x80000000 / 0 + 1); /* { dg-warning "division by zero" } */
+}
+
+int32_t
+fn4 (int32_t so)
+{
+ return (so + so) * (0x80000000 / 0 - 1); /* { dg-warning "division by zero" } */
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr78218.c b/gcc/testsuite/gcc.dg/torture/pr78218.c
index b3e2892429d..fd6ddc9d90d 100644
--- a/gcc/testsuite/gcc.dg/torture/pr78218.c
+++ b/gcc/testsuite/gcc.dg/torture/pr78218.c
@@ -1,15 +1,18 @@
/* { dg-do run } */
-struct
+struct v
{
int v;
-} a[2];
+};
-int b;
+struct v a[2];
+
+struct v *gp;
void __attribute__((noinline,noclone))
-check ()
+check (struct v *p)
{
+ gp = p;
if (a[0].v != 1)
__builtin_abort ();
}
diff --git a/gcc/testsuite/gcc.dg/torture/pr80163.c b/gcc/testsuite/gcc.dg/torture/pr80163.c
index 80cc68dd76d..a9a4438d66f 100644
--- a/gcc/testsuite/gcc.dg/torture/pr80163.c
+++ b/gcc/testsuite/gcc.dg/torture/pr80163.c
@@ -1,5 +1,6 @@
/* PR c/80163 */
/* { dg-do compile { target int128 } } */
+/* { dg-require-effective-target label_values } */
volatile int v;
diff --git a/gcc/testsuite/gcc.dg/torture/pr81181.c b/gcc/testsuite/gcc.dg/torture/pr81181.c
new file mode 100644
index 00000000000..e7216d7bf3e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr81181.c
@@ -0,0 +1,30 @@
+/* { dg-do compile } */
+
+unsigned int lh;
+
+void
+ny (int t3, int ys, int rt, int p8)
+{
+ if (lh != 0)
+ {
+ if (0)
+ {
+oo:
+ do
+ {
+ rt = (p8 != 0) ? t3 : 0;
+ rt = (rt != 0 || lh != (unsigned int)ys);
+ rt += lh + ys;
+ }
+ while (t3 <= 0);
+
+ lh = ys;
+ ys = rt;
+ }
+
+ if (lh != 0)
+ p8 = lh;
+ }
+
+ goto oo;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr81297.c b/gcc/testsuite/gcc.dg/torture/pr81297.c
new file mode 100644
index 00000000000..be346c4c0d1
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr81297.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+
+int
+nf (int gy, int x0)
+{
+ while (gy < 1)
+ ++x0;
+
+ gy += !!gy;
+ if (gy < 0)
+ {
+ x0 += gy;
+ return (x0 > (gy + x0)) ? (1 / 0) : 1; /* { dg-warning "division by zero" } */
+ }
+}
+
diff --git a/gcc/testsuite/gcc.dg/torture/pr81500.c b/gcc/testsuite/gcc.dg/torture/pr81500.c
new file mode 100644
index 00000000000..7aaec2189fc
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr81500.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+
+typedef int a;
+void c(int *b)
+{
+ int d;
+ a e, f, *g, *h = b;
+ for (; d; d--) {
+ f = *g & 1;
+ *h-- = *g-- | e;
+ e = f;
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr81510-2.c b/gcc/testsuite/gcc.dg/torture/pr81510-2.c
new file mode 100644
index 00000000000..7e2bc9866f7
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr81510-2.c
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+
+typedef int h;
+typedef int k;
+int a;
+int b;
+int c;
+int d;
+int e;
+int f(int g)
+{
+ h *i = &e;
+ k *j;
+ if (d -= b)
+ for (; *j; *j += 1) {
+ g = g || (a = e ? c = (__UINTPTR_TYPE__)j : 0) + *i;
+ i = &d;
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr81510.c b/gcc/testsuite/gcc.dg/torture/pr81510.c
new file mode 100644
index 00000000000..c93c4683629
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr81510.c
@@ -0,0 +1,29 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-w" } */
+
+typedef int d;
+typedef int f;
+typedef long h;
+int a;
+int b;
+int c;
+int e()
+{
+ f *g;
+ h i;
+ for (;;)
+ if (g)
+ for (; b; b++) {
+ g = c;
+ if (a &= c) {
+ d *j = &b;
+ h k;
+ for (; i; i++) {
+ *g ?: (*j = k);
+ g = &a;
+ }
+ for (; i <= 3; i++)
+ ;
+ }
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr81571.c b/gcc/testsuite/gcc.dg/torture/pr81571.c
new file mode 100644
index 00000000000..74bceb763ea
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr81571.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+
+int a, b, c, d;
+short fn1(int p1, int p2) { return p1; }
+
+int fn2(int p1) {}
+
+int main()
+{
+ for (; c; c++)
+ a |= fn1(1, a) | fn2(b |= d);
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr81573.c b/gcc/testsuite/gcc.dg/torture/pr81573.c
new file mode 100644
index 00000000000..3930c56386b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr81573.c
@@ -0,0 +1,16 @@
+/* { dg-do run } */
+
+int a = 1, *c = &a, d;
+signed char b;
+
+int main ()
+{
+ for (; b > -27; b--)
+ {
+ *c ^= b;
+ *c ^= 1;
+ }
+ while (a > 1)
+ ;
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/assoc-2.c b/gcc/testsuite/gcc.dg/tree-ssa/assoc-2.c
new file mode 100644
index 00000000000..cc0e9d429b4
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/assoc-2.c
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+/* { dg-options "-O -fdump-tree-gimple-raw -fdump-tree-optimized-raw" } */
+
+int f0(int a, int b){
+ return a * 33 * b * 55;
+}
+
+int f1(int a){
+ a *= 33;
+ return a * 55;
+}
+
+int f2(int a, int b){
+ a *= 33;
+ return a * b * 55;
+}
+
+/* { dg-final { scan-tree-dump-times "mult_expr" 7 "gimple" } } */
+/* { dg-final { scan-tree-dump-times "mult_expr" 5 "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/attr-hotcold-2.c b/gcc/testsuite/gcc.dg/tree-ssa/attr-hotcold-2.c
index 184dd10ddae..17526113d4b 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/attr-hotcold-2.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/attr-hotcold-2.c
@@ -1,8 +1,7 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-profile_estimate-blocks-details" } */
+/* { dg-options "-O2 -fdump-tree-profile_estimate" } */
-void g(void);
-void h(void);
+int v1, v2;
void f(int x, int y)
{
if (x) goto A;
@@ -10,19 +9,19 @@ void f(int x, int y)
return;
A: __attribute__((cold))
- g();
+ v1 = x;
return;
B: __attribute__((hot))
- h();
+ v2 = y;
return;
}
/* { dg-final { scan-tree-dump-times "hot label heuristics" 1 "profile_estimate" } } */
/* { dg-final { scan-tree-dump-times "cold label heuristics" 1 "profile_estimate" } } */
-/* { dg-final { scan-tree-dump "A \\\[0\\\..*\\\]" "profile_estimate" } } */
+/* { dg-final { scan-tree-dump-times "combined heuristics: 0\\\..*" 1 "profile_estimate" } } */
/* Note: we're attempting to match some number > 6000, i.e. > 60%.
The exact number ought to be tweekable without having to juggle
the testcase around too much. */
-/* { dg-final { scan-tree-dump "B \\\[\[6-9\]\[0-9\]\\\..*\\\]" "profile_estimate" } } */
+/* { dg-final { scan-tree-dump-times "combined heuristics: \[6-9\]\[0-9\]\\\..*" 1 "profile_estimate" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr81388-1.c b/gcc/testsuite/gcc.dg/tree-ssa/pr81388-1.c
index ecfe12929cc..0beb5109d40 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/pr81388-1.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr81388-1.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -fno-strict-overflow -fdump-tree-ivcanon-details" } */
+/* { dg-options "-O2 -fno-strict-overflow -fdump-tree-tailc-details" } */
void bar();
void foo(char *dst)
@@ -11,4 +11,6 @@ void foo(char *dst)
} while (dst < end);
}
-/* { dg-final { scan-tree-dump-times " zero if " 1 "ivcanon" } } */
+/* The loop only iterates once because pointer overflow always has undefined
+ semantics. As a result, call to bar becomes tail call. */
+/* { dg-final { scan-tree-dump-times "Found tail call " 1 "tailc" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr81588.c b/gcc/testsuite/gcc.dg/tree-ssa/pr81588.c
new file mode 100644
index 00000000000..2709abd89a1
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr81588.c
@@ -0,0 +1,15 @@
+/* PR tree-optimization/81588 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-reassoc1-details" } */
+
+extern long long int a, c;
+extern unsigned short b;
+
+/* { dg-final { scan-tree-dump-times "Optimizing range test \[^\n\r]* and comparison" 1 "reassoc1" } } */
+
+__attribute__((noinline, noclone)) void
+foo (void)
+{
+ if ((b > a) != (1 + (a < 0)))
+ c = 0;
+}
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr81620-1.c b/gcc/testsuite/gcc.dg/tree-ssa/pr81620-1.c
new file mode 100644
index 00000000000..f8f2dd8ad6c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr81620-1.c
@@ -0,0 +1,20 @@
+/* { dg-do run } */
+/* { dg-options "-O3 -fno-tree-loop-vectorize -fdump-tree-pcom-details" } */
+
+int a[7];
+char b;
+void abort (void);
+
+int main() {
+ b = 4;
+ for (; b; b--) {
+ a[b] = b;
+ a[b + 2] = 1;
+ }
+ if (a[0] != 0 || a[1] != 1 || a[2] != 2
+ || a[3] != 1 || a[4] != 1 || a[5] != 1 || a[6] != 1)
+ abort ();
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "Store-stores chain" 1 "pcom" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr81620-2.c b/gcc/testsuite/gcc.dg/tree-ssa/pr81620-2.c
new file mode 100644
index 00000000000..85a8e350840
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr81620-2.c
@@ -0,0 +1,25 @@
+/* { dg-do run } */
+/* { dg-options "-O3 -fno-tree-loop-vectorize -fdump-tree-pcom-details" } */
+
+int a[200];
+char b;
+void abort (void);
+
+int main() {
+ int i;
+ b = 100;
+ for (; b; b--) {
+ a[b] = 2;
+ a[b + 2] = 1;
+ }
+
+ if (a[0] != 0 || a[1] != 2 || a[2] != 2)
+ abort ();
+ for (i = 3; i < 103; i++)
+ if (a[i] != 1)
+ abort ();
+
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "Store-stores chain" 1 "pcom" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr81627.c b/gcc/testsuite/gcc.dg/tree-ssa/pr81627.c
new file mode 100644
index 00000000000..9ba43be5052
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr81627.c
@@ -0,0 +1,28 @@
+/* { dg-do run } */
+/* { dg-options "-O3 -fno-tree-loop-vectorize -fdump-tree-pcom-details" } */
+
+int a, b, c, d[6], e = 3, f;
+
+void abort (void);
+void fn1 ()
+{
+ for (b = 1; b < 5; b++)
+ {
+ for (c = 0; c < 5; c++)
+ d[b] = e;
+ if (a)
+ f++;
+ d[b + 1] = 1;
+ }
+}
+
+int main ()
+{
+ fn1 ();
+ if (d[0] != 0 || d[1] != 3 || d[2] != 3
+ || d[3] != 3 || d[4] != 3 || d[5] != 1)
+ abort ();
+
+ return 0;
+}
+/* { dg-final { scan-tree-dump-times "Store-stores chain" 1 "pcom" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr81744.c b/gcc/testsuite/gcc.dg/tree-ssa/pr81744.c
new file mode 100644
index 00000000000..b0f5d38ff93
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr81744.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -fno-tree-loop-vectorize -fno-tree-slp-vectorize -fno-inline -fdump-tree-pcom-details" } */
+
+typedef struct {
+ int a, b;
+} CompandSegment;
+int a;
+CompandSegment *b;
+void fn1() {
+ for (; a; a++)
+ b[a].a = b[a].b = b[a - 1].a = b[a - 1].b = 0;
+}
+/* { dg-final { scan-tree-dump-times "Store-stores chain" 2 "pcom"} } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/predcom-dse-1.c b/gcc/testsuite/gcc.dg/tree-ssa/predcom-dse-1.c
new file mode 100644
index 00000000000..d3a2339e55e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/predcom-dse-1.c
@@ -0,0 +1,62 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -fno-inline -fpredictive-commoning -fdump-tree-pcom-details" } */
+
+int arr[105] = {2, 3, 5, 7, 11};
+int result0[10] = {2, 3, 5, 7, 11};
+int result1[10] = {0, -1, 5, -2, 11, 0};
+int result2[10] = {0, 0, -1, -2, -2, 0};
+int result3[10] = {0, 0, 0, -1, -2, -2, 0};
+int result4[10] = {0, 0, 0, 0, -1, -2, -2, 0};
+int result100[105] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -2, -2, 0};
+
+extern void abort (void);
+
+void __attribute__((noinline)) foo (int *a, int len)
+{
+ int i;
+ for (i = 0; i < len; i++)
+ {
+ a[i] = 0;
+ a[i + 1] = -1;
+ a[i + 3] = -2;
+ }
+}
+
+void check (int *a, int *res, int len)
+{
+ int i;
+
+ for (i = 0; i < len; i++)
+ if (a[i] != res[i])
+ abort ();
+}
+
+int main (void)
+{
+ foo (arr, 0);
+ check (arr, result0, 10);
+
+ foo (arr, 1);
+ check (arr, result1, 10);
+
+ foo (arr, 2);
+ check (arr, result2, 10);
+
+ foo (arr, 3);
+ check (arr, result3, 10);
+
+ foo (arr, 4);
+ check (arr, result4, 10);
+
+ foo (arr, 100);
+ check (arr, result100, 105);
+
+ return 0;
+}
+/* { dg-final { scan-tree-dump "Store-stores chain" "pcom"} } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/predcom-dse-10.c b/gcc/testsuite/gcc.dg/tree-ssa/predcom-dse-10.c
new file mode 100644
index 00000000000..bd5575d9502
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/predcom-dse-10.c
@@ -0,0 +1,44 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -fno-inline -fpredictive-commoning -fdump-tree-pcom-details" } */
+
+int arr[105] = {2, 3, 5, 7, 11};
+int result0[10] = {2, 3, 5, 7, 11};
+int result1[10] = {0, 3, 5, -2, 11, 0};
+
+extern void abort (void);
+
+void __attribute__((noinline)) foo (int *a, int len, int flag)
+{
+ int i;
+ for (i = 0; i < len; i++)
+ {
+ a[i] = 0;
+ if (flag)
+ a[i + 1] = -1;
+ a[i + 3] = -2;
+ }
+}
+
+void check (int *a, int *res, int len)
+{
+ int i;
+
+ for (i = 0; i < len; i++)
+ if (a[i] != res[i])
+ abort ();
+}
+
+int main (void)
+{
+ int i;
+
+ foo (arr, 0, 0);
+ check (arr, result0, 10);
+
+ foo (arr, 1, 0);
+ check (arr, result1, 10);
+
+ return 0;
+}
+/* { dg-final { scan-tree-dump-not "Store-stores chain" "pcom"} } */
+
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/predcom-dse-11.c b/gcc/testsuite/gcc.dg/tree-ssa/predcom-dse-11.c
new file mode 100644
index 00000000000..9e496f68a12
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/predcom-dse-11.c
@@ -0,0 +1,51 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -fno-inline -fpredictive-commoning -fdump-tree-pcom-details" } */
+
+int arr[105] = {2, 3, 5, 7, 11};
+int x[105] = {2, 3, 5, 7, 11};
+int result0[10] = {2, 3, 5, 7, 11};
+int result1[10] = {0, 0, 0, 0, 0, 0, -1, -2, -2};
+
+extern void abort (void);
+
+int __attribute__((noinline)) foo (int * __restrict__ a, int * __restrict__ b, int len, int flag)
+{
+ int i, sum = 0;
+ for (i = 0; i < len; i++)
+ {
+ a[i] = 0;
+ b[i + 2] = i;
+ a[i + 1] = -1;
+ sum += b[i];
+ a[i + 3] = -2;
+ }
+ return sum;
+}
+
+void check (int *a, int *res, int len, int sum, int val)
+{
+ int i;
+
+ if (sum != val)
+ abort ();
+
+ for (i = 0; i < len; i++)
+ if (a[i] != res[i])
+ abort ();
+}
+
+int main (void)
+{
+ int i, sum;
+
+ sum = foo (arr, x, 0, 0);
+ check (arr, result0, 10, sum, 0);
+
+ sum = foo (arr, x, 6, 0);
+ check (arr, result1, 10, sum, 11);
+
+ return 0;
+}
+/* { dg-final { scan-tree-dump "Store-stores chain" "pcom"} } */
+/* { dg-final { scan-tree-dump "Store-loads chain" "pcom"} } */
+
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/predcom-dse-2.c b/gcc/testsuite/gcc.dg/tree-ssa/predcom-dse-2.c
new file mode 100644
index 00000000000..c48d438e9e0
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/predcom-dse-2.c
@@ -0,0 +1,62 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -fno-inline -fpredictive-commoning -fdump-tree-pcom-details" } */
+
+int arr[105] = {2, 3, 5, 7, 11};
+int result0[10] = {2, 3, 5, 7, 11};
+int result1[10] = {0, 3, -1, -2, 11, 0};
+int result2[10] = {0, 0, -1, -1, -2, 0};
+int result3[10] = {0, 0, 0, -1, -1, -2, 0};
+int result4[10] = {0, 0, 0, 0, -1, -1, -2, 0};
+int result100[105] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -2, 0};
+
+extern void abort (void);
+
+void __attribute__((noinline)) foo (int *a, int len)
+{
+ int i;
+ for (i = 0; i < len; i++)
+ {
+ a[i] = 0;
+ a[i + 2] = -1;
+ a[i + 3] = -2;
+ }
+}
+
+void check (int *a, int *res, int len)
+{
+ int i;
+
+ for (i = 0; i < len; i++)
+ if (a[i] != res[i])
+ abort ();
+}
+
+int main (void)
+{
+ foo (arr, 0);
+ check (arr, result0, 10);
+
+ foo (arr, 1);
+ check (arr, result1, 10);
+
+ foo (arr, 2);
+ check (arr, result2, 10);
+
+ foo (arr, 3);
+ check (arr, result3, 10);
+
+ foo (arr, 4);
+ check (arr, result4, 10);
+
+ foo (arr, 100);
+ check (arr, result100, 105);
+
+ return 0;
+}
+/* { dg-final { scan-tree-dump "Store-stores chain" "pcom"} } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/predcom-dse-3.c b/gcc/testsuite/gcc.dg/tree-ssa/predcom-dse-3.c
new file mode 100644
index 00000000000..9c2736cd0ad
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/predcom-dse-3.c
@@ -0,0 +1,108 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -fno-inline -fpredictive-commoning -fdump-tree-pcom-details" } */
+
+int arr1[105] = {2, 3, 5, 7, 11, 13, 0};
+int arr2[105] = {2, 3, 5, 7, 11, 13, 0};
+int arr3[105] = {2, 3, 5, 7, 11, 13, 0};
+int arr4[105] = {2, 3, 5, 7, 11, 13, 0};
+int result1[105] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -2, -3, 0};
+int result2[105] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -2, 0};
+int result3[105] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -2, -2, 0};
+int result4[105] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, 0};
+
+extern void abort (void);
+
+void check (int *a, int *res, int len)
+{
+ int i;
+
+ for (i = 0; i < len; i++)
+ if (a[i] != res[i])
+ abort ();
+}
+
+void __attribute__((noinline)) foo1 (int *a)
+{
+ int i;
+ for (i = 0; i < 100; i++)
+ {
+ a[i] = 0;
+ a[i + 1] = -1;
+ a[i + 2] = -2;
+ a[i + 3] = -3;
+ }
+}
+
+void __attribute__((noinline)) foo2 (int *a)
+{
+ int i;
+ for (i = 0; i < 100; i++)
+ {
+ a[i] = 0;
+ a[i + 2] = -1;
+ a[i + 3] = -2;
+ }
+}
+
+void __attribute__((noinline)) foo3 (int *a)
+{
+ int i;
+ for (i = 0; i < 100; i++)
+ {
+ a[i] = 0;
+ a[i + 1] = -1;
+ a[i + 3] = -2;
+ }
+}
+
+void __attribute__((noinline)) foo4 (int *a)
+{
+ int i;
+ for (i = 0; i < 100; i++)
+ {
+ a[i] = 0;
+ a[i + 3] = -1;
+ }
+}
+
+int main (void)
+{
+ foo1 (arr1);
+ check (arr1, result1, 105);
+
+ foo2 (arr2);
+ check (arr2, result2, 105);
+
+ foo3 (arr3);
+ check (arr3, result3, 105);
+
+ foo4 (arr4);
+ check (arr4, result4, 105);
+
+ return 0;
+}
+/* { dg-final { scan-tree-dump-times "Store-stores chain" 4 "pcom"} } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/predcom-dse-4.c b/gcc/testsuite/gcc.dg/tree-ssa/predcom-dse-4.c
new file mode 100644
index 00000000000..302425a17cc
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/predcom-dse-4.c
@@ -0,0 +1,61 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -fno-inline -fpredictive-commoning -fdump-tree-pcom-details" } */
+
+int arr[105] = {2, 3, 5, 7, 11};
+int result0[10] = {2, 3, 5, 7, 11};
+int result1[10] = {0, 3, 5, -1, 11, 0};
+int result2[10] = {0, 0, 5, -1, -1, 0};
+int result3[10] = {0, 0, 0, -1, -1, -1, 0};
+int result4[10] = {0, 0, 0, 0, -1, -1, -1, 0};
+int result100[105] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, 0};
+
+extern void abort (void);
+
+void __attribute__((noinline)) foo (int *a, int len)
+{
+ int i;
+ for (i = 0; i < len; i++)
+ {
+ a[i] = 0;
+ a[i + 3] = -1;
+ }
+}
+
+void check (int *a, int *res, int len)
+{
+ int i;
+
+ for (i = 0; i < len; i++)
+ if (a[i] != res[i])
+ abort ();
+}
+
+int main (void)
+{
+ foo (arr, 0);
+ check (arr, result0, 10);
+
+ foo (arr, 1);
+ check (arr, result1, 10);
+
+ foo (arr, 2);
+ check (arr, result2, 10);
+
+ foo (arr, 3);
+ check (arr, result3, 10);
+
+ foo (arr, 4);
+ check (arr, result4, 10);
+
+ foo (arr, 100);
+ check (arr, result100, 105);
+
+ return 0;
+}
+/* { dg-final { scan-tree-dump "Store-stores chain" "pcom"} } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/predcom-dse-5.c b/gcc/testsuite/gcc.dg/tree-ssa/predcom-dse-5.c
new file mode 100644
index 00000000000..a13d56098be
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/predcom-dse-5.c
@@ -0,0 +1,63 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -fno-inline -fpredictive-commoning -fdump-tree-pcom-details" } */
+
+int arr[105] = {2, 3, 5, 7, 11};
+int result0[10] = {2, 3, 5, 7, 11};
+int result1[10] = {0, -1, -2, -3, 11, 0};
+int result2[10] = {0, 0, -1, -2, -3, 0};
+int result3[10] = {0, 0, 0, -1, -2, -3, 0};
+int result4[10] = {0, 0, 0, 0, -1, -2, -3, 0};
+int result100[105] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -2, -3, 0};
+
+extern void abort (void);
+
+void __attribute__((noinline)) foo (int *a, int len)
+{
+ int i;
+ for (i = 0; i < len; i++)
+ {
+ a[i] = 0;
+ a[i + 1] = -1;
+ a[i + 2] = -2;
+ a[i + 3] = -3;
+ }
+}
+
+void check (int *a, int *res, int len)
+{
+ int i;
+
+ for (i = 0; i < len; i++)
+ if (a[i] != res[i])
+ abort ();
+}
+
+int main (void)
+{
+ foo (arr, 0);
+ check (arr, result0, 10);
+
+ foo (arr, 1);
+ check (arr, result1, 10);
+
+ foo (arr, 2);
+ check (arr, result2, 10);
+
+ foo (arr, 3);
+ check (arr, result3, 10);
+
+ foo (arr, 4);
+ check (arr, result4, 10);
+
+ foo (arr, 100);
+ check (arr, result100, 105);
+
+ return 0;
+}
+/* { dg-final { scan-tree-dump "Store-stores chain" "pcom"} } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/predcom-dse-6.c b/gcc/testsuite/gcc.dg/tree-ssa/predcom-dse-6.c
new file mode 100644
index 00000000000..63d6c8f33b0
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/predcom-dse-6.c
@@ -0,0 +1,65 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -fno-inline -fpredictive-commoning -fdump-tree-pcom-details" } */
+
+int arr[105] = {2, 3, 5, 7, 11, 13, 17, 19};
+int result0[10] = {2, 3, 5, 7, 11, 13, 17, 19};
+int result1[10] = {0, -1, -2, -3, -4, -5, 17, 19};
+int result2[10] = {0, 0, -1, -2, -3, -4, -5, 19};
+int result3[10] = {0, 0, 0, -1, -2, -3, -4, -5};
+int result4[10] = {0, 0, 0, 0, -1, -2, -3, -4, -5};
+int result100[105] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -2, -3, -4, -5};
+
+extern void abort (void);
+
+void __attribute__((noinline)) foo (int *a, int len)
+{
+ int i;
+ for (i = 0; i < len; i++)
+ {
+ a[i] = 0;
+ a[i + 1] = -1;
+ a[i + 2] = -2;
+ a[i + 3] = -3;
+ a[i + 4] = -4;
+ a[i + 5] = -5;
+ }
+}
+
+void check (int *a, int *res, int len)
+{
+ int i;
+
+ for (i = 0; i < len; i++)
+ if (a[i] != res[i])
+ abort ();
+}
+
+int main (void)
+{
+ foo (arr, 0);
+ check (arr, result0, 10);
+
+ foo (arr, 1);
+ check (arr, result1, 10);
+
+ foo (arr, 2);
+ check (arr, result2, 10);
+
+ foo (arr, 3);
+ check (arr, result3, 10);
+
+ foo (arr, 4);
+ check (arr, result4, 10);
+
+ foo (arr, 100);
+ check (arr, result100, 105);
+
+ return 0;
+}
+/* { dg-final { scan-tree-dump "Store-stores chain" "pcom"} } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/predcom-dse-7.c b/gcc/testsuite/gcc.dg/tree-ssa/predcom-dse-7.c
new file mode 100644
index 00000000000..0bde6e6dced
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/predcom-dse-7.c
@@ -0,0 +1,63 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -fno-inline -fpredictive-commoning -fdump-tree-pcom-details" } */
+
+int arr[105] = {2, 3, 5, 7, 11, 13, 17, 19};
+int result0[10] = {2, 3, 5, 7, 11, 13, 17, 19};
+int result1[10] = {0, -1, 5, -3, 11, -5, 17, 19};
+int result2[10] = {0, 0, -1, -3, -3, -5, -5, 19};
+int result3[10] = {0, 0, 0, -1, -3, -3, -5, -5};
+int result4[10] = {0, 0, 0, 0, -1, -3, -3, -5, -5};
+int result100[105] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -3, -3, -5, -5};
+
+extern void abort (void);
+
+void __attribute__((noinline)) foo (int *a, int len)
+{
+ int i;
+ for (i = 0; i < len; i++)
+ {
+ a[i] = 0;
+ a[i + 1] = -1;
+ a[i + 3] = -3;
+ a[i + 5] = -5;
+ }
+}
+
+void check (int *a, int *res, int len)
+{
+ int i;
+
+ for (i = 0; i < len; i++)
+ if (a[i] != res[i])
+ abort ();
+}
+
+int main (void)
+{
+ foo (arr, 0);
+ check (arr, result0, 10);
+
+ foo (arr, 1);
+ check (arr, result1, 10);
+
+ foo (arr, 2);
+ check (arr, result2, 10);
+
+ foo (arr, 3);
+ check (arr, result3, 10);
+
+ foo (arr, 4);
+ check (arr, result4, 10);
+
+ foo (arr, 100);
+ check (arr, result100, 105);
+
+ return 0;
+}
+/* { dg-final { scan-tree-dump "Store-stores chain" "pcom"} } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/predcom-dse-8.c b/gcc/testsuite/gcc.dg/tree-ssa/predcom-dse-8.c
new file mode 100644
index 00000000000..45ffd25c424
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/predcom-dse-8.c
@@ -0,0 +1,60 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -fno-inline -fpredictive-commoning -fdump-tree-pcom-details" } */
+
+int arr[105] = {2, 3, 5, 7, 11, 13, 17, 19};
+int result0[10] = {2, 3, 5, 7, 11, 13, 17, 19};
+int result1[10] = {0, 3, 5, 7, 11, -5, 17, 19};
+int result2[10] = {0, 0, 5, 7, 11, -5, -5, 19};
+int result3[10] = {0, 0, 0, 7, 11, -5, -5, -5};
+int result4[10] = {0, 0, 0, 0, 11, -5, -5, -5, -5};
+int result100[105] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -5, -5, -5, -5, -5};
+
+extern void abort (void);
+
+void __attribute__((noinline)) foo (int *a, int len)
+{
+ int i;
+ for (i = 0; i < len; i++)
+ {
+ a[i] = 0;
+ a[i + 5] = -5;
+ }
+}
+
+void check (int *a, int *res, int len)
+{
+ int i;
+
+ for (i = 0; i < len; i++)
+ if (a[i] != res[i])
+ abort ();
+}
+
+int main (void)
+{
+ foo (arr, 0);
+ check (arr, result0, 10);
+
+ foo (arr, 1);
+ check (arr, result1, 10);
+
+ foo (arr, 2);
+ check (arr, result2, 10);
+
+ foo (arr, 3);
+ check (arr, result3, 10);
+
+ foo (arr, 4);
+ check (arr, result4, 10);
+
+ foo (arr, 100);
+ check (arr, result100, 105);
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/predcom-dse-9.c b/gcc/testsuite/gcc.dg/tree-ssa/predcom-dse-9.c
new file mode 100644
index 00000000000..1c4e3140309
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/predcom-dse-9.c
@@ -0,0 +1,90 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -fno-inline -fpredictive-commoning -fdump-tree-pcom-details" } */
+
+int arr1[105] = {2, 3, 5, 7, 11, 13, 17, 19};
+int arr2[105] = {2, 3, 5, 7, 11, 13, 17, 19};
+int arr3[105] = {2, 3, 5, 7, 11, 13, 17, 19};
+
+int result1[105] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -2, -3, -4, -5};
+int result2[105] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -3, -3, -5, -5};
+int result3[105] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -5, -5, -5, -5, -5};
+
+extern void abort (void);
+
+void __attribute__((noinline)) foo1 (int *a)
+{
+ int i;
+ for (i = 0; i < 100; i++)
+ {
+ a[i] = 0;
+ a[i + 1] = -1;
+ a[i + 2] = -2;
+ a[i + 3] = -3;
+ a[i + 4] = -4;
+ a[i + 5] = -5;
+ }
+}
+
+void __attribute__((noinline)) foo2 (int *a)
+{
+ int i;
+ for (i = 0; i < 100; i++)
+ {
+ a[i] = 0;
+ a[i + 1] = -1;
+ a[i + 3] = -3;
+ a[i + 5] = -5;
+ }
+}
+
+void __attribute__((noinline)) foo3 (int *a)
+{
+ int i;
+ for (i = 0; i < 100; i++)
+ {
+ a[i] = 0;
+ a[i + 5] = -5;
+ }
+}
+
+void check (int *a, int *res, int len)
+{
+ int i;
+
+ for (i = 0; i < len; i++)
+ if (a[i] != res[i])
+ abort ();
+}
+
+int main (void)
+{
+ foo1 (arr1);
+ check (arr1, result1, 10);
+
+ foo2 (arr2);
+ check (arr2, result2, 10);
+
+ foo3 (arr3);
+ check (arr3, result3, 10);
+
+ return 0;
+}
+/* { dg-final { scan-tree-dump "Store-stores chain" "pcom"} } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/reassoc-23.c b/gcc/testsuite/gcc.dg/tree-ssa/reassoc-23.c
index 0ab967d20ab..a5451ade6ef 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/reassoc-23.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/reassoc-23.c
@@ -6,9 +6,10 @@ foo(unsigned int a, unsigned int b, unsigned int c, unsigned int d,
unsigned int e, unsigned int f, unsigned int g, unsigned int h)
{
/* Should be transformed into e = 20 */
- unsigned int i = (a + 9) + (c + 8);
- unsigned int j = (-c + 1) + (-a + 2);
-
+ unsigned int i = (a + 9);
+ unsigned int j = (-c + 1);
+ i += (c + 8);
+ j += (-a + 2);
e = i + j;
return e;
}
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/slsr-4.c b/gcc/testsuite/gcc.dg/tree-ssa/slsr-4.c
index 17d7b4c6951..1e943b737b9 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/slsr-4.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/slsr-4.c
@@ -23,13 +23,9 @@ f (int i)
foo (y);
}
-/* { dg-final { scan-tree-dump-times "\\* 4" 1 "slsr" } } */
-/* { dg-final { scan-tree-dump-times "\\* 10" 1 "slsr" } } */
-/* { dg-final { scan-tree-dump-times "\\+ 20;" 1 "slsr" } } */
+/* { dg-final { scan-tree-dump-times "\\* 40" 1 "slsr" } } */
/* { dg-final { scan-tree-dump-times "\\+ 200" 1 "slsr" } } */
-/* { dg-final { scan-tree-dump-times "\\- 16;" 1 "slsr" } } */
/* { dg-final { scan-tree-dump-times "\\- 160" 1 "slsr" } } */
-/* { dg-final { scan-tree-dump-times "\\* 4" 1 "optimized" } } */
-/* { dg-final { scan-tree-dump-times "\\* 10" 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "\\* 40" 1 "optimized" } } */
/* { dg-final { scan-tree-dump-times "\\+ 200" 1 "optimized" } } */
/* { dg-final { scan-tree-dump-times "\\+ 40" 1 "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/split-path-5.c b/gcc/testsuite/gcc.dg/tree-ssa/split-path-5.c
index 5044c7301a1..95aabdaf6be 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/split-path-5.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/split-path-5.c
@@ -41,20 +41,4 @@ bmhi_init (const char *pattern)
}
}
-char *
-bmhi_search (const char *string, const int stringlen)
-{
- int i, j;
- char *s;
- for (;;)
- {
- while (--j >= 0 && (
- {
- __typeof__ (s[j]) __x = (s[j]);
- ((((__ctype_ptr__ +
- sizeof (""[__x]))[(int) (__x)]) &
- (01 | 02)) ==
- 02) ? (int) __x - 'a' +
- 'A' : (int) __x;}) == pat[j]);
-}}
-/* { dg-final { scan-tree-dump-times "Duplicating join block" 2 "split-paths" } } */
+/* { dg-final { scan-tree-dump-times "Duplicating join block" 1 "split-paths" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dce-3.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dce-3.c
index 64b30ca1eb3..863aa79b4eb 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dce-3.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dce-3.c
@@ -26,9 +26,6 @@ int main(void)
by marking the j % 7 condition as useful. See PR45178. */
/* We should eliminate the inner condition, but the loop must be preserved
- as it is infinite. Therefore there should be just one phi node (for i): */
-/* { dg-final { scan-tree-dump-times "PHI " 1 "cddce1" { xfail *-*-* } } } */
-
-/* And one if (for the exit condition of the loop): */
-/* { dg-final { scan-tree-dump-times "if " 1 "cddce1" } } */
-
+ as it is infinite. Therefore there should be just one goto and no PHI. */
+/* { dg-final { scan-tree-dump-times "PHI " 0 "cddce1" } } */
+/* { dg-final { scan-tree-dump-times "goto" 1 "cddce1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp24.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp24.c
index 853ee21bb8f..ed49e25f87a 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/vrp24.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp24.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -fno-tree-forwprop -fdump-tree-vrp1-details" } */
+/* { dg-options "-O2 -fno-tree-forwprop -fdump-tree-vrp1-details -fdump-tree-optimized" } */
struct rtx_def;
@@ -86,10 +86,8 @@ L7:
/* The first n_sets > 0 test can be simplfiied into n_sets == 1 since
n_sets can only have the values [0, 1] as it's the result of a
- boolean operation.
+ boolean operation. */
- The second n_sets > 0 test can also be simplified into n_sets == 1
- as the only way to reach the tests is when n_sets <= 1 and the only
- value which satisfies both conditions is n_sets == 1. */
-/* { dg-final { scan-tree-dump-times "Simplified relational" 2 "vrp1" } } */
+/* { dg-final { scan-tree-dump-times "Simplified relational" 1 "vrp1" } } */
+/* { dg-final { scan-tree-dump-times "if " 4 "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/ubsan/pr81505.c b/gcc/testsuite/gcc.dg/ubsan/pr81505.c
new file mode 100644
index 00000000000..1cebef56172
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ubsan/pr81505.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -fsanitize=signed-integer-overflow" } */
+
+int a, b, c, h;
+
+int i[5][5];
+
+void
+fn1 ()
+{
+ int l = 0;
+
+ for (a = 0; a <= 3; a++)
+ for (b = 1; b >= 0; b -= 1)
+ l |= i[0][b];
+ c = l;
+}
diff --git a/gcc/testsuite/gcc.dg/unclosed-init.c b/gcc/testsuite/gcc.dg/unclosed-init.c
new file mode 100644
index 00000000000..c0e4dd8da9b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/unclosed-init.c
@@ -0,0 +1,3 @@
+int unclosed[] = { /* { dg-message "18: to match this '.'" } */
+ 42
+ /* { dg-error "0: expected '.' at end of input" } */
diff --git a/gcc/testsuite/gcc.dg/uninit-23.c b/gcc/testsuite/gcc.dg/uninit-23.c
index b38e1d08eab..d64eb7d2ee9 100644
--- a/gcc/testsuite/gcc.dg/uninit-23.c
+++ b/gcc/testsuite/gcc.dg/uninit-23.c
@@ -15,10 +15,10 @@ ql (void)
for (;;)
{
int *go;
- int *t4 = go;
+ int *t4 = go; /* { dg-warning "is used uninitialized" } */
l1:
- *t4 = (*t4 != 0) ? 0 : 2; /* { dg-warning "may be used uninitialized" } */
+ *t4 = (*t4 != 0) ? 0 : 2;
}
if (ij != 0)
diff --git a/gcc/testsuite/gcc.dg/vect/no-section-anchors-vect-69.c b/gcc/testsuite/gcc.dg/vect/no-section-anchors-vect-69.c
index fe968de3432..1458ba60426 100644
--- a/gcc/testsuite/gcc.dg/vect/no-section-anchors-vect-69.c
+++ b/gcc/testsuite/gcc.dg/vect/no-section-anchors-vect-69.c
@@ -1,5 +1,6 @@
/* { dg-require-effective-target vect_int } */
/* { dg-add-options bind_pic_locally } */
+/* { dg-additional-options "--param vect-max-peeling-for-alignment=0" } */
#include <stdarg.h>
#include "tree-vect.h"
@@ -114,7 +115,4 @@ int main (void)
}
/* { dg-final { scan-tree-dump-times "vectorized 4 loops" 1 "vect" } } */
-/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" } } */
-/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 2 "vect" { xfail { {! vector_alignment_reachable} || { vect_sizes_32B_16B} } } } } */
/* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning" 1 "vect" { target { {! vector_alignment_reachable} && {! vect_hw_misalign} } } } } */
-/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 1 "vect" { target { {! vector_alignment_reachable} && {! vect_hw_misalign} } } } } */
diff --git a/gcc/testsuite/gcc.dg/vect/pr80815-3.c b/gcc/testsuite/gcc.dg/vect/pr80815-3.c
index dae01fa7af7..50392ab1a41 100644
--- a/gcc/testsuite/gcc.dg/vect/pr80815-3.c
+++ b/gcc/testsuite/gcc.dg/vect/pr80815-3.c
@@ -42,4 +42,4 @@ int main (void)
return 0;
}
-/* { dg-final { scan-tree-dump "improved number of alias checks from \[0-9\]* to 1" "vect" } } */
+/* { dg-final { scan-tree-dump "improved number of alias checks from \[0-9\]* to 1" "vect" { target vect_perm } } } */
diff --git a/gcc/testsuite/gcc.dg/vect/pr81136.c b/gcc/testsuite/gcc.dg/vect/pr81136.c
index 24bd8fa3b19..c67357684df 100644
--- a/gcc/testsuite/gcc.dg/vect/pr81136.c
+++ b/gcc/testsuite/gcc.dg/vect/pr81136.c
@@ -14,3 +14,5 @@ fn1 (int n)
for (int i = 0; i < n; i++)
a->bar[i] = b[i];
}
+
+/* { dg-final { scan-tree-dump-not "Unknown misalignment" "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/pr81410.c b/gcc/testsuite/gcc.dg/vect/pr81410.c
index 929850f2391..8d1bd6c8efd 100644
--- a/gcc/testsuite/gcc.dg/vect/pr81410.c
+++ b/gcc/testsuite/gcc.dg/vect/pr81410.c
@@ -3,10 +3,9 @@
#include "tree-vect.h"
-typedef long long uint64_t;
-uint64_t x[24];
-uint64_t y[16];
-uint64_t z[8];
+long long x[24];
+long long y[16];
+long long z[8];
void __attribute__((noinline)) foo()
{
diff --git a/gcc/testsuite/gcc.dg/vect/pr81633.c b/gcc/testsuite/gcc.dg/vect/pr81633.c
new file mode 100644
index 00000000000..1ae15504e81
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/pr81633.c
@@ -0,0 +1,33 @@
+/* { dg-do run } */
+
+static double identity[4][4] = {{1, 0, 0, 0},
+ {0, 1, 0, 0},
+ {0, 0, 1, 0},
+ {0, 0, 0, 1}};
+static double expected[4][4] = {{1, 0, 0, 0},
+ {0, 0, 0, 0},
+ {0, 0, 0, 0},
+ {0, 0, 0, 0}};
+
+static void __attribute__((noinline,noclone))
+kernel(double A[4][4])
+{
+ double tmp[4][4];
+ for (int j = 0; j < 4; j++)
+ for (int k = 0; k < 4; k++)
+ tmp[j][k] = identity[j][0] * identity[j][k];
+ for (int j = 0; j < 4; j++ )
+ for (int k = 0; k < 4; k++)
+ A[j][k] = tmp[j][k];
+}
+
+int main(void)
+{
+ double A[4][4] = {{0.0}};
+ kernel(A);
+ for ( int i = 0; i < 4; i++ )
+ for ( int j = 0; j < 4; j++ )
+ if (A[i][j] != expected[i][j])
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/vect/section-anchors-vect-69.c b/gcc/testsuite/gcc.dg/vect/section-anchors-vect-69.c
index 8c88e5f6d18..26bcf4b0d76 100644
--- a/gcc/testsuite/gcc.dg/vect/section-anchors-vect-69.c
+++ b/gcc/testsuite/gcc.dg/vect/section-anchors-vect-69.c
@@ -1,4 +1,5 @@
/* { dg-require-effective-target section_anchors } */
+/* { dg-additional-options "--param vect-max-peeling-for-alignment=0" } */
#include <stdarg.h>
#include "tree-vect.h"
@@ -112,8 +113,6 @@ int main (void)
}
/* { dg-final { scan-tree-dump-times "vectorized 4 loops" 1 "vect" { target vect_int } } } */
-/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" } } */
/* Alignment forced using versioning until the pass that increases alignment
is extended to handle structs. */
-/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 2 "vect" { target {vect_int && vector_alignment_reachable } } } } */
/* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning" 4 "vect" { target {vect_int && {! vector_alignment_reachable} } } } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-28.c b/gcc/testsuite/gcc.dg/vect/vect-28.c
index b28fbd9c79a..e213df1a465 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-28.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-28.c
@@ -1,4 +1,5 @@
/* { dg-require-effective-target vect_int } */
+/* { dg-additional-options "--param vect-max-peeling-for-alignment=0" } */
#include <stdarg.h>
#include "tree-vect.h"
@@ -39,6 +40,4 @@ int main (void)
}
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
-/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" } } */
-/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 1 "vect" { target { vector_alignment_reachable } } } } */
/* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning" 1 "vect" { target { {! vector_alignment_reachable} && {! vect_hw_misalign} } } } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-33-big-array.c b/gcc/testsuite/gcc.dg/vect/vect-33-big-array.c
index 5ad3953810b..c1aa399a240 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-33-big-array.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-33-big-array.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-require-effective-target vect_int } */
+/* { dg-additional-options "--param vect-max-peeling-for-alignment=0" } */
#include <stdarg.h>
#include "tree-vect.h"
@@ -38,6 +39,4 @@ int main (void)
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
-/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" } } */
-/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 1 "vect" { target vector_alignment_reachable } } } */
/* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning" 1 "vect" { target { {! vector_alignment_reachable} && {! vect_hw_misalign} } } } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-70.c b/gcc/testsuite/gcc.dg/vect/vect-70.c
index 0ec06a273df..a110f9c34e8 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-70.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-70.c
@@ -1,4 +1,5 @@
/* { dg-require-effective-target vect_int } */
+/* { dg-additional-options "--param vect-max-peeling-for-alignment=0" } */
#include <stdarg.h>
#include "tree-vect.h"
@@ -63,6 +64,4 @@ int main (void)
}
/* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect" } } */
-/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" } } */
-/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 1 "vect" {target { vector_alignment_reachable} } } } */
/* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning" 1 "vect" {target {{! vector_alignment_reachable} && {! vect_hw_misalign} } } } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-87.c b/gcc/testsuite/gcc.dg/vect/vect-87.c
index 4f743975852..17b1dcdee99 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-87.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-87.c
@@ -1,4 +1,5 @@
/* { dg-require-effective-target vect_int } */
+/* { dg-additional-options "--param vect-max-peeling-for-alignment=0" } */
#include <stdarg.h>
#include "tree-vect.h"
@@ -50,6 +51,4 @@ int main (void)
/* Fails for targets that don't vectorize PLUS (e.g alpha). */
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
-/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" } } */
-/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 1 "vect" {target vector_alignment_reachable} } } */
/* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning" 1 "vect" {target { {! vector_alignment_reachable} && {! vect_hw_misalign} } } } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-88.c b/gcc/testsuite/gcc.dg/vect/vect-88.c
index f35c5259a8d..b99cb4d89a4 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-88.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-88.c
@@ -1,4 +1,5 @@
/* { dg-require-effective-target vect_int } */
+/* { dg-additional-options "--param vect-max-peeling-for-alignment=0" } */
#include <stdarg.h>
#include "tree-vect.h"
@@ -50,6 +51,4 @@ int main (void)
/* Fails for targets that don't vectorize PLUS (e.g alpha). */
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
-/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" } } */
-/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 1 "vect" {target vector_alignment_reachable } } } */
/* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning" 1 "vect" {target { {! vector_alignment_reachable} && {! vect_hw_misalign} } } } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-91.c b/gcc/testsuite/gcc.dg/vect/vect-91.c
index de9d5d1e1e8..979b8e93aef 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-91.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-91.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-require-effective-target vect_int } */
+/* { dg-additional-options "--param vect-max-peeling-for-alignment=0" } */
#include <stdarg.h>
#include "tree-vect.h"
@@ -60,5 +61,4 @@ main3 ()
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 3 "vect" { xfail vect_no_int_add } } } */
/* { dg-final { scan-tree-dump-times "accesses have the same alignment." 3 "vect" { target { { vect_aligned_arrays } && {! vect_sizes_32B_16B} } } } } */
/* { dg-final { scan-tree-dump-times "accesses have the same alignment." 2 "vect" { target { {! vect_aligned_arrays } && {vect_sizes_32B_16B} } } } } */
-/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 3 "vect" {target { vector_alignment_reachable } } } } */
/* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning" 3 "vect" {target { {! vector_alignment_reachable} && {! vect_hw_misalign} } } } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-93.c b/gcc/testsuite/gcc.dg/vect/vect-93.c
index 790ef2d7596..dfa4d42b8b2 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-93.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-93.c
@@ -1,4 +1,5 @@
/* { dg-require-effective-target vect_float } */
+/* { dg-additional-options "--param vect-max-peeling-for-alignment=0" } */
#include <stdarg.h>
#include "tree-vect.h"
@@ -71,8 +72,6 @@ int main (void)
/* main && main1 together: */
/* { dg-final { scan-tree-dump-times "vectorized 2 loops" 2 "vect" { target powerpc*-*-* i?86-*-* x86_64-*-* } } } */
-/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 2 "vect" { target { vect_no_align && {! vector_alignment_reachable} } } } } */
-/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 3 "vect" { xfail { { vect_no_align } || { { ! vector_alignment_reachable} || vect_element_align } } } } } */
/* in main1: */
/* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect" { target !powerpc*-*-* !i?86-*-* !x86_64-*-* } } } */
@@ -80,5 +79,4 @@ int main (void)
/* in main: */
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target { vect_no_align && { ! vect_hw_misalign } } } } } */
-/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 1 "vect" { xfail { vect_no_align && { ! vect_hw_misalign } } } } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-alias-check-3.c b/gcc/testsuite/gcc.dg/vect/vect-alias-check-3.c
new file mode 100644
index 00000000000..10b4c3d2c2a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-alias-check-3.c
@@ -0,0 +1,120 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target vect_int } */
+/* { dg-additional-options "--param vect-max-version-for-alias-checks=0 -fopenmp-simd" } */
+
+/* Intended to be larger than any VF. */
+#define GAP 128
+#define N (GAP * 3)
+
+struct s { int x[N + 1]; };
+struct t { struct s x[N + 1]; };
+struct u { int x[N + 1]; int y; };
+struct v { struct s s; };
+
+void
+f1 (struct s *a, struct s *b)
+{
+ for (int i = 0; i < N; ++i)
+ a->x[i] += b->x[i];
+}
+
+void
+f2 (struct s *a, struct s *b)
+{
+ for (int i = 0; i < N; ++i)
+ a[1].x[i] += b[2].x[i];
+}
+
+void
+f3 (struct s *a, struct s *b)
+{
+ for (int i = 0; i < N; ++i)
+ a[1].x[i] += b[i].x[i];
+}
+
+void
+f4 (struct s *a, struct s *b)
+{
+ for (int i = 0; i < N; ++i)
+ a[i].x[i] += b[i].x[i];
+}
+
+void
+f5 (struct s *a, struct s *b)
+{
+ for (int i = 0; i < N; ++i)
+ a->x[i] += b->x[i + 1];
+}
+
+void
+f6 (struct s *a, struct s *b)
+{
+ for (int i = 0; i < N; ++i)
+ a[1].x[i] += b[2].x[i + 1];
+}
+
+void
+f7 (struct s *a, struct s *b)
+{
+ for (int i = 0; i < N; ++i)
+ a[1].x[i] += b[i].x[i + 1];
+}
+
+void
+f8 (struct s *a, struct s *b)
+{
+ for (int i = 0; i < N; ++i)
+ a[i].x[i] += b[i].x[i + 1];
+}
+
+void
+f9 (struct s *a, struct t *b)
+{
+ for (int i = 0; i < N; ++i)
+ a->x[i] += b->x[1].x[i];
+}
+
+void
+f10 (struct s *a, struct t *b)
+{
+ for (int i = 0; i < N; ++i)
+ a->x[i] += b->x[i].x[i];
+}
+
+void
+f11 (struct u *a, struct u *b)
+{
+ for (int i = 0; i < N; ++i)
+ a->x[i] += b->x[i] + b[i].y;
+}
+
+void
+f12 (struct s *a, struct s *b)
+{
+ for (int i = 0; i < GAP; ++i)
+ a->x[i + GAP] += b->x[i];
+}
+
+void
+f13 (struct s *a, struct s *b)
+{
+ for (int i = 0; i < GAP * 2; ++i)
+ a->x[i + GAP] += b->x[i];
+}
+
+void
+f14 (struct v *a, struct s *b)
+{
+ for (int i = 0; i < N; ++i)
+ a->s.x[i] = b->x[i];
+}
+
+void
+f15 (struct s *a, struct s *b)
+{
+ #pragma omp simd safelen(N)
+ for (int i = 0; i < N; ++i)
+ a->x[i + 1] += b->x[i];
+}
+
+/* { dg-final { scan-tree-dump-times "LOOP VECTORIZED" 15 "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-alias-check-4.c b/gcc/testsuite/gcc.dg/vect/vect-alias-check-4.c
new file mode 100644
index 00000000000..1e5fc273ec1
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-alias-check-4.c
@@ -0,0 +1,35 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target vect_int } */
+/* { dg-additional-options "--param vect-max-version-for-alias-checks=0" } */
+
+#define N 16
+
+struct s1 { int a[N]; };
+struct s2 { struct s1 b; int c; };
+struct s3 { int d; struct s1 e; };
+union u { struct s2 f; struct s3 g; };
+
+/* We allow a and b to overlap arbitrarily. */
+
+void
+f1 (int a[][N], int b[][N])
+{
+ for (int i = 0; i < N; ++i)
+ a[0][i] += b[0][i];
+}
+
+void
+f2 (union u *a, union u *b)
+{
+ for (int i = 0; i < N; ++i)
+ a->f.b.a[i] += b->g.e.a[i];
+}
+
+void
+f3 (struct s1 *a, struct s1 *b)
+{
+ for (int i = 0; i < N - 1; ++i)
+ a->a[i + 1] += b->a[i];
+}
+
+/* { dg-final { scan-tree-dump-not "LOOP VECTORIZED" "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-alias-check-5.c b/gcc/testsuite/gcc.dg/vect/vect-alias-check-5.c
new file mode 100644
index 00000000000..bfa946b9ad2
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-alias-check-5.c
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target vect_int } */
+
+/* Intended to be larger than any VF. */
+#define GAP 128
+#define N (GAP * 3)
+
+struct s { int x[N]; };
+
+void
+f1 (struct s *a, struct s *b)
+{
+ for (int i = 0; i < GAP * 2; ++i)
+ a->x[i + GAP] += b->x[i];
+}
+
+/* { dg-final { scan-tree-dump-times "consider run-time aliasing" 1 "vect" } } */
+/* { dg-final { scan-tree-dump-times "improved number of alias checks from 1 to 0" 1 "vect" } } */
+/* { dg-final { scan-tree-dump-times "LOOP VECTORIZED" 1 "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-alias-check-6.c b/gcc/testsuite/gcc.dg/vect/vect-alias-check-6.c
new file mode 100644
index 00000000000..5bb78f8ad5c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-alias-check-6.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target vect_int } */
+
+#define N 16
+
+struct s { int x[N]; };
+
+void
+f1 (struct s *a, struct s *b)
+{
+ for (int i = 0; i < N - 1; ++i)
+ a->x[i + 1] += b->x[i];
+}
+
+/* { dg-final { scan-tree-dump {checking that [^\n]* and [^\n]* have different addresses} "vect" } } */
+/* { dg-final { scan-tree-dump "LOOP VECTORIZED" "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-alias-check-7.c b/gcc/testsuite/gcc.dg/vect/vect-alias-check-7.c
new file mode 100644
index 00000000000..812349de914
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-alias-check-7.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target vect_int } */
+
+#define N 16
+
+struct s { int x[N]; };
+
+void
+f1 (struct s *a, struct s *b)
+{
+ for (int i = 0; i < N; ++i)
+ a->x[i] += b->x[N - i - 1];
+}
+
+/* { dg-final { scan-tree-dump {checking that [^\n]* and [^\n]* have different addresses} "vect" } } */
+/* { dg-final { scan-tree-dump "LOOP VECTORIZED" "vect" { target { vect_perm && vect_element_align } } } } */