aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxim Kuvyrkov <maxim.kuvyrkov@linaro.org>2018-03-14 15:24:04 +0000
committerMaxim Kuvyrkov <maxim.kuvyrkov@linaro.org>2018-03-14 15:24:04 +0000
commit008c65a505dbfdbf62b7c59d5995c07bf6c462d4 (patch)
tree5b04771be14b1d15d352b540cea5b75fe31731c9
parent120525557a2dce8d4634456016a0d3943fcb8eb2 (diff)
Merge branches/gcc-7-branch rev 258507.
Change-Id: I674b939f54d302f865cc5539f00d7c47d84cdab6
-rw-r--r--gcc/ChangeLog40
-rw-r--r--gcc/DATESTAMP2
-rw-r--r--gcc/ada/ChangeLog11
-rw-r--r--gcc/ada/gcc-interface/misc.c3
-rw-r--r--gcc/ada/gcc-interface/trans.c2
-rw-r--r--gcc/config/aarch64/aarch64.c11
-rw-r--r--gcc/config/pa/pa.h18
-rw-r--r--gcc/config/pa/pa.md82
-rw-r--r--gcc/config/pa/pa64-hpux.h14
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/pt.c6
-rw-r--r--gcc/doc/invoke.texi4
-rw-r--r--gcc/fortran/ChangeLog17
-rw-r--r--gcc/fortran/arith.c10
-rw-r--r--gcc/fortran/decl.c19
-rw-r--r--gcc/fortran/resolve.c13
-rw-r--r--gcc/testsuite/ChangeLog34
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/alias-decl-63.C18
-rw-r--r--gcc/testsuite/gcc.dg/vect/pr84485.c34
-rw-r--r--gcc/testsuite/gcc.target/aarch64/pr63304_1.c2
-rw-r--r--gcc/testsuite/gfortran.dg/pr64124.f905
-rw-r--r--gcc/testsuite/gfortran.dg/pr70409.f9023
-rw-r--r--gcc/testsuite/gfortran.dg/pr83939.f9012
-rw-r--r--gcc/testsuite/gfortran.dg/pr84734.f904
-rw-r--r--gcc/testsuite/gnat.dg/prot3.adb8
-rw-r--r--gcc/testsuite/gnat.dg/prot3_pkg.adb17
-rw-r--r--gcc/testsuite/gnat.dg/prot3_pkg.ads16
-rw-r--r--gcc/tree-vect-data-refs.c12
-rw-r--r--libatomic/ChangeLog8
-rw-r--r--libatomic/config/s390/exch_n.c69
-rw-r--r--libatomic/configure.tgt5
-rw-r--r--libgcc/ChangeLog8
-rw-r--r--libgcc/config/pa/fptr.c20
-rw-r--r--libstdc++-v3/ChangeLog19
-rwxr-xr-xlibstdc++-v3/configure26
-rw-r--r--libstdc++-v3/crossconfig.m42
-rw-r--r--libstdc++-v3/include/c_global/cstdlib6
-rw-r--r--libstdc++-v3/include/std/variant14
-rw-r--r--libstdc++-v3/testsuite/18_support/aligned_alloc/aligned_alloc.cc42
39 files changed, 601 insertions, 61 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index d17cfe5de61..dcd28d01e45 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,43 @@
+2018-03-12 Jonathan Wakely <jwakely@redhat.com>
+
+ * doc/invoke.texi (-mclflushopt): Fix spelling of option.
+
+2018-03-12 Richard Sandiford <richard.sandiford@linaro.org>
+
+ PR tree-optimization/84485
+ * tree-vect-data-refs.c (vect_analyze_data_ref_dependence): Return
+ true for zero dependence distances if the step might be zero,
+ and if there is no metadata that guarantees correctness.
+ (vect_analyze_data_ref_access): Check safelen as well as
+ force_vectorize.
+
+2018-03-11 John David Anglin <danglin@gcc.gnu.org>
+
+ Backport from mainline
+ 2018-02-14 John David Anglin <danglin@gcc.gnu.org>
+
+ PR target/83984
+ * config/pa/pa.md: Load address of PIC label using the linkage table
+ if the label is nonlocal.
+
+ Backport from mainline
+ 2018-03-06 John David Anglin <danglin@gcc.gnu.org>
+
+ * config/pa/pa.h (ASM_GENERATE_INTERNAL_LABEL): Revise to use
+ sprint_ul.
+ (ASM_OUTPUT_ADDR_VEC_ELT): Revise for above change.
+ (ASM_OUTPUT_ADDR_DIFF_ELT): Likewise.
+ * config/pa/pa64-hpux.h (ASM_GENERATE_INTERNAL_LABEL): Revise as above.
+
+2018-03-09 Kugan Vivekanandarajah <kuganv@linaro.org>
+
+ Backport from mainline
+ 2017-09-13 Kugan Vivekanandarajah <kuganv@linaro.org>
+
+ * config/aarch64/aarch64.c (aarch64_override_options_after_change_1):
+ Disable pc relative literal load irrespective of TARGET_FIX_ERR_A53_84341
+ for default.
+
2018-03-06 Denis Chertykov <chertykov@gmail.com>
Backport from mainline
diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index d326f67838d..396833387ce 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20180307
+20180314
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 73cd991166b..1cc0c11e6b2 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,14 @@
+2018-03-12 Eric Botcazou <ebotcazou@adacore.com>
+
+ PR ada/82813
+ * gcc-interface/misc.c (gnat_post_options): Disable string overflow
+ warnings.
+
+2018-03-10 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gcc-interface/trans.c (node_has_volatile_full_access) <N_Identifier>:
+ Consider only entities for objects.
+
2018-03-06 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/trans.c (convert_with_check): Fix typo in the condition
diff --git a/gcc/ada/gcc-interface/misc.c b/gcc/ada/gcc-interface/misc.c
index 1b6b3eb265a..11570f0987f 100644
--- a/gcc/ada/gcc-interface/misc.c
+++ b/gcc/ada/gcc-interface/misc.c
@@ -262,6 +262,9 @@ gnat_post_options (const char **pfilename ATTRIBUTE_UNUSED)
/* No psABI change warnings for Ada. */
warn_psabi = 0;
+ /* No string overflow warnings for Ada. */
+ warn_stringop_overflow = 0;
+
/* No caret by default for Ada. */
if (!global_options_set.x_flag_diagnostics_show_caret)
global_dc->show_caret = false;
diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c
index c42583a187a..eaad084959c 100644
--- a/gcc/ada/gcc-interface/trans.c
+++ b/gcc/ada/gcc-interface/trans.c
@@ -4059,6 +4059,8 @@ node_has_volatile_full_access (Node_Id gnat_node)
case N_Identifier:
case N_Expanded_Name:
gnat_entity = Entity (gnat_node);
+ if (!Is_Object (gnat_entity))
+ break;
return Is_Volatile_Full_Access (gnat_entity)
|| Is_Volatile_Full_Access (Etype (gnat_entity));
diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index 0c736b79d63..4f66f911ffa 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -8954,17 +8954,6 @@ aarch64_override_options_after_change_1 (struct gcc_options *opts)
if (opts->x_pcrelative_literal_loads == 1)
aarch64_pcrelative_literal_loads = true;
- /* This is PR70113. When building the Linux kernel with
- CONFIG_ARM64_ERRATUM_843419, support for relocations
- R_AARCH64_ADR_PREL_PG_HI21 and R_AARCH64_ADR_PREL_PG_HI21_NC is
- removed from the kernel to avoid loading objects with possibly
- offending sequences. Without -mpc-relative-literal-loads we would
- generate such relocations, preventing the kernel build from
- succeeding. */
- if (opts->x_pcrelative_literal_loads == 2
- && TARGET_FIX_ERR_A53_843419)
- aarch64_pcrelative_literal_loads = true;
-
/* In the tiny memory model it makes no sense to disallow PC relative
literal pool loads. */
if (aarch64_cmodel == AARCH64_CMODEL_TINY
diff --git a/gcc/config/pa/pa.h b/gcc/config/pa/pa.h
index 65df53e54b0..dd37dd3ad8d 100644
--- a/gcc/config/pa/pa.h
+++ b/gcc/config/pa/pa.h
@@ -1153,8 +1153,18 @@ do { \
PREFIX is the class of label and NUM is the number within the class.
This is suitable for output with `assemble_name'. */
-#define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \
- sprintf (LABEL, "*%c$%s%04ld", (PREFIX)[0], (PREFIX) + 1, (long)(NUM))
+#define ASM_GENERATE_INTERNAL_LABEL(LABEL, PREFIX, NUM) \
+ do \
+ { \
+ char *__p; \
+ (LABEL)[0] = '*'; \
+ (LABEL)[1] = (PREFIX)[0]; \
+ (LABEL)[2] = '$'; \
+ __p = stpcpy (&(LABEL)[3], &(PREFIX)[1]); \
+ sprint_ul (__p, (unsigned long) (NUM)); \
+ } \
+ while (0)
+
/* Output the definition of a compiler-generated label named NAME. */
@@ -1193,14 +1203,14 @@ do { \
/* This is how to output an element of a case-vector that is absolute. */
#define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
- fprintf (FILE, "\t.word L$%04d\n", VALUE)
+ fprintf (FILE, "\t.word L$%d\n", VALUE)
/* This is how to output an element of a case-vector that is relative.
Since we always place jump tables in the text section, the difference
is absolute and requires no relocation. */
#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \
- fprintf (FILE, "\t.word L$%04d-L$%04d\n", VALUE, REL)
+ fprintf (FILE, "\t.word L$%d-L$%d\n", VALUE, REL)
/* This is how to output an absolute case-vector. */
diff --git a/gcc/config/pa/pa.md b/gcc/config/pa/pa.md
index e786d104b1f..01657fdf838 100644
--- a/gcc/config/pa/pa.md
+++ b/gcc/config/pa/pa.md
@@ -2536,24 +2536,40 @@
xoperands[0] = operands[0];
xoperands[1] = operands[1];
- xoperands[2] = gen_label_rtx ();
- (*targetm.asm_out.internal_label) (asm_out_file, \"L\",
- CODE_LABEL_NUMBER (xoperands[2]));
- output_asm_insn (\"mfia %0\", xoperands);
-
- /* If we're trying to load the address of a label that happens to be
- close, then we can use a shorter sequence. */
if (GET_CODE (operands[1]) == LABEL_REF
- && !LABEL_REF_NONLOCAL_P (operands[1])
- && INSN_ADDRESSES_SET_P ()
- && abs (INSN_ADDRESSES (INSN_UID (XEXP (operands[1], 0)))
- - INSN_ADDRESSES (INSN_UID (insn))) < 8100)
- output_asm_insn (\"ldo %1-%2(%0),%0\", xoperands);
+ && !LABEL_REF_NONLOCAL_P (operands[1]))
+ {
+ xoperands[2] = gen_label_rtx ();
+ (*targetm.asm_out.internal_label) (asm_out_file, \"L\",
+ CODE_LABEL_NUMBER (xoperands[2]));
+ output_asm_insn (\"mfia %0\", xoperands);
+
+ /* If we're trying to load the address of a label that happens to be
+ close, then we can use a shorter sequence. */
+ if (INSN_ADDRESSES_SET_P ()
+ && abs (INSN_ADDRESSES (INSN_UID (XEXP (operands[1], 0)))
+ - INSN_ADDRESSES (INSN_UID (insn))) < 8100)
+ output_asm_insn (\"ldo %1-%2(%0),%0\", xoperands);
+ else
+ {
+ output_asm_insn (\"addil L%%%1-%2,%0\", xoperands);
+ output_asm_insn (\"ldo R%%%1-%2(%0),%0\", xoperands);
+ }
+ }
else
{
- output_asm_insn (\"addil L%%%1-%2,%0\", xoperands);
- output_asm_insn (\"ldo R%%%1-%2(%0),%0\", xoperands);
+ /* Load using linkage table. */
+ if (TARGET_64BIT)
+ {
+ output_asm_insn (\"addil LT%%%1,%%r27\", xoperands);
+ output_asm_insn (\"ldd RT%%%1(%0),%0\", xoperands);
+ }
+ else
+ {
+ output_asm_insn (\"addil LT%%%1,%%r19\", xoperands);
+ output_asm_insn (\"ldw RT%%%1(%0),%0\", xoperands);
+ }
}
return \"\";
}"
@@ -2570,25 +2586,33 @@
xoperands[0] = operands[0];
xoperands[1] = operands[1];
- xoperands[2] = gen_label_rtx ();
- output_asm_insn (\"bl .+8,%0\", xoperands);
- output_asm_insn (\"depi 0,31,2,%0\", xoperands);
- (*targetm.asm_out.internal_label) (asm_out_file, \"L\",
- CODE_LABEL_NUMBER (xoperands[2]));
-
- /* If we're trying to load the address of a label that happens to be
- close, then we can use a shorter sequence. */
if (GET_CODE (operands[1]) == LABEL_REF
- && !LABEL_REF_NONLOCAL_P (operands[1])
- && INSN_ADDRESSES_SET_P ()
- && abs (INSN_ADDRESSES (INSN_UID (XEXP (operands[1], 0)))
- - INSN_ADDRESSES (INSN_UID (insn))) < 8100)
- output_asm_insn (\"ldo %1-%2(%0),%0\", xoperands);
+ && !LABEL_REF_NONLOCAL_P (operands[1]))
+ {
+ xoperands[2] = gen_label_rtx ();
+ output_asm_insn (\"bl .+8,%0\", xoperands);
+ output_asm_insn (\"depi 0,31,2,%0\", xoperands);
+ (*targetm.asm_out.internal_label) (asm_out_file, \"L\",
+ CODE_LABEL_NUMBER (xoperands[2]));
+
+ /* If we're trying to load the address of a label that happens to be
+ close, then we can use a shorter sequence. */
+ if (INSN_ADDRESSES_SET_P ()
+ && abs (INSN_ADDRESSES (INSN_UID (XEXP (operands[1], 0)))
+ - INSN_ADDRESSES (INSN_UID (insn))) < 8100)
+ output_asm_insn (\"ldo %1-%2(%0),%0\", xoperands);
+ else
+ {
+ output_asm_insn (\"addil L%%%1-%2,%0\", xoperands);
+ output_asm_insn (\"ldo R%%%1-%2(%0),%0\", xoperands);
+ }
+ }
else
{
- output_asm_insn (\"addil L%%%1-%2,%0\", xoperands);
- output_asm_insn (\"ldo R%%%1-%2(%0),%0\", xoperands);
+ /* Load using linkage table. */
+ output_asm_insn (\"addil LT%%%1,%%r19\", xoperands);
+ output_asm_insn (\"ldw RT%%%1(%0),%0\", xoperands);
}
return \"\";
}"
diff --git a/gcc/config/pa/pa64-hpux.h b/gcc/config/pa/pa64-hpux.h
index 8b7a42be3b5..5b21482602d 100644
--- a/gcc/config/pa/pa64-hpux.h
+++ b/gcc/config/pa/pa64-hpux.h
@@ -245,8 +245,18 @@ do { \
/* We need to use the HP style for internal labels. */
#undef ASM_GENERATE_INTERNAL_LABEL
-#define ASM_GENERATE_INTERNAL_LABEL(LABEL, PREFIX, NUM) \
- sprintf (LABEL, "*%c$%s%04ld", (PREFIX)[0], (PREFIX) + 1, (long)(NUM))
+#define ASM_GENERATE_INTERNAL_LABEL(LABEL, PREFIX, NUM) \
+ do \
+ { \
+ char *__p; \
+ (LABEL)[0] = '*'; \
+ (LABEL)[1] = (PREFIX)[0]; \
+ (LABEL)[2] = '$'; \
+ __p = stpcpy (&(LABEL)[3], &(PREFIX)[1]); \
+ sprint_ul (__p, (unsigned long) (NUM)); \
+ } \
+ while (0)
+
#else /* USING_ELFOS_H */
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 6e5aeb07782..1eb8b0af0cf 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2018-03-09 Jason Merrill <jason@redhat.com>
+
+ PR c++/84785 - ICE with alias template and default targs.
+ * pt.c (type_unification_real): Set processing_template_decl if
+ saw_undeduced == 1.
+
2018-03-07 Marek Polacek <polacek@redhat.com>
Backported from mainline
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 9815df63c28..b4032550849 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -19490,7 +19490,13 @@ type_unification_real (tree tparms,
location_t save_loc = input_location;
if (DECL_P (parm))
input_location = DECL_SOURCE_LOCATION (parm);
+
+ if (saw_undeduced == 1)
+ ++processing_template_decl;
arg = tsubst_template_arg (arg, full_targs, complain, NULL_TREE);
+ if (saw_undeduced == 1)
+ --processing_template_decl;
+
if (arg != error_mark_node && !uses_template_parms (arg))
arg = convert_template_argument (parm, arg, full_targs, complain,
i, NULL_TREE);
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index f150453d369..fbb99aa8936 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -25114,8 +25114,8 @@ preferred alignment to @option{-mpreferred-stack-boundary=2}.
@itemx -mpclmul
@opindex mpclmul
@need 200
-@itemx -mclfushopt
-@opindex mclfushopt
+@itemx -mclflushopt
+@opindex mclflushopt
@need 200
@itemx -mfsgsbase
@opindex mfsgsbase
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 55cf7d573ee..6156644ad48 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,20 @@
+2018-03-12 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/83939
+ * resolve.c (resolve_fl_procedure): Enforce F2018:C15100.
+
+2018-03-10 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/84734
+ * arith.c (check_result, eval_intrinsic): If result overflows, pass
+ the expression up the chain instead of a NULL pointer.
+
+2018-03-08 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/64124
+ PR fortran/70409
+ * decl.c (gfc_match_char_spec): Try to reduce a charlen to a constant.
+
2018-03-06 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/56667
diff --git a/gcc/fortran/arith.c b/gcc/fortran/arith.c
index 8fa305c6aee..c594048eb51 100644
--- a/gcc/fortran/arith.c
+++ b/gcc/fortran/arith.c
@@ -555,10 +555,10 @@ check_result (arith rc, gfc_expr *x, gfc_expr *r, gfc_expr **rp)
val = ARITH_OK;
}
- if (val != ARITH_OK)
- gfc_free_expr (r);
- else
+ if (val == ARITH_OK || val == ARITH_OVERFLOW)
*rp = r;
+ else
+ gfc_free_expr (r);
return val;
}
@@ -1603,9 +1603,13 @@ eval_intrinsic (gfc_intrinsic_op op,
if (rc != ARITH_OK)
{
gfc_error (gfc_arith_error (rc), &op1->where);
+ if (rc == ARITH_OVERFLOW)
+ goto done;
return NULL;
}
+done:
+
gfc_free_expr (op1);
gfc_free_expr (op2);
return result;
diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c
index 6d3d28af127..e46b8394853 100644
--- a/gcc/fortran/decl.c
+++ b/gcc/fortran/decl.c
@@ -2979,7 +2979,24 @@ done:
if (seen_length == 0)
cl->length = gfc_get_int_expr (gfc_default_integer_kind, NULL, 1);
else
- cl->length = len;
+ {
+ /* If gfortran ends up here, then the len may be reducible to a
+ constant. Try to do that here. If it does not reduce, simply
+ assign len to the charlen. */
+ if (len && len->expr_type != EXPR_CONSTANT)
+ {
+ gfc_expr *e;
+ e = gfc_copy_expr (len);
+ gfc_reduce_init_expr (e);
+ if (e->expr_type == EXPR_CONSTANT)
+ gfc_replace_expr (len, e);
+ else
+ gfc_free_expr (e);
+ cl->length = len;
+ }
+ else
+ cl->length = len;
+ }
ts->u.cl = cl;
ts->kind = kind == 0 ? gfc_default_character_kind : kind;
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
index 1074470eaf6..4baa0e036fc 100644
--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -12228,6 +12228,19 @@ resolve_fl_procedure (gfc_symbol *sym, int mp_flag)
}
}
+ /* F2018, C15100: "The result of an elemental function shall be scalar,
+ and shall not have the POINTER or ALLOCATABLE attribute." The scalar
+ pointer is tested and caught elsewhere. */
+ if (sym->attr.elemental && sym->result
+ && (sym->result->attr.allocatable || sym->result->attr.pointer))
+ {
+ gfc_error ("Function result variable %qs at %L of elemental "
+ "function %qs shall not have an ALLOCATABLE or POINTER "
+ "attribute", sym->result->name,
+ &sym->result->declared_at, sym->name);
+ return false;
+ }
+
if (sym->attr.is_bind_c && sym->attr.is_c_interop != 1)
{
gfc_formal_arglist *curr_arg;
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index aafb8e1fc43..68e6b47d96f 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,37 @@
+2018-03-12 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/83939
+ * gfortran.dg/pr83939.f90
+
+2018-03-12 Richard Sandiford <richard.sandiford@linaro.org>
+
+ PR tree-optimization/84485
+ * gcc.dg/vect/pr84485.c: New test.
+
+2018-03-10 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/84734
+ * gfortran.dg/pr84734.f90: New test.
+
+2018-03-10 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gnat.dg/prot3.adb: New test.
+ * gnat.dg/prot3_pkg.ad[sb]: New helper.
+
+2018-03-09 Kugan Vivekanandarajah <kuganv@linaro.org>
+
+ Backport from mainline
+ 2017-09-13 Kugan Vivekanandarajah <kuganv@linaro.org>
+
+ * gcc.target/aarch64/pr63304_1.c: Remove-mno-fix-cortex-a53-843419.
+
+2018-03-08 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/64124
+ PR fortran/70409
+ * gfortran.dg/pr64124.f90: New tests.
+ * gfortran.dg/pr70409.f90: New tests.
+
2018-03-06 Carl Love <cel@us.ibm.com>
Backport from mainline
diff --git a/gcc/testsuite/g++.dg/cpp0x/alias-decl-63.C b/gcc/testsuite/g++.dg/cpp0x/alias-decl-63.C
new file mode 100644
index 00000000000..04fb42d9e09
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/alias-decl-63.C
@@ -0,0 +1,18 @@
+// PR c++/84785
+// { dg-do compile { target c++11 } }
+
+template <typename> struct A;
+template <bool> struct B;
+template <bool B, typename> using enable_if_t = typename B<B>::type;
+template <long> using type_pack_element = int;
+struct variant {
+ variant() {}
+ template <typename Arg, long I = Arg::type::value,
+ typename = type_pack_element<I>, enable_if_t<A<Arg>::value, int>>
+ variant(Arg &&);
+};
+
+struct S {
+ variant var;
+};
+int main() { S s; }
diff --git a/gcc/testsuite/gcc.dg/vect/pr84485.c b/gcc/testsuite/gcc.dg/vect/pr84485.c
new file mode 100644
index 00000000000..ad25d3642c8
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/pr84485.c
@@ -0,0 +1,34 @@
+/* { dg-do run } */
+
+#include "tree-vect.h"
+
+#define N 256
+
+void __attribute__ ((noinline, noclone))
+f (unsigned long incx, unsigned long incy,
+ float *restrict dx, float *restrict dy)
+{
+ unsigned long ix = 0, iy = 0;
+ for (unsigned long i = 0; i < N; ++i)
+ {
+ dy[iy] += dx[ix];
+ ix += incx;
+ iy += incy;
+ }
+}
+
+float a = 0.0;
+float b[N];
+
+int
+main (void)
+{
+ check_vect ();
+
+ for (int i = 0; i < N; ++i)
+ b[i] = i;
+ f (1, 0, b, &a);
+ if (a != N * (N - 1) / 2)
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/aarch64/pr63304_1.c b/gcc/testsuite/gcc.target/aarch64/pr63304_1.c
index 114d8c1a6c3..b00f9a68621 100644
--- a/gcc/testsuite/gcc.target/aarch64/pr63304_1.c
+++ b/gcc/testsuite/gcc.target/aarch64/pr63304_1.c
@@ -1,5 +1,5 @@
/* { dg-do assemble } */
-/* { dg-options "-O1 --save-temps -mno-fix-cortex-a53-843419" } */
+/* { dg-options "-O1 --save-temps" } */
#pragma GCC push_options
#pragma GCC target ("+nothing+simd, cmodel=small")
diff --git a/gcc/testsuite/gfortran.dg/pr64124.f90 b/gcc/testsuite/gfortran.dg/pr64124.f90
new file mode 100644
index 00000000000..349c20de204
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr64124.f90
@@ -0,0 +1,5 @@
+! { dg-do compile }
+! PR fortran/64124.f90
+ character(len=kind(1)) x
+ integer(len(x)) y
+ end
diff --git a/gcc/testsuite/gfortran.dg/pr70409.f90 b/gcc/testsuite/gfortran.dg/pr70409.f90
new file mode 100644
index 00000000000..0372f6e9632
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr70409.f90
@@ -0,0 +1,23 @@
+! { dg-do run }
+! PR fortran/70409
+! Contriubted by Harald Anlauf <anlauf at gmx dot de>
+program foo
+ integer, parameter :: huge_1 = huge(0_1)
+ character( huge_1 ), parameter :: x = 'abc'
+ character( huge(0_1) ), parameter :: y = 'abc'
+ character( huge(0_1)+0 ), parameter :: z = 'abcdef'
+ character( huge(0_1) ) :: a = 'abc'
+ integer, parameter :: huge_2 = huge(0_2)
+ character( huge_2 ), parameter :: u = 'abc'
+ character( huge(0_2) ), parameter :: v = 'abc'
+ character(int(huge(0_2),4)), parameter :: w = 'abcdef'
+ character( huge(0_2) ) :: b = 'abc'
+ if (len(x) /= huge_1) stop 1
+ if (len(y) /= huge_1) stop 2
+ if (len(z) /= huge_1) stop 3
+ if (len(a) /= huge_1) stop 4
+ if (len(u) /= huge_2) stop 5
+ if (len(v) /= huge_2) stop 6
+ if (len(w) /= huge_2) stop 7
+ if (len(b) /= huge_2) stop 8
+end program foo
diff --git a/gcc/testsuite/gfortran.dg/pr83939.f90 b/gcc/testsuite/gfortran.dg/pr83939.f90
new file mode 100644
index 00000000000..dfeaac71630
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr83939.f90
@@ -0,0 +1,12 @@
+! { dg-do compile }
+elemental function f() result(s) ! { dg-error "shall not have an ALLOCATABLE or POINTER" }
+ allocatable s
+ allocate(s)
+ s = 3.5
+end function
+
+elemental function g() result(s) ! { dg-error "shall not have an ALLOCATABLE or POINTER" }
+ pointer s
+ allocate(s)
+ s = 3.5
+end function
diff --git a/gcc/testsuite/gfortran.dg/pr84734.f90 b/gcc/testsuite/gfortran.dg/pr84734.f90
new file mode 100644
index 00000000000..4b117ae43e7
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr84734.f90
@@ -0,0 +1,4 @@
+! { dg-do compile }
+! PR fortran/84734
+ integer :: b(huge(1_8)+1_8) = 0 ! { dg-error "Arithmetic overflow" }
+ end
diff --git a/gcc/testsuite/gnat.dg/prot3.adb b/gcc/testsuite/gnat.dg/prot3.adb
new file mode 100644
index 00000000000..25390659238
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/prot3.adb
@@ -0,0 +1,8 @@
+-- { dg-do run }
+
+with Prot3_Pkg; use Prot3_Pkg;
+
+procedure Prot3 is
+begin
+ P.Foo (4);
+end;
diff --git a/gcc/testsuite/gnat.dg/prot3_pkg.adb b/gcc/testsuite/gnat.dg/prot3_pkg.adb
new file mode 100644
index 00000000000..07ae1829f60
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/prot3_pkg.adb
@@ -0,0 +1,17 @@
+package body Prot3_Pkg is
+
+ protected body Prot is
+ function Fn (J : Short_Integer) return Rec
+ is
+ begin
+ return (V1 => J * J,
+ V2 => J);
+ end;
+
+ procedure Foo (J : Short_Integer) is
+ begin
+ Val := Fn (J);
+ end;
+ end Prot;
+
+end Prot3_Pkg;
diff --git a/gcc/testsuite/gnat.dg/prot3_pkg.ads b/gcc/testsuite/gnat.dg/prot3_pkg.ads
new file mode 100644
index 00000000000..b4cce90a543
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/prot3_pkg.ads
@@ -0,0 +1,16 @@
+package Prot3_Pkg is
+
+ type Rec is record
+ V1 : Short_Integer;
+ V2 : Short_Integer;
+ end record with Volatile_Full_Access;
+
+ protected type Prot is
+ procedure Foo (J : Short_Integer);
+ private
+ Val : Rec;
+ end Prot;
+
+ P : Prot;
+
+end Prot3_Pkg;
diff --git a/gcc/tree-vect-data-refs.c b/gcc/tree-vect-data-refs.c
index ccaa945bffb..f0e97060d7b 100644
--- a/gcc/tree-vect-data-refs.c
+++ b/gcc/tree-vect-data-refs.c
@@ -394,6 +394,16 @@ vect_analyze_data_ref_dependence (struct data_dependence_relation *ddr,
}
}
+ unsigned int step_prec = TYPE_PRECISION (TREE_TYPE (DR_STEP (dra)));
+ if (loop->safelen < 2
+ && !expr_not_equal_to (DR_STEP (dra), wi::zero (step_prec)))
+ {
+ if (dump_enabled_p ())
+ dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
+ "step could be zero.\n");
+ return true;
+ }
+
continue;
}
@@ -2515,7 +2525,7 @@ vect_analyze_data_ref_access (struct data_reference *dr)
/* Allow references with zero step for outer loops marked
with pragma omp simd only - it guarantees absence of
loop-carried dependencies between inner loop iterations. */
- if (!loop->force_vectorize)
+ if (!loop->force_vectorize || loop->safelen < 2)
{
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,
diff --git a/libatomic/ChangeLog b/libatomic/ChangeLog
index 77297253a79..629048c3e64 100644
--- a/libatomic/ChangeLog
+++ b/libatomic/ChangeLog
@@ -1,3 +1,11 @@
+2018-03-09 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
+
+ Backport from mainline
+ 2018-03-09 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
+
+ * config/s390/exch_n.c: New file.
+ * configure.tgt: Add the config directory for s390.
+
2018-01-25 Release Manager
* GCC 7.3.0 released.
diff --git a/libatomic/config/s390/exch_n.c b/libatomic/config/s390/exch_n.c
new file mode 100644
index 00000000000..b2340b4aa6a
--- /dev/null
+++ b/libatomic/config/s390/exch_n.c
@@ -0,0 +1,69 @@
+/* Copyright (C) 2018 Free Software Foundation, Inc.
+ Contributed by Andreas Krebbel <krebbel@linux.vnet.ibm.com>
+
+ This file is part of the GNU Atomic Library (libatomic).
+
+ Libatomic is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ Libatomic is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ more details.
+
+ Under Section 7 of GPL version 3, you are granted additional
+ permissions described in the GCC Runtime Library Exception, version
+ 3.1, as published by the Free Software Foundation.
+
+ You should have received a copy of the GNU General Public License and
+ a copy of the GCC Runtime Library Exception along with this program;
+ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <libatomic_i.h>
+
+
+/* The compiler builtin will use the hardware instruction cdsg if the
+ memory operand is properly aligned and will fall back to the
+ library call otherwise.
+
+ In case the compiler for one part is able to detect that the
+ location is aligned and fails to do so for another usage of the hw
+ instruction and the sw fall back would be mixed on the same memory
+ location. To avoid this the library fall back also has to use the
+ hardware instruction if possible. */
+
+#if !DONE && N == 16
+UTYPE
+SIZE(libat_exchange) (UTYPE *mptr, UTYPE newval, int smodel UNUSED)
+{
+ if (!((uintptr_t)mptr & 0xf))
+ {
+ /* Use the builtin only if the memory operand is 16 byte
+ aligned. */
+ return __atomic_exchange_n ((UTYPE *)__builtin_assume_aligned (mptr, 16),
+ newval, __ATOMIC_SEQ_CST);
+ }
+ else
+ {
+ UTYPE oldval;
+ UWORD magic;
+
+ pre_seq_barrier (smodel);
+ magic = protect_start (mptr);
+
+ oldval = *mptr;
+ *mptr = newval;
+
+ protect_end (mptr, magic);
+ post_seq_barrier (smodel);
+
+ return oldval;
+ }
+}
+#define DONE 1
+#endif /* N == 16 */
+
+#include "../../exch_n.c"
diff --git a/libatomic/configure.tgt b/libatomic/configure.tgt
index b8af3ab2546..30ae29248cd 100644
--- a/libatomic/configure.tgt
+++ b/libatomic/configure.tgt
@@ -114,6 +114,11 @@ case "${target}" in
config_path="${config_path} linux/arm posix"
;;
+ s390*-*-linux*)
+ # OS support for atomic primitives.
+ config_path="${config_path} s390 posix"
+ ;;
+
*-*-linux* | *-*-gnu* | *-*-k*bsd*-gnu \
| *-*-netbsd* | *-*-freebsd* | *-*-openbsd* | *-*-dragonfly* \
| *-*-solaris2* | *-*-sysv4* | *-*-irix6* | *-*-osf* | *-*-hpux11* \
diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog
index 9658cb68725..7ad7e9f1c54 100644
--- a/libgcc/ChangeLog
+++ b/libgcc/ChangeLog
@@ -1,3 +1,11 @@
+2018-03-11 John David Anglin <danglin@gcc.gnu.org>
+
+ Backport from mainline
+ 2018-03-06 John David Anglin <danglin@gcc.gnu.org>
+
+ * config/pa/fptr.c (_dl_read_access_allowed): New.
+ (__canonicalize_funcptr_for_compare): Use it.
+
2018-02-20 Max Filippov <jcmvbkbc@gmail.com>
Backport from mainline
diff --git a/libgcc/config/pa/fptr.c b/libgcc/config/pa/fptr.c
index 645fa5d833a..e145026df3e 100644
--- a/libgcc/config/pa/fptr.c
+++ b/libgcc/config/pa/fptr.c
@@ -52,6 +52,16 @@ typedef int (*fptr_t) (void);
typedef int (*fixup_t) (struct link_map *, unsigned int);
extern unsigned int _GLOBAL_OFFSET_TABLE_;
+static inline int
+_dl_read_access_allowed (unsigned int *addr)
+{
+ int result;
+
+ asm ("proberi (%1),3,%0" : "=r" (result) : "r" (addr) : );
+
+ return result;
+}
+
/* __canonicalize_funcptr_for_compare must be hidden so that it is not
placed in the dynamic symbol table. Like millicode functions, it
must be linked into all binaries in order access the got table of
@@ -82,6 +92,16 @@ __canonicalize_funcptr_for_compare (fptr_t fptr)
The second word in the plabel contains the relocation offset for the
function. */
plabel = (unsigned int *) ((unsigned int) fptr & ~3);
+ if (!_dl_read_access_allowed (plabel))
+ return (unsigned int) fptr;
+
+ /* Load first word of candidate descriptor. It should be a pointer
+ with word alignment and point to memory that can be read. */
+ got = (unsigned int *) plabel[0];
+ if (((unsigned int) got & 3) != 0
+ || !_dl_read_access_allowed (got))
+ return (unsigned int) fptr;
+
got = (unsigned int *) (plabel[0] + GOT_FROM_PLT_STUB);
/* Return the address of the function if the plabel has been resolved. */
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index bb2d01ff659..41ab6772495 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,22 @@
+2018-03-13 Jonathan Wakely <jwakely@redhat.com>
+
+ Backport from mainline
+ 2018-03-09 Jonathan Wakely <jwakely@redhat.com>
+
+ PR libstdc++/84769
+ * include/std/variant (get<_Tp, _Types...>, get_if<_Tp, _Types...>):
+ Qualify calls to get<_Np, Types...> and get_if<_Np, _Types...>.
+
+2018-03-12 Jonathan Wakely <jwakely@redhat.com>
+
+ PR libstdc++/84773
+ PR libstdc++/83662
+ * crossconfig.m4: Check for aligned_alloc etc. on freebsd and mingw32.
+ * configure: Regenerate.
+ * include/c_global/cstdlib [_GLIBCXX_HAVE_ALIGNED_ALLOC]
+ (aligned_alloc): Add using-declaration.
+ * testsuite/18_support/aligned_alloc/aligned_alloc.cc: New test.
+
2018-03-02 Jonathan Wakely <jwakely@redhat.com>
Backport from mainline
diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure
index fdbf7bea876..9e56113b872 100755
--- a/libstdc++-v3/configure
+++ b/libstdc++-v3/configure
@@ -53329,6 +53329,19 @@ _ACEOF
fi
done
+ for ac_func in aligned_alloc posix_memalign memalign _aligned_malloc
+do :
+ as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+eval as_val=\$$as_ac_var
+ if test "x$as_val" = x""yes; then :
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
;;
*-fuchsia*)
@@ -66079,6 +66092,19 @@ done
CXXFLAGS="$ac_save_CXXFLAGS"
+ for ac_func in aligned_alloc posix_memalign memalign _aligned_malloc
+do :
+ as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+eval as_val=\$$as_ac_var
+ if test "x$as_val" = x""yes; then :
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
;;
*-netbsd*)
SECTION_FLAGS='-ffunction-sections -fdata-sections'
diff --git a/libstdc++-v3/crossconfig.m4 b/libstdc++-v3/crossconfig.m4
index 77c9828fe91..292f9963c2a 100644
--- a/libstdc++-v3/crossconfig.m4
+++ b/libstdc++-v3/crossconfig.m4
@@ -133,6 +133,7 @@ case "${host}" in
AC_DEFINE(HAVE_ISNANL)
fi
AC_CHECK_FUNCS(__cxa_thread_atexit)
+ AC_CHECK_FUNCS(aligned_alloc posix_memalign memalign _aligned_malloc)
;;
*-fuchsia*)
@@ -197,6 +198,7 @@ case "${host}" in
GLIBCXX_CHECK_LINKER_FEATURES
GLIBCXX_CHECK_MATH_SUPPORT
GLIBCXX_CHECK_STDLIB_SUPPORT
+ AC_CHECK_FUNCS(aligned_alloc posix_memalign memalign _aligned_malloc)
;;
*-netbsd*)
SECTION_FLAGS='-ffunction-sections -fdata-sections'
diff --git a/libstdc++-v3/include/c_global/cstdlib b/libstdc++-v3/include/c_global/cstdlib
index 006ac689763..52d5255592f 100644
--- a/libstdc++-v3/include/c_global/cstdlib
+++ b/libstdc++-v3/include/c_global/cstdlib
@@ -78,6 +78,9 @@ namespace std
// Get rid of those macros defined in <stdlib.h> in lieu of real functions.
#undef abort
+#if __cplusplus >= 201703L && defined(_GLIBCXX_HAVE_ALIGNED_ALLOC)
+# undef aligned_alloc
+#endif
#undef atexit
#if __cplusplus >= 201103L
# ifdef _GLIBCXX_HAVE_AT_QUICK_EXIT
@@ -125,6 +128,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
using ::ldiv_t;
using ::abort;
+#if __cplusplus >= 201703L && defined(_GLIBCXX_HAVE_ALIGNED_ALLOC)
+ using ::aligned_alloc;
+#endif
using ::atexit;
#if __cplusplus >= 201103L
# ifdef _GLIBCXX_HAVE_AT_QUICK_EXIT
diff --git a/libstdc++-v3/include/std/variant b/libstdc++-v3/include/std/variant
index 1f1a8492323..0180eefd169 100644
--- a/libstdc++-v3/include/std/variant
+++ b/libstdc++-v3/include/std/variant
@@ -741,7 +741,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
static_assert(__detail::__variant::__exactly_once<_Tp, _Types...>,
"T should occur for exactly once in alternatives");
static_assert(!is_void_v<_Tp>, "_Tp should not be void");
- return get<__detail::__variant::__index_of_v<_Tp, _Types...>>(__v);
+ return std::get<__detail::__variant::__index_of_v<_Tp, _Types...>>(__v);
}
template<typename _Tp, typename... _Types>
@@ -750,7 +750,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
static_assert(__detail::__variant::__exactly_once<_Tp, _Types...>,
"T should occur for exactly once in alternatives");
static_assert(!is_void_v<_Tp>, "_Tp should not be void");
- return get<__detail::__variant::__index_of_v<_Tp, _Types...>>(
+ return std::get<__detail::__variant::__index_of_v<_Tp, _Types...>>(
std::move(__v));
}
@@ -760,7 +760,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
static_assert(__detail::__variant::__exactly_once<_Tp, _Types...>,
"T should occur for exactly once in alternatives");
static_assert(!is_void_v<_Tp>, "_Tp should not be void");
- return get<__detail::__variant::__index_of_v<_Tp, _Types...>>(__v);
+ return std::get<__detail::__variant::__index_of_v<_Tp, _Types...>>(__v);
}
template<typename _Tp, typename... _Types>
@@ -769,7 +769,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
static_assert(__detail::__variant::__exactly_once<_Tp, _Types...>,
"T should occur for exactly once in alternatives");
static_assert(!is_void_v<_Tp>, "_Tp should not be void");
- return get<__detail::__variant::__index_of_v<_Tp, _Types...>>(
+ return std::get<__detail::__variant::__index_of_v<_Tp, _Types...>>(
std::move(__v));
}
@@ -808,7 +808,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
static_assert(__detail::__variant::__exactly_once<_Tp, _Types...>,
"T should occur for exactly once in alternatives");
static_assert(!is_void_v<_Tp>, "_Tp should not be void");
- return get_if<__detail::__variant::__index_of_v<_Tp, _Types...>>(__ptr);
+ return std::get_if<__detail::__variant::__index_of_v<_Tp, _Types...>>(
+ __ptr);
}
template<typename _Tp, typename... _Types>
@@ -819,7 +820,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
static_assert(__detail::__variant::__exactly_once<_Tp, _Types...>,
"T should occur for exactly once in alternatives");
static_assert(!is_void_v<_Tp>, "_Tp should not be void");
- return get_if<__detail::__variant::__index_of_v<_Tp, _Types...>>(__ptr);
+ return std::get_if<__detail::__variant::__index_of_v<_Tp, _Types...>>(
+ __ptr);
}
struct monostate { };
diff --git a/libstdc++-v3/testsuite/18_support/aligned_alloc/aligned_alloc.cc b/libstdc++-v3/testsuite/18_support/aligned_alloc/aligned_alloc.cc
new file mode 100644
index 00000000000..1700df8fdda
--- /dev/null
+++ b/libstdc++-v3/testsuite/18_support/aligned_alloc/aligned_alloc.cc
@@ -0,0 +1,42 @@
+// Copyright (C) 2018 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-options "-std=gnu++17" }
+// { dg-do run { target c++1z } }
+
+#include <cstdlib>
+#include <cstdint>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+#ifdef _GLIBCXX_HAVE_ALIGNED_ALLOC
+ void* p = std::aligned_alloc(256, 1);
+ if (p)
+ {
+ VERIFY( (reinterpret_cast<std::uintptr_t>(p) % 256) == 0 );
+ std::free(p);
+ }
+#endif
+}
+
+int
+main()
+{
+ test01();
+}