From 7595b0aceeb462800c469fc0a5764cc3af8a4bb5 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Tue, 5 Mar 2019 00:16:22 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@269380 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 6cc47af160f..8db54c9cc93 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190304 +20190305 -- cgit v1.2.3 From c942547b59f7395e083f6fdf1006766996791126 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Tue, 5 Mar 2019 08:26:32 +0000 Subject: 2019-03-05 Richard Biener Backport from mainline 2019-02-26 Richard Biener PR tree-optimization/89505 * tree-ssa-structalias.c (compute_dependence_clique): Make sure to handle restrict pointed-to vars with multiple subvars correctly. * gcc.dg/torture/pr89505.c: New testcase. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@269383 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 10 ++++++++++ gcc/testsuite/ChangeLog | 8 ++++++++ gcc/testsuite/gcc.dg/torture/pr89505.c | 22 ++++++++++++++++++++++ gcc/tree-ssa-structalias.c | 5 ++++- 4 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.dg/torture/pr89505.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 9b96616ea4c..29945bab951 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +2019-03-05 Richard Biener + + Backport from mainline + 2019-02-26 Richard Biener + + PR tree-optimization/89505 + * tree-ssa-structalias.c (compute_dependence_clique): Make sure + to handle restrict pointed-to vars with multiple subvars + correctly. + 2019-03-01 Tamar Christina PR target/89517 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index aa95fd0ece6..d3d02ddcd39 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2019-03-05 Richard Biener + + Backport from mainline + 2019-02-26 Richard Biener + + PR tree-optimization/89505 + * gcc.dg/torture/pr89505.c: New testcase. + 2019-03-03 Harald Anlauf Backport from trunk diff --git a/gcc/testsuite/gcc.dg/torture/pr89505.c b/gcc/testsuite/gcc.dg/torture/pr89505.c new file mode 100644 index 00000000000..6fca475ad9d --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr89505.c @@ -0,0 +1,22 @@ +/* { dg-do run } */ + +struct S { int i; void *p; int j; }; +int a; +int __attribute__((noinline)) +foo (struct S * __restrict p, int q) +{ + int *x = &p->j; + if (q) + x = &a; + p->j = 1; + *x = 2; + return p->j; +} + +int main() +{ + struct S s; + if (foo (&s, 0) != 2) + __builtin_abort (); + return 0; +} diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c index 373946f518a..0e69629f879 100644 --- a/gcc/tree-ssa-structalias.c +++ b/gcc/tree-ssa-structalias.c @@ -7552,7 +7552,10 @@ compute_dependence_clique (void) } if (used) { - bitmap_set_bit (rvars, restrict_var->id); + /* Add all subvars to the set of restrict pointed-to set. */ + for (unsigned sv = restrict_var->head; sv != 0; + sv = get_varinfo (sv)->next) + bitmap_set_bit (rvars, sv); varinfo_t escaped = get_varinfo (find (escaped_id)); if (bitmap_bit_p (escaped->solution, restrict_var->id)) escaped_p = true; -- cgit v1.2.3 From 5f22b30838369a7c957feb409834d6b17acfb5d3 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Wed, 6 Mar 2019 00:16:09 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@269408 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 8db54c9cc93..3e15e1464c6 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190305 +20190306 -- cgit v1.2.3 From 48d23232562a5c2ddf96b1d8679da62f72dfe948 Mon Sep 17 00:00:00 2001 From: Xiong Hu Luo Date: Wed, 6 Mar 2019 02:19:35 +0000 Subject: backport r268834 from mainline to gcc-8-branch Backport r268834 of "Add support for the vec_sbox_be, vec_cipher_be etc." from mainline to gcc-8-branch. gcc/ChangeLog: 2019-03-06 Xiong Hu Luo Backport of r268834 from mainline to gcc-8-branch. 2019-02-13 Xiong Hu Luo * config/rs6000/altivec.h (vec_sbox_be, vec_cipher_be, vec_cipherlast_be, vec_ncipher_be, vec_ncipherlast_be): New #defines. * config/rs6000/crypto.md (CR_vqdi): New define_mode_iterator. (crypto_vsbox_, crypto__): New define_insns. * config/rs6000/rs6000-builtin.def (VSBOX_BE): New BU_CRYPTO_1. (VCIPHER_BE, VCIPHERLAST_BE, VNCIPHER_BE, VNCIPHERLAST_BE): New BU_CRYPTO_2. * config/rs6000/rs6000.c (builtin_function_type) : New switch options. * doc/extend.texi (vec_sbox_be, vec_cipher_be, vec_cipherlast_be, vec_ncipher_be, vec_ncipherlast_be): New builtin functions. gcc/testsuite/ChangeLog: 2019-03-06 Xiong Hu Luo Backport of r268834 from mainline to gcc-8-branch. 2019-01-23 Xiong Hu Luo * gcc.target/powerpc/crypto-builtin-1.c (crypto1_be, crypto2_be, crypto3_be, crypto4_be, crypto5_be): New testcases. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@269410 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 19 +++++++++++ gcc/config/rs6000/altivec.h | 5 +++ gcc/config/rs6000/crypto.md | 17 ++++++---- gcc/config/rs6000/rs6000-builtin.def | 19 ++++++++--- gcc/config/rs6000/rs6000.c | 5 +++ gcc/doc/extend.texi | 13 ++++++++ gcc/testsuite/ChangeLog | 9 +++++ .../gcc.target/powerpc/crypto-builtin-1.c | 38 ++++++++++++++++++---- 8 files changed, 107 insertions(+), 18 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 29945bab951..a21a49728aa 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,22 @@ +2019-03-06 Xiong Hu Luo + + Backport of r268834 from mainline to gcc-8-branch. + 2019-02-13 Xiong Hu Luo + + * config/rs6000/altivec.h (vec_sbox_be, vec_cipher_be, + vec_cipherlast_be, vec_ncipher_be, vec_ncipherlast_be): New #defines. + * config/rs6000/crypto.md (CR_vqdi): New define_mode_iterator. + (crypto_vsbox_, crypto__): New define_insns. + * config/rs6000/rs6000-builtin.def (VSBOX_BE): New BU_CRYPTO_1. + (VCIPHER_BE, VCIPHERLAST_BE, VNCIPHER_BE, VNCIPHERLAST_BE): + New BU_CRYPTO_2. + * config/rs6000/rs6000.c (builtin_function_type) + : New switch options. + * doc/extend.texi (vec_sbox_be, vec_cipher_be, vec_cipherlast_be, + vec_ncipher_be, vec_ncipherlast_be): New builtin functions. + 2019-03-05 Richard Biener Backport from mainline diff --git a/gcc/config/rs6000/altivec.h b/gcc/config/rs6000/altivec.h index 5a3416235da..6c5757eadf5 100644 --- a/gcc/config/rs6000/altivec.h +++ b/gcc/config/rs6000/altivec.h @@ -418,6 +418,11 @@ #define vec_vupkhsw __builtin_vec_vupkhsw #define vec_vupklsw __builtin_vec_vupklsw #define vec_revb __builtin_vec_revb +#define vec_sbox_be __builtin_crypto_vsbox_be +#define vec_cipher_be __builtin_crypto_vcipher_be +#define vec_cipherlast_be __builtin_crypto_vcipherlast_be +#define vec_ncipher_be __builtin_crypto_vncipher_be +#define vec_ncipherlast_be __builtin_crypto_vncipherlast_be #endif #ifdef __POWER9_VECTOR__ diff --git a/gcc/config/rs6000/crypto.md b/gcc/config/rs6000/crypto.md index 0f34e141580..5dc569996e2 100644 --- a/gcc/config/rs6000/crypto.md +++ b/gcc/config/rs6000/crypto.md @@ -48,6 +48,9 @@ ;; Iterator for VSHASIGMAD/VSHASIGMAW (define_mode_iterator CR_hash [V4SI V2DI]) +;; Iterator for VSBOX/VCIPHER/VNCIPHER/VCIPHERLAST/VNCIPHERLAST +(define_mode_iterator CR_vqdi [V16QI V2DI]) + ;; Iterator for the other crypto functions (define_int_iterator CR_code [UNSPEC_VCIPHER UNSPEC_VNCIPHER @@ -60,10 +63,10 @@ (UNSPEC_VNCIPHERLAST "vncipherlast")]) ;; 2 operand crypto instructions -(define_insn "crypto_" - [(set (match_operand:V2DI 0 "register_operand" "=v") - (unspec:V2DI [(match_operand:V2DI 1 "register_operand" "v") - (match_operand:V2DI 2 "register_operand" "v")] +(define_insn "crypto__" + [(set (match_operand:CR_vqdi 0 "register_operand" "=v") + (unspec:CR_vqdi [(match_operand:CR_vqdi 1 "register_operand" "v") + (match_operand:CR_vqdi 2 "register_operand" "v")] CR_code))] "TARGET_CRYPTO" " %0,%1,%2" @@ -90,9 +93,9 @@ [(set_attr "type" "vecperm")]) ;; 1 operand crypto instruction -(define_insn "crypto_vsbox" - [(set (match_operand:V2DI 0 "register_operand" "=v") - (unspec:V2DI [(match_operand:V2DI 1 "register_operand" "v")] +(define_insn "crypto_vsbox_" + [(set (match_operand:CR_vqdi 0 "register_operand" "=v") + (unspec:CR_vqdi [(match_operand:CR_vqdi 1 "register_operand" "v")] UNSPEC_VSBOX))] "TARGET_CRYPTO" "vsbox %0,%1" diff --git a/gcc/config/rs6000/rs6000-builtin.def b/gcc/config/rs6000/rs6000-builtin.def index 5abbd3e791b..d2896fce7c3 100644 --- a/gcc/config/rs6000/rs6000-builtin.def +++ b/gcc/config/rs6000/rs6000-builtin.def @@ -2442,13 +2442,22 @@ BU_P9_OVERLOAD_2 (CMPRB2, "byte_in_either_range") BU_P9_OVERLOAD_2 (CMPEQB, "byte_in_set") /* 1 argument crypto functions. */ -BU_CRYPTO_1 (VSBOX, "vsbox", CONST, crypto_vsbox) +BU_CRYPTO_1 (VSBOX, "vsbox", CONST, crypto_vsbox_v2di) +BU_CRYPTO_1 (VSBOX_BE, "vsbox_be", CONST, crypto_vsbox_v16qi) /* 2 argument crypto functions. */ -BU_CRYPTO_2 (VCIPHER, "vcipher", CONST, crypto_vcipher) -BU_CRYPTO_2 (VCIPHERLAST, "vcipherlast", CONST, crypto_vcipherlast) -BU_CRYPTO_2 (VNCIPHER, "vncipher", CONST, crypto_vncipher) -BU_CRYPTO_2 (VNCIPHERLAST, "vncipherlast", CONST, crypto_vncipherlast) +BU_CRYPTO_2 (VCIPHER, "vcipher", CONST, crypto_vcipher_v2di) +BU_CRYPTO_2 (VCIPHER_BE, "vcipher_be", CONST, crypto_vcipher_v16qi) +BU_CRYPTO_2 (VCIPHERLAST, "vcipherlast", + CONST, crypto_vcipherlast_v2di) +BU_CRYPTO_2 (VCIPHERLAST_BE, "vcipherlast_be", + CONST, crypto_vcipherlast_v16qi) +BU_CRYPTO_2 (VNCIPHER, "vncipher", CONST, crypto_vncipher_v2di) +BU_CRYPTO_2 (VNCIPHER_BE, "vncipher_be", CONST, crypto_vncipher_v16qi) +BU_CRYPTO_2 (VNCIPHERLAST, "vncipherlast", + CONST, crypto_vncipherlast_v2di) +BU_CRYPTO_2 (VNCIPHERLAST_BE, "vncipherlast_be", + CONST, crypto_vncipherlast_v16qi) BU_CRYPTO_2A (VPMSUMB, "vpmsumb", CONST, crypto_vpmsumb) BU_CRYPTO_2A (VPMSUMH, "vpmsumh", CONST, crypto_vpmsumh) BU_CRYPTO_2A (VPMSUMW, "vpmsumw", CONST, crypto_vpmsumw) diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index fdc7285bb74..fee41e171a7 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -18251,6 +18251,7 @@ builtin_function_type (machine_mode mode_ret, machine_mode mode_arg0, { /* unsigned 1 argument functions. */ case CRYPTO_BUILTIN_VSBOX: + case CRYPTO_BUILTIN_VSBOX_BE: case P8V_BUILTIN_VGBBD: case MISC_BUILTIN_CDTBCD: case MISC_BUILTIN_CBCDTD: @@ -18266,9 +18267,13 @@ builtin_function_type (machine_mode mode_ret, machine_mode mode_arg0, case ALTIVEC_BUILTIN_VMULOUH: case P8V_BUILTIN_VMULOUW: case CRYPTO_BUILTIN_VCIPHER: + case CRYPTO_BUILTIN_VCIPHER_BE: case CRYPTO_BUILTIN_VCIPHERLAST: + case CRYPTO_BUILTIN_VCIPHERLAST_BE: case CRYPTO_BUILTIN_VNCIPHER: + case CRYPTO_BUILTIN_VNCIPHER_BE: case CRYPTO_BUILTIN_VNCIPHERLAST: + case CRYPTO_BUILTIN_VNCIPHERLAST_BE: case CRYPTO_BUILTIN_VPMSUMB: case CRYPTO_BUILTIN_VPMSUMH: case CRYPTO_BUILTIN_VPMSUMW: diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi index 11e926e9d47..297f7d5975b 100644 --- a/gcc/doc/extend.texi +++ b/gcc/doc/extend.texi @@ -19708,20 +19708,33 @@ If the cryptographic instructions are enabled (@option{-mcrypto} or @smallexample vector unsigned long long __builtin_crypto_vsbox (vector unsigned long long); +vector unsigned char vec_sbox_be (vector unsigned char); + vector unsigned long long __builtin_crypto_vcipher (vector unsigned long long, vector unsigned long long); +vector unsigned char vec_cipher_be (vector unsigned char, vector unsigned char); + vector unsigned long long __builtin_crypto_vcipherlast (vector unsigned long long, vector unsigned long long); +vector unsigned char vec_cipherlast_be (vector unsigned char, + vector unsigned char); + vector unsigned long long __builtin_crypto_vncipher (vector unsigned long long, vector unsigned long long); +vector unsigned char vec_ncipher_be (vector unsigned char, + vector unsigned char); + vector unsigned long long __builtin_crypto_vncipherlast (vector unsigned long long, vector unsigned long long); +vector unsigned char vec_ncipherlast_be (vector unsigned char, + vector unsigned char); + vector unsigned char __builtin_crypto_vpermxor (vector unsigned char, vector unsigned char, vector unsigned char); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index d3d02ddcd39..0db36e31e32 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,12 @@ +2019-03-06 Xiong Hu Luo + + Backport of r268834 from mainline to gcc-8-branch. + 2019-01-23 Xiong Hu Luo + + * gcc.target/powerpc/crypto-builtin-1.c + (crypto1_be, crypto2_be, crypto3_be, crypto4_be, crypto5_be): + New testcases. + 2019-03-05 Richard Biener Backport from mainline diff --git a/gcc/testsuite/gcc.target/powerpc/crypto-builtin-1.c b/gcc/testsuite/gcc.target/powerpc/crypto-builtin-1.c index 234041d5c35..38245ffc370 100644 --- a/gcc/testsuite/gcc.target/powerpc/crypto-builtin-1.c +++ b/gcc/testsuite/gcc.target/powerpc/crypto-builtin-1.c @@ -4,37 +4,63 @@ /* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } */ /* { dg-options "-mcpu=power8 -O2 -ftree-vectorize -fvect-cost-model=dynamic -fno-unroll-loops -fno-unroll-all-loops" } */ +#include typedef vector unsigned long long crypto_t; typedef vector unsigned long long v2di_t; typedef vector unsigned int v4si_t; typedef vector unsigned short v8hi_t; typedef vector unsigned char v16qi_t; -crypto_t crpyto1 (crypto_t a) +crypto_t crypto1 (crypto_t a) { return __builtin_crypto_vsbox (a); } +v16qi_t crypto1_be (v16qi_t a) +{ + return vec_sbox_be (a); +} + crypto_t crypto2 (crypto_t a, crypto_t b) { return __builtin_crypto_vcipher (a, b); } +v16qi_t crypto2_be (v16qi_t a, v16qi_t b) +{ + return vec_cipher_be (a, b); +} + crypto_t crypto3 (crypto_t a, crypto_t b) { return __builtin_crypto_vcipherlast (a, b); } +v16qi_t crypto3_be (v16qi_t a, v16qi_t b) +{ + return vec_cipherlast_be (a, b); +} + crypto_t crypto4 (crypto_t a, crypto_t b) { return __builtin_crypto_vncipher (a, b); } +v16qi_t crypto4_be (v16qi_t a, v16qi_t b) +{ + return vec_ncipher_be (a, b); +} + crypto_t crypto5 (crypto_t a, crypto_t b) { return __builtin_crypto_vncipherlast (a, b); } +v16qi_t crypto5_be (v16qi_t a, v16qi_t b) +{ + return vec_ncipherlast_be (a, b); +} + v16qi_t crypto6a (v16qi_t a, v16qi_t b, v16qi_t c) { return __builtin_crypto_vpermxor (a, b, c); @@ -117,15 +143,15 @@ v4si_t crypto8d (v4si_t a) /* Note space is used after the instruction so that vcipherlast does not match vcipher. */ -/* { dg-final { scan-assembler-times "vcipher " 1 } } */ -/* { dg-final { scan-assembler-times "vcipherlast " 1 } } */ -/* { dg-final { scan-assembler-times "vncipher " 1 } } */ -/* { dg-final { scan-assembler-times "vncipherlast " 1 } } */ +/* { dg-final { scan-assembler-times "vcipher " 2 } } */ +/* { dg-final { scan-assembler-times "vcipherlast " 2 } } */ +/* { dg-final { scan-assembler-times "vncipher " 2 } } */ +/* { dg-final { scan-assembler-times "vncipherlast " 2 } } */ /* { dg-final { scan-assembler-times "vpermxor " 4 } } */ /* { dg-final { scan-assembler-times "vpmsumb " 2 } } */ /* { dg-final { scan-assembler-times "vpmsumd " 2 } } */ /* { dg-final { scan-assembler-times "vpmsumh " 2 } } */ /* { dg-final { scan-assembler-times "vpmsumw " 2 } } */ -/* { dg-final { scan-assembler-times "vsbox " 1 } } */ +/* { dg-final { scan-assembler-times "vsbox " 2 } } */ /* { dg-final { scan-assembler-times "vshasigmad " 2 } } */ /* { dg-final { scan-assembler-times "vshasigmaw " 2 } } */ -- cgit v1.2.3 From bcb29513791ec15d321bccc330758d7939734d24 Mon Sep 17 00:00:00 2001 From: Tamar Christina Date: Wed, 6 Mar 2019 09:34:04 +0000 Subject: AArch64: Have empty HWCAPs string ignored during native feature detection. This patch makes the feature detection code for AArch64 GCC not add features automatically when the feature had no hwcaps string to match against. This means that -mcpu=native no longer adds feature flags such as +profile. The behavior wasn't noticed before because at the time +profile was added a bug was preventing any feature bits from being added by native detections. The loop has also been changed as Jakub specified in order to avoid a memory leak that was present in the existing code and to be slightly more efficient. gcc/ChangeLog: Backport from trunk. 2019-02-28 Tamar Christina PR target/88530 * config/aarch64/aarch64-option-extensions.def: Document it. * config/aarch64/driver-aarch64.c (host_detect_local_cpu): Skip feature if empty hwcaps. gcc/testsuite/ChangeLog: Backport from trunk. 2019-02-28 Tamar Christina PR target/88530 * gcc.target/aarch64/options_set_10.c: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@269412 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 10 +++++++ gcc/config/aarch64/aarch64-option-extensions.def | 3 ++- gcc/config/aarch64/driver-aarch64.c | 32 ++++++++++++++--------- gcc/testsuite/ChangeLog | 8 ++++++ gcc/testsuite/gcc.target/aarch64/options_set_10.c | 11 ++++++++ 5 files changed, 51 insertions(+), 13 deletions(-) create mode 100644 gcc/testsuite/gcc.target/aarch64/options_set_10.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a21a49728aa..60feab73864 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +2019-03-06 Tamar Christina + + Backport from trunk. + 2019-02-28 Tamar Christina + + PR target/88530 + * config/aarch64/aarch64-option-extensions.def: Document it. + * config/aarch64/driver-aarch64.c (host_detect_local_cpu): Skip feature + if empty hwcaps. + 2019-03-06 Xiong Hu Luo Backport of r268834 from mainline to gcc-8-branch. diff --git a/gcc/config/aarch64/aarch64-option-extensions.def b/gcc/config/aarch64/aarch64-option-extensions.def index a1b71cedb14..749ee2b3417 100644 --- a/gcc/config/aarch64/aarch64-option-extensions.def +++ b/gcc/config/aarch64/aarch64-option-extensions.def @@ -36,7 +36,8 @@ the extension (for example, the 'crypto' extension depends on four entries: aes, pmull, sha1, sha2 being present). In that case this field should contain a space (" ") separated list of the strings in 'Features' - that are required. Their order is not important. */ + that are required. Their order is not important. An empty string means + do not detect this feature during auto detection. */ /* NOTE: This file is being parsed by config.gcc and so the AARCH64_OPT_EXTENSION must adhere to a strict format: diff --git a/gcc/config/aarch64/driver-aarch64.c b/gcc/config/aarch64/driver-aarch64.c index 4e83c7a7679..896f0d08720 100644 --- a/gcc/config/aarch64/driver-aarch64.c +++ b/gcc/config/aarch64/driver-aarch64.c @@ -249,27 +249,35 @@ host_detect_local_cpu (int argc, const char **argv) { for (i = 0; i < num_exts; i++) { - char *p = NULL; - char *feat_string - = concat (aarch64_extensions[i].feat_string, NULL); + const char *p = aarch64_extensions[i].feat_string; + + /* If the feature contains no HWCAPS string then ignore it for the + auto detection. */ + if (*p == '\0') + continue; + bool enabled = true; /* This may be a multi-token feature string. We need - to match all parts, which could be in any order. - If this isn't a multi-token feature string, strtok is - just going to return a pointer to feat_string. */ - p = strtok (feat_string, " "); - while (p != NULL) + to match all parts, which could be in any order. */ + size_t len = strlen (buf); + do { - if (strstr (buf, p) == NULL) + const char *end = strchr (p, ' '); + if (end == NULL) + end = strchr (p, '\0'); + if (memmem (buf, len, p, end - p) == NULL) { /* Failed to match this token. Turn off the features we'd otherwise enable. */ enabled = false; break; } - p = strtok (NULL, " "); + if (*end == '\0') + break; + p = end + 1; } + while (1); if (enabled) extension_flags |= aarch64_extensions[i].flag; @@ -359,12 +367,12 @@ host_detect_local_cpu (int argc, const char **argv) not_found: { /* If detection fails we ignore the option. - Clean up and return empty string. */ + Clean up and return NULL. */ if (f) fclose (f); - return ""; + return NULL; } } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 0db36e31e32..24e847f381d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2019-03-06 Tamar Christina + + Backport from trunk. + 2019-02-28 Tamar Christina + + PR target/88530 + * gcc.target/aarch64/options_set_10.c: New test. + 2019-03-06 Xiong Hu Luo Backport of r268834 from mainline to gcc-8-branch. diff --git a/gcc/testsuite/gcc.target/aarch64/options_set_10.c b/gcc/testsuite/gcc.target/aarch64/options_set_10.c new file mode 100644 index 00000000000..1fc8aa86fd6 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/options_set_10.c @@ -0,0 +1,11 @@ +/* { dg-do compile { target { { aarch64*-*-linux*} && native } } } */ +/* { dg-additional-options "-mcpu=native" } */ + +int main () +{ + return 0; +} + +/* { dg-final { scan-assembler-not {\.arch .+\+profile.*} } } */ + + /* Check that an empty feature string is not detected during mcpu=native. */ -- cgit v1.2.3 From 1211d026cad06bed80cf6b14cf7de32ac6370fb7 Mon Sep 17 00:00:00 2001 From: Tamar Christina Date: Wed, 6 Mar 2019 09:49:00 +0000 Subject: AArch64: Fix command line options canonicalization version. Commandline options on AArch64 don't get canonicalized into the smallest possible set before output to the assembler. This means that overlapping feature sets are emitted with superfluous parts. Normally this isn't an issue, but in the case of crypto we have retro-actively split it into aes and sha2. We need to emit only +crypto to the assembler so old assemblers continue to work. Because of how -mcpu=native and -march=native work they end up enabling all feature bits. Instead we need to get the smallest possible set, which would also fix the problem with older the assemblers and the retro-active split. The function that handles this is called quite often. It is called for any push/pop options or attribute that changes arch, cpu etc. In order to not make this search for the smallest set too expensive we sort the options based on the number of features (bits) they enable. This allows us to process the list linearly instead of quadratically (Once we have enabled a feature, we know that anything else that enables it can be ignored. By sorting we'll get the biggest groups first and thus the smallest combination of commandline flags). The Option handling structures have been extended to have a boolean to indicate whether the option is synthetic, with that I mean if the option flag itself enables a new feature. e.g. +crypto isn't an actual feature, it just enables other features, but others like +rdma enable multiple dependent features but is itself also a feature. There are two ways to solve this. 1) Either have the options that are feature bits also turn themselves on, e.g. change rdma to turn on FP, SIMD and RDMA as dependency bits. 2) Make a distinction between these two different type of features and have the framework handle it correctly. Even though it's more code I went for the second approach, as it's the one that'll be less fragile (people can't forget it) and gives the least surprises. Effectively this patch changes the following: The values before the => are the old compiler and after the => the new code. -march=armv8.2-a+crypto+sha2 => -march=armv8.2-a+crypto -march=armv8.2-a+sha2+aes => -march=armv8.2-a+crypto The remaining behaviors stay the same. gcc/ChangeLog: Backport from trunk. 2019-02-25 Tamar Christina PR target/88530 * common/config/aarch64/aarch64-common.c (struct aarch64_option_extension): Add is_synthetic. (all_extensions): Use it. (TARGET_OPTION_INIT_STRUCT): Define hook. (struct gcc_targetm_common): Moved to end. (all_extensions_by_on): New. (opt_ext_cmp, typedef opt_ext): New. (aarch64_option_init_struct): New. (aarch64_contains_opt): New. (aarch64_get_extension_string_for_isa_flags): Output smallest set. * config/aarch64/aarch64-option-extensions.def (AARCH64_OPT_EXTENSION): Explicitly include AES and SHA2 in crypto. (fp, simd, crc, lse, fp16, rcpc, rdma, dotprod, aes, sha2, sha3, sm4, fp16fml, sve): Set is_synthetic to false. (crypto): Set is_synthetic to true. * config/aarch64/driver-aarch64.c (AARCH64_OPT_EXTENSION): Add SYNTHETIC. gcc/testsuite/ChangeLog: Backport from trunk. 2019-02-25 Tamar Christina PR target/88530 * gcc.target/aarch64/options_set_1.c: New test. * gcc.target/aarch64/options_set_2.c: New test. * gcc.target/aarch64/options_set_3.c: New test. * gcc.target/aarch64/options_set_4.c: New test. * gcc.target/aarch64/options_set_5.c: New test. * gcc.target/aarch64/options_set_6.c: New test. * gcc.target/aarch64/options_set_7.c: New test. * gcc.target/aarch64/options_set_8.c: New test. * gcc.target/aarch64/options_set_9.c: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@269413 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 25 +++ gcc/common/config/aarch64/aarch64-common.c | 200 ++++++++++++++++++++--- gcc/config/aarch64/aarch64-option-extensions.def | 74 +++++---- gcc/config/aarch64/driver-aarch64.c | 3 +- gcc/testsuite/ChangeLog | 25 +++ gcc/testsuite/gcc.target/aarch64/options_set_1.c | 11 ++ gcc/testsuite/gcc.target/aarch64/options_set_2.c | 11 ++ gcc/testsuite/gcc.target/aarch64/options_set_3.c | 11 ++ gcc/testsuite/gcc.target/aarch64/options_set_4.c | 12 ++ gcc/testsuite/gcc.target/aarch64/options_set_5.c | 12 ++ gcc/testsuite/gcc.target/aarch64/options_set_6.c | 12 ++ gcc/testsuite/gcc.target/aarch64/options_set_7.c | 11 ++ gcc/testsuite/gcc.target/aarch64/options_set_8.c | 12 ++ gcc/testsuite/gcc.target/aarch64/options_set_9.c | 14 ++ 14 files changed, 377 insertions(+), 56 deletions(-) create mode 100644 gcc/testsuite/gcc.target/aarch64/options_set_1.c create mode 100644 gcc/testsuite/gcc.target/aarch64/options_set_2.c create mode 100644 gcc/testsuite/gcc.target/aarch64/options_set_3.c create mode 100644 gcc/testsuite/gcc.target/aarch64/options_set_4.c create mode 100644 gcc/testsuite/gcc.target/aarch64/options_set_5.c create mode 100644 gcc/testsuite/gcc.target/aarch64/options_set_6.c create mode 100644 gcc/testsuite/gcc.target/aarch64/options_set_7.c create mode 100644 gcc/testsuite/gcc.target/aarch64/options_set_8.c create mode 100644 gcc/testsuite/gcc.target/aarch64/options_set_9.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 60feab73864..87d6db9003c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,28 @@ +2019-03-06 Tamar Christina + + Backport from trunk. + 2019-02-25 Tamar Christina + + PR target/88530 + * common/config/aarch64/aarch64-common.c + (struct aarch64_option_extension): Add is_synthetic. + (all_extensions): Use it. + (TARGET_OPTION_INIT_STRUCT): Define hook. + (struct gcc_targetm_common): Moved to end. + (all_extensions_by_on): New. + (opt_ext_cmp, typedef opt_ext): New. + (aarch64_option_init_struct): New. + (aarch64_contains_opt): New. + (aarch64_get_extension_string_for_isa_flags): Output smallest set. + * config/aarch64/aarch64-option-extensions.def + (AARCH64_OPT_EXTENSION): Explicitly include AES and SHA2 in crypto. + (fp, simd, crc, lse, fp16, rcpc, rdma, dotprod, aes, sha2, sha3, + sm4, fp16fml, sve): + Set is_synthetic to false. + (crypto): Set is_synthetic to true. + * config/aarch64/driver-aarch64.c (AARCH64_OPT_EXTENSION): Add + SYNTHETIC. + 2019-03-06 Tamar Christina Backport from trunk. diff --git a/gcc/common/config/aarch64/aarch64-common.c b/gcc/common/config/aarch64/aarch64-common.c index a9fc5f1707e..4bd61e8be1f 100644 --- a/gcc/common/config/aarch64/aarch64-common.c +++ b/gcc/common/config/aarch64/aarch64-common.c @@ -41,6 +41,8 @@ #undef TARGET_OPTION_OPTIMIZATION_TABLE #define TARGET_OPTION_OPTIMIZATION_TABLE aarch_option_optimization_table +#undef TARGET_OPTION_INIT_STRUCT +#define TARGET_OPTION_INIT_STRUCT aarch64_option_init_struct /* Set default optimization options. */ static const struct default_options aarch_option_optimization_table[] = @@ -113,8 +115,6 @@ aarch64_handle_option (struct gcc_options *opts, } } -struct gcc_targetm_common targetm_common = TARGETM_COMMON_INITIALIZER; - /* An ISA extension in the co-processor and main instruction set space. */ struct aarch64_option_extension { @@ -122,15 +122,28 @@ struct aarch64_option_extension const unsigned long flag_canonical; const unsigned long flags_on; const unsigned long flags_off; + const bool is_synthetic; }; /* ISA extensions in AArch64. */ static const struct aarch64_option_extension all_extensions[] = { -#define AARCH64_OPT_EXTENSION(NAME, FLAG_CANONICAL, FLAGS_ON, FLAGS_OFF, Z) \ - {NAME, FLAG_CANONICAL, FLAGS_ON, FLAGS_OFF}, +#define AARCH64_OPT_EXTENSION(NAME, FLAG_CANONICAL, FLAGS_ON, FLAGS_OFF, \ + SYNTHETIC, Z) \ + {NAME, FLAG_CANONICAL, FLAGS_ON, FLAGS_OFF, SYNTHETIC}, +#include "config/aarch64/aarch64-option-extensions.def" + {NULL, 0, 0, 0, false} +}; + +/* A copy of the ISA extensions list for AArch64 sorted by the popcount of + bits and extension turned on. Cached for efficiency. */ +static struct aarch64_option_extension all_extensions_by_on[] = +{ +#define AARCH64_OPT_EXTENSION(NAME, FLAG_CANONICAL, FLAGS_ON, FLAGS_OFF, \ + SYNTHETIC, Z) \ + {NAME, FLAG_CANONICAL, FLAGS_ON, FLAGS_OFF, SYNTHETIC}, #include "config/aarch64/aarch64-option-extensions.def" - {NULL, 0, 0, 0} + {NULL, 0, 0, 0, false} }; struct processor_name_to_arch @@ -232,6 +245,76 @@ aarch64_parse_extension (const char *str, unsigned long *isa_flags) return AARCH64_PARSE_OK; } +/* Comparer to sort aarch64's feature extensions by population count. Largest + first. */ + +typedef const struct aarch64_option_extension opt_ext; + +int opt_ext_cmp (const void* a, const void* b) +{ + opt_ext *opt_a = (opt_ext *)a; + opt_ext *opt_b = (opt_ext *)b; + + /* We consider the total set of bits an options turns on to be the union of + the singleton set containing the option itself and the set of options it + turns on as a dependency. As an example +dotprod turns on FL_DOTPROD and + FL_SIMD. As such the set of bits represented by this option is + {FL_DOTPROD, FL_SIMD}. */ + unsigned long total_flags_a = opt_a->flag_canonical & opt_a->flags_on; + unsigned long total_flags_b = opt_b->flag_canonical & opt_b->flags_on; + int popcnt_a = popcount_hwi ((HOST_WIDE_INT)total_flags_a); + int popcnt_b = popcount_hwi ((HOST_WIDE_INT)total_flags_b); + int order = popcnt_b - popcnt_a; + + /* If they have the same amount of bits set, give it a more + deterministic ordering by using the value of the bits themselves. */ + if (order == 0) + return total_flags_b - total_flags_a; + + return order; +} + +/* Implement TARGET_OPTION_INIT_STRUCT. */ + +static void +aarch64_option_init_struct (struct gcc_options *opts ATTRIBUTE_UNUSED) +{ + /* Sort the extensions based on how many bits they set, order the larger + counts first. We sort the list because this makes processing the + feature bits O(n) instead of O(n^2). While n is small, the function + to calculate the feature strings is called on every options push, + pop and attribute change (arm_neon headers, lto etc all cause this to + happen quite frequently). It is a trade-off between time and space and + so time won. */ + int n_extensions + = sizeof (all_extensions) / sizeof (struct aarch64_option_extension); + qsort (&all_extensions_by_on, n_extensions, + sizeof (struct aarch64_option_extension), opt_ext_cmp); +} + +/* Checks to see if enough bits from the option OPT are enabled in + ISA_FLAG_BITS to be able to replace the individual options with the + canonicalized version of the option. This is done based on two rules: + + 1) Synthetic groups, such as +crypto we only care about the bits that are + turned on. e.g. +aes+sha2 can be replaced with +crypto. + + 2) Options that themselves have a bit, such as +rdma, in this case, all the + feature bits they turn on must be available and the bit for the option + itself must be. In this case it's effectively a reduction rather than a + grouping. e.g. +fp+simd is not enough to turn on +rdma, for that you would + need +rdma+fp+simd which is reduced down to +rdma. +*/ + +static bool +aarch64_contains_opt (unsigned long isa_flag_bits, opt_ext *opt) +{ + unsigned long flags_check + = opt->is_synthetic ? opt->flags_on : opt->flag_canonical; + + return (isa_flag_bits & flags_check) == flags_check; +} + /* Return a string representation of ISA_FLAGS. DEFAULT_ARCH_FLAGS gives the default set of flags which are implied by whatever -march we'd put out. Our job is to figure out the minimal set of "+" and @@ -245,26 +328,97 @@ aarch64_get_extension_string_for_isa_flags (unsigned long isa_flags, const struct aarch64_option_extension *opt = NULL; std::string outstr = ""; - /* Pass one: Find all the things we need to turn on. As a special case, - we always want to put out +crc if it is enabled. */ - for (opt = all_extensions; opt->name != NULL; opt++) - if ((isa_flags & opt->flag_canonical - && !(default_arch_flags & opt->flag_canonical)) - || (default_arch_flags & opt->flag_canonical - && opt->flag_canonical == AARCH64_ISA_CRC)) - { - outstr += "+"; - outstr += opt->name; - } + unsigned long isa_flag_bits = isa_flags; - /* Pass two: Find all the things we need to turn off. */ - for (opt = all_extensions; opt->name != NULL; opt++) - if ((~isa_flags) & opt->flag_canonical - && !((~default_arch_flags) & opt->flag_canonical)) + /* Pass one: Minimize the search space by reducing the set of options + to the smallest set that still turns on the same features as before in + conjunction with the bits that are turned on by default for the selected + architecture. */ + for (opt = all_extensions_by_on; opt->name != NULL; opt++) + { + /* If the bit is on by default, then all the options it turns on are also + on by default due to the transitive dependencies. + + If the option is enabled explicitly in the set then we need to emit + an option for it. Since this list is sorted by extensions setting the + largest number of featers first, we can be sure that nothing else will + ever need to set the bits we already set. Consider the following + situation: + + Feat1 = A + B + C + Feat2 = A + B + Feat3 = A + D + Feat4 = B + C + Feat5 = C + + The following results are expected: + + A + C = A + Feat5 + B + C = Feat4 + Feat4 + A = Feat1 + Feat2 + Feat5 = Feat1 + Feat1 + C = Feat1 + Feat3 + Feat4 = Feat1 + D + + This search assumes that all invidual feature bits are use visible, + in other words the user must be able to do +A, +B, +C and +D. */ + if (aarch64_contains_opt (isa_flag_bits | default_arch_flags, opt)) { - outstr += "+no"; - outstr += opt->name; + /* We remove all the dependent bits, to prevent them from being turned + on twice. This only works because we assume that all there are + individual options to set all bits standalone. */ + isa_flag_bits &= ~opt->flags_on; + isa_flag_bits |= opt->flag_canonical; } + } + + /* By toggling bits on and off, we may have set bits on that are already + enabled by default. So we mask the default set out so we don't emit an + option for them. Instead of checking for this each time during Pass One + we just mask all default bits away at the end. */ + isa_flag_bits &= ~default_arch_flags; + + /* We now have the smallest set of features we need to process. A subsequent + linear scan of the bits in isa_flag_bits will allow us to print the ext + names. However as a special case if CRC was enabled before, always print + it. This is required because some CPUs have an incorrect specification + in older assemblers. Even though CRC should be the default for these + cases the -mcpu values won't turn it on. */ + if (isa_flags & AARCH64_ISA_CRC) + isa_flag_bits |= AARCH64_ISA_CRC; + + /* Pass Two: + Print the option names that we're sure we must turn on. These are only + optional extension names. Mandatory ones have already been removed and + ones we explicitly want off have been too. */ + for (opt = all_extensions_by_on; opt->name != NULL; opt++) + { + if (isa_flag_bits & opt->flag_canonical) + { + outstr += "+"; + outstr += opt->name; + } + } + + /* Pass Three: + Print out a +no for any mandatory extension that we are + turning off. By this point aarch64_parse_extension would have ensured + that any optional extensions are turned off. The only things left are + things that can't be turned off usually, e.g. something that is on by + default because it's mandatory and we want it off. For turning off bits + we don't guarantee the smallest set of flags, but instead just emit all + options the user has specified. + + The assembler requires all + to be printed before +no. */ + for (opt = all_extensions_by_on; opt->name != NULL; opt++) + { + if ((~isa_flags) & opt->flag_canonical + && !((~default_arch_flags) & opt->flag_canonical)) + { + outstr += "+no"; + outstr += opt->name; + } + } return outstr; } @@ -345,5 +499,7 @@ aarch64_rewrite_mcpu (int argc, const char **argv) return aarch64_rewrite_selected_cpu (argv[argc - 1]); } +struct gcc_targetm_common targetm_common = TARGETM_COMMON_INITIALIZER; + #undef AARCH64_CPU_NAME_LENGTH diff --git a/gcc/config/aarch64/aarch64-option-extensions.def b/gcc/config/aarch64/aarch64-option-extensions.def index 749ee2b3417..a575448e406 100644 --- a/gcc/config/aarch64/aarch64-option-extensions.def +++ b/gcc/config/aarch64/aarch64-option-extensions.def @@ -21,23 +21,31 @@ Before using #include to read this file, define a macro: - AARCH64_OPT_EXTENSION(EXT_NAME, FLAG_CANONICAL, FLAGS_ON, FLAGS_OFF, FEATURE_STRING) - - EXT_NAME is the name of the extension, represented as a string constant. - FLAGS_CANONICAL is the canonical internal name for this flag. - FLAGS_ON are the bitwise-or of the features that enabling the extension - adds, or zero if enabling this extension has no effect on other features. - FLAGS_OFF are the bitwise-or of the features that disabling the extension - removes, or zero if disabling this extension has no effect on other - features. - FEAT_STRING is a string containing the entries in the 'Features' field of - /proc/cpuinfo on a GNU/Linux system that correspond to this architecture - extension being available. Sometimes multiple entries are needed to enable - the extension (for example, the 'crypto' extension depends on four - entries: aes, pmull, sha1, sha2 being present). In that case this field - should contain a space (" ") separated list of the strings in 'Features' - that are required. Their order is not important. An empty string means - do not detect this feature during auto detection. */ + AARCH64_OPT_EXTENSION(EXT_NAME, FLAG_CANONICAL, FLAGS_ON, FLAGS_OFF, + SYNTHETIC, FEATURE_STRING) + + - EXT_NAME is the name of the extension, represented as a string constant. + - FLAGS_CANONICAL is the canonical internal name for this flag. + - FLAGS_ON are the bitwise-or of the features that enabling the extension + adds, or zero if enabling this extension has no effect on other features. + - FLAGS_OFF are the bitwise-or of the features that disabling the extension + removes, or zero if disabling this extension has no effect on other + features. + - SYNTHETIC is a boolean to indicate whether the option is a purely synthetic + grouping of options and that the option itself has no feature bit (e.g. + crypto). This is used to determine when sum of the individual options in + FLAGS_ON can be replaced by FLAG_CANONICAL in options minimization. If the + group is synthetic then they can be replaced when all options in FLAGS_ON + are enabled, otherwise they can only be replaced when + FLAGS_ON | FLAG_CANONICAL are enabled. + - FEAT_STRING is a string containing the entries in the 'Features' field of + /proc/cpuinfo on a GNU/Linux system that correspond to this architecture + extension being available. Sometimes multiple entries are needed to enable + the extension (for example, the 'crypto' extension depends on four + entries: aes, pmull, sha1, sha2 being present). In that case this field + should contain a space (" ") separated list of the strings in 'Features' + that are required. Their order is not important. An empty string means + do not detect this feature during auto detection. */ /* NOTE: This file is being parsed by config.gcc and so the AARCH64_OPT_EXTENSION must adhere to a strict format: @@ -50,60 +58,60 @@ /* Enabling "fp" just enables "fp". Disabling "fp" also disables "simd", "crypto", "fp16", "aes", "sha2", "sha3", sm3/sm4 and "sve". */ -AARCH64_OPT_EXTENSION("fp", AARCH64_FL_FP, 0, AARCH64_FL_SIMD | AARCH64_FL_CRYPTO | AARCH64_FL_F16 | AARCH64_FL_AES | AARCH64_FL_SHA2 | AARCH64_FL_SHA3 | AARCH64_FL_SM4 | AARCH64_FL_SVE, "fp") +AARCH64_OPT_EXTENSION("fp", AARCH64_FL_FP, 0, AARCH64_FL_SIMD | AARCH64_FL_CRYPTO | AARCH64_FL_F16 | AARCH64_FL_AES | AARCH64_FL_SHA2 | AARCH64_FL_SHA3 | AARCH64_FL_SM4 | AARCH64_FL_SVE, false, "fp") /* Enabling "simd" also enables "fp". Disabling "simd" also disables "crypto", "dotprod", "aes", "sha2", "sha3", "sm3/sm4" and "sve". */ -AARCH64_OPT_EXTENSION("simd", AARCH64_FL_SIMD, AARCH64_FL_FP, AARCH64_FL_CRYPTO | AARCH64_FL_DOTPROD | AARCH64_FL_AES | AARCH64_FL_SHA2 | AARCH64_FL_SHA3 | AARCH64_FL_SM4 | AARCH64_FL_SVE, "asimd") +AARCH64_OPT_EXTENSION("simd", AARCH64_FL_SIMD, AARCH64_FL_FP, AARCH64_FL_CRYPTO | AARCH64_FL_DOTPROD | AARCH64_FL_AES | AARCH64_FL_SHA2 | AARCH64_FL_SHA3 | AARCH64_FL_SM4 | AARCH64_FL_SVE, false, "asimd") -/* Enabling "crypto" also enables "fp" and "simd". +/* Enabling "crypto" also enables "fp", "simd", "aes" and "sha2". Disabling "crypto" disables "crypto", "aes", "sha2", "sha3" and "sm3/sm4". */ -AARCH64_OPT_EXTENSION("crypto", AARCH64_FL_CRYPTO, AARCH64_FL_FP | AARCH64_FL_SIMD, AARCH64_FL_AES | AARCH64_FL_SHA2 |AARCH64_FL_SHA3 | AARCH64_FL_SM4, "aes pmull sha1 sha2") +AARCH64_OPT_EXTENSION("crypto", AARCH64_FL_CRYPTO, AARCH64_FL_FP | AARCH64_FL_SIMD | AARCH64_FL_AES | AARCH64_FL_SHA2, AARCH64_FL_AES | AARCH64_FL_SHA2 |AARCH64_FL_SHA3 | AARCH64_FL_SM4, true, "aes pmull sha1 sha2") /* Enabling or disabling "crc" only changes "crc". */ -AARCH64_OPT_EXTENSION("crc", AARCH64_FL_CRC, 0, 0, "crc32") +AARCH64_OPT_EXTENSION("crc", AARCH64_FL_CRC, 0, 0, false, "crc32") /* Enabling or disabling "lse" only changes "lse". */ -AARCH64_OPT_EXTENSION("lse", AARCH64_FL_LSE, 0, 0, "atomics") +AARCH64_OPT_EXTENSION("lse", AARCH64_FL_LSE, 0, 0, false, "atomics") /* Enabling "fp16" also enables "fp". Disabling "fp16" disables "fp16", "fp16fml" and "sve". */ -AARCH64_OPT_EXTENSION("fp16", AARCH64_FL_F16, AARCH64_FL_FP, AARCH64_FL_F16FML | AARCH64_FL_SVE, "fphp asimdhp") +AARCH64_OPT_EXTENSION("fp16", AARCH64_FL_F16, AARCH64_FL_FP, AARCH64_FL_F16FML | AARCH64_FL_SVE, false, "fphp asimdhp") /* Enabling or disabling "rcpc" only changes "rcpc". */ -AARCH64_OPT_EXTENSION("rcpc", AARCH64_FL_RCPC, 0, 0, "lrcpc") +AARCH64_OPT_EXTENSION("rcpc", AARCH64_FL_RCPC, 0, 0, false, "lrcpc") /* Enabling "rdma" also enables "fp", "simd". Disabling "rdma" just disables "rdma". */ -AARCH64_OPT_EXTENSION("rdma", AARCH64_FL_RDMA, AARCH64_FL_FP | AARCH64_FL_SIMD, 0, "asimdrdm") +AARCH64_OPT_EXTENSION("rdma", AARCH64_FL_RDMA, AARCH64_FL_FP | AARCH64_FL_SIMD, 0, false, "asimdrdm") /* Enabling "dotprod" also enables "simd". Disabling "dotprod" only disables "dotprod". */ -AARCH64_OPT_EXTENSION("dotprod", AARCH64_FL_DOTPROD, AARCH64_FL_SIMD, 0, "asimddp") +AARCH64_OPT_EXTENSION("dotprod", AARCH64_FL_DOTPROD, AARCH64_FL_SIMD, 0, false, "asimddp") /* Enabling "aes" also enables "simd". Disabling "aes" just disables "aes". */ -AARCH64_OPT_EXTENSION("aes", AARCH64_FL_AES, AARCH64_FL_SIMD, 0, "aes") +AARCH64_OPT_EXTENSION("aes", AARCH64_FL_AES, AARCH64_FL_SIMD, 0, false, "aes") /* Enabling "sha2" also enables "simd". Disabling "sha2" just disables "sha2". */ -AARCH64_OPT_EXTENSION("sha2", AARCH64_FL_SHA2, AARCH64_FL_SIMD, 0, "sha1 sha2") +AARCH64_OPT_EXTENSION("sha2", AARCH64_FL_SHA2, AARCH64_FL_SIMD, 0, false, "sha1 sha2") /* Enabling "sha3" enables "simd" and "sha2". Disabling "sha3" just disables "sha3". */ -AARCH64_OPT_EXTENSION("sha3", AARCH64_FL_SHA3, AARCH64_FL_SIMD | AARCH64_FL_SHA2, 0, "sha3 sha512") +AARCH64_OPT_EXTENSION("sha3", AARCH64_FL_SHA3, AARCH64_FL_SIMD | AARCH64_FL_SHA2, 0, false, "sha3 sha512") /* Enabling "sm4" also enables "simd". Disabling "sm4" just disables "sm4". */ -AARCH64_OPT_EXTENSION("sm4", AARCH64_FL_SM4, AARCH64_FL_SIMD, 0, "sm3 sm4") +AARCH64_OPT_EXTENSION("sm4", AARCH64_FL_SM4, AARCH64_FL_SIMD, 0, false, "sm3 sm4") /* Enabling "fp16fml" also enables "fp" and "fp16". Disabling "fp16fml" just disables "fp16fml". */ -AARCH64_OPT_EXTENSION("fp16fml", AARCH64_FL_F16FML, AARCH64_FL_FP | AARCH64_FL_F16, 0, "asimdfml") +AARCH64_OPT_EXTENSION("fp16fml", AARCH64_FL_F16FML, AARCH64_FL_FP | AARCH64_FL_F16, 0, false, "asimdfml") /* Enabling "sve" also enables "fp16", "fp" and "simd". Disabling "sve" just disables "sve". */ -AARCH64_OPT_EXTENSION("sve", AARCH64_FL_SVE, AARCH64_FL_FP | AARCH64_FL_SIMD | AARCH64_FL_F16, 0, "sve") +AARCH64_OPT_EXTENSION("sve", AARCH64_FL_SVE, AARCH64_FL_FP | AARCH64_FL_SIMD | AARCH64_FL_F16, 0, false, "sve") #undef AARCH64_OPT_EXTENSION diff --git a/gcc/config/aarch64/driver-aarch64.c b/gcc/config/aarch64/driver-aarch64.c index 896f0d08720..c68bdfdc57f 100644 --- a/gcc/config/aarch64/driver-aarch64.c +++ b/gcc/config/aarch64/driver-aarch64.c @@ -36,7 +36,8 @@ struct aarch64_arch_extension const char *feat_string; }; -#define AARCH64_OPT_EXTENSION(EXT_NAME, FLAG_CANONICAL, FLAGS_ON, FLAGS_OFF, FEATURE_STRING) \ +#define AARCH64_OPT_EXTENSION(EXT_NAME, FLAG_CANONICAL, FLAGS_ON, FLAGS_OFF, \ + SYNTHETIC, FEATURE_STRING) \ { EXT_NAME, FLAG_CANONICAL, FEATURE_STRING }, static struct aarch64_arch_extension aarch64_extensions[] = { diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 24e847f381d..5517e72dceb 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,28 @@ +2019-03-06 Tamar Christina + + Backport from trunk. + 2019-02-25 Tamar Christina + + PR target/88530 + * common/config/aarch64/aarch64-common.c + (struct aarch64_option_extension): Add is_synthetic. + (all_extensions): Use it. + (TARGET_OPTION_INIT_STRUCT): Define hook. + (struct gcc_targetm_common): Moved to end. + (all_extensions_by_on): New. + (opt_ext_cmp, typedef opt_ext): New. + (aarch64_option_init_struct): New. + (aarch64_contains_opt): New. + (aarch64_get_extension_string_for_isa_flags): Output smallest set. + * config/aarch64/aarch64-option-extensions.def + (AARCH64_OPT_EXTENSION): Explicitly include AES and SHA2 in crypto. + (fp, simd, crc, lse, fp16, rcpc, rdma, dotprod, aes, sha2, sha3, + sm4, fp16fml, sve): + Set is_synthetic to false. + (crypto): Set is_synthetic to true. + * config/aarch64/driver-aarch64.c (AARCH64_OPT_EXTENSION): Add + SYNTHETIC. + 2019-03-06 Tamar Christina Backport from trunk. diff --git a/gcc/testsuite/gcc.target/aarch64/options_set_1.c b/gcc/testsuite/gcc.target/aarch64/options_set_1.c new file mode 100644 index 00000000000..40d9a05c905 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/options_set_1.c @@ -0,0 +1,11 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-march=armv8.2-a" } */ + +int main () +{ + return 0; +} + +/* { dg-final { scan-assembler-times {\.arch armv8\.2\-a\+crc} 1 } } */ + +/* Check to see if crc is output by default. */ diff --git a/gcc/testsuite/gcc.target/aarch64/options_set_2.c b/gcc/testsuite/gcc.target/aarch64/options_set_2.c new file mode 100644 index 00000000000..3476febce70 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/options_set_2.c @@ -0,0 +1,11 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-march=armv8.2-a+crypto" } */ + +int main () +{ + return 0; +} + +/* { dg-final { scan-assembler-times {\.arch armv8\.2\-a\+crypto\+crc} 1 } } */ + +/* Check to see if crc and crypto are maintained if crypto specified. */ diff --git a/gcc/testsuite/gcc.target/aarch64/options_set_3.c b/gcc/testsuite/gcc.target/aarch64/options_set_3.c new file mode 100644 index 00000000000..4558339f16c --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/options_set_3.c @@ -0,0 +1,11 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-march=armv8.2-a+aes+sha2+crypto" } */ + +int main () +{ + return 0; +} + +/* { dg-final { scan-assembler-times {\.arch armv8\.2\-a\+crypto\+crc} 1 } } */ + +/* Check if smallest set is maintained when outputting. */ diff --git a/gcc/testsuite/gcc.target/aarch64/options_set_4.c b/gcc/testsuite/gcc.target/aarch64/options_set_4.c new file mode 100644 index 00000000000..15514bfe93e --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/options_set_4.c @@ -0,0 +1,12 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-march=armv8.2-a+aes+sha2" } */ + +int main () +{ + return 0; +} + +/* { dg-final { scan-assembler-times {\.arch armv8\.2\-a\+crypto\+crc} 1 } } */ + +/* Check if individual bits that make up a grouping is specified that only the + grouping is kept. */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/aarch64/options_set_5.c b/gcc/testsuite/gcc.target/aarch64/options_set_5.c new file mode 100644 index 00000000000..b4c0901195e --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/options_set_5.c @@ -0,0 +1,12 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-march=armv8.2-a+aes+sha2+nosha2" } */ + +int main () +{ + return 0; +} + +/* { dg-final { scan-assembler-times {\.arch armv8\.2\-a\+crc\+aes} 1 } } */ + +/* Check if turning off feature bits works correctly and grouping is no + longer valid. */ diff --git a/gcc/testsuite/gcc.target/aarch64/options_set_6.c b/gcc/testsuite/gcc.target/aarch64/options_set_6.c new file mode 100644 index 00000000000..90a055928a2 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/options_set_6.c @@ -0,0 +1,12 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-march=armv8.2-a+crypto+nosha2" } */ + +int main () +{ + return 0; +} + +/* { dg-final { scan-assembler-times {\.arch armv8\.2\-a\+crypto\+crc} 1 } } */ + +/* Group as a whole was requested to be turned on, crypto itself is a bit and so + just turning off one feature can't turn it off. */ diff --git a/gcc/testsuite/gcc.target/aarch64/options_set_7.c b/gcc/testsuite/gcc.target/aarch64/options_set_7.c new file mode 100644 index 00000000000..71a2c8a1905 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/options_set_7.c @@ -0,0 +1,11 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-march=armv8.4-a+dotprod" } */ + +int main () +{ + return 0; +} + +/* { dg-final { scan-assembler-times {\.arch armv8\.4\-a} 1 } } */ + +/* Checking if enabling default features drops the superfluous bits. */ diff --git a/gcc/testsuite/gcc.target/aarch64/options_set_8.c b/gcc/testsuite/gcc.target/aarch64/options_set_8.c new file mode 100644 index 00000000000..83be1bd7a5c --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/options_set_8.c @@ -0,0 +1,12 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-march=armv8.4-a+nodotprod" } */ + +int main () +{ + return 0; +} + +/* { dg-final { scan-assembler-times {\.arch armv8\.4\-a} 1 } } */ + +/* Checking if trying to turn off default features propagates the commandline + option. */ diff --git a/gcc/testsuite/gcc.target/aarch64/options_set_9.c b/gcc/testsuite/gcc.target/aarch64/options_set_9.c new file mode 100644 index 00000000000..e3c7cdc54ff --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/options_set_9.c @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-march=armv8-a+simd+fp" } */ + +int main () +{ + return 0; +} + +/* { dg-final { scan-assembler-times {\.arch armv8\-a} 1 } } */ + + /* Check that grouping of bits that don't form a synthetic group don't turn + on the parent. e.g. rdma turns on simd+fp, but simd+fp does not turn on + rdma since rdma is it's own group. crypto however turns on aes and sha2 + and turning on sha2 and eas should turn on crypto!. */ -- cgit v1.2.3 From d4fbc387097148e7788a038efbc9e5d1daa0bfc3 Mon Sep 17 00:00:00 2001 From: Thomas Koenig Date: Wed, 6 Mar 2019 20:12:06 +0000 Subject: 2019-03-06 Thomas Koenig PR fortran/72714 Backport from trunk * resolve.c (resolve_allocate_expr): Add some tests for coarrays. 2019-03-06 Thomas Koenig PR fortran/72714 Backport from trunk * gfortran.dg/coarray_allocate_11.f90: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@269440 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fortran/ChangeLog | 6 +++ gcc/fortran/resolve.c | 53 ++++++++++++++++++++--- gcc/testsuite/ChangeLog | 6 +++ gcc/testsuite/gfortran.dg/coarray_allocate_11.f90 | 15 +++++++ 4 files changed, 74 insertions(+), 6 deletions(-) create mode 100644 gcc/testsuite/gfortran.dg/coarray_allocate_11.f90 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 2110c0a18e8..7d50329c62e 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2019-03-06 Thomas Koenig + + PR fortran/72714 + Backport from trunk + * resolve.c (resolve_allocate_expr): Add some tests for coarrays. + 2019-03-03 Harald Anlauf Backport from trunk diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index b2c907495a2..24b472ed58f 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -7655,13 +7655,54 @@ resolve_allocate_expr (gfc_expr *e, gfc_code *code, bool *array_alloc_wo_spec) if (codimension) for (i = ar->dimen; i < ar->dimen + ar->codimen; i++) - if (ar->dimen_type[i] == DIMEN_THIS_IMAGE) - { - gfc_error ("Coarray specification required in ALLOCATE statement " - "at %L", &e->where); - goto failure; - } + { + switch (ar->dimen_type[i]) + { + case DIMEN_THIS_IMAGE: + gfc_error ("Coarray specification required in ALLOCATE statement " + "at %L", &e->where); + goto failure; + + case DIMEN_RANGE: + if (ar->start[i] == 0 || ar->end[i] == 0) + { + /* If ar->stride[i] is NULL, we issued a previous error. */ + if (ar->stride[i] == NULL) + gfc_error ("Bad array specification in ALLOCATE statement " + "at %L", &e->where); + goto failure; + } + else if (gfc_dep_compare_expr (ar->start[i], ar->end[i]) == 1) + { + gfc_error ("Upper cobound is less than lower cobound at %L", + &ar->start[i]->where); + goto failure; + } + break; + + case DIMEN_ELEMENT: + if (ar->start[i]->expr_type == EXPR_CONSTANT) + { + gcc_assert (ar->start[i]->ts.type == BT_INTEGER); + if (mpz_cmp_si (ar->start[i]->value.integer, 1) < 0) + { + gfc_error ("Upper cobound is less than lower cobound " + " of 1 at %L", &ar->start[i]->where); + goto failure; + } + } + break; + + case DIMEN_STAR: + break; + default: + gfc_error ("Bad array specification in ALLOCATE statement at %L", + &e->where); + goto failure; + + } + } for (i = 0; i < ar->dimen; i++) { if (ar->type == AR_ELEMENT || ar->type == AR_FULL) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 5517e72dceb..3542b1fdbca 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2019-03-06 Thomas Koenig + + PR fortran/72714 + Backport from trunk + * gfortran.dg/coarray_allocate_11.f90: New test. + 2019-03-06 Tamar Christina Backport from trunk. diff --git a/gcc/testsuite/gfortran.dg/coarray_allocate_11.f90 b/gcc/testsuite/gfortran.dg/coarray_allocate_11.f90 new file mode 100644 index 00000000000..0e806f0955b --- /dev/null +++ b/gcc/testsuite/gfortran.dg/coarray_allocate_11.f90 @@ -0,0 +1,15 @@ +! { dg-do compile } +! { dg-additional-options -fcoarray=single } +program p + integer, allocatable :: z[:,:] + integer :: i + allocate (z[1:,*]) ! { dg-error "Bad array specification in ALLOCATE statement" } + allocate (z[:2,*]) ! { dg-error "Bad array specification in ALLOCATE statement" } + allocate (z[2:1,*]) ! { dg-error "Upper cobound is less than lower cobound" } + allocate (z[:0,*]) ! { dg-error "Bad array specification in ALLOCATE statement" } + allocate (z[0,*]) ! { dg-error "Upper cobound is less than lower cobound" } + allocate (z[1,*]) ! This is OK + allocate (z[1:1,*]) ! This is OK + allocate (z[i:i,*]) ! This is OK + allocate (z[i:i-1,*]) ! { dg-error "Upper cobound is less than lower cobound" } +end -- cgit v1.2.3 From 29cd0a1a465ff5959001ff588485a40215819908 Mon Sep 17 00:00:00 2001 From: Harald Anlauf Date: Wed, 6 Mar 2019 21:16:00 +0000 Subject: 2019-03-06 Harald Anlauf Backport from trunk PR fortran/71203 * expr.c (simplify_const_ref): Avoid null pointer dereference. PR fortran/71203 * gfortran.dg/substr_8.f90: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@269445 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fortran/ChangeLog | 6 ++++++ gcc/fortran/expr.c | 10 ++++++++-- gcc/testsuite/ChangeLog | 6 ++++++ gcc/testsuite/gfortran.dg/substr_8.f90 | 15 +++++++++++++++ 4 files changed, 35 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gfortran.dg/substr_8.f90 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 7d50329c62e..51bef2a2922 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2019-03-06 Harald Anlauf + + Backport from trunk + PR fortran/71203 + * expr.c (simplify_const_ref): Avoid null pointer dereference. + 2019-03-06 Thomas Koenig PR fortran/72714 diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c index 6ef4eb864e6..2731a714fca 100644 --- a/gcc/fortran/expr.c +++ b/gcc/fortran/expr.c @@ -1784,8 +1784,14 @@ simplify_const_ref (gfc_expr *p) string_len = 0; if (!p->ts.u.cl) - p->ts.u.cl = gfc_new_charlen (p->symtree->n.sym->ns, - NULL); + { + if (p->symtree) + p->ts.u.cl = gfc_new_charlen (p->symtree->n.sym->ns, + NULL); + else + p->ts.u.cl = gfc_new_charlen (gfc_current_ns, + NULL); + } else gfc_free_expr (p->ts.u.cl->length); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 3542b1fdbca..5fa4460e6a0 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2019-03-06 Harald Anlauf + + Backport from trunk + PR fortran/71203 + * gfortran.dg/substr_8.f90: New test. + 2019-03-06 Thomas Koenig PR fortran/72714 diff --git a/gcc/testsuite/gfortran.dg/substr_8.f90 b/gcc/testsuite/gfortran.dg/substr_8.f90 new file mode 100644 index 00000000000..a3b77873f7c --- /dev/null +++ b/gcc/testsuite/gfortran.dg/substr_8.f90 @@ -0,0 +1,15 @@ +! { dg-do run } +! PR fortran/71203 - used to ICE on zero-length arrays or substrings +! Derived from original test cases by Gerhard Steinmetz + +program p + implicit none + character(3), parameter :: a(4) = ' ' + character(*), parameter :: b(4) = 'abc' + character(*), parameter :: x(*) = a(2:2)(3:1) + character(*), parameter :: y(*) = a(2:1)(3:1) + character(*), parameter :: z(*) = b(2:1)(2:3) + if (size (x) /= 1 .or. len(x) /= 0) stop 1 + if (size (y) /= 0 .or. len(y) /= 0) stop 2 + if (size (z) /= 0 .or. len(z) /= 2) stop 3 +end -- cgit v1.2.3 From 77f81618fe5c3852b852e3624038cfb2cb36c648 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Thu, 7 Mar 2019 00:16:16 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@269447 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 3e15e1464c6..71b5ee8fc68 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190306 +20190307 -- cgit v1.2.3 From 73bdd48e81763b96d3256c3e8e20d6fda0de7a2b Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Thu, 7 Mar 2019 08:32:09 +0000 Subject: PR c++/89585 * parser.c (cp_parser_asm_definition): Parse asm qualifiers even at toplevel, but diagnose them. * g++.dg/asm-qual-3.C: Adjust expected diagnostics. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@269452 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/parser.c | 13 ++++++++++++- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/asm-qual-3.C | 8 ++++---- 4 files changed, 27 insertions(+), 5 deletions(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 8ce0c68168a..f8fdbb1d3d6 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2019-03-07 Jakub Jelinek + + PR c++/89585 + * parser.c (cp_parser_asm_definition): Parse asm qualifiers even + at toplevel, but diagnose them. + 2019-02-26 Marek Polacek Backported from mainline diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 18b09affb59..e479ed96d30 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -19125,8 +19125,9 @@ cp_parser_asm_definition (cp_parser* parser) location_t volatile_loc = UNKNOWN_LOCATION; location_t inline_loc = UNKNOWN_LOCATION; location_t goto_loc = UNKNOWN_LOCATION; + location_t first_loc = UNKNOWN_LOCATION; - if (cp_parser_allow_gnu_extensions_p (parser) && parser->in_function_body) + if (cp_parser_allow_gnu_extensions_p (parser)) for (;;) { cp_token *token = cp_lexer_peek_token (parser->lexer); @@ -19152,6 +19153,8 @@ cp_parser_asm_definition (cp_parser* parser) } else inline_loc = loc; + if (!first_loc) + first_loc = loc; cp_lexer_consume_token (parser->lexer); continue; @@ -19163,6 +19166,8 @@ cp_parser_asm_definition (cp_parser* parser) } else goto_loc = loc; + if (!first_loc) + first_loc = loc; cp_lexer_consume_token (parser->lexer); continue; @@ -19182,6 +19187,12 @@ cp_parser_asm_definition (cp_parser* parser) bool inline_p = (inline_loc != UNKNOWN_LOCATION); bool goto_p = (goto_loc != UNKNOWN_LOCATION); + if (!parser->in_function_body && (inline_p || goto_p)) + { + error_at (first_loc, "asm qualifier outside of function body"); + inline_p = goto_p = false; + } + /* Look for the opening `('. */ if (!cp_parser_require (parser, CPP_OPEN_PAREN, RT_OPEN_PAREN)) return; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 5fa4460e6a0..9789ecf577f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-03-07 Jakub Jelinek + + PR c++/89585 + * g++.dg/asm-qual-3.C: Adjust expected diagnostics. + 2019-03-06 Harald Anlauf Backport from trunk diff --git a/gcc/testsuite/g++.dg/asm-qual-3.C b/gcc/testsuite/g++.dg/asm-qual-3.C index 95c9b570a5f..6faf0ef5e06 100644 --- a/gcc/testsuite/g++.dg/asm-qual-3.C +++ b/gcc/testsuite/g++.dg/asm-qual-3.C @@ -2,11 +2,11 @@ // { dg-do compile } // { dg-options "-std=gnu++98" } -asm const (""); // { dg-error {expected '\(' before 'const'} } -asm volatile (""); // { dg-error {expected '\(' before 'volatile'} } +asm const (""); // { dg-error {'const' is not an asm qualifier} } +asm volatile (""); asm restrict (""); // { dg-error {expected '\(' before 'restrict'} } -asm inline (""); // { dg-error {expected '\(' before 'inline'} } -asm goto (""); // { dg-error {expected '\(' before 'goto'} } +asm inline (""); // { dg-error {asm qualifier outside of function body} } +asm goto (""); // { dg-error {asm qualifier outside of function body} } // There are many other things wrong with this code, so: // { dg-excess-errors "" } -- cgit v1.2.3 From 79d3f33cd4586a032b02f2b72bcfb3f331672d05 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Fri, 8 Mar 2019 00:16:26 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@269475 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 71b5ee8fc68..6d65f6b85a2 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190307 +20190308 -- cgit v1.2.3 From 785d6a7879b76e23c9eccb581c3151c3a561b34c Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Fri, 8 Mar 2019 18:19:55 +0000 Subject: PR c++/88183 - ICE with .* fold-expression. build_m_component_ref can't handle type-dependent operands, so let's use the default case; tsubst_copy_and_build also uses build_x_binary_op for substituting a DOTSTAR_EXPR. * pt.c (fold_expression) [DOTSTAR_EXPR]: Remove special handling. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@269501 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cp/ChangeLog | 5 +++++ gcc/cp/pt.c | 2 -- gcc/testsuite/g++.dg/cpp1z/fold-lambda3.C | 19 +++++++++++++++++++ 3 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/g++.dg/cpp1z/fold-lambda3.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index f8fdbb1d3d6..33fce17d7e9 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2019-03-08 Jason Merrill + + PR c++/88183 - ICE with .* fold-expression. + * pt.c (fold_expression) [DOTSTAR_EXPR]: Remove special handling. + 2019-03-07 Jakub Jelinek PR c++/89585 diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 92c8e51b746..9c7a4157090 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -11732,8 +11732,6 @@ fold_expression (tree t, tree left, tree right, tsubst_flags_t complain) { case COMPOUND_EXPR: return build_x_compound_expr (input_location, left, right, complain); - case DOTSTAR_EXPR: - return build_m_component_ref (left, right, complain); default: return build_x_binary_op (input_location, code, left, TREE_CODE (left), diff --git a/gcc/testsuite/g++.dg/cpp1z/fold-lambda3.C b/gcc/testsuite/g++.dg/cpp1z/fold-lambda3.C new file mode 100644 index 00000000000..5a53c866284 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1z/fold-lambda3.C @@ -0,0 +1,19 @@ +// PR c++/88183 +// { dg-do compile { target c++17 } } + +struct A { int i; }; + +template T& g(T); + +template +void f(U u, Vs... vs) +{ + [vs...](auto x) { + (g(x) .* ... .* vs) = 42; + }(u); +} + +int main() +{ + f(A(), &A::i); +} -- cgit v1.2.3 From 06253ae8ba15ead0b8d8ef1f23300a8d90b4454d Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Fri, 8 Mar 2019 18:21:02 +0000 Subject: PR c++/87513 - 'sorry' mangling PMF template-id. Here build_offset_ref calls build_qualified_name to make a SCOPE_REF because the dependent template arguments make type_dependent_expression_p (member) true. We could probably work hard to prevent this, but it doesn't seem necessary, and it's easy to fix write_expression to handle the result. * mangle.c (write_expression): Handle SCOPE_REF to BASELINK. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@269502 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cp/ChangeLog | 3 +++ gcc/cp/mangle.c | 3 ++- gcc/testsuite/g++.dg/cpp0x/decltype-tid1.C | 9 +++++++++ 3 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/cpp0x/decltype-tid1.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 33fce17d7e9..467a4e38e3d 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,8 @@ 2019-03-08 Jason Merrill + PR c++/87513 - 'sorry' mangling PMF template-id. + * mangle.c (write_expression): Handle SCOPE_REF to BASELINK. + PR c++/88183 - ICE with .* fold-expression. * pt.c (fold_expression) [DOTSTAR_EXPR]: Remove special handling. diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c index 2f65709d7d8..5146162404f 100644 --- a/gcc/cp/mangle.c +++ b/gcc/cp/mangle.c @@ -3047,7 +3047,8 @@ write_expression (tree expr) { scope = TREE_OPERAND (expr, 0); member = TREE_OPERAND (expr, 1); - gcc_assert (!BASELINK_P (member)); + if (BASELINK_P (member)) + member = BASELINK_FUNCTIONS (member); } else { diff --git a/gcc/testsuite/g++.dg/cpp0x/decltype-tid1.C b/gcc/testsuite/g++.dg/cpp0x/decltype-tid1.C new file mode 100644 index 00000000000..03285022087 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/decltype-tid1.C @@ -0,0 +1,9 @@ +// PR c++/87513 +// { dg-do compile { target c++11 } } + +struct A { template void foo (); }; +template auto bar () -> decltype (&A::foo); +void foo () +{ + bar<0> (); +} -- cgit v1.2.3 From 4e01ea68d225639c3aa7b44c7ffd6e6146c2a1b2 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Fri, 8 Mar 2019 18:22:20 +0000 Subject: PR c++/89422 - ICE with -g and lambda in default arg in template. Here, we were trying to instantiate the default argument before setting DECL_FRIEND_CONTEXT, so that the instantiated lambda ended up being treated as part of the S template, which confused dwarf2out. * pt.c (tsubst_function_decl): SET_DECL_FRIEND_CONTEXT sooner. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@269503 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cp/ChangeLog | 3 +++ gcc/cp/pt.c | 10 +++++----- gcc/testsuite/g++.dg/cpp0x/lambda/lambda-defarg9.C | 10 ++++++++++ 3 files changed, 18 insertions(+), 5 deletions(-) create mode 100644 gcc/testsuite/g++.dg/cpp0x/lambda/lambda-defarg9.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 467a4e38e3d..293284fd771 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,8 @@ 2019-03-08 Jason Merrill + PR c++/89422 - ICE with -g and lambda in default arg in template. + * pt.c (tsubst_function_decl): SET_DECL_FRIEND_CONTEXT sooner. + PR c++/87513 - 'sorry' mangling PMF template-id. * mangle.c (write_expression): Handle SCOPE_REF to BASELINK. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 9c7a4157090..985741a2807 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -13021,6 +13021,11 @@ tsubst_function_decl (tree t, tree args, tsubst_flags_t complain, set_constraints (r, ci); } + if (DECL_FRIEND_P (t) && DECL_FRIEND_CONTEXT (t)) + SET_DECL_FRIEND_CONTEXT (r, + tsubst (DECL_FRIEND_CONTEXT (t), + args, complain, in_decl)); + /* Set up the DECL_TEMPLATE_INFO for R. There's no need to do this in the special friend case mentioned above where GEN_TMPL is NULL. */ @@ -13082,11 +13087,6 @@ tsubst_function_decl (tree t, tree args, tsubst_flags_t complain, && !grok_op_properties (r, /*complain=*/true)) return error_mark_node; - if (DECL_FRIEND_P (t) && DECL_FRIEND_CONTEXT (t)) - SET_DECL_FRIEND_CONTEXT (r, - tsubst (DECL_FRIEND_CONTEXT (t), - args, complain, in_decl)); - /* Possibly limit visibility based on template args. */ DECL_VISIBILITY (r) = VISIBILITY_DEFAULT; if (DECL_VISIBILITY_SPECIFIED (t)) diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-defarg9.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-defarg9.C new file mode 100644 index 00000000000..f0436adfe9a --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-defarg9.C @@ -0,0 +1,10 @@ +// PR c++/89422 +// { dg-do compile { target c++11 } } +// { dg-additional-options -g } + +template struct S +{ + friend void foo (int a = []{ return 0; }()) {} + int b; +}; +S<0> t; -- cgit v1.2.3 From 5b2351d31bcfd6fa3e926674b22889925b5b78ad Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Fri, 8 Mar 2019 20:50:31 +0000 Subject: PR c++/89576 - if constexpr of lambda capture. Now that we're doing implicit lambda capture in templates, we see x here as the lambda capture. maybe_convert_cond was doing nothing in a template, so we never called mark_rvalue_use on x. As part of the broad move toward doing more processing of non-dependent expressions, let's do this conversion. * semantics.c (maybe_convert_cond): Do convert a non-dependent condition in a template. * typeck.c (condition_conversion): Handle being called in a template. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@269506 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/semantics.c | 7 +++++-- gcc/cp/typeck.c | 9 ++++----- gcc/testsuite/g++.dg/cpp1z/constexpr-if28.C | 11 +++++++++++ 4 files changed, 26 insertions(+), 7 deletions(-) create mode 100644 gcc/testsuite/g++.dg/cpp1z/constexpr-if28.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 293284fd771..c95691b8ac0 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,11 @@ 2019-03-08 Jason Merrill + PR c++/89576 - if constexpr of lambda capture. + * semantics.c (maybe_convert_cond): Do convert a non-dependent + condition in a template. + * typeck.c (condition_conversion): Handle being called in a + template. + PR c++/89422 - ICE with -g and lambda in default arg in template. * pt.c (tsubst_function_decl): SET_DECL_FRIEND_CONTEXT sooner. diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index a5460fa392e..0d7d75a1a60 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -645,10 +645,13 @@ maybe_convert_cond (tree cond) return NULL_TREE; /* Wait until we instantiate templates before doing conversion. */ - if (processing_template_decl) + if (processing_template_decl + && (type_dependent_expression_p (cond) + /* For GCC 8 only convert non-dependent condition in a lambda. */ + || !current_lambda_expr ())) return cond; - if (warn_sequence_point) + if (warn_sequence_point && !processing_template_decl) verify_sequence_points (cond); /* Do the conversion. */ diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index 9ffea19fba9..afc1fd795b2 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -5747,18 +5747,17 @@ cp_truthvalue_conversion (tree expr) return c_common_truthvalue_conversion (input_location, expr); } -/* Just like cp_truthvalue_conversion, but we want a CLEANUP_POINT_EXPR. */ +/* Just like cp_truthvalue_conversion, but we want a CLEANUP_POINT_EXPR. This + is a low-level function; most callers should use maybe_convert_cond. */ tree condition_conversion (tree expr) { tree t; - /* Anything that might happen in a template should go through - maybe_convert_cond. */ - gcc_assert (!processing_template_decl); t = perform_implicit_conversion_flags (boolean_type_node, expr, tf_warning_or_error, LOOKUP_NORMAL); - t = fold_build_cleanup_point_expr (boolean_type_node, t); + if (!processing_template_decl) + t = fold_build_cleanup_point_expr (boolean_type_node, t); return t; } diff --git a/gcc/testsuite/g++.dg/cpp1z/constexpr-if28.C b/gcc/testsuite/g++.dg/cpp1z/constexpr-if28.C new file mode 100644 index 00000000000..8bfde6c1bdb --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1z/constexpr-if28.C @@ -0,0 +1,11 @@ +// PR c++/89576 +// { dg-do compile { target c++17 } } + +template +void foo() +{ + constexpr int x = 0; + [&] { + if constexpr (x) {} + }; +} -- cgit v1.2.3 From 986d218b3179d593905c1baec1520d3ccfe361da Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Fri, 8 Mar 2019 21:39:58 +0000 Subject: PR c++/89381 - implicit copy and using-declaration. Here the used base::operator= gets into the list of foo's bindings for operator=, but it shouldn't make the copy ctor deleted. * class.c (classtype_has_move_assign_or_move_ctor_p): Don't consider op= brought in by a using-declaration. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@269509 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cp/ChangeLog | 4 ++++ gcc/cp/class.c | 4 +++- gcc/testsuite/g++.dg/cpp0x/implicit16.C | 37 +++++++++++++++++++++++++++++++++ 3 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/cpp0x/implicit16.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index c95691b8ac0..900d7856dc6 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2019-03-08 Jason Merrill + PR c++/89381 - implicit copy and using-declaration. + * class.c (classtype_has_move_assign_or_move_ctor_p): Don't consider + op= brought in by a using-declaration. + PR c++/89576 - if constexpr of lambda capture. * semantics.c (maybe_convert_cond): Do convert a non-dependent condition in a template. diff --git a/gcc/cp/class.c b/gcc/cp/class.c index 834ba17a85d..0b789b17337 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -5171,7 +5171,9 @@ classtype_has_move_assign_or_move_ctor_p (tree t, bool user_p) for (ovl_iterator iter (get_class_binding_direct (t, assign_op_identifier)); iter; ++iter) - if ((!user_p || !DECL_ARTIFICIAL (*iter)) && move_fn_p (*iter)) + if ((!user_p || !DECL_ARTIFICIAL (*iter)) + && DECL_CONTEXT (*iter) == t + && move_fn_p (*iter)) return true; return false; diff --git a/gcc/testsuite/g++.dg/cpp0x/implicit16.C b/gcc/testsuite/g++.dg/cpp0x/implicit16.C new file mode 100644 index 00000000000..229f2b4cd81 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/implicit16.C @@ -0,0 +1,37 @@ +// PR c++/89381 +// { dg-do compile { target c++11 } } + +template +struct base +{ + base() { } + base(const base&) { } + base(base&&) { } + base& operator=(const base&) { return *this; } + base& operator=(base&&) { return *this; } +}; + +struct foo : base +{ + using base::base; + using base::operator=; +}; + +//using workaround = decltype(foo{*static_cast(0)}); + +struct bar +{ + bar& operator=(foo ve) + { + value = ve; + return *this; + } + + foo value; +}; + +int main() +{ + foo a; + foo b{a}; +} -- cgit v1.2.3 From 784b8c3cc85cc84ecaf0fe2ed0ad37fa4c966f37 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Fri, 8 Mar 2019 21:40:04 +0000 Subject: PR c++/87921 - wrong error with inline static data member. An instantiation of an inline variable isn't defined until it's instantiated, so don't treat it as defined just because it's inline. * decl2.c (c_parse_final_cleanups): Don't force out uninstantiated inline static data members. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@269510 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cp/ChangeLog | 4 ++++ gcc/cp/decl2.c | 5 ++++- gcc/testsuite/g++.dg/cpp1z/inline-var5.C | 16 ++++++++++++++++ 3 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/cpp1z/inline-var5.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 900d7856dc6..57a08f3ae5c 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2019-03-08 Jason Merrill + PR c++/87921 - wrong error with inline static data member. + * decl2.c (c_parse_final_cleanups): Don't force out uninstantiated + inline static data members. + PR c++/89381 - implicit copy and using-declaration. * class.c (classtype_has_move_assign_or_move_ctor_p): Don't consider op= brought in by a using-declaration. diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index 6a67c4e5b33..1043af49b91 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -4905,7 +4905,10 @@ c_parse_final_cleanups (void) { if (var_finalized_p (decl) || DECL_REALLY_EXTERN (decl) /* Don't write it out if we haven't seen a definition. */ - || (DECL_IN_AGGR_P (decl) && !DECL_INLINE_VAR_P (decl))) + || (DECL_IN_AGGR_P (decl) && !DECL_INLINE_VAR_P (decl)) + /* Or haven't instantiated it. */ + || (DECL_TEMPLATE_INSTANTIATION (decl) + && !DECL_TEMPLATE_INSTANTIATED (decl))) continue; import_export_decl (decl); /* If this static data member is needed, provide it to the diff --git a/gcc/testsuite/g++.dg/cpp1z/inline-var5.C b/gcc/testsuite/g++.dg/cpp1z/inline-var5.C new file mode 100644 index 00000000000..27730106f27 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1z/inline-var5.C @@ -0,0 +1,16 @@ +// PR c++/87921 +// { dg-do compile { target c++17 } } + +template +struct X +{ + static inline long x[] = { 1L }; + long foo () { return x[0]; } +}; + +void +bar () +{ + class L {}; + X v {}; +} -- cgit v1.2.3 From 50922773a583e6e4f694cd1224689240f8343b75 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Fri, 8 Mar 2019 21:40:10 +0000 Subject: PR c++/88690 - C++17 ICE with empty base in aggregate. * typeck2.c (process_init_constructor_record): Skip trivial initialization of an empty base. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@269511 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cp/ChangeLog | 4 ++++ gcc/cp/typeck2.c | 7 +++++++ gcc/testsuite/g++.dg/cpp1z/aggr-base7.C | 8 ++++++++ 3 files changed, 19 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp1z/aggr-base7.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 57a08f3ae5c..f12a2b03b77 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2019-03-08 Jason Merrill + PR c++/88690 - C++17 ICE with empty base in aggregate. + * typeck2.c (process_init_constructor_record): Skip trivial + initialization of an empty base. + PR c++/87921 - wrong error with inline static data member. * decl2.c (c_parse_final_cleanups): Don't force out uninstantiated inline static data members. diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c index b91c98d594b..34284074a21 100644 --- a/gcc/cp/typeck2.c +++ b/gcc/cp/typeck2.c @@ -1538,6 +1538,13 @@ process_init_constructor_record (tree type, tree init, int nested, } } + if (DECL_SIZE (field) && integer_zerop (DECL_SIZE (field)) + && !TREE_SIDE_EFFECTS (next)) + /* Don't add trivial initialization of an empty base/field to the + constructor, as they might not be ordered the way the back-end + expects. */ + continue; + /* If this is a bitfield, now convert to the lowered type. */ if (type != TREE_TYPE (field)) next = cp_convert_and_check (TREE_TYPE (field), next, complain); diff --git a/gcc/testsuite/g++.dg/cpp1z/aggr-base7.C b/gcc/testsuite/g++.dg/cpp1z/aggr-base7.C new file mode 100644 index 00000000000..bc1793e79ca --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1z/aggr-base7.C @@ -0,0 +1,8 @@ +// PR c++/88690 +// { dg-do compile { target c++11 } } + +struct A { int a = 1; }; +struct B { int b = 0; }; +struct C { C() = default; C (const C&) = delete; }; +struct D : public B, public C {}; +struct E : A { D f; } g{}; -- cgit v1.2.3 From 8aa74ff230cb0d892cdd25da71aee160d64932cb Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Fri, 8 Mar 2019 21:40:15 +0000 Subject: PR c++/88419 - C++17 ICE with class template arg deduction. Just like in make_constrained_auto, we need to defer setting TYPE_CANONICAL until we've set fields that will affect structural_comptypes. * pt.c (make_template_placeholder): Set TYPE_CANONICAL after CLASS_PLACEHOLDER_TEMPLATE. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@269512 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cp/ChangeLog | 4 ++++ gcc/cp/pt.c | 4 +++- gcc/testsuite/g++.dg/cpp1z/class-deduction62.C | 22 ++++++++++++++++++++++ 3 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/cpp1z/class-deduction62.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index f12a2b03b77..b3278030784 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2019-03-08 Jason Merrill + PR c++/88419 - C++17 ICE with class template arg deduction. + * pt.c (make_template_placeholder): Set TYPE_CANONICAL after + CLASS_PLACEHOLDER_TEMPLATE. + PR c++/88690 - C++17 ICE with empty base in aggregate. * typeck2.c (process_init_constructor_record): Skip trivial initialization of an empty base. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 985741a2807..481d04dfba0 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -26002,8 +26002,10 @@ make_auto (void) tree make_template_placeholder (tree tmpl) { - tree t = make_auto_1 (DECL_NAME (tmpl), true); + tree t = make_auto_1 (DECL_NAME (tmpl), false); CLASS_PLACEHOLDER_TEMPLATE (t) = tmpl; + /* Our canonical type depends on the placeholder. */ + TYPE_CANONICAL (t) = canonical_type_parameter (t); return t; } diff --git a/gcc/testsuite/g++.dg/cpp1z/class-deduction62.C b/gcc/testsuite/g++.dg/cpp1z/class-deduction62.C new file mode 100644 index 00000000000..2baa3acb8c1 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1z/class-deduction62.C @@ -0,0 +1,22 @@ +// PR c++/88419 +// { dg-do compile { target c++17 } } + +template struct ref_view { + template ref_view(T&&); +}; + +template ref_view(R&) -> ref_view; + +struct ref_fn { + template auto operator()(R r) const + noexcept(noexcept(ref_view{r})); +}; + +template struct indirect_view { + indirect_view(R); +}; + +struct indirect_fn { + template auto operator()(R r) const + noexcept(noexcept(indirect_view{r})); +}; -- cgit v1.2.3 From 8fe4d568a253387c9ca7f6a2d5d736737c8749ad Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Fri, 8 Mar 2019 21:40:21 +0000 Subject: PR c++/88869 - C++17 ICE with CTAD and explicit specialization. The members of an explicit specialization of a class template don't have the template parameters of that class template, so we shouldn't try to provide arguments for them. Only set outer_args when the class is an instantiation. * pt.c (do_class_deduction): Don't include explicit specialization args in outer_args. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@269513 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cp/ChangeLog | 4 ++++ gcc/cp/pt.c | 2 +- gcc/testsuite/g++.dg/cpp1z/class-deduction63.C | 11 +++++++++++ 3 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/cpp1z/class-deduction63.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index b3278030784..a5526d8acc0 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2019-03-08 Jason Merrill + PR c++/88869 - C++17 ICE with CTAD and explicit specialization. + * pt.c (do_class_deduction): Don't include explicit specialization + args in outer_args. + PR c++/88419 - C++17 ICE with class template arg deduction. * pt.c (make_template_placeholder): Set TYPE_CANONICAL after CLASS_PLACEHOLDER_TEMPLATE. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 481d04dfba0..1adb7c18e31 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -26607,7 +26607,7 @@ do_class_deduction (tree ptype, tree tmpl, tree init, int flags, tree outer_args = NULL_TREE; if (DECL_CLASS_SCOPE_P (tmpl) - && CLASSTYPE_TEMPLATE_INFO (DECL_CONTEXT (tmpl))) + && CLASSTYPE_TEMPLATE_INSTANTIATION (DECL_CONTEXT (tmpl))) { outer_args = CLASSTYPE_TI_ARGS (DECL_CONTEXT (tmpl)); type = TREE_TYPE (most_general_template (tmpl)); diff --git a/gcc/testsuite/g++.dg/cpp1z/class-deduction63.C b/gcc/testsuite/g++.dg/cpp1z/class-deduction63.C new file mode 100644 index 00000000000..4fc66fcbe15 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1z/class-deduction63.C @@ -0,0 +1,11 @@ +// PR c++/88869 +// { dg-do compile { target c++17 } } + +template struct B; +template <> struct B { + template struct C { + T e; + C (T f) : e(f) {} + }; + void foo () { C c (42); } +}; -- cgit v1.2.3 From ee91f1e5cabd40d2eb4c0e8c2dde7aa95d8e4c6b Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Fri, 8 Mar 2019 21:40:28 +0000 Subject: PR c++/88820 - ICE with CTAD and member template used in DMI. Here the problem was that in order to form a FUNCTION_DECL for foo in the uninstantiated template, we were trying to deduce template args for S from the template parm itself, and failing. * pt.c (do_class_deduction): Handle parm used as its own arg. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@269514 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cp/ChangeLog | 3 +++ gcc/cp/pt.c | 3 +++ gcc/testsuite/g++.dg/cpp1z/class-deduction64.C | 9 +++++++++ 3 files changed, 15 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp1z/class-deduction64.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index a5526d8acc0..ad157c3f961 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,8 @@ 2019-03-08 Jason Merrill + PR c++/88820 - ICE with CTAD and member template used in DMI. + * pt.c (do_class_deduction): Handle parm used as its own arg. + PR c++/88869 - C++17 ICE with CTAD and explicit specialization. * pt.c (do_class_deduction): Don't include explicit specialization args in outer_args. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 1adb7c18e31..d0001c4895b 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -26540,6 +26540,9 @@ do_class_deduction (tree ptype, tree tmpl, tree init, int flags, error ("non-class template %qT used without template arguments", tmpl); return error_mark_node; } + if (init && TREE_TYPE (init) == ptype) + /* Using the template parm as its own argument. */ + return ptype; tree type = TREE_TYPE (tmpl); diff --git a/gcc/testsuite/g++.dg/cpp1z/class-deduction64.C b/gcc/testsuite/g++.dg/cpp1z/class-deduction64.C new file mode 100644 index 00000000000..3a06e6fb522 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1z/class-deduction64.C @@ -0,0 +1,9 @@ +// PR c++/88820 +// { dg-do compile { target c++17 } } + +template struct S; + +template struct W { + template static int foo(); + bool b = foo(); +}; -- cgit v1.2.3 From 967caf3869953d926b9f8e1b194fc46c7ef00f09 Mon Sep 17 00:00:00 2001 From: Martin Jambor Date: Fri, 8 Mar 2019 22:55:20 +0000 Subject: Relax cgraph_node::clone_of_p to also look through former clones 2019-03-08 Martin Jambor Backport from mainline 2019-03-07 Martin Jambor PR ipa/88235 * cgraph.h (cgraph_node): New inline method former_thunk_p. * cgraph.c (cgraph_node::dump): Dump a note if node is a former thunk. (clone_of_p): Treat expanded thunks like thunks, be optimistic if they have multiple callees. At the end check if declarations match as opposed to cgraph_nodes. testsuite/ * g++.dg/ipa/pr88235.C: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@269517 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 12 +++++++++ gcc/cgraph.c | 13 ++++++--- gcc/cgraph.h | 13 +++++++++ gcc/testsuite/ChangeLog | 7 +++++ gcc/testsuite/g++.dg/ipa/pr88235.C | 55 ++++++++++++++++++++++++++++++++++++++ 5 files changed, 97 insertions(+), 3 deletions(-) create mode 100644 gcc/testsuite/g++.dg/ipa/pr88235.C diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 87d6db9003c..7b4f7c00c3c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,15 @@ +2019-03-08 Martin Jambor + + Backport from mainline + 2019-03-07 Martin Jambor + + PR ipa/88235 + * cgraph.h (cgraph_node): New inline method former_thunk_p. + * cgraph.c (cgraph_node::dump): Dump a note if node is a former thunk. + (clone_of_p): Treat expanded thunks like thunks, be optimistic if they + have multiple callees. At the end check if declarations match as + opposed to cgraph_nodes. + 2019-03-06 Tamar Christina Backport from trunk. diff --git a/gcc/cgraph.c b/gcc/cgraph.c index 9f3a2929f6b..8f4019b1fb9 100644 --- a/gcc/cgraph.c +++ b/gcc/cgraph.c @@ -3007,7 +3007,9 @@ cgraph_node::collect_callers (void) return redirect_callers; } -/* Return TRUE if NODE2 a clone of NODE or is equivalent to it. */ + +/* Return TRUE if NODE2 a clone of NODE or is equivalent to it. Return + optimistically true if this cannot be determined. */ static bool clone_of_p (cgraph_node *node, cgraph_node *node2) @@ -3019,12 +3021,17 @@ clone_of_p (cgraph_node *node, cgraph_node *node2) /* There are no virtual clones of thunks so check former_clone_of or if we might have skipped thunks because this adjustments are no longer necessary. */ - while (node->thunk.thunk_p) + while (node->thunk.thunk_p || node->former_thunk_p ()) { if (node2->former_clone_of == node->decl) return true; if (!node->thunk.this_adjusting) return false; + /* In case of instrumented expanded thunks, which can have multiple calls + in them, we do not know how to continue and just have to be + optimistic. */ + if (node->callees->next_callee) + return true; node = node->callees->callee->ultimate_alias_target (); skipped_thunk = true; } @@ -3040,7 +3047,7 @@ clone_of_p (cgraph_node *node, cgraph_node *node2) return false; } - while (node != node2 && node2) + while (node2 && node->decl != node2->decl) node2 = node2->clone_of; return node2 != NULL; } diff --git a/gcc/cgraph.h b/gcc/cgraph.h index afb2745a841..2509cd28881 100644 --- a/gcc/cgraph.h +++ b/gcc/cgraph.h @@ -1258,6 +1258,9 @@ public: Note that at WPA stage, the function body may not be present in memory. */ inline bool has_gimple_body_p (void); + /* Return true if this node represents a former, i.e. an expanded, thunk. */ + inline bool former_thunk_p (void); + /* Return true if function should be optimized for size. */ bool optimize_for_size_p (void); @@ -2858,6 +2861,16 @@ cgraph_node::has_gimple_body_p (void) return definition && !thunk.thunk_p && !alias; } +/* Return true if this node represents a former, i.e. an expanded, thunk. */ + +inline bool +cgraph_node::former_thunk_p (void) +{ + return (!thunk.thunk_p + && (thunk.fixed_offset + || thunk.virtual_offset_p)); +} + /* Walk all functions with body defined. */ #define FOR_EACH_FUNCTION_WITH_GIMPLE_BODY(node) \ for ((node) = symtab->first_function_with_gimple_body (); (node); \ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 9789ecf577f..cec790a4c9d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2019-03-08 Martin Jambor + + Backport from mainline + 2019-03-07 Martin Jambor + + * g++.dg/ipa/pr88235.C: New test. + 2019-03-07 Jakub Jelinek PR c++/89585 diff --git a/gcc/testsuite/g++.dg/ipa/pr88235.C b/gcc/testsuite/g++.dg/ipa/pr88235.C new file mode 100644 index 00000000000..29f3252b828 --- /dev/null +++ b/gcc/testsuite/g++.dg/ipa/pr88235.C @@ -0,0 +1,55 @@ +// { dg-do compile } +// { dg-options "-O1 -fdevirtualize -finline-small-functions -fipa-cp -fipa-cp-clone --param ipa-cp-eval-threshold=125 --param max-inline-insns-single=4" } + +extern "C" int printf (const char *, ...); +enum E { vf_request, vf_event } want; + +int errs = 0; + +class ivResource { +public: + virtual ~ivResource () { } +}; + +class ivHandler : public ivResource { +public: + virtual void event() { } +}; + +class ivGlyph : public ivResource { +public: + virtual ~ivGlyph () { } + virtual void request () { + if (want!=vf_request) + ++errs; + } +}; + +class ItemView : public ivGlyph, public ivHandler { +public: + virtual void event () { + if (want!=vf_event) + ++errs; + } +} a; + +ivGlyph *bar() { + return &a; +} + +ivHandler *bar2() { + return &a; +} + +int main() { + want=vf_request; + bar()->request(); + want=vf_event; + bar2()->event(); + if (errs) { + printf("FAIL\n"); + return 1; + } + printf("PASS\n"); + return 0; +} -- cgit v1.2.3 From 15b88d3b7373effd6ec8c5d0df927004aabd18e1 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Sat, 9 Mar 2019 00:16:10 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@269519 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 6d65f6b85a2..9dc87220701 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190308 +20190309 -- cgit v1.2.3 From 71d54300b94bca769e83485f4555841b7dfdb7bd Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Sun, 10 Mar 2019 00:16:12 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@269544 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 9dc87220701..a82dd1045e8 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190309 +20190310 -- cgit v1.2.3 From b3ae6094d2c36d93f56de9d3a48dfa4c4394ff1a Mon Sep 17 00:00:00 2001 From: Thomas Koenig Date: Sun, 10 Mar 2019 10:28:14 +0000 Subject: 2019-03-10 Thomas Koenig Steven G. Kargl PR fortran/87734 Backort from trunk * symbol.c (gfc_add_procedure): Only throw an error if the procedure has not been declared either PUBLIC or PRIVATE. * resolve.c (is_illegal_recursion): Remove an assert(). 2019-03-10 Thomas Koenig PR fortran/87734 Backport from trunk * gfortran.dg/public_private_module_10.f90: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@269548 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fortran/ChangeLog | 9 +++++++++ gcc/fortran/resolve.c | 2 -- gcc/fortran/symbol.c | 3 ++- gcc/testsuite/ChangeLog | 6 ++++++ gcc/testsuite/gfortran.dg/public_private_module_10.f90 | 18 ++++++++++++++++++ 5 files changed, 35 insertions(+), 3 deletions(-) create mode 100644 gcc/testsuite/gfortran.dg/public_private_module_10.f90 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 51bef2a2922..c01fa812ecd 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,12 @@ +2019-03-10 Thomas Koenig + Steven G. Kargl + + PR fortran/87734 + Backort from trunk + * symbol.c (gfc_add_procedure): Only throw an error if the + procedure has not been declared either PUBLIC or PRIVATE. + * resolve.c (is_illegal_recursion): Remove an assert(). + 2019-03-06 Harald Anlauf Backport from trunk diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index 24b472ed58f..7291039782e 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -1681,8 +1681,6 @@ is_illegal_recursion (gfc_symbol* sym, gfc_namespace* context) || gfc_fl_struct (sym->attr.flavor)) return false; - gcc_assert (sym->attr.flavor == FL_PROCEDURE); - /* If we've got an ENTRY, find real procedure. */ if (sym->attr.entry && sym->ns->entries) proc_sym = sym->ns->entries->sym; diff --git a/gcc/fortran/symbol.c b/gcc/fortran/symbol.c index 00d9303d290..ebb57eda9c5 100644 --- a/gcc/fortran/symbol.c +++ b/gcc/fortran/symbol.c @@ -1801,7 +1801,8 @@ gfc_add_procedure (symbol_attribute *attr, procedure_type t, if (where == NULL) where = &gfc_current_locus; - if (attr->proc != PROC_UNKNOWN && !attr->module_procedure) + if (attr->proc != PROC_UNKNOWN && !attr->module_procedure + && attr->access == ACCESS_UNKNOWN) { if (attr->proc == PROC_ST_FUNCTION && t == PROC_INTERNAL && !gfc_notification_std (GFC_STD_F2008)) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index cec790a4c9d..577d5789842 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2019-03-10 Thomas Koenig + + PR fortran/87734 + Backport from trunk + * gfortran.dg/public_private_module_10.f90: New test. + 2019-03-08 Martin Jambor Backport from mainline diff --git a/gcc/testsuite/gfortran.dg/public_private_module_10.f90 b/gcc/testsuite/gfortran.dg/public_private_module_10.f90 new file mode 100644 index 00000000000..1877cc23279 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/public_private_module_10.f90 @@ -0,0 +1,18 @@ +! { dg-do compile } +! PR 87734 - this used to issue spurious errors. + +module m_vstring + implicit none + + public :: vstring_length + +contains + + subroutine vstring_cast() + character ( len = vstring_length() ) :: char_string + end subroutine + + pure integer function vstring_length () + end function + +end module -- cgit v1.2.3 From 5d6be5b2193795faea18d4042c72f133582c4734 Mon Sep 17 00:00:00 2001 From: Thomas Koenig Date: Sun, 10 Mar 2019 11:19:58 +0000 Subject: 2019-03-10 Thomas Koenig PR fortran/71544 Backport from trunk * trans-types.c (gfc_typenode_for_spec) Set ts->is_c_interop of C_PTR and C_FUNPTR. (create_fn_spec): Mark argument as escaping if ts->is_c_interop is set. 2019-03-10 Thomas Koenig PR fortran/71544 Backport from trunk * gfortran.dg/c_ptr_tests_19.f90: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@269551 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fortran/ChangeLog | 8 +++++++ gcc/fortran/trans-types.c | 6 +++-- gcc/testsuite/ChangeLog | 6 +++++ gcc/testsuite/gfortran.dg/c_ptr_tests_19.f90 | 36 ++++++++++++++++++++++++++++ 4 files changed, 54 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gfortran.dg/c_ptr_tests_19.f90 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index c01fa812ecd..03edb662ff8 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,11 @@ +2019-03-10 Thomas Koenig + + PR fortran/71544 + Backport from trunk + * trans-types.c (gfc_typenode_for_spec) Set ts->is_c_interop of + C_PTR and C_FUNPTR. + (create_fn_spec): Mark argument as escaping if ts->is_c_interop is set. + 2019-03-10 Thomas Koenig Steven G. Kargl diff --git a/gcc/fortran/trans-types.c b/gcc/fortran/trans-types.c index b47475e1602..a3659e65e43 100644 --- a/gcc/fortran/trans-types.c +++ b/gcc/fortran/trans-types.c @@ -1213,7 +1213,8 @@ gfc_typenode_for_spec (gfc_typespec * spec, int codim) { spec->type = BT_INTEGER; spec->kind = gfc_index_integer_kind; - spec->f90_type = BT_VOID; + spec->f90_type = BT_VOID; + spec->is_c_interop = 1; /* Mark as escaping later. */ } break; case BT_VOID: @@ -2978,7 +2979,8 @@ create_fn_spec (gfc_symbol *sym, tree fntype) || f->sym->ts.u.derived->attr.pointer_comp)) || (f->sym->ts.type == BT_CLASS && (CLASS_DATA (f->sym)->ts.u.derived->attr.proc_pointer_comp - || CLASS_DATA (f->sym)->ts.u.derived->attr.pointer_comp))) + || CLASS_DATA (f->sym)->ts.u.derived->attr.pointer_comp)) + || (f->sym->ts.type == BT_INTEGER && f->sym->ts.is_c_interop)) spec[spec_len++] = '.'; else if (f->sym->attr.intent == INTENT_IN) spec[spec_len++] = 'r'; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 577d5789842..30b858d6d3b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2019-03-10 Thomas Koenig + + PR fortran/71544 + Backport from trunk + * gfortran.dg/c_ptr_tests_19.f90: New test. + 2019-03-10 Thomas Koenig PR fortran/87734 diff --git a/gcc/testsuite/gfortran.dg/c_ptr_tests_19.f90 b/gcc/testsuite/gfortran.dg/c_ptr_tests_19.f90 new file mode 100644 index 00000000000..2cb0b183c88 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/c_ptr_tests_19.f90 @@ -0,0 +1,36 @@ +! { dg-do run } + +! PR 71544 - this failed with some optimization options due to a +! pointer not being marked as escaping. + +module store_cptr + use, intrinsic :: iso_c_binding + implicit none + public + type(c_ptr), save :: cptr +end module store_cptr + +subroutine init() + use, intrinsic :: iso_c_binding + implicit none + integer(c_int), pointer :: a + allocate(a) + call save_cptr(c_loc(a)) + a = 100 +end subroutine init + +subroutine save_cptr(cptr_in) + use store_cptr + implicit none + type(c_ptr), intent(in) :: cptr_in + cptr = cptr_in +end subroutine save_cptr + +program init_fails + use store_cptr + implicit none + integer(c_int), pointer :: val + call init() + call c_f_pointer(cptr,val) + if (val /= 100) stop 1 +end program init_fails -- cgit v1.2.3 From c79734b8f5c9a0ff1c7f017e84d963d7ea1c618c Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Mon, 11 Mar 2019 00:16:09 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@269564 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index a82dd1045e8..6bb0d5a3f6f 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190310 +20190311 -- cgit v1.2.3 From 47c6437d421c3641dd8e668812618afc591d338c Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Mon, 11 Mar 2019 09:37:41 +0000 Subject: Backport r268789 2019-03-11 Martin Liska Backport from mainline 2019-02-11 David Malcolm PR lto/88147 * input.c (selftest::test_line_offset_overflow): New selftest. (selftest::input_c_tests): Call it. 2019-03-11 Martin Liska Backport from mainline 2019-02-11 Martin Liska PR lto/88147 * line-map.c (linemap_line_start): Don't reuse the existing line map if the line offset is sufficiently large to cause overflow when computing location_t values. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@269570 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 9 +++++++++ gcc/input.c | 30 ++++++++++++++++++++++++++++++ libcpp/ChangeLog | 10 ++++++++++ libcpp/line-map.c | 4 ++++ 4 files changed, 53 insertions(+) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 7b4f7c00c3c..eae2c4fe68c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2019-03-11 Martin Liska + + Backport from mainline + 2019-02-11 David Malcolm + + PR lto/88147 + * input.c (selftest::test_line_offset_overflow): New selftest. + (selftest::input_c_tests): Call it. + 2019-03-08 Martin Jambor Backport from mainline diff --git a/gcc/input.c b/gcc/input.c index b6675768722..26c2bf21d52 100644 --- a/gcc/input.c +++ b/gcc/input.c @@ -3538,6 +3538,34 @@ for_each_line_table_case (void (*testcase) (const line_table_case &)) ASSERT_EQ (num_cases_tested, 2 * 12); } +/* Verify that when presented with a consecutive pair of locations with + a very large line offset, we don't attempt to consolidate them into + a single ordinary linemap where the line offsets within the line map + would lead to overflow (PR lto/88147). */ + +static void +test_line_offset_overflow () +{ + line_table_test ltt (line_table_case (5, 0)); + + linemap_add (line_table, LC_ENTER, false, "foo.c", 0); + linemap_line_start (line_table, 1, 100); + location_t loc_a = linemap_line_start (line_table, 2578, 255); + assert_loceq ("foo.c", 2578, 0, loc_a); + + const line_map_ordinary *ordmap_a = LINEMAPS_LAST_ORDINARY_MAP (line_table); + ASSERT_EQ (ordmap_a->m_column_and_range_bits, 13); + ASSERT_EQ (ordmap_a->m_range_bits, 5); + + location_t loc_b = linemap_line_start (line_table, 404198, 512); + assert_loceq ("foo.c", 404198, 0, loc_b); + + /* We should have started a new linemap, rather than attempting to store + a very large line offset. */ + const line_map_ordinary *ordmap_b = LINEMAPS_LAST_ORDINARY_MAP (line_table); + ASSERT_NE (ordmap_a, ordmap_b); +} + /* Run all of the selftests within this file. */ void @@ -3577,6 +3605,8 @@ input_c_tests () for_each_line_table_case (test_lexer_char_constants); test_reading_source_line (); + + test_line_offset_overflow (); } } // namespace selftest diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog index afc70cfce6c..e29f66d39f1 100644 --- a/libcpp/ChangeLog +++ b/libcpp/ChangeLog @@ -1,3 +1,13 @@ +2019-03-11 Martin Liska + + Backport from mainline + 2019-02-11 Martin Liska + + PR lto/88147 + * line-map.c (linemap_line_start): Don't reuse the existing line + map if the line offset is sufficiently large to cause overflow + when computing location_t values. + 2019-02-22 Release Manager * GCC 8.3.0 released. diff --git a/libcpp/line-map.c b/libcpp/line-map.c index a84084c99f0..42aecd6993f 100644 --- a/libcpp/line-map.c +++ b/libcpp/line-map.c @@ -755,6 +755,10 @@ linemap_line_start (struct line_maps *set, linenum_type to_line, if (line_delta < 0 || last_line != ORDINARY_MAP_STARTING_LINE_NUMBER (map) || SOURCE_COLUMN (map, highest) >= (1U << (column_bits - range_bits)) + || ( /* We can't reuse the map if the line offset is sufficiently + large to cause overflow when computing location_t values. */ + (to_line - ORDINARY_MAP_STARTING_LINE_NUMBER (map)) + >= (1U << (CHAR_BIT * sizeof (linenum_type) - column_bits))) || range_bits < map->m_range_bits) map = linemap_check_ordinary (const_cast -- cgit v1.2.3 From 6c67b74c75dcf9a90f23daff3e3df5cf71100163 Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Mon, 11 Mar 2019 09:37:52 +0000 Subject: Backport r268981 2019-03-11 Martin Liska Backport from mainline 2019-02-18 Martin Liska PR c++/89383 * line-map.c (linemap_line_start): Use 1UL in order to not overflow. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@269571 138bc75d-0d04-0410-961f-82ee72b054a4 --- libcpp/ChangeLog | 9 +++++++++ libcpp/line-map.c | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog index e29f66d39f1..bc1208a689b 100644 --- a/libcpp/ChangeLog +++ b/libcpp/ChangeLog @@ -1,3 +1,12 @@ +2019-03-11 Martin Liska + + Backport from mainline + 2019-02-18 Martin Liska + + PR c++/89383 + * line-map.c (linemap_line_start): Use 1UL in order + to not overflow. + 2019-03-11 Martin Liska Backport from mainline diff --git a/libcpp/line-map.c b/libcpp/line-map.c index 42aecd6993f..72fe2c0dcec 100644 --- a/libcpp/line-map.c +++ b/libcpp/line-map.c @@ -758,7 +758,8 @@ linemap_line_start (struct line_maps *set, linenum_type to_line, || ( /* We can't reuse the map if the line offset is sufficiently large to cause overflow when computing location_t values. */ (to_line - ORDINARY_MAP_STARTING_LINE_NUMBER (map)) - >= (1U << (CHAR_BIT * sizeof (linenum_type) - column_bits))) + >= (((uint64_t) 1) + << (CHAR_BIT * sizeof (linenum_type) - column_bits))) || range_bits < map->m_range_bits) map = linemap_check_ordinary (const_cast -- cgit v1.2.3 From 47e0cdef66649ea6e52814c585413c4620c04916 Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Mon, 11 Mar 2019 09:38:06 +0000 Subject: Backport r269492 2019-03-11 Martin Liska Backport from mainline 2019-03-08 Martin Liska PR target/86952 * config/i386/i386.c (ix86_option_override_internal): Disable jump tables when retpolines are used. 2019-03-11 Martin Liska Backport from mainline 2019-03-08 Martin Liska PR target/86952 * gcc.target/i386/indirect-thunk-7.c: Use jump tables to match scanned pattern. * gcc.target/i386/indirect-thunk-inline-7.c: Likewise. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@269572 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 9 +++++++++ gcc/config/i386/i386.c | 6 ++++++ gcc/testsuite/ChangeLog | 10 ++++++++++ gcc/testsuite/gcc.target/i386/indirect-thunk-7.c | 2 +- gcc/testsuite/gcc.target/i386/indirect-thunk-inline-7.c | 2 +- 5 files changed, 27 insertions(+), 2 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index eae2c4fe68c..a91a2227f74 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2019-03-11 Martin Liska + + Backport from mainline + 2019-03-08 Martin Liska + + PR target/86952 + * config/i386/i386.c (ix86_option_override_internal): Disable + jump tables when retpolines are used. + 2019-03-11 Martin Liska Backport from mainline diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index a88a29b51e6..f1de97f73df 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -4958,6 +4958,12 @@ ix86_option_override_internal (bool main_args_p, opts->x_param_values, opts_set->x_param_values); + /* PR86952: jump table usage with retpolines is slow. + The PR provides some numbers about the slowness. */ + if (ix86_indirect_branch != indirect_branch_keep + && !opts_set->x_flag_jump_tables) + opts->x_flag_jump_tables = 0; + return true; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 30b858d6d3b..d700082a335 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,13 @@ +2019-03-11 Martin Liska + + Backport from mainline + 2019-03-08 Martin Liska + + PR target/86952 + * gcc.target/i386/indirect-thunk-7.c: Use jump tables to match + scanned pattern. + * gcc.target/i386/indirect-thunk-inline-7.c: Likewise. + 2019-03-10 Thomas Koenig PR fortran/71544 diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-7.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-7.c index 3c72036dbaf..53868f46558 100644 --- a/gcc/testsuite/gcc.target/i386/indirect-thunk-7.c +++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-7.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk -fno-pic" } */ +/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk -fno-pic -fjump-tables" } */ void func0 (void); void func1 (void); diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-7.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-7.c index ea009245a58..e6f064959a1 100644 --- a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-7.c +++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-7.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk-inline -fno-pic" } */ +/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk-inline -fno-pic -fjump-tables" } */ void func0 (void); void func1 (void); -- cgit v1.2.3 From e5a2aa458629e04fd2cf71e0a557e788d138fea6 Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Mon, 11 Mar 2019 09:38:18 +0000 Subject: Backport r269558 2019-03-11 Martin Liska Backport from mainline 2019-03-10 Rainer Orth * gcc.target/i386/indirect-thunk-extern-7.c: Add -fjump-tables to dg-options. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@269573 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/testsuite/ChangeLog | 8 ++++++++ gcc/testsuite/gcc.target/i386/indirect-thunk-extern-7.c | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index d700082a335..ada8a72d565 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2019-03-11 Martin Liska + + Backport from mainline + 2019-03-10 Rainer Orth + + * gcc.target/i386/indirect-thunk-extern-7.c: Add -fjump-tables to + dg-options. + 2019-03-11 Martin Liska Backport from mainline diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-7.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-7.c index b7339745116..95c5cc176ae 100644 --- a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-7.c +++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-7.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk-extern -fno-pic" } */ +/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk-extern -fno-pic -fjump-tables" } */ void func0 (void); void func1 (void); -- cgit v1.2.3 From f8f108152f52d6b43c426a790481f3b252ed6e2a Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Mon, 11 Mar 2019 11:40:11 +0000 Subject: PR rtl-optimization/89588 * loop-unroll.c (decide_unroll_constant_iterations): Make guard for explicit unrolling factor more robust. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@269580 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 6 ++++++ gcc/loop-unroll.c | 2 +- gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/c-c++-common/unroll-6.c | 9 +++++++++ 4 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/c-c++-common/unroll-6.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a91a2227f74..166d9ea98ac 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2019-03-11 Eric Botcazou + + PR rtl-optimization/89588 + * loop-unroll.c (decide_unroll_constant_iterations): Make guard for + explicit unrolling factor more robust. + 2019-03-11 Martin Liska Backport from mainline diff --git a/gcc/loop-unroll.c b/gcc/loop-unroll.c index 5a0393224cb..4b36e7c44c3 100644 --- a/gcc/loop-unroll.c +++ b/gcc/loop-unroll.c @@ -399,7 +399,7 @@ decide_unroll_constant_iterations (struct loop *loop, int flags) { /* However we cannot unroll completely at the RTL level a loop with constant number of iterations; it should have been peeled instead. */ - if ((unsigned) loop->unroll - 1 > desc->niter - 2) + if ((unsigned) loop->unroll > desc->niter - 1) { if (dump_file) fprintf (dump_file, ";; Loop should have been peeled\n"); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ada8a72d565..3cbe732c64a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2019-03-11 Eric Botcazou + + * c-c++-common/unroll-6.c: New test. + 2019-03-11 Martin Liska Backport from mainline diff --git a/gcc/testsuite/c-c++-common/unroll-6.c b/gcc/testsuite/c-c++-common/unroll-6.c new file mode 100644 index 00000000000..fd74f19bed5 --- /dev/null +++ b/gcc/testsuite/c-c++-common/unroll-6.c @@ -0,0 +1,9 @@ +/* { dg-do compile } */ +/* { dg-options "-O -fno-tree-loop-optimize" } */ + +void test (void) +{ + #pragma GCC unroll 2 + for (int nv = 0; nv <= 2; nv += 2) + {} +} -- cgit v1.2.3 From c277daa40f36281b6c7d0d50828e79f06e279660 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Tue, 12 Mar 2019 00:16:08 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@269600 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 6bb0d5a3f6f..8225281e59d 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190311 +20190312 -- cgit v1.2.3 From 17e8f9d7d93f7fc30d0de688a7675dee1843b304 Mon Sep 17 00:00:00 2001 From: Andre Vieira Date: Tue, 12 Mar 2019 14:52:02 +0000 Subject: Backport of r269499 and related testism fix r269596. gcc/ChangeLog: 2019-03-12 Andre Vieira Backport from mainline 2019-03-08 Andre Vieira * config/arm/arm.h (TARGET_FP16_TO_DOUBLE): Add TARGET_VFP_DOUBLE requirement. gcc/testsuite/ChangeLog: 2019-03-12 Andre Vieira Backport from mainline 2019-03-08 Andre Vieira * gcc.target/arm/f16_f64_conv_no_dp.c: New test. Backport from mainline 2019-03-11 Christophe Lyon * gcc.target/arm/f16_f64_conv_no_dp.c: Add arm_fp16_ok effective target. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@269613 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 8 ++++++++ gcc/config/arm/arm.h | 2 +- gcc/testsuite/ChangeLog | 13 +++++++++++++ gcc/testsuite/gcc.target/arm/f16_f64_conv_no_dp.c | 16 ++++++++++++++++ 4 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.target/arm/f16_f64_conv_no_dp.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 166d9ea98ac..3de25eb3ec7 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2019-03-12 Andre Vieira + + Backport from mainline + 2019-03-08 Andre Vieira + + * config/arm/arm.h (TARGET_FP16_TO_DOUBLE): Add TARGET_VFP_DOUBLE + requirement. + 2019-03-11 Eric Botcazou PR rtl-optimization/89588 diff --git a/gcc/config/arm/arm.h b/gcc/config/arm/arm.h index 2809112f68d..b12ae385802 100644 --- a/gcc/config/arm/arm.h +++ b/gcc/config/arm/arm.h @@ -191,7 +191,7 @@ extern tree arm_fp16_type_node; /* FPU supports converting between HFmode and DFmode in a single hardware step. */ #define TARGET_FP16_TO_DOUBLE \ - (TARGET_HARD_FLOAT && (TARGET_FP16 && TARGET_VFP5)) + (TARGET_HARD_FLOAT && TARGET_FP16 && TARGET_VFP5 && TARGET_VFP_DOUBLE) /* FPU supports fused-multiply-add operations. */ #define TARGET_FMA (bitmap_bit_p (arm_active_target.isa, isa_bit_vfpv4)) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 3cbe732c64a..c6574c81295 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,16 @@ +2019-03-12 Andre Vieira + + Backport from mainline + 2019-03-08 Andre Vieira + + * gcc.target/arm/f16_f64_conv_no_dp.c: New test. + + Backport from mainline + 2019-03-11 Christophe Lyon + + * gcc.target/arm/f16_f64_conv_no_dp.c: Add arm_fp16_ok effective + target. + 2019-03-11 Eric Botcazou * c-c++-common/unroll-6.c: New test. diff --git a/gcc/testsuite/gcc.target/arm/f16_f64_conv_no_dp.c b/gcc/testsuite/gcc.target/arm/f16_f64_conv_no_dp.c new file mode 100644 index 00000000000..2620e570004 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/f16_f64_conv_no_dp.c @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target arm_fp16_ok } */ +/* { dg-skip-if "do not override fpu" { *-*-* } { "-mfpu=*" } { "-mfpu=fpv5-sp-d16" } } */ +/* { dg-skip-if "do not disable fpu" { *-*-* } { "-mfloat-abi=soft" } { * } } */ +/* { dg-skip-if "do not override fp16-format" { *-*-* } { "-mfp16-format=*" } { "-mfp16-format=ieee" } } */ +/* { dg-options "-O1 -mfpu=fpv5-sp-d16 -mfloat-abi=hard -mfp16-format=ieee" } */ + +__fp16 foo (double a) +{ + return a; +} + +double bar (__fp16 a) +{ + return a; +} -- cgit v1.2.3 From 13b9173acd4db41a18888f0facd8781f5c76d402 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Tue, 12 Mar 2019 16:15:47 +0000 Subject: 2019-03-12 Richard Biener PR tree-optimization/89664 * tree-ssa-math-opts.c (execute_cse_reciprocals_1): Properly free the occurance tree after the early out. * gfortran.dg/pr89664.f90: New testcase. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@269618 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 6 ++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gfortran.dg/pr89664.f90 | 24 ++++++++++++++++++++++++ gcc/tree-ssa-math-opts.c | 3 ++- 4 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gfortran.dg/pr89664.f90 diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 3de25eb3ec7..217c3a2972c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2019-03-12 Richard Biener + + PR tree-optimization/89664 + * tree-ssa-math-opts.c (execute_cse_reciprocals_1): Properly + free the occurance tree after the early out. + 2019-03-12 Andre Vieira Backport from mainline diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c6574c81295..52711b38a2f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-03-12 Richard Biener + + PR tree-optimization/89664 + * gfortran.dg/pr89664.f90: New testcase. + 2019-03-12 Andre Vieira Backport from mainline diff --git a/gcc/testsuite/gfortran.dg/pr89664.f90 b/gcc/testsuite/gfortran.dg/pr89664.f90 new file mode 100644 index 00000000000..55578069957 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr89664.f90 @@ -0,0 +1,24 @@ +! { dg-do compile } +! { dg-options "-Ofast" } + +subroutine s (x) + real :: x + call sub (x) +end +subroutine sub (x) + real :: x, y + logical :: a, b + real :: f1, f2, f3, f4 + y = f1() + a = .false. + if ( f2() > f3() ) a = .true. + b = .false. + if ( f2() > f4() ) b = .true. + if ( a ) then + x = 1.0 + else if ( b ) then + x = 1.0/y**2 + else + x = 1.0/y - y**2 + end if +end diff --git a/gcc/tree-ssa-math-opts.c b/gcc/tree-ssa-math-opts.c index 8463979b4c8..a8f275bb78f 100644 --- a/gcc/tree-ssa-math-opts.c +++ b/gcc/tree-ssa-math-opts.c @@ -603,7 +603,7 @@ execute_cse_reciprocals_1 (gimple_stmt_iterator *def_gsi, tree def) /* If it is more profitable to optimize 1 / x, don't optimize 1 / (x * x). */ if (sqrt_recip_count > square_recip_count) - return; + goto out; /* Do the expensive part only if we can hope to optimize something. */ if (count + square_recip_count >= threshold && count >= 1) @@ -646,6 +646,7 @@ execute_cse_reciprocals_1 (gimple_stmt_iterator *def_gsi, tree def) } } +out: for (occ = occ_head; occ; ) occ = free_bb (occ); -- cgit v1.2.3 From 3c70487ae8c5f04e19567f02251a8fa31711e634 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Wed, 13 Mar 2019 00:16:09 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@269630 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 8225281e59d..7e9d41b52ce 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190312 +20190313 -- cgit v1.2.3 From 48ed1681aa48c24f013cabbcd7e0624ace1d8014 Mon Sep 17 00:00:00 2001 From: Andreas Krebbel Date: Wed, 13 Mar 2019 09:50:21 +0000 Subject: S/390: Fix the vec_xl / vec_xst style builtins This patch fixes several problems with the vec_xl/vec_xst builtins: - vec_xl/vec_xst needs to use the alignment of the scalar memory operand for the vector type reference. This is required to emit the proper vl/vst alignment hints. - vec_xl / vec_xld2 / vec_xlw4 should accept const pointer source operands - vec_xlw4 / vec_xstw4 needs to accept float memory operands gcc/ChangeLog: 2019-03-13 Andreas Krebbel Backport from mainline 2019-02-07 Andreas Krebbel * config/s390/s390-builtin-types.def: Add new types. * config/s390/s390-builtins.def: (s390_vec_xl, s390_vec_xld2) (s390_vec_xlw4): Make the memory operand into a const pointer. (s390_vec_xld2, s390_vec_xlw4): Add a variant for single precision float. * config/s390/s390-c.c (s390_expand_overloaded_builtin): Generate a new vector type with the alignment of the scalar memory operand. gcc/testsuite/ChangeLog: 2019-03-13 Andreas Krebbel Backport from mainline 2019-02-07 Andreas Krebbel * gcc.target/s390/zvector/xl-xst-align-1.c: New test. * gcc.target/s390/zvector/xl-xst-align-2.c: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@269642 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 13 +++++ gcc/config/s390/s390-builtin-types.def | 14 ++++- gcc/config/s390/s390-builtins.def | 65 +++++++++++----------- gcc/config/s390/s390-c.c | 28 +++++++--- gcc/testsuite/ChangeLog | 8 +++ .../gcc.target/s390/zvector/xl-xst-align-1.c | 45 +++++++++++++++ .../gcc.target/s390/zvector/xl-xst-align-2.c | 48 ++++++++++++++++ 7 files changed, 182 insertions(+), 39 deletions(-) create mode 100644 gcc/testsuite/gcc.target/s390/zvector/xl-xst-align-1.c create mode 100644 gcc/testsuite/gcc.target/s390/zvector/xl-xst-align-2.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 217c3a2972c..fefba6f1345 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,16 @@ +2019-03-13 Andreas Krebbel + + Backport from mainline + 2019-02-07 Andreas Krebbel + + * config/s390/s390-builtin-types.def: Add new types. + * config/s390/s390-builtins.def: (s390_vec_xl, s390_vec_xld2) + (s390_vec_xlw4): Make the memory operand into a const pointer. + (s390_vec_xld2, s390_vec_xlw4): Add a variant for single precision + float. + * config/s390/s390-c.c (s390_expand_overloaded_builtin): Generate + a new vector type with the alignment of the scalar memory operand. + 2019-03-12 Richard Biener PR tree-optimization/89664 diff --git a/gcc/config/s390/s390-builtin-types.def b/gcc/config/s390/s390-builtin-types.def index 2acc55fe0af..6f257c6de77 100644 --- a/gcc/config/s390/s390-builtin-types.def +++ b/gcc/config/s390/s390-builtin-types.def @@ -260,6 +260,7 @@ DEF_FN_TYPE_2 (BT_FN_V4SF_FLT_INT, BT_V4SF, BT_FLT, BT_INT) DEF_FN_TYPE_2 (BT_FN_V4SF_V4SF_UCHAR, BT_V4SF, BT_V4SF, BT_UCHAR) DEF_FN_TYPE_2 (BT_FN_V4SF_V4SF_V4SF, BT_V4SF, BT_V4SF, BT_V4SF) DEF_FN_TYPE_2 (BT_FN_V4SI_BV4SI_V4SI, BT_V4SI, BT_BV4SI, BT_V4SI) +DEF_FN_TYPE_2 (BT_FN_V4SI_INT_VOIDCONSTPTR, BT_V4SI, BT_INT, BT_VOIDCONSTPTR) DEF_FN_TYPE_2 (BT_FN_V4SI_INT_VOIDPTR, BT_V4SI, BT_INT, BT_VOIDPTR) DEF_FN_TYPE_2 (BT_FN_V4SI_UV4SI_UV4SI, BT_V4SI, BT_UV4SI, BT_UV4SI) DEF_FN_TYPE_2 (BT_FN_V4SI_V2DI_V2DI, BT_V4SI, BT_V2DI, BT_V2DI) @@ -492,6 +493,7 @@ DEF_OV_TYPE (BT_OV_USHORT_UV8HI_INT, BT_USHORT, BT_UV8HI, BT_INT) DEF_OV_TYPE (BT_OV_UV16QI_BV16QI_BV16QI, BT_UV16QI, BT_BV16QI, BT_BV16QI) DEF_OV_TYPE (BT_OV_UV16QI_BV16QI_BV16QI_INTPTR, BT_UV16QI, BT_BV16QI, BT_BV16QI, BT_INTPTR) DEF_OV_TYPE (BT_OV_UV16QI_BV16QI_UV16QI, BT_UV16QI, BT_BV16QI, BT_UV16QI) +DEF_OV_TYPE (BT_OV_UV16QI_LONG_UCHARCONSTPTR, BT_UV16QI, BT_LONG, BT_UCHARCONSTPTR) DEF_OV_TYPE (BT_OV_UV16QI_LONG_UCHARPTR, BT_UV16QI, BT_LONG, BT_UCHARPTR) DEF_OV_TYPE (BT_OV_UV16QI_UCHAR, BT_UV16QI, BT_UCHAR) DEF_OV_TYPE (BT_OV_UV16QI_UCHARCONSTPTR, BT_UV16QI, BT_UCHARCONSTPTR) @@ -523,6 +525,7 @@ DEF_OV_TYPE (BT_OV_UV16QI_UV8HI_UV8HI_INTPTR, BT_UV16QI, BT_UV8HI, BT_UV8HI, BT_ DEF_OV_TYPE (BT_OV_UV16QI_V16QI, BT_UV16QI, BT_V16QI) DEF_OV_TYPE (BT_OV_UV16QI_V8HI_V8HI, BT_UV16QI, BT_V8HI, BT_V8HI) DEF_OV_TYPE (BT_OV_UV2DI_BV2DI_UV2DI, BT_UV2DI, BT_BV2DI, BT_UV2DI) +DEF_OV_TYPE (BT_OV_UV2DI_LONG_ULONGLONGCONSTPTR, BT_UV2DI, BT_LONG, BT_ULONGLONGCONSTPTR) DEF_OV_TYPE (BT_OV_UV2DI_LONG_ULONGLONGPTR, BT_UV2DI, BT_LONG, BT_ULONGLONGPTR) DEF_OV_TYPE (BT_OV_UV2DI_ULONGLONG, BT_UV2DI, BT_ULONGLONG) DEF_OV_TYPE (BT_OV_UV2DI_ULONGLONGCONSTPTR, BT_UV2DI, BT_ULONGLONGCONSTPTR) @@ -556,6 +559,8 @@ DEF_OV_TYPE (BT_OV_UV2DI_V2DI, BT_UV2DI, BT_V2DI) DEF_OV_TYPE (BT_OV_UV4SI_BV4SI_BV4SI, BT_UV4SI, BT_BV4SI, BT_BV4SI) DEF_OV_TYPE (BT_OV_UV4SI_BV4SI_BV4SI_INTPTR, BT_UV4SI, BT_BV4SI, BT_BV4SI, BT_INTPTR) DEF_OV_TYPE (BT_OV_UV4SI_BV4SI_UV4SI, BT_UV4SI, BT_BV4SI, BT_UV4SI) +DEF_OV_TYPE (BT_OV_UV4SI_LONG_FLTPTR, BT_UV4SI, BT_LONG, BT_FLTPTR) +DEF_OV_TYPE (BT_OV_UV4SI_LONG_UINTCONSTPTR, BT_UV4SI, BT_LONG, BT_UINTCONSTPTR) DEF_OV_TYPE (BT_OV_UV4SI_LONG_UINTPTR, BT_UV4SI, BT_LONG, BT_UINTPTR) DEF_OV_TYPE (BT_OV_UV4SI_UINT, BT_UV4SI, BT_UINT) DEF_OV_TYPE (BT_OV_UV4SI_UINTCONSTPTR, BT_UV4SI, BT_UINTCONSTPTR) @@ -593,6 +598,7 @@ DEF_OV_TYPE (BT_OV_UV4SI_V4SI, BT_UV4SI, BT_V4SI) DEF_OV_TYPE (BT_OV_UV8HI_BV8HI_BV8HI, BT_UV8HI, BT_BV8HI, BT_BV8HI) DEF_OV_TYPE (BT_OV_UV8HI_BV8HI_BV8HI_INTPTR, BT_UV8HI, BT_BV8HI, BT_BV8HI, BT_INTPTR) DEF_OV_TYPE (BT_OV_UV8HI_BV8HI_UV8HI, BT_UV8HI, BT_BV8HI, BT_UV8HI) +DEF_OV_TYPE (BT_OV_UV8HI_LONG_USHORTCONSTPTR, BT_UV8HI, BT_LONG, BT_USHORTCONSTPTR) DEF_OV_TYPE (BT_OV_UV8HI_LONG_USHORTPTR, BT_UV8HI, BT_LONG, BT_USHORTPTR) DEF_OV_TYPE (BT_OV_UV8HI_USHORT, BT_UV8HI, BT_USHORT) DEF_OV_TYPE (BT_OV_UV8HI_USHORTCONSTPTR, BT_UV8HI, BT_USHORTCONSTPTR) @@ -626,6 +632,7 @@ DEF_OV_TYPE (BT_OV_UV8HI_UV8HI_V8HI, BT_UV8HI, BT_UV8HI, BT_V8HI) DEF_OV_TYPE (BT_OV_UV8HI_V4SI_V4SI, BT_UV8HI, BT_V4SI, BT_V4SI) DEF_OV_TYPE (BT_OV_UV8HI_V8HI, BT_UV8HI, BT_V8HI) DEF_OV_TYPE (BT_OV_V16QI_BV16QI_V16QI, BT_V16QI, BT_BV16QI, BT_V16QI) +DEF_OV_TYPE (BT_OV_V16QI_LONG_SCHARCONSTPTR, BT_V16QI, BT_LONG, BT_SCHARCONSTPTR) DEF_OV_TYPE (BT_OV_V16QI_LONG_SCHARPTR, BT_V16QI, BT_LONG, BT_SCHARPTR) DEF_OV_TYPE (BT_OV_V16QI_SCHAR, BT_V16QI, BT_SCHAR) DEF_OV_TYPE (BT_OV_V16QI_SCHARCONSTPTR, BT_V16QI, BT_SCHARCONSTPTR) @@ -660,6 +667,7 @@ DEF_OV_TYPE (BT_OV_V2DF_DBLCONSTPTR_UINT, BT_V2DF, BT_DBLCONSTPTR, BT_UINT) DEF_OV_TYPE (BT_OV_V2DF_DBLCONSTPTR_USHORT, BT_V2DF, BT_DBLCONSTPTR, BT_USHORT) DEF_OV_TYPE (BT_OV_V2DF_DBL_INT, BT_V2DF, BT_DBL, BT_INT) DEF_OV_TYPE (BT_OV_V2DF_DBL_V2DF_INT, BT_V2DF, BT_DBL, BT_V2DF, BT_INT) +DEF_OV_TYPE (BT_OV_V2DF_LONG_DBLCONSTPTR, BT_V2DF, BT_LONG, BT_DBLCONSTPTR) DEF_OV_TYPE (BT_OV_V2DF_LONG_DBLPTR, BT_V2DF, BT_LONG, BT_DBLPTR) DEF_OV_TYPE (BT_OV_V2DF_UV2DI, BT_V2DF, BT_UV2DI) DEF_OV_TYPE (BT_OV_V2DF_UV2DI_INT, BT_V2DF, BT_UV2DI, BT_INT) @@ -687,6 +695,7 @@ DEF_OV_TYPE (BT_OV_V2DI_LONGLONGCONSTPTR_USHORT, BT_V2DI, BT_LONGLONGCONSTPTR, B DEF_OV_TYPE (BT_OV_V2DI_LONGLONG_INT, BT_V2DI, BT_LONGLONG, BT_INT) DEF_OV_TYPE (BT_OV_V2DI_LONGLONG_LONGLONG, BT_V2DI, BT_LONGLONG, BT_LONGLONG) DEF_OV_TYPE (BT_OV_V2DI_LONGLONG_V2DI_INT, BT_V2DI, BT_LONGLONG, BT_V2DI, BT_INT) +DEF_OV_TYPE (BT_OV_V2DI_LONG_LONGLONGCONSTPTR, BT_V2DI, BT_LONG, BT_LONGLONGCONSTPTR) DEF_OV_TYPE (BT_OV_V2DI_LONG_LONGLONGPTR, BT_V2DI, BT_LONG, BT_LONGLONGPTR) DEF_OV_TYPE (BT_OV_V2DI_V16QI, BT_V2DI, BT_V16QI) DEF_OV_TYPE (BT_OV_V2DI_V2DI, BT_V2DI, BT_V2DI) @@ -716,7 +725,7 @@ DEF_OV_TYPE (BT_OV_V4SF_FLTCONSTPTR_UINT, BT_V4SF, BT_FLTCONSTPTR, BT_UINT) DEF_OV_TYPE (BT_OV_V4SF_FLTCONSTPTR_USHORT, BT_V4SF, BT_FLTCONSTPTR, BT_USHORT) DEF_OV_TYPE (BT_OV_V4SF_FLT_INT, BT_V4SF, BT_FLT, BT_INT) DEF_OV_TYPE (BT_OV_V4SF_FLT_V4SF_INT, BT_V4SF, BT_FLT, BT_V4SF, BT_INT) -DEF_OV_TYPE (BT_OV_V4SF_LONG_FLTPTR, BT_V4SF, BT_LONG, BT_FLTPTR) +DEF_OV_TYPE (BT_OV_V4SF_LONG_FLTCONSTPTR, BT_V4SF, BT_LONG, BT_FLTCONSTPTR) DEF_OV_TYPE (BT_OV_V4SF_V4SF, BT_V4SF, BT_V4SF) DEF_OV_TYPE (BT_OV_V4SF_V4SF_BV4SI, BT_V4SF, BT_V4SF, BT_BV4SI) DEF_OV_TYPE (BT_OV_V4SF_V4SF_UCHAR, BT_V4SF, BT_V4SF, BT_UCHAR) @@ -737,6 +746,7 @@ DEF_OV_TYPE (BT_OV_V4SI_INTCONSTPTR_UINT, BT_V4SI, BT_INTCONSTPTR, BT_UINT) DEF_OV_TYPE (BT_OV_V4SI_INTCONSTPTR_USHORT, BT_V4SI, BT_INTCONSTPTR, BT_USHORT) DEF_OV_TYPE (BT_OV_V4SI_INT_INT, BT_V4SI, BT_INT, BT_INT) DEF_OV_TYPE (BT_OV_V4SI_INT_V4SI_INT, BT_V4SI, BT_INT, BT_V4SI, BT_INT) +DEF_OV_TYPE (BT_OV_V4SI_LONG_INTCONSTPTR, BT_V4SI, BT_LONG, BT_INTCONSTPTR) DEF_OV_TYPE (BT_OV_V4SI_LONG_INTPTR, BT_V4SI, BT_LONG, BT_INTPTR) DEF_OV_TYPE (BT_OV_V4SI_UV4SI_V4SI_V4SI, BT_V4SI, BT_UV4SI, BT_V4SI, BT_V4SI) DEF_OV_TYPE (BT_OV_V4SI_V2DI_V2DI, BT_V4SI, BT_V2DI, BT_V2DI) @@ -764,6 +774,7 @@ DEF_OV_TYPE (BT_OV_V4SI_V8HI, BT_V4SI, BT_V8HI) DEF_OV_TYPE (BT_OV_V4SI_V8HI_V8HI, BT_V4SI, BT_V8HI, BT_V8HI) DEF_OV_TYPE (BT_OV_V4SI_V8HI_V8HI_V4SI, BT_V4SI, BT_V8HI, BT_V8HI, BT_V4SI) DEF_OV_TYPE (BT_OV_V8HI_BV8HI_V8HI, BT_V8HI, BT_BV8HI, BT_V8HI) +DEF_OV_TYPE (BT_OV_V8HI_LONG_SHORTCONSTPTR, BT_V8HI, BT_LONG, BT_SHORTCONSTPTR) DEF_OV_TYPE (BT_OV_V8HI_LONG_SHORTPTR, BT_V8HI, BT_LONG, BT_SHORTPTR) DEF_OV_TYPE (BT_OV_V8HI_SHORT, BT_V8HI, BT_SHORT) DEF_OV_TYPE (BT_OV_V8HI_SHORTCONSTPTR, BT_V8HI, BT_SHORTCONSTPTR) @@ -802,6 +813,7 @@ DEF_OV_TYPE (BT_OV_VOID_UV16QI_UCHARPTR_UINT, BT_VOID, BT_UV16QI, BT_UCHARPTR, B DEF_OV_TYPE (BT_OV_VOID_UV2DI_LONG_ULONGLONGPTR, BT_VOID, BT_UV2DI, BT_LONG, BT_ULONGLONGPTR) DEF_OV_TYPE (BT_OV_VOID_UV2DI_ULONGLONGPTR_UINT, BT_VOID, BT_UV2DI, BT_ULONGLONGPTR, BT_UINT) DEF_OV_TYPE (BT_OV_VOID_UV2DI_UV2DI_ULONGLONGPTR_ULONGLONG, BT_VOID, BT_UV2DI, BT_UV2DI, BT_ULONGLONGPTR, BT_ULONGLONG) +DEF_OV_TYPE (BT_OV_VOID_UV4SI_LONG_FLTPTR, BT_VOID, BT_UV4SI, BT_LONG, BT_FLTPTR) DEF_OV_TYPE (BT_OV_VOID_UV4SI_LONG_UINTPTR, BT_VOID, BT_UV4SI, BT_LONG, BT_UINTPTR) DEF_OV_TYPE (BT_OV_VOID_UV4SI_UINTPTR_UINT, BT_VOID, BT_UV4SI, BT_UINTPTR, BT_UINT) DEF_OV_TYPE (BT_OV_VOID_UV4SI_UV4SI_UINTPTR_ULONGLONG, BT_VOID, BT_UV4SI, BT_UV4SI, BT_UINTPTR, BT_ULONGLONG) diff --git a/gcc/config/s390/s390-builtins.def b/gcc/config/s390/s390-builtins.def index 0fbe838cbf9..365e794316a 100644 --- a/gcc/config/s390/s390-builtins.def +++ b/gcc/config/s390/s390-builtins.def @@ -328,36 +328,38 @@ B_DEF (s390_vgmh, vec_genmaskv8hi, 0, B_DEF (s390_vgmf, vec_genmaskv4si, 0, B_VX, O1_U8 | O2_U8, BT_FN_UV4SI_UCHAR_UCHAR) B_DEF (s390_vgmg, vec_genmaskv2di, 0, B_VX, O1_U8 | O2_U8, BT_FN_UV2DI_UCHAR_UCHAR) -OB_DEF (s390_vec_xl, s390_vec_xl_s8, s390_vec_xl_dbl, B_VX, BT_FN_V4SI_INT_VOIDPTR) -OB_DEF_VAR (s390_vec_xl_s8, MAX, 0, O1_LIT, BT_OV_V16QI_LONG_SCHARPTR) /* vl */ -OB_DEF_VAR (s390_vec_xl_u8, MAX, 0, O1_LIT, BT_OV_UV16QI_LONG_UCHARPTR) /* vl */ -OB_DEF_VAR (s390_vec_xl_s16, MAX, 0, O1_LIT, BT_OV_V8HI_LONG_SHORTPTR) /* vl */ -OB_DEF_VAR (s390_vec_xl_u16, MAX, 0, O1_LIT, BT_OV_UV8HI_LONG_USHORTPTR) /* vl */ -OB_DEF_VAR (s390_vec_xl_s32, MAX, 0, O1_LIT, BT_OV_V4SI_LONG_INTPTR) /* vl */ -OB_DEF_VAR (s390_vec_xl_u32, MAX, 0, O1_LIT, BT_OV_UV4SI_LONG_UINTPTR) /* vl */ -OB_DEF_VAR (s390_vec_xl_s64, MAX, 0, O1_LIT, BT_OV_V2DI_LONG_LONGLONGPTR) /* vl */ -OB_DEF_VAR (s390_vec_xl_u64, MAX, 0, O1_LIT, BT_OV_UV2DI_LONG_ULONGLONGPTR) /* vl */ -OB_DEF_VAR (s390_vec_xl_flt, MAX, 0, O1_LIT, BT_OV_V4SF_LONG_FLTPTR) /* vl */ -OB_DEF_VAR (s390_vec_xl_dbl, MAX, 0, O1_LIT, BT_OV_V2DF_LONG_DBLPTR) /* vl */ - -OB_DEF (s390_vec_xld2, s390_vec_xld2_s8, s390_vec_xld2_dbl, B_DEP | B_VX, BT_FN_V4SI_INT_VOIDPTR) -OB_DEF_VAR (s390_vec_xld2_s8, MAX, 0, O1_LIT, BT_OV_V16QI_LONG_SCHARPTR) /* vl */ -OB_DEF_VAR (s390_vec_xld2_u8, MAX, 0, O1_LIT, BT_OV_UV16QI_LONG_UCHARPTR) /* vl */ -OB_DEF_VAR (s390_vec_xld2_s16, MAX, 0, O1_LIT, BT_OV_V8HI_LONG_SHORTPTR) /* vl */ -OB_DEF_VAR (s390_vec_xld2_u16, MAX, 0, O1_LIT, BT_OV_UV8HI_LONG_USHORTPTR) /* vl */ -OB_DEF_VAR (s390_vec_xld2_s32, MAX, 0, O1_LIT, BT_OV_V4SI_LONG_INTPTR) /* vl */ -OB_DEF_VAR (s390_vec_xld2_u32, MAX, 0, O1_LIT, BT_OV_UV4SI_LONG_UINTPTR) /* vl */ -OB_DEF_VAR (s390_vec_xld2_s64, MAX, 0, O1_LIT, BT_OV_V2DI_LONG_LONGLONGPTR) /* vl */ -OB_DEF_VAR (s390_vec_xld2_u64, MAX, 0, O1_LIT, BT_OV_UV2DI_LONG_ULONGLONGPTR) /* vl */ -OB_DEF_VAR (s390_vec_xld2_dbl, MAX, 0, O1_LIT, BT_OV_V2DF_LONG_DBLPTR) /* vl */ - -OB_DEF (s390_vec_xlw4, s390_vec_xlw4_s8, s390_vec_xlw4_u32, B_DEP | B_VX, BT_FN_V4SI_INT_VOIDPTR) -OB_DEF_VAR (s390_vec_xlw4_s8, MAX, 0, O1_LIT, BT_OV_V16QI_LONG_SCHARPTR) /* vl */ -OB_DEF_VAR (s390_vec_xlw4_u8, MAX, 0, O1_LIT, BT_OV_UV16QI_LONG_UCHARPTR) /* vl */ -OB_DEF_VAR (s390_vec_xlw4_s16, MAX, 0, O1_LIT, BT_OV_V8HI_LONG_SHORTPTR) /* vl */ -OB_DEF_VAR (s390_vec_xlw4_u16, MAX, 0, O1_LIT, BT_OV_UV8HI_LONG_USHORTPTR) /* vl */ -OB_DEF_VAR (s390_vec_xlw4_s32, MAX, 0, O1_LIT, BT_OV_V4SI_LONG_INTPTR) /* vl */ -OB_DEF_VAR (s390_vec_xlw4_u32, MAX, 0, O1_LIT, BT_OV_UV4SI_LONG_UINTPTR) /* vl */ +OB_DEF (s390_vec_xl, s390_vec_xl_s8, s390_vec_xl_dbl, B_VX, BT_FN_V4SI_INT_VOIDCONSTPTR) +OB_DEF_VAR (s390_vec_xl_s8, MAX, 0, O1_LIT, BT_OV_V16QI_LONG_SCHARCONSTPTR) /* vl */ +OB_DEF_VAR (s390_vec_xl_u8, MAX, 0, O1_LIT, BT_OV_UV16QI_LONG_UCHARCONSTPTR) /* vl */ +OB_DEF_VAR (s390_vec_xl_s16, MAX, 0, O1_LIT, BT_OV_V8HI_LONG_SHORTCONSTPTR) /* vl */ +OB_DEF_VAR (s390_vec_xl_u16, MAX, 0, O1_LIT, BT_OV_UV8HI_LONG_USHORTCONSTPTR) /* vl */ +OB_DEF_VAR (s390_vec_xl_s32, MAX, 0, O1_LIT, BT_OV_V4SI_LONG_INTCONSTPTR) /* vl */ +OB_DEF_VAR (s390_vec_xl_u32, MAX, 0, O1_LIT, BT_OV_UV4SI_LONG_UINTCONSTPTR) /* vl */ +OB_DEF_VAR (s390_vec_xl_s64, MAX, 0, O1_LIT, BT_OV_V2DI_LONG_LONGLONGCONSTPTR) /* vl */ +OB_DEF_VAR (s390_vec_xl_u64, MAX, 0, O1_LIT, BT_OV_UV2DI_LONG_ULONGLONGCONSTPTR) /* vl */ +OB_DEF_VAR (s390_vec_xl_flt, MAX, 0, O1_LIT, BT_OV_V4SF_LONG_FLTCONSTPTR) /* vl */ +OB_DEF_VAR (s390_vec_xl_dbl, MAX, 0, O1_LIT, BT_OV_V2DF_LONG_DBLCONSTPTR) /* vl */ + +OB_DEF (s390_vec_xld2, s390_vec_xld2_s8, s390_vec_xld2_dbl, B_DEP | B_VX, BT_FN_V4SI_INT_VOIDCONSTPTR) +OB_DEF_VAR (s390_vec_xld2_s8, MAX, 0, O1_LIT, BT_OV_V16QI_LONG_SCHARCONSTPTR) /* vl */ +OB_DEF_VAR (s390_vec_xld2_u8, MAX, 0, O1_LIT, BT_OV_UV16QI_LONG_UCHARCONSTPTR) /* vl */ +OB_DEF_VAR (s390_vec_xld2_s16, MAX, 0, O1_LIT, BT_OV_V8HI_LONG_SHORTCONSTPTR) /* vl */ +OB_DEF_VAR (s390_vec_xld2_u16, MAX, 0, O1_LIT, BT_OV_UV8HI_LONG_USHORTCONSTPTR) /* vl */ +OB_DEF_VAR (s390_vec_xld2_s32, MAX, 0, O1_LIT, BT_OV_V4SI_LONG_INTCONSTPTR) /* vl */ +OB_DEF_VAR (s390_vec_xld2_u32, MAX, 0, O1_LIT, BT_OV_UV4SI_LONG_UINTCONSTPTR) /* vl */ +OB_DEF_VAR (s390_vec_xld2_s64, MAX, 0, O1_LIT, BT_OV_V2DI_LONG_LONGLONGCONSTPTR) /* vl */ +OB_DEF_VAR (s390_vec_xld2_u64, MAX, 0, O1_LIT, BT_OV_UV2DI_LONG_ULONGLONGCONSTPTR) /* vl */ +OB_DEF_VAR (s390_vec_xld2_flt, MAX, B_VXE, O1_LIT, BT_OV_V4SF_LONG_FLTCONSTPTR) /* vl */ +OB_DEF_VAR (s390_vec_xld2_dbl, MAX, 0, O1_LIT, BT_OV_V2DF_LONG_DBLCONSTPTR) /* vl */ + +OB_DEF (s390_vec_xlw4, s390_vec_xlw4_s8, s390_vec_xlw4_flt, B_DEP | B_VX, BT_FN_V4SI_INT_VOIDCONSTPTR) +OB_DEF_VAR (s390_vec_xlw4_s8, MAX, 0, O1_LIT, BT_OV_V16QI_LONG_SCHARCONSTPTR) /* vl */ +OB_DEF_VAR (s390_vec_xlw4_u8, MAX, 0, O1_LIT, BT_OV_UV16QI_LONG_UCHARCONSTPTR) /* vl */ +OB_DEF_VAR (s390_vec_xlw4_s16, MAX, 0, O1_LIT, BT_OV_V8HI_LONG_SHORTCONSTPTR) /* vl */ +OB_DEF_VAR (s390_vec_xlw4_u16, MAX, 0, O1_LIT, BT_OV_UV8HI_LONG_USHORTCONSTPTR) /* vl */ +OB_DEF_VAR (s390_vec_xlw4_s32, MAX, 0, O1_LIT, BT_OV_V4SI_LONG_INTCONSTPTR) /* vl */ +OB_DEF_VAR (s390_vec_xlw4_u32, MAX, 0, O1_LIT, BT_OV_UV4SI_LONG_UINTCONSTPTR) /* vl */ +OB_DEF_VAR (s390_vec_xlw4_flt, MAX, B_VXE, O1_LIT, BT_OV_V4SF_LONG_FLTCONSTPTR) /* vl */ OB_DEF (s390_vec_splats, s390_vec_splats_s8, s390_vec_splats_dbl,B_VX, BT_FN_OV4SI_INT) OB_DEF_VAR (s390_vec_splats_s8, s390_vlrepb, 0, 0, BT_OV_V16QI_SCHAR) @@ -746,13 +748,14 @@ OB_DEF_VAR (s390_vec_xstd2_s64, MAX, 0, OB_DEF_VAR (s390_vec_xstd2_u64, MAX, 0, O2_LIT, BT_OV_VOID_UV2DI_LONG_ULONGLONGPTR) /* vst */ OB_DEF_VAR (s390_vec_xstd2_dbl, MAX, 0, O2_LIT, BT_OV_VOID_V2DF_LONG_DBLPTR) /* vst */ -OB_DEF (s390_vec_xstw4, s390_vec_xstw4_s8, s390_vec_xstw4_u32, B_DEP | B_VX, BT_FN_VOID_OV4SI_INT_VOIDPTR) +OB_DEF (s390_vec_xstw4, s390_vec_xstw4_s8, s390_vec_xstw4_flt, B_DEP | B_VX, BT_FN_VOID_OV4SI_INT_VOIDPTR) OB_DEF_VAR (s390_vec_xstw4_s8, MAX, 0, O2_LIT, BT_OV_VOID_V16QI_LONG_SCHARPTR) /* vst */ OB_DEF_VAR (s390_vec_xstw4_u8, MAX, 0, O2_LIT, BT_OV_VOID_UV16QI_LONG_UCHARPTR) /* vst */ OB_DEF_VAR (s390_vec_xstw4_s16, MAX, 0, O2_LIT, BT_OV_VOID_V8HI_LONG_SHORTPTR) /* vst */ OB_DEF_VAR (s390_vec_xstw4_u16, MAX, 0, O2_LIT, BT_OV_VOID_UV8HI_LONG_USHORTPTR) /* vst */ OB_DEF_VAR (s390_vec_xstw4_s32, MAX, 0, O2_LIT, BT_OV_VOID_V4SI_LONG_INTPTR) /* vst */ OB_DEF_VAR (s390_vec_xstw4_u32, MAX, 0, O2_LIT, BT_OV_VOID_UV4SI_LONG_UINTPTR) /* vst */ +OB_DEF_VAR (s390_vec_xstw4_flt, MAX, B_VXE, O2_LIT, BT_OV_VOID_V4SF_LONG_FLTPTR) /* vst */ OB_DEF (s390_vec_store_len, s390_vec_store_len_s8,s390_vec_store_len_dbl,B_VX, BT_FN_VOID_OV4SI_VOIDPTR_UINT) OB_DEF_VAR (s390_vec_store_len_s8, s390_vstl, 0, 0, BT_OV_VOID_V16QI_SCHARPTR_UINT) diff --git a/gcc/config/s390/s390-c.c b/gcc/config/s390/s390-c.c index 4a72d499cee..8fb46b03af3 100644 --- a/gcc/config/s390/s390-c.c +++ b/gcc/config/s390/s390-c.c @@ -477,16 +477,30 @@ s390_expand_overloaded_builtin (location_t loc, case S390_OVERLOADED_BUILTIN_s390_vec_xl: case S390_OVERLOADED_BUILTIN_s390_vec_xld2: case S390_OVERLOADED_BUILTIN_s390_vec_xlw4: - return build2 (MEM_REF, return_type, - fold_build_pointer_plus ((*arglist)[1], (*arglist)[0]), - build_int_cst (TREE_TYPE ((*arglist)[1]), 0)); + { + /* Build a vector type with the alignment of the source + location in order to enable correct alignment hints to be + generated for vl. */ + tree mem_type = build_aligned_type (return_type, + TYPE_ALIGN (TREE_TYPE (TREE_TYPE ((*arglist)[1])))); + return build2 (MEM_REF, mem_type, + fold_build_pointer_plus ((*arglist)[1], (*arglist)[0]), + build_int_cst (TREE_TYPE ((*arglist)[1]), 0)); + } case S390_OVERLOADED_BUILTIN_s390_vec_xst: case S390_OVERLOADED_BUILTIN_s390_vec_xstd2: case S390_OVERLOADED_BUILTIN_s390_vec_xstw4: - return build2 (MODIFY_EXPR, TREE_TYPE((*arglist)[0]), - build1 (INDIRECT_REF, TREE_TYPE((*arglist)[0]), - fold_build_pointer_plus ((*arglist)[2], (*arglist)[1])), - (*arglist)[0]); + { + /* Build a vector type with the alignment of the target + location in order to enable correct alignment hints to be + generated for vst. */ + tree mem_type = build_aligned_type (TREE_TYPE((*arglist)[0]), + TYPE_ALIGN (TREE_TYPE (TREE_TYPE ((*arglist)[2])))); + return build2 (MODIFY_EXPR, mem_type, + build1 (INDIRECT_REF, mem_type, + fold_build_pointer_plus ((*arglist)[2], (*arglist)[1])), + (*arglist)[0]); + } case S390_OVERLOADED_BUILTIN_s390_vec_load_pair: return build_constructor_va (return_type, 2, NULL_TREE, (*arglist)[0], diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 52711b38a2f..a0cacfa7289 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2019-03-13 Andreas Krebbel + + Backport from mainline + 2019-02-07 Andreas Krebbel + + * gcc.target/s390/zvector/xl-xst-align-1.c: New test. + * gcc.target/s390/zvector/xl-xst-align-2.c: New test. + 2019-03-12 Richard Biener PR tree-optimization/89664 diff --git a/gcc/testsuite/gcc.target/s390/zvector/xl-xst-align-1.c b/gcc/testsuite/gcc.target/s390/zvector/xl-xst-align-1.c new file mode 100644 index 00000000000..bf9cc2824e7 --- /dev/null +++ b/gcc/testsuite/gcc.target/s390/zvector/xl-xst-align-1.c @@ -0,0 +1,45 @@ +/* { dg-do compile { target { s390*-*-* } } } */ +/* { dg-options "-O3 -mzarch -march=z14 -mzvector" } */ + +#include + +vector float +foo (float *a) +{ + return vec_xl (0, a); +} + +vector float +bar (const float *a) +{ + return vec_xl (0, a); +} + +void +baz (float *f, vector float a) +{ + vec_xst (a, 0, f); +} + +vector float +foo2 (float *a) +{ + return vec_xlw4 (0, a); +} + +vector float +bar2 (const float *a) +{ + return vec_xlw4 (0, a); +} + +void +baz2 (float *f, vector float a) +{ + vec_xstw4 (a, 0, f); +} + +/* Make sure no alignment hints are generated. */ + +/* { dg-final { scan-assembler-not "vl.*,3" } } */ +/* { dg-final { scan-assembler-not "vst.*,3" } } */ diff --git a/gcc/testsuite/gcc.target/s390/zvector/xl-xst-align-2.c b/gcc/testsuite/gcc.target/s390/zvector/xl-xst-align-2.c new file mode 100644 index 00000000000..fe69fd8a680 --- /dev/null +++ b/gcc/testsuite/gcc.target/s390/zvector/xl-xst-align-2.c @@ -0,0 +1,48 @@ +/* { dg-do compile { target { s390*-*-* } } } */ +/* { dg-options "-O3 -mzarch -march=z14 -mzvector" } */ + +#include + +typedef float __attribute__((aligned(8))) float_aligned; + +vector float +foo (float_aligned *a) +{ + return vec_xl (0, a); +} + +vector float +bar (const float_aligned *a) +{ + return vec_xl (0, a); +} + +void +baz (float_aligned *f, vector float a) +{ + vec_xst (a, 0, f); +} + +vector float +foo2 (float_aligned *a) +{ + return vec_xlw4 (0, a); +} + +vector float +bar2 (const float_aligned *a) +{ + return vec_xlw4 (0, a); +} + +void +baz2 (float_aligned *f, vector float a) +{ + vec_xstw4 (a, 0, f); +} + +/* Make sure alignment hints are generated if the source or target + operand is properly aligned. */ + +/* { dg-final { scan-assembler-times "vl\t%v\[0-9\]*,0\\(%r2\\),3" 4 } } */ +/* { dg-final { scan-assembler-times "vst\t%v\[0-9\]*,0\\(%r2\\),3" 2 } } */ -- cgit v1.2.3 From 11430931832fc25d971436335e4390ecbf8abac9 Mon Sep 17 00:00:00 2001 From: Andreas Krebbel Date: Wed, 13 Mar 2019 09:51:38 +0000 Subject: S/390: Fix immediate vector operands for some builtins. This fixes a problem with vec_add/sub_u128 builtins. The s390_expand_builtin backend function is supposed to convert the operand to TImode *AND* load it into a vector register. The current implementation did only the conversion and gave up then. gcc/ChangeLog: 2019-03-13 Andreas Krebbel Backport from mainline 2019-03-11 Andreas Krebbel * config/s390/s390.c (s390_expand_builtin): Do the copy_to_reg not only on the else branch. gcc/testsuite/ChangeLog: 2019-03-13 Andreas Krebbel Backport from mainline 2019-03-11 Andreas Krebbel * gcc.target/s390/zvector/vec-addc-u128.c: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@269643 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 8 ++++++++ gcc/config/s390/s390.c | 14 ++++++++++---- gcc/testsuite/ChangeLog | 7 +++++++ gcc/testsuite/gcc.target/s390/zvector/vec-addc-u128.c | 10 ++++++++++ 4 files changed, 35 insertions(+), 4 deletions(-) create mode 100644 gcc/testsuite/gcc.target/s390/zvector/vec-addc-u128.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index fefba6f1345..e97bd4a2327 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2019-03-13 Andreas Krebbel + + Backport from mainline + 2019-03-11 Andreas Krebbel + + * config/s390/s390.c (s390_expand_builtin): Do the copy_to_reg not + only on the else branch. + 2019-03-13 Andreas Krebbel Backport from mainline diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c index 8921f6d82f5..f2b6676cd0f 100644 --- a/gcc/config/s390/s390.c +++ b/gcc/config/s390/s390.c @@ -937,6 +937,8 @@ s390_expand_builtin (tree exp, rtx target, rtx subtarget ATTRIBUTE_UNUSED, continue; } + /* A memory operand is rejected by the memory_operand predicate. + Try making the address legal by copying it into a register. */ if (MEM_P (op[arity]) && insn_op->predicate == memory_operand && (GET_MODE (XEXP (op[arity], 0)) == Pmode @@ -960,10 +962,14 @@ s390_expand_builtin (tree exp, rtx target, rtx subtarget ATTRIBUTE_UNUSED, { op[arity] = tmp_rtx; } - else if (GET_MODE (op[arity]) == insn_op->mode - || GET_MODE (op[arity]) == VOIDmode - || (insn_op->predicate == address_operand - && GET_MODE (op[arity]) == Pmode)) + + /* The predicate rejects the operand although the mode is fine. + Copy the operand to register. */ + if (!insn_op->predicate (op[arity], insn_op->mode) + && (GET_MODE (op[arity]) == insn_op->mode + || GET_MODE (op[arity]) == VOIDmode + || (insn_op->predicate == address_operand + && GET_MODE (op[arity]) == Pmode))) { /* An address_operand usually has VOIDmode in the expander so we cannot use this. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index a0cacfa7289..51a1713741f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2019-03-13 Andreas Krebbel + + Backport from mainline + 2019-03-11 Andreas Krebbel + + * gcc.target/s390/zvector/vec-addc-u128.c: New test. + 2019-03-13 Andreas Krebbel Backport from mainline diff --git a/gcc/testsuite/gcc.target/s390/zvector/vec-addc-u128.c b/gcc/testsuite/gcc.target/s390/zvector/vec-addc-u128.c new file mode 100644 index 00000000000..3ab0c71e3b2 --- /dev/null +++ b/gcc/testsuite/gcc.target/s390/zvector/vec-addc-u128.c @@ -0,0 +1,10 @@ +/* { dg-do compile { target { s390*-*-* } } } */ +/* { dg-options "-O3 -mzarch -march=z13 -mzvector -fno-asynchronous-unwind-tables" } */ + +#include + +vector unsigned char test(void) +{ + vector unsigned char a = { 0 }; + return __builtin_s390_vec_addc_u128 (a, a); +} -- cgit v1.2.3 From f31db5cc1aa1a99e91056a7a1a060083d046c829 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Wed, 13 Mar 2019 14:08:07 +0000 Subject: 2019-03-14 Richard Biener Backport from mainline 2019-03-13 Richard Biener PR middle-end/89677 * tree-scalar-evolution.c (simplify_peeled_chrec): Do not throw FP expressions at tree-affine. * gcc.dg/torture/pr89677.c: New testcase. 2019-03-01 Richard Biener PR middle-end/89497 * tree-cfgcleanup.h (cleanup_tree_cfg): Add SSA update flags argument, defaulted to zero. * passes.c (execute_function_todo): Pass down SSA update flags to cleanup_tree_cfg. * tree-cfgcleanup.c: Include tree-into-ssa.h and tree-cfgcleanup.h. (cleanup_tree_cfg_1): After cleanup_control_flow_pre update SSA form if requested. (cleanup_tree_cfg_noloop): Pass down SSA update flags. (cleanup_tree_cfg): Get and pass down SSA update flags. * gcc.dg/tree-ssa/reassoc-43.c: Avoid false match in regex. * g++.dg/tree-prof/devirt.C: Scan tracer dump for foldings that happen now earlier. 2019-02-18 Richard Biener PR tree-optimization/89296 * tree-ssa-loop-ch.c (ch_base::copy_headers): Restrict setting of no-warning flag to cases that might emit the bogus warning. * gcc.dg/uninit-pr89296.c: New testcase. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@269650 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 28 ++++++++++++++++++++++++++++ gcc/passes.c | 2 +- gcc/testsuite/ChangeLog | 21 +++++++++++++++++++++ gcc/testsuite/g++.dg/tree-prof/devirt.C | 8 ++++---- gcc/testsuite/gcc.dg/torture/pr89677.c | 15 +++++++++++++++ gcc/testsuite/gcc.dg/tree-ssa/reassoc-43.c | 2 +- gcc/testsuite/gcc.dg/uninit-pr89296.c | 13 +++++++++++++ gcc/tree-cfgcleanup.c | 14 +++++++++----- gcc/tree-cfgcleanup.h | 2 +- gcc/tree-scalar-evolution.c | 5 +++++ gcc/tree-ssa-loop-ch.c | 16 ++++++++++++++-- 11 files changed, 112 insertions(+), 14 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/torture/pr89677.c create mode 100644 gcc/testsuite/gcc.dg/uninit-pr89296.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e97bd4a2327..ce29caf81e4 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,31 @@ +2019-03-14 Richard Biener + + Backport from mainline + 2019-03-13 Richard Biener + + PR middle-end/89677 + * tree-scalar-evolution.c (simplify_peeled_chrec): Do not + throw FP expressions at tree-affine. + + 2019-03-01 Richard Biener + + PR middle-end/89497 + * tree-cfgcleanup.h (cleanup_tree_cfg): Add SSA update flags + argument, defaulted to zero. + * passes.c (execute_function_todo): Pass down SSA update flags + to cleanup_tree_cfg. + * tree-cfgcleanup.c: Include tree-into-ssa.h and tree-cfgcleanup.h. + (cleanup_tree_cfg_1): After cleanup_control_flow_pre update SSA + form if requested. + (cleanup_tree_cfg_noloop): Pass down SSA update flags. + (cleanup_tree_cfg): Get and pass down SSA update flags. + + 2019-02-18 Richard Biener + + PR tree-optimization/89296 + * tree-ssa-loop-ch.c (ch_base::copy_headers): Restrict setting + of no-warning flag to cases that might emit the bogus warning. + 2019-03-13 Andreas Krebbel Backport from mainline diff --git a/gcc/passes.c b/gcc/passes.c index 65ad690f6d9..a6c118543e6 100644 --- a/gcc/passes.c +++ b/gcc/passes.c @@ -1944,7 +1944,7 @@ execute_function_todo (function *fn, void *data) /* Always cleanup the CFG before trying to update SSA. */ if (flags & TODO_cleanup_cfg) { - cleanup_tree_cfg (); + cleanup_tree_cfg (flags & TODO_update_ssa_any); /* When cleanup_tree_cfg merges consecutive blocks, it may perform some simplistic propagation when removing single diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 51a1713741f..eeacad549d0 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,24 @@ +2019-03-14 Richard Biener + + Backport from mainline + 2019-03-13 Richard Biener + + PR middle-end/89677 + * gcc.dg/torture/pr89677.c: New testcase. + + 2019-03-01 Richard Biener + + PR middle-end/89497 + * gcc.dg/tree-ssa/reassoc-43.c: Avoid false match in regex. + * g++.dg/tree-prof/devirt.C: Scan tracer dump for foldings + that happen now earlier. + + 2019-02-18 Richard Biener + + PR tree-optimization/89296 + * tree-ssa-loop-ch.c (ch_base::copy_headers): Restrict setting + of no-warning flag to cases that might emit the bogus warning. + 2019-03-13 Andreas Krebbel Backport from mainline diff --git a/gcc/testsuite/g++.dg/tree-prof/devirt.C b/gcc/testsuite/g++.dg/tree-prof/devirt.C index 3de5dbcf688..d8fb2d9ef46 100644 --- a/gcc/testsuite/g++.dg/tree-prof/devirt.C +++ b/gcc/testsuite/g++.dg/tree-prof/devirt.C @@ -1,5 +1,5 @@ /* PR ipa/88561 */ -/* { dg-options "-O3 -fdump-tree-dom3-details" } */ +/* { dg-options "-O3 -fdump-tree-tracer-details -fdump-tree-dom3-details" } */ struct nsISupports { @@ -121,6 +121,6 @@ main () __builtin_abort (); } -/* { dg-final-use-not-autofdo { scan-tree-dump-times "folding virtual function call to virtual unsigned int mozPersonalDictionary::_ZThn16" 1 "dom3" { target { lp64 || llp64 } } } } */ -/* { dg-final-use-not-autofdo { scan-tree-dump-times "folding virtual function call to virtual unsigned int mozPersonalDictionary::_ZThn8" 1 "dom3" { target ilp32 } } } */ -/* { dg-final-use-not-autofdo { scan-tree-dump-times "folding virtual function call to virtual unsigned int mozPersonalDictionary::AddRef" 1 "dom3" } } */ +/* { dg-final-use-not-autofdo { scan-tree-dump-times "folding virtual function call to virtual unsigned int mozPersonalDictionary::_ZThn16" 1 "tracer" { target { lp64 || llp64 } } } } */ +/* { dg-final-use-not-autofdo { scan-tree-dump-times "folding virtual function call to virtual unsigned int mozPersonalDictionary::_ZThn8" 1 "tracer" { target ilp32 } } } */ +/* { dg-final-use-not-autofdo { scan-tree-dump-times "folding virtual function call to virtual unsigned int mozPersonalDictionary::AddRef" 1 "tracer" } } */ diff --git a/gcc/testsuite/gcc.dg/torture/pr89677.c b/gcc/testsuite/gcc.dg/torture/pr89677.c new file mode 100644 index 00000000000..a45ca1f61a1 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr89677.c @@ -0,0 +1,15 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target int32plus } */ + +int a, b, d; +unsigned c; +float e, f, g; +void h() { + float *i = &g; + for (; c < 10; c += 3) + for (; d; d += 3) { + a = *i; + g = f + 0; + f = b + *i + (b - e + 305219) + -b + 3; + } +} diff --git a/gcc/testsuite/gcc.dg/tree-ssa/reassoc-43.c b/gcc/testsuite/gcc.dg/tree-ssa/reassoc-43.c index ea44f300f94..90e1e86b3cb 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/reassoc-43.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/reassoc-43.c @@ -50,4 +50,4 @@ c_parser_translation_unit (c_parser * parser) } } } -/* { dg-final { scan-tree-dump-not "0 != 0" "reassoc2"} } */ +/* { dg-final { scan-tree-dump-not "\[ (\]0 != 0" "reassoc2"} } */ diff --git a/gcc/testsuite/gcc.dg/uninit-pr89296.c b/gcc/testsuite/gcc.dg/uninit-pr89296.c new file mode 100644 index 00000000000..9d81b32b979 --- /dev/null +++ b/gcc/testsuite/gcc.dg/uninit-pr89296.c @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -Wuninitialized" } */ + +int get_a_value (); +void printk(const char *); +void test_func() +{ + int loop; + while (!loop) { /* { dg-warning "is used uninitialized" } */ + loop = get_a_value(); + printk("..."); + } +} diff --git a/gcc/tree-cfgcleanup.c b/gcc/tree-cfgcleanup.c index c261e71d43b..6d57329d4eb 100644 --- a/gcc/tree-cfgcleanup.c +++ b/gcc/tree-cfgcleanup.c @@ -43,6 +43,8 @@ along with GCC; see the file COPYING3. If not see #include "gimple-match.h" #include "gimple-fold.h" #include "tree-ssa-loop-niter.h" +#include "tree-into-ssa.h" +#include "tree-cfgcleanup.h" /* The set of blocks in that at least one of the following changes happened: @@ -761,7 +763,7 @@ cleanup_control_flow_pre () /* Iterate the cfg cleanups, while anything changes. */ static bool -cleanup_tree_cfg_1 (void) +cleanup_tree_cfg_1 (unsigned ssa_update_flags) { bool retval = false; basic_block bb; @@ -786,6 +788,8 @@ cleanup_tree_cfg_1 (void) /* After doing the above SSA form should be valid (or an update SSA should be required). */ + if (ssa_update_flags) + update_ssa (ssa_update_flags); /* Continue by iterating over all basic blocks looking for BB merging opportunities. */ @@ -828,7 +832,7 @@ mfb_keep_latches (edge e) Return true if the flowgraph was modified, false otherwise. */ static bool -cleanup_tree_cfg_noloop (void) +cleanup_tree_cfg_noloop (unsigned ssa_update_flags) { bool changed; @@ -908,7 +912,7 @@ cleanup_tree_cfg_noloop (void) } } - changed |= cleanup_tree_cfg_1 (); + changed |= cleanup_tree_cfg_1 (ssa_update_flags); gcc_assert (dom_info_available_p (CDI_DOMINATORS)); @@ -966,9 +970,9 @@ repair_loop_structures (void) /* Cleanup cfg and repair loop structures. */ bool -cleanup_tree_cfg (void) +cleanup_tree_cfg (unsigned ssa_update_flags) { - bool changed = cleanup_tree_cfg_noloop (); + bool changed = cleanup_tree_cfg_noloop (ssa_update_flags); if (current_loops != NULL && loops_state_satisfies_p (LOOPS_NEED_FIXUP)) diff --git a/gcc/tree-cfgcleanup.h b/gcc/tree-cfgcleanup.h index 0b33d875365..7b6dbc1ee79 100644 --- a/gcc/tree-cfgcleanup.h +++ b/gcc/tree-cfgcleanup.h @@ -22,7 +22,7 @@ along with GCC; see the file COPYING3. If not see /* In tree-cfgcleanup.c */ extern bitmap cfgcleanup_altered_bbs; -extern bool cleanup_tree_cfg (void); +extern bool cleanup_tree_cfg (unsigned = 0); extern bool fixup_noreturn_call (gimple *stmt); #endif /* GCC_TREE_CFGCLEANUP_H */ diff --git a/gcc/tree-scalar-evolution.c b/gcc/tree-scalar-evolution.c index fefc9de96af..c955352018a 100644 --- a/gcc/tree-scalar-evolution.c +++ b/gcc/tree-scalar-evolution.c @@ -1421,6 +1421,11 @@ simplify_peeled_chrec (struct loop *loop, tree arg, tree init_cond) return build_polynomial_chrec (loop->num, init_cond, right); } + /* The affine code only deals with pointer and integer types. */ + if (!POINTER_TYPE_P (type) + && !INTEGRAL_TYPE_P (type)) + return chrec_dont_know; + /* Try harder to check if they are equal. */ tree_to_aff_combination_expand (left, type, &aff1, &peeled_chrec_map); tree_to_aff_combination_expand (step_val, type, &aff2, &peeled_chrec_map); diff --git a/gcc/tree-ssa-loop-ch.c b/gcc/tree-ssa-loop-ch.c index 488999dd8ce..92e0c435e98 100644 --- a/gcc/tree-ssa-loop-ch.c +++ b/gcc/tree-ssa-loop-ch.c @@ -376,11 +376,23 @@ ch_base::copy_headers (function *fun) { gimple *stmt = gsi_stmt (bsi); if (gimple_code (stmt) == GIMPLE_COND) - gimple_set_no_warning (stmt, true); + { + tree lhs = gimple_cond_lhs (stmt); + if (gimple_cond_code (stmt) != EQ_EXPR + && gimple_cond_code (stmt) != NE_EXPR + && INTEGRAL_TYPE_P (TREE_TYPE (lhs)) + && TYPE_OVERFLOW_UNDEFINED (TREE_TYPE (lhs))) + gimple_set_no_warning (stmt, true); + } else if (is_gimple_assign (stmt)) { enum tree_code rhs_code = gimple_assign_rhs_code (stmt); - if (TREE_CODE_CLASS (rhs_code) == tcc_comparison) + tree rhs1 = gimple_assign_rhs1 (stmt); + if (TREE_CODE_CLASS (rhs_code) == tcc_comparison + && rhs_code != EQ_EXPR + && rhs_code != NE_EXPR + && INTEGRAL_TYPE_P (TREE_TYPE (rhs1)) + && TYPE_OVERFLOW_UNDEFINED (TREE_TYPE (rhs1))) gimple_set_no_warning (stmt, true); } } -- cgit v1.2.3 From 6832e29ddaa28bb31e650f4eacff8d08a963dee5 Mon Sep 17 00:00:00 2001 From: Vladimir Makarov Date: Wed, 13 Mar 2019 20:44:50 +0000 Subject: 2019-03-13 Vladimir Makarov PR target/85860 * lra-constraints.c (inherit_in_ebb): Update potential_reload_hard_regs along with live_hard_regs. 2019-03-13 Vladimir Makarov PR target/85860 * gcc.target/i386/pr85860.c: New. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@269663 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 6 ++++++ gcc/lra-constraints.c | 1 + gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.target/i386/pr85860.c | 23 +++++++++++++++++++++++ 4 files changed, 35 insertions(+) create mode 100644 gcc/testsuite/gcc.target/i386/pr85860.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ce29caf81e4..c779ed45d92 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2019-03-13 Vladimir Makarov + + PR target/85860 + * lra-constraints.c (inherit_in_ebb): Update + potential_reload_hard_regs along with live_hard_regs. + 2019-03-14 Richard Biener Backport from mainline diff --git a/gcc/lra-constraints.c b/gcc/lra-constraints.c index 5405c4d2adb..e3adf78e57c 100644 --- a/gcc/lra-constraints.c +++ b/gcc/lra-constraints.c @@ -6293,6 +6293,7 @@ inherit_in_ebb (rtx_insn *head, rtx_insn *tail) add_to_hard_reg_set (&s, PSEUDO_REGNO_MODE (dst_regno), reg_renumber[dst_regno]); AND_COMPL_HARD_REG_SET (live_hard_regs, s); + AND_COMPL_HARD_REG_SET (potential_reload_hard_regs, s); } /* We should invalidate potential inheritance or splitting for the current insn usages to the next diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index eeacad549d0..1cb4b8e97fc 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-03-13 Vladimir Makarov + + PR target/85860 + * gcc.target/i386/pr85860.c: New. + 2019-03-14 Richard Biener Backport from mainline diff --git a/gcc/testsuite/gcc.target/i386/pr85860.c b/gcc/testsuite/gcc.target/i386/pr85860.c new file mode 100644 index 00000000000..aef78a4b958 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr85860.c @@ -0,0 +1,23 @@ +/* { dg-do compile { target lp64 } } */ +/* { dg-options "-O2 -fno-guess-branch-probability -flive-range-shrinkage -mbmi2" } */ + +int a, b, c, d, e; + +extern int bar(void); + +__int128 +foo (unsigned g, int h, long i, __int128 j, short k, __int128 l) +{ + unsigned __int128 m = j; + do + { + j %= 5; + c = c >> (m & 31); + e = __builtin_sub_overflow (b, 0, &m); + d = bar (); + l *= __builtin_mul_overflow_p ((unsigned) d, ~(unsigned __int128) 1, + (unsigned __int128) 0); + } + while (a); + return m + j + k + l; +} -- cgit v1.2.3 From 1d852caa09c812b504d704227283fcbff958bd08 Mon Sep 17 00:00:00 2001 From: Thomas Koenig Date: Wed, 13 Mar 2019 22:05:59 +0000 Subject: 2019-03-13 Thomas Koenig PR fortran/87673 Backport from trunk * match.c (gfc_match_type_spec): Remove call to gfc_resolve_expr for character length. 2019-03-13 Thomas Koenig PR fortran/87673 Backport from trunk * gfortran.dg/charlen_17.f90: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@269665 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fortran/ChangeLog | 7 +++++++ gcc/fortran/match.c | 2 -- gcc/testsuite/ChangeLog | 6 ++++++ gcc/testsuite/gfortran.dg/charlen_17.f90 | 14 ++++++++++++++ 4 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gfortran.dg/charlen_17.f90 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 03edb662ff8..3b0b6a25ba0 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,10 @@ +2019-03-13 Thomas Koenig + + PR fortran/87673 + Backport from trunk + * match.c (gfc_match_type_spec): Remove call to + gfc_resolve_expr for character length. + 2019-03-10 Thomas Koenig PR fortran/71544 diff --git a/gcc/fortran/match.c b/gcc/fortran/match.c index 8185e51d5a9..d0a4b53da6b 100644 --- a/gcc/fortran/match.c +++ b/gcc/fortran/match.c @@ -2105,8 +2105,6 @@ gfc_match_type_spec (gfc_typespec *ts) ts->type = BT_CHARACTER; m = gfc_match_char_spec (ts); - if (ts->u.cl && ts->u.cl->length) - gfc_resolve_expr (ts->u.cl->length); if (m == MATCH_NO) m = MATCH_YES; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 1cb4b8e97fc..015e934309a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2019-03-13 Thomas Koenig + + PR fortran/87673 + Backport from trunk + * gfortran.dg/charlen_17.f90: New test. + 2019-03-13 Vladimir Makarov PR target/85860 diff --git a/gcc/testsuite/gfortran.dg/charlen_17.f90 b/gcc/testsuite/gfortran.dg/charlen_17.f90 new file mode 100644 index 00000000000..6b766d8f433 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/charlen_17.f90 @@ -0,0 +1,14 @@ +! { dg-do compile } +! PR 87673 - used to cause errors about non-pure functions. + +module x + implicit none +contains + pure function foo() result(res) + character(len=:), allocatable :: res + allocate (character(bar()) :: res) + end function foo + pure integer function bar() + bar = 1 + end function bar +end module x -- cgit v1.2.3 From ea1db1a560576defeda9521aba81ba3e4b5604a9 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Thu, 14 Mar 2019 00:16:16 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@269669 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 7e9d41b52ce..0449c251fab 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190313 +20190314 -- cgit v1.2.3 From d46059b33f96e4618584218e0e50e0cd6423df38 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Thu, 14 Mar 2019 09:14:30 +0000 Subject: 2019-03-14 Richard Biener PR middle-end/89572 * tree-scalar-evolution.c (get_loop_exit_condition): Use safe_dyn_cast. * tree-ssa-loop-ivcanon.c (canonicalize_loop_induction_variables): Use gimple_location_safe. * gcc.dg/torture/pr89572.c: New testcase. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@269675 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 8 ++++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/torture/pr89572.c | 28 ++++++++++++++++++++++++++++ gcc/tree-scalar-evolution.c | 2 +- gcc/tree-ssa-loop-ivcanon.c | 4 ++-- 5 files changed, 44 insertions(+), 3 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/torture/pr89572.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c779ed45d92..038b1bd714e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2019-03-14 Richard Biener + + PR middle-end/89572 + * tree-scalar-evolution.c (get_loop_exit_condition): Use + safe_dyn_cast. + * tree-ssa-loop-ivcanon.c (canonicalize_loop_induction_variables): + Use gimple_location_safe. + 2019-03-13 Vladimir Makarov PR target/85860 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 015e934309a..4ba559dbd3f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-03-14 Richard Biener + + PR middle-end/89572 + * gcc.dg/torture/pr89572.c: New testcase. + 2019-03-13 Thomas Koenig PR fortran/87673 diff --git a/gcc/testsuite/gcc.dg/torture/pr89572.c b/gcc/testsuite/gcc.dg/torture/pr89572.c new file mode 100644 index 00000000000..1c293850c11 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr89572.c @@ -0,0 +1,28 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-finline-functions" } */ + +int vh, it, k1; + +void +vn (void) +{ + ++vh; + if (vh == 0 && it == 0) + k1 = -k1; +} + +__attribute__ ((returns_twice)) void +ef (int *uw) +{ + while (uw != (void *) 0) + { + vn (); + *uw = 0; + } +} + +void +gu (int *uw) +{ + ef (uw); +} diff --git a/gcc/tree-scalar-evolution.c b/gcc/tree-scalar-evolution.c index c955352018a..759bc612566 100644 --- a/gcc/tree-scalar-evolution.c +++ b/gcc/tree-scalar-evolution.c @@ -875,7 +875,7 @@ get_loop_exit_condition (const struct loop *loop) gimple *stmt; stmt = last_stmt (exit_edge->src); - if (gcond *cond_stmt = dyn_cast (stmt)) + if (gcond *cond_stmt = safe_dyn_cast (stmt)) res = cond_stmt; } diff --git a/gcc/tree-ssa-loop-ivcanon.c b/gcc/tree-ssa-loop-ivcanon.c index 7f8b5199b6b..5b6db6aa9f3 100644 --- a/gcc/tree-ssa-loop-ivcanon.c +++ b/gcc/tree-ssa-loop-ivcanon.c @@ -1177,7 +1177,7 @@ canonicalize_loop_induction_variables (struct loop *loop, = niter_desc.may_be_zero && !integer_zerop (niter_desc.may_be_zero); } if (TREE_CODE (niter) == INTEGER_CST) - locus = gimple_location (last_stmt (exit->src)); + locus = gimple_location_safe (last_stmt (exit->src)); else { /* For non-constant niter fold may_be_zero into niter again. */ @@ -1204,7 +1204,7 @@ canonicalize_loop_induction_variables (struct loop *loop, niter = find_loop_niter_by_eval (loop, &exit); if (exit) - locus = gimple_location (last_stmt (exit->src)); + locus = gimple_location_safe (last_stmt (exit->src)); if (TREE_CODE (niter) != INTEGER_CST) exit = NULL; -- cgit v1.2.3 From 2426d7f9544424b34c459e2e7453a52d982e1f56 Mon Sep 17 00:00:00 2001 From: Martin Jambor Date: Thu, 14 Mar 2019 16:50:50 +0000 Subject: Zero local estimated benefit for cloning extern inline function 2019-03-14 Martin Jambor Backport from mainline 2019-03-07 Martin Jambor PR lto/87525 * ipa-cp.c (perform_estimation_of_a_value): Account zero time benefit for extern inline functions. testsuite/ * gcc.dg/ipa/ipcp-5.c: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@269687 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 9 ++++++++ gcc/ipa-cp.c | 17 ++++++++++----- gcc/testsuite/ChangeLog | 8 +++++++ gcc/testsuite/gcc.dg/ipa/ipcp-5.c | 45 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 74 insertions(+), 5 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/ipa/ipcp-5.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 038b1bd714e..df07bb57464 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2019-03-14 Martin Jambor + + Backport from mainline + 2019-03-07 Martin Jambor + + PR lto/87525 + * ipa-cp.c (perform_estimation_of_a_value): Account zero time benefit + for extern inline functions. + 2019-03-14 Richard Biener PR middle-end/89572 diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c index 5bd4df0ecb7..84d49074bc8 100644 --- a/gcc/ipa-cp.c +++ b/gcc/ipa-cp.c @@ -2852,11 +2852,18 @@ perform_estimation_of_a_value (cgraph_node *node, vec known_csts, base_time -= time; if (base_time > 65535) base_time = 65535; - time_benefit = base_time.to_int () - + devirtualization_time_bonus (node, known_csts, known_contexts, - known_aggs_ptrs) - + hint_time_bonus (hints) - + removable_params_cost + est_move_cost; + + /* Extern inline functions have no cloning local time benefits because they + will be inlined anyway. The only reason to clone them is if it enables + optimization in any of the functions they call. */ + if (DECL_EXTERNAL (node->decl) && DECL_DECLARED_INLINE_P (node->decl)) + time_benefit = 0; + else + time_benefit = base_time.to_int () + + devirtualization_time_bonus (node, known_csts, known_contexts, + known_aggs_ptrs) + + hint_time_bonus (hints) + + removable_params_cost + est_move_cost; gcc_checking_assert (size >=0); /* The inliner-heuristics based estimates may think that in certain diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 4ba559dbd3f..9aabab1cf32 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2019-03-14 Martin Jambor + + Backport from mainline + 2019-03-07 Martin Jambor + + PR lto/87525 + * gcc.dg/ipa/ipcp-5.c: New test. + 2019-03-14 Richard Biener PR middle-end/89572 diff --git a/gcc/testsuite/gcc.dg/ipa/ipcp-5.c b/gcc/testsuite/gcc.dg/ipa/ipcp-5.c new file mode 100644 index 00000000000..6786c514543 --- /dev/null +++ b/gcc/testsuite/gcc.dg/ipa/ipcp-5.c @@ -0,0 +1,45 @@ +/* Test that estimated local cloning time benefit of extern inline functions is + zero. */ + +/* { dg-do compile } */ +/* { dg-options "-O3 -fdump-ipa-cp -fno-early-inlining" } */ +/* { dg-add-options bind_pic_locally } */ + +extern int get_int (void); +extern void use_stuff (int); + +int arr[10]; + +inline void +f (int a) +{ + arr[0] += a + 5; + arr[1] += a + 50; + arr[2] += a - 3; + arr[3] += a; + arr[4] += a + 21; + arr[5] += a + 900; + arr[6] += a + 2; + arr[7] += a + 3456; + arr[8] += a + 3; + arr[9] += a + 32; + use_stuff (a); +} + + +int +entry (void) +{ + int i; + for (i = 0; i < 100; i++) + f (7); + for (i = 0; i < 100; i++) + f (get_int ()); + return 0; +} + + +/* { dg-final { scan-ipa-dump "loc_time: 0" "cp" } } */ +/* { dg-final { scan-ipa-dump-not "replacing param.*with const" "cp" } } */ + + -- cgit v1.2.3 From 92b223ef3b2b7e64ffa60d67dcc7a734b792dba6 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Fri, 15 Mar 2019 00:16:07 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@269697 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 0449c251fab..5f83f80e320 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190314 +20190315 -- cgit v1.2.3 From 7951bcf0ff9a19fb91e31e8410babf945d9d73ba Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Fri, 15 Mar 2019 08:36:15 +0000 Subject: Subject: Backport r269684 2019-03-15 Martin Liska PR other/89712 * doc/invoke.texi: Remove -fdump-class-hierarchy option. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@269701 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 5 +++++ gcc/doc/invoke.texi | 1 - 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index df07bb57464..ff86fa414c7 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2019-03-15 Martin Liska + + PR other/89712 + * doc/invoke.texi: Remove -fdump-class-hierarchy option. + 2019-03-14 Martin Jambor Backport from mainline diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index e5c4e8125aa..4ee24c3ab78 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -554,7 +554,6 @@ Objective-C and Objective-C++ Dialects}. -fdisable-tree-@var{pass_name} @gol -fdisable-tree-@var{pass-name}=@var{range-list} @gol -fdump-noaddr -fdump-unnumbered -fdump-unnumbered-links @gol --fdump-class-hierarchy@r{[}-@var{n}@r{]} @gol -fdump-final-insns@r{[}=@var{file}@r{]} @gol -fdump-ipa-all -fdump-ipa-cgraph -fdump-ipa-inline @gol -fdump-lang-all @gol -- cgit v1.2.3 From e176b101b8a9a4db15ea0fc7a88294ef126cc19f Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Fri, 15 Mar 2019 11:07:53 +0000 Subject: 2019-03-15 Richard Biener Backport from mainline 2019-03-06 Richard Biener PR testsuite/89551 * gcc.dg/uninit-pred-8_b.c: Force logical-op-non-short-circuit the way that makes the testcase PASS. 2018-11-30 Jakub Jelinek PR testsuite/85368 * params.def (PARAM_LOGICAL_OP_NON_SHORT_CIRCUIT): New param. * tree-ssa-ifcombine.c (ifcombine_ifandif): If --param logical-op-non-short-circuit is present, override LOGICAL_OP_NON_SHORT_CIRCUIT value from the param. * fold-const.c (fold_range_test, fold_truth_andor): Likewise. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@269704 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 12 ++++++++++++ gcc/fold-const.c | 21 ++++++++++++++------- gcc/params.def | 5 +++++ gcc/testsuite/ChangeLog | 9 +++++++++ gcc/testsuite/gcc.dg/uninit-pred-8_b.c | 5 +++-- gcc/tree-ssa-ifcombine.c | 7 ++++++- 6 files changed, 49 insertions(+), 10 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ff86fa414c7..f566e1610c7 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,15 @@ +2019-03-15 Richard Biener + + Backport from mainline + 2018-11-30 Jakub Jelinek + + PR testsuite/85368 + * params.def (PARAM_LOGICAL_OP_NON_SHORT_CIRCUIT): New param. + * tree-ssa-ifcombine.c (ifcombine_ifandif): If + --param logical-op-non-short-circuit is present, override + LOGICAL_OP_NON_SHORT_CIRCUIT value from the param. + * fold-const.c (fold_range_test, fold_truth_andor): Likewise. + 2019-03-15 Martin Liska PR other/89712 diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 36bcc65f14d..af67feb5fbc 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -5515,12 +5515,15 @@ fold_range_test (location_t loc, enum tree_code code, tree type, /* On machines where the branch cost is expensive, if this is a short-circuited branch and the underlying object on both sides is the same, make a non-short-circuit operation. */ - else if (LOGICAL_OP_NON_SHORT_CIRCUIT - && !flag_sanitize_coverage - && lhs != 0 && rhs != 0 - && (code == TRUTH_ANDIF_EXPR - || code == TRUTH_ORIF_EXPR) - && operand_equal_p (lhs, rhs, 0)) + bool logical_op_non_short_circuit = LOGICAL_OP_NON_SHORT_CIRCUIT; + if (PARAM_VALUE (PARAM_LOGICAL_OP_NON_SHORT_CIRCUIT) != -1) + logical_op_non_short_circuit + = PARAM_VALUE (PARAM_LOGICAL_OP_NON_SHORT_CIRCUIT); + if (logical_op_non_short_circuit + && !flag_sanitize_coverage + && lhs != 0 && rhs != 0 + && (code == TRUTH_ANDIF_EXPR || code == TRUTH_ORIF_EXPR) + && operand_equal_p (lhs, rhs, 0)) { /* If simple enough, just rewrite. Otherwise, make a SAVE_EXPR unless we are at top level or LHS contains a PLACEHOLDER_EXPR, in @@ -8165,7 +8168,11 @@ fold_truth_andor (location_t loc, enum tree_code code, tree type, if ((tem = fold_truth_andor_1 (loc, code, type, arg0, arg1)) != 0) return tem; - if (LOGICAL_OP_NON_SHORT_CIRCUIT + bool logical_op_non_short_circuit = LOGICAL_OP_NON_SHORT_CIRCUIT; + if (PARAM_VALUE (PARAM_LOGICAL_OP_NON_SHORT_CIRCUIT) != -1) + logical_op_non_short_circuit + = PARAM_VALUE (PARAM_LOGICAL_OP_NON_SHORT_CIRCUIT); + if (logical_op_non_short_circuit && !flag_sanitize_coverage && (code == TRUTH_AND_EXPR || code == TRUTH_ANDIF_EXPR diff --git a/gcc/params.def b/gcc/params.def index dad47ec2b00..e3ad05fd182 100644 --- a/gcc/params.def +++ b/gcc/params.def @@ -1331,6 +1331,11 @@ DEFPARAM(PARAM_AVOID_FMA_MAX_BITS, "Maximum number of bits for which we avoid creating FMAs.", 0, 0, 512) +DEFPARAM(PARAM_LOGICAL_OP_NON_SHORT_CIRCUIT, + "logical-op-non-short-circuit", + "True if a non-short-circuit operation is optimal.", + -1, -1, 1) + /* Local variables: diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 9aabab1cf32..c631992f486 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,12 @@ +2019-03-15 Richard Biener + + Backport from mainline + 2019-03-06 Richard Biener + + PR testsuite/89551 + * gcc.dg/uninit-pred-8_b.c: Force logical-op-non-short-circuit + the way that makes the testcase PASS. + 2019-03-14 Martin Jambor Backport from mainline diff --git a/gcc/testsuite/gcc.dg/uninit-pred-8_b.c b/gcc/testsuite/gcc.dg/uninit-pred-8_b.c index 06e2eba27d0..d9c3c42c302 100644 --- a/gcc/testsuite/gcc.dg/uninit-pred-8_b.c +++ b/gcc/testsuite/gcc.dg/uninit-pred-8_b.c @@ -1,6 +1,7 @@ - /* { dg-do compile } */ -/* { dg-options "-Wuninitialized -O2" } */ +/* ??? Jump threading makes a mess of the logical-op-non-short-circuit=0 case + so force it our way. */ +/* { dg-options "-Wuninitialized -O2 --param logical-op-non-short-circuit=1" } */ int g; void bar(); diff --git a/gcc/tree-ssa-ifcombine.c b/gcc/tree-ssa-ifcombine.c index b63c600c47b..828ee81d898 100644 --- a/gcc/tree-ssa-ifcombine.c +++ b/gcc/tree-ssa-ifcombine.c @@ -40,6 +40,7 @@ along with GCC; see the file COPYING3. If not see #include "gimplify-me.h" #include "tree-cfg.h" #include "tree-ssa.h" +#include "params.h" #ifndef LOGICAL_OP_NON_SHORT_CIRCUIT #define LOGICAL_OP_NON_SHORT_CIRCUIT \ @@ -556,7 +557,11 @@ ifcombine_ifandif (basic_block inner_cond_bb, bool inner_inv, { tree t1, t2; gimple_stmt_iterator gsi; - if (!LOGICAL_OP_NON_SHORT_CIRCUIT || flag_sanitize_coverage) + bool logical_op_non_short_circuit = LOGICAL_OP_NON_SHORT_CIRCUIT; + if (PARAM_VALUE (PARAM_LOGICAL_OP_NON_SHORT_CIRCUIT) != -1) + logical_op_non_short_circuit + = PARAM_VALUE (PARAM_LOGICAL_OP_NON_SHORT_CIRCUIT); + if (!logical_op_non_short_circuit || flag_sanitize_coverage) return false; /* Only do this optimization if the inner bb contains only the conditional. */ if (!gsi_one_before_end_p (gsi_start_nondebug_after_labels_bb (inner_cond_bb))) -- cgit v1.2.3 From 1c35b1831731a82e0100a3bbac4ed0e9523bec84 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Sat, 16 Mar 2019 00:16:18 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@269719 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 5f83f80e320..814c2feda07 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190315 +20190316 -- cgit v1.2.3 From 6a37ba6740d1da3c7a407d74195a98890ad0a1bd Mon Sep 17 00:00:00 2001 From: Thomas Koenig Date: Sat, 16 Mar 2019 13:16:11 +0000 Subject: 2019-03-16 Thomas Koenig PR fortran/66695 PR fortran/77746 PR fortran/79485 Backport from trunk * gfortran.h (gfc_symbol): Add bind_c component. (gfc_get_gsymbol): Add argument bind_c. * decl.c (add_global_entry): Add bind_c argument to gfc_get_symbol. * parse.c (parse_block_data): Likewise. (parse_module): Likewise. (add_global_procedure): Likewise. (add_global_program): Likewise. * resolve.c (resolve_common_blocks): Likewise. (resolve_global_procedure): Likewise. (gfc_verify_binding_labels): Likewise. * symbol.c (gfc_get_gsymbol): Add argument bind_c. Set bind_c in gsym. * trans-decl.c (gfc_get_module_backend_decl): Add bind_c argument to gfc_get_symbol. (gfc_get_extern_function_decl): If the sym has a binding label and it cannot be found in the global symbol tabel, it is the wrong one and vice versa. 2019-03-16 Thomas Koenig PR fortran/66695 PR fortran/77746 PR fortran/79485 Backport from trunk * gfortran.dg/binding_label_tests_30.f90: New test. * gfortran.dg/binding_label_tests_31.f90: New test. * gfortran.dg/binding_label_tests_32.f90: New test. * gfortran.dg/binding_label_tests_33.f90: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@269722 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fortran/ChangeLog | 25 ++++++++++++++ gcc/fortran/decl.c | 4 +-- gcc/fortran/gfortran.h | 3 +- gcc/fortran/parse.c | 10 +++--- gcc/fortran/resolve.c | 9 ++--- gcc/fortran/symbol.c | 3 +- gcc/fortran/trans-decl.c | 21 +++++++++--- gcc/testsuite/ChangeLog | 11 ++++++ .../gfortran.dg/binding_label_tests_30.f90 | 7 ++++ .../gfortran.dg/binding_label_tests_31.f90 | 19 +++++++++++ .../gfortran.dg/binding_label_tests_32.f90 | 35 +++++++++++++++++++ .../gfortran.dg/binding_label_tests_33.f90 | 39 ++++++++++++++++++++++ 12 files changed, 169 insertions(+), 17 deletions(-) create mode 100644 gcc/testsuite/gfortran.dg/binding_label_tests_30.f90 create mode 100644 gcc/testsuite/gfortran.dg/binding_label_tests_31.f90 create mode 100644 gcc/testsuite/gfortran.dg/binding_label_tests_32.f90 create mode 100644 gcc/testsuite/gfortran.dg/binding_label_tests_33.f90 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 3b0b6a25ba0..4e015420016 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,28 @@ +2019-03-16 Thomas Koenig + + PR fortran/66695 + PR fortran/77746 + PR fortran/79485 + Backport from trunk + * gfortran.h (gfc_symbol): Add bind_c component. + (gfc_get_gsymbol): Add argument bind_c. + * decl.c (add_global_entry): Add bind_c argument to + gfc_get_symbol. + * parse.c (parse_block_data): Likewise. + (parse_module): Likewise. + (add_global_procedure): Likewise. + (add_global_program): Likewise. + * resolve.c (resolve_common_blocks): Likewise. + (resolve_global_procedure): Likewise. + (gfc_verify_binding_labels): Likewise. + * symbol.c (gfc_get_gsymbol): Add argument bind_c. Set bind_c + in gsym. + * trans-decl.c (gfc_get_module_backend_decl): Add bind_c argument + to gfc_get_symbol. + (gfc_get_extern_function_decl): If the sym has a binding label + and it cannot be found in the global symbol tabel, it is the wrong + one and vice versa. + 2019-03-13 Thomas Koenig PR fortran/87673 diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c index 41b1a992a57..7cc276ea64a 100644 --- a/gcc/fortran/decl.c +++ b/gcc/fortran/decl.c @@ -7164,7 +7164,7 @@ add_global_entry (const char *name, const char *binding_label, bool sub, name is a global identifier. */ if (!binding_label || gfc_notification_std (GFC_STD_F2008)) { - s = gfc_get_gsymbol (name); + s = gfc_get_gsymbol (name, false); if (s->defined || (s->type != GSYM_UNKNOWN && s->type != type)) { @@ -7186,7 +7186,7 @@ add_global_entry (const char *name, const char *binding_label, bool sub, && (!gfc_notification_std (GFC_STD_F2008) || strcmp (name, binding_label) != 0)) { - s = gfc_get_gsymbol (binding_label); + s = gfc_get_gsymbol (binding_label, true); if (s->defined || (s->type != GSYM_UNKNOWN && s->type != type)) { diff --git a/gcc/fortran/gfortran.h b/gcc/fortran/gfortran.h index abdefe12ed2..dd512d94922 100644 --- a/gcc/fortran/gfortran.h +++ b/gcc/fortran/gfortran.h @@ -1883,6 +1883,7 @@ typedef struct gfc_gsymbol enum gfc_symbol_type type; int defined, used; + bool bind_c; locus where; gfc_namespace *ns; } @@ -3059,7 +3060,7 @@ void gfc_enforce_clean_symbol_state (void); void gfc_free_dt_list (void); -gfc_gsymbol *gfc_get_gsymbol (const char *); +gfc_gsymbol *gfc_get_gsymbol (const char *, bool bind_c); gfc_gsymbol *gfc_find_gsymbol (gfc_gsymbol *, const char *); gfc_gsymbol *gfc_find_case_gsymbol (gfc_gsymbol *, const char *); diff --git a/gcc/fortran/parse.c b/gcc/fortran/parse.c index 4ce6eb42750..e920c71d569 100644 --- a/gcc/fortran/parse.c +++ b/gcc/fortran/parse.c @@ -5830,7 +5830,7 @@ parse_block_data (void) } else { - s = gfc_get_gsymbol (gfc_new_block->name); + s = gfc_get_gsymbol (gfc_new_block->name, false); if (s->defined || (s->type != GSYM_UNKNOWN && s->type != GSYM_BLOCK_DATA)) gfc_global_used (s, &gfc_new_block->declared_at); @@ -5912,7 +5912,7 @@ parse_module (void) gfc_gsymbol *s; bool error; - s = gfc_get_gsymbol (gfc_new_block->name); + s = gfc_get_gsymbol (gfc_new_block->name, false); if (s->defined || (s->type != GSYM_UNKNOWN && s->type != GSYM_MODULE)) gfc_global_used (s, &gfc_new_block->declared_at); else @@ -5976,7 +5976,7 @@ add_global_procedure (bool sub) name is a global identifier. */ if (!gfc_new_block->binding_label || gfc_notification_std (GFC_STD_F2008)) { - s = gfc_get_gsymbol (gfc_new_block->name); + s = gfc_get_gsymbol (gfc_new_block->name, false); if (s->defined || (s->type != GSYM_UNKNOWN @@ -6001,7 +6001,7 @@ add_global_procedure (bool sub) && (!gfc_notification_std (GFC_STD_F2008) || strcmp (gfc_new_block->name, gfc_new_block->binding_label) != 0)) { - s = gfc_get_gsymbol (gfc_new_block->binding_label); + s = gfc_get_gsymbol (gfc_new_block->binding_label, true); if (s->defined || (s->type != GSYM_UNKNOWN @@ -6033,7 +6033,7 @@ add_global_program (void) if (gfc_new_block == NULL) return; - s = gfc_get_gsymbol (gfc_new_block->name); + s = gfc_get_gsymbol (gfc_new_block->name, false); if (s->defined || (s->type != GSYM_UNKNOWN && s->type != GSYM_PROGRAM)) gfc_global_used (s, &gfc_new_block->declared_at); diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index 7291039782e..d2b1d26a5a7 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -1045,7 +1045,7 @@ resolve_common_blocks (gfc_symtree *common_root) } if (!gsym) { - gsym = gfc_get_gsymbol (common_root->n.common->name); + gsym = gfc_get_gsymbol (common_root->n.common->name, false); gsym->type = GSYM_COMMON; gsym->where = common_root->n.common->where; gsym->defined = 1; @@ -1067,7 +1067,7 @@ resolve_common_blocks (gfc_symtree *common_root) } if (!gsym) { - gsym = gfc_get_gsymbol (common_root->n.common->binding_label); + gsym = gfc_get_gsymbol (common_root->n.common->binding_label, true); gsym->type = GSYM_COMMON; gsym->where = common_root->n.common->where; gsym->defined = 1; @@ -2482,7 +2482,8 @@ resolve_global_procedure (gfc_symbol *sym, locus *where, type = sub ? GSYM_SUBROUTINE : GSYM_FUNCTION; - gsym = gfc_get_gsymbol (sym->binding_label ? sym->binding_label : sym->name); + gsym = gfc_get_gsymbol (sym->binding_label ? sym->binding_label : sym->name, + sym->binding_label != NULL); if ((gsym->type != GSYM_UNKNOWN && gsym->type != type)) gfc_global_used (gsym, where); @@ -11704,7 +11705,7 @@ gfc_verify_binding_labels (gfc_symbol *sym) && (gsym->type == GSYM_FUNCTION || gsym->type == GSYM_SUBROUTINE))) { if (!gsym) - gsym = gfc_get_gsymbol (sym->binding_label); + gsym = gfc_get_gsymbol (sym->binding_label, true); gsym->where = sym->declared_at; gsym->sym_name = sym->name; gsym->binding_label = sym->binding_label; diff --git a/gcc/fortran/symbol.c b/gcc/fortran/symbol.c index ebb57eda9c5..e40e9ac648e 100644 --- a/gcc/fortran/symbol.c +++ b/gcc/fortran/symbol.c @@ -4353,7 +4353,7 @@ gsym_compare (void *_s1, void *_s2) /* Get a global symbol, creating it if it doesn't exist. */ gfc_gsymbol * -gfc_get_gsymbol (const char *name) +gfc_get_gsymbol (const char *name, bool bind_c) { gfc_gsymbol *s; @@ -4364,6 +4364,7 @@ gfc_get_gsymbol (const char *name) s = XCNEW (gfc_gsymbol); s->type = GSYM_UNKNOWN; s->name = gfc_get_string ("%s", name); + s->bind_c = bind_c; gfc_insert_bbt (&gfc_gsym_root, s, gsym_compare); diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c index a2172c3ddeb..a68223d2040 100644 --- a/gcc/fortran/trans-decl.c +++ b/gcc/fortran/trans-decl.c @@ -839,7 +839,7 @@ gfc_get_module_backend_decl (gfc_symbol *sym) { if (!gsym) { - gsym = gfc_get_gsymbol (sym->module); + gsym = gfc_get_gsymbol (sym->module, false); gsym->type = GSYM_MODULE; gsym->ns = gfc_get_namespace (NULL, 0); } @@ -2002,9 +2002,22 @@ gfc_get_extern_function_decl (gfc_symbol * sym, gfc_actual_arglist *actual_args) return get_proc_pointer_decl (sym); /* See if this is an external procedure from the same file. If so, - return the backend_decl. */ - gsym = gfc_find_gsymbol (gfc_gsym_root, sym->binding_label - ? sym->binding_label : sym->name); + return the backend_decl. If we are looking at a BIND(C) + procedure and the symbol is not BIND(C), or vice versa, we + haven't found the right procedure. */ + + if (sym->binding_label) + { + gsym = gfc_find_gsymbol (gfc_gsym_root, sym->binding_label); + if (gsym && !gsym->bind_c) + gsym = NULL; + } + else + { + gsym = gfc_find_gsymbol (gfc_gsym_root, sym->name); + if (gsym && gsym->bind_c) + gsym = NULL; + } if (gsym && !gsym->defined) gsym = NULL; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c631992f486..3548db53d76 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,14 @@ +2019-03-16 Thomas Koenig + + PR fortran/66695 + PR fortran/77746 + PR fortran/79485 + Backport from trunk + * gfortran.dg/binding_label_tests_30.f90: New test. + * gfortran.dg/binding_label_tests_31.f90: New test. + * gfortran.dg/binding_label_tests_32.f90: New test. + * gfortran.dg/binding_label_tests_33.f90: New test. + 2019-03-15 Richard Biener Backport from mainline diff --git a/gcc/testsuite/gfortran.dg/binding_label_tests_30.f90 b/gcc/testsuite/gfortran.dg/binding_label_tests_30.f90 new file mode 100644 index 00000000000..168d4b52f2d --- /dev/null +++ b/gcc/testsuite/gfortran.dg/binding_label_tests_30.f90 @@ -0,0 +1,7 @@ +! { dg-do compile } +! Make sure this error is flagged. +subroutine foo() ! { dg-error "is already being used as a SUBROUTINE" } +end subroutine foo + +subroutine bar() bind(C,name="foo") ! { dg-error "is already being used as a SUBROUTINE" } +end subroutine bar diff --git a/gcc/testsuite/gfortran.dg/binding_label_tests_31.f90 b/gcc/testsuite/gfortran.dg/binding_label_tests_31.f90 new file mode 100644 index 00000000000..e914c66a7b8 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/binding_label_tests_31.f90 @@ -0,0 +1,19 @@ +! { dg-do compile } +! PR fortran/66695 - this used to ICE. +! Original test case by Vladimir Fuka. +module mod + implicit none +contains + integer function F() + end function +end module + +module mod_C + use mod + implicit none +contains + subroutine s() bind(C, name="f") + integer :: x + x = F() + end subroutine +end module diff --git a/gcc/testsuite/gfortran.dg/binding_label_tests_32.f90 b/gcc/testsuite/gfortran.dg/binding_label_tests_32.f90 new file mode 100644 index 00000000000..f18df66a2cc --- /dev/null +++ b/gcc/testsuite/gfortran.dg/binding_label_tests_32.f90 @@ -0,0 +1,35 @@ +! { dg-do run } +! PR 77746 - this used to crash during execution. +! Original test case by Vladimir Fuka. +module first + private + public execute + + interface execute + module procedure random_name + end interface + +contains + + subroutine random_name() + end subroutine +end module + +module test + use first + + implicit none + +contains + + subroutine p_execute(i) bind(C, name="random_name") + integer :: i + + call execute() + end subroutine + +end module + + use test + call p_execute(1) +end diff --git a/gcc/testsuite/gfortran.dg/binding_label_tests_33.f90 b/gcc/testsuite/gfortran.dg/binding_label_tests_33.f90 new file mode 100644 index 00000000000..fdb9a887f60 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/binding_label_tests_33.f90 @@ -0,0 +1,39 @@ +! { dg-do run } +! PR 79485 - used to crash because the wrong routine was called. +module fmod1 + + contains + + subroutine foo(i) + implicit none + + integer, intent(inout) :: i + + i=i+1 + + end subroutine foo + +end module fmod1 + +module fmod2 + use iso_c_binding + use fmod1, only : foo_first => foo + + contains + + subroutine foo(i) bind(c) + implicit none + + integer, intent(inout) :: i + + i=i+2 + call foo_first(i) + + end subroutine foo + +end module fmod2 + + use fmod2 + + call foo(i) +end -- cgit v1.2.3 From f535a3fdd831a21021fde49f815a8d1dfe308371 Mon Sep 17 00:00:00 2001 From: Thomas Koenig Date: Sat, 16 Mar 2019 13:52:19 +0000 Subject: 2019-03-16 Thomas Koenig PR fortran/66089 Backport from trunk * trans-array.c (gfc_scalar_elemental_arg_saved_as_reference): Return false if a scalar tempoary is needed. (gfc_walk_variable_expr): Fix up class refs. 2019-03-16 Thomas Koenig PR fortran/66089 Backport from trunk * gfortran.dg/dependency_53.f90: New test. * gfortran.dg/assumed_type_2.f90: Adapted tree dumps. * gfortran.dg/no_arg_check_2.f90: Likewise. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@269724 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fortran/ChangeLog | 8 ++++++++ gcc/fortran/trans-array.c | 5 +++++ gcc/testsuite/ChangeLog | 8 ++++++++ gcc/testsuite/gfortran.dg/assumed_type_2.f90 | 4 ++-- gcc/testsuite/gfortran.dg/dependency_53.f90 | 25 +++++++++++++++++++++++++ gcc/testsuite/gfortran.dg/no_arg_check_2.f90 | 4 ++-- 6 files changed, 50 insertions(+), 4 deletions(-) create mode 100644 gcc/testsuite/gfortran.dg/dependency_53.f90 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 4e015420016..27f7b562bc1 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,11 @@ +2019-03-16 Thomas Koenig + + PR fortran/66089 + Backport from trunk + * trans-array.c (gfc_scalar_elemental_arg_saved_as_reference): + Return false if a scalar tempoary is needed. + (gfc_walk_variable_expr): Fix up class refs. + 2019-03-16 Thomas Koenig PR fortran/66695 diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c index 8498dfb656e..6a4dcaffbd8 100644 --- a/gcc/fortran/trans-array.c +++ b/gcc/fortran/trans-array.c @@ -2652,6 +2652,9 @@ gfc_scalar_elemental_arg_saved_as_reference (gfc_ss_info * ss_info) if (ss_info->type != GFC_SS_REFERENCE) return false; + if (ss_info->data.scalar.needs_temporary) + return false; + /* If the actual argument can be absent (in other words, it can be a NULL reference), don't try to evaluate it; pass instead the reference directly. */ @@ -10350,6 +10353,8 @@ gfc_walk_variable_expr (gfc_ss * ss, gfc_expr * expr) { gfc_ref *ref; + gfc_fix_class_refs (expr); + for (ref = expr->ref; ref; ref = ref->next) if (ref->type == REF_ARRAY && ref->u.ar.type != AR_ELEMENT) break; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 3548db53d76..eabac5e7d65 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2019-03-16 Thomas Koenig + + PR fortran/66089 + Backport from trunk + * gfortran.dg/dependency_53.f90: New test. + * gfortran.dg/assumed_type_2.f90: Adapted tree dumps. + * gfortran.dg/no_arg_check_2.f90: Likewise. + 2019-03-16 Thomas Koenig PR fortran/66695 diff --git a/gcc/testsuite/gfortran.dg/assumed_type_2.f90 b/gcc/testsuite/gfortran.dg/assumed_type_2.f90 index acf587386c5..dce5ac6839c 100644 --- a/gcc/testsuite/gfortran.dg/assumed_type_2.f90 +++ b/gcc/testsuite/gfortran.dg/assumed_type_2.f90 @@ -157,7 +157,7 @@ end ! { dg-final { scan-tree-dump-times "sub_scalar .\\(struct t1 .\\) array_class_t1_alloc._data.data" 1 "original" } } ! { dg-final { scan-tree-dump-times "sub_scalar .\\(struct t1 .\\) \\(array_class_t1_ptr._data.dat" 1 "original" } } -! { dg-final { scan-tree-dump-times "sub_array_assumed \\(D" 3 "original" } } +! { dg-final { scan-tree-dump-times "sub_array_assumed \\(D" 4 "original" } } ! { dg-final { scan-tree-dump-times " = _gfortran_internal_pack \\(&parm" 1 "original" } } ! { dg-final { scan-tree-dump-times "sub_array_assumed \\(&array_int\\)" 1 "original" } } ! { dg-final { scan-tree-dump-times "sub_array_assumed \\(\\(real\\(kind=4\\).0:. . restrict\\) array_real_alloc.data" 1 "original" } } @@ -166,7 +166,7 @@ end ! { dg-final { scan-tree-dump-times "sub_array_assumed \\(\\(struct t1.0:. .\\) parm" 1 "original" } } ! { dg-final { scan-tree-dump-times "sub_array_assumed \\(\\(struct t2.0:. . restrict\\) array_t2_alloc.data\\);" 1 "original" } } ! { dg-final { scan-tree-dump-times "sub_array_assumed \\(\\(struct t1.0:. . restrict\\) array_class_t1_alloc._data.data\\);" 1 "original" } } -! { dg-final { scan-tree-dump-times "sub_array_assumed \\(\\(struct t1.0:. .\\) array_class_t1_ptr._data.data\\);" 1 "original" } } +! { dg-final { scan-tree-dump-times "sub_array_assumed \\(\\(struct t1.0:. .\\) array_class_t1_ptr._data.data\\);" 0 "original" } } ! { dg-final { scan-tree-dump-times "sub_array_shape \\(&array_real_alloc," 1 "original" } } ! { dg-final { scan-tree-dump-times "sub_array_shape \\(&array_char_ptr," 1 "original" } } diff --git a/gcc/testsuite/gfortran.dg/dependency_53.f90 b/gcc/testsuite/gfortran.dg/dependency_53.f90 new file mode 100644 index 00000000000..a45302fb0a3 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/dependency_53.f90 @@ -0,0 +1,25 @@ +! { dg-do run } +! PR fortran/66089 - used to ICE and, after that ICE was fixed, +! gave wrong results. + type :: t + integer :: c + end type t + + class(t), dimension(:), allocatable :: b,c + + allocate (b(5), source=t(7)) + allocate(c(5), source=t(13)) + c = plus(c(1), b) + if (any(c%c /= 20)) stop 1 + c = t(13) + c = plus(b, c(1)) + if (any(c%c /= 20)) stop 2 +contains + + elemental function plus(lhs, rhs) + class(t), intent(in) :: lhs, rhs + type(t) :: plus + plus%c = lhs%c + rhs%c + end function plus + +end diff --git a/gcc/testsuite/gfortran.dg/no_arg_check_2.f90 b/gcc/testsuite/gfortran.dg/no_arg_check_2.f90 index f99a2e8e923..fe334883a3e 100644 --- a/gcc/testsuite/gfortran.dg/no_arg_check_2.f90 +++ b/gcc/testsuite/gfortran.dg/no_arg_check_2.f90 @@ -139,7 +139,7 @@ end ! { dg-final { scan-tree-dump-times "sub_scalar .\\(struct t1 .\\) array_class_t1_alloc._data.data" 1 "original" } } ! { dg-final { scan-tree-dump-times "sub_scalar .\\(struct t1 .\\) \\(array_class_t1_ptr._data.dat" 1 "original" } } -! { dg-final { scan-tree-dump-times "sub_array_assumed \\(D" 3 "original" } } +! { dg-final { scan-tree-dump-times "sub_array_assumed \\(D" 4 "original" } } ! { dg-final { scan-tree-dump-times " = _gfortran_internal_pack \\(&parm" 1 "original" } } ! { dg-final { scan-tree-dump-times "sub_array_assumed \\(&array_int\\)" 1 "original" } } ! { dg-final { scan-tree-dump-times "sub_array_assumed \\(\\(real\\(kind=4\\).0:. . restrict\\) array_real_alloc.data" 1 "original" } } @@ -148,5 +148,5 @@ end ! { dg-final { scan-tree-dump-times "sub_array_assumed \\(\\(struct t1.0:. .\\) parm" 1 "original" } } ! { dg-final { scan-tree-dump-times "sub_array_assumed \\(\\(struct t2.0:. . restrict\\) array_t2_alloc.data\\);" 1 "original" } } ! { dg-final { scan-tree-dump-times "sub_array_assumed \\(\\(struct t1.0:. . restrict\\) array_class_t1_alloc._data.data\\);" 1 "original" } } -! { dg-final { scan-tree-dump-times "sub_array_assumed \\(\\(struct t1.0:. .\\) array_class_t1_ptr._data.data\\);" 1 "original" } } +! { dg-final { scan-tree-dump-times "sub_array_assumed \\(\\(struct t1.0:. .\\) array_class_t1_ptr._data.data\\);" 0 "original" } } -- cgit v1.2.3 From 18abf03fd5c3a35bb7ab47f81ac851884868de43 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Sun, 17 Mar 2019 00:16:09 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@269736 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 814c2feda07..fd621439124 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190316 +20190317 -- cgit v1.2.3 From 06e30010bab53ea4bf081cfc3427e92dd29c2770 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Sun, 17 Mar 2019 09:11:22 +0000 Subject: x32: Add addr32 prefix to VSIB address 32-bit indices in VSIB address are sign-extended to 64 bits. In x32, when 32-bit indices are used as addresses, like in vgatherdps %ymm7, 0(,%ymm9,1), %ymm6 32-bit indices, 0xf7fa3010, is sign-extended to 0xfffffffff7fa3010 which is invalid address. Add addr32 prefix to UNSPEC_VSIBADDR instructions for x32 if there is no base register nor symbol. This fixes 175.vpr and 254.gap in SPEC CPU 2000 on x32 with -Ofast -funroll-loops -march=haswell gcc/ Backport from mainline 2019-03-14 H.J. Lu PR target/89523 * config/i386/i386.c (ix86_print_operand): Handle 'M' to add addr32 prefix to VSIB address for X32. * config/i386/sse.md (*avx512pf_gatherpfsf_mask): Prepend "%M2" to opcode. (*avx512pf_gatherpfdf_mask): Likewise. (*avx512pf_scatterpfsf_mask): Likewise. (*avx512pf_scatterpfdf_mask): Likewise. (*avx2_gathersi): Prepend "%M3" to opcode. (*avx2_gathersi_2): Prepend "%M2" to opcode. (*avx2_gatherdi): Prepend "%M3" to opcode. (*avx2_gatherdi_2): Prepend "%M2" to opcode. (*avx2_gatherdi_3): Prepend "%M3" to opcode. (*avx2_gatherdi_4): Prepend "%M2" to opcode.` (*avx512f_gathersi): Prepend "%M4" to opcode. (*avx512f_gathersi_2): Prepend "%M3" to opcode. (*avx512f_gatherdi): Prepend "%M4" to opcode. (*avx512f_gatherdi_2): Prepend "%M3" to opcode. (*avx512f_scattersi): Prepend "%M0" to opcode. (*avx512f_scatterdi): Likewise. gcc/testsuite/ Backport from mainline 2019-03-14 H.J. Lu PR target/89523 * gcc.target/i386/pr89523-1a.c: New test. * gcc.target/i386/pr89523-1b.c: Likewise. * gcc.target/i386/pr89523-2.c: Likewise. * gcc.target/i386/pr89523-3.c: Likewise. * gcc.target/i386/pr89523-4.c: Likewise. * gcc.target/i386/pr89523-5.c: Likewise. * gcc.target/i386/pr89523-6.c: Likewise. * gcc.target/i386/pr89523-7.c: Likewise. * gcc.target/i386/pr89523-8.c: Likewise. * gcc.target/i386/pr89523-9.c: Likewise. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@269738 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 26 +++++++++++++++++ gcc/config/i386/i386.c | 21 ++++++++++++++ gcc/config/i386/sse.md | 46 +++++++++++++++--------------- gcc/testsuite/ChangeLog | 17 +++++++++++ gcc/testsuite/gcc.target/i386/pr89523-1a.c | 24 ++++++++++++++++ gcc/testsuite/gcc.target/i386/pr89523-1b.c | 7 +++++ gcc/testsuite/gcc.target/i386/pr89523-2.c | 37 ++++++++++++++++++++++++ gcc/testsuite/gcc.target/i386/pr89523-3.c | 36 +++++++++++++++++++++++ gcc/testsuite/gcc.target/i386/pr89523-4.c | 36 +++++++++++++++++++++++ gcc/testsuite/gcc.target/i386/pr89523-5.c | 39 +++++++++++++++++++++++++ gcc/testsuite/gcc.target/i386/pr89523-6.c | 38 ++++++++++++++++++++++++ gcc/testsuite/gcc.target/i386/pr89523-7.c | 42 +++++++++++++++++++++++++++ gcc/testsuite/gcc.target/i386/pr89523-8.c | 41 ++++++++++++++++++++++++++ gcc/testsuite/gcc.target/i386/pr89523-9.c | 30 +++++++++++++++++++ 14 files changed, 417 insertions(+), 23 deletions(-) create mode 100644 gcc/testsuite/gcc.target/i386/pr89523-1a.c create mode 100644 gcc/testsuite/gcc.target/i386/pr89523-1b.c create mode 100644 gcc/testsuite/gcc.target/i386/pr89523-2.c create mode 100644 gcc/testsuite/gcc.target/i386/pr89523-3.c create mode 100644 gcc/testsuite/gcc.target/i386/pr89523-4.c create mode 100644 gcc/testsuite/gcc.target/i386/pr89523-5.c create mode 100644 gcc/testsuite/gcc.target/i386/pr89523-6.c create mode 100644 gcc/testsuite/gcc.target/i386/pr89523-7.c create mode 100644 gcc/testsuite/gcc.target/i386/pr89523-8.c create mode 100644 gcc/testsuite/gcc.target/i386/pr89523-9.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f566e1610c7..8b716b40712 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,29 @@ +2019-03-17 H.J. Lu + + Backport from mainline + 2019-03-14 H.J. Lu + + PR target/89523 + * config/i386/i386.c (ix86_print_operand): Handle 'M' to add + addr32 prefix to VSIB address for X32. + * config/i386/sse.md (*avx512pf_gatherpfsf_mask): Prepend + "%M2" to opcode. + (*avx512pf_gatherpfdf_mask): Likewise. + (*avx512pf_scatterpfsf_mask): Likewise. + (*avx512pf_scatterpfdf_mask): Likewise. + (*avx2_gathersi): Prepend "%M3" to opcode. + (*avx2_gathersi_2): Prepend "%M2" to opcode. + (*avx2_gatherdi): Prepend "%M3" to opcode. + (*avx2_gatherdi_2): Prepend "%M2" to opcode. + (*avx2_gatherdi_3): Prepend "%M3" to opcode. + (*avx2_gatherdi_4): Prepend "%M2" to opcode.` + (*avx512f_gathersi): Prepend "%M4" to opcode. + (*avx512f_gathersi_2): Prepend "%M3" to opcode. + (*avx512f_gatherdi): Prepend "%M4" to opcode. + (*avx512f_gatherdi_2): Prepend "%M3" to opcode. + (*avx512f_scattersi): Prepend "%M0" to opcode. + (*avx512f_scatterdi): Likewise. + 2019-03-15 Richard Biener Backport from mainline diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index f1de97f73df..b5a47dd6682 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -18127,6 +18127,7 @@ print_reg (rtx x, int code, FILE *file) ; -- print a semicolon (after prefixes due to bug in older gas). ~ -- print "i" if TARGET_AVX2, "f" otherwise. ^ -- print addr32 prefix if TARGET_64BIT and Pmode != word_mode + M -- print addr32 prefix for TARGET_X32 with VSIB address. ! -- print MPX prefix for jxx/call/ret instructions if required. */ @@ -18674,6 +18675,26 @@ ix86_print_operand (FILE *file, rtx x, int code) putc (TARGET_AVX2 ? 'i' : 'f', file); return; + case 'M': + if (TARGET_X32) + { + /* NB: 32-bit indices in VSIB address are sign-extended + to 64 bits. In x32, if 32-bit address 0xf7fa3010 is + sign-extended to 0xfffffffff7fa3010 which is invalid + address. Add addr32 prefix if there is no base + register nor symbol. */ + bool ok; + struct ix86_address parts; + ok = ix86_decompose_address (x, &parts); + gcc_assert (ok && parts.index == NULL_RTX); + if (parts.base == NULL_RTX + && (parts.disp == NULL_RTX + || !symbolic_operand (parts.disp, + GET_MODE (parts.disp)))) + fputs ("addr32 ", file); + } + return; + case '^': if (TARGET_64BIT && Pmode != word_mode) fputs ("addr32 ", file); diff --git a/gcc/config/i386/sse.md b/gcc/config/i386/sse.md index 0a75bd10976..b42292e7702 100644 --- a/gcc/config/i386/sse.md +++ b/gcc/config/i386/sse.md @@ -16271,9 +16271,9 @@ case 3: /* %X5 so that we don't emit any *WORD PTR for -masm=intel, as gas changed what it requires incompatibly. */ - return "vgatherpf0ps\t{%5%{%0%}|%X5%{%0%}}"; + return "%M2vgatherpf0ps\t{%5%{%0%}|%X5%{%0%}}"; case 2: - return "vgatherpf1ps\t{%5%{%0%}|%X5%{%0%}}"; + return "%M2vgatherpf1ps\t{%5%{%0%}|%X5%{%0%}}"; default: gcc_unreachable (); } @@ -16318,9 +16318,9 @@ case 3: /* %X5 so that we don't emit any *WORD PTR for -masm=intel, as gas changed what it requires incompatibly. */ - return "vgatherpf0pd\t{%5%{%0%}|%X5%{%0%}}"; + return "%M2vgatherpf0pd\t{%5%{%0%}|%X5%{%0%}}"; case 2: - return "vgatherpf1pd\t{%5%{%0%}|%X5%{%0%}}"; + return "%M2vgatherpf1pd\t{%5%{%0%}|%X5%{%0%}}"; default: gcc_unreachable (); } @@ -16366,10 +16366,10 @@ case 7: /* %X5 so that we don't emit any *WORD PTR for -masm=intel, as gas changed what it requires incompatibly. */ - return "vscatterpf0ps\t{%5%{%0%}|%X5%{%0%}}"; + return "%M2vscatterpf0ps\t{%5%{%0%}|%X5%{%0%}}"; case 2: case 6: - return "vscatterpf1ps\t{%5%{%0%}|%X5%{%0%}}"; + return "%M2vscatterpf1ps\t{%5%{%0%}|%X5%{%0%}}"; default: gcc_unreachable (); } @@ -16415,10 +16415,10 @@ case 7: /* %X5 so that we don't emit any *WORD PTR for -masm=intel, as gas changed what it requires incompatibly. */ - return "vscatterpf0pd\t{%5%{%0%}|%X5%{%0%}}"; + return "%M2vscatterpf0pd\t{%5%{%0%}|%X5%{%0%}}"; case 2: case 6: - return "vscatterpf1pd\t{%5%{%0%}|%X5%{%0%}}"; + return "%M2vscatterpf1pd\t{%5%{%0%}|%X5%{%0%}}"; default: gcc_unreachable (); } @@ -19157,7 +19157,7 @@ UNSPEC_GATHER)) (clobber (match_scratch:VEC_GATHER_MODE 1 "=&x"))] "TARGET_AVX2" - "vgatherd\t{%1, %7, %0|%0, %7, %1}" + "%M3vgatherd\t{%1, %7, %0|%0, %7, %1}" [(set_attr "type" "ssemov") (set_attr "prefix" "vex") (set_attr "mode" "")]) @@ -19177,7 +19177,7 @@ UNSPEC_GATHER)) (clobber (match_scratch:VEC_GATHER_MODE 1 "=&x"))] "TARGET_AVX2" - "vgatherd\t{%1, %6, %0|%0, %6, %1}" + "%M2vgatherd\t{%1, %6, %0|%0, %6, %1}" [(set_attr "type" "ssemov") (set_attr "prefix" "vex") (set_attr "mode" "")]) @@ -19218,7 +19218,7 @@ UNSPEC_GATHER)) (clobber (match_scratch:VEC_GATHER_MODE 1 "=&x"))] "TARGET_AVX2" - "vgatherq\t{%5, %7, %2|%2, %7, %5}" + "%M3vgatherq\t{%5, %7, %2|%2, %7, %5}" [(set_attr "type" "ssemov") (set_attr "prefix" "vex") (set_attr "mode" "")]) @@ -19240,8 +19240,8 @@ "TARGET_AVX2" { if (mode != mode) - return "vgatherq\t{%4, %6, %x0|%x0, %6, %4}"; - return "vgatherq\t{%4, %6, %0|%0, %6, %4}"; + return "%M2vgatherq\t{%4, %6, %x0|%x0, %6, %4}"; + return "%M2vgatherq\t{%4, %6, %0|%0, %6, %4}"; } [(set_attr "type" "ssemov") (set_attr "prefix" "vex") @@ -19265,7 +19265,7 @@ (const_int 2) (const_int 3)]))) (clobber (match_scratch:VI4F_256 1 "=&x"))] "TARGET_AVX2" - "vgatherq\t{%5, %7, %0|%0, %7, %5}" + "%M3vgatherq\t{%5, %7, %0|%0, %7, %5}" [(set_attr "type" "ssemov") (set_attr "prefix" "vex") (set_attr "mode" "")]) @@ -19288,7 +19288,7 @@ (const_int 2) (const_int 3)]))) (clobber (match_scratch:VI4F_256 1 "=&x"))] "TARGET_AVX2" - "vgatherq\t{%4, %6, %0|%0, %6, %4}" + "%M2vgatherq\t{%4, %6, %0|%0, %6, %4}" [(set_attr "type" "ssemov") (set_attr "prefix" "vex") (set_attr "mode" "")]) @@ -19328,7 +19328,7 @@ "TARGET_AVX512F" ;; %X6 so that we don't emit any *WORD PTR for -masm=intel, as ;; gas changed what it requires incompatibly. - "vgatherd\t{%6, %0%{%2%}|%0%{%2%}, %X6}" + "%M4vgatherd\t{%6, %0%{%2%}|%0%{%2%}, %X6}" [(set_attr "type" "ssemov") (set_attr "prefix" "evex") (set_attr "mode" "")]) @@ -19349,7 +19349,7 @@ "TARGET_AVX512F" ;; %X5 so that we don't emit any *WORD PTR for -masm=intel, as ;; gas changed what it requires incompatibly. - "vgatherd\t{%5, %0%{%1%}|%0%{%1%}, %X5}" + "%M3vgatherd\t{%5, %0%{%1%}|%0%{%1%}, %X5}" [(set_attr "type" "ssemov") (set_attr "prefix" "evex") (set_attr "mode" "")]) @@ -19390,7 +19390,7 @@ "TARGET_AVX512F" ;; %X6 so that we don't emit any *WORD PTR for -masm=intel, as ;; gas changed what it requires incompatibly. - "vgatherq\t{%6, %1%{%2%}|%1%{%2%}, %X6}" + "%M4vgatherq\t{%6, %1%{%2%}|%1%{%2%}, %X6}" [(set_attr "type" "ssemov") (set_attr "prefix" "evex") (set_attr "mode" "")]) @@ -19415,11 +19415,11 @@ if (mode != mode) { if ( != 64) - return "vgatherq\t{%5, %x0%{%1%}|%x0%{%1%}, %X5}"; + return "%M3vgatherq\t{%5, %x0%{%1%}|%x0%{%1%}, %X5}"; else - return "vgatherq\t{%5, %t0%{%1%}|%t0%{%1%}, %X5}"; + return "%M3vgatherq\t{%5, %t0%{%1%}|%t0%{%1%}, %X5}"; } - return "vgatherq\t{%5, %0%{%1%}|%0%{%1%}, %X5}"; + return "%M3vgatherq\t{%5, %0%{%1%}|%0%{%1%}, %X5}"; } [(set_attr "type" "ssemov") (set_attr "prefix" "evex") @@ -19458,7 +19458,7 @@ "TARGET_AVX512F" ;; %X5 so that we don't emit any *WORD PTR for -masm=intel, as ;; gas changed what it requires incompatibly. - "vscatterd\t{%3, %5%{%1%}|%X5%{%1%}, %3}" + "%M0vscatterd\t{%3, %5%{%1%}|%X5%{%1%}, %3}" [(set_attr "type" "ssemov") (set_attr "prefix" "evex") (set_attr "mode" "")]) @@ -19496,7 +19496,7 @@ "TARGET_AVX512F" ;; %X5 so that we don't emit any *WORD PTR for -masm=intel, as ;; gas changed what it requires incompatibly. - "vscatterq\t{%3, %5%{%1%}|%X5%{%1%}, %3}" + "%M0vscatterq\t{%3, %5%{%1%}|%X5%{%1%}, %3}" [(set_attr "type" "ssemov") (set_attr "prefix" "evex") (set_attr "mode" "")]) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index eabac5e7d65..ae7bf8ec416 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,20 @@ +2019-03-17 H.J. Lu + + Backport from mainline + 2019-03-14 H.J. Lu + + PR target/89523 + * gcc.target/i386/pr89523-1a.c: New test. + * gcc.target/i386/pr89523-1b.c: Likewise. + * gcc.target/i386/pr89523-2.c: Likewise. + * gcc.target/i386/pr89523-3.c: Likewise. + * gcc.target/i386/pr89523-4.c: Likewise. + * gcc.target/i386/pr89523-5.c: Likewise. + * gcc.target/i386/pr89523-6.c: Likewise. + * gcc.target/i386/pr89523-7.c: Likewise. + * gcc.target/i386/pr89523-8.c: Likewise. + * gcc.target/i386/pr89523-9.c: Likewise. + 2019-03-16 Thomas Koenig PR fortran/66089 diff --git a/gcc/testsuite/gcc.target/i386/pr89523-1a.c b/gcc/testsuite/gcc.target/i386/pr89523-1a.c new file mode 100644 index 00000000000..0d0edab0363 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr89523-1a.c @@ -0,0 +1,24 @@ +/* { dg-do compile { target { ! ia32 } } } */ +/* { dg-require-effective-target maybe_x32 } */ +/* { dg-options "-maddress-mode=short -mx32 -Ofast -funroll-loops -march=haswell" } */ +/* { dg-final { scan-assembler-not "\tvgather" } } */ +/* { dg-final { scan-assembler "addr32 vgather" } } */ + +void foo (void); + +extern float *ncost; + +float +bar (int type, int num) +{ + int i; + float cost; + + cost = 0; + for (i = 0; i < num; i++) + if (type) + cost += ncost[i]; + else + foo (); + return (cost); +} diff --git a/gcc/testsuite/gcc.target/i386/pr89523-1b.c b/gcc/testsuite/gcc.target/i386/pr89523-1b.c new file mode 100644 index 00000000000..6a5c1d43625 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr89523-1b.c @@ -0,0 +1,7 @@ +/* { dg-do compile { target { ! ia32 } } } */ +/* { dg-require-effective-target maybe_x32 } */ +/* { dg-options "-maddress-mode=long -mx32 -Ofast -funroll-loops -march=haswell" } */ +/* { dg-final { scan-assembler-not "\tvgather" } } */ +/* { dg-final { scan-assembler "addr32 vgather" } } */ + +#include "pr89523-1a.c" diff --git a/gcc/testsuite/gcc.target/i386/pr89523-2.c b/gcc/testsuite/gcc.target/i386/pr89523-2.c new file mode 100644 index 00000000000..2ffbffe5e40 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr89523-2.c @@ -0,0 +1,37 @@ +/* { dg-do compile { target { ! ia32 } } } */ +/* { dg-require-effective-target maybe_x32 } */ +/* { dg-options "-mx32 -O2 -march=haswell" } */ +/* { dg-final { scan-assembler "\tvgather" } } */ +/* { dg-final { scan-assembler-not "addr32 vgather" } } */ + +typedef double __v2df __attribute__ ((__vector_size__ (16))); +typedef int __v4si __attribute__ ((__vector_size__ (16))); +typedef long long __v2di __attribute__ ((__vector_size__ (16))); + +typedef long long __m128i __attribute__ ((__vector_size__ (16), __may_alias__)); +typedef double __m128d __attribute__ ((__vector_size__ (16), __may_alias__)); + +extern __inline __m128d +__attribute__ ((__gnu_inline__, __always_inline__, __artificial__)) +_mm_i32gather_pd (double const *__base, __m128i __index, const int __scale) +{ + __v2df __zero = { 0.0, 0.0 }; + __v2df __mask = __builtin_ia32_cmpeqpd (__zero, __zero); + __v2df x = x; + + return (__m128d) __builtin_ia32_gathersiv2df (x, + __base, + (__v4si)__index, + __mask, + __scale); +} + +__m128d x; +double *base; +__m128i idx; + +void extern +avx2_test (void) +{ + x = _mm_i32gather_pd (base, idx, 1); +} diff --git a/gcc/testsuite/gcc.target/i386/pr89523-3.c b/gcc/testsuite/gcc.target/i386/pr89523-3.c new file mode 100644 index 00000000000..fc3631b694b --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr89523-3.c @@ -0,0 +1,36 @@ +/* { dg-do compile { target { ! ia32 } } } */ +/* { dg-require-effective-target maybe_x32 } */ +/* { dg-options "-mx32 -O2 -march=haswell" } */ +/* { dg-final { scan-assembler "\tvgather" } } */ +/* { dg-final { scan-assembler-not "addr32 vgather" } } */ + +typedef double __v2df __attribute__ ((__vector_size__ (16))); +typedef int __v4si __attribute__ ((__vector_size__ (16))); +typedef long long __v2di __attribute__ ((__vector_size__ (16))); + +typedef long long __m128i __attribute__ ((__vector_size__ (16), __may_alias__)); +typedef double __m128d __attribute__ ((__vector_size__ (16), __may_alias__)); + +extern __inline __m128d +__attribute__ ((__gnu_inline__, __always_inline__, __artificial__)) +_mm_i64gather_pd (double const *__base, __m128i __index, const int __scale) +{ + __v2df __zero = { 0.0, 0.0 }; + __v2df __mask = __builtin_ia32_cmpeqpd (__zero, __zero); + + return (__m128d) __builtin_ia32_gatherdiv2df (__zero, + __base, + (__v2di)__index, + __mask, + __scale); +} + +__m128d x; +double *base; +__m128i idx; + +void extern +avx2_test (void) +{ + x = _mm_i64gather_pd (base, idx, 1); +} diff --git a/gcc/testsuite/gcc.target/i386/pr89523-4.c b/gcc/testsuite/gcc.target/i386/pr89523-4.c new file mode 100644 index 00000000000..3436e5dcae3 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr89523-4.c @@ -0,0 +1,36 @@ +/* { dg-do compile { target { ! ia32 } } } */ +/* { dg-require-effective-target maybe_x32 } */ +/* { dg-options "-mx32 -O2 -march=haswell" } */ +/* { dg-final { scan-assembler-not "\tvgather" } } */ +/* { dg-final { scan-assembler "addr32 vgather" } } */ + +typedef double __v2df __attribute__ ((__vector_size__ (16))); +typedef int __v4si __attribute__ ((__vector_size__ (16))); +typedef long long __v2di __attribute__ ((__vector_size__ (16))); + +typedef long long __m128i __attribute__ ((__vector_size__ (16), __may_alias__)); +typedef double __m128d __attribute__ ((__vector_size__ (16), __may_alias__)); + +extern __inline __m128d +__attribute__ ((__gnu_inline__, __always_inline__, __artificial__)) +_mm_i32gather_pd (double const *__base, __m128i __index, const int __scale) +{ + __v2df __zero = { 0.0, 0.0 }; + __v2df __mask = __builtin_ia32_cmpeqpd (__zero, __zero); + __v2df x = x; + + return (__m128d) __builtin_ia32_gathersiv2df (x, + __base, + (__v4si)__index, + __mask, + __scale); +} + +__m128d x; +__m128i idx; + +void extern +avx2_test (void) +{ + x = _mm_i32gather_pd ((void *) 0, idx, 1); +} diff --git a/gcc/testsuite/gcc.target/i386/pr89523-5.c b/gcc/testsuite/gcc.target/i386/pr89523-5.c new file mode 100644 index 00000000000..6a769c7a249 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr89523-5.c @@ -0,0 +1,39 @@ +/* { dg-do compile { target { ! ia32 } } } */ +/* { dg-require-effective-target maybe_x32 } */ +/* { dg-options "-mx32 -O2 -mavx512pf" } */ +/* { dg-final { scan-assembler "\tvgather" } } */ +/* { dg-final { scan-assembler-not "addr32 vgather" } } */ + +typedef int __v8si __attribute__ ((__vector_size__ (32))); +typedef long long __m256i __attribute__ ((__vector_size__ (32), + __may_alias__)); +typedef unsigned char __mmask8; + +extern __inline void +__attribute__ ((__gnu_inline__, __always_inline__, __artificial__)) +_mm512_prefetch_i32gather_pd (__m256i __index, void const *__addr, + int __scale, int __hint) +{ + __builtin_ia32_gatherpfdpd ((__mmask8) 0xFF, (__v8si) __index, __addr, + __scale, __hint); +} + +extern __inline void +__attribute__ ((__gnu_inline__, __always_inline__, __artificial__)) +_mm512_mask_prefetch_i32gather_pd (__m256i __index, __mmask8 __mask, + void const *__addr, int __scale, int __hint) +{ + __builtin_ia32_gatherpfdpd (__mask, (__v8si) __index, __addr, __scale, + __hint); +} + +volatile __m256i idx; +volatile __mmask8 m8; +void *base; + +void extern +avx512pf_test (void) +{ + _mm512_prefetch_i32gather_pd (idx, base, 8, 3); + _mm512_mask_prefetch_i32gather_pd (idx, m8, base, 8, 3); +} diff --git a/gcc/testsuite/gcc.target/i386/pr89523-6.c b/gcc/testsuite/gcc.target/i386/pr89523-6.c new file mode 100644 index 00000000000..82f795e085c --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr89523-6.c @@ -0,0 +1,38 @@ +/* { dg-do compile { target { ! ia32 } } } */ +/* { dg-require-effective-target maybe_x32 } */ +/* { dg-options "-mx32 -O2 -mavx512pf" } */ +/* { dg-final { scan-assembler-not "\tvgather" } } */ +/* { dg-final { scan-assembler "addr32 vgather" } } */ + +typedef int __v8si __attribute__ ((__vector_size__ (32))); +typedef long long __m256i __attribute__ ((__vector_size__ (32), + __may_alias__)); +typedef unsigned char __mmask8; + +extern __inline void +__attribute__ ((__gnu_inline__, __always_inline__, __artificial__)) +_mm512_prefetch_i32gather_pd (__m256i __index, void const *__addr, + int __scale, int __hint) +{ + __builtin_ia32_gatherpfdpd ((__mmask8) 0xFF, (__v8si) __index, __addr, + __scale, __hint); +} + +extern __inline void +__attribute__ ((__gnu_inline__, __always_inline__, __artificial__)) +_mm512_mask_prefetch_i32gather_pd (__m256i __index, __mmask8 __mask, + void const *__addr, int __scale, int __hint) +{ + __builtin_ia32_gatherpfdpd (__mask, (__v8si) __index, __addr, __scale, + __hint); +} + +volatile __m256i idx; +volatile __mmask8 m8; + +void extern +avx512pf_test (void) +{ + _mm512_prefetch_i32gather_pd (idx, (void *) 0, 8, 3); + _mm512_mask_prefetch_i32gather_pd (idx, m8, (void *) 0, 8, 3); +} diff --git a/gcc/testsuite/gcc.target/i386/pr89523-7.c b/gcc/testsuite/gcc.target/i386/pr89523-7.c new file mode 100644 index 00000000000..030b00d268a --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr89523-7.c @@ -0,0 +1,42 @@ +/* { dg-do compile { target { ! ia32 } } } */ +/* { dg-require-effective-target maybe_x32 } */ +/* { dg-options "-mx32 -O2 -mavx512f" } */ +/* { dg-final { scan-assembler "\tvscatter" } } */ +/* { dg-final { scan-assembler-not "addr32 vscatter" } } */ + +typedef int __v8si __attribute__ ((__vector_size__ (32))); +typedef double __v8df __attribute__ ((__vector_size__ (64))); +typedef long long __m256i __attribute__ ((__vector_size__ (32), + __may_alias__)); +typedef double __m512d __attribute__ ((__vector_size__ (64), __may_alias__)); +typedef unsigned char __mmask8; + +extern __inline void +__attribute__ ((__gnu_inline__, __always_inline__, __artificial__)) +_mm512_i32scatter_pd (void *__addr, __m256i __index, __m512d __v1, + int __scale) +{ + __builtin_ia32_scattersiv8df (__addr, (__mmask8) 0xFF, + (__v8si) __index, (__v8df) __v1, __scale); +} + +extern __inline void +__attribute__ ((__gnu_inline__, __always_inline__, __artificial__)) +_mm512_mask_i32scatter_pd (void *__addr, __mmask8 __mask, + __m256i __index, __m512d __v1, int __scale) +{ + __builtin_ia32_scattersiv8df (__addr, __mask, (__v8si) __index, + (__v8df) __v1, __scale); +} + +volatile __m512d src; +volatile __m256i idx; +volatile __mmask8 m8; +double *addr; + +void extern +avx512f_test (void) +{ + _mm512_i32scatter_pd (addr, idx, src, 8); + _mm512_mask_i32scatter_pd (addr, m8, idx, src, 8); +} diff --git a/gcc/testsuite/gcc.target/i386/pr89523-8.c b/gcc/testsuite/gcc.target/i386/pr89523-8.c new file mode 100644 index 00000000000..465c985c2b7 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr89523-8.c @@ -0,0 +1,41 @@ +/* { dg-do compile { target { ! ia32 } } } */ +/* { dg-require-effective-target maybe_x32 } */ +/* { dg-options "-mx32 -O2 -mavx512f" } */ +/* { dg-final { scan-assembler "\tvscatter" } } */ +/* { dg-final { scan-assembler-not "addr32 vscatter" } } */ + +typedef long long __v8di __attribute__ ((__vector_size__ (64))); +typedef double __v8df __attribute__ ((__vector_size__ (64))); +typedef long long __m512i __attribute__ ((__vector_size__ (64), __may_alias__)); +typedef double __m512d __attribute__ ((__vector_size__ (64), __may_alias__)); +typedef unsigned char __mmask8; + +extern __inline void +__attribute__ ((__gnu_inline__, __always_inline__, __artificial__)) +_mm512_i64scatter_pd (void *__addr, __m512i __index, __m512d __v1, + int __scale) +{ + __builtin_ia32_scatterdiv8df (__addr, (__mmask8) 0xFF, + (__v8di) __index, (__v8df) __v1, __scale); +} + +extern __inline void +__attribute__ ((__gnu_inline__, __always_inline__, __artificial__)) +_mm512_mask_i64scatter_pd (void *__addr, __mmask8 __mask, + __m512i __index, __m512d __v1, int __scale) +{ + __builtin_ia32_scatterdiv8df (__addr, __mask, (__v8di) __index, + (__v8df) __v1, __scale); +} + +volatile __m512d src; +volatile __m512i idx; +volatile __mmask8 m8; +double *addr; + +void extern +avx512f_test (void) +{ + _mm512_i64scatter_pd (addr, idx, src, 8); + _mm512_mask_i64scatter_pd (addr, m8, idx, src, 8); +} diff --git a/gcc/testsuite/gcc.target/i386/pr89523-9.c b/gcc/testsuite/gcc.target/i386/pr89523-9.c new file mode 100644 index 00000000000..e9323126bd6 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr89523-9.c @@ -0,0 +1,30 @@ +/* { dg-do compile { target { ! ia32 } } } */ +/* { dg-require-effective-target maybe_x32 } */ +/* { dg-options "-mx32 -O2 -mavx512f" } */ +/* { dg-final { scan-assembler-not "\tvscatter" } } */ +/* { dg-final { scan-assembler "addr32 vscatter" } } */ + +typedef int __v8si __attribute__ ((__vector_size__ (32))); +typedef double __v8df __attribute__ ((__vector_size__ (64))); +typedef long long __m256i __attribute__ ((__vector_size__ (32), + __may_alias__)); +typedef double __m512d __attribute__ ((__vector_size__ (64), __may_alias__)); +typedef unsigned char __mmask8; + +extern __inline void +__attribute__ ((__gnu_inline__, __always_inline__, __artificial__)) +_mm512_i32scatter_pd (void *__addr, __m256i __index, __m512d __v1, + int __scale) +{ + __builtin_ia32_scattersiv8df (__addr, (__mmask8) 0xFF, + (__v8si) __index, (__v8df) __v1, __scale); +} + +volatile __m512d src; +volatile __m256i idx; + +void extern +avx512f_test (void) +{ + _mm512_i32scatter_pd ((void *) 0, idx, src, 8); +} -- cgit v1.2.3 From d39b29922868b145fd3c828104f13f336cfa73a5 Mon Sep 17 00:00:00 2001 From: Thomas Koenig Date: Sun, 17 Mar 2019 12:45:33 +0000 Subject: 2019-03-17 Thomas Koenig PR fortran/84394 Backport from trunk * symbol.c (gfc_add_subroutine): If we are encountering a subrtoutine within a BLOCK DATA and the name starts with an underscore, do not check. 2019-03-17 Thomas Koenig PR fortran/84394 Backport from trunk * gfortran.dg/blockdata_11.f90: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@269740 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fortran/ChangeLog | 8 ++++++++ gcc/fortran/symbol.c | 10 ++++++++- gcc/testsuite/ChangeLog | 6 ++++++ gcc/testsuite/gfortran.dg/blockdata_11.f90 | 33 ++++++++++++++++++++++++++++++ 4 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gfortran.dg/blockdata_11.f90 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 27f7b562bc1..33472c09cb2 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,11 @@ +2019-03-17 Thomas Koenig + + PR fortran/84394 + Backport from trunk + * symbol.c (gfc_add_subroutine): If we are encountering a + subrtoutine within a BLOCK DATA and the name starts with an + underscore, do not check. + 2019-03-16 Thomas Koenig PR fortran/66089 diff --git a/gcc/fortran/symbol.c b/gcc/fortran/symbol.c index e40e9ac648e..6f4abde48cc 100644 --- a/gcc/fortran/symbol.c +++ b/gcc/fortran/symbol.c @@ -1685,7 +1685,15 @@ gfc_add_subroutine (symbol_attribute *attr, const char *name, locus *where) return false; attr->subroutine = 1; - return check_conflict (attr, name, where); + + /* If we are looking at a BLOCK DATA statement and we encounter a + name with a leading underscore (which must be + compiler-generated), do not check. See PR 84394. */ + + if (name && *name != '_' && gfc_current_state () != COMP_BLOCK_DATA) + return check_conflict (attr, name, where); + else + return true; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ae7bf8ec416..6793a4c817d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2019-03-17 Thomas Koenig + + PR fortran/84394 + Backport from trunk + * gfortran.dg/blockdata_11.f90: New test. + 2019-03-17 H.J. Lu Backport from mainline diff --git a/gcc/testsuite/gfortran.dg/blockdata_11.f90 b/gcc/testsuite/gfortran.dg/blockdata_11.f90 new file mode 100644 index 00000000000..4aee18b7c7a --- /dev/null +++ b/gcc/testsuite/gfortran.dg/blockdata_11.f90 @@ -0,0 +1,33 @@ +! { dg-do run } +! PR 84394 - this used to complain about private procedures in +! BLOCK data. +module mod1 + implicit none + type :: type1 + integer :: i1 + end type type1 +end module + +module mod2 + implicit none + contains + subroutine sub1 + integer vals + common /block1/ vals(5) + if (any(vals /= [1, 2, 3, 4, 5])) stop 1 + end subroutine +end module + +block data blkdat + use mod1 + integer vals + common /block1/ vals(5) + data vals/1, 2, 3, 4, 5/ +end block data blkdat + +program main + use mod2, only: sub1 + implicit none + call sub1 +end program + -- cgit v1.2.3 From adaf626a85a13d48c1ad0961b423eb30242c7d76 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Mon, 18 Mar 2019 00:16:13 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@269748 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index fd621439124..f3597e0747c 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190317 +20190318 -- cgit v1.2.3 From e35f8a9538551fc2a253139f4b15e34d2cfea0db Mon Sep 17 00:00:00 2001 From: Martin Jambor Date: Mon, 18 Mar 2019 11:31:52 +0000 Subject: Add forgotten requeing in propagate_subaccesses_across_link 2019-03-18 Martin Jambor PR tree-optimization/89546 * tree-sra.c (propagate_subaccesses_across_link): Requeue new_acc if any propagation to its children took place. testsuite/ * gcc.dg/tree-ssa/pr89546.c: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@269762 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 9 +++ gcc/testsuite/ChangeLog | 8 +++ gcc/testsuite/gcc.dg/tree-ssa/pr89546.c | 100 ++++++++++++++++++++++++++++++++ gcc/tree-sra.c | 8 ++- 4 files changed, 123 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/pr89546.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 8b716b40712..97c05965df8 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2019-03-18 Martin Jambor + + Backport from mainline + 2019-03-18 Martin Jambor + + PR tree-optimization/89546 + * tree-sra.c (propagate_subaccesses_across_link): Requeue new_acc if + any propagation to its children took place. + 2019-03-17 H.J. Lu Backport from mainline diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 6793a4c817d..e7a735aba17 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2019-03-18 Martin Jambor + + Backport from mainline + 2019-03-18 Martin Jambor + + PR tree-optimization/89546 + * gcc.dg/tree-ssa/pr89546.c: New test. + 2019-03-17 Thomas Koenig PR fortran/84394 diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr89546.c b/gcc/testsuite/gcc.dg/tree-ssa/pr89546.c new file mode 100644 index 00000000000..c4645ae1858 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr89546.c @@ -0,0 +1,100 @@ +/* { dg-do run } */ +/* { dg-options "-O" } */ + +struct I +{ + int i; +}; + +struct A +{ + struct I i1; + struct I i2; + struct I i3; +}; + +struct B +{ + struct I i0; + struct A a; +}; + +struct C +{ + struct I i00; + struct B b; +}; + +volatile int v; + +void __attribute__((noipa)) +consume_i (struct I i) +{ + v = i.i; +} + +void __attribute__((noipa)) +consume_a (struct A a) +{ + v = a.i1.i; +} + +void __attribute__((noipa)) +consume_b (struct B b) +{ + v = b.a.i1.i; +} + +void __attribute__((noipa)) +consume_c (struct C c) +{ + v = c.b.a.i1.i; +} + + + + +int __attribute__((noipa)) +foo (struct I input) +{ + struct I i1, i2, i3; + struct A a1, a2, a3; + struct B b1; + struct C c; + + i1 = input; + a1.i1 = i1; + b1.a = a1; + + i2.i = 1; + b1.i0 = i2; + + c.b = b1; + + a2 = c.b.a; + a3 = a2; + i3 = a3.i1; + + int t = c.b.i0.i; + a2.i3.i = 4; + consume_i (i1); + consume_i (i2); + consume_b (b1); + consume_a (a1); + consume_a (a2); + consume_a (a3); + consume_c (c); + + return i3.i + t; +} + +int +main (int argc, char *argv[]) +{ + struct I s; + s.i = 1234; + int i = foo (s); + if (i != 1235) + __builtin_abort (); + return 0; +} diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c index b513676152f..bb373b33b7a 100644 --- a/gcc/tree-sra.c +++ b/gcc/tree-sra.c @@ -2729,8 +2729,12 @@ propagate_subaccesses_across_link (struct access *lacc, struct access *racc) rchild->grp_hint = 1; new_acc->grp_hint |= new_acc->grp_read; - if (rchild->first_child) - ret |= propagate_subaccesses_across_link (new_acc, rchild); + if (rchild->first_child + && propagate_subaccesses_across_link (new_acc, rchild)) + { + ret = 1; + add_access_to_work_queue (new_acc); + } } else { -- cgit v1.2.3 From f9b0311a566af3ce3fc433e1e212bfd2b25ca339 Mon Sep 17 00:00:00 2001 From: Martin Sebor Date: Mon, 18 Mar 2019 19:44:02 +0000 Subject: Backport from mainline: PR middle-end/88273 - [8/9 Regression] warning: 'memcpy' offset [-527, -529] is out of the bounds [0, 16] gcc/ChangeLog: PR middle-end/88273 * gimple-ssa-warn-restrict.c (builtin_memref::extend_offset_range): Handle anti-ranges the same as no range at all. gcc/testsuite/ChangeLog: PR middle-end/88273 * gcc.dg/Warray-bounds-38.c: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@269778 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 6 ++++++ gcc/gimple-ssa-warn-restrict.c | 6 +----- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/Warray-bounds-38.c | 30 ++++++++++++++++++++++++++++++ 4 files changed, 42 insertions(+), 5 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/Warray-bounds-38.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 97c05965df8..5dea538dddd 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2019-03-18 Martin Sebor + + PR middle-end/88273 + * gimple-ssa-warn-restrict.c (builtin_memref::extend_offset_range): + Handle anti-ranges the same as no range at all. + 2019-03-18 Martin Jambor Backport from mainline diff --git a/gcc/gimple-ssa-warn-restrict.c b/gcc/gimple-ssa-warn-restrict.c index 3d0664da028..8aeefd4077b 100644 --- a/gcc/gimple-ssa-warn-restrict.c +++ b/gcc/gimple-ssa-warn-restrict.c @@ -314,13 +314,9 @@ builtin_memref::extend_offset_range (tree offset) offrange[0] += offset_int::from (min, SIGNED); offrange[1] += offset_int::from (max, SIGNED); } - else if (rng == VR_ANTI_RANGE) - { - offrange[0] += offset_int::from (max + 1, SIGNED); - offrange[1] += offset_int::from (min - 1, SIGNED); - } else { + /* Handle an anti-range the same as no range at all. */ gimple *stmt = SSA_NAME_DEF_STMT (offset); tree type; if (is_gimple_assign (stmt) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e7a735aba17..3079d17eb49 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-03-18 Martin Sebor + + PR middle-end/88273 + * gcc.dg/Warray-bounds-38.c: New test. + 2019-03-18 Martin Jambor Backport from mainline diff --git a/gcc/testsuite/gcc.dg/Warray-bounds-38.c b/gcc/testsuite/gcc.dg/Warray-bounds-38.c new file mode 100644 index 00000000000..c9aa0eb8175 --- /dev/null +++ b/gcc/testsuite/gcc.dg/Warray-bounds-38.c @@ -0,0 +1,30 @@ +/* PR middle-end/88273 - bogus warning: 'memcpy' offset [-527, -529] + is out of the bounds [0, 16] + { dg-do compile } + { dg-options "-O2 -Wall" } */ + +typedef __SIZE_TYPE__ size_t; + +void *q; + +size_t x, y; + +inline void f (char *p, int i, size_t j) +{ + size_t n = y ? y : j; + + p += x - i; + + __builtin_memcpy (q, p, n); /* { dg-bogus "bounds" } */ + + x = n; +} + +void g (void) +{ + struct { char a[16]; } s; + + f (q, 0, sizeof s); + + f (s.a, 33 * sizeof s, 1); +} -- cgit v1.2.3 From 52a2aa0b5a9675cb3976ae8588873f74060a6720 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Tue, 19 Mar 2019 00:16:08 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@269787 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index f3597e0747c..a61f3fcc2bb 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190318 +20190319 -- cgit v1.2.3 From 634e9f1be975f22d52fb21cfe136ddacb8b00b88 Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Tue, 19 Mar 2019 08:10:08 +0000 Subject: PR rtl-optimization/89753 * loop-unroll.c (decide_unroll_constant_iterations): Make guard for explicit unrolling factor even more robust. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@269792 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 6 ++++++ gcc/loop-unroll.c | 2 +- gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/c-c++-common/unroll-7.c | 11 +++++++++++ 4 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/c-c++-common/unroll-7.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 5dea538dddd..b28b67dff3e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2019-03-19 Eric Botcazou + + PR rtl-optimization/89753 + * loop-unroll.c (decide_unroll_constant_iterations): Make guard for + explicit unrolling factor even more robust. + 2019-03-18 Martin Sebor PR middle-end/88273 diff --git a/gcc/loop-unroll.c b/gcc/loop-unroll.c index 4b36e7c44c3..0f50747aa08 100644 --- a/gcc/loop-unroll.c +++ b/gcc/loop-unroll.c @@ -399,7 +399,7 @@ decide_unroll_constant_iterations (struct loop *loop, int flags) { /* However we cannot unroll completely at the RTL level a loop with constant number of iterations; it should have been peeled instead. */ - if ((unsigned) loop->unroll > desc->niter - 1) + if (desc->niter == 0 || (unsigned) loop->unroll > desc->niter - 1) { if (dump_file) fprintf (dump_file, ";; Loop should have been peeled\n"); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 3079d17eb49..b09ab29afff 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2019-03-19 Eric Botcazou + + * c-c++-common/unroll-7.c: New test. + 2019-03-18 Martin Sebor PR middle-end/88273 diff --git a/gcc/testsuite/c-c++-common/unroll-7.c b/gcc/testsuite/c-c++-common/unroll-7.c new file mode 100644 index 00000000000..8332e9f983c --- /dev/null +++ b/gcc/testsuite/c-c++-common/unroll-7.c @@ -0,0 +1,11 @@ +/* { dg-do compile } */ +/* { dg-options "-O -fno-tree-dominator-opts" } */ + +int nv; + +void test (void) +{ + #pragma GCC unroll 2 + for (nv = 0; nv < 1; ++nv) + {} +} -- cgit v1.2.3 From abace883e86ee9bd1fdd9e1c7ddc657e8d6cc241 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Tue, 19 Mar 2019 17:46:22 +0000 Subject: 2019-03-19 Richard Biener PR debug/88389 * opts.c (finish_options): Disable -gsplit-dwarf when doing LTO. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@269808 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 5 +++++ gcc/opts.c | 8 ++++++++ 2 files changed, 13 insertions(+) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b28b67dff3e..b46e6c2cff1 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2019-03-19 Richard Biener + + PR debug/88389 + * opts.c (finish_options): Disable -gsplit-dwarf when doing LTO. + 2019-03-19 Eric Botcazou PR rtl-optimization/89753 diff --git a/gcc/opts.c b/gcc/opts.c index 442f250f3af..28030881e93 100644 --- a/gcc/opts.c +++ b/gcc/opts.c @@ -922,6 +922,14 @@ finish_options (struct gcc_options *opts, struct gcc_options *opts_set, "linker plugin"); opts->x_flag_fat_lto_objects = 1; } + + /* -gsplit-dwarf isn't compatible with LTO, see PR88389. */ + if (opts->x_dwarf_split_debug_info) + { + inform (loc, "%<-gsplit-dwarf%> is not supported with LTO," + " disabling"); + opts->x_dwarf_split_debug_info = 0; + } } /* We initialize opts->x_flag_split_stack to -1 so that targets can set a -- cgit v1.2.3 From 334ee664dcf05cac6e136323ceae4aca6ef7fb28 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Wed, 20 Mar 2019 00:16:12 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@269816 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index a61f3fcc2bb..0031c11d12f 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190319 +20190320 -- cgit v1.2.3 From 2a177cb23e2f4df7d5927cba7cf24ab07bcfcb01 Mon Sep 17 00:00:00 2001 From: Florian Weimer Date: Wed, 20 Mar 2019 10:42:35 +0000 Subject: PR libgcc/60790: x86: Do not assume ELF constructors run before IFUNC resolvers * config/x86/host-config.h (libat_feat1_ecx, libat_feat1_edx): Remove declarations. (__libat_feat1, __libat_feat1_init): Declare. (FEAT1_REGISTER): Define. (load_feat1): New function. (IFUNC_COND_1): Adjust. * config/x86/init.c (libat_feat1_ecx, libat_feat1_edx) (init_cpuid): Remove definitions. (__libat_feat1): New variable. (__libat_feat1_init): New function. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@269818 138bc75d-0d04-0410-961f-82ee72b054a4 --- libatomic/ChangeLog | 15 +++++++++++++++ libatomic/config/x86/host-config.h | 34 ++++++++++++++++++++++++++++++---- libatomic/config/x86/init.c | 14 +++++++++----- 3 files changed, 54 insertions(+), 9 deletions(-) diff --git a/libatomic/ChangeLog b/libatomic/ChangeLog index 6c5e7fb5c11..e2f3a1e69a9 100644 --- a/libatomic/ChangeLog +++ b/libatomic/ChangeLog @@ -1,3 +1,18 @@ +2019-03-20 Florian Weimer + + PR libgcc/60790 + x86: Do not assume ELF constructors run before IFUNC resolvers. + * config/x86/host-config.h (libat_feat1_ecx, libat_feat1_edx): + Remove declarations. + (__libat_feat1, __libat_feat1_init): Declare. + (FEAT1_REGISTER): Define. + (load_feat1): New function. + (IFUNC_COND_1): Adjust. + * config/x86/init.c (libat_feat1_ecx, libat_feat1_edx) + (init_cpuid): Remove definitions. + (__libat_feat1): New variable. + (__libat_feat1_init): New function. + 2019-02-22 Release Manager * GCC 8.3.0 released. diff --git a/libatomic/config/x86/host-config.h b/libatomic/config/x86/host-config.h index 4a9ab4a6d94..0b6c33862ec 100644 --- a/libatomic/config/x86/host-config.h +++ b/libatomic/config/x86/host-config.h @@ -25,13 +25,39 @@ #if HAVE_IFUNC #include -extern unsigned int libat_feat1_ecx HIDDEN; -extern unsigned int libat_feat1_edx HIDDEN; +#ifdef __x86_64__ +# define FEAT1_REGISTER ecx +#else +# define FEAT1_REGISTER edx +#endif + +/* Value of the CPUID feature register FEAT1_REGISTER for the cmpxchg + bit for IFUNC_COND1 below. */ +extern unsigned int __libat_feat1 HIDDEN; + +/* Initialize libat_feat1 and return its value. */ +unsigned int __libat_feat1_init (void) HIDDEN; + +/* Return the value of the relevant feature register for the relevant + cmpxchg bit, or 0 if there is no CPUID support. */ +static inline unsigned int +__attribute__ ((const)) +load_feat1 (void) +{ + /* See the store in __libat_feat1_init. */ + unsigned int feat1 = __atomic_load_n (&__libat_feat1, __ATOMIC_RELAXED); + if (feat1 == 0) + /* Assume that initialization has not happened yet. This may get + called repeatedly if the CPU does not have any feature bits at + all. */ + feat1 = __libat_feat1_init (); + return feat1; +} #ifdef __x86_64__ -# define IFUNC_COND_1 (libat_feat1_ecx & bit_CMPXCHG16B) +# define IFUNC_COND_1 (load_feat1 () & bit_CMPXCHG16B) #else -# define IFUNC_COND_1 (libat_feat1_edx & bit_CMPXCHG8B) +# define IFUNC_COND_1 (load_feat1 () & bit_CMPXCHG8B) #endif #ifdef __x86_64__ diff --git a/libatomic/config/x86/init.c b/libatomic/config/x86/init.c index 8b9ccd3b3de..5a4cf8b0456 100644 --- a/libatomic/config/x86/init.c +++ b/libatomic/config/x86/init.c @@ -26,13 +26,17 @@ #if HAVE_IFUNC -unsigned int libat_feat1_ecx, libat_feat1_edx; +unsigned int __libat_feat1; -static void __attribute__((constructor)) -init_cpuid (void) +unsigned int +__libat_feat1_init (void) { - unsigned int eax, ebx; - __get_cpuid (1, &eax, &ebx, &libat_feat1_ecx, &libat_feat1_edx); + unsigned int eax, ebx, ecx, edx; + FEAT1_REGISTER = 0; + __get_cpuid (1, &eax, &ebx, &ecx, &edx); + /* See the load in load_feat1. */ + __atomic_store_n (&__libat_feat1, FEAT1_REGISTER, __ATOMIC_RELAXED); + return FEAT1_REGISTER; } #endif /* HAVE_IFUNC */ -- cgit v1.2.3 From ac2809b8dd51c1991eaa8af0929b3e3411b73364 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Thu, 21 Mar 2019 00:16:08 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@269830 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 0031c11d12f..eba1dd04719 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190320 +20190321 -- cgit v1.2.3 From 16d7d88caf23e9af730dc1732d4449dc0beca2ad Mon Sep 17 00:00:00 2001 From: Bill Schmidt Date: Thu, 21 Mar 2019 17:04:54 +0000 Subject: 2019-03-21 Bill Schmidt Backport from mainline 2019-03-08 Bill Schmidt * config/rs6000/rs6000-p8swap.c (rs6000_analyze_swaps): Rebuild ud- and du-chains between phases. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@269842 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 8 ++++++++ gcc/config/rs6000/rs6000-p8swap.c | 7 +++++++ 2 files changed, 15 insertions(+) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b46e6c2cff1..f97a6d173c2 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2019-03-21 Bill Schmidt + + Backport from mainline + 2019-03-08 Bill Schmidt + + * config/rs6000/rs6000-p8swap.c (rs6000_analyze_swaps): Rebuild + ud- and du-chains between phases. + 2019-03-19 Richard Biener PR debug/88389 diff --git a/gcc/config/rs6000/rs6000-p8swap.c b/gcc/config/rs6000/rs6000-p8swap.c index 071bc0c187d..3ba5ebae17f 100644 --- a/gcc/config/rs6000/rs6000-p8swap.c +++ b/gcc/config/rs6000/rs6000-p8swap.c @@ -2317,7 +2317,14 @@ rs6000_analyze_swaps (function *fun) /* Pre-pass to recombine lvx and stvx patterns so we don't lose info. */ recombine_lvx_stvx_patterns (fun); + + /* Rebuild ud- and du-chains. */ + df_remove_problem (df_chain); df_process_deferred_rescans (); + df_set_flags (DF_RD_PRUNE_DEAD_DEFS); + df_chain_add_problem (DF_DU_CHAIN | DF_UD_CHAIN); + df_analyze (); + df_set_flags (DF_DEFER_INSN_RESCAN); /* Allocate structure to represent webs of insns. */ insn_entry = XCNEWVEC (swap_web_entry, get_max_uid ()); -- cgit v1.2.3 From 5acf37c0187d043b130be06f957ff18c2cf2c801 Mon Sep 17 00:00:00 2001 From: Thomas Schwinge Date: Thu, 21 Mar 2019 18:57:39 +0000 Subject: [testsuite, Fortran] Consistently set 'DEFAULT_FFLAGS' In the same 'runtest' instance, 'global' variables persist from one '*.exp' file to another. All other '*.exp' files are using " -pedantic-errors" instead of the empty string as the default for 'DEFAULT_FFLAGS'. Thus this setting of 'DEFAULT_FFLAGS' is not idempotent, depends on whether 'gfortran.dg/ieee/ieee.exp', or an other defining '*.exp' file is executed first. gcc/testsuite/ PR fortran/29383 * gfortran.dg/ieee/ieee.exp (DEFAULT_FFLAGS): Set the same as in other '*.exp' files. trunk r269845 git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@269846 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/testsuite/ChangeLog | 6 ++++++ gcc/testsuite/gfortran.dg/ieee/ieee.exp | 10 +++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b09ab29afff..9aa82da9a4a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2019-03-21 Thomas Schwinge + + PR fortran/29383 + * gfortran.dg/ieee/ieee.exp (DEFAULT_FFLAGS): Set the same as in + other '*.exp' files. + 2019-03-19 Eric Botcazou * c-c++-common/unroll-7.c: New test. diff --git a/gcc/testsuite/gfortran.dg/ieee/ieee.exp b/gcc/testsuite/gfortran.dg/ieee/ieee.exp index 987ecaf4bcd..2ccf2493dc4 100644 --- a/gcc/testsuite/gfortran.dg/ieee/ieee.exp +++ b/gcc/testsuite/gfortran.dg/ieee/ieee.exp @@ -22,15 +22,15 @@ load_lib gfortran-dg.exp load_lib target-supports.exp -# Initialize `dg'. -dg-init - -# Flags specified in each test +# If a testcase doesn't have special options, use these. global DEFAULT_FFLAGS if ![info exists DEFAULT_FFLAGS] then { - set DEFAULT_FFLAGS "" + set DEFAULT_FFLAGS " -pedantic-errors" } +# Initialize `dg'. +dg-init + # Flags for finding the IEEE modules if [info exists TOOL_OPTIONS] { set specpath [get_multilibs ${TOOL_OPTIONS}] -- cgit v1.2.3 From e378fc4774b6dd3fbc6b4d3b891eec1afb68fdbd Mon Sep 17 00:00:00 2001 From: Thomas Schwinge Date: Thu, 21 Mar 2019 19:16:54 +0000 Subject: [testsuite, Fortran] Apply DejaGnu 1.4.4 work-around also to 'gfortran.dg/coarray/caf.exp:dg-compile-aux-modules' See trunk r215293. This unifies all 'dg-compile-aux-modules' instances. gcc/testsuite/ PR fortran/56408 * gfortran.dg/coarray/caf.exp (dg-compile-aux-modules): Workaround missing nexted dg-test call support in dejaGNU 1.4.4. trunk r269848 git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@269849 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/gfortran.dg/coarray/caf.exp | 12 +++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 9aa82da9a4a..38982cf82f4 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,9 @@ 2019-03-21 Thomas Schwinge + PR fortran/56408 + * gfortran.dg/coarray/caf.exp (dg-compile-aux-modules): Workaround + missing nexted dg-test call support in dejaGNU 1.4.4. + PR fortran/29383 * gfortran.dg/ieee/ieee.exp (DEFAULT_FFLAGS): Set the same as in other '*.exp' files. diff --git a/gcc/testsuite/gfortran.dg/coarray/caf.exp b/gcc/testsuite/gfortran.dg/coarray/caf.exp index d1a7a56970f..f7f57f4477f 100644 --- a/gcc/testsuite/gfortran.dg/coarray/caf.exp +++ b/gcc/testsuite/gfortran.dg/coarray/caf.exp @@ -54,8 +54,18 @@ proc dg-compile-aux-modules { args } { error "dg-set-target-env-var: needs one argument" return } + + set level [info level] + if { [info procs dg-save-unknown] != [list] } { + rename dg-save-unknown dg-save-unknown-level-$level + } + dg-test $gfortran_test_path/[lindex $args 1] "" $gfortran_aux_module_flags - # cleanup-modules isn't intentionally invoked here. + # cleanup-modules is intentionally not invoked here. + + if { [info procs dg-save-unknown-level-$level] != [list] } { + rename dg-save-unknown-level-$level dg-save-unknown + } } # Add -latomic only where supported. Assume built-in support elsewhere. -- cgit v1.2.3 From 7747d01aeb8952ed35332855dd771ecfac207a41 Mon Sep 17 00:00:00 2001 From: Thomas Schwinge Date: Thu, 21 Mar 2019 19:31:09 +0000 Subject: [testsuite] Fix 'dg-compile-aux-modules' diagnostic gcc/testsuite/ PR fortran/56408 * gcc.target/powerpc/ppc-fortran/ppc-fortran.exp (dg-compile-aux-modules): Fix diagnostic. * gfortran.dg/coarray/caf.exp (dg-compile-aux-modules): Likewise. * gfortran.dg/dg.exp (dg-compile-aux-modules): Likewise. trunk r269851 git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@269852 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/testsuite/ChangeLog | 6 ++++++ gcc/testsuite/gcc.target/powerpc/ppc-fortran/ppc-fortran.exp | 2 +- gcc/testsuite/gfortran.dg/coarray/caf.exp | 2 +- gcc/testsuite/gfortran.dg/dg.exp | 2 +- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 38982cf82f4..fb11208d2c8 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,11 @@ 2019-03-21 Thomas Schwinge + PR fortran/56408 + * gcc.target/powerpc/ppc-fortran/ppc-fortran.exp + (dg-compile-aux-modules): Fix diagnostic. + * gfortran.dg/coarray/caf.exp (dg-compile-aux-modules): Likewise. + * gfortran.dg/dg.exp (dg-compile-aux-modules): Likewise. + PR fortran/56408 * gfortran.dg/coarray/caf.exp (dg-compile-aux-modules): Workaround missing nexted dg-test call support in dejaGNU 1.4.4. diff --git a/gcc/testsuite/gcc.target/powerpc/ppc-fortran/ppc-fortran.exp b/gcc/testsuite/gcc.target/powerpc/ppc-fortran/ppc-fortran.exp index aa819915382..73138db3005 100644 --- a/gcc/testsuite/gcc.target/powerpc/ppc-fortran/ppc-fortran.exp +++ b/gcc/testsuite/gcc.target/powerpc/ppc-fortran/ppc-fortran.exp @@ -36,7 +36,7 @@ proc dg-compile-aux-modules { args } { global gfortran_test_path global gfortran_aux_module_flags if { [llength $args] != 2 } { - error "dg-set-target-env-var: needs one argument" + error "dg-compile-aux-modules: needs one argument" return } diff --git a/gcc/testsuite/gfortran.dg/coarray/caf.exp b/gcc/testsuite/gfortran.dg/coarray/caf.exp index f7f57f4477f..3a9d3e0717e 100644 --- a/gcc/testsuite/gfortran.dg/coarray/caf.exp +++ b/gcc/testsuite/gfortran.dg/coarray/caf.exp @@ -51,7 +51,7 @@ proc dg-compile-aux-modules { args } { global gfortran_test_path global gfortran_aux_module_flags if { [llength $args] != 2 } { - error "dg-set-target-env-var: needs one argument" + error "dg-compile-aux-modules: needs one argument" return } diff --git a/gcc/testsuite/gfortran.dg/dg.exp b/gcc/testsuite/gfortran.dg/dg.exp index aa819915382..73138db3005 100644 --- a/gcc/testsuite/gfortran.dg/dg.exp +++ b/gcc/testsuite/gfortran.dg/dg.exp @@ -36,7 +36,7 @@ proc dg-compile-aux-modules { args } { global gfortran_test_path global gfortran_aux_module_flags if { [llength $args] != 2 } { - error "dg-set-target-env-var: needs one argument" + error "dg-compile-aux-modules: needs one argument" return } -- cgit v1.2.3 From dfbda5f9764604873233e69bcfb1a9905bb2c0d3 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Fri, 22 Mar 2019 00:16:11 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@269865 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index eba1dd04719..3f42a52ff9b 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190321 +20190322 -- cgit v1.2.3 From 0cc41fb85488edb92e55f3e48c8165cad017fa59 Mon Sep 17 00:00:00 2001 From: Bill Schmidt Date: Fri, 22 Mar 2019 13:58:10 +0000 Subject: [gcc] 2019-03-22 Backport from mainline 2019-03-22 Bill Schmidt * config/rs6000/mmintrin.h (_mm_sub_pi32): Fix typo. [gcc/testsuite] 2019-03-22 Backport from mainline 2019-03-22 Bill Schmidt * gcc.target/powerpc/mmx-psubd-2.c: Test _m_psubd. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@269872 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 6 ++++++ gcc/config/rs6000/mmintrin.h | 2 +- gcc/testsuite/ChangeLog | 6 ++++++ gcc/testsuite/gcc.target/powerpc/mmx-psubd-2.c | 14 +++++++++++--- 4 files changed, 24 insertions(+), 4 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f97a6d173c2..20cbee10652 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2019-03-22 Backport from mainline + + 2019-03-22 Bill Schmidt + + * config/rs6000/mmintrin.h (_mm_sub_pi32): Fix typo. + 2019-03-21 Bill Schmidt Backport from mainline diff --git a/gcc/config/rs6000/mmintrin.h b/gcc/config/rs6000/mmintrin.h index b15dd9bf242..497ecdf7895 100644 --- a/gcc/config/rs6000/mmintrin.h +++ b/gcc/config/rs6000/mmintrin.h @@ -581,7 +581,7 @@ _mm_sub_pi32 (__m64 __m1, __m64 __m2) extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__)) _m_psubd (__m64 __m1, __m64 __m2) { - return _mm_add_pi32 (__m1, __m2); + return _mm_sub_pi32 (__m1, __m2); } extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__)) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index fb11208d2c8..d50fb9f71a4 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2019-03-22 Backport from mainline + + 2019-03-22 Bill Schmidt + + * gcc.target/powerpc/mmx-psubd-2.c: Test _m_psubd. + 2019-03-21 Thomas Schwinge PR fortran/56408 diff --git a/gcc/testsuite/gcc.target/powerpc/mmx-psubd-2.c b/gcc/testsuite/gcc.target/powerpc/mmx-psubd-2.c index 3260f611748..a823fe38e1f 100644 --- a/gcc/testsuite/gcc.target/powerpc/mmx-psubd-2.c +++ b/gcc/testsuite/gcc.target/powerpc/mmx-psubd-2.c @@ -23,20 +23,28 @@ test (__m64 s1, __m64 s2) return _mm_sub_pi32 (s1, s2); } +static __m64 +__attribute__((noinline, unused)) +test_alias (__m64 s1, __m64 s2) +{ + return _m_psubd (s1, s2); +} + static void TEST (void) { __m64_union u, s1, s2; - __m64_union e; + __m64_union e, v; int i; s1.as_m64 = _mm_setr_pi32 (30, 90); s2.as_m64 = _mm_setr_pi32 (76, -100); u.as_m64 = test (s1.as_m64, s2.as_m64); - + v.as_m64 = test_alias (s1.as_m64, s2.as_m64); + for (i = 0; i < 2; i++) e.as_int[i] = s1.as_int[i] - s2.as_int[i]; - if (u.as_m64 != e.as_m64) + if (u.as_m64 != e.as_m64 || u.as_m64 != v.as_m64) abort (); } -- cgit v1.2.3 From 30e8167f21da357ca0eca45bb3c4ffc4e5d044d2 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Sat, 23 Mar 2019 00:16:21 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@269884 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 3f42a52ff9b..4c7a5ab393e 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190322 +20190323 -- cgit v1.2.3 From 7064019e7494cdaf5cbf6ac869137b5990851893 Mon Sep 17 00:00:00 2001 From: Thomas Koenig Date: Sat, 23 Mar 2019 15:58:25 +0000 Subject: 2019-03-23 Thomas Koenig PR fortran/68009 Backport from trunk * iresolve.c: Include trans.h. (gfc_resolve_fe_runtine_error): Set backend_decl on resolved_sym. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@269889 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fortran/ChangeLog | 8 ++++++++ gcc/fortran/iresolve.c | 5 +++++ 2 files changed, 13 insertions(+) diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 33472c09cb2..1d35ed72786 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,11 @@ +2019-03-23 Thomas Koenig + + PR fortran/68009 + Backport from trunk + * iresolve.c: Include trans.h. + (gfc_resolve_fe_runtine_error): Set backend_decl on + resolved_sym. + 2019-03-17 Thomas Koenig PR fortran/84394 diff --git a/gcc/fortran/iresolve.c b/gcc/fortran/iresolve.c index f15b8f2773a..7e70a061acd 100644 --- a/gcc/fortran/iresolve.c +++ b/gcc/fortran/iresolve.c @@ -35,6 +35,7 @@ along with GCC; see the file COPYING3. If not see #include "intrinsic.h" #include "constructor.h" #include "arith.h" +#include "trans.h" /* Given printf-like arguments, return a stable version of the result string. @@ -2377,6 +2378,10 @@ gfc_resolve_fe_runtime_error (gfc_code *c) a->name = "%VAL"; c->resolved_sym = gfc_get_intrinsic_sub_symbol (name); + /* We set the backend_decl here because runtime_error is a + variadic function and we would use the wrong calling + convention otherwise. */ + c->resolved_sym->backend_decl = gfor_fndecl_runtime_error; } void -- cgit v1.2.3 From 4980c66c44510305bdb8d0f2ba0ae329e3340f6a Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Sun, 24 Mar 2019 00:16:11 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@269893 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 4c7a5ab393e..5f9e8270d45 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190323 +20190324 -- cgit v1.2.3 From 27a153a2fdd1eebc7efb4ae187bd7cf4b8727d56 Mon Sep 17 00:00:00 2001 From: Janus Weil Date: Sun, 24 Mar 2019 18:08:10 +0000 Subject: fix PR 71861 2019-03-24 Janus Weil PR fortran/71861 * symbol.c (check_conflict): ABSTRACT attribute conflicts with INTRINSIC attribute. 2019-03-24 Janus Weil PR fortran/71861 * gfortran.dg/interface_abstract_5.f90: New test case. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@269898 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fortran/ChangeLog | 7 +++++ gcc/fortran/symbol.c | 1 + gcc/testsuite/ChangeLog | 6 ++++ gcc/testsuite/gfortran.dg/interface_abstract_5.f90 | 32 ++++++++++++++++++++++ 4 files changed, 46 insertions(+) create mode 100644 gcc/testsuite/gfortran.dg/interface_abstract_5.f90 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 1d35ed72786..5acbd8e84f4 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,10 @@ +2019-03-24 Janus Weil + + PR fortran/71861 + Backport from trunk + * symbol.c (check_conflict): ABSTRACT attribute conflicts with + INTRINSIC attribute. + 2019-03-23 Thomas Koenig PR fortran/68009 diff --git a/gcc/fortran/symbol.c b/gcc/fortran/symbol.c index 6f4abde48cc..e783319298c 100644 --- a/gcc/fortran/symbol.c +++ b/gcc/fortran/symbol.c @@ -554,6 +554,7 @@ check_conflict (symbol_attribute *attr, const char *name, locus *where) conf (external, intrinsic); conf (entry, intrinsic); + conf (abstract, intrinsic); if ((attr->if_source == IFSRC_DECL && !attr->procedure) || attr->contained) conf (external, subroutine); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index d50fb9f71a4..bdc471dc14b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2019-03-24 Janus Weil + + PR fortran/71861 + Backport from trunk + * gfortran.dg/interface_abstract_5.f90: New test case. + 2019-03-22 Backport from mainline 2019-03-22 Bill Schmidt diff --git a/gcc/testsuite/gfortran.dg/interface_abstract_5.f90 b/gcc/testsuite/gfortran.dg/interface_abstract_5.f90 new file mode 100644 index 00000000000..fddf6b89d27 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/interface_abstract_5.f90 @@ -0,0 +1,32 @@ +! { dg-do compile } +! +! PR 71861: [7/8/9 Regression] [F03] ICE in write_symbol(): bad module symbol +! +! Contributed by Gerhard Steinmetz + +module m1 + intrinsic abs + abstract interface + function abs(x) ! { dg-error "ABSTRACT attribute conflicts with INTRINSIC attribute" } + real :: abs, x + end + end interface +end + +module m2 + abstract interface + function abs(x) + real :: abs, x + end + end interface + intrinsic abs ! { dg-error "ABSTRACT attribute conflicts with INTRINSIC attribute" } +end + +module m3 + abstract interface + function f(x) + real :: f, x + end + end interface + intrinsic f ! { dg-error "ABSTRACT attribute conflicts with INTRINSIC attribute" } +end -- cgit v1.2.3 From c621459ad6b78102956a8e1f57b37263d88db4fc Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Mon, 25 Mar 2019 00:16:37 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@269904 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 5f9e8270d45..29c4ead2e15 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190324 +20190325 -- cgit v1.2.3 From 6b41b1875ceb510bbb8019b37485bb37120311af Mon Sep 17 00:00:00 2001 From: Andreas Krebbel Date: Mon, 25 Mar 2019 10:18:57 +0000 Subject: S/390: Fix PR89775. Stackpointer save/restore instructions removed Even if a global register is being clobbered in a function we usually do not save and restore it. However, we still have to do this if it is a special register. Most of the places in the backend handle this correctly but not the prologue/epilogue optimization. gcc/ChangeLog: 2019-03-25 Andreas Krebbel Backport from mainline 2019-03-20 Andreas Krebbel PR target/89775 * config/s390/s390.c (global_not_special_regno_p): Move to make it available to ... (s390_optimize_register_info): Use global_not_special_regno_p to check for global regs. 2019-03-25 Andreas Krebbel Backport from mainline 2019-03-20 Jakub Jelinek PR target/89775 * gcc.target/s390/pr89775-1.c: New test. * gcc.target/s390/pr89775-2.c: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@269910 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 14 ++++++++++++- gcc/config/s390/s390.c | 34 ++++++++++++++++--------------- gcc/testsuite/ChangeLog | 9 ++++++++ gcc/testsuite/gcc.target/s390/pr89775-1.c | 17 ++++++++++++++++ gcc/testsuite/gcc.target/s390/pr89775-2.c | 25 +++++++++++++++++++++++ 5 files changed, 82 insertions(+), 17 deletions(-) create mode 100644 gcc/testsuite/gcc.target/s390/pr89775-1.c create mode 100644 gcc/testsuite/gcc.target/s390/pr89775-2.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 20cbee10652..f0bd6c2f046 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,17 @@ -2019-03-22 Backport from mainline +2019-03-25 Andreas Krebbel + Backport from mainline + 2019-03-20 Andreas Krebbel + + PR target/89775 + * config/s390/s390.c (global_not_special_regno_p): Move to make it + available to ... + (s390_optimize_register_info): Use global_not_special_regno_p to + check for global regs. + +2019-03-22 Bill Schmidt + + Backport from mainline 2019-03-22 Bill Schmidt * config/rs6000/mmintrin.h (_mm_sub_pi32): Fix typo. diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c index f2b6676cd0f..9e7fd2b04dd 100644 --- a/gcc/config/s390/s390.c +++ b/gcc/config/s390/s390.c @@ -10112,6 +10112,21 @@ s390_register_info () s390_register_info_stdarg_gpr (); } +/* Return true if REGNO is a global register, but not one + of the special ones that need to be saved/restored in anyway. */ + +static inline bool +global_not_special_regno_p (int regno) +{ + return (global_regs[regno] + /* These registers are special and need to be + restored in any case. */ + && !(regno == STACK_POINTER_REGNUM + || regno == RETURN_REGNUM + || regno == BASE_REGNUM + || (flag_pic && regno == (int)PIC_OFFSET_TABLE_REGNUM))); +} + /* This function is called by s390_optimize_prologue in order to get rid of unnecessary GPR save/restore instructions. The register info for the GPRs is re-computed and the ranges are re-calculated. */ @@ -10127,8 +10142,10 @@ s390_optimize_register_info () s390_regs_ever_clobbered (clobbered_regs); + /* Global registers do not need to be saved and restored unless it + is one of our special regs. (r12, r13, r14, or r15). */ for (i = 0; i < 32; i++) - clobbered_regs[i] = clobbered_regs[i] && !global_regs[i]; + clobbered_regs[i] = clobbered_regs[i] && !global_not_special_regno_p (i); /* There is still special treatment needed for cases invisible to s390_regs_ever_clobbered. */ @@ -10882,21 +10899,6 @@ restore_fpr (rtx base, int offset, int regnum) return emit_move_insn (gen_rtx_REG (DFmode, regnum), addr); } -/* Return true if REGNO is a global register, but not one - of the special ones that need to be saved/restored in anyway. */ - -static inline bool -global_not_special_regno_p (int regno) -{ - return (global_regs[regno] - /* These registers are special and need to be - restored in any case. */ - && !(regno == STACK_POINTER_REGNUM - || regno == RETURN_REGNUM - || regno == BASE_REGNUM - || (flag_pic && regno == (int)PIC_OFFSET_TABLE_REGNUM))); -} - /* Generate insn to save registers FIRST to LAST into the register save area located at offset OFFSET relative to register BASE. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index bdc471dc14b..6a74e8f153b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,12 @@ +2019-03-25 Andreas Krebbel + + Backport from mainline + 2019-03-20 Jakub Jelinek + + PR target/89775 + * gcc.target/s390/pr89775-1.c: New test. + * gcc.target/s390/pr89775-2.c: New test. + 2019-03-24 Janus Weil PR fortran/71861 diff --git a/gcc/testsuite/gcc.target/s390/pr89775-1.c b/gcc/testsuite/gcc.target/s390/pr89775-1.c new file mode 100644 index 00000000000..2c0f6fd1f9b --- /dev/null +++ b/gcc/testsuite/gcc.target/s390/pr89775-1.c @@ -0,0 +1,17 @@ +/* PR target/89775 */ +/* { dg-do run } */ +/* { dg-options "-O0 -fomit-frame-pointer" } */ +/* { dg-additional-sources "pr89775-2.c" } */ + +register void *sp __asm ("15"); + +__attribute__((noipa)) int +foo (const char *a, const char *b) +{ + while (1) + { + char c = *a++; + if (c != *b++) return 0; + if (c == '\0') return 1; + } +} diff --git a/gcc/testsuite/gcc.target/s390/pr89775-2.c b/gcc/testsuite/gcc.target/s390/pr89775-2.c new file mode 100644 index 00000000000..645661e5852 --- /dev/null +++ b/gcc/testsuite/gcc.target/s390/pr89775-2.c @@ -0,0 +1,25 @@ +/* PR target/89775 */ +/* { dg-do compile } */ + +extern int foo (const char *, const char *); + +__attribute__((noipa)) void +bar (const char *p) +{ + static const char *x; + if (!x) + x = p; + else if (p != x) + __builtin_abort (); +} + +int +main () +{ + char a[8] = "abcdefg"; + bar (a); + if (foo (a, a) != 1) + __builtin_abort (); + bar (a); + return 0; +} -- cgit v1.2.3 From 36e538ef046cc4ed4a8e2cbc19b8028471c2fee8 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Tue, 26 Mar 2019 00:16:15 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@269930 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 29c4ead2e15..a86bdf762f9 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190325 +20190326 -- cgit v1.2.3 From d8bba9a58837c4fe73e4b44ed82f8981aa573b86 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Wed, 27 Mar 2019 00:16:11 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@269957 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index a86bdf762f9..d24d5be9372 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190326 +20190327 -- cgit v1.2.3 From d7582ad5a9b54148aad6c448037a4109e87a7762 Mon Sep 17 00:00:00 2001 From: Uros Bizjak Date: Wed, 27 Mar 2019 19:14:35 +0000 Subject: PR target/89827 * config/i386/i386.c (dimode_scalar_chain::convert_reg): Also process XEXP (src, 0) of a shift insn. testsuite/ChangeLog: PR target/89827 * gcc.target/i386/pr89827.c: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@269975 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 8 +++++++- gcc/config/i386/i386.c | 1 + gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.target/i386/pr89827.c | 11 +++++++++++ 4 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.target/i386/pr89827.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f0bd6c2f046..b1da0334239 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2019-03-26 Uroš Bizjak + + PR target/89827 + * config/i386/i386.c (dimode_scalar_chain::convert_reg): + Also process XEXP (src, 0) of a shift insn. + 2019-03-25 Andreas Krebbel Backport from mainline @@ -951,7 +957,7 @@ Backport from mainline 2018-11-20 Richard Biener - + PR tree-optimization/88105 * tree-ssa-dom.c (pass_dominator::execute): Do not walk backedges. diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index b5a47dd6682..c03e9f04f22 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -2006,6 +2006,7 @@ dimode_scalar_chain::convert_reg (unsigned regno) emit_insn_before (seq, insn); + XEXP (src, 0) = replace_with_subreg (XEXP (src, 0), reg, reg); XEXP (src, 1) = gen_rtx_SUBREG (DImode, tmp2, 0); } else if (!MEM_P (dst) || !REG_P (src)) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 6a74e8f153b..4922b03c211 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-03-26 Uroš Bizjak + + PR target/89827 + * gcc.target/i386/pr89827.c: New test. + 2019-03-25 Andreas Krebbel Backport from mainline diff --git a/gcc/testsuite/gcc.target/i386/pr89827.c b/gcc/testsuite/gcc.target/i386/pr89827.c new file mode 100644 index 00000000000..c6fb48b54b9 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr89827.c @@ -0,0 +1,11 @@ +/* PR target/89827 */ +/* { dg-do compile { target ia32 } } */ +/* { dg-options "-O2 -msse2 -mstv -mno-stackrealign" } */ + +unsigned long long a; + +void +foo (void) +{ + a >>= (unsigned short) a; +} -- cgit v1.2.3 From cd126ba4c42a69e2170824d74b69f4eb6503c9c2 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Thu, 28 Mar 2019 00:16:10 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@269982 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index d24d5be9372..9734064401e 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190327 +20190328 -- cgit v1.2.3 From 2c6c7e47977ed7b9bce742fc05e827e973e56036 Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Thu, 28 Mar 2019 08:51:46 +0000 Subject: Backport r265786 2019-03-28 Martin Liska Backport from mainline 2018-11-05 Martin Liska PR web/87829 * doc/invoke.texi: Remove options that are not disabled with -Os. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@269986 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 9 +++++++++ gcc/doc/invoke.texi | 3 +-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b1da0334239..76e5366e66b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2019-03-28 Martin Liska + + Backport from mainline + 2018-11-05 Martin Liska + + PR web/87829 + * doc/invoke.texi: Remove options that are + not disabled with -Os. + 2019-03-26 Uroš Bizjak PR target/89827 diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 4ee24c3ab78..de86d7a1e01 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -7680,8 +7680,7 @@ do not typically increase code size. @option{-Os} disables the following optimization flags: @gccoptlist{-falign-functions -falign-jumps -falign-loops @gol --falign-labels -freorder-blocks -freorder-blocks-algorithm=stc @gol --freorder-blocks-and-partition -fprefetch-loop-arrays} +-falign-labels -fprefetch-loop-arrays} It also enables @option{-finline-functions}, causes the compiler to tune for code size rather than execution speed, and performs further optimizations -- cgit v1.2.3 From bea3aedc4fcaceb02295a0e70bd83f81df24331a Mon Sep 17 00:00:00 2001 From: Uros Bizjak Date: Thu, 28 Mar 2019 21:38:44 +0000 Subject: PR target/89848 * config/i386/i386.c (dimode_scalar_chain::make_vector_copies): Also process XEXP (src, 0) of a shift insn. testsuite/ChangeLog: PR target/89848 * gcc.target/i386/pr89848.c: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270008 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 6 ++++++ gcc/config/i386/i386.c | 5 ++++- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.target/i386/pr89848.c | 11 +++++++++++ 4 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.target/i386/pr89848.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 76e5366e66b..63fc9cb0d43 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2019-03-28 Uroš Bizjak + + PR target/89848 + * config/i386/i386.c (dimode_scalar_chain::make_vector_copies): + Also process XEXP (src, 0) of a shift insn. + 2019-03-28 Martin Liska Backport from mainline diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index c03e9f04f22..469edc9189a 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -1867,7 +1867,10 @@ dimode_scalar_chain::make_vector_copies (unsigned regno) || GET_CODE (src) == LSHIFTRT) && !CONST_INT_P (XEXP (src, 1)) && reg_or_subregno (XEXP (src, 1)) == regno) - XEXP (src, 1) = vreg; + { + XEXP (src, 0) = replace_with_subreg (XEXP (src, 0), reg, reg); + XEXP (src, 1) = vreg; + } } else replace_with_subreg_in_insn (insn, reg, vreg); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 4922b03c211..543c9423c4a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-03-28 Uroš Bizjak + + PR target/89848 + * gcc.target/i386/pr89848.c: New test. + 2019-03-26 Uroš Bizjak PR target/89827 diff --git a/gcc/testsuite/gcc.target/i386/pr89848.c b/gcc/testsuite/gcc.target/i386/pr89848.c new file mode 100644 index 00000000000..eb67d0dd1e8 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr89848.c @@ -0,0 +1,11 @@ +/* PR target/89848 */ +/* { dg-do compile { target ia32 } } */ +/* { dg-options "-O2 -msse2 -mtune=pentium3m" } */ + +long long +foo (long long x) +{ + x >>= 3; + x <<= x; + return x; +} -- cgit v1.2.3 From e0174a901e164123e1987eb8a607f70b1ea0b980 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Fri, 29 Mar 2019 00:16:27 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270011 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 9734064401e..6e55f6509c1 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190328 +20190329 -- cgit v1.2.3 From eb19b0fe63cc9ff9e10c103fa7d49a21fe26080f Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Sat, 30 Mar 2019 00:16:14 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270028 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 6e55f6509c1..ca9d55a2e36 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190329 +20190330 -- cgit v1.2.3 From 6559c3ec19aba8d887decd5ba76299e80e6e1c8f Mon Sep 17 00:00:00 2001 From: Kugan Vivekanandarajah Date: Sat, 30 Mar 2019 04:28:51 +0000 Subject: 2019-03-29 Kugan Vivekanandarajah Backport from mainline 2019-03-29 Kugan Vivekanandarajah Eric Botcazou PR rtl-optimization/89862 * rtl.h (word_register_operation_p): Exclude CONST_INT from operations that operates on the full registers for WORD_REGISTER_OPERATIONS architectures. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270031 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 11 +++++++++++ gcc/rtl.h | 1 + 2 files changed, 12 insertions(+) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 63fc9cb0d43..53462d28f38 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,14 @@ +2019-03-29 Kugan Vivekanandarajah + + Backport from mainline + 2019-03-29 Kugan Vivekanandarajah + Eric Botcazou + + PR rtl-optimization/89862 + * rtl.h (word_register_operation_p): Exclude CONST_INT from operations + that operates on the full registers for WORD_REGISTER_OPERATIONS + architectures. + 2019-03-28 Uroš Bizjak PR target/89848 diff --git a/gcc/rtl.h b/gcc/rtl.h index 51f70cd8c3d..31567126c83 100644 --- a/gcc/rtl.h +++ b/gcc/rtl.h @@ -4355,6 +4355,7 @@ word_register_operation_p (const_rtx x) { switch (GET_CODE (x)) { + case CONST_INT: case ROTATE: case ROTATERT: case SIGN_EXTRACT: -- cgit v1.2.3 From e26cb60e86eb4a62f340f79ffc8bfe673965b900 Mon Sep 17 00:00:00 2001 From: Thomas Koenig Date: Sat, 30 Mar 2019 13:23:38 +0000 Subject: 2019-03-30 Thomas Koenig PR fortran/78865 Backport from trunk * interface.c (compare_actual_formal): Change errors about missing or extra to gfc_error_now to make sure they are issued. Change "spec" to "specifier" in message. * resolve.c (resolve_global_procedure): Also check for mismatching interface with global symbols if the namespace has already been resolved. 2019-03-30 Thomas Koenig PR fortran/78865 Backport from trunk * gfortran.dg/altreturn_10.f90: New test. * gfortran.dg/whole_file_3.f90: Change dg-warning to dg-error. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270032 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fortran/ChangeLog | 11 ++++ gcc/fortran/interface.c | 10 ++-- gcc/fortran/resolve.c | 80 +++++++++++++++--------------- gcc/testsuite/ChangeLog | 7 +++ gcc/testsuite/gfortran.dg/altreturn_10.f90 | 19 +++++++ gcc/testsuite/gfortran.dg/whole_file_3.f90 | 4 +- 6 files changed, 85 insertions(+), 46 deletions(-) create mode 100644 gcc/testsuite/gfortran.dg/altreturn_10.f90 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 5acbd8e84f4..534061802e9 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,14 @@ +2019-03-30 Thomas Koenig + + PR fortran/78865 + Backport from trunk + * interface.c (compare_actual_formal): Change errors about + missing or extra to gfc_error_now to make sure they are issued. + Change "spec" to "specifier" in message. + * resolve.c (resolve_global_procedure): Also check for mismatching + interface with global symbols if the namespace has already been + resolved. + 2019-03-24 Janus Weil PR fortran/71861 diff --git a/gcc/fortran/interface.c b/gcc/fortran/interface.c index 2e8dfd49900..9e06128f7b8 100644 --- a/gcc/fortran/interface.c +++ b/gcc/fortran/interface.c @@ -2941,17 +2941,19 @@ compare_actual_formal (gfc_actual_arglist **ap, gfc_formal_arglist *formal, if (f->sym == NULL) { + /* These errors have to be issued, otherwise an ICE can occur. + See PR 78865. */ if (where) - gfc_error ("Missing alternate return spec in subroutine call " - "at %L", where); + gfc_error_now ("Missing alternate return specifier in subroutine " + "call at %L", where); return false; } if (a->expr == NULL) { if (where) - gfc_error ("Unexpected alternate return spec in subroutine " - "call at %L", where); + gfc_error_now ("Unexpected alternate return specifier in " + "subroutine call at %L", where); return false; } diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index d2b1d26a5a7..b68c5ffe0b6 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -2493,64 +2493,64 @@ resolve_global_procedure (gfc_symbol *sym, locus *where, && gsym->type != GSYM_UNKNOWN && !gsym->binding_label && gsym->ns - && gsym->ns->resolved != -1 && gsym->ns->proc_name && not_in_recursive (sym, gsym->ns) && not_entry_self_reference (sym, gsym->ns)) { gfc_symbol *def_sym; + def_sym = gsym->ns->proc_name; /* Resolve the gsymbol namespace if needed. */ - if (!gsym->ns->resolved) + if (gsym->ns->resolved != -1) { - gfc_dt_list *old_dt_list; + if (!gsym->ns->resolved) + { + gfc_dt_list *old_dt_list; - /* Stash away derived types so that the backend_decls do not - get mixed up. */ - old_dt_list = gfc_derived_types; - gfc_derived_types = NULL; + /* Stash away derived types so that the backend_decls + do not get mixed up. */ + old_dt_list = gfc_derived_types; + gfc_derived_types = NULL; - gfc_resolve (gsym->ns); + gfc_resolve (gsym->ns); - /* Store the new derived types with the global namespace. */ - if (gfc_derived_types) - gsym->ns->derived_types = gfc_derived_types; + /* Store the new derived types with the global namespace. */ + if (gfc_derived_types) + gsym->ns->derived_types = gfc_derived_types; - /* Restore the derived types of this namespace. */ - gfc_derived_types = old_dt_list; - } + /* Restore the derived types of this namespace. */ + gfc_derived_types = old_dt_list; + } - /* Make sure that translation for the gsymbol occurs before - the procedure currently being resolved. */ - ns = gfc_global_ns_list; - for (; ns && ns != gsym->ns; ns = ns->sibling) - { - if (ns->sibling == gsym->ns) + /* Make sure that translation for the gsymbol occurs before + the procedure currently being resolved. */ + ns = gfc_global_ns_list; + for (; ns && ns != gsym->ns; ns = ns->sibling) { - ns->sibling = gsym->ns->sibling; - gsym->ns->sibling = gfc_global_ns_list; - gfc_global_ns_list = gsym->ns; - break; + if (ns->sibling == gsym->ns) + { + ns->sibling = gsym->ns->sibling; + gsym->ns->sibling = gfc_global_ns_list; + gfc_global_ns_list = gsym->ns; + break; + } } - } - - def_sym = gsym->ns->proc_name; - /* This can happen if a binding name has been specified. */ - if (gsym->binding_label && gsym->sym_name != def_sym->name) - gfc_find_symbol (gsym->sym_name, gsym->ns, 0, &def_sym); + /* This can happen if a binding name has been specified. */ + if (gsym->binding_label && gsym->sym_name != def_sym->name) + gfc_find_symbol (gsym->sym_name, gsym->ns, 0, &def_sym); - if (def_sym->attr.entry_master) - { - gfc_entry_list *entry; - for (entry = gsym->ns->entries; entry; entry = entry->next) - if (strcmp (entry->sym->name, sym->name) == 0) - { - def_sym = entry->sym; - break; - } + if (def_sym->attr.entry_master) + { + gfc_entry_list *entry; + for (entry = gsym->ns->entries; entry; entry = entry->next) + if (strcmp (entry->sym->name, sym->name) == 0) + { + def_sym = entry->sym; + break; + } + } } - if (sym->attr.function && !gfc_compare_types (&sym->ts, &def_sym->ts)) { gfc_error ("Return type mismatch of function %qs at %L (%s/%s)", diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 543c9423c4a..eb8d989338b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2019-03-30 Thomas Koenig + + PR fortran/78865 + Backport from trunk + * gfortran.dg/altreturn_10.f90: New test. + * gfortran.dg/whole_file_3.f90: Change dg-warning to dg-error. + 2019-03-28 Uroš Bizjak PR target/89848 diff --git a/gcc/testsuite/gfortran.dg/altreturn_10.f90 b/gcc/testsuite/gfortran.dg/altreturn_10.f90 new file mode 100644 index 00000000000..7e5d56977ea --- /dev/null +++ b/gcc/testsuite/gfortran.dg/altreturn_10.f90 @@ -0,0 +1,19 @@ +! { dg-do compile } +! { dg-options -Os } +! PR 78865 - this used to ICE. +program p + call sub (3) +end +subroutine sub (x) + integer :: x, i, n + do i = 1, x + if ( n /= 0 ) stop + call sub2 + end do + print *, x, n +end +subroutine sub2 + call sub (*99) ! { dg-error "Unexpected alternate return specifier" } + call sub (99.) ! { dg-warning "Type mismatch in argument" } +99 stop +end diff --git a/gcc/testsuite/gfortran.dg/whole_file_3.f90 b/gcc/testsuite/gfortran.dg/whole_file_3.f90 index 242280ccf53..a46909d3db2 100644 --- a/gcc/testsuite/gfortran.dg/whole_file_3.f90 +++ b/gcc/testsuite/gfortran.dg/whole_file_3.f90 @@ -14,8 +14,8 @@ program test EXTERNAL R - call PHLOAD (R, 1) ! { dg-warning "Missing alternate return spec" } - CALL PHLOAD (R, 2) ! { dg-warning "Missing alternate return spec" } + call PHLOAD (R, 1) ! { dg-error "Missing alternate return specifier" } + CALL PHLOAD (R, 2) ! { dg-error "Missing alternate return specifier" } CALL PHLOAD (R, *999) ! This one is OK 999 continue END program test -- cgit v1.2.3 From 0c8f61bb2816bccda572b5f35531bd2cc4dce3b0 Mon Sep 17 00:00:00 2001 From: Thomas Koenig Date: Sat, 30 Mar 2019 13:45:47 +0000 Subject: 2019-03-30 Thomas Koenig PR fortran/89866 * gfortran.dg/pointer_intent_8.f90: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270035 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/testsuite/ChangeLog | 6 ++++++ gcc/testsuite/gfortran.dg/pointer_intent_8.f90 | 22 ++++++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 gcc/testsuite/gfortran.dg/pointer_intent_8.f90 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index eb8d989338b..3bc7d441031 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2019-03-30 Thomas Koenig + + PR fortran/89866 + Backport from trunk + * gfortran.dg/pointer_intent_8.f90: New test. + 2019-03-30 Thomas Koenig PR fortran/78865 diff --git a/gcc/testsuite/gfortran.dg/pointer_intent_8.f90 b/gcc/testsuite/gfortran.dg/pointer_intent_8.f90 new file mode 100644 index 00000000000..6bfbc5c37cc --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pointer_intent_8.f90 @@ -0,0 +1,22 @@ +! { dg-do run } +! PR 85797 - this used to get wrong results. + + +PROGRAM testfortran2 + IMPLICIT NONE + + INTEGER, DIMENSION(10), TARGET :: i4array + + i4array = (/ 1,2,3,4,5,6,7,8,9,10 /) + + call InRef(i4array) + +CONTAINS + + subroutine InRef(v) + INTEGER, DIMENSION(:), POINTER, INTENT(in) :: v + INTEGER :: i + if (any (v /= [(i,i=1,10)])) stop 1 + END subroutine + +END -- cgit v1.2.3 From e449866f8ccc621d91488454c915fb0b17ff3d2b Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Sun, 31 Mar 2019 00:16:13 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270040 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index ca9d55a2e36..aef6b6ceee7 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190330 +20190331 -- cgit v1.2.3 From 67fc4240de0ea0d64277710698a5f2d33fca8834 Mon Sep 17 00:00:00 2001 From: Harald Anlauf Date: Sun, 31 Mar 2019 19:08:23 +0000 Subject: 2019-03-31 Harald Anlauf PR fortran/83515 PR fortran/85797 * trans-types.c (gfc_typenode_for_spec): Handle conversion for procedure pointers. * target-memory.c (gfc_element_size): Handle size determination for procedure pointers. PR fortran/83515 PR fortran/85797 * gfortran.dg/pr85797.f90: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270046 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fortran/ChangeLog | 9 +++++++++ gcc/fortran/target-memory.c | 1 + gcc/fortran/trans-types.c | 3 +++ gcc/testsuite/ChangeLog | 6 ++++++ gcc/testsuite/gfortran.dg/pr85797.f90 | 33 +++++++++++++++++++++++++++++++++ 5 files changed, 52 insertions(+) create mode 100644 gcc/testsuite/gfortran.dg/pr85797.f90 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 534061802e9..1017a313edd 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,12 @@ +2019-03-31 Harald Anlauf + + PR fortran/83515 + PR fortran/85797 + * trans-types.c (gfc_typenode_for_spec): Handle conversion for + procedure pointers. + * target-memory.c (gfc_element_size): Handle size determination + for procedure pointers. + 2019-03-30 Thomas Koenig PR fortran/78865 diff --git a/gcc/fortran/target-memory.c b/gcc/fortran/target-memory.c index c924cb529d1..35a631aa878 100644 --- a/gcc/fortran/target-memory.c +++ b/gcc/fortran/target-memory.c @@ -120,6 +120,7 @@ gfc_element_size (gfc_expr *e, size_t *siz) case BT_CLASS: case BT_VOID: case BT_ASSUMED: + case BT_PROCEDURE: { /* Determine type size without clobbering the typespec for ISO C binding types. */ diff --git a/gcc/fortran/trans-types.c b/gcc/fortran/trans-types.c index a3659e65e43..b4daf4b61b1 100644 --- a/gcc/fortran/trans-types.c +++ b/gcc/fortran/trans-types.c @@ -1231,6 +1231,9 @@ gfc_typenode_for_spec (gfc_typespec * spec, int codim) basetype = pfunc_type_node; } break; + case BT_PROCEDURE: + basetype = pfunc_type_node; + break; default: gcc_unreachable (); } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 3bc7d441031..6245b74e191 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2019-03-31 Harald Anlauf + + PR fortran/83515 + PR fortran/85797 + * gfortran.dg/pr85797.f90: New test. + 2019-03-30 Thomas Koenig PR fortran/89866 diff --git a/gcc/testsuite/gfortran.dg/pr85797.f90 b/gcc/testsuite/gfortran.dg/pr85797.f90 new file mode 100644 index 00000000000..fe6d96d6e30 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr85797.f90 @@ -0,0 +1,33 @@ +! { dg-do compile } +! { dg-options "-Wall" } +! PR fortran/83515 - ICE: Invalid expression in gfc_element_size +! PR fortran/85797 - ICE in gfc_element_size, at fortran/target-memory.c:126 + +subroutine a + c = transfer (a, b) ! { dg-warning "Non-RECURSIVE procedure" } +end + +recursive subroutine d + c = transfer (d, b) +end + +recursive subroutine e + k = transfer (transfer (e, e), 1) +end + +subroutine f + use, intrinsic :: iso_c_binding + integer(c_intptr_t) :: b, c + c = transfer (transfer (b, a), b) +end + +module m +contains + function f () result (z) ! { dg-warning "Return value" } + class(*), pointer :: z + end function f + recursive subroutine s (q) + procedure(f) :: q + call s (q) + end subroutine s +end -- cgit v1.2.3 From 5871f73e9b58860a5647411f0cce560277651247 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Mon, 1 Apr 2019 00:16:15 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270050 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index aef6b6ceee7..0d5465b6b77 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190331 +20190401 -- cgit v1.2.3 From 49aada8c5f1983df8c8c37c5b73331070aeebab4 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Tue, 2 Apr 2019 00:16:18 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270071 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 0d5465b6b77..9f7cdbf8bcf 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190401 +20190402 -- cgit v1.2.3 From e1b2d8026c928448f7dacf6aea164a27181307c9 Mon Sep 17 00:00:00 2001 From: Uros Bizjak Date: Tue, 2 Apr 2019 18:37:14 +0000 Subject: PR target/89902 PR target/89903 * config/i386/i386.c (dimode_scalar_to_vector_candidate_p): Return false for variable DImode shifts. (dimode_scalar_chain::compute_convert_gain): Do not handle register count operand in variable DImode shifts. (dimode_scalar_chain::make_vector_copies): Remove support to copy count argument of a variable shift instruction to a vector register. (dimode_scalar_chain::convert_reg): Remove support to convert count argument of a variable shift instruction. testsuite/ChangeLog: PR target/89902 PR target/89903 * gcc.target/i386/pr70799-4.c: Remove. * gcc.target/i386/pr70799-5.c: Remove. * gcc.target/i386/pr89902.c: New test. * gcc.target/i386/pr89903.c: Ditto. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270104 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 13 +++ gcc/config/i386/i386.c | 130 +++--------------------------- gcc/testsuite/ChangeLog | 9 +++ gcc/testsuite/gcc.target/i386/pr70799-4.c | 17 ---- gcc/testsuite/gcc.target/i386/pr70799-5.c | 17 ---- gcc/testsuite/gcc.target/i386/pr89902.c | 13 +++ gcc/testsuite/gcc.target/i386/pr89903.c | 14 ++++ 7 files changed, 58 insertions(+), 155 deletions(-) delete mode 100644 gcc/testsuite/gcc.target/i386/pr70799-4.c delete mode 100644 gcc/testsuite/gcc.target/i386/pr70799-5.c create mode 100644 gcc/testsuite/gcc.target/i386/pr89902.c create mode 100644 gcc/testsuite/gcc.target/i386/pr89903.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 53462d28f38..d2e126f9de1 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,16 @@ +2019-04-02 Uroš Bizjak + + PR target/89902 + PR target/89903 + * config/i386/i386.c (dimode_scalar_to_vector_candidate_p): + Return false for variable DImode shifts. + (dimode_scalar_chain::compute_convert_gain): Do not handle + register count operand in variable DImode shifts. + (dimode_scalar_chain::make_vector_copies): Remove support to copy + count argument of a variable shift instruction to a vector register. + (dimode_scalar_chain::convert_reg): Remove support to convert + count argument of a variable shift instruction. + 2019-03-29 Kugan Vivekanandarajah Backport from mainline diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 469edc9189a..30a20af8fab 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -1024,16 +1024,8 @@ dimode_scalar_to_vector_candidate_p (rtx_insn *insn) case ASHIFT: case LSHIFTRT: - if (!REG_P (XEXP (src, 1)) - && (!SUBREG_P (XEXP (src, 1)) - || SUBREG_BYTE (XEXP (src, 1)) != 0 - || !REG_P (SUBREG_REG (XEXP (src, 1)))) - && (!CONST_INT_P (XEXP (src, 1)) - || !IN_RANGE (INTVAL (XEXP (src, 1)), 0, 63))) - return false; - - if (GET_MODE (XEXP (src, 1)) != QImode - && !CONST_INT_P (XEXP (src, 1))) + if (!CONST_INT_P (XEXP (src, 1)) + || !IN_RANGE (INTVAL (XEXP (src, 1)), 0, 63)) return false; break; @@ -1630,15 +1622,10 @@ dimode_scalar_chain::compute_convert_gain () { if (CONST_INT_P (XEXP (src, 0))) gain -= vector_const_cost (XEXP (src, 0)); - if (CONST_INT_P (XEXP (src, 1))) - { - gain += ix86_cost->shift_const; - if (INTVAL (XEXP (src, 1)) >= 32) - gain -= COSTS_N_INSNS (1); - } - else - /* Additional gain for omitting two CMOVs. */ - gain += ix86_cost->shift_var + COSTS_N_INSNS (2); + + gain += ix86_cost->shift_const; + if (INTVAL (XEXP (src, 1)) >= 32) + gain -= COSTS_N_INSNS (1); } else if (GET_CODE (src) == PLUS || GET_CODE (src) == MINUS @@ -1754,60 +1741,14 @@ dimode_scalar_chain::make_vector_copies (unsigned regno) { rtx reg = regno_reg_rtx[regno]; rtx vreg = gen_reg_rtx (DImode); - bool count_reg = false; df_ref ref; for (ref = DF_REG_DEF_CHAIN (regno); ref; ref = DF_REF_NEXT_REG (ref)) if (!bitmap_bit_p (insns, DF_REF_INSN_UID (ref))) { - df_ref use; - - /* Detect the count register of a shift instruction. */ - for (use = DF_REG_USE_CHAIN (regno); use; use = DF_REF_NEXT_REG (use)) - if (bitmap_bit_p (insns, DF_REF_INSN_UID (use))) - { - rtx_insn *insn = DF_REF_INSN (use); - rtx def_set = single_set (insn); - - gcc_assert (def_set); - - rtx src = SET_SRC (def_set); - - if ((GET_CODE (src) == ASHIFT - || GET_CODE (src) == ASHIFTRT - || GET_CODE (src) == LSHIFTRT) - && !CONST_INT_P (XEXP (src, 1)) - && reg_or_subregno (XEXP (src, 1)) == regno) - count_reg = true; - } - start_sequence (); - if (count_reg) - { - rtx qreg = gen_lowpart (QImode, reg); - rtx tmp = gen_reg_rtx (SImode); - if (TARGET_ZERO_EXTEND_WITH_AND - && optimize_function_for_speed_p (cfun)) - { - emit_move_insn (tmp, const0_rtx); - emit_insn (gen_movstrictqi - (gen_lowpart (QImode, tmp), qreg)); - } - else - emit_insn (gen_rtx_SET - (tmp, gen_rtx_ZERO_EXTEND (SImode, qreg))); - - if (!TARGET_INTER_UNIT_MOVES_TO_VEC) - { - rtx slot = assign_386_stack_local (SImode, SLOT_STV_TEMP); - emit_move_insn (slot, tmp); - tmp = copy_rtx (slot); - } - - emit_insn (gen_zero_extendsidi2 (vreg, tmp)); - } - else if (!TARGET_INTER_UNIT_MOVES_TO_VEC) + if (!TARGET_INTER_UNIT_MOVES_TO_VEC) { rtx tmp = assign_386_stack_local (DImode, SLOT_STV_TEMP); emit_move_insn (adjust_address (tmp, SImode, 0), @@ -1855,25 +1796,8 @@ dimode_scalar_chain::make_vector_copies (unsigned regno) if (bitmap_bit_p (insns, DF_REF_INSN_UID (ref))) { rtx_insn *insn = DF_REF_INSN (ref); - if (count_reg) - { - rtx def_set = single_set (insn); - gcc_assert (def_set); - rtx src = SET_SRC (def_set); - - if ((GET_CODE (src) == ASHIFT - || GET_CODE (src) == ASHIFTRT - || GET_CODE (src) == LSHIFTRT) - && !CONST_INT_P (XEXP (src, 1)) - && reg_or_subregno (XEXP (src, 1)) == regno) - { - XEXP (src, 0) = replace_with_subreg (XEXP (src, 0), reg, reg); - XEXP (src, 1) = vreg; - } - } - else - replace_with_subreg_in_insn (insn, reg, vreg); + replace_with_subreg_in_insn (insn, reg, vreg); if (dump_file) fprintf (dump_file, " Replaced r%d with r%d in insn %d\n", @@ -1976,43 +1900,7 @@ dimode_scalar_chain::convert_reg (unsigned regno) rtx src = SET_SRC (def_set); rtx dst = SET_DEST (def_set); - if ((GET_CODE (src) == ASHIFT - || GET_CODE (src) == ASHIFTRT - || GET_CODE (src) == LSHIFTRT) - && !CONST_INT_P (XEXP (src, 1)) - && reg_or_subregno (XEXP (src, 1)) == regno) - { - rtx tmp2 = gen_reg_rtx (V2DImode); - - start_sequence (); - - if (TARGET_SSE4_1) - emit_insn (gen_sse4_1_zero_extendv2qiv2di2 - (tmp2, gen_rtx_SUBREG (V16QImode, reg, 0))); - else - { - rtx vec_cst - = gen_rtx_CONST_VECTOR (V2DImode, - gen_rtvec (2, GEN_INT (0xff), - const0_rtx)); - vec_cst - = validize_mem (force_const_mem (V2DImode, vec_cst)); - - emit_insn (gen_rtx_SET - (tmp2, - gen_rtx_AND (V2DImode, - gen_rtx_SUBREG (V2DImode, reg, 0), - vec_cst))); - } - rtx_insn *seq = get_insns (); - end_sequence (); - - emit_insn_before (seq, insn); - - XEXP (src, 0) = replace_with_subreg (XEXP (src, 0), reg, reg); - XEXP (src, 1) = gen_rtx_SUBREG (DImode, tmp2, 0); - } - else if (!MEM_P (dst) || !REG_P (src)) + if (!MEM_P (dst) || !REG_P (src)) replace_with_subreg_in_insn (insn, reg, reg); bitmap_clear_bit (conv, INSN_UID (insn)); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 6245b74e191..cde2eb8338f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,12 @@ +2019-04-02 Uroš Bizjak + + PR target/89902 + PR target/89903 + * gcc.target/i386/pr70799-4.c: Remove. + * gcc.target/i386/pr70799-5.c: Remove. + * gcc.target/i386/pr89902.c: New test. + * gcc.target/i386/pr89903.c: Ditto. + 2019-03-31 Harald Anlauf PR fortran/83515 diff --git a/gcc/testsuite/gcc.target/i386/pr70799-4.c b/gcc/testsuite/gcc.target/i386/pr70799-4.c deleted file mode 100644 index 3e415d590b8..00000000000 --- a/gcc/testsuite/gcc.target/i386/pr70799-4.c +++ /dev/null @@ -1,17 +0,0 @@ -/* PR target/pr70799 */ -/* { dg-do compile { target ia32 } } */ -/* { dg-options "-O2 -march=slm -mno-stackrealign" } */ -/* { dg-final { scan-assembler "psllq" } } */ -/* { dg-final { scan-assembler "psrlq" } } */ - -unsigned long long a, b; - -void test1 (int c) -{ - a = b << c; -} - -void test2 (int c) -{ - a = b >> c; -} diff --git a/gcc/testsuite/gcc.target/i386/pr70799-5.c b/gcc/testsuite/gcc.target/i386/pr70799-5.c deleted file mode 100644 index ea17071a1f4..00000000000 --- a/gcc/testsuite/gcc.target/i386/pr70799-5.c +++ /dev/null @@ -1,17 +0,0 @@ -/* PR target/pr70799 */ -/* { dg-do compile { target ia32 } } */ -/* { dg-options "-O2 -march=slm -mavx512vl -mno-stackrealign" } */ -/* { dg-final { scan-assembler "psllq" } } */ -/* { dg-final { scan-assembler "psraq" } } */ - -long long a, b; - -void test1 (int c) -{ - a = b << c; -} - -void test2 (int c) -{ - a = b >> c; -} diff --git a/gcc/testsuite/gcc.target/i386/pr89902.c b/gcc/testsuite/gcc.target/i386/pr89902.c new file mode 100644 index 00000000000..30c95bc2a3a --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr89902.c @@ -0,0 +1,13 @@ +/* PR target/89902 */ +/* { dg-do compile { target ia32 } } */ +/* { dg-options "-O2 -fno-tree-coalesce-vars -mavx512bitalg" } */ + +void bar (void); + +int +foo (long long x) +{ + x <<= (char) x; + bar (); + return x; +} diff --git a/gcc/testsuite/gcc.target/i386/pr89903.c b/gcc/testsuite/gcc.target/i386/pr89903.c new file mode 100644 index 00000000000..03dccacfbb9 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr89903.c @@ -0,0 +1,14 @@ +/* PR target/89903 */ +/* { dg-do compile { target ia32 } } */ +/* { dg-options "-O2 -march=skylake" } */ + +int a, b; + +void +foo (void) +{ + unsigned long long d = 983040; + d += a; + d >>= (short) d; + b = d; +} -- cgit v1.2.3 From a8f8dafad1b86fdd21d83939c482a873c170f181 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Wed, 3 Apr 2019 00:16:08 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270109 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 9f7cdbf8bcf..0467f2f45d0 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190402 +20190403 -- cgit v1.2.3 From be0f231bdf3028dee834c00941040bad1206e0a0 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Wed, 3 Apr 2019 08:46:35 +0000 Subject: 2019-04-03 Richard Biener PR lto/89896 * lto-wrapper.c (run_gcc): Avoid implicit rules making the all target phony. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270113 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 6 ++++++ gcc/lto-wrapper.c | 4 +++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d2e126f9de1..512575db54e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2019-04-03 Richard Biener + + PR lto/89896 + * lto-wrapper.c (run_gcc): Avoid implicit rules making + the all target phony. + 2019-04-02 Uroš Bizjak PR target/89902 diff --git a/gcc/lto-wrapper.c b/gcc/lto-wrapper.c index 7a3f93ab2a1..dada53d26d9 100644 --- a/gcc/lto-wrapper.c +++ b/gcc/lto-wrapper.c @@ -1669,7 +1669,9 @@ cont: struct pex_obj *pex; char jobs[32]; - fprintf (mstream, "all:"); + fprintf (mstream, + ".PHONY: all\n" + "all:"); for (i = 0; i < nr; ++i) { int j = ltrans_priorities[i*2 + 1]; -- cgit v1.2.3 From dfbba37d19d3b67543d6a10b958c4c7cad618173 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Thu, 4 Apr 2019 00:16:08 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270140 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 0467f2f45d0..af2c3a5bbc4 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190403 +20190404 -- cgit v1.2.3 From 6b6051aced2c14a30d0df671ba38d50bc73d2c55 Mon Sep 17 00:00:00 2001 From: Martin Sebor Date: Thu, 4 Apr 2019 22:16:11 +0000 Subject: Backport from 9.0. PR middle-end/89934 - ICE on a call with fewer arguments to strncpy declared without prototype gcc/ChangeLog: PR middle-end/89934 * gimple-ssa-warn-restrict.c (builtin_access::builtin_access): Bail out if the number of arguments is less than expected. gcc/testsuite/ChangeLog: PR middle-end/89934 * gcc.dg/Wrestrict-19.c: New test. * gcc.dg/Wrestrict-5.c: Add comment. Remove unused code. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270153 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 6 ++++++ gcc/gimple-ssa-warn-restrict.c | 4 ++++ gcc/testsuite/ChangeLog | 6 ++++++ gcc/testsuite/gcc.dg/Wrestrict-19.c | 33 +++++++++++++++++++++++++++++++++ gcc/testsuite/gcc.dg/Wrestrict-5.c | 17 ++++++----------- 5 files changed, 55 insertions(+), 11 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/Wrestrict-19.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 512575db54e..94efad6a944 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2019-04-04 Martin Sebor + + PR middle-end/89934 + * gimple-ssa-warn-restrict.c (builtin_access::builtin_access): Bail + out if the number of arguments is less than expected. + 2019-04-03 Richard Biener PR lto/89896 diff --git a/gcc/gimple-ssa-warn-restrict.c b/gcc/gimple-ssa-warn-restrict.c index 8aeefd4077b..722bc6f921f 100644 --- a/gcc/gimple-ssa-warn-restrict.c +++ b/gcc/gimple-ssa-warn-restrict.c @@ -698,6 +698,10 @@ builtin_access::builtin_access (gcall *call, builtin_memref &dst, offset_int bounds[2] = { maxobjsize, maxobjsize }; if (dstref->strbounded_p) { + unsigned nargs = gimple_call_num_args (call); + if (nargs <= sizeargno) + return; + tree size = gimple_call_arg (call, sizeargno); tree range[2]; if (get_size_range (size, range, true)) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index cde2eb8338f..9cdc3993b10 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2019-04-04 Martin Sebor + + PR middle-end/89934 + * gcc.dg/Wrestrict-19.c: New test. + * gcc.dg/Wrestrict-5.c: Add comment. Remove unused code. + 2019-04-02 Uroš Bizjak PR target/89902 diff --git a/gcc/testsuite/gcc.dg/Wrestrict-19.c b/gcc/testsuite/gcc.dg/Wrestrict-19.c new file mode 100644 index 00000000000..ebb4a5efcef --- /dev/null +++ b/gcc/testsuite/gcc.dg/Wrestrict-19.c @@ -0,0 +1,33 @@ +/* PR middle-end/89934 - ICE on a call with fewer arguments to strncpy + declared without prototype + { dg-do compile } + { dg-options "-O2 -Wall" } */ + +typedef __SIZE_TYPE__ size_t; + +char *strncpy (); + +char* f0 (char *s) +{ + return strncpy (); +} + +char* f1 (char *s) +{ + return strncpy (s); +} + +char* f2 (char *s) +{ + return strncpy (s, s + 1); /* ICE here. */ +} + +void f3 (char *s, size_t n, const char *t) +{ + strncpy (s, n, t); + strncpy (n, s, t); +} + +/* { dg-prune-output "\\\[-Wbuiltin-declaration-mismatch]" } + { dg-prune-output "\\\[-Wint-conversion]" } */ + diff --git a/gcc/testsuite/gcc.dg/Wrestrict-5.c b/gcc/testsuite/gcc.dg/Wrestrict-5.c index 4912ee5506b..513b4267fa4 100644 --- a/gcc/testsuite/gcc.dg/Wrestrict-5.c +++ b/gcc/testsuite/gcc.dg/Wrestrict-5.c @@ -1,19 +1,11 @@ -/* Test to verify that valid calls to common restrict-qualified built-in +/* PR tree-optimization/83655 - ICE on an invalid call to memcpy declared + with no prototype + Test to verify that valid calls to common restrict-qualified built-in functions declared with no prototype are checked for overlap, and that invalid calls are ignored. { dg-do compile } { dg-options "-O2 -Wrestrict" } */ -typedef __SIZE_TYPE__ size_t; - -#if __cplusplus -extern "C" { - -#define NO_PROTO ... -#else -#define NO_PROTO /* empty */ -#endif - void* memcpy (); char* strncpy (); @@ -41,3 +33,6 @@ void test_strncpy_nowarn (char *d) { strncpy (d + 1, d + 3, ""); } + +/* { dg-prune-output "\\\[-Wbuiltin-declaration-mismatch]" } + { dg-prune-output "\\\[-Wint-conversion]" } */ -- cgit v1.2.3 From 8fc387babfbae76c23020518a81419b60ceb3283 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Fri, 5 Apr 2019 00:16:09 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270157 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index af2c3a5bbc4..8761c396e70 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190404 +20190405 -- cgit v1.2.3 From 154efb66c29584acff416351de0d0fdb38ece607 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Sat, 6 Apr 2019 00:16:14 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270180 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 8761c396e70..9c538793155 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190405 +20190406 -- cgit v1.2.3 From 684cacc98d996e6fbc90b451daa2ad23cf0faceb Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Sun, 7 Apr 2019 00:16:13 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270186 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 9c538793155..a1b1c16a670 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190406 +20190407 -- cgit v1.2.3 From 8193b0ac13ee31e78c7ab3325199addd65b1ebe8 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Mon, 8 Apr 2019 00:16:10 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270194 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index a1b1c16a670..58ff2f2bff9 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190407 +20190408 -- cgit v1.2.3 From 7d59a928ed23ee7f56307afc5002cd27a6537565 Mon Sep 17 00:00:00 2001 From: Uros Bizjak Date: Mon, 8 Apr 2019 03:59:50 +0000 Subject: PR target/89945 * config/i386/i386.md (anddi_1 to andsi_1_zext splitter): Avoid calling gen_lowpart with SYMBOL_REF and LABEL_REF operand. testsuite/ChangeLog: PR target/89945 * gcc.target/i386/pr89945.c: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270196 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 6 ++++++ gcc/config/i386/i386.md | 11 ++++++++++- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.target/i386/pr89945.c | 21 +++++++++++++++++++++ 4 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.target/i386/pr89945.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 94efad6a944..703b7bbc633 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2019-04-07 Uroš Bizjak + + PR target/89945 + * config/i386/i386.md (anddi_1 to andsi_1_zext splitter): + Avoid calling gen_lowpart with SYMBOL_REF and LABEL_REF operand. + 2019-04-04 Martin Sebor PR middle-end/89934 diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md index 7691160c0c4..417b6e61a7e 100644 --- a/gcc/config/i386/i386.md +++ b/gcc/config/i386/i386.md @@ -8942,7 +8942,16 @@ [(parallel [(set (match_dup 0) (zero_extend:DI (and:SI (match_dup 1) (match_dup 2)))) (clobber (reg:CC FLAGS_REG))])] - "operands[2] = gen_lowpart (SImode, operands[2]);") +{ + if (GET_CODE (operands[2]) == SYMBOL_REF + || GET_CODE (operands[2]) == LABEL_REF) + { + operands[2] = shallow_copy_rtx (operands[2]); + PUT_MODE (operands[2], SImode); + } + else + operands[2] = gen_lowpart (SImode, operands[2]); +}) ;; See comment for addsi_1_zext why we do use nonimmediate_operand (define_insn "*andsi_1_zext" diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 9cdc3993b10..7c3a5f81edc 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +019-04-07 Uroš Bizjak + + PR target/89945 + * gcc.target/i386/pr89945.c: New test. + 2019-04-04 Martin Sebor PR middle-end/89934 diff --git a/gcc/testsuite/gcc.target/i386/pr89945.c b/gcc/testsuite/gcc.target/i386/pr89945.c new file mode 100644 index 00000000000..39e864a9d65 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr89945.c @@ -0,0 +1,21 @@ +/* PR target/89945 */ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +void +foo () +{ + void *g[] = {&&a, &&b}; + + for (unsigned c = 0x1F;; c >>= 1) + { + unsigned d = (long)"a"; + long e = 8; + + while (e) + { + a: goto *g[c&d]; + b: e--; + } + } +} -- cgit v1.2.3 From b4e84644959e129ef3aa47d31974b68e9741fb07 Mon Sep 17 00:00:00 2001 From: Claudiu Zissulescu Date: Mon, 8 Apr 2019 07:49:41 +0000 Subject: Backport ARC patch. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270200 138bc75d-0d04-0410-961f-82ee72b054a4 --- include/ChangeLog | 8 ++++++++ include/longlong.h | 6 ++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/include/ChangeLog b/include/ChangeLog index 02ab3367193..7456a13e5d8 100644 --- a/include/ChangeLog +++ b/include/ChangeLog @@ -1,3 +1,11 @@ +2019-04-08 Claudiu Zissulescu + + backport mainline + Vineet Gupta + PR 89877 + * longlong.h [__arc__] (add_ssaaaa): Add cc clobber. + (sub_ddmmss): Likewise. + 2019-02-22 Release Manager * GCC 8.3.0 released. diff --git a/include/longlong.h b/include/longlong.h index 7f3dc17dc0a..8771365b9dc 100644 --- a/include/longlong.h +++ b/include/longlong.h @@ -199,7 +199,8 @@ extern UDItype __udiv_qrnnd (UDItype *, UDItype, UDItype, UDItype); : "%r" ((USItype) (ah)), \ "rICal" ((USItype) (bh)), \ "%r" ((USItype) (al)), \ - "rICal" ((USItype) (bl))) + "rICal" ((USItype) (bl)) \ + : "cc") #define sub_ddmmss(sh, sl, ah, al, bh, bl) \ __asm__ ("sub.f %1, %4, %5\n\tsbc %0, %2, %3" \ : "=r" ((USItype) (sh)), \ @@ -207,7 +208,8 @@ extern UDItype __udiv_qrnnd (UDItype *, UDItype, UDItype, UDItype); : "r" ((USItype) (ah)), \ "rICal" ((USItype) (bh)), \ "r" ((USItype) (al)), \ - "rICal" ((USItype) (bl))) + "rICal" ((USItype) (bl)) \ + : "cc") #define __umulsidi3(u,v) ((UDItype)(USItype)u*(USItype)v) #ifdef __ARC_NORM__ -- cgit v1.2.3 From 660cebc15beb5403bd383a25b62c6d64359de294 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Tue, 9 Apr 2019 00:16:15 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270218 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 58ff2f2bff9..0a907d512b4 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190408 +20190409 -- cgit v1.2.3 From 890ba35b1077a11d2c42a33d4238f95c9310cfd7 Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Tue, 9 Apr 2019 19:29:49 +0000 Subject: * c-ada-spec.c (print_destructor): Deal with deleting destructors. (dump_ada_declaration) : Likewise. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270240 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/c-family/ChangeLog | 5 +++++ gcc/c-family/c-ada-spec.c | 7 +++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index 43cbc3dd751..58ca7b6c1d3 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,8 @@ +2019-04-09 Eric Botcazou + + * c-ada-spec.c (print_destructor): Deal with deleting destructors. + (dump_ada_declaration) : Likewise. + 2019-02-22 Release Manager * GCC 8.3.0 released. diff --git a/gcc/c-family/c-ada-spec.c b/gcc/c-family/c-ada-spec.c index 30fdb59d55c..f5f558c5a5c 100644 --- a/gcc/c-family/c-ada-spec.c +++ b/gcc/c-family/c-ada-spec.c @@ -2686,6 +2686,8 @@ print_destructor (pretty_printer *buffer, tree t, tree type) tree decl_name = DECL_NAME (TYPE_NAME (type)); pp_string (buffer, "Delete_"); + if (strncmp (IDENTIFIER_POINTER (DECL_NAME (t)), "__dt_del", 8) == 0) + pp_string (buffer, "And_Free_"); pp_ada_tree_identifier (buffer, decl_name, t, 0, false); } @@ -2937,9 +2939,10 @@ dump_ada_declaration (pretty_printer *buffer, tree t, tree type, int spc) if (DECL_ARTIFICIAL (t)) return 0; - /* Only consider constructors/destructors for complete objects. */ + /* Only consider complete constructors and deleting destructors. */ if (strncmp (IDENTIFIER_POINTER (decl_name), "__ct_comp", 9) != 0 - && strncmp (IDENTIFIER_POINTER (decl_name), "__dt_comp", 9) != 0) + && strncmp (IDENTIFIER_POINTER (decl_name), "__dt_comp", 9) != 0 + && strncmp (IDENTIFIER_POINTER (decl_name), "__dt_del", 8) != 0) return 0; } -- cgit v1.2.3 From 1a2bb91089e86cf5d159bdfd6beb324a0aee17e7 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Wed, 10 Apr 2019 00:16:10 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270244 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 0a907d512b4..9035ee48445 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190409 +20190410 -- cgit v1.2.3 From 897aeb5ebe38b21a33addd58c8ffa9472bacedb0 Mon Sep 17 00:00:00 2001 From: Matthew Malcomson Date: Wed, 10 Apr 2019 13:41:21 +0000 Subject: Backport of r270226 from mainline to gcc-8-branch The "*neon_mov" patterns for 128 bit sized quantities uses the "Dn" constraint to match vmov.f32 and vmov.i patterns. This constraint boils down to using the `neon_immediate_valid` function. Once the constraint has matched, the output C statement asserts that function passes. The output C statement calls `neon_immediate_valid` with the mode taken from the iterator, while the constraint takes the mode from the operand. This can cause a discrepency when the operand is a CONST_INT, as the constraint passes VOIDmode which `neon_immediate_valid` treats as DImode, while the C statement passes the mode of the iterator which can be TImode. When this happens, the `neon_immediate_valid` can fail in the second call (if e.g. the CONST_INT is a valid immediate in DImode but not TImode) which would trigger the assertion. The testcase added with this patch triggers this when compiled with an arm cross compiler using the command line below. gcc -march=armv8-a -c neon-immediate-timode.c -O1 -mfloat-abi=hard -mfpu=neon-fp-armv8 This patch splits the original "Dn" constraint into three new constraints, "DN" for TImode CONST_INT, "Dn" for DImode CONST_INT, and "Dm" for CONST_VECTOR. Splitting things up this way requires using one extra alternative in the "*neon_mov" patterns, but makes it clear from the constraint what mode is being used. We also remove the behaviour of treating VOIDmode as DImode in `neon_valid_immediate` since the original "Dn" constraint was the only place that functionality was used. VOIDmode is now never passed to that function. An assertion has been added to the function to ensure this problem is caught earlier on. bootstrapped and regtested on arm-none-linux-gnueabihf gcc/ChangeLog: 2019-04-10 Matthew Malcomson PR target/90024 * config/arm/arm.c (neon_valid_immediate): Disallow VOIDmode parameter. * config/arm/constraints.md (Dm, DN, Dn): Split previous Dn constraint into three. * config/arm/neon.md (*neon_mov): Account for TImode and DImode differences directly. (*smax3_neon, vashl3, vashr3_imm): Use Dm constraint. gcc/testsuite/ChangeLog: 2019-04-10 Matthew Malcomson PR target/90024 * gcc.dg/torture/neon-immediate-timode.c: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270254 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 10 ++++ gcc/config/arm/arm.c | 3 +- gcc/config/arm/constraints.md | 25 +++++++-- gcc/config/arm/neon.md | 59 +++++++++++----------- gcc/testsuite/ChangeLog | 5 ++ .../gcc.dg/torture/neon-immediate-timode.c | 10 ++++ 6 files changed, 76 insertions(+), 36 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/torture/neon-immediate-timode.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 703b7bbc633..62a30dfac22 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +2019-04-10 Matthew Malcomson + + PR target/90024 + * config/arm/arm.c (neon_valid_immediate): Disallow VOIDmode parameter. + * config/arm/constraints.md (Dm, DN, Dn): Split previous Dn constraint + into three. + * config/arm/neon.md (*neon_mov): Account for TImode and DImode + differences directly. + (*smax3_neon, vashl3, vashr3_imm): Use Dm constraint. + 2019-04-07 Uroš Bizjak PR target/89945 diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index e45eb525db6..5e8190ec85a 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -11930,8 +11930,7 @@ neon_valid_immediate (rtx op, machine_mode mode, int inverse, else { n_elts = 1; - if (mode == VOIDmode) - mode = DImode; + gcc_assert (mode != VOIDmode); } innersize = GET_MODE_UNIT_SIZE (mode); diff --git a/gcc/config/arm/constraints.md b/gcc/config/arm/constraints.md index 7576c6fc401..09161620074 100644 --- a/gcc/config/arm/constraints.md +++ b/gcc/config/arm/constraints.md @@ -31,7 +31,8 @@ ;; 'H' was previously used for FPA. ;; The following multi-letter normal constraints have been used: -;; in ARM/Thumb-2 state: Da, Db, Dc, Dd, Dn, Dl, DL, Do, Dv, Dy, Di, Dt, Dp, Dz +;; in ARM/Thumb-2 state: Da, Db, Dc, Dd, Dn, DN, Dm, Dl, DL, Do, Dv, Dy, Di, +;; Dt, Dp, Dz ;; in Thumb-1 state: Pa, Pb, Pc, Pd, Pe ;; in Thumb-2 state: Pj, PJ, Ps, Pt, Pu, Pv, Pw, Px, Py ;; in all states: Pf @@ -294,14 +295,28 @@ (and (match_code "const_double,const_int") (match_test "TARGET_32BIT && arm_const_double_by_immediates (op)"))) -(define_constraint "Dn" +(define_constraint "Dm" "@internal - In ARM/Thumb-2 state a const_vector or const_int which can be loaded with a - Neon vmov immediate instruction." - (and (match_code "const_vector,const_int") + In ARM/Thumb-2 state a const_vector which can be loaded with a Neon vmov + immediate instruction." + (and (match_code "const_vector") (match_test "TARGET_32BIT && imm_for_neon_mov_operand (op, GET_MODE (op))"))) +(define_constraint "Dn" + "@internal + In ARM/Thumb-2 state a DImode const_int which can be loaded with a Neon vmov + immediate instruction." + (and (match_code "const_int") + (match_test "TARGET_32BIT && imm_for_neon_mov_operand (op, DImode)"))) + +(define_constraint "DN" + "@internal + In ARM/Thumb-2 state a TImode const_int which can be loaded with a Neon vmov + immediate instruction." + (and (match_code "const_int") + (match_test "TARGET_32BIT && imm_for_neon_mov_operand (op, TImode)"))) + (define_constraint "Dl" "@internal In ARM/Thumb-2 state a const_vector which can be used with a Neon vorr or diff --git a/gcc/config/arm/neon.md b/gcc/config/arm/neon.md index db53ab0b8bf..dd062225a49 100644 --- a/gcc/config/arm/neon.md +++ b/gcc/config/arm/neon.md @@ -25,14 +25,14 @@ (define_insn "*neon_mov" [(set (match_operand:VDX 0 "nonimmediate_operand" - "=w,Un,w, w, ?r,?w,?r,?r, ?Us") + "=w,Un,w, w, w, ?r,?w,?r,?r, ?Us") (match_operand:VDX 1 "general_operand" - " w,w, Dn,Uni, w, r, r, Usi,r"))] + " w,w, Dm,Dn,Uni, w, r, r, Usi,r"))] "TARGET_NEON && (register_operand (operands[0], mode) || register_operand (operands[1], mode))" { - if (which_alternative == 2) + if (which_alternative == 2 || which_alternative == 3) { int width, is_valid; static char templ[40]; @@ -53,31 +53,32 @@ switch (which_alternative) { case 0: return "vmov\t%P0, %P1 @ "; - case 1: case 3: return output_move_neon (operands); - case 2: gcc_unreachable (); - case 4: return "vmov\t%Q0, %R0, %P1 @ "; - case 5: return "vmov\t%P0, %Q1, %R1 @ "; + case 1: case 4: return output_move_neon (operands); + case 2: case 3: gcc_unreachable (); + case 5: return "vmov\t%Q0, %R0, %P1 @ "; + case 6: return "vmov\t%P0, %Q1, %R1 @ "; default: return output_move_double (operands, true, NULL); } } [(set_attr "type" "neon_move,neon_store1_1reg,neon_move,\ - neon_load1_1reg, neon_to_gp,neon_from_gp,mov_reg,\ - neon_load1_2reg, neon_store1_2reg") - (set_attr "length" "4,4,4,4,4,4,8,8,8") - (set_attr "arm_pool_range" "*,*,*,1020,*,*,*,1020,*") - (set_attr "thumb2_pool_range" "*,*,*,1018,*,*,*,1018,*") - (set_attr "neg_pool_range" "*,*,*,1004,*,*,*,1004,*")]) + neon_move,neon_load1_1reg, neon_to_gp,\ + neon_from_gp,mov_reg,neon_load1_2reg,\ + neon_store1_2reg") + (set_attr "length" "4,4,4,4,4,4,4,8,8,8") + (set_attr "arm_pool_range" "*,*,*,*,1020,*,*,*,1020,*") + (set_attr "thumb2_pool_range" "*,*,*,*,1018,*,*,*,1018,*") + (set_attr "neg_pool_range" "*,*,*,*,1004,*,*,*,1004,*")]) (define_insn "*neon_mov" [(set (match_operand:VQXMOV 0 "nonimmediate_operand" - "=w,Un,w, w, ?r,?w,?r,?r, ?Us") + "=w,Un,w, w, w, ?r,?w,?r,?r, ?Us") (match_operand:VQXMOV 1 "general_operand" - " w,w, Dn,Uni, w, r, r, Usi, r"))] + " w,w, Dm,DN,Uni, w, r, r, Usi, r"))] "TARGET_NEON && (register_operand (operands[0], mode) || register_operand (operands[1], mode))" { - if (which_alternative == 2) + if (which_alternative == 2 || which_alternative == 3) { int width, is_valid; static char templ[40]; @@ -98,20 +99,20 @@ switch (which_alternative) { case 0: return "vmov\t%q0, %q1 @ "; - case 1: case 3: return output_move_neon (operands); - case 2: gcc_unreachable (); - case 4: return "vmov\t%Q0, %R0, %e1 @ \;vmov\t%J0, %K0, %f1"; - case 5: return "vmov\t%e0, %Q1, %R1 @ \;vmov\t%f0, %J1, %K1"; + case 1: case 4: return output_move_neon (operands); + case 2: case 3: gcc_unreachable (); + case 5: return "vmov\t%Q0, %R0, %e1 @ \;vmov\t%J0, %K0, %f1"; + case 6: return "vmov\t%e0, %Q1, %R1 @ \;vmov\t%f0, %J1, %K1"; default: return output_move_quad (operands); } } [(set_attr "type" "neon_move_q,neon_store2_2reg_q,neon_move_q,\ - neon_load2_2reg_q,neon_to_gp_q,neon_from_gp_q,\ - mov_reg,neon_load1_4reg,neon_store1_4reg") - (set_attr "length" "4,8,4,8,8,8,16,8,16") - (set_attr "arm_pool_range" "*,*,*,1020,*,*,*,1020,*") - (set_attr "thumb2_pool_range" "*,*,*,1018,*,*,*,1018,*") - (set_attr "neg_pool_range" "*,*,*,996,*,*,*,996,*")]) + neon_move_q,neon_load2_2reg_q,neon_to_gp_q,\ + neon_from_gp_q,mov_reg,neon_load1_4reg,neon_store1_4reg") + (set_attr "length" "4,8,4,4,8,8,8,16,8,16") + (set_attr "arm_pool_range" "*,*,*,*,1020,*,*,*,1020,*") + (set_attr "thumb2_pool_range" "*,*,*,*,1018,*,*,*,1018,*") + (set_attr "neg_pool_range" "*,*,*,*,996,*,*,*,996,*")]) /* We define these mov expanders to match the standard mov$a optab to prevent the mid-end from trying to do a subreg for these modes which is the most @@ -1033,7 +1034,7 @@ (define_insn "vashl3" [(set (match_operand:VDQIW 0 "s_register_operand" "=w,w") (ashift:VDQIW (match_operand:VDQIW 1 "s_register_operand" "w,w") - (match_operand:VDQIW 2 "imm_lshift_or_reg_neon" "w,Dn")))] + (match_operand:VDQIW 2 "imm_lshift_or_reg_neon" "w,Dm")))] "TARGET_NEON" { switch (which_alternative) @@ -1052,7 +1053,7 @@ (define_insn "vashr3_imm" [(set (match_operand:VDQIW 0 "s_register_operand" "=w") (ashiftrt:VDQIW (match_operand:VDQIW 1 "s_register_operand" "w") - (match_operand:VDQIW 2 "imm_for_neon_rshift_operand" "Dn")))] + (match_operand:VDQIW 2 "imm_for_neon_rshift_operand" "Dm")))] "TARGET_NEON" { return neon_output_shift_immediate ("vshr", 's', &operands[2], @@ -1065,7 +1066,7 @@ (define_insn "vlshr3_imm" [(set (match_operand:VDQIW 0 "s_register_operand" "=w") (lshiftrt:VDQIW (match_operand:VDQIW 1 "s_register_operand" "w") - (match_operand:VDQIW 2 "imm_for_neon_rshift_operand" "Dn")))] + (match_operand:VDQIW 2 "imm_for_neon_rshift_operand" "Dm")))] "TARGET_NEON" { return neon_output_shift_immediate ("vshr", 'u', &operands[2], diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 7c3a5f81edc..06d07417451 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-04-10 Matthew Malcomson + + PR target/90024 + * gcc.dg/torture/neon-immediate-timode.c: New test. + 019-04-07 Uroš Bizjak PR target/89945 diff --git a/gcc/testsuite/gcc.dg/torture/neon-immediate-timode.c b/gcc/testsuite/gcc.dg/torture/neon-immediate-timode.c new file mode 100644 index 00000000000..35f7d2cd32c --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/neon-immediate-timode.c @@ -0,0 +1,10 @@ +union a { + char b; + long long c; +}; +union a d; +int g(int, union a, union a); +void e() { + union a f[2] = {-1L}; + g(0, d, f[0]); +} -- cgit v1.2.3 From 623093dcfe937e665d2303b66ddf2e9822223037 Mon Sep 17 00:00:00 2001 From: Harald Anlauf Date: Wed, 10 Apr 2019 20:26:44 +0000 Subject: 2019-04-10 Harald Anlauf Backport from trunk PR fortran/89904 * check.c (gfc_check_transfer): Reject procedures as actual arguments for SOURCE and MOLD of TRANSFER intrinsic. PR fortran/89904 * gfortran.dg/pr85797.f90: Adjust testcase. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270265 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fortran/ChangeLog | 7 +++++++ gcc/fortran/check.c | 22 ++++++++++++++++++++++ gcc/testsuite/ChangeLog | 6 ++++++ gcc/testsuite/gfortran.dg/pr85797.f90 | 16 +++++++--------- 4 files changed, 42 insertions(+), 9 deletions(-) diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 1017a313edd..c7545e28705 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,10 @@ +2019-04-10 Harald Anlauf + + Backport from trunk + PR fortran/89904 + * check.c (gfc_check_transfer): Reject procedures as actual + arguments for SOURCE and MOLD of TRANSFER intrinsic. + 2019-03-31 Harald Anlauf PR fortran/83515 diff --git a/gcc/fortran/check.c b/gcc/fortran/check.c index febf77fd3e7..2a24147cfe6 100644 --- a/gcc/fortran/check.c +++ b/gcc/fortran/check.c @@ -5477,6 +5477,26 @@ gfc_check_transfer (gfc_expr *source, gfc_expr *mold, gfc_expr *size) size_t source_size; size_t result_size; + /* SOURCE shall be a scalar or array of any type. */ + if (source->ts.type == BT_PROCEDURE + && source->symtree->n.sym->attr.subroutine == 1) + { + gfc_error ("% argument of % intrinsic at %L " + "must not be a %s", &source->where, + gfc_basic_typename (source->ts.type)); + return false; + } + + /* MOLD shall be a scalar or array of any type. */ + if (mold->ts.type == BT_PROCEDURE + && mold->symtree->n.sym->attr.subroutine == 1) + { + gfc_error ("% argument of % intrinsic at %L " + "must not be a %s", &mold->where, + gfc_basic_typename (mold->ts.type)); + return false; + } + if (mold->ts.type == BT_HOLLERITH) { gfc_error ("% argument of % intrinsic at %L must not be" @@ -5484,6 +5504,8 @@ gfc_check_transfer (gfc_expr *source, gfc_expr *mold, gfc_expr *size) return false; } + /* SIZE (optional) shall be an integer scalar. The corresponding actual + argument shall not be an optional dummy argument. */ if (size != NULL) { if (!type_check (size, 2, BT_INTEGER)) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 06d07417451..29a57b353eb 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2019-04-10 Harald Anlauf + + Backport from trunk + PR fortran/89904 + * gfortran.dg/pr85797.f90: Adjust testcase. + 2019-04-10 Matthew Malcomson PR target/90024 diff --git a/gcc/testsuite/gfortran.dg/pr85797.f90 b/gcc/testsuite/gfortran.dg/pr85797.f90 index fe6d96d6e30..01d8e640621 100644 --- a/gcc/testsuite/gfortran.dg/pr85797.f90 +++ b/gcc/testsuite/gfortran.dg/pr85797.f90 @@ -1,29 +1,27 @@ ! { dg-do compile } -! { dg-options "-Wall" } ! PR fortran/83515 - ICE: Invalid expression in gfc_element_size ! PR fortran/85797 - ICE in gfc_element_size, at fortran/target-memory.c:126 +! PR fortran/89904 - ICE in gfortran starting with r270045 -subroutine a - c = transfer (a, b) ! { dg-warning "Non-RECURSIVE procedure" } +recursive subroutine a + c = transfer (a, b) ! { dg-error "'SOURCE' argument of 'TRANSFER'" } end recursive subroutine d - c = transfer (d, b) -end - -recursive subroutine e - k = transfer (transfer (e, e), 1) + c = transfer (b, d) ! { dg-error "'MOLD' argument of 'TRANSFER'" } end subroutine f use, intrinsic :: iso_c_binding integer(c_intptr_t) :: b, c + procedure(), pointer :: a + c = transfer (a, b) c = transfer (transfer (b, a), b) end module m contains - function f () result (z) ! { dg-warning "Return value" } + function f () result (z) class(*), pointer :: z end function f recursive subroutine s (q) -- cgit v1.2.3 From f033fb4bef3fcbab72bdd458ba208ea65c6d55d2 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Thu, 11 Apr 2019 00:16:24 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270270 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 9035ee48445..1770dc29ef7 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190410 +20190411 -- cgit v1.2.3 From cc1ac0b234278096eede0754d833d17bae6d7603 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Thu, 11 Apr 2019 07:31:58 +0000 Subject: 2019-04-11 Richard Biener PR tree-optimization/90018 * tree-vect-data-refs.c (vect_preserves_scalar_order_p): Test both SLP and interleaving variants. * gcc.dg/vect/pr90018.c: New testcase. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270274 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 6 ++++ gcc/testsuite/ChangeLog | 5 +++ gcc/testsuite/gcc.dg/vect/pr90018.c | 47 +++++++++++++++++++++++++++ gcc/tree-vect-data-refs.c | 64 ++++++++++++++++++++++++++++--------- 4 files changed, 107 insertions(+), 15 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/vect/pr90018.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 62a30dfac22..5df5b720df8 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2019-04-11 Richard Biener + + PR tree-optimization/90018 + * tree-vect-data-refs.c (vect_preserves_scalar_order_p): + Test both SLP and interleaving variants. + 2019-04-10 Matthew Malcomson PR target/90024 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 29a57b353eb..500934c844d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-04-11 Richard Biener + + PR tree-optimization/90018 + * gcc.dg/vect/pr90018.c: New testcase. + 2019-04-10 Harald Anlauf Backport from trunk diff --git a/gcc/testsuite/gcc.dg/vect/pr90018.c b/gcc/testsuite/gcc.dg/vect/pr90018.c new file mode 100644 index 00000000000..85c9654ceda --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/pr90018.c @@ -0,0 +1,47 @@ +/* { dg-do run } */ +/* { dg-require-effective-target vect_double } */ + +#include "tree-vect.h" + +void __attribute__((noinline,noclone)) +foo (double *a4, int n) +{ + for (int i = 0; i < n; ++i) + { + /* We may not apply interleaving to the group (a), (b) because of (c). */ + double tem1 = a4[i*4] + a4[i*4+n*4] /* (a) */; + double tem2 = a4[i*4+2*n*4+1]; + a4[i*4+n*4+1] = tem1; /* (c) */ + a4[i*4+1] = tem2; + double tem3 = a4[i*4] - tem2; + double tem4 = tem3 + a4[i*4+n*4]; + a4[i*4+n*4+1] = tem4 + a4[i*4+n*4+1] /* (b) */; + } +} +int main(int argc, char **argv) +{ + int n = 11; + double a4[4 * n * 3]; + double a42[4 * n * 3]; + check_vect (); + for (int i = 0; i < 4 * n * 3; ++i) + a4[i] = a42[i] = i; + foo (a4, n); + for (int i = 0; i < n; ++i) + { + double tem1 = a42[i*4] + a42[i*4+n*4]; + double tem2 = a42[i*4+2*n*4+1]; + a42[i*4+n*4+1] = tem1; + a42[i*4+1] = tem2; + double tem3 = a42[i*4] - tem2; + double tem4 = tem3 + a42[i*4+n*4]; + a42[i*4+n*4+1] = tem4 + a42[i*4+n*4+1]; + __asm__ volatile ("": : : "memory"); + } + for (int i = 0; i < 4 * n * 3; ++i) + if (a4[i] != a42[i]) + __builtin_abort (); + return 0; +} + +/* { dg-final { scan-tree-dump "READ_WRITE dependence in interleaving" "vect" } } */ diff --git a/gcc/tree-vect-data-refs.c b/gcc/tree-vect-data-refs.c index 68f8027583e..0c04ff1bbb9 100644 --- a/gcc/tree-vect-data-refs.c +++ b/gcc/tree-vect-data-refs.c @@ -206,26 +206,60 @@ vect_preserves_scalar_order_p (gimple *stmt_a, gimple *stmt_b) return true; /* STMT_A and STMT_B belong to overlapping groups. All loads in a - group are emitted at the position of the last scalar load and all - stores in a group are emitted at the position of the last scalar store. + SLP group are emitted at the position of the last scalar load and + all loads in an interleaving group are emitted at the position + of the first scalar load. + Stores in a group are emitted at the position of the last scalar store. Compute that position and check whether the resulting order matches - the current one. */ - gimple *last_a = GROUP_FIRST_ELEMENT (stmtinfo_a); + the current one. + We have not yet decided between SLP and interleaving so we have + to conservatively assume both. */ + gimple *il_a; + gimple *last_a = il_a = GROUP_FIRST_ELEMENT (stmtinfo_a); if (last_a) - for (gimple *s = GROUP_NEXT_ELEMENT (vinfo_for_stmt (last_a)); s; - s = GROUP_NEXT_ELEMENT (vinfo_for_stmt (s))) - last_a = get_later_stmt (last_a, s); + { + for (gimple *s = GROUP_NEXT_ELEMENT (vinfo_for_stmt (last_a)); s; + s = GROUP_NEXT_ELEMENT (vinfo_for_stmt (s))) + last_a = get_later_stmt (last_a, s); + if (!DR_IS_WRITE (STMT_VINFO_DATA_REF (stmtinfo_a))) + { + for (gimple *s = GROUP_NEXT_ELEMENT (vinfo_for_stmt (il_a)); s; + s = GROUP_NEXT_ELEMENT (vinfo_for_stmt (s))) + if (get_later_stmt (il_a, s) == il_a) + il_a = s; + } + else + il_a = last_a; + } else - last_a = stmt_a; - gimple *last_b = GROUP_FIRST_ELEMENT (stmtinfo_b); + last_a = il_a = stmt_a; + gimple *il_b; + gimple *last_b = il_b = GROUP_FIRST_ELEMENT (stmtinfo_b); if (last_b) - for (gimple *s = GROUP_NEXT_ELEMENT (vinfo_for_stmt (last_b)); s; - s = GROUP_NEXT_ELEMENT (vinfo_for_stmt (s))) - last_b = get_later_stmt (last_b, s); + { + for (gimple *s = GROUP_NEXT_ELEMENT (vinfo_for_stmt (last_b)); s; + s = GROUP_NEXT_ELEMENT (vinfo_for_stmt (s))) + last_b = get_later_stmt (last_b, s); + if (!DR_IS_WRITE (STMT_VINFO_DATA_REF (stmtinfo_b))) + { + for (gimple *s = GROUP_NEXT_ELEMENT (vinfo_for_stmt (il_b)); s; + s = GROUP_NEXT_ELEMENT (vinfo_for_stmt (s))) + if (get_later_stmt (il_b, s) == il_b) + il_b = s; + } + else + il_b = last_b; + } else - last_b = stmt_b; - return ((get_later_stmt (last_a, last_b) == last_a) - == (get_later_stmt (stmt_a, stmt_b) == stmt_a)); + last_b = il_b = stmt_b; + bool a_after_b = (get_later_stmt (stmt_a, stmt_b) == stmt_a); + return (/* SLP */ + (get_later_stmt (last_a, last_b) == last_a) == a_after_b + /* Interleaving */ + && (get_later_stmt (il_a, il_b) == il_a) == a_after_b + /* Mixed */ + && (get_later_stmt (il_a, last_b) == il_a) == a_after_b + && (get_later_stmt (last_a, il_b) == last_a) == a_after_b); } /* A subroutine of vect_analyze_data_ref_dependence. Handle -- cgit v1.2.3 From 6a6240eb8b44b2024fd777f28a87bc6570a08a89 Mon Sep 17 00:00:00 2001 From: Matthew Malcomson Date: Thu, 11 Apr 2019 10:12:50 +0000 Subject: [testsuite][arm] Update warning prune regex r269586 changed the format of some warning messages. Each switch in the warning message is now surrounded by single quotes. This commit updates the regex's in arm.exp dejagnu files to match the new format and remove the extra 20+ FAILs on excess errors that are introduced on certain variations (e.g. arm-eabi-aem/-marm/-march=armv7-a/-mfpu=vfpv3-d16/-mfloat-abi=softfp). Regtested arm.exp with cross-compiler arm-none-eabi gcc/testsuite/ChangeLog: 2019-04-11 Matthew Malcomson * g++.target/arm/arm.exp: Change format of default prune regex. * gcc.target/arm/arm.exp: Change format of default prune regex. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270279 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.target/arm/arm.exp | 2 +- gcc/testsuite/gcc.target/arm/arm.exp | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 500934c844d..e73d0fdddcd 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-04-11 Matthew Malcomson + + * g++.target/arm/arm.exp: Change format of default prune regex. + * gcc.target/arm/arm.exp: Change format of default prune regex. + 2019-04-11 Richard Biener PR tree-optimization/90018 diff --git a/gcc/testsuite/g++.target/arm/arm.exp b/gcc/testsuite/g++.target/arm/arm.exp index 1a169d2f220..de788977434 100644 --- a/gcc/testsuite/g++.target/arm/arm.exp +++ b/gcc/testsuite/g++.target/arm/arm.exp @@ -35,7 +35,7 @@ if ![info exists DEFAULT_CXXFLAGS] then { global dg_runtest_extra_prunes set dg_runtest_extra_prunes "" -lappend dg_runtest_extra_prunes "warning: switch -m(cpu|arch)=.* conflicts with -m(cpu|arch)=.* switch" +lappend dg_runtest_extra_prunes "warning: switch '-m(cpu|arch)=.*' conflicts with '-m(cpu|arch)=.*' switch" # Initialize `dg'. dg-init diff --git a/gcc/testsuite/gcc.target/arm/arm.exp b/gcc/testsuite/gcc.target/arm/arm.exp index 2f219492419..f4bdff26187 100644 --- a/gcc/testsuite/gcc.target/arm/arm.exp +++ b/gcc/testsuite/gcc.target/arm/arm.exp @@ -33,7 +33,7 @@ if ![info exists DEFAULT_CFLAGS] then { # This variable should only apply to tests called in this exp file. global dg_runtest_extra_prunes set dg_runtest_extra_prunes "" -lappend dg_runtest_extra_prunes "warning: switch -m(cpu|arch)=.* conflicts with -m(cpu|arch)=.* switch" +lappend dg_runtest_extra_prunes "warning: switch '-m(cpu|arch)=.*' conflicts with '-m(cpu|arch)=.*' switch" # Initialize `dg'. dg-init -- cgit v1.2.3 From 5445067c85f1047942991c85fb6bb98349aa36c0 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Fri, 12 Apr 2019 00:16:27 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270298 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 1770dc29ef7..fe4d26b6b7b 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190411 +20190412 -- cgit v1.2.3 From a9d23fd6fd4454c21b198acaec866bd74b339b43 Mon Sep 17 00:00:00 2001 From: Matthew Malcomson Date: Fri, 12 Apr 2019 13:09:17 +0000 Subject: Revert r270279 This patch was applied on the wrong branch. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270315 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/testsuite/ChangeLog | 5 ----- gcc/testsuite/g++.target/arm/arm.exp | 2 +- gcc/testsuite/gcc.target/arm/arm.exp | 2 +- 3 files changed, 2 insertions(+), 7 deletions(-) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e73d0fdddcd..500934c844d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,8 +1,3 @@ -2019-04-11 Matthew Malcomson - - * g++.target/arm/arm.exp: Change format of default prune regex. - * gcc.target/arm/arm.exp: Change format of default prune regex. - 2019-04-11 Richard Biener PR tree-optimization/90018 diff --git a/gcc/testsuite/g++.target/arm/arm.exp b/gcc/testsuite/g++.target/arm/arm.exp index de788977434..1a169d2f220 100644 --- a/gcc/testsuite/g++.target/arm/arm.exp +++ b/gcc/testsuite/g++.target/arm/arm.exp @@ -35,7 +35,7 @@ if ![info exists DEFAULT_CXXFLAGS] then { global dg_runtest_extra_prunes set dg_runtest_extra_prunes "" -lappend dg_runtest_extra_prunes "warning: switch '-m(cpu|arch)=.*' conflicts with '-m(cpu|arch)=.*' switch" +lappend dg_runtest_extra_prunes "warning: switch -m(cpu|arch)=.* conflicts with -m(cpu|arch)=.* switch" # Initialize `dg'. dg-init diff --git a/gcc/testsuite/gcc.target/arm/arm.exp b/gcc/testsuite/gcc.target/arm/arm.exp index f4bdff26187..2f219492419 100644 --- a/gcc/testsuite/gcc.target/arm/arm.exp +++ b/gcc/testsuite/gcc.target/arm/arm.exp @@ -33,7 +33,7 @@ if ![info exists DEFAULT_CFLAGS] then { # This variable should only apply to tests called in this exp file. global dg_runtest_extra_prunes set dg_runtest_extra_prunes "" -lappend dg_runtest_extra_prunes "warning: switch '-m(cpu|arch)=.*' conflicts with '-m(cpu|arch)=.*' switch" +lappend dg_runtest_extra_prunes "warning: switch -m(cpu|arch)=.* conflicts with -m(cpu|arch)=.* switch" # Initialize `dg'. dg-init -- cgit v1.2.3 From daef13acc9650f235acb56aee121df201b346c0a Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Sat, 13 Apr 2019 00:16:30 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270334 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index fe4d26b6b7b..c7d138c5c1f 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190412 +20190413 -- cgit v1.2.3 From aa80a14941df85c12ca7aca2c5172f16711552be Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Sun, 14 Apr 2019 00:16:12 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270343 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index c7d138c5c1f..47f613afa56 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190413 +20190414 -- cgit v1.2.3 From 64a5e5f1b0ec7342879f69d911e2eec54a8c01b2 Mon Sep 17 00:00:00 2001 From: Thomas Koenig Date: Sun, 14 Apr 2019 11:26:18 +0000 Subject: 2019-04-14 Thomas Koenig Backport from trunk PR fortran/89981 * resolve.c (resolve_global_procedure): If the global symbol is an ENTRY, also look up its name among the entries. 2019-04-14 Thomas Koenig Backport from trunk PR fortran/89981 * gfortran.dg/entry_22.f90: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270350 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fortran/ChangeLog | 7 +++++++ gcc/fortran/resolve.c | 2 +- gcc/testsuite/ChangeLog | 6 ++++++ gcc/testsuite/gfortran.dg/entry_22.f90 | 12 ++++++++++++ 4 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gfortran.dg/entry_22.f90 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index c7545e28705..9da1a9f159e 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,10 @@ +2019-04-14 Thomas Koenig + + Backport from trunk + PR fortran/89981 + * resolve.c (resolve_global_procedure): If the global symbol is an + ENTRY, also look up its name among the entries. + 2019-04-10 Harald Anlauf Backport from trunk diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index b68c5ffe0b6..87d5969b3c9 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -2540,7 +2540,7 @@ resolve_global_procedure (gfc_symbol *sym, locus *where, if (gsym->binding_label && gsym->sym_name != def_sym->name) gfc_find_symbol (gsym->sym_name, gsym->ns, 0, &def_sym); - if (def_sym->attr.entry_master) + if (def_sym->attr.entry_master || def_sym->attr.entry) { gfc_entry_list *entry; for (entry = gsym->ns->entries; entry; entry = entry->next) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 500934c844d..946d862ffab 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2019-04-14 Thomas Koenig + + Backport from trunk + PR fortran/89981 + * gfortran.dg/entry_22.f90: New test. + 2019-04-11 Richard Biener PR tree-optimization/90018 diff --git a/gcc/testsuite/gfortran.dg/entry_22.f90 b/gcc/testsuite/gfortran.dg/entry_22.f90 new file mode 100644 index 00000000000..7753429d65b --- /dev/null +++ b/gcc/testsuite/gfortran.dg/entry_22.f90 @@ -0,0 +1,12 @@ +! { dg-do compile } +! { dg-additional-options "-pedantic" } +! PR fortran/89981 - this used to give a wrong warning (error with +! -pedantic) +program main + call bar(i) + call baz(i) ! { dg-error "Type mismatch in argument" } +end program main +subroutine foo(r) + entry bar(i) + entry baz(r) +end subroutine foo -- cgit v1.2.3 From 8f2fbbaf757d52a4411c77ac64d7364c089b7fe1 Mon Sep 17 00:00:00 2001 From: Thomas Koenig Date: Sun, 14 Apr 2019 12:17:42 +0000 Subject: 2019-04-14 Thomas Koenig PR fortran/87352 Backport from trunk * gfortran.h (gfc_component): Add finalized field. * class.c (finalize_component): If the component is already finalized, return early. Set component->finalized on exit. 2019-04-14 Thomas Koenig Backport from trunk PR fortran/87352 * gfortran.dg/finalize_28.f90: Adjust count of __builtin_free. * gfortran.dg/finalize_34.f90: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270351 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fortran/ChangeLog | 8 ++++++++ gcc/fortran/class.c | 4 ++++ gcc/fortran/gfortran.h | 1 + gcc/testsuite/ChangeLog | 7 +++++++ gcc/testsuite/gfortran.dg/finalize_28.f90 | 2 +- gcc/testsuite/gfortran.dg/finalize_34.f90 | 25 +++++++++++++++++++++++++ 6 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gfortran.dg/finalize_34.f90 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 9da1a9f159e..7442bda84c0 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,11 @@ +2019-04-14 Thomas Koenig + + Backport from trunk + PR fortran/87352 + * gfortran.h (gfc_component): Add finalized field. + * class.c (finalize_component): If the component is already + finalized, return early. Set component->finalized on exit. + 2019-04-14 Thomas Koenig Backport from trunk diff --git a/gcc/fortran/class.c b/gcc/fortran/class.c index cb9f0d9f23d..23a0468dedd 100644 --- a/gcc/fortran/class.c +++ b/gcc/fortran/class.c @@ -907,6 +907,9 @@ finalize_component (gfc_expr *expr, gfc_symbol *derived, gfc_component *comp, if (!comp_is_finalizable (comp)) return; + if (comp->finalized) + return; + e = gfc_copy_expr (expr); if (!e->ref) e->ref = ref = gfc_get_ref (); @@ -1034,6 +1037,7 @@ finalize_component (gfc_expr *expr, gfc_symbol *derived, gfc_component *comp, sub_ns); gfc_free_expr (e); } + comp->finalized = true; } diff --git a/gcc/fortran/gfortran.h b/gcc/fortran/gfortran.h index dd512d94922..ebe6eab558b 100644 --- a/gcc/fortran/gfortran.h +++ b/gcc/fortran/gfortran.h @@ -1080,6 +1080,7 @@ typedef struct gfc_component struct gfc_typebound_proc *tb; /* When allocatable/pointer and in a coarray the associated token. */ tree caf_token; + bool finalized; } gfc_component; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 946d862ffab..dd8826dc163 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2019-04-14 Thomas Koenig + + Backport from trunk + PR fortran/87352 + * gfortran.dg/finalize_28.f90: Adjust count of __builtin_free. + * gfortran.dg/finalize_34.f90: New test. + 2019-04-14 Thomas Koenig Backport from trunk diff --git a/gcc/testsuite/gfortran.dg/finalize_28.f90 b/gcc/testsuite/gfortran.dg/finalize_28.f90 index f0c9665252f..597413b2dd3 100644 --- a/gcc/testsuite/gfortran.dg/finalize_28.f90 +++ b/gcc/testsuite/gfortran.dg/finalize_28.f90 @@ -21,4 +21,4 @@ contains integer, intent(out) :: edges(:,:) end subroutine coo_dump_edges end module coo_graphs -! { dg-final { scan-tree-dump-times "__builtin_free" 6 "original" } } +! { dg-final { scan-tree-dump-times "__builtin_free" 5 "original" } } diff --git a/gcc/testsuite/gfortran.dg/finalize_34.f90 b/gcc/testsuite/gfortran.dg/finalize_34.f90 new file mode 100644 index 00000000000..e2f02a5c51c --- /dev/null +++ b/gcc/testsuite/gfortran.dg/finalize_34.f90 @@ -0,0 +1,25 @@ +! { dg-do compile } +! { dg-additional-options "-fdump-tree-original" } +! PR 87352 - this used to cause an excessive number of deallocations. +module testmodule + implicit none + public + + type :: evtlist_type + real, allocatable, dimension(:) :: p1 + real, allocatable, dimension(:) :: p2 + real, allocatable, dimension(:) :: p3 + real, allocatable, dimension(:) :: p4 + end type evtlist_type + + type :: evtlistlist_type + type(evtlist_type) :: evtlist(1:1) + end type evtlistlist_type + +end module testmodule + +program main + use testmodule + type(evtlist_type), dimension(10) :: a +end program main +! { dg-final { scan-tree-dump-times "__builtin_free" 8 "original" } } -- cgit v1.2.3 From 6083574a10f2c7dea2405942fb1827ad93edb004 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Mon, 15 Apr 2019 00:16:13 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270357 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 47f613afa56..096e3bf457f 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190414 +20190415 -- cgit v1.2.3 From 8e829d8458df418b87248249eb817a9a6fdf1675 Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Mon, 15 Apr 2019 08:53:24 +0000 Subject: Backport r268060 2019-04-15 Martin Liska Backport from mainline 2019-01-18 Martin Liska Richard Biener PR middle-end/88587 * cgraph.h (create_version_clone_with_body): Add new argument with attributes. * cgraphclones.c (cgraph_node::create_version_clone): Add DECL_ATTRIBUTES to a newly created decl. And call valid_attribute_p so that proper cl_target_optimization_node is set for the newly created declaration. * multiple_target.c (create_target_clone): Set DECL_ATTRIBUTES for declaration. (expand_target_clones): Do not call valid_attribute_p, it must be already done. * tree-inline.c (copy_decl_for_dup_finish): Reset mode for vector types. 2019-04-15 Martin Liska Backport from mainline 2019-01-18 Martin Liska PR middle-end/88587 * g++.target/i386/pr88587.C: New test. * gcc.target/i386/mvc13.c: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270365 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 20 ++++++++++++++++++++ gcc/cgraph.h | 7 ++++++- gcc/cgraphclones.c | 20 +++++++++++++++++++- gcc/multiple_target.c | 36 ++++++++++++++---------------------- gcc/testsuite/ChangeLog | 9 +++++++++ gcc/tree-inline.c | 4 ++++ 6 files changed, 72 insertions(+), 24 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 5df5b720df8..90b71abb781 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,23 @@ +2019-04-15 Martin Liska + + Backport from mainline + 2019-01-18 Martin Liska + Richard Biener + + PR middle-end/88587 + * cgraph.h (create_version_clone_with_body): Add new argument + with attributes. + * cgraphclones.c (cgraph_node::create_version_clone): Add + DECL_ATTRIBUTES to a newly created decl. And call + valid_attribute_p so that proper cl_target_optimization_node + is set for the newly created declaration. + * multiple_target.c (create_target_clone): Set DECL_ATTRIBUTES + for declaration. + (expand_target_clones): Do not call valid_attribute_p, it must + be already done. + * tree-inline.c (copy_decl_for_dup_finish): Reset mode for + vector types. + 2019-04-11 Richard Biener PR tree-optimization/90018 diff --git a/gcc/cgraph.h b/gcc/cgraph.h index 2509cd28881..9495863d8ce 100644 --- a/gcc/cgraph.h +++ b/gcc/cgraph.h @@ -997,12 +997,17 @@ public: If non-NULL BLOCK_TO_COPY determine what basic blocks to copy. If non_NULL NEW_ENTRY determine new entry BB of the clone. + If TARGET_ATTRIBUTES is non-null, when creating a new declaration, + add the attributes to DECL_ATTRIBUTES. And call valid_attribute_p + that will promote value of the attribute DECL_FUNCTION_SPECIFIC_TARGET + of the declaration. + Return the new version's cgraph node. */ cgraph_node *create_version_clone_with_body (vec redirect_callers, vec *tree_map, bitmap args_to_skip, bool skip_return, bitmap bbs_to_copy, basic_block new_entry_block, - const char *clone_name); + const char *clone_name, tree target_attributes = NULL_TREE); /* Insert a new cgraph_function_version_info node into cgraph_fnver_htab corresponding to cgraph_node. */ diff --git a/gcc/cgraphclones.c b/gcc/cgraphclones.c index 6e84a31c1a5..bdccde1ac35 100644 --- a/gcc/cgraphclones.c +++ b/gcc/cgraphclones.c @@ -938,6 +938,11 @@ cgraph_node::create_version_clone (tree new_decl, If non-NULL BLOCK_TO_COPY determine what basic blocks to copy. If non_NULL NEW_ENTRY determine new entry BB of the clone. + If TARGET_ATTRIBUTES is non-null, when creating a new declaration, + add the attributes to DECL_ATTRIBUTES. And call valid_attribute_p + that will promote value of the attribute DECL_FUNCTION_SPECIFIC_TARGET + of the declaration. + Return the new version's cgraph node. */ cgraph_node * @@ -945,7 +950,7 @@ cgraph_node::create_version_clone_with_body (vec redirect_callers, vec *tree_map, bitmap args_to_skip, bool skip_return, bitmap bbs_to_copy, basic_block new_entry_block, - const char *suffix) + const char *suffix, tree target_attributes) { tree old_decl = decl; cgraph_node *new_version_node = NULL; @@ -968,6 +973,19 @@ cgraph_node::create_version_clone_with_body SET_DECL_ASSEMBLER_NAME (new_decl, DECL_NAME (new_decl)); SET_DECL_RTL (new_decl, NULL); + if (target_attributes) + { + DECL_ATTRIBUTES (new_decl) = target_attributes; + + location_t saved_loc = input_location; + tree v = TREE_VALUE (target_attributes); + input_location = DECL_SOURCE_LOCATION (new_decl); + bool r = targetm.target_option.valid_attribute_p (new_decl, NULL, v, 0); + input_location = saved_loc; + if (!r) + return NULL; + } + /* When the old decl was a con-/destructor make sure the clone isn't. */ DECL_STATIC_CONSTRUCTOR (new_decl) = 0; DECL_STATIC_DESTRUCTOR (new_decl) = 0; diff --git a/gcc/multiple_target.c b/gcc/multiple_target.c index a1fe09a5983..be15af3142c 100644 --- a/gcc/multiple_target.c +++ b/gcc/multiple_target.c @@ -294,7 +294,8 @@ create_new_asm_name (char *old_asm_name, char *new_asm_name) /* Creates target clone of NODE. */ static cgraph_node * -create_target_clone (cgraph_node *node, bool definition, char *name) +create_target_clone (cgraph_node *node, bool definition, char *name, + tree attributes) { cgraph_node *new_node; @@ -303,13 +304,16 @@ create_target_clone (cgraph_node *node, bool definition, char *name) new_node = node->create_version_clone_with_body (vNULL, NULL, NULL, false, NULL, NULL, - name); + name, attributes); + if (new_node == NULL) + return NULL; new_node->force_output = true; } else { tree new_decl = copy_node (node->decl); new_node = cgraph_node::get_create (new_decl); + DECL_ATTRIBUTES (new_decl) = attributes; /* Generate a new name for the new version. */ symtab->change_decl_assembler_name (new_node->decl, clone_function_name (node->decl, @@ -399,22 +403,16 @@ expand_target_clones (struct cgraph_node *node, bool definition) create_new_asm_name (attr, suffix); /* Create new target clone. */ - cgraph_node *new_node = create_target_clone (node, definition, suffix); - new_node->local.local = false; - XDELETEVEC (suffix); - - /* Set new attribute for the clone. */ tree attributes = make_attribute ("target", attr, - DECL_ATTRIBUTES (new_node->decl)); - DECL_ATTRIBUTES (new_node->decl) = attributes; - location_t saved_loc = input_location; - input_location = DECL_SOURCE_LOCATION (node->decl); - if (!targetm.target_option.valid_attribute_p (new_node->decl, NULL, - TREE_VALUE (attributes), - 0)) + DECL_ATTRIBUTES (node->decl)); + + cgraph_node *new_node = create_target_clone (node, definition, suffix, + attributes); + if (new_node == NULL) return false; + new_node->local.local = false; + XDELETEVEC (suffix); - input_location = saved_loc; decl2_v = new_node->function_version (); if (decl2_v != NULL) continue; @@ -441,13 +439,7 @@ expand_target_clones (struct cgraph_node *node, bool definition) DECL_ATTRIBUTES (node->decl)); DECL_ATTRIBUTES (node->decl) = attributes; node->local.local = false; - location_t saved_loc = input_location; - input_location = DECL_SOURCE_LOCATION (node->decl); - bool ret - = targetm.target_option.valid_attribute_p (node->decl, NULL, - TREE_VALUE (attributes), 0); - input_location = saved_loc; - return ret; + return true; } static unsigned int diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index dd8826dc163..3439dbcae61 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,12 @@ +2019-04-15 Martin Liska + + Backport from mainline + 2019-01-18 Martin Liska + + PR middle-end/88587 + * g++.target/i386/pr88587.C: New test. + * gcc.target/i386/mvc13.c: New test. + 2019-04-14 Thomas Koenig Backport from trunk diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c index 324c1682921..f7a3216d792 100644 --- a/gcc/tree-inline.c +++ b/gcc/tree-inline.c @@ -5539,6 +5539,10 @@ copy_decl_for_dup_finish (copy_body_data *id, tree decl, tree copy) if (CODE_CONTAINS_STRUCT (TREE_CODE (copy), TS_DECL_WRTL) && !TREE_STATIC (copy) && !DECL_EXTERNAL (copy)) SET_DECL_RTL (copy, 0); + /* For vector typed decls make sure to update DECL_MODE according + to the new function context. */ + if (VECTOR_TYPE_P (TREE_TYPE (copy))) + SET_DECL_MODE (copy, TYPE_MODE (TREE_TYPE (copy))); /* These args would always appear unused, if not for this. */ TREE_USED (copy) = 1; -- cgit v1.2.3 From a755d36afa8441fca8b84b5ebc3b62da89da9eb8 Mon Sep 17 00:00:00 2001 From: Martin Jambor Date: Mon, 15 Apr 2019 14:31:57 +0000 Subject: Reorganize cgraph_node::clone_of_p 2019-04-15 Martin Jambor PR ipa/89693 * cgraph.c (clone_of_p): Loop over clone chain for each step in the thunk chain. testsuite/ * g++.dg/ipa/pr89693.C: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270371 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 9 +++++++ gcc/cgraph.c | 30 +++++++++++++--------- gcc/testsuite/ChangeLog | 7 +++++ gcc/testsuite/g++.dg/ipa/pr89693.C | 52 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 86 insertions(+), 12 deletions(-) create mode 100644 gcc/testsuite/g++.dg/ipa/pr89693.C diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 90b71abb781..377e36c245a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2019-04-15 Martin Jambor + + Backport from mainline + 2019-04-15 Martin Jambor + + PR ipa/89693 + * cgraph.c (clone_of_p): Loop over clone chain for each step in + the thunk chain. + 2019-04-15 Martin Liska Backport from mainline diff --git a/gcc/cgraph.c b/gcc/cgraph.c index 8f4019b1fb9..74a82129f62 100644 --- a/gcc/cgraph.c +++ b/gcc/cgraph.c @@ -3014,17 +3014,25 @@ cgraph_node::collect_callers (void) static bool clone_of_p (cgraph_node *node, cgraph_node *node2) { - bool skipped_thunk = false; node = node->ultimate_alias_target (); node2 = node2->ultimate_alias_target (); + if (node2->clone_of == node + || node2->former_clone_of == node->decl) + return true; + + if (!node->thunk.thunk_p && !node->former_thunk_p ()) + { + while (node2 && node->decl != node2->decl) + node2 = node2->clone_of; + return node2 != NULL; + } + /* There are no virtual clones of thunks so check former_clone_of or if we might have skipped thunks because this adjustments are no longer necessary. */ while (node->thunk.thunk_p || node->former_thunk_p ()) { - if (node2->former_clone_of == node->decl) - return true; if (!node->thunk.this_adjusting) return false; /* In case of instrumented expanded thunks, which can have multiple calls @@ -3033,23 +3041,21 @@ clone_of_p (cgraph_node *node, cgraph_node *node2) if (node->callees->next_callee) return true; node = node->callees->callee->ultimate_alias_target (); - skipped_thunk = true; - } - if (skipped_thunk) - { if (!node2->clone.args_to_skip || !bitmap_bit_p (node2->clone.args_to_skip, 0)) return false; if (node2->former_clone_of == node->decl) return true; - else if (!node2->clone_of) - return false; + + cgraph_node *n2 = node2; + while (n2 && node->decl != n2->decl) + n2 = n2->clone_of; + if (n2) + return true; } - while (node2 && node->decl != node2->decl) - node2 = node2->clone_of; - return node2 != NULL; + return false; } /* Verify edge count and frequency. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 3439dbcae61..8084d5e833f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2019-04-15 Martin Jambor + + Backport from mainline + 2019-04-15 Martin Jambor + + * g++.dg/ipa/pr89693.C: New test. + 2019-04-15 Martin Liska Backport from mainline diff --git a/gcc/testsuite/g++.dg/ipa/pr89693.C b/gcc/testsuite/g++.dg/ipa/pr89693.C new file mode 100644 index 00000000000..4ac83eeeb3a --- /dev/null +++ b/gcc/testsuite/g++.dg/ipa/pr89693.C @@ -0,0 +1,52 @@ +// Copyright (C) 2005 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 4 Apr 2005 +// Re-purposed to check for re-rurgesnce of PR 89693 in 2019. + +// { dg-do compile } +// { dg-options "-O3 -fno-ipa-icf-functions" } + +// Origin: yanliu@ca.ibm.com +// nathan@codesourcery.com + +struct A { + virtual void One (); +}; +struct B { + virtual B *Two (); + virtual B &Three (); +}; + +struct C : A, B +{ + virtual C *Two (); + virtual C &Three (); +}; +void A::One () {} +B *B::Two() {return this;} +B &B::Three() {return *this;} +C *C::Two () {return 0;} +C &C::Three () {return *(C *)0;} + +B *Foo (B *b) +{ + return b->Two (); +} + +B &Bar (B *b) +{ + return b->Three (); +} + +int main () +{ + C c; + + /* We should not adjust a null pointer. */ + if (Foo (&c)) + return 1; + /* But we should adjust a (bogus) null reference. */ + if (!&Bar (&c)) + return 2; + + return 0; +} -- cgit v1.2.3 From 5d95e6655fc923cb8138f78be8f9a93d79a295b0 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Tue, 16 Apr 2019 00:16:08 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270375 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 096e3bf457f..90427b7c530 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190415 +20190416 -- cgit v1.2.3 From 81444befcca0409534612309873222a5f8e85bb6 Mon Sep 17 00:00:00 2001 From: John David Anglin Date: Tue, 16 Apr 2019 23:21:13 +0000 Subject: PR libgfortran/79540 * io/write_float.def (build_float_string): Don't copy digits when ndigits is negative. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270398 138bc75d-0d04-0410-961f-82ee72b054a4 --- libgfortran/ChangeLog | 9 +++++++++ libgfortran/io/write_float.def | 5 +++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index c5c76614119..a763d351508 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,12 @@ +2019-04-16 John David Anglin + + Backport from mainline + 2019-03-25 John David Anglin + + PR libgfortran/79540 + * io/write_float.def (build_float_string): Don't copy digits when + ndigits is negative. + 2019-03-02 Jerry DeLisle PR libfortran/89020 diff --git a/libgfortran/io/write_float.def b/libgfortran/io/write_float.def index 25ea64beb21..a749f64b796 100644 --- a/libgfortran/io/write_float.def +++ b/libgfortran/io/write_float.def @@ -620,14 +620,15 @@ build_float_string (st_parameter_dt *dtp, const fnode *f, char *buffer, } /* Set digits after the decimal point, padding with zeros. */ - if (nafter > 0) + if (ndigits >= 0 && nafter > 0) { if (nafter > ndigits) i = ndigits; else i = nafter; - memcpy (put, digits, i); + if (i > 0) + memcpy (put, digits, i); while (i < nafter) put[i++] = '0'; -- cgit v1.2.3 From 883abbfbc6225956f732cf159a5b3448b82d5e06 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Wed, 17 Apr 2019 00:16:08 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270400 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 90427b7c530..b87667d2501 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190416 +20190417 -- cgit v1.2.3 From e6677fa5ea0d7d4ce0b6fbac6f50cc8cfd3f608b Mon Sep 17 00:00:00 2001 From: Kelvin Nilsen Date: Wed, 17 Apr 2019 15:40:12 +0000 Subject: gcc/ChangeLog: 2019-04-17 Kelvin Nilsen Backport from mainline 2019-03-15 Kelvin Nilsen PR target/87532 * config/rs6000/rs6000-c.c (altivec_resolve_overloaded_builtin): When handling vec_extract, use modular arithmetic to allow constant selectors greater than vector length. * config/rs6000/rs6000.c (rs6000_expand_vector_extract): Allow V1TImode vectors to have constant selector values greater than 0. Use modular arithmetic to compute vector index. (rs6000_split_vec_extract_var): Use modular arithmetic to compute index for in-memory vectors. Correct code generation for in-register vectors. Use inner mode of vector rather than mode of destination for move instruction. (altivec_expand_vec_ext_builtin): Use modular arithmetic to compute index. 2019-04-12 Kelvin Nilsen PR target/87532 * config/rs6000/vsx.md (*vsx_extract__mode_var): Use QI inner mode with V16QI vector mode. gcc/testsuite/ChangeLog: 2019-04-17 Kelvin Nilsen Backport from mainline 2019-03-15 Kelvin Nilsen PR target/87532 * gcc.target/powerpc/pr87532.c: New test. * gcc.target/powerpc/vec-extract-v16qiu-v2.h: New test. * gcc.target/powerpc/vec-extract-v16qiu-v2a.c: New test. * gcc.target/powerpc/vec-extract-v16qiu-v2b.c: New test. * gcc.target/powerpc/vsx-builtin-10a.c: New test. * gcc.target/powerpc/vsx-builtin-10b.c: New test. * gcc.target/powerpc/vsx-builtin-11a.c: New test. * gcc.target/powerpc/vsx-builtin-11b.c: New test. * gcc.target/powerpc/vsx-builtin-12a.c: New test. * gcc.target/powerpc/vsx-builtin-12b.c: New test. * gcc.target/powerpc/vsx-builtin-13a.c: New test. * gcc.target/powerpc/vsx-builtin-13b.c: New test. * gcc.target/powerpc/vsx-builtin-14a.c: New test. * gcc.target/powerpc/vsx-builtin-14b.c: New test. * gcc.target/powerpc/vsx-builtin-15a.c: New test. * gcc.target/powerpc/vsx-builtin-15b.c: New test. * gcc.target/powerpc/vsx-builtin-16a.c: New test. * gcc.target/powerpc/vsx-builtin-16b.c: New test. * gcc.target/powerpc/vsx-builtin-17a.c: New test. * gcc.target/powerpc/vsx-builtin-17b.c: New test. * gcc.target/powerpc/vsx-builtin-18a.c: New test. * gcc.target/powerpc/vsx-builtin-18b.c: New test. * gcc.target/powerpc/vsx-builtin-19a.c: New test. * gcc.target/powerpc/vsx-builtin-19b.c: New test. * gcc.target/powerpc/vsx-builtin-20a.c: New test. * gcc.target/powerpc/vsx-builtin-20b.c: New test. * gcc.target/powerpc/vsx-builtin-9a.c: New test. * gcc.target/powerpc/vsx-builtin-9b.c: New test. 2019-03-19 Kelvin Nilsen PR target/89736 * gcc.target/powerpc/pr87532-mc.c: Modify dejagnu directives to restrict this test to vsx targets. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270413 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 25 ++ gcc/config/rs6000/rs6000-c.c | 12 +- gcc/config/rs6000/rs6000.c | 55 +++-- gcc/config/rs6000/vsx.md | 8 +- gcc/testsuite/ChangeLog | 41 ++++ gcc/testsuite/gcc.target/powerpc/pr87532-mc.c | 258 +++++++++++++++++++++ gcc/testsuite/gcc.target/powerpc/pr87532.c | 72 ++++++ .../gcc.target/powerpc/vec-extract-v16qiu-v2.h | 253 ++++++++++++++++++++ .../gcc.target/powerpc/vec-extract-v16qiu-v2a.c | 14 ++ .../gcc.target/powerpc/vec-extract-v16qiu-v2b.c | 14 ++ gcc/testsuite/gcc.target/powerpc/vsx-builtin-10a.c | 155 +++++++++++++ gcc/testsuite/gcc.target/powerpc/vsx-builtin-10b.c | 155 +++++++++++++ gcc/testsuite/gcc.target/powerpc/vsx-builtin-11a.c | 149 ++++++++++++ gcc/testsuite/gcc.target/powerpc/vsx-builtin-11b.c | 149 ++++++++++++ gcc/testsuite/gcc.target/powerpc/vsx-builtin-12a.c | 109 +++++++++ gcc/testsuite/gcc.target/powerpc/vsx-builtin-12b.c | 109 +++++++++ gcc/testsuite/gcc.target/powerpc/vsx-builtin-13a.c | 124 ++++++++++ gcc/testsuite/gcc.target/powerpc/vsx-builtin-13b.c | 124 ++++++++++ gcc/testsuite/gcc.target/powerpc/vsx-builtin-14a.c | 126 ++++++++++ gcc/testsuite/gcc.target/powerpc/vsx-builtin-14b.c | 126 ++++++++++ gcc/testsuite/gcc.target/powerpc/vsx-builtin-15a.c | 113 +++++++++ gcc/testsuite/gcc.target/powerpc/vsx-builtin-15b.c | 113 +++++++++ gcc/testsuite/gcc.target/powerpc/vsx-builtin-16a.c | 165 +++++++++++++ gcc/testsuite/gcc.target/powerpc/vsx-builtin-16b.c | 165 +++++++++++++ gcc/testsuite/gcc.target/powerpc/vsx-builtin-17a.c | 155 +++++++++++++ gcc/testsuite/gcc.target/powerpc/vsx-builtin-17b.c | 155 +++++++++++++ gcc/testsuite/gcc.target/powerpc/vsx-builtin-18a.c | 149 ++++++++++++ gcc/testsuite/gcc.target/powerpc/vsx-builtin-18b.c | 149 ++++++++++++ gcc/testsuite/gcc.target/powerpc/vsx-builtin-19a.c | 109 +++++++++ gcc/testsuite/gcc.target/powerpc/vsx-builtin-19b.c | 109 +++++++++ gcc/testsuite/gcc.target/powerpc/vsx-builtin-20a.c | 115 +++++++++ gcc/testsuite/gcc.target/powerpc/vsx-builtin-20b.c | 115 +++++++++ gcc/testsuite/gcc.target/powerpc/vsx-builtin-9a.c | 164 +++++++++++++ gcc/testsuite/gcc.target/powerpc/vsx-builtin-9b.c | 164 +++++++++++++ 34 files changed, 3995 insertions(+), 23 deletions(-) create mode 100644 gcc/testsuite/gcc.target/powerpc/pr87532-mc.c create mode 100644 gcc/testsuite/gcc.target/powerpc/pr87532.c create mode 100644 gcc/testsuite/gcc.target/powerpc/vec-extract-v16qiu-v2.h create mode 100644 gcc/testsuite/gcc.target/powerpc/vec-extract-v16qiu-v2a.c create mode 100644 gcc/testsuite/gcc.target/powerpc/vec-extract-v16qiu-v2b.c create mode 100644 gcc/testsuite/gcc.target/powerpc/vsx-builtin-10a.c create mode 100644 gcc/testsuite/gcc.target/powerpc/vsx-builtin-10b.c create mode 100644 gcc/testsuite/gcc.target/powerpc/vsx-builtin-11a.c create mode 100644 gcc/testsuite/gcc.target/powerpc/vsx-builtin-11b.c create mode 100644 gcc/testsuite/gcc.target/powerpc/vsx-builtin-12a.c create mode 100644 gcc/testsuite/gcc.target/powerpc/vsx-builtin-12b.c create mode 100644 gcc/testsuite/gcc.target/powerpc/vsx-builtin-13a.c create mode 100644 gcc/testsuite/gcc.target/powerpc/vsx-builtin-13b.c create mode 100644 gcc/testsuite/gcc.target/powerpc/vsx-builtin-14a.c create mode 100644 gcc/testsuite/gcc.target/powerpc/vsx-builtin-14b.c create mode 100644 gcc/testsuite/gcc.target/powerpc/vsx-builtin-15a.c create mode 100644 gcc/testsuite/gcc.target/powerpc/vsx-builtin-15b.c create mode 100644 gcc/testsuite/gcc.target/powerpc/vsx-builtin-16a.c create mode 100644 gcc/testsuite/gcc.target/powerpc/vsx-builtin-16b.c create mode 100644 gcc/testsuite/gcc.target/powerpc/vsx-builtin-17a.c create mode 100644 gcc/testsuite/gcc.target/powerpc/vsx-builtin-17b.c create mode 100644 gcc/testsuite/gcc.target/powerpc/vsx-builtin-18a.c create mode 100644 gcc/testsuite/gcc.target/powerpc/vsx-builtin-18b.c create mode 100644 gcc/testsuite/gcc.target/powerpc/vsx-builtin-19a.c create mode 100644 gcc/testsuite/gcc.target/powerpc/vsx-builtin-19b.c create mode 100644 gcc/testsuite/gcc.target/powerpc/vsx-builtin-20a.c create mode 100644 gcc/testsuite/gcc.target/powerpc/vsx-builtin-20b.c create mode 100644 gcc/testsuite/gcc.target/powerpc/vsx-builtin-9a.c create mode 100644 gcc/testsuite/gcc.target/powerpc/vsx-builtin-9b.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 377e36c245a..67ae2ca179f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,28 @@ +2019-04-17 Kelvin Nilsen + + Backport from mainline + 2019-03-15 Kelvin Nilsen + + PR target/87532 + * config/rs6000/rs6000-c.c (altivec_resolve_overloaded_builtin): + When handling vec_extract, use modular arithmetic to allow + constant selectors greater than vector length. + * config/rs6000/rs6000.c (rs6000_expand_vector_extract): Allow + V1TImode vectors to have constant selector values greater than 0. + Use modular arithmetic to compute vector index. + (rs6000_split_vec_extract_var): Use modular arithmetic to compute + index for in-memory vectors. Correct code generation for + in-register vectors. Use inner mode of vector rather than mode of + destination for move instruction. + (altivec_expand_vec_ext_builtin): Use modular arithmetic to + compute index. + + 2019-04-12 Kelvin Nilsen + + PR target/87532 + * config/rs6000/vsx.md (*vsx_extract__mode_var): + Use QI inner mode with V16QI vector mode. + 2019-04-15 Martin Jambor Backport from mainline diff --git a/gcc/config/rs6000/rs6000-c.c b/gcc/config/rs6000/rs6000-c.c index 409fc2b29c0..a448bfafc25 100644 --- a/gcc/config/rs6000/rs6000-c.c +++ b/gcc/config/rs6000/rs6000-c.c @@ -6605,12 +6605,14 @@ altivec_resolve_overloaded_builtin (location_t loc, tree fndecl, arg2 = fold_for_warn (arg2); - /* If the second argument is an integer constant, if the value is in - the expected range, generate the built-in code if we can. We need - 64-bit and direct move to extract the small integer vectors. */ - if (TREE_CODE (arg2) == INTEGER_CST - && wi::ltu_p (wi::to_wide (arg2), nunits)) + /* If the second argument is an integer constant, generate + the built-in code if we can. We need 64-bit and direct + move to extract the small integer vectors. */ + if (TREE_CODE (arg2) == INTEGER_CST) { + wide_int selector = wi::to_wide (arg2); + selector = wi::umod_trunc (selector, nunits); + arg2 = wide_int_to_tree (TREE_TYPE (arg2), selector); switch (mode) { default: diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index fee41e171a7..7b69f82a415 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -7374,7 +7374,6 @@ rs6000_expand_vector_extract (rtx target, rtx vec, rtx elt) default: break; case E_V1TImode: - gcc_assert (INTVAL (elt) == 0 && inner_mode == TImode); emit_move_insn (target, gen_lowpart (TImode, vec)); break; case E_V2DFmode: @@ -7454,18 +7453,32 @@ rs6000_expand_vector_extract (rtx target, rtx vec, rtx elt) } } - gcc_assert (CONST_INT_P (elt)); - /* Allocate mode-sized buffer. */ mem = assign_stack_temp (mode, GET_MODE_SIZE (mode)); emit_move_insn (mem, vec); + if (CONST_INT_P (elt)) + { + int modulo_elt = INTVAL (elt) % GET_MODE_NUNITS (mode); - /* Add offset to field within buffer matching vector element. */ - mem = adjust_address_nv (mem, inner_mode, - INTVAL (elt) * GET_MODE_SIZE (inner_mode)); + /* Add offset to field within buffer matching vector element. */ + mem = adjust_address_nv (mem, inner_mode, + modulo_elt * GET_MODE_SIZE (inner_mode)); + emit_move_insn (target, adjust_address_nv (mem, inner_mode, 0)); + } + else + { + unsigned int ele_size = GET_MODE_SIZE (inner_mode); + rtx num_ele_m1 = GEN_INT (GET_MODE_NUNITS (mode) - 1); + rtx new_addr = gen_reg_rtx (Pmode); - emit_move_insn (target, adjust_address_nv (mem, inner_mode, 0)); + elt = gen_rtx_AND (Pmode, elt, num_ele_m1); + if (ele_size > 1) + elt = gen_rtx_MULT (Pmode, elt, GEN_INT (ele_size)); + new_addr = gen_rtx_PLUS (Pmode, XEXP (mem, 0), elt); + new_addr = change_address (mem, inner_mode, new_addr); + emit_move_insn (target, new_addr); + } } /* Helper function to return the register number of a RTX. */ @@ -7646,7 +7659,7 @@ rs6000_split_vec_extract_var (rtx dest, rtx src, rtx element, rtx tmp_gpr, rtx tmp_altivec) { machine_mode mode = GET_MODE (src); - machine_mode scalar_mode = GET_MODE (dest); + machine_mode scalar_mode = GET_MODE_INNER (GET_MODE (src)); unsigned scalar_size = GET_MODE_SIZE (scalar_mode); int byte_shift = exact_log2 (scalar_size); @@ -7657,6 +7670,10 @@ rs6000_split_vec_extract_var (rtx dest, rtx src, rtx element, rtx tmp_gpr, systems. */ if (MEM_P (src)) { + int num_elements = GET_MODE_NUNITS (mode); + rtx num_ele_m1 = GEN_INT (num_elements - 1); + + emit_insn (gen_anddi3 (element, element, num_ele_m1)); gcc_assert (REG_P (tmp_gpr)); emit_move_insn (dest, rs6000_adjust_vec_address (dest, src, element, tmp_gpr, scalar_mode)); @@ -7665,7 +7682,9 @@ rs6000_split_vec_extract_var (rtx dest, rtx src, rtx element, rtx tmp_gpr, else if (REG_P (src) || SUBREG_P (src)) { - int bit_shift = byte_shift + 3; + int num_elements = GET_MODE_NUNITS (mode); + int bits_in_element = mode_to_bits (GET_MODE_INNER (mode)); + int bit_shift = 7 - exact_log2 (num_elements); rtx element2; int dest_regno = regno_or_subregno (dest); int src_regno = regno_or_subregno (src); @@ -7741,7 +7760,7 @@ rs6000_split_vec_extract_var (rtx dest, rtx src, rtx element, rtx tmp_gpr, { if (!VECTOR_ELT_ORDER_BIG) { - rtx num_ele_m1 = GEN_INT (GET_MODE_NUNITS (mode) - 1); + rtx num_ele_m1 = GEN_INT (num_elements - 1); emit_insn (gen_anddi3 (tmp_gpr, element, num_ele_m1)); emit_insn (gen_subdi3 (tmp_gpr, num_ele_m1, tmp_gpr)); @@ -7799,8 +7818,8 @@ rs6000_split_vec_extract_var (rtx dest, rtx src, rtx element, rtx tmp_gpr, emit_insn (gen_vsx_vslo_v2di (tmp_altivec_di, src_v2di, tmp_altivec)); emit_move_insn (tmp_gpr_di, tmp_altivec_di); - emit_insn (gen_ashrdi3 (tmp_gpr_di, tmp_gpr_di, - GEN_INT (64 - (8 * scalar_size)))); + emit_insn (gen_lshrdi3 (tmp_gpr_di, tmp_gpr_di, + GEN_INT (64 - bits_in_element))); return; } @@ -15417,9 +15436,17 @@ altivec_expand_vec_ext_builtin (tree exp, rtx target) op0 = expand_normal (arg0); op1 = expand_normal (arg1); - /* Call get_element_number to validate arg1 if it is a constant. */ if (TREE_CODE (arg1) == INTEGER_CST) - (void) get_element_number (TREE_TYPE (arg0), arg1); + { + unsigned HOST_WIDE_INT elt; + unsigned HOST_WIDE_INT size = TYPE_VECTOR_SUBPARTS (TREE_TYPE (arg0)); + unsigned int truncated_selector; + /* Even if !tree_fits_uhwi_p (arg1)), TREE_INT_CST_LOW (arg0) + returns low-order bits of INTEGER_CST for modulo indexing. */ + elt = TREE_INT_CST_LOW (arg1); + truncated_selector = elt % size; + op1 = GEN_INT (truncated_selector); + } tmode = TYPE_MODE (TREE_TYPE (TREE_TYPE (arg0))); mode0 = TYPE_MODE (TREE_TYPE (arg0)); diff --git a/gcc/config/rs6000/vsx.md b/gcc/config/rs6000/vsx.md index c6eb9a74b38..17c24551306 100644 --- a/gcc/config/rs6000/vsx.md +++ b/gcc/config/rs6000/vsx.md @@ -3756,9 +3756,9 @@ DONE; }) -(define_insn_and_split "*vsx_extract___var" - [(set (match_operand:SDI 0 "gpc_reg_operand" "=r,r,r") - (zero_extend:SDI +(define_insn_and_split "*vsx_extract__mode_var" + [(set (match_operand: 0 "gpc_reg_operand" "=r,r,r") + (zero_extend: (unspec: [(match_operand:VSX_EXTRACT_I 1 "input_operand" "wK,v,m") (match_operand:DI 2 "gpc_reg_operand" "r,r,r")] @@ -3770,7 +3770,7 @@ "&& reload_completed" [(const_int 0)] { - machine_mode smode = mode; + machine_mode smode = mode; rs6000_split_vec_extract_var (gen_rtx_REG (smode, REGNO (operands[0])), operands[1], operands[2], operands[3], operands[4]); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 8084d5e833f..62b258a92e2 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,44 @@ +2019-04-17 Kelvin Nilsen + + Backport from mainline + 2019-03-15 Kelvin Nilsen + + PR target/87532 + * gcc.target/powerpc/pr87532.c: New test. + * gcc.target/powerpc/vec-extract-v16qiu-v2.h: New test. + * gcc.target/powerpc/vec-extract-v16qiu-v2a.c: New test. + * gcc.target/powerpc/vec-extract-v16qiu-v2b.c: New test. + * gcc.target/powerpc/vsx-builtin-10a.c: New test. + * gcc.target/powerpc/vsx-builtin-10b.c: New test. + * gcc.target/powerpc/vsx-builtin-11a.c: New test. + * gcc.target/powerpc/vsx-builtin-11b.c: New test. + * gcc.target/powerpc/vsx-builtin-12a.c: New test. + * gcc.target/powerpc/vsx-builtin-12b.c: New test. + * gcc.target/powerpc/vsx-builtin-13a.c: New test. + * gcc.target/powerpc/vsx-builtin-13b.c: New test. + * gcc.target/powerpc/vsx-builtin-14a.c: New test. + * gcc.target/powerpc/vsx-builtin-14b.c: New test. + * gcc.target/powerpc/vsx-builtin-15a.c: New test. + * gcc.target/powerpc/vsx-builtin-15b.c: New test. + * gcc.target/powerpc/vsx-builtin-16a.c: New test. + * gcc.target/powerpc/vsx-builtin-16b.c: New test. + * gcc.target/powerpc/vsx-builtin-17a.c: New test. + * gcc.target/powerpc/vsx-builtin-17b.c: New test. + * gcc.target/powerpc/vsx-builtin-18a.c: New test. + * gcc.target/powerpc/vsx-builtin-18b.c: New test. + * gcc.target/powerpc/vsx-builtin-19a.c: New test. + * gcc.target/powerpc/vsx-builtin-19b.c: New test. + * gcc.target/powerpc/vsx-builtin-20a.c: New test. + * gcc.target/powerpc/vsx-builtin-20b.c: New test. + * gcc.target/powerpc/vsx-builtin-9a.c: New test. + * gcc.target/powerpc/vsx-builtin-9b.c: New test. + + 2019-03-19 Kelvin Nilsen + + PR target/89736 + * gcc.target/powerpc/pr87532-mc.c: Modify dejagnu directives to + restrict this test to vsx targets. + 2019-04-15 Martin Jambor Backport from mainline diff --git a/gcc/testsuite/gcc.target/powerpc/pr87532-mc.c b/gcc/testsuite/gcc.target/powerpc/pr87532-mc.c new file mode 100644 index 00000000000..e5f79aa5dc1 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/pr87532-mc.c @@ -0,0 +1,258 @@ +/* { dg-do run { target int128 } } */ +/* { dg-require-effective-target vsx_hw } */ +/* { dg-options "-mvsx -O2" } */ + +/* This test should run the same on any target that supports vsx + instructions. Intentionally not specifying cpu in order to test + all code generation paths. */ + +#include +#include +#include + +#include + +static vector unsigned __int128 +deoptimize_uint128 (vector unsigned __int128 a) +{ + __asm__ (" # %x0" : "+v" (a)); + return a; +} + +static vector unsigned long long int +deoptimize_ulong (vector unsigned long long int a) +{ + __asm__ (" # %x0" : "+v" (a)); + return a; +} + +static vector unsigned int +deoptimize_uint (vector unsigned int a) +{ + __asm__ (" # %x0" : "+v" (a)); + return a; +} + +static vector unsigned char +deoptimize_uchar (vector unsigned char a) +{ + __asm__ (" # %x0" : "+v" (a)); + return a; +} + +static vector unsigned short +deoptimize_ushort (vector unsigned short a) +{ + __asm__ (" # %x0" : "+v" (a)); + return a; +} + +__attribute ((noinline)) unsigned __int128 +get_auto_n_uint128 (vector unsigned __int128 a, int n) +{ + return __builtin_vec_extract (a, n); +} + +__attribute ((noinline)) unsigned long long int +get_auto_n_ulong (vector unsigned long long int a, int n) +{ + return __builtin_vec_extract (a, n); +} + +__attribute ((noinline)) +unsigned int get_auto_n_uint (vector unsigned int a, int n) +{ + return __builtin_vec_extract (a, n); +} + +__attribute ((noinline)) +unsigned char get_auto_n_uchar (vector unsigned char a, int n) +{ + return __builtin_vec_extract (a, n); +} + +__attribute ((noinline)) +unsigned short get_auto_n_ushort (vector unsigned short a, int n) +{ + return __builtin_vec_extract (a, n); +} + + +int check_uint128_element (int i, unsigned __int128 entry) +{ + printf ("checking uint128 entry at index %d\n", i); + + return (entry == ((((unsigned __int128) 0xffeeddccbbaa9988ULL) << 64) + | 0x0706050403020100ULL)); +} + +int check_ulong_element (int i, unsigned long long int entry) +{ + printf ("checking ulong entry 0x%llx at index %d\n", entry, i); + + switch (i % 2) + { + case 0: return (entry == 0x9999901010ULL); + case 1: return (entry == 0x7777733333ULL); + default: + return 0; + } +} + +int check_uint_element (int i, unsigned int entry) +{ + printf ("checking uint entry 0x%x at index %d\n", entry, i); + + switch (i % 4) + { + case 0: return (entry == 0x99999); + case 1: return (entry == 0x01010); + case 2: return (entry == 0x77777); + case 3: return (entry == 0x33333); + default: + return 0; + } +} + +int check_uchar_element (int i, unsigned char entry) +{ + printf ("checking uchar entry 0x%x at index %d\n", entry, i); + switch (i % 16) + { + case 0: return (entry == 0x90); + case 1: return (entry == 0x80); + case 2: return (entry == 0x70); + case 3: return (entry == 0x60); + case 4: return (entry == 0x50); + case 5: return (entry == 0x40); + case 6: return (entry == 0x30); + case 7: return (entry == 0x20); + case 8: return (entry == 0x10); + case 9: return (entry == 0xf0); + case 10: return (entry == 0xe0); + case 11: return (entry == 0xd0); + case 12: return (entry == 0xc0); + case 13: return (entry == 0xb0); + case 14: return (entry == 0xa0); + case 15: return (entry == 0xff); + default: + return 0; + } +} + +int check_ushort_element (int i, unsigned short entry) +{ + printf ("checking ushort entry 0x%x at index %d\n", entry, i); + switch (i % 8) + { + case 0: return (entry == 0x9988); + case 1: return (entry == 0x8877); + case 2: return (entry == 0x7766); + case 3: return (entry == 0x6655); + case 4: return (entry == 0x5544); + case 5: return (entry == 0x4433); + case 6: return (entry == 0x3322); + case 7: return (entry == 0x2211); + default: + return 0; + } +} + +void do_auto_uint128 ( vector unsigned __int128 a ) +{ + int i; + unsigned __int128 c; + for (i = 0; i < 32; i += 3) + { + c = get_auto_n_uint128 (a,i); + if (!check_uint128_element (i, c)) abort (); + } + } + +void do_auto_ulong ( vector unsigned long long int a ) +{ + int i; + unsigned long long int c; + for (i = 0; i < 32; i += 3) + { + c = get_auto_n_ulong (a,i); + if (!check_ulong_element (i, c)) abort (); + } + } + +void do_auto_uint ( vector unsigned int a ) +{ + int i; + unsigned int c; + for (i = 0; i < 32; i += 3) + { + c = get_auto_n_uint (a,i); + if (!check_uint_element (i, c)) abort (); + } + } + +void do_auto_ushort ( vector unsigned short a ) +{ + int i; + unsigned short c; + for (i = 0; i < 32; i += 3) + { + c = get_auto_n_ushort (a,i); + if (!check_ushort_element (i, c)) abort (); + } +} + +void do_auto_uchar ( vector unsigned char a ) +{ + int i; + unsigned char c; + for (i = 0; i < 32; i += 3) + { + c = get_auto_n_uchar (a,i); + if (!check_uchar_element (i, c)) abort (); + } +} + +int +main (void) +{ + size_t i; + + vector unsigned __int128 u = { + ((((unsigned __int128) 0xffeeddccbbaa9988ULL) << 64) + | 0x0706050403020100ULL) }; + vector unsigned __int128 du; + + vector unsigned long long int v = { 0x9999901010ULL, 0x7777733333ULL }; + vector unsigned long long int dv; + + vector unsigned int x = { 0x99999, 0x01010, 0x77777, 0x33333 }; + vector unsigned int dx; + + vector unsigned char y = { 0x90, 0x80, 0x70, 0x60, 0x50, 0x40, 0x30, 0x20, + 0x10, 0xf0, 0xe0, 0xd0, 0xc0, 0xb0, 0xa0, 0xff }; + vector unsigned char dy; + + vector unsigned short z = { 0x9988, 0x8877, 0x7766, 0x6655, + 0x5544, 0x4433, 0x3322, 0x2211 }; + vector unsigned short dz; + + do_auto_uint128 (u); + do_auto_ulong (v); + do_auto_uint (x); + do_auto_uchar (y); + do_auto_ushort (z); + + du = deoptimize_uint128 (u); + dv = deoptimize_ulong (v); + dx = deoptimize_uint (x); + dy = deoptimize_uchar (y); + dz = deoptimize_ushort (z); + + do_auto_uint128 (du); + do_auto_ulong (dv); + do_auto_uint (dx); + do_auto_uchar (dy); + do_auto_ushort (dz); + return 0; +} diff --git a/gcc/testsuite/gcc.target/powerpc/pr87532.c b/gcc/testsuite/gcc.target/powerpc/pr87532.c new file mode 100644 index 00000000000..4b07f07258f --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/pr87532.c @@ -0,0 +1,72 @@ +/* { dg-do run } */ +/* { dg-require-effective-target vmx_hw } */ +/* { dg-options "-maltivec" } */ + +/* This test should run the same on any target that supports altivec/dfp + instructions. Intentionally not specifying cpu in order to test + all code generation paths. */ + +#include +#include +#include +#include + +static void +check (unsigned char, unsigned char) __attribute__((__noinline__)); + +static __attribute__((altivec(vector__))) unsigned char +deoptimize (__attribute__((altivec(vector__))) unsigned char) +__attribute__((__noinline__)); + +static __attribute__((altivec(vector__))) unsigned char +deoptimize (__attribute__((altivec(vector__))) unsigned char a) +{ + __asm__ (" # %x0" : "+v" (a)); + return a; +} + +// Toggle this attribute inline/noinline to see pass/fail. +// fails with the noinline attribute applied. +__attribute__ ((__noinline__)) +unsigned char +get_auto_n (__attribute__((altivec(vector__))) unsigned char a, size_t n) +{ + return (unsigned char) __builtin_vec_extract (a, n); +} + +void +do_auto (__attribute__((altivec(vector__))) unsigned char a) +{ + size_t i; + for (i = 1; i < 3 ; i++) + { + do + { + printf ("get_auto_n (a, %d) produces 0x0%x\n", + i, (int) get_auto_n (a, i)); + + if ((int) get_auto_n (a,i) > 250) abort(); + } while (0); + } +} + +int +main (void) +{ + size_t i; + __attribute__((altivec(vector__))) unsigned char x = + { 3, 2, 3, 8, 5, 6, 7, 8, 240, 241, 242, 243, 244, 245, 246, 247 }; + __attribute__((altivec(vector__))) unsigned char a; + + printf (" first elements of x are: %d %d %d %d %d\n", + x[0], x[1], x[2], x[3], x[4]); + + a = deoptimize (x); + + printf (" after deoptimization, first elements of a are: %d %d %d %d %d\n", + a[0], a[1], a[2], a[3], a[4]); + + do_auto (a); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/powerpc/vec-extract-v16qiu-v2.h b/gcc/testsuite/gcc.target/powerpc/vec-extract-v16qiu-v2.h new file mode 100644 index 00000000000..d1157599ee7 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/vec-extract-v16qiu-v2.h @@ -0,0 +1,253 @@ +#include +#include +#include + +#ifndef RTYPE +#define RTYPE TYPE +#endif + +#ifdef DO_TRACE +#include + +#define TRACE(STRING, NUM) \ +do \ + { \ + fprintf (stderr, "%s: %2d\n", STRING, (int) NUM); \ + fflush (stderr); \ + } \ +while (0) + +#ifndef FAIL_FORMAT +#define FAIL_FORMAT "%ld" +#define FAIL_CAST(X) ((long)(X)) +#endif + +#define FAIL(EXP, GOT) \ +do \ + { \ + fprintf (stderr, "Expected: " FAIL_FORMAT ", got " FAIL_FORMAT "\n", \ + FAIL_CAST (EXP), FAIL_CAST (GOT)); \ + fflush (stderr); \ + abort (); \ + } \ +while (0) + +#else +#define TRACE(STRING, NUM) +#define FAIL(EXP, GOT) abort () +#endif + +static void +check (RTYPE, RTYPE) __attribute__((__noinline__)); + +static vector TYPE +deoptimize (vector TYPE) __attribute__((__noinline__)); + +static vector TYPE +*deoptimize_ptr (vector TYPE *) __attribute__((__noinline__)); + +static void +check (RTYPE expected, RTYPE got) +{ + if (expected != got) + FAIL (expected, got); +} + +static vector TYPE +deoptimize (vector TYPE a) +{ + __asm__ (" # %x0" : "+v" (a)); + return a; +} + +static vector TYPE * +deoptimize_ptr (vector TYPE *p) +{ + __asm__ (" # %0" : "+r" (p)); + return p; +} + + +RTYPE +get_auto_0 (vector TYPE a) +{ + TRACE ("get_auto_", 0); + return (RTYPE) vec_extract (a, 0); +} + +RTYPE +get_auto_1 (vector TYPE a) +{ + TRACE ("get_auto_", 1); + return (RTYPE) vec_extract (a, 1); +} + +#if ELEMENTS >= 4 +RTYPE +get_auto_2 (vector TYPE a) +{ + return (RTYPE) vec_extract (a, 2); +} + +RTYPE +get_auto_3 (vector TYPE a) +{ + return (RTYPE) vec_extract (a, 3); +} + +#if ELEMENTS >= 8 +RTYPE +get_auto_4 (vector TYPE a) +{ + return (RTYPE) vec_extract (a, 4); +} + +RTYPE +get_auto_5 (vector TYPE a) +{ + return (RTYPE) vec_extract (a, 5); +} + +RTYPE +get_auto_6 (vector TYPE a) +{ + return (RTYPE) vec_extract (a, 6); +} + +RTYPE +get_auto_7 (vector TYPE a) +{ + return (RTYPE) vec_extract (a, 7); +} + +#if ELEMENTS >= 16 +RTYPE +get_auto_8 (vector TYPE a) +{ + return (RTYPE) vec_extract (a, 8); +} + +RTYPE +get_auto_9 (vector TYPE a) +{ + return (RTYPE) vec_extract (a, 9); +} + +RTYPE +get_auto_10 (vector TYPE a) +{ + return (RTYPE) vec_extract (a, 10); +} + +RTYPE +get_auto_11 (vector TYPE a) +{ + return (RTYPE) vec_extract (a, 11); +} + +RTYPE +get_auto_12 (vector TYPE a) +{ + return (RTYPE) vec_extract (a, 12); +} + +RTYPE +get_auto_13 (vector TYPE a) +{ + return (RTYPE) vec_extract (a, 13); +} + +RTYPE +get_auto_14 (vector TYPE a) +{ + return (RTYPE) vec_extract (a, 14); +} + +RTYPE +get_auto_15 (vector TYPE a) +{ + return (RTYPE) vec_extract (a, 15); +} + +#endif +#endif +#endif + + +/* Tests for the normal case of vec_extract where the vector is in a register + and returning the result in a register as a return value. */ +#ifdef DISABLE_INLINE_OF_GET_AUTO_N +__attribute__ ((__noinline__)) +#else +/* gcc issues warning: always_inline function might not be inlinable + + __attribute__ ((__always_inline__)) +*/ +#endif +RTYPE +get_auto_n (vector TYPE a, ssize_t n) +{ + return (RTYPE) vec_extract (a, n); +} + +typedef RTYPE (*auto_func_type) (vector TYPE); + +static auto_func_type get_auto_const[] = { + get_auto_0, + get_auto_1, +#if ELEMENTS >= 4 + get_auto_2, + get_auto_3, +#if ELEMENTS >= 8 + get_auto_4, + get_auto_5, + get_auto_6, + get_auto_7, +#if ELEMENTS >= 16 + get_auto_8, + get_auto_9, + get_auto_10, + get_auto_11, + get_auto_12, + get_auto_13, + get_auto_14, + get_auto_15, +#endif +#endif +#endif +}; + +extern void do_auto (vector TYPE a) __attribute__((__noinline__)); + +void +do_auto (vector TYPE a) +{ + size_t i; + + for (i = 1; i < 40; i += 3) + { + TRACE ("do_auto, i: ", i); + TRACE (" get_auto_const[i] returns: ", + (*get_auto_const [i % ELEMENTS]) (a)); + TRACE (" get_auto_n returns", get_auto_n (a, i)); + check (get_auto_n (a, i), (*get_auto_const [i % ELEMENTS]) (a)); + } +} + + + +/* Main program to test all of the possibilities. */ +int +main (void) +{ + size_t i; + vector TYPE x = INITIAL; + vector TYPE *p, *p2, a, y; + vector TYPE z[2]; + + a = deoptimize (x); + + do_auto (a); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/powerpc/vec-extract-v16qiu-v2a.c b/gcc/testsuite/gcc.target/powerpc/vec-extract-v16qiu-v2a.c new file mode 100644 index 00000000000..05082b71c20 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/vec-extract-v16qiu-v2a.c @@ -0,0 +1,14 @@ +/* { dg-do run } */ +/* { dg-require-effective-target vsx_hw } */ +/* { dg-options "-O2 -mvsx" } */ + +#define TYPE unsigned char +/* ELEMENTS is number of elements in a vector of TYPE. */ +#define ELEMENTS 16 +#define INITIAL \ + { 3, 2, 3, 4, 5, 6, 7, 8, 240, 241, 242, 243, 244, 245, 246, 247 } + +#define DO_TRACE +#define DISABLE_INLINE_OF_GET_AUTO_N + +#include "vec-extract-v16qiu-v2.h" diff --git a/gcc/testsuite/gcc.target/powerpc/vec-extract-v16qiu-v2b.c b/gcc/testsuite/gcc.target/powerpc/vec-extract-v16qiu-v2b.c new file mode 100644 index 00000000000..87a3aa4a8e5 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/vec-extract-v16qiu-v2b.c @@ -0,0 +1,14 @@ +/* { dg-do run } */ +/* { dg-require-effective-target vsx_hw } */ +/* { dg-options "-O2 -mvsx" } */ + +#define TYPE unsigned char +/* ELEMENTS is number of elements in a vector of TYPE. */ +#define ELEMENTS 16 +#define INITIAL \ + { 3, 2, 3, 4, 5, 6, 7, 8, 240, 241, 242, 243, 244, 245, 246, 247 } + +#define DO_TRACE +#undef DISABLE_INLINE_OF_GET_AUTO_N + +#include "vec-extract-v16qiu-v2.h" diff --git a/gcc/testsuite/gcc.target/powerpc/vsx-builtin-10a.c b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-10a.c new file mode 100644 index 00000000000..e8516de66ff --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-10a.c @@ -0,0 +1,155 @@ +/* { dg-do run } */ +/* { dg-require-effective-target vmx_hw } */ +/* { dg-options "-maltivec" } */ + +/* This test should run the same on any target that supports altivec/dfp + instructions. Intentionally not specifying cpu in order to test + all code generation paths. */ + +#include + +extern void abort (void); + +#define CONST0 (0) +#define CONST1 (1) +#define CONST2 (2) +#define CONST3 (3) +#define CONST4 (4) +#define CONST5 (5) +#define CONST6 (6) +#define CONST7 (7) + + +/* Test that indices > length of vector are applied modulo the vector + length. */ + +/* Test for vector residing in register. */ +short s3 (vector short v) +{ + return __builtin_vec_ext_v8hi (v, 3); +} + +short s7 (vector short v) +{ + return __builtin_vec_ext_v8hi (v, 7); +} + +short s21 (vector short v) +{ + return __builtin_vec_ext_v8hi (v, 21); +} + +short s30 (vector short v) +{ + return __builtin_vec_ext_v8hi (v, 30); +} + +/* Test for vector residing in memory. */ +short ms3 (vector short *vp) +{ + return __builtin_vec_ext_v8hi (*vp, 3); +} + +short ms7 (vector short *vp) +{ + return __builtin_vec_ext_v8hi (*vp, 7); +} + +short ms21 (vector short *vp) +{ + return __builtin_vec_ext_v8hi (*vp, 21); +} + +short ms30 (vector short *vp) +{ + return __builtin_vec_ext_v8hi (*vp, 30); +} + +/* Test the same with variable indices. */ + +/* Test for variable selector and vector residing in register. */ +__attribute__((noinline)) +short ci (vector short v, int i) +{ + return __builtin_vec_ext_v8hi (v, i); +} + +/* Test for variable selector and vector residing in memory. */ +__attribute__((noinline)) +short mci (vector short *vp, int i) +{ + return __builtin_vec_ext_v8hi (*vp, i); +} + + +int main (int argc, short *argv[]) { + vector short sv = { + CONST0, CONST1, CONST2, CONST3, CONST4, CONST5, CONST6, CONST7 }; + short s; + + s = s3 (sv); + if (s != CONST3) + abort (); + + s = s7 (sv); + if (s != CONST7) + abort (); + + s = s21 (sv); + if (s != CONST5) + abort (); + + s = s30 (sv); + if (s != CONST6) + abort (); + + s = ms3 (&sv); + if (s != CONST3) + abort (); + + s = ms7 (&sv); + if (s != CONST7) + abort (); + + s = ms21 (&sv); + if (s != CONST5) + abort (); + + s = ms30 (&sv); + if (s != CONST6) + abort (); + + s = ci (sv, 5); + if (s != CONST5) + abort (); + + s = ci (sv, 2); + if (s != CONST2) + abort (); + + s = ci (sv, 15); + if (s != CONST7) + abort (); + + s = ci (sv, 28); + if (s != CONST4) + abort (); + + s = mci (&sv, 5); + if (s != CONST5) + abort (); + + s = mci (&sv, 12); + if (s != CONST4) + abort (); + + s = mci (&sv, 25); + if (s != CONST1) + abort (); + + s = mci (&sv, 16); + if (s != CONST0) + abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/powerpc/vsx-builtin-10b.c b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-10b.c new file mode 100644 index 00000000000..6300b0e2230 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-10b.c @@ -0,0 +1,155 @@ +/* { dg-do run } */ +/* { dg-require-effective-target vmx_hw } */ +/* { dg-options "-maltivec -O3" } */ + +/* This test should run the same on any target that supports altivec/dfp + instructions. Intentionally not specifying cpu in order to test + all code generation paths. */ + +#include + +extern void abort (void); + +#define CONST0 (0) +#define CONST1 (1) +#define CONST2 (2) +#define CONST3 (3) +#define CONST4 (4) +#define CONST5 (5) +#define CONST6 (6) +#define CONST7 (7) + + +/* Test that indices > length of vector are applied modulo the vector + length. */ + +/* Test for vector residing in register. */ +short s3 (vector short v) +{ + return __builtin_vec_ext_v8hi (v, 3); +} + +short s7 (vector short v) +{ + return __builtin_vec_ext_v8hi (v, 7); +} + +short s21 (vector short v) +{ + return __builtin_vec_ext_v8hi (v, 21); +} + +short s30 (vector short v) +{ + return __builtin_vec_ext_v8hi (v, 30); +} + +/* Test for vector residing in memory. */ +short ms3 (vector short *vp) +{ + return __builtin_vec_ext_v8hi (*vp, 3); +} + +short ms7 (vector short *vp) +{ + return __builtin_vec_ext_v8hi (*vp, 7); +} + +short ms21 (vector short *vp) +{ + return __builtin_vec_ext_v8hi (*vp, 21); +} + +short ms30 (vector short *vp) +{ + return __builtin_vec_ext_v8hi (*vp, 30); +} + +/* Test the same with variable indices. */ + +/* Test for variable selector and vector residing in register. */ +__attribute__((noinline)) +short ci (vector short v, int i) +{ + return __builtin_vec_ext_v8hi (v, i); +} + +/* Test for variable selector and vector residing in memory. */ +__attribute__((noinline)) +short mci (vector short *vp, int i) +{ + return __builtin_vec_ext_v8hi (*vp, i); +} + + +int main (int argc, short *argv[]) { + vector short sv = { + CONST0, CONST1, CONST2, CONST3, CONST4, CONST5, CONST6, CONST7 }; + short s; + + s = s3 (sv); + if (s != CONST3) + abort (); + + s = s7 (sv); + if (s != CONST7) + abort (); + + s = s21 (sv); + if (s != CONST5) + abort (); + + s = s30 (sv); + if (s != CONST6) + abort (); + + s = ms3 (&sv); + if (s != CONST3) + abort (); + + s = ms7 (&sv); + if (s != CONST7) + abort (); + + s = ms21 (&sv); + if (s != CONST5) + abort (); + + s = ms30 (&sv); + if (s != CONST6) + abort (); + + s = ci (sv, 5); + if (s != CONST5) + abort (); + + s = ci (sv, 2); + if (s != CONST2) + abort (); + + s = ci (sv, 15); + if (s != CONST7) + abort (); + + s = ci (sv, 28); + if (s != CONST4) + abort (); + + s = mci (&sv, 5); + if (s != CONST5) + abort (); + + s = mci (&sv, 12); + if (s != CONST4) + abort (); + + s = mci (&sv, 25); + if (s != CONST1) + abort (); + + s = mci (&sv, 16); + if (s != CONST0) + abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/powerpc/vsx-builtin-11a.c b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-11a.c new file mode 100644 index 00000000000..e962e121bd0 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-11a.c @@ -0,0 +1,149 @@ +/* { dg-do run } */ +/* { dg-require-effective-target vmx_hw } */ +/* { dg-options "-maltivec" } */ + +/* This test should run the same on any target that supports altivec/dfp + instructions. Intentionally not specifying cpu in order to test + all code generation paths. */ + +#include + +extern void abort (void); + +#define CONST0 (0) +#define CONST1 (1) +#define CONST2 (2) +#define CONST3 (3) + +/* Test that indices > length of vector are applied modulo the vector + length. */ + +/* Test for vector residing in register. */ +int s3 (vector int v) +{ + return __builtin_vec_ext_v4si (v, 3); +} + +int s1 (vector int v) +{ + return __builtin_vec_ext_v4si (v, 1); +} + +int s21 (vector int v) +{ + return __builtin_vec_ext_v4si (v, 21); +} + +int s30 (vector int v) +{ + return __builtin_vec_ext_v4si (v, 30); +} + +/* Test for vector residing in memory. */ +int ms3 (vector int *vp) +{ + return __builtin_vec_ext_v4si (*vp, 3); +} + +int ms1(vector int *vp) +{ + return __builtin_vec_ext_v4si (*vp, 1); +} + +int ms21(vector int *vp) +{ + return __builtin_vec_ext_v4si (*vp, 21); +} + +int ms30(vector int *vp) +{ + return __builtin_vec_ext_v4si (*vp, 30); +} + +/* Test the same with variable indices. */ + +/* Test for variable selector and vector residing in register. */ +__attribute__((noinline)) +int ci (vector int v, int i) +{ + return __builtin_vec_ext_v4si (v, i); +} + +/* Test for variable selector and vector residing in memory. */ +__attribute__((noinline)) +int mci(vector int *vp, int i) +{ + return __builtin_vec_ext_v4si (*vp, i); +} + + +int main (int argc, int *argv[]) { + vector int sv = { CONST0, CONST1, CONST2, CONST3 }; + int s; + + s = s3 (sv); + if (s != CONST3) + abort (); + + s = s1 (sv); + if (s != CONST1) + abort (); + + s = s21 (sv); + if (s != CONST1) + abort (); + + s = s30 (sv); + if (s != CONST2) + abort (); + + s = ms3 (&sv); + if (s != CONST3) + abort (); + + s = ms1 (&sv); + if (s != CONST1) + abort (); + + s = ms21 (&sv); + if (s != CONST1) + abort (); + + s = ms30 (&sv); + if (s != CONST2) + abort (); + + s = ci (sv, 5); + if (s != CONST1) + abort (); + + s = ci (sv, 2); + if (s != CONST2) + abort (); + + s = ci (sv, 15); + if (s != CONST3) + abort (); + + s = ci (sv, 28); + if (s != CONST0) + abort (); + + s = mci (&sv, 5); + if (s != CONST1) + abort (); + + s = mci (&sv, 12); + if (s != CONST0) + abort (); + + s = mci (&sv, 25); + if (s != CONST1) + abort (); + + s = mci (&sv, 16); + if (s != CONST0) + abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/powerpc/vsx-builtin-11b.c b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-11b.c new file mode 100644 index 00000000000..fafdd10f842 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-11b.c @@ -0,0 +1,149 @@ +/* { dg-do run } */ +/* { dg-require-effective-target vmx_hw } */ +/* { dg-options "-maltivec -O3" } */ + +/* This test should run the same on any target that supports altivec/dfp + instructions. Intentionally not specifying cpu in order to test + all code generation paths. */ + +#include + +extern void abort (void); + +#define CONST0 (0) +#define CONST1 (1) +#define CONST2 (2) +#define CONST3 (3) + +/* Test that indices > length of vector are applied modulo the vector + length. */ + +/* Test for vector residing in register. */ +int s3 (vector int v) +{ + return __builtin_vec_ext_v4si (v, 3); +} + +int s1 (vector int v) +{ + return __builtin_vec_ext_v4si (v, 1); +} + +int s21 (vector int v) +{ + return __builtin_vec_ext_v4si (v, 21); +} + +int s30 (vector int v) +{ + return __builtin_vec_ext_v4si (v, 30); +} + +/* Test for vector residing in memory. */ +int ms3 (vector int *vp) +{ + return __builtin_vec_ext_v4si (*vp, 3); +} + +int ms1(vector int *vp) +{ + return __builtin_vec_ext_v4si (*vp, 1); +} + +int ms21(vector int *vp) +{ + return __builtin_vec_ext_v4si (*vp, 21); +} + +int ms30(vector int *vp) +{ + return __builtin_vec_ext_v4si (*vp, 30); +} + +/* Test the same with variable indices. */ + +/* Test for variable selector and vector residing in register. */ +__attribute__((noinline)) +int ci (vector int v, int i) +{ + return __builtin_vec_ext_v4si (v, i); +} + +/* Test for variable selector and vector residing in memory. */ +__attribute__((noinline)) +int mci(vector int *vp, int i) +{ + return __builtin_vec_ext_v4si (*vp, i); +} + + +int main (int argc, int *argv[]) { + vector int sv = { CONST0, CONST1, CONST2, CONST3 }; + int s; + + s = s3 (sv); + if (s != CONST3) + abort (); + + s = s1 (sv); + if (s != CONST1) + abort (); + + s = s21 (sv); + if (s != CONST1) + abort (); + + s = s30 (sv); + if (s != CONST2) + abort (); + + s = ms3 (&sv); + if (s != CONST3) + abort (); + + s = ms1 (&sv); + if (s != CONST1) + abort (); + + s = ms21 (&sv); + if (s != CONST1) + abort (); + + s = ms30 (&sv); + if (s != CONST2) + abort (); + + s = ci (sv, 5); + if (s != CONST1) + abort (); + + s = ci (sv, 2); + if (s != CONST2) + abort (); + + s = ci (sv, 15); + if (s != CONST3) + abort (); + + s = ci (sv, 28); + if (s != CONST0) + abort (); + + s = mci (&sv, 5); + if (s != CONST1) + abort (); + + s = mci (&sv, 12); + if (s != CONST0) + abort (); + + s = mci (&sv, 25); + if (s != CONST1) + abort (); + + s = mci (&sv, 16); + if (s != CONST0) + abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/powerpc/vsx-builtin-12a.c b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-12a.c new file mode 100644 index 00000000000..a79bc7f5384 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-12a.c @@ -0,0 +1,109 @@ +/* { dg-do run { target int128 } } */ +/* { dg-require-effective-target vsx_hw } */ +/* { dg-options "-mvsx" } */ + +/* This test should run the same on any target that supports vsx + instructions. Intentionally not specifying cpu in order to test + all code generation paths. */ + +#include + +extern void abort (void); + +#define CONST0 (31415926539LL) +#define CONST1 (2 * 31415926539LL) + +/* Test that indices > length of vector are applied modulo the vector + length. */ + +/* Test for vector residing in register. */ +long long int e0 (vector long long int v) +{ + return __builtin_vec_ext_v2di (v, 0); +} + +long long int e3 (vector long long int v) +{ + return __builtin_vec_ext_v2di (v, 3); +} + +/* Test for vector residing in memory. */ +long long int me0 (vector long long int *vp) +{ + return __builtin_vec_ext_v2di (*vp, 0); +} + +long long int me3 (vector long long int *vp) +{ + return __builtin_vec_ext_v2di (*vp, 3); +} + +/* Test the same with variable indices. */ + +/* Test for variable selector and vector residing in register. */ +__attribute__((noinline)) +long long int ei (vector long long int v, int i) +{ + return __builtin_vec_ext_v2di (v, i); +} + +/* Test for variable selector and vector residing in memory. */ +long long int mei (vector long long int *vp, int i) +{ + return __builtin_vec_ext_v2di (*vp, i); +} + +int main (int argc, char *argv[]) { + vector long long int dv = { CONST0, CONST1 }; + long long int d; + + d = e0 (dv); + if (d != CONST0) + abort (); + + d = e3 (dv); + if (d != CONST1) + abort (); + + d = me0 (&dv); + if (d != CONST0) + abort (); + + d = me3 (&dv); + if (d != CONST1) + abort (); + + d = ei (dv, 0); + if (d != CONST0) + abort (); + + d = ei (dv, 1); + if (d != CONST1) + abort (); + + d = ei (dv, 2); + if (d != CONST0) + abort (); + + d = ei (dv, 3); + if (d != CONST1) + abort (); + + d = mei (&dv, 0); + if (d != CONST0) + abort (); + + d = mei (&dv, 1); + if (d != CONST1) + abort (); + + d = mei (&dv, 2); + if (d != CONST0) + abort (); + + d = mei (&dv, 3); + if (d != CONST1) + abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/powerpc/vsx-builtin-12b.c b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-12b.c new file mode 100644 index 00000000000..2b63624f8b1 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-12b.c @@ -0,0 +1,109 @@ +/* { dg-do run { target int128 } } */ +/* { dg-require-effective-target vsx_hw } */ +/* { dg-options "-mvsx -O3" } */ + +/* This test should run the same on any target that supports vsx + instructions. Intentionally not specifying cpu in order to test + all code generation paths. */ + +#include + +extern void abort (void); + +#define CONST0 (31415926539LL) +#define CONST1 (2 * 31415926539LL) + +/* Test that indices > length of vector are applied modulo the vector + length. */ + +/* Test for vector residing in register. */ +long long int e0 (vector long long int v) +{ + return __builtin_vec_ext_v2di (v, 0); +} + +long long int e3 (vector long long int v) +{ + return __builtin_vec_ext_v2di (v, 3); +} + +/* Test for vector residing in memory. */ +long long int me0 (vector long long int *vp) +{ + return __builtin_vec_ext_v2di (*vp, 0); +} + +long long int me3 (vector long long int *vp) +{ + return __builtin_vec_ext_v2di (*vp, 3); +} + +/* Test the same with variable indices. */ + +/* Test for variable selector and vector residing in register. */ +__attribute__((noinline)) +long long int ei (vector long long int v, int i) +{ + return __builtin_vec_ext_v2di (v, i); +} + +/* Test for variable selector and vector residing in memory. */ +long long int mei (vector long long int *vp, int i) +{ + return __builtin_vec_ext_v2di (*vp, i); +} + +int main (int argc, char *argv[]) { + vector long long int dv = { CONST0, CONST1 }; + long long int d; + + d = e0 (dv); + if (d != CONST0) + abort (); + + d = e3 (dv); + if (d != CONST1) + abort (); + + d = me0 (&dv); + if (d != CONST0) + abort (); + + d = me3 (&dv); + if (d != CONST1) + abort (); + + d = ei (dv, 0); + if (d != CONST0) + abort (); + + d = ei (dv, 1); + if (d != CONST1) + abort (); + + d = ei (dv, 2); + if (d != CONST0) + abort (); + + d = ei (dv, 3); + if (d != CONST1) + abort (); + + d = mei (&dv, 0); + if (d != CONST0) + abort (); + + d = mei (&dv, 1); + if (d != CONST1) + abort (); + + d = mei (&dv, 2); + if (d != CONST0) + abort (); + + d = mei (&dv, 3); + if (d != CONST1) + abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/powerpc/vsx-builtin-13a.c b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-13a.c new file mode 100644 index 00000000000..907bcce9236 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-13a.c @@ -0,0 +1,124 @@ +/* { dg-do run { target int128 } } */ +/* { dg-require-effective-target vsx_hw } */ +/* { dg-options "-mvsx" } */ + +/* This test should run the same on any target that supports vsx + instructions. Intentionally not specifying cpu in order to test + all code generation paths. */ + +#include + +/* Define this after PR89424 is addressed. */ +#undef PR89424 + +/* Define this after PR89626 is addressed. */ +#undef PR89626 + +#ifdef PR89626 +#define SIGNED +#else +#define SIGNED signed +#endif + +extern void abort (void); + +#define CONST0 (((SIGNED __int128) 31415926539) << 60) + +/* Test that indices > length of vector are applied modulo the vector + length. */ + +/* Test for vector residing in register. */ +SIGNED __int128 e0 (vector SIGNED __int128 v) +{ + return __builtin_vec_ext_v1ti (v, 0); +} + +SIGNED __int128 e3 (vector SIGNED __int128 v) +{ + return __builtin_vec_ext_v1ti (v, 3); +} + +/* Test for vector residing in memory. */ +SIGNED __int128 me0 (vector SIGNED __int128 *vp) +{ + return __builtin_vec_ext_v1ti (*vp, 0); +} + +SIGNED __int128 me3 (vector SIGNED __int128 *vp) +{ + return __builtin_vec_ext_v1ti (*vp, 3); +} + +/* Test the same with variable indices. */ + +#ifdef PR89424 +/* Test for variable selector and vector residing in register. */ +__attribute__((noinline)) +SIGNED __int128 ei (vector SIGNED __int128 v, int i) +{ + return __builtin_vec_ext_v1ti (v, i); +} + +/* Test for variable selector and vector residing in memory. */ +SIGNED __int128 mei (vector SIGNED __int128 *vp, int i) +{ + return __builtin_vec_ext_v1ti (*vp, i); +} +#endif + +int main (int argc, char *argv[]) { + vector SIGNED __int128 dv = { CONST0 }; + SIGNED __int128 d; + + d = e0 (dv); + if (d != CONST0) + abort (); + + d = e3 (dv); + if (d != CONST0) + abort (); + + d = me0 (&dv); + if (d != CONST0) + abort (); + + d = me3 (&dv); + if (d != CONST0) + abort (); + +#ifdef PR89424 + d = ei (dv, 0); + if (d != CONST0) + abort (); + + d = ei (dv, 1); + if (d != CONST0) + abort (); + + d = ei (dv, 2); + if (d != CONST0) + abort (); + + d = ei (dv, 3); + if (d != CONST0) + abort (); + + d = mei (&dv, 0); + if (d != CONST0) + abort (); + + d = mei (&dv, 1); + if (d != CONST0) + abort (); + + d = mei (&dv, 2); + if (d != CONST0) + abort (); + + d = mei (&dv, 3); + if (d != CONST0) + abort (); +#endif + + return 0; +} diff --git a/gcc/testsuite/gcc.target/powerpc/vsx-builtin-13b.c b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-13b.c new file mode 100644 index 00000000000..e1d791ded4f --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-13b.c @@ -0,0 +1,124 @@ +/* { dg-do run { target int128 } } */ +/* { dg-require-effective-target vsx_hw } */ +/* { dg-options "-mvsx -O3" } */ + +/* This test should run the same on any target that supports vsx + instructions. Intentionally not specifying cpu in order to test + all code generation paths. */ + +#include + +/* Define this after PR89424 is addressed. */ +#undef PR89424 + +/* Define this after PR89626 is addressed. */ +#undef PR89626 + +#ifdef PR89626 +#define SIGNED +#else +#define SIGNED signed +#endif + +extern void abort (void); + +#define CONST0 (((SIGNED __int128) 31415926539) << 60) + +/* Test that indices > length of vector are applied modulo the vector + length. */ + +/* Test for vector residing in register. */ +SIGNED __int128 e0 (vector SIGNED __int128 v) +{ + return __builtin_vec_ext_v1ti (v, 0); +} + +SIGNED __int128 e3 (vector SIGNED __int128 v) +{ + return __builtin_vec_ext_v1ti (v, 3); +} + +/* Test for vector residing in memory. */ +SIGNED __int128 me0 (vector SIGNED __int128 *vp) +{ + return __builtin_vec_ext_v1ti (*vp, 0); +} + +SIGNED __int128 me3 (vector SIGNED __int128 *vp) +{ + return __builtin_vec_ext_v1ti (*vp, 3); +} + +/* Test the same with variable indices. */ + +#ifdef PR89424 +/* Test for variable selector and vector residing in register. */ +__attribute__((noinline)) +SIGNED __int128 ei (vector SIGNED __int128 v, int i) +{ + return __builtin_vec_ext_v1ti (v, i); +} + +/* Test for variable selector and vector residing in memory. */ +SIGNED __int128 mei (vector SIGNED __int128 *vp, int i) +{ + return __builtin_vec_ext_v1ti (*vp, i); +} +#endif + +int main (int argc, char *argv[]) { + vector SIGNED __int128 dv = { CONST0 }; + SIGNED __int128 d; + + d = e0 (dv); + if (d != CONST0) + abort (); + + d = e3 (dv); + if (d != CONST0) + abort (); + + d = me0 (&dv); + if (d != CONST0) + abort (); + + d = me3 (&dv); + if (d != CONST0) + abort (); + +#ifdef PR89424 + d = ei (dv, 0); + if (d != CONST0) + abort (); + + d = ei (dv, 1); + if (d != CONST0) + abort (); + + d = ei (dv, 2); + if (d != CONST0) + abort (); + + d = ei (dv, 3); + if (d != CONST0) + abort (); + + d = mei (&dv, 0); + if (d != CONST0) + abort (); + + d = mei (&dv, 1); + if (d != CONST0) + abort (); + + d = mei (&dv, 2); + if (d != CONST0) + abort (); + + d = mei (&dv, 3); + if (d != CONST0) + abort (); +#endif + + return 0; +} diff --git a/gcc/testsuite/gcc.target/powerpc/vsx-builtin-14a.c b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-14a.c new file mode 100644 index 00000000000..8eb8eb63fbe --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-14a.c @@ -0,0 +1,126 @@ +/* { dg-do run } */ +/* { dg-require-effective-target vmx_hw } */ +/* { dg-options "-maltivec" } */ + +/* This test should run the same on any target that supports altivec/dfp + instructions. Intentionally not specifying cpu in order to test + all code generation paths. */ + +#include + +extern void abort (void); + +#define CONST0 ((float) (3.1415926539)) +#define CONST1 ((float) (3.1415926539 * 2)) +#define CONST2 ((float) (3.1415926539 * 3)) +#define CONST3 ((float) (3.1415926539 * 4)) + +/* Test that indices > length of vector are applied modulo the vector + length. */ + +/* Test for vector residing in register. */ +float e0(vector float v){ return __builtin_vec_ext_v4sf (v, 0); } +float e1(vector float v){ return __builtin_vec_ext_v4sf (v, 1); } +float e7(vector float v){ return __builtin_vec_ext_v4sf (v, 7); } +float e8(vector float v){ return __builtin_vec_ext_v4sf (v, 8); } + +/* Test for vector residing in memory. */ +float me0(vector float *vp){ return __builtin_vec_ext_v4sf (*vp, 0); } +float me1(vector float *vp){ return __builtin_vec_ext_v4sf (*vp, 1); } + +float me13(vector float *vp) +{ + return __builtin_vec_ext_v4sf (*vp, 13); +} + +float me15(vector float *vp) +{ + return __builtin_vec_ext_v4sf (*vp, 15); +} + +/* Test the same with variable indices. */ + +/* Test for variable selector and vector residing in register. */ +__attribute__((noinline)) +float ei(vector float v, int i) +{ + return __builtin_vec_ext_v4sf (v, i); +} + +/* Test for variable selector and vector residing in memory. */ +float mei(vector float *vp, int i) +{ + return __builtin_vec_ext_v4sf (*vp, i); +} + + +int main (int argc, char *argv[]) { + vector float dv = { CONST0, CONST1, CONST2, CONST3 }; + float d; + + d = e0 (dv); + if (d != CONST0) + abort (); + + d = e1 (dv); + if (d != CONST1) + abort (); + + d = e7 (dv); + if (d != CONST3) + abort (); + + d = e8 (dv); + if (d != CONST0) + abort (); + + d = me0 (&dv); + if (d != CONST0) + abort (); + + d = me1 (&dv); + if (d != CONST1) + abort (); + + d = me13 (&dv); + if (d != CONST1) + abort (); + + d = me15 (&dv); + if (d != CONST3) + abort (); + + d = ei (dv, 0); + if (d != CONST0) + abort (); + + d = ei (dv, 2); + if (d != CONST2) + abort (); + + d = ei (dv, 11); + if (d != CONST3) + abort (); + + d = ei (dv, 17); + if (d != CONST1) + abort (); + + d = mei (&dv, 0); + if (d != CONST0) + abort (); + + d = mei (&dv, 1); + if (d != CONST1) + abort (); + + d = mei (&dv, 15); + if (d != CONST3) + abort (); + + d = mei (&dv, 6); + if (d != CONST2) + abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/powerpc/vsx-builtin-14b.c b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-14b.c new file mode 100644 index 00000000000..84bc8a2ae71 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-14b.c @@ -0,0 +1,126 @@ +/* { dg-do run } */ +/* { dg-require-effective-target vmx_hw } */ +/* { dg-options "-maltivec -O3" } */ + +/* This test should run the same on any target that supports altivec/dfp + instructions. Intentionally not specifying cpu in order to test + all code generation paths. */ + +#include + +extern void abort (void); + +#define CONST0 ((float) (3.1415926539)) +#define CONST1 ((float) (3.1415926539 * 2)) +#define CONST2 ((float) (3.1415926539 * 3)) +#define CONST3 ((float) (3.1415926539 * 4)) + +/* Test that indices > length of vector are applied modulo the vector + length. */ + +/* Test for vector residing in register. */ +float e0(vector float v){ return __builtin_vec_ext_v4sf (v, 0); } +float e1(vector float v){ return __builtin_vec_ext_v4sf (v, 1); } +float e7(vector float v){ return __builtin_vec_ext_v4sf (v, 7); } +float e8(vector float v){ return __builtin_vec_ext_v4sf (v, 8); } + +/* Test for vector residing in memory. */ +float me0(vector float *vp){ return __builtin_vec_ext_v4sf (*vp, 0); } +float me1(vector float *vp){ return __builtin_vec_ext_v4sf (*vp, 1); } + +float me13(vector float *vp) +{ + return __builtin_vec_ext_v4sf (*vp, 13); +} + +float me15(vector float *vp) +{ + return __builtin_vec_ext_v4sf (*vp, 15); +} + +/* Test the same with variable indices. */ + +/* Test for variable selector and vector residing in register. */ +__attribute__((noinline)) +float ei(vector float v, int i) +{ + return __builtin_vec_ext_v4sf (v, i); +} + +/* Test for variable selector and vector residing in memory. */ +float mei(vector float *vp, int i) +{ + return __builtin_vec_ext_v4sf (*vp, i); +} + + +int main (int argc, char *argv[]) { + vector float dv = { CONST0, CONST1, CONST2, CONST3 }; + float d; + + d = e0 (dv); + if (d != CONST0) + abort (); + + d = e1 (dv); + if (d != CONST1) + abort (); + + d = e7 (dv); + if (d != CONST3) + abort (); + + d = e8 (dv); + if (d != CONST0) + abort (); + + d = me0 (&dv); + if (d != CONST0) + abort (); + + d = me1 (&dv); + if (d != CONST1) + abort (); + + d = me13 (&dv); + if (d != CONST1) + abort (); + + d = me15 (&dv); + if (d != CONST3) + abort (); + + d = ei (dv, 0); + if (d != CONST0) + abort (); + + d = ei (dv, 2); + if (d != CONST2) + abort (); + + d = ei (dv, 11); + if (d != CONST3) + abort (); + + d = ei (dv, 17); + if (d != CONST1) + abort (); + + d = mei (&dv, 0); + if (d != CONST0) + abort (); + + d = mei (&dv, 1); + if (d != CONST1) + abort (); + + d = mei (&dv, 15); + if (d != CONST3) + abort (); + + d = mei (&dv, 6); + if (d != CONST2) + abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/powerpc/vsx-builtin-15a.c b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-15a.c new file mode 100644 index 00000000000..b8bff5c3f56 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-15a.c @@ -0,0 +1,113 @@ +/* { dg-do run { target int128 } } */ +/* { dg-require-effective-target vsx_hw } */ +/* { dg-options "-mvsx" } */ + +/* This test should run the same on any target that supports vsx + instructions. Intentionally not specifying cpu in order to test + all code generation paths. */ + +#include + +extern void abort (void); + +#define CONST0 (3.1415926539) +#define CONST1 (3.1415926539 * 2) + + +/* Test that indices > length of vector are applied modulo the vector + length. */ + +/* Test for vector residing in register. */ +double e0(vector double v){ return __builtin_vec_ext_v2df (v, 0); } +double e1(vector double v){ return __builtin_vec_ext_v2df (v, 1); } +double e2(vector double v){ return __builtin_vec_ext_v2df (v, 2); } +double e3(vector double v){ return __builtin_vec_ext_v2df (v, 3); } + +/* Test for vector residing in memory. */ +double me0(vector double *vp){ return __builtin_vec_ext_v2df (*vp, 0); } +double me1(vector double *vp){ return __builtin_vec_ext_v2df (*vp, 1); } +double me2(vector double *vp){ return __builtin_vec_ext_v2df (*vp, 2); } +double me3(vector double *vp){ return __builtin_vec_ext_v2df (*vp, 3); } + +/* Test the same with variable indices. */ + +/* Test for variable selector and vector residing in register. */ +__attribute__((noinline)) +double ei(vector double v, int i){ return __builtin_vec_ext_v2df (v, i); } + +/* Test for variable selector and vector residing in memory. */ +double mei(vector double *vp, int i){ return __builtin_vec_ext_v2df (*vp, i); } + + +int main (int argc, char *argv[]) { + vector double dv; + double d; + dv[0] = CONST0; + dv[1] = CONST1; + + d = e0 (dv); + if (d != CONST0) + abort (); + + d = e1 (dv); + if (d != CONST1) + abort (); + + d = e2 (dv); + if (d != CONST0) + abort (); + + d = e3 (dv); + if (d != CONST1) + abort (); + + d = me0 (&dv); + if (d != CONST0) + abort (); + + d = me1 (&dv); + if (d != CONST1) + abort (); + + d = me2 (&dv); + if (d != CONST0) + abort (); + + d = me3 (&dv); + if (d != CONST1) + abort (); + + d = ei (dv, 0); + if (d != CONST0) + abort (); + + d = ei (dv, 1); + if (d != CONST1) + abort (); + + d = ei (dv, 2); + if (d != CONST0) + abort (); + + d = ei (dv, 3); + if (d != CONST1) + abort (); + + d = mei (&dv, 0); + if (d != CONST0) + abort (); + + d = mei (&dv, 1); + if (d != CONST1) + abort (); + + d = mei (&dv, 2); + if (d != CONST0) + abort (); + + d = mei (&dv, 3); + if (d != CONST1) + abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/powerpc/vsx-builtin-15b.c b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-15b.c new file mode 100644 index 00000000000..402cde7b1c3 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-15b.c @@ -0,0 +1,113 @@ +/* { dg-do run { target int128 } } */ +/* { dg-require-effective-target vsx_hw } */ +/* { dg-options "-mvsx -O3" } */ + +/* This test should run the same on any target that supports vsx + instructions. Intentionally not specifying cpu in order to test + all code generation paths. */ + +#include + +extern void abort (void); + +#define CONST0 (3.1415926539) +#define CONST1 (3.1415926539 * 2) + + +/* Test that indices > length of vector are applied modulo the vector + length. */ + +/* Test for vector residing in register. */ +double e0(vector double v){ return __builtin_vec_ext_v2df (v, 0); } +double e1(vector double v){ return __builtin_vec_ext_v2df (v, 1); } +double e2(vector double v){ return __builtin_vec_ext_v2df (v, 2); } +double e3(vector double v){ return __builtin_vec_ext_v2df (v, 3); } + +/* Test for vector residing in memory. */ +double me0(vector double *vp){ return __builtin_vec_ext_v2df (*vp, 0); } +double me1(vector double *vp){ return __builtin_vec_ext_v2df (*vp, 1); } +double me2(vector double *vp){ return __builtin_vec_ext_v2df (*vp, 2); } +double me3(vector double *vp){ return __builtin_vec_ext_v2df (*vp, 3); } + +/* Test the same with variable indices. */ + +/* Test for variable selector and vector residing in register. */ +__attribute__((noinline)) +double ei(vector double v, int i){ return __builtin_vec_ext_v2df (v, i); } + +/* Test for variable selector and vector residing in memory. */ +double mei(vector double *vp, int i){ return __builtin_vec_ext_v2df (*vp, i); } + + +int main (int argc, char *argv[]) { + vector double dv; + double d; + dv[0] = CONST0; + dv[1] = CONST1; + + d = e0 (dv); + if (d != CONST0) + abort (); + + d = e1 (dv); + if (d != CONST1) + abort (); + + d = e2 (dv); + if (d != CONST0) + abort (); + + d = e3 (dv); + if (d != CONST1) + abort (); + + d = me0 (&dv); + if (d != CONST0) + abort (); + + d = me1 (&dv); + if (d != CONST1) + abort (); + + d = me2 (&dv); + if (d != CONST0) + abort (); + + d = me3 (&dv); + if (d != CONST1) + abort (); + + d = ei (dv, 0); + if (d != CONST0) + abort (); + + d = ei (dv, 1); + if (d != CONST1) + abort (); + + d = ei (dv, 2); + if (d != CONST0) + abort (); + + d = ei (dv, 3); + if (d != CONST1) + abort (); + + d = mei (&dv, 0); + if (d != CONST0) + abort (); + + d = mei (&dv, 1); + if (d != CONST1) + abort (); + + d = mei (&dv, 2); + if (d != CONST0) + abort (); + + d = mei (&dv, 3); + if (d != CONST1) + abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/powerpc/vsx-builtin-16a.c b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-16a.c new file mode 100644 index 00000000000..465296a820a --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-16a.c @@ -0,0 +1,165 @@ +/* { dg-do run } */ +/* { dg-require-effective-target vmx_hw } */ +/* { dg-options "-maltivec" } */ + +/* This test should run the same on any target that supports altivec/dfp + instructions. Intentionally not specifying cpu in order to test + all code generation paths. */ + +#include + +extern void abort (void); + +#define CONST0 (0) +#define CONST1 (1) +#define CONST2 (2) +#define CONST3 (3) +#define CONST4 (4) +#define CONST5 (5) +#define CONST6 (6) +#define CONST7 (7) +#define CONST8 (8) +#define CONST9 (9) +#define CONSTA (10) +#define CONSTB (11) +#define CONSTC (12) +#define CONSTD (13) +#define CONSTE (14) +#define CONSTF (15) + + +/* Test that indices > length of vector are applied modulo the vector + length. */ + +/* Test for vector residing in register. */ +unsigned char c0 (vector unsigned char v) +{ + return __builtin_vec_extract (v, 0); +} + +unsigned char c9 (vector unsigned char v) +{ + return __builtin_vec_extract (v, 9); +} + +unsigned char c21 (vector unsigned char v) +{ + return __builtin_vec_extract (v, 21); +} + +unsigned char c30 (vector unsigned char v) +{ + return __builtin_vec_extract (v, 30); +} + +/* Test for vector residing in memory. */ +unsigned char mc0 (vector unsigned char *vp) +{ + return __builtin_vec_extract (*vp, 0); +} + +unsigned char mc9 (vector unsigned char *vp) +{ + return __builtin_vec_extract (*vp, 9); +} + +unsigned char mc21 (vector unsigned char *vp) +{ + return __builtin_vec_extract (*vp, 21); +} + +unsigned char mc30 (vector unsigned char *vp) +{ + return __builtin_vec_extract (*vp, 30); +} + +/* Test the same with variable indices. */ + +/* Test for variable selector and vector residing in register. */ +__attribute__((noinline)) +unsigned char ci (vector unsigned char v, int i) +{ + return __builtin_vec_extract (v, i); +} + +/* Test for variable selector and vector residing in memory. */ +__attribute__((noinline)) +unsigned char mci (vector unsigned char *vp, int i) +{ + return __builtin_vec_extract (*vp, i); +} + + +int main (int argc, char *argv[]) { + vector unsigned char cv = { CONST0, CONST1, CONST2, CONST3, + CONST4, CONST5, CONST6, CONST7, + CONST8, CONST9, CONSTA, CONSTB, + CONSTC, CONSTD, CONSTE, CONSTF }; + unsigned char c; + + c = c0 (cv); + if (c != CONST0) + abort (); + + c = c9 (cv); + if (c != CONST9) + abort (); + + c = c21 (cv); + if (c != CONST5) + abort (); + + c = c30 (cv); + if (c != CONSTE) + abort (); + + c = mc0 (&cv); + if (c != CONST0) + abort (); + + c = mc9 (&cv); + if (c != CONST9) + abort (); + + c = mc21 (&cv); + if (c != CONST5) + abort (); + + c = mc30 (&cv); + if (c != CONSTE) + abort (); + + c = ci (cv, 8); + if (c != CONST8) + abort (); + + c = ci (cv, 13); + if (c != CONSTD) + abort (); + + c = ci (cv, 23); + if (c != CONST7) + abort (); + + c = ci (cv, 31); + if (c != CONSTF) + abort (); + + c = mci (&cv, 5); + if (c != CONST5) + abort (); + + c = mci (&cv, 12); + if (c != CONSTC) + abort (); + + c = mci (&cv, 25); + if (c != CONST9) + abort (); + + c = mci (&cv, 16); + if (c != CONST0) + abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/powerpc/vsx-builtin-16b.c b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-16b.c new file mode 100644 index 00000000000..b646fb12dab --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-16b.c @@ -0,0 +1,165 @@ +/* { dg-do run } */ +/* { dg-require-effective-target vmx_hw } */ +/* { dg-options "-maltivec -O3" } */ + +/* This test should run the same on any target that supports altivec/dfp + instructions. Intentionally not specifying cpu in order to test + all code generation paths. */ + +#include + +extern void abort (void); + +#define CONST0 (0) +#define CONST1 (1) +#define CONST2 (2) +#define CONST3 (3) +#define CONST4 (4) +#define CONST5 (5) +#define CONST6 (6) +#define CONST7 (7) +#define CONST8 (8) +#define CONST9 (9) +#define CONSTA (10) +#define CONSTB (11) +#define CONSTC (12) +#define CONSTD (13) +#define CONSTE (14) +#define CONSTF (15) + + +/* Test that indices > length of vector are applied modulo the vector + length. */ + +/* Test for vector residing in register. */ +unsigned char c0 (vector unsigned char v) +{ + return __builtin_vec_extract (v, 0); +} + +unsigned char c9 (vector unsigned char v) +{ + return __builtin_vec_extract (v, 9); +} + +unsigned char c21 (vector unsigned char v) +{ + return __builtin_vec_extract (v, 21); +} + +unsigned char c30 (vector unsigned char v) +{ + return __builtin_vec_extract (v, 30); +} + +/* Test for vector residing in memory. */ +unsigned char mc0 (vector unsigned char *vp) +{ + return __builtin_vec_extract (*vp, 0); +} + +unsigned char mc9 (vector unsigned char *vp) +{ + return __builtin_vec_extract (*vp, 9); +} + +unsigned char mc21 (vector unsigned char *vp) +{ + return __builtin_vec_extract (*vp, 21); +} + +unsigned char mc30 (vector unsigned char *vp) +{ + return __builtin_vec_extract (*vp, 30); +} + +/* Test the same with variable indices. */ + +/* Test for variable selector and vector residing in register. */ +__attribute__((noinline)) +unsigned char ci (vector unsigned char v, int i) +{ + return __builtin_vec_extract (v, i); +} + +/* Test for variable selector and vector residing in memory. */ +__attribute__((noinline)) +unsigned char mci (vector unsigned char *vp, int i) +{ + return __builtin_vec_extract (*vp, i); +} + + +int main (int argc, char *argv[]) { + vector unsigned char cv = { CONST0, CONST1, CONST2, CONST3, + CONST4, CONST5, CONST6, CONST7, + CONST8, CONST9, CONSTA, CONSTB, + CONSTC, CONSTD, CONSTE, CONSTF }; + unsigned char c; + + c = c0 (cv); + if (c != CONST0) + abort (); + + c = c9 (cv); + if (c != CONST9) + abort (); + + c = c21 (cv); + if (c != CONST5) + abort (); + + c = c30 (cv); + if (c != CONSTE) + abort (); + + c = mc0 (&cv); + if (c != CONST0) + abort (); + + c = mc9 (&cv); + if (c != CONST9) + abort (); + + c = mc21 (&cv); + if (c != CONST5) + abort (); + + c = mc30 (&cv); + if (c != CONSTE) + abort (); + + c = ci (cv, 8); + if (c != CONST8) + abort (); + + c = ci (cv, 13); + if (c != CONSTD) + abort (); + + c = ci (cv, 23); + if (c != CONST7) + abort (); + + c = ci (cv, 31); + if (c != CONSTF) + abort (); + + c = mci (&cv, 5); + if (c != CONST5) + abort (); + + c = mci (&cv, 12); + if (c != CONSTC) + abort (); + + c = mci (&cv, 25); + if (c != CONST9) + abort (); + + c = mci (&cv, 16); + if (c != CONST0) + abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/powerpc/vsx-builtin-17a.c b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-17a.c new file mode 100644 index 00000000000..afb69342a31 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-17a.c @@ -0,0 +1,155 @@ +/* { dg-do run } */ +/* { dg-require-effective-target vmx_hw } */ +/* { dg-options "-maltivec" } */ + +/* This test should run the same on any target that supports altivec/dfp + instructions. Intentionally not specifying cpu in order to test + all code generation paths. */ + +#include + +extern void abort (void); + +#define CONST0 (0) +#define CONST1 (1) +#define CONST2 (2) +#define CONST3 (3) +#define CONST4 (4) +#define CONST5 (5) +#define CONST6 (6) +#define CONST7 (7) + + +/* Test that indices > length of vector are applied modulo the vector + length. */ + +/* Test for vector residing in register. */ +unsigned short s3 (vector unsigned short v) +{ + return __builtin_vec_extract (v, 3); +} + +unsigned short s7 (vector unsigned short v) +{ + return __builtin_vec_extract (v, 7); +} + +unsigned short s21 (vector unsigned short v) +{ + return __builtin_vec_extract (v, 21); +} + +unsigned short s30 (vector unsigned short v) +{ + return __builtin_vec_extract (v, 30); +} + +/* Test for vector residing in memory. */ +unsigned short ms3 (vector unsigned short *vp) +{ + return __builtin_vec_extract (*vp, 3); +} + +unsigned short ms7 (vector unsigned short *vp) +{ + return __builtin_vec_extract (*vp, 7); +} + +unsigned short ms21 (vector unsigned short *vp) +{ + return __builtin_vec_extract (*vp, 21); +} + +unsigned short ms30 (vector unsigned short *vp) +{ + return __builtin_vec_extract (*vp, 30); +} + +/* Test the same with variable indices. */ + +/* Test for variable selector and vector residing in register. */ +__attribute__((noinline)) +unsigned short ci (vector unsigned short v, int i) +{ + return __builtin_vec_extract (v, i); +} + +/* Test for variable selector and vector residing in memory. */ +__attribute__((noinline)) +unsigned short mci (vector unsigned short *vp, int i) +{ + return __builtin_vec_extract (*vp, i); +} + + +int main (int argc, unsigned short *argv[]) { + vector unsigned short sv = { + CONST0, CONST1, CONST2, CONST3, CONST4, CONST5, CONST6, CONST7 }; + unsigned short s; + + s = s3 (sv); + if (s != CONST3) + abort (); + + s = s7 (sv); + if (s != CONST7) + abort (); + + s = s21 (sv); + if (s != CONST5) + abort (); + + s = s30 (sv); + if (s != CONST6) + abort (); + + s = ms3 (&sv); + if (s != CONST3) + abort (); + + s = ms7 (&sv); + if (s != CONST7) + abort (); + + s = ms21 (&sv); + if (s != CONST5) + abort (); + + s = ms30 (&sv); + if (s != CONST6) + abort (); + + s = ci (sv, 5); + if (s != CONST5) + abort (); + + s = ci (sv, 2); + if (s != CONST2) + abort (); + + s = ci (sv, 15); + if (s != CONST7) + abort (); + + s = ci (sv, 28); + if (s != CONST4) + abort (); + + s = mci (&sv, 5); + if (s != CONST5) + abort (); + + s = mci (&sv, 12); + if (s != CONST4) + abort (); + + s = mci (&sv, 25); + if (s != CONST1) + abort (); + + s = mci (&sv, 16); + if (s != CONST0) + abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/powerpc/vsx-builtin-17b.c b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-17b.c new file mode 100644 index 00000000000..63814ee4bb4 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-17b.c @@ -0,0 +1,155 @@ +/* { dg-do run } */ +/* { dg-require-effective-target vmx_hw } */ +/* { dg-options "-maltivec -O3" } */ + +/* This test should run the same on any target that supports altivec/dfp + instructions. Intentionally not specifying cpu in order to test + all code generation paths. */ + +#include + +extern void abort (void); + +#define CONST0 (0) +#define CONST1 (1) +#define CONST2 (2) +#define CONST3 (3) +#define CONST4 (4) +#define CONST5 (5) +#define CONST6 (6) +#define CONST7 (7) + + +/* Test that indices > length of vector are applied modulo the vector + length. */ + +/* Test for vector residing in register. */ +unsigned short s3 (vector unsigned short v) +{ + return __builtin_vec_extract (v, 3); +} + +unsigned short s7 (vector unsigned short v) +{ + return __builtin_vec_extract (v, 7); +} + +unsigned short s21 (vector unsigned short v) +{ + return __builtin_vec_extract (v, 21); +} + +unsigned short s30 (vector unsigned short v) +{ + return __builtin_vec_extract (v, 30); +} + +/* Test for vector residing in memory. */ +unsigned short ms3 (vector unsigned short *vp) +{ + return __builtin_vec_extract (*vp, 3); +} + +unsigned short ms7 (vector unsigned short *vp) +{ + return __builtin_vec_extract (*vp, 7); +} + +unsigned short ms21 (vector unsigned short *vp) +{ + return __builtin_vec_extract (*vp, 21); +} + +unsigned short ms30 (vector unsigned short *vp) +{ + return __builtin_vec_extract (*vp, 30); +} + +/* Test the same with variable indices. */ + +/* Test for variable selector and vector residing in register. */ +__attribute__((noinline)) +unsigned short ci (vector unsigned short v, int i) +{ + return __builtin_vec_extract (v, i); +} + +/* Test for variable selector and vector residing in memory. */ +__attribute__((noinline)) +unsigned short mci (vector unsigned short *vp, int i) +{ + return __builtin_vec_extract (*vp, i); +} + + +int main (int argc, unsigned short *argv[]) { + vector unsigned short sv = { + CONST0, CONST1, CONST2, CONST3, CONST4, CONST5, CONST6, CONST7 }; + unsigned short s; + + s = s3 (sv); + if (s != CONST3) + abort (); + + s = s7 (sv); + if (s != CONST7) + abort (); + + s = s21 (sv); + if (s != CONST5) + abort (); + + s = s30 (sv); + if (s != CONST6) + abort (); + + s = ms3 (&sv); + if (s != CONST3) + abort (); + + s = ms7 (&sv); + if (s != CONST7) + abort (); + + s = ms21 (&sv); + if (s != CONST5) + abort (); + + s = ms30 (&sv); + if (s != CONST6) + abort (); + + s = ci (sv, 5); + if (s != CONST5) + abort (); + + s = ci (sv, 2); + if (s != CONST2) + abort (); + + s = ci (sv, 15); + if (s != CONST7) + abort (); + + s = ci (sv, 28); + if (s != CONST4) + abort (); + + s = mci (&sv, 5); + if (s != CONST5) + abort (); + + s = mci (&sv, 12); + if (s != CONST4) + abort (); + + s = mci (&sv, 25); + if (s != CONST1) + abort (); + + s = mci (&sv, 16); + if (s != CONST0) + abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/powerpc/vsx-builtin-18a.c b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-18a.c new file mode 100644 index 00000000000..3681ad9d019 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-18a.c @@ -0,0 +1,149 @@ +/* { dg-do run } */ +/* { dg-require-effective-target vmx_hw } */ +/* { dg-options "-maltivec" } */ + +/* This test should run the same on any target that supports altivec/dfp + instructions. Unsigned Intentionally not specifying cpu in order to test + all code generation paths. */ + +#include + +extern void abort (void); + +#define CONST0 (0) +#define CONST1 (1) +#define CONST2 (2) +#define CONST3 (3) + +/* Test that indices > length of vector are applied modulo the vector + length. */ + +/* Test for vector residing in register. */ +unsigned int s3 (vector unsigned int v) +{ + return __builtin_vec_extract (v, 3); +} + +unsigned int s1 (vector unsigned int v) +{ + return __builtin_vec_extract (v, 1); +} + +unsigned int s21 (vector unsigned int v) +{ + return __builtin_vec_extract (v, 21); +} + +unsigned int s30 (vector unsigned int v) +{ + return __builtin_vec_extract (v, 30); +} + +/* Test for vector residing in memory. */ +unsigned int ms3 (vector unsigned int *vp) +{ + return __builtin_vec_extract (*vp, 3); +} + +unsigned int ms1(vector unsigned int *vp) +{ + return __builtin_vec_extract (*vp, 1); +} + +unsigned int ms21(vector unsigned int *vp) +{ + return __builtin_vec_extract (*vp, 21); +} + +unsigned int ms30(vector unsigned int *vp) +{ + return __builtin_vec_extract (*vp, 30); +} + +/* Test the same with variable indices. */ + +/* Test for variable selector and vector residing in register. */ +__attribute__((noinline)) +unsigned int ci (vector unsigned int v, int i) +{ + return __builtin_vec_extract (v, i); +} + +/* Test for variable selector and vector residing in memory. */ +__attribute__((noinline)) +unsigned int mci(vector unsigned int *vp, int i) +{ + return __builtin_vec_extract (*vp, i); +} + + +unsigned int main (int argc, unsigned char *argv[]) { + vector unsigned int sv = { CONST0, CONST1, CONST2, CONST3 }; + unsigned int s; + + s = s3 (sv); + if (s != CONST3) + abort (); + + s = s1 (sv); + if (s != CONST1) + abort (); + + s = s21 (sv); + if (s != CONST1) + abort (); + + s = s30 (sv); + if (s != CONST2) + abort (); + + s = ms3 (&sv); + if (s != CONST3) + abort (); + + s = ms1 (&sv); + if (s != CONST1) + abort (); + + s = ms21 (&sv); + if (s != CONST1) + abort (); + + s = ms30 (&sv); + if (s != CONST2) + abort (); + + s = ci (sv, 5); + if (s != CONST1) + abort (); + + s = ci (sv, 2); + if (s != CONST2) + abort (); + + s = ci (sv, 15); + if (s != CONST3) + abort (); + + s = ci (sv, 28); + if (s != CONST0) + abort (); + + s = mci (&sv, 5); + if (s != CONST1) + abort (); + + s = mci (&sv, 12); + if (s != CONST0) + abort (); + + s = mci (&sv, 25); + if (s != CONST1) + abort (); + + s = mci (&sv, 16); + if (s != CONST0) + abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/powerpc/vsx-builtin-18b.c b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-18b.c new file mode 100644 index 00000000000..57b5c43282c --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-18b.c @@ -0,0 +1,149 @@ +/* { dg-do run } */ +/* { dg-require-effective-target vmx_hw } */ +/* { dg-options "-maltivec -O3" } */ + +/* This test should run the same on any target that supports altivec/dfp + instructions. Unsigned Intentionally not specifying cpu in order to test + all code generation paths. */ + +#include + +extern void abort (void); + +#define CONST0 (0) +#define CONST1 (1) +#define CONST2 (2) +#define CONST3 (3) + +/* Test that indices > length of vector are applied modulo the vector + length. */ + +/* Test for vector residing in register. */ +unsigned int s3 (vector unsigned int v) +{ + return __builtin_vec_extract (v, 3); +} + +unsigned int s1 (vector unsigned int v) +{ + return __builtin_vec_extract (v, 1); +} + +unsigned int s21 (vector unsigned int v) +{ + return __builtin_vec_extract (v, 21); +} + +unsigned int s30 (vector unsigned int v) +{ + return __builtin_vec_extract (v, 30); +} + +/* Test for vector residing in memory. */ +unsigned int ms3 (vector unsigned int *vp) +{ + return __builtin_vec_extract (*vp, 3); +} + +unsigned int ms1(vector unsigned int *vp) +{ + return __builtin_vec_extract (*vp, 1); +} + +unsigned int ms21(vector unsigned int *vp) +{ + return __builtin_vec_extract (*vp, 21); +} + +unsigned int ms30(vector unsigned int *vp) +{ + return __builtin_vec_extract (*vp, 30); +} + +/* Test the same with variable indices. */ + +/* Test for variable selector and vector residing in register. */ +__attribute__((noinline)) +unsigned int ci (vector unsigned int v, int i) +{ + return __builtin_vec_extract (v, i); +} + +/* Test for variable selector and vector residing in memory. */ +__attribute__((noinline)) +unsigned int mci(vector unsigned int *vp, int i) +{ + return __builtin_vec_extract (*vp, i); +} + + +unsigned int main (int argc, unsigned char *argv[]) { + vector unsigned int sv = { CONST0, CONST1, CONST2, CONST3 }; + unsigned int s; + + s = s3 (sv); + if (s != CONST3) + abort (); + + s = s1 (sv); + if (s != CONST1) + abort (); + + s = s21 (sv); + if (s != CONST1) + abort (); + + s = s30 (sv); + if (s != CONST2) + abort (); + + s = ms3 (&sv); + if (s != CONST3) + abort (); + + s = ms1 (&sv); + if (s != CONST1) + abort (); + + s = ms21 (&sv); + if (s != CONST1) + abort (); + + s = ms30 (&sv); + if (s != CONST2) + abort (); + + s = ci (sv, 5); + if (s != CONST1) + abort (); + + s = ci (sv, 2); + if (s != CONST2) + abort (); + + s = ci (sv, 15); + if (s != CONST3) + abort (); + + s = ci (sv, 28); + if (s != CONST0) + abort (); + + s = mci (&sv, 5); + if (s != CONST1) + abort (); + + s = mci (&sv, 12); + if (s != CONST0) + abort (); + + s = mci (&sv, 25); + if (s != CONST1) + abort (); + + s = mci (&sv, 16); + if (s != CONST0) + abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/powerpc/vsx-builtin-19a.c b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-19a.c new file mode 100644 index 00000000000..dee8319fb10 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-19a.c @@ -0,0 +1,109 @@ +/* { dg-do run { target int128 } } */ +/* { dg-require-effective-target vsx_hw } */ +/* { dg-options "-mvsx" } */ + +/* This test should run the same on any target that supports vsx + instructions. Intentionally not specifying cpu in order to test + all code generation paths. */ + +#include + +extern void abort (void); + +#define CONST0 (31415926539LL) +#define CONST1 (2 * 31415926539LL) + +/* Test that indices > length of vector are applied modulo the vector + length. */ + +/* Test for vector residing in register. */ +unsigned long long int e0 (vector unsigned long long int v) +{ + return __builtin_vec_extract (v, 0); +} + +unsigned long long int e3 (vector unsigned long long int v) +{ + return __builtin_vec_extract (v, 3); +} + +/* Test for vector residing in memory. */ +unsigned long long int me0 (vector unsigned long long int *vp) +{ + return __builtin_vec_extract (*vp, 0); +} + +unsigned long long int me3 (vector unsigned long long int *vp) +{ + return __builtin_vec_extract (*vp, 3); +} + +/* Test the same with variable indices. */ + +/* Test for variable selector and vector residing in register. */ +__attribute__((noinline)) +unsigned long long int ei (vector unsigned long long int v, int i) +{ + return __builtin_vec_extract (v, i); +} + +/* Test for variable selector and vector residing in memory. */ +unsigned long long int mei (vector unsigned long long int *vp, int i) +{ + return __builtin_vec_extract (*vp, i); +} + +int main (int argc, char *argv[]) { + vector unsigned long long int dv = { CONST0, CONST1 }; + unsigned long long int d; + + d = e0 (dv); + if (d != CONST0) + abort (); + + d = e3 (dv); + if (d != CONST1) + abort (); + + d = me0 (&dv); + if (d != CONST0) + abort (); + + d = me3 (&dv); + if (d != CONST1) + abort (); + + d = ei (dv, 0); + if (d != CONST0) + abort (); + + d = ei (dv, 1); + if (d != CONST1) + abort (); + + d = ei (dv, 2); + if (d != CONST0) + abort (); + + d = ei (dv, 3); + if (d != CONST1) + abort (); + + d = mei (&dv, 0); + if (d != CONST0) + abort (); + + d = mei (&dv, 1); + if (d != CONST1) + abort (); + + d = mei (&dv, 2); + if (d != CONST0) + abort (); + + d = mei (&dv, 3); + if (d != CONST1) + abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/powerpc/vsx-builtin-19b.c b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-19b.c new file mode 100644 index 00000000000..c39923e319b --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-19b.c @@ -0,0 +1,109 @@ +/* { dg-do run { target int128 } } */ +/* { dg-require-effective-target vsx_hw } */ +/* { dg-options "-mvsx -O3" } */ + +/* This test should run the same on any target that supports vsx + instructions. Intentionally not specifying cpu in order to test + all code generation paths. */ + +#include + +extern void abort (void); + +#define CONST0 (31415926539LL) +#define CONST1 (2 * 31415926539LL) + +/* Test that indices > length of vector are applied modulo the vector + length. */ + +/* Test for vector residing in register. */ +unsigned long long int e0 (vector unsigned long long int v) +{ + return __builtin_vec_extract (v, 0); +} + +unsigned long long int e3 (vector unsigned long long int v) +{ + return __builtin_vec_extract (v, 3); +} + +/* Test for vector residing in memory. */ +unsigned long long int me0 (vector unsigned long long int *vp) +{ + return __builtin_vec_extract (*vp, 0); +} + +unsigned long long int me3 (vector unsigned long long int *vp) +{ + return __builtin_vec_extract (*vp, 3); +} + +/* Test the same with variable indices. */ + +/* Test for variable selector and vector residing in register. */ +__attribute__((noinline)) +unsigned long long int ei (vector unsigned long long int v, int i) +{ + return __builtin_vec_extract (v, i); +} + +/* Test for variable selector and vector residing in memory. */ +unsigned long long int mei (vector unsigned long long int *vp, int i) +{ + return __builtin_vec_extract (*vp, i); +} + +int main (int argc, char *argv[]) { + vector unsigned long long int dv = { CONST0, CONST1 }; + unsigned long long int d; + + d = e0 (dv); + if (d != CONST0) + abort (); + + d = e3 (dv); + if (d != CONST1) + abort (); + + d = me0 (&dv); + if (d != CONST0) + abort (); + + d = me3 (&dv); + if (d != CONST1) + abort (); + + d = ei (dv, 0); + if (d != CONST0) + abort (); + + d = ei (dv, 1); + if (d != CONST1) + abort (); + + d = ei (dv, 2); + if (d != CONST0) + abort (); + + d = ei (dv, 3); + if (d != CONST1) + abort (); + + d = mei (&dv, 0); + if (d != CONST0) + abort (); + + d = mei (&dv, 1); + if (d != CONST1) + abort (); + + d = mei (&dv, 2); + if (d != CONST0) + abort (); + + d = mei (&dv, 3); + if (d != CONST1) + abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/powerpc/vsx-builtin-20a.c b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-20a.c new file mode 100644 index 00000000000..638f5a1c904 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-20a.c @@ -0,0 +1,115 @@ +/* { dg-do run { target int128 } } */ +/* { dg-require-effective-target vsx_hw } */ +/* { dg-options "-mvsx" } */ + +/* This test should run the same on any target that supports vsx + instructions. Intentionally not specifying cpu in order to test + all code generation paths. */ + +#include + +/* Define this after PR89424 is addressed. */ +#undef PR89424 + +extern void abort (void); + +#define CONST0 (((unsigned __int128) 31415926539) << 60) + +/* Test that indices > length of vector are applied modulo the vector + length. */ + +/* Test for vector residing in register. */ +unsigned __int128 e0 (vector unsigned __int128 v) +{ + return __builtin_vec_extract (v, 0); +} + +unsigned __int128 e3 (vector unsigned __int128 v) +{ + return __builtin_vec_extract (v, 3); +} + +/* Test for vector residing in memory. */ +unsigned __int128 me0 (vector unsigned __int128 *vp) +{ + return __builtin_vec_extract (*vp, 0); +} + +unsigned __int128 me3 (vector unsigned __int128 *vp) +{ + return __builtin_vec_extract (*vp, 3); +} + +/* Test the same with variable indices. */ + +#ifdef PR89424 +/* Test for variable selector and vector residing in register. */ +__attribute__((noinline)) +unsigned __int128 ei (vector unsigned __int128 v, int i) +{ + return __builtin_vec_extract (v, i); +} + +/* Test for variable selector and vector residing in memory. */ +unsigned __int128 mei (vector unsigned __int128 *vp, int i) +{ + return __builtin_vec_extract (*vp, i); +} +#endif + +int main (int argc, char *argv[]) { + vector unsigned __int128 dv = { CONST0 }; + unsigned __int128 d; + + d = e0 (dv); + if (d != CONST0) + abort (); + + d = e3 (dv); + if (d != CONST0) + abort (); + + d = me0 (&dv); + if (d != CONST0) + abort (); + + d = me3 (&dv); + if (d != CONST0) + abort (); + +#ifdef PR89424 + d = ei (dv, 0); + if (d != CONST0) + abort (); + + d = ei (dv, 1); + if (d != CONST0) + abort (); + + d = ei (dv, 2); + if (d != CONST0) + abort (); + + d = ei (dv, 3); + if (d != CONST0) + abort (); + + d = mei (&dv, 0); + if (d != CONST0) + abort (); + + d = mei (&dv, 1); + if (d != CONST0) + abort (); + + d = mei (&dv, 2); + if (d != CONST0) + abort (); + + d = mei (&dv, 3); + if (d != CONST0) + abort (); +#endif + + return 0; +} diff --git a/gcc/testsuite/gcc.target/powerpc/vsx-builtin-20b.c b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-20b.c new file mode 100644 index 00000000000..7b127a06c77 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-20b.c @@ -0,0 +1,115 @@ +/* { dg-do run { target int128 } } */ +/* { dg-require-effective-target vsx_hw } */ +/* { dg-options "-mvsx -O3" } */ + +/* This test should run the same on any target that supports vsx + instructions. Intentionally not specifying cpu in order to test + all code generation paths. */ + +#include + +/* Define this after PR89424 is addressed. */ +#undef PR89424 + +extern void abort (void); + +#define CONST0 (((unsigned __int128) 31415926539) << 60) + +/* Test that indices > length of vector are applied modulo the vector + length. */ + +/* Test for vector residing in register. */ +unsigned __int128 e0 (vector unsigned __int128 v) +{ + return __builtin_vec_extract (v, 0); +} + +unsigned __int128 e3 (vector unsigned __int128 v) +{ + return __builtin_vec_extract (v, 3); +} + +/* Test for vector residing in memory. */ +unsigned __int128 me0 (vector unsigned __int128 *vp) +{ + return __builtin_vec_extract (*vp, 0); +} + +unsigned __int128 me3 (vector unsigned __int128 *vp) +{ + return __builtin_vec_extract (*vp, 3); +} + +/* Test the same with variable indices. */ + +#ifdef PR89424 +/* Test for variable selector and vector residing in register. */ +__attribute__((noinline)) +unsigned __int128 ei (vector unsigned __int128 v, int i) +{ + return __builtin_vec_extract (v, i); +} + +/* Test for variable selector and vector residing in memory. */ +unsigned __int128 mei (vector unsigned __int128 *vp, int i) +{ + return __builtin_vec_extract (*vp, i); +} +#endif + +int main (int argc, char *argv[]) { + vector unsigned __int128 dv = { CONST0 }; + unsigned __int128 d; + + d = e0 (dv); + if (d != CONST0) + abort (); + + d = e3 (dv); + if (d != CONST0) + abort (); + + d = me0 (&dv); + if (d != CONST0) + abort (); + + d = me3 (&dv); + if (d != CONST0) + abort (); + +#ifdef PR89424 + d = ei (dv, 0); + if (d != CONST0) + abort (); + + d = ei (dv, 1); + if (d != CONST0) + abort (); + + d = ei (dv, 2); + if (d != CONST0) + abort (); + + d = ei (dv, 3); + if (d != CONST0) + abort (); + + d = mei (&dv, 0); + if (d != CONST0) + abort (); + + d = mei (&dv, 1); + if (d != CONST0) + abort (); + + d = mei (&dv, 2); + if (d != CONST0) + abort (); + + d = mei (&dv, 3); + if (d != CONST0) + abort (); +#endif + + return 0; +} diff --git a/gcc/testsuite/gcc.target/powerpc/vsx-builtin-9a.c b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-9a.c new file mode 100644 index 00000000000..7b3543443b7 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-9a.c @@ -0,0 +1,164 @@ +/* { dg-do run } */ +/* { dg-require-effective-target vmx_hw } */ +/* { dg-options "-maltivec" } */ + +/* This test should run the same on any target that supports altivec/dfp + instructions. Intentionally not specifying cpu in order to test + all code generation paths. */ + +#include + +extern void abort (void); + +#define CONST0 (0) +#define CONST1 (1) +#define CONST2 (2) +#define CONST3 (3) +#define CONST4 (4) +#define CONST5 (5) +#define CONST6 (6) +#define CONST7 (7) +#define CONST8 (8) +#define CONST9 (9) +#define CONSTA (10) +#define CONSTB (11) +#define CONSTC (12) +#define CONSTD (13) +#define CONSTE (14) +#define CONSTF (15) + + +/* Test that indices > length of vector are applied modulo the vector + length. */ + +/* Test for vector residing in register. */ +signed char c0 (vector signed char v) +{ + return __builtin_vec_ext_v16qi (v, 0); +} + +signed char c9 (vector signed char v) +{ + return __builtin_vec_ext_v16qi (v, 9); +} + +signed char c21 (vector signed char v) +{ + return __builtin_vec_ext_v16qi (v, 21); +} + +signed char c30 (vector signed char v) +{ + return __builtin_vec_ext_v16qi (v, 30); +} + +/* Test for vector residing in memory. */ +signed char mc0 (vector signed char *vp) +{ + return __builtin_vec_ext_v16qi (*vp, 0); +} + +signed char mc9 (vector signed char *vp) +{ + return __builtin_vec_ext_v16qi (*vp, 9); +} + +signed char mc21 (vector signed char *vp) +{ + return __builtin_vec_ext_v16qi (*vp, 21); +} + +signed char mc30 (vector signed char *vp) +{ + return __builtin_vec_ext_v16qi (*vp, 30); +} + +/* Test the same with variable indices. */ + +/* Test for variable selector and vector residing in register. */ +__attribute__((noinline)) +signed char ci (vector signed char v, int i) +{ + return __builtin_vec_ext_v16qi (v, i); +} + +/* Test for variable selector and vector residing in memory. */ +__attribute__((noinline)) +signed char mci(vector signed char *vp, int i) { + return __builtin_vec_ext_v16qi (*vp, i); +} + + +int main (int argc, char *argv[]) { + vector signed char cv = { CONST0, CONST1, CONST2, CONST3, + CONST4, CONST5, CONST6, CONST7, + CONST8, CONST9, CONSTA, CONSTB, + CONSTC, CONSTD, CONSTE, CONSTF }; + signed char c; + + c = c0 (cv); + if (c != CONST0) + abort (); + + c = c9 (cv); + if (c != CONST9) + abort (); + + c = c21 (cv); + if (c != CONST5) + abort (); + + c = c30 (cv); + if (c != CONSTE) + abort (); + + c = mc0 (&cv); + if (c != CONST0) + abort (); + + c = mc9 (&cv); + if (c != CONST9) + abort (); + + c = mc21 (&cv); + if (c != CONST5) + abort (); + + c = mc30 (&cv); + if (c != CONSTE) + abort (); + + c = ci (cv, 8); + if (c != CONST8) + abort (); + + c = ci (cv, 13); + if (c != CONSTD) + abort (); + + c = ci (cv, 23); + if (c != CONST7) + abort (); + + c = ci (cv, 31); + if (c != CONSTF) + abort (); + + c = mci (&cv, 5); + if (c != CONST5) + abort (); + + c = mci (&cv, 12); + if (c != CONSTC) + abort (); + + c = mci (&cv, 25); + if (c != CONST9) + abort (); + + c = mci (&cv, 16); + if (c != CONST0) + abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/powerpc/vsx-builtin-9b.c b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-9b.c new file mode 100644 index 00000000000..ff081b354b2 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-9b.c @@ -0,0 +1,164 @@ +/* { dg-do run } */ +/* { dg-require-effective-target vmx_hw } */ +/* { dg-options "-maltivec -O3" } */ + +/* This test should run the same on any target that supports altivec/dfp + instructions. Intentionally not specifying cpu in order to test + all code generation paths. */ + +#include + +extern void abort (void); + +#define CONST0 (0) +#define CONST1 (1) +#define CONST2 (2) +#define CONST3 (3) +#define CONST4 (4) +#define CONST5 (5) +#define CONST6 (6) +#define CONST7 (7) +#define CONST8 (8) +#define CONST9 (9) +#define CONSTA (10) +#define CONSTB (11) +#define CONSTC (12) +#define CONSTD (13) +#define CONSTE (14) +#define CONSTF (15) + + +/* Test that indices > length of vector are applied modulo the vector + length. */ + +/* Test for vector residing in register. */ +signed char c0 (vector signed char v) +{ + return __builtin_vec_ext_v16qi (v, 0); +} + +signed char c9 (vector signed char v) +{ + return __builtin_vec_ext_v16qi (v, 9); +} + +signed char c21 (vector signed char v) +{ + return __builtin_vec_ext_v16qi (v, 21); +} + +signed char c30 (vector signed char v) +{ + return __builtin_vec_ext_v16qi (v, 30); +} + +/* Test for vector residing in memory. */ +signed char mc0 (vector signed char *vp) +{ + return __builtin_vec_ext_v16qi (*vp, 0); +} + +signed char mc9 (vector signed char *vp) +{ + return __builtin_vec_ext_v16qi (*vp, 9); +} + +signed char mc21 (vector signed char *vp) +{ + return __builtin_vec_ext_v16qi (*vp, 21); +} + +signed char mc30 (vector signed char *vp) +{ + return __builtin_vec_ext_v16qi (*vp, 30); +} + +/* Test the same with variable indices. */ + +/* Test for variable selector and vector residing in register. */ +__attribute__((noinline)) +signed char ci (vector signed char v, int i) +{ + return __builtin_vec_ext_v16qi (v, i); +} + +/* Test for variable selector and vector residing in memory. */ +__attribute__((noinline)) +signed char mci(vector signed char *vp, int i) { + return __builtin_vec_ext_v16qi (*vp, i); +} + + +int main (int argc, char *argv[]) { + vector signed char cv = { CONST0, CONST1, CONST2, CONST3, + CONST4, CONST5, CONST6, CONST7, + CONST8, CONST9, CONSTA, CONSTB, + CONSTC, CONSTD, CONSTE, CONSTF }; + signed char c; + + c = c0 (cv); + if (c != CONST0) + abort (); + + c = c9 (cv); + if (c != CONST9) + abort (); + + c = c21 (cv); + if (c != CONST5) + abort (); + + c = c30 (cv); + if (c != CONSTE) + abort (); + + c = mc0 (&cv); + if (c != CONST0) + abort (); + + c = mc9 (&cv); + if (c != CONST9) + abort (); + + c = mc21 (&cv); + if (c != CONST5) + abort (); + + c = mc30 (&cv); + if (c != CONSTE) + abort (); + + c = ci (cv, 8); + if (c != CONST8) + abort (); + + c = ci (cv, 13); + if (c != CONSTD) + abort (); + + c = ci (cv, 23); + if (c != CONST7) + abort (); + + c = ci (cv, 31); + if (c != CONSTF) + abort (); + + c = mci (&cv, 5); + if (c != CONST5) + abort (); + + c = mci (&cv, 12); + if (c != CONSTC) + abort (); + + c = mci (&cv, 25); + if (c != CONST9) + abort (); + + c = mci (&cv, 16); + if (c != CONST0) + abort (); + + return 0; +} -- cgit v1.2.3 From a8e356239fe8bb82e6f56f0f9d40f7c37da23b0c Mon Sep 17 00:00:00 2001 From: Martin Jambor Date: Wed, 17 Apr 2019 15:52:16 +0000 Subject: 2019-04-17 Martin Jambor Backport from mainline 2019-03-10 Martin Jambor PR tree-optimization/85762 PR tree-optimization/87008 PR tree-optimization/85459 * tree-sra.c (contains_vce_or_bfcref_p): New parameter, set the bool it points to if there is a type changing MEM_REF. Adjust all callers. (build_accesses_from_assign): Disable total scalarization if contains_vce_or_bfcref_p returns true through the new parameter, for both rhs and lhs. testsuite/ * g++.dg/tree-ssa/pr87008.C: New test. * gcc.dg/guality/pr54970.c: Xfail tests querying a[0] everywhere. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270414 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 14 +++++++++++++ gcc/testsuite/ChangeLog | 8 ++++++++ gcc/testsuite/g++.dg/tree-ssa/pr87008.C | 17 ++++++++++++++++ gcc/testsuite/gcc.dg/guality/pr54970.c | 6 +++--- gcc/tree-sra.c | 36 ++++++++++++++++++++++++--------- 5 files changed, 69 insertions(+), 12 deletions(-) create mode 100644 gcc/testsuite/g++.dg/tree-ssa/pr87008.C diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 67ae2ca179f..f9d0cbe2835 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,17 @@ +2019-04-17 Martin Jambor + + Backport from mainline + 2019-03-10 Martin Jambor + + PR tree-optimization/85762 + PR tree-optimization/87008 + PR tree-optimization/85459 + * tree-sra.c (contains_vce_or_bfcref_p): New parameter, set the bool + it points to if there is a type changing MEM_REF. Adjust all callers. + (build_accesses_from_assign): Disable total scalarization if + contains_vce_or_bfcref_p returns true through the new parameter, for + both rhs and lhs. + 2019-04-17 Kelvin Nilsen Backport from mainline diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 62b258a92e2..7951d79208a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2019-04-17 Martin Jambor + + Backport from mainline + 2019-03-10 Martin Jambor + + * g++.dg/tree-ssa/pr87008.C: New test. + * gcc.dg/guality/pr54970.c: Xfail tests querying a[0] everywhere. + 2019-04-17 Kelvin Nilsen Backport from mainline diff --git a/gcc/testsuite/g++.dg/tree-ssa/pr87008.C b/gcc/testsuite/g++.dg/tree-ssa/pr87008.C new file mode 100644 index 00000000000..eef521f9ad5 --- /dev/null +++ b/gcc/testsuite/g++.dg/tree-ssa/pr87008.C @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-optimized" } */ + +extern void dontcallthis(); + +struct A { long a, b; }; +struct B : A {}; +templatevoid cp(T&a,T const&b){a=b;} +long f(B x){ + B y; cp(y,x); + B z; cp(z,x); + if (y.a - z.a) + dontcallthis (); + return 0; +} + +/* { dg-final { scan-tree-dump-not "dontcallthis" "optimized" } } */ diff --git a/gcc/testsuite/gcc.dg/guality/pr54970.c b/gcc/testsuite/gcc.dg/guality/pr54970.c index 1819d023e21..f12a9aac1d2 100644 --- a/gcc/testsuite/gcc.dg/guality/pr54970.c +++ b/gcc/testsuite/gcc.dg/guality/pr54970.c @@ -8,17 +8,17 @@ int main () { - int a[] = { 1, 2, 3 }; /* { dg-final { gdb-test 15 "a\[0\]" "1" } } */ + int a[] = { 1, 2, 3 }; /* { dg-final { gdb-test 15 "a\[0\]" "1" { xfail { *-*-* } } } } */ int *p = a + 2; /* { dg-final { gdb-test 15 "a\[1\]" "2" } } */ int *q = a + 1; /* { dg-final { gdb-test 15 "a\[2\]" "3" } } */ /* { dg-final { gdb-test 15 "*p" "3" } } */ asm volatile (NOP); /* { dg-final { gdb-test 15 "*q" "2" } } */ - *p += 10; /* { dg-final { gdb-test 20 "a\[0\]" "1" } } */ + *p += 10; /* { dg-final { gdb-test 20 "a\[0\]" "1" { xfail { *-*-* } } } } */ /* { dg-final { gdb-test 20 "a\[1\]" "2" } } */ /* { dg-final { gdb-test 20 "a\[2\]" "13" } } */ /* { dg-final { gdb-test 20 "*p" "13" } } */ asm volatile (NOP); /* { dg-final { gdb-test 20 "*q" "2" } } */ - *q += 10; /* { dg-final { gdb-test 25 "a\[0\]" "1" } } */ + *q += 10; /* { dg-final { gdb-test 25 "a\[0\]" "1" { xfail { *-*-* } } } } */ /* { dg-final { gdb-test 25 "a\[1\]" "12" } } */ /* { dg-final { gdb-test 25 "a\[2\]" "13" } } */ /* { dg-final { gdb-test 25 "*p" "13" } } */ diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c index bb373b33b7a..e1ebdfaa225 100644 --- a/gcc/tree-sra.c +++ b/gcc/tree-sra.c @@ -1150,29 +1150,36 @@ contains_view_convert_expr_p (const_tree ref) return false; } -/* Return true if REF contains a VIEW_CONVERT_EXPR or a MEM_REF that performs - type conversion or a COMPONENT_REF with a bit-field field declaration. */ +/* Return true if REF contains a VIEW_CONVERT_EXPR or a COMPONENT_REF with a + bit-field field declaration. If TYPE_CHANGING_P is non-NULL, set the bool + it points to will be set if REF contains any of the above or a MEM_REF + expression that effectively performs type conversion. */ static bool -contains_vce_or_bfcref_p (const_tree ref) +contains_vce_or_bfcref_p (const_tree ref, bool *type_changing_p = NULL) { while (handled_component_p (ref)) { if (TREE_CODE (ref) == VIEW_CONVERT_EXPR || (TREE_CODE (ref) == COMPONENT_REF && DECL_BIT_FIELD (TREE_OPERAND (ref, 1)))) - return true; + { + if (type_changing_p) + *type_changing_p = true; + return true; + } ref = TREE_OPERAND (ref, 0); } - if (TREE_CODE (ref) != MEM_REF + if (!type_changing_p + || TREE_CODE (ref) != MEM_REF || TREE_CODE (TREE_OPERAND (ref, 0)) != ADDR_EXPR) return false; tree mem = TREE_OPERAND (TREE_OPERAND (ref, 0), 0); if (TYPE_MAIN_VARIANT (TREE_TYPE (ref)) != TYPE_MAIN_VARIANT (TREE_TYPE (mem))) - return true; + *type_changing_p = true; return false; } @@ -1368,15 +1375,26 @@ build_accesses_from_assign (gimple *stmt) lacc->grp_assignment_write = 1; if (storage_order_barrier_p (rhs)) lacc->grp_unscalarizable_region = 1; + + if (should_scalarize_away_bitmap && !is_gimple_reg_type (lacc->type)) + { + bool type_changing_p = false; + contains_vce_or_bfcref_p (lhs, &type_changing_p); + if (type_changing_p) + bitmap_set_bit (cannot_scalarize_away_bitmap, + DECL_UID (lacc->base)); + } } if (racc) { racc->grp_assignment_read = 1; - if (should_scalarize_away_bitmap && !gimple_has_volatile_ops (stmt) - && !is_gimple_reg_type (racc->type)) + if (should_scalarize_away_bitmap && !is_gimple_reg_type (racc->type)) { - if (contains_vce_or_bfcref_p (rhs)) + bool type_changing_p = false; + contains_vce_or_bfcref_p (rhs, &type_changing_p); + + if (type_changing_p || gimple_has_volatile_ops (stmt)) bitmap_set_bit (cannot_scalarize_away_bitmap, DECL_UID (racc->base)); else -- cgit v1.2.3 From 0337a4a59e98d75021e914e3fd4c678098a9f080 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Thu, 18 Apr 2019 00:16:09 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270429 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index b87667d2501..7a0620c7016 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190417 +20190418 -- cgit v1.2.3 From a443eb57d2443bed6272aa57535df0592371bea5 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Fri, 19 Apr 2019 00:16:15 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270450 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 7a0620c7016..944f054b11e 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190418 +20190419 -- cgit v1.2.3 From c1a0f91fdf0a1f3c527e3252f24ddead1314c217 Mon Sep 17 00:00:00 2001 From: Pat Haugen Date: Fri, 19 Apr 2019 17:14:57 +0000 Subject: Backport from mainline: 2019-04-16 Pat Haugen PR target/84369 * config/rs6000/power9.md: Add store forwarding bypass. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270461 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 8 ++++++++ gcc/config/rs6000/power9.md | 3 +++ 2 files changed, 11 insertions(+) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f9d0cbe2835..ecdd9c86ba0 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2019-04-19 Pat Haugen + + Backport from mainline: + 2019-04-16 Pat Haugen + + PR target/84369 + * config/rs6000/power9.md: Add store forwarding bypass. + 2019-04-17 Martin Jambor Backport from mainline diff --git a/gcc/config/rs6000/power9.md b/gcc/config/rs6000/power9.md index 79ebbe47e08..cc4a329c6aa 100644 --- a/gcc/config/rs6000/power9.md +++ b/gcc/config/rs6000/power9.md @@ -236,6 +236,9 @@ (eq_attr "cpu" "power9")) "DU_super_power9,LSU_pair_power9") +; Store forwarding latency is 6 +(define_bypass 6 "power9-*store*" "power9-*load*") + (define_insn_reservation "power9-larx" 4 (and (eq_attr "type" "load_l") (eq_attr "cpu" "power9")) -- cgit v1.2.3 From 69e1751ba4173c558c2dd740f533d231ce7c7293 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Sat, 20 Apr 2019 00:16:14 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270465 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 944f054b11e..3ac391d3a49 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190419 +20190420 -- cgit v1.2.3 From efdf68ea9f36da148fd0b705b6b85ec444641bf8 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Sun, 21 Apr 2019 00:16:08 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270474 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 3ac391d3a49..67c1b28f8fd 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190420 +20190421 -- cgit v1.2.3 From 7c74eb219c8c3748c3330fc9eba00fe6a865d06b Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Mon, 22 Apr 2019 00:16:12 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270487 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 67c1b28f8fd..33b54abeb1f 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190421 +20190422 -- cgit v1.2.3 From c257d2bc7597049a448d271ffa1e5e8cea53361d Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Tue, 23 Apr 2019 00:16:10 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270497 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 33b54abeb1f..7f80cee800b 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190422 +20190423 -- cgit v1.2.3 From 4fa9d3fe05df57d14d6cd53a469d2e316ce19fbf Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Wed, 24 Apr 2019 00:16:14 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270529 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 7f80cee800b..7e63179ca6d 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190423 +20190424 -- cgit v1.2.3 From 54a98e703609fc929b0f8b0bc93508e15734e340 Mon Sep 17 00:00:00 2001 From: Paul Thomas Date: Wed, 24 Apr 2019 07:27:42 +0000 Subject: 2019-04-24 Paul Thomas PR fortran/87127 * resolve.c (check_host_association): If an external function is typed but not declared explicitly to be external, change the old symbol from a variable to an external function. 2019-04-24 Paul Thomas PR fortran/87127 * gfortran.dg/external_procedures_4.f90: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270532 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fortran/ChangeLog | 8 ++++++ gcc/fortran/resolve.c | 33 ++++++++++++++++++---- gcc/testsuite/ChangeLog | 6 ++++ .../gfortran.dg/external_procedures_4.f90 | 28 ++++++++++++++++++ 4 files changed, 70 insertions(+), 5 deletions(-) create mode 100644 gcc/testsuite/gfortran.dg/external_procedures_4.f90 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 7442bda84c0..41b79383ee6 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,11 @@ +2019-04-24 Paul Thomas + + Backport from mainline + PR fortran/87127 + * resolve.c (check_host_association): If an external function + is typed but not declared explicitly to be external, change the + old symbol from a variable to an external function. + 2019-04-14 Thomas Koenig Backport from trunk diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index 87d5969b3c9..4c67b57614f 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -5629,11 +5629,14 @@ resolve_procedure: /* Checks to see that the correct symbol has been host associated. - The only situation where this arises is that in which a twice - contained function is parsed after the host association is made. - Therefore, on detecting this, change the symbol in the expression - and convert the array reference into an actual arglist if the old - symbol is a variable. */ + The only situations where this arises are: + (i) That in which a twice contained function is parsed after + the host association is made. On detecting this, change + the symbol in the expression and convert the array reference + into an actual arglist if the old symbol is a variable; or + (ii) That in which an external function is typed but not declared + explcitly to be external. Here, the old symbol is changed + from a variable to an external function. */ static bool check_host_association (gfc_expr *e) { @@ -5723,6 +5726,26 @@ check_host_association (gfc_expr *e) gfc_resolve_expr (e); sym->refs++; } + /* This case corresponds to a call, from a block or a contained + procedure, to an external function, which has not been declared + as being external in the main program but has been typed. */ + else if (sym && old_sym != sym + && !e->ref + && sym->ts.type == BT_UNKNOWN + && old_sym->ts.type != BT_UNKNOWN + && sym->attr.flavor == FL_PROCEDURE + && old_sym->attr.flavor == FL_VARIABLE + && sym->ns->parent == old_sym->ns + && sym->ns->proc_name + && (sym->ns->proc_name->attr.flavor == FL_LABEL + || sym->ns->proc_name->attr.flavor == FL_PROCEDURE)) + { + old_sym->attr.flavor = FL_PROCEDURE; + old_sym->attr.external = 1; + old_sym->attr.function = 1; + old_sym->result = old_sym; + gfc_resolve_expr (e); + } } /* This might have changed! */ return e->expr_type == EXPR_FUNCTION; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 7951d79208a..47f33ff4780 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2019-04-24 Paul Thomas + + Backport from mainline + PR fortran/87127 + * gfortran.dg/external_procedures_4.f90: New test. + 2019-04-17 Martin Jambor Backport from mainline diff --git a/gcc/testsuite/gfortran.dg/external_procedures_4.f90 b/gcc/testsuite/gfortran.dg/external_procedures_4.f90 new file mode 100644 index 00000000000..11c4f48ea3e --- /dev/null +++ b/gcc/testsuite/gfortran.dg/external_procedures_4.f90 @@ -0,0 +1,28 @@ +! { dg-do run } +! +! Test the fix for PR87127 in which the references to exfunc cause +! the error "‘exfunc’ at (1) is not a function". +! +! Contributed by Gerhard Steinmetz +! +function exfunc(i) + implicit none + integer :: exfunc,i + exfunc = 2*i +end function + +! contents of test.f90 +program test + implicit none + integer :: exfunc,i + integer,parameter :: array(2)=[6,7] + associate(i=>array(2)) ! Original bug + if (exfunc(i) .ne. 2*i) stop 1 + end associate + i = 99 + call foo +contains + subroutine foo() ! Comment #3 + if (exfunc(i) .ne. 2*i) stop 2 + end subroutine foo +end program -- cgit v1.2.3 From fc29288eb0487dddaa4fe9c1ad833da7d87d6022 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Thu, 25 Apr 2019 00:16:08 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270562 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 7e63179ca6d..e49bc7d775b 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190424 +20190425 -- cgit v1.2.3 From bc8fa1404a92f2d85cc268a5473862d888a8dd16 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Fri, 26 Apr 2019 00:16:08 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270590 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index e49bc7d775b..f9053ef63f8 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190425 +20190426 -- cgit v1.2.3 From 83be1ec84ce90968c6eb3a3d9939bfc480a64712 Mon Sep 17 00:00:00 2001 From: Roman Zhuykov Date: Fri, 26 Apr 2019 16:04:54 +0000 Subject: Backport modulo-sched fixes from mainline 2019-04-23 Roman Zhuykov modulo-sched: prevent division by zero (PR87979) PR rtl-optimization/87979 * modulo-sched.c (sms_schedule): Start ii value "mii" should not equal zero. modulo-sched: fix branch scheduling issue (PR84032) PR rtl-optimization/84032 * modulo-sched.c (ps_insn_find_column): Change condition so that branch will always be the last insn in a row inside partial schedule. gcc/testsuite: PR rtl-optimization/87979 * gcc.dg/pr87979.c: New test. PR rtl-optimization/84032 * gcc.dg/pr84032.c: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270609 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 14 ++++++++++++++ gcc/modulo-sched.c | 5 ++--- gcc/testsuite/ChangeLog | 14 ++++++++++++-- gcc/testsuite/gcc.dg/pr84032.c | 23 +++++++++++++++++++++++ gcc/testsuite/gcc.dg/pr87979.c | 11 +++++++++++ 5 files changed, 62 insertions(+), 5 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/pr84032.c create mode 100644 gcc/testsuite/gcc.dg/pr87979.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ecdd9c86ba0..0a839840696 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,17 @@ +2019-04-26 Roman Zhuykov + + Backport from mainline + 2019-04-23 Roman Zhuykov + + PR rtl-optimization/87979 + * modulo-sched.c (sms_schedule): Start ii value "mii" should + not equal zero. + + PR rtl-optimization/84032 + * modulo-sched.c (ps_insn_find_column): Change condition so that + branch will always be the last insn in a row inside partial + schedule. + 2019-04-19 Pat Haugen Backport from mainline: diff --git a/gcc/modulo-sched.c b/gcc/modulo-sched.c index 9a27365bfbc..0fb3f1bcb60 100644 --- a/gcc/modulo-sched.c +++ b/gcc/modulo-sched.c @@ -1605,6 +1605,7 @@ sms_schedule (void) mii = 1; /* Need to pass some estimate of mii. */ rec_mii = sms_order_nodes (g, mii, node_order, &max_asap); mii = MAX (res_MII (g), rec_mii); + mii = MAX (mii, 1); maxii = MAX (max_asap, MAXII_FACTOR * mii); if (dump_file) @@ -3004,9 +3005,7 @@ ps_insn_find_column (partial_schedule_ptr ps, ps_insn_ptr ps_i, last_must_precede = next_ps_i; } /* The closing branch must be the last in the row. */ - if (must_precede - && bitmap_bit_p (must_precede, next_ps_i->id) - && JUMP_P (ps_rtl_insn (ps, next_ps_i->id))) + if (JUMP_P (ps_rtl_insn (ps, next_ps_i->id))) return false; last_in_row = next_ps_i; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 47f33ff4780..29ba0b4d464 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,14 @@ +2019-04-26 Roman Zhuykov + + Backport from mainline + 2019-04-23 Roman Zhuykov + + PR rtl-optimization/87979 + * gcc.dg/pr87979.c: New test. + + PR rtl-optimization/84032 + * gcc.dg/pr84032.c: New test. + 2019-04-24 Paul Thomas Backport from mainline @@ -294,8 +305,7 @@ 2019-02-18 Richard Biener PR tree-optimization/89296 - * tree-ssa-loop-ch.c (ch_base::copy_headers): Restrict setting - of no-warning flag to cases that might emit the bogus warning. + * gcc.dg/uninit-pr89296.c: New testcase. 2019-03-13 Andreas Krebbel diff --git a/gcc/testsuite/gcc.dg/pr84032.c b/gcc/testsuite/gcc.dg/pr84032.c new file mode 100644 index 00000000000..c295d9a0dae --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr84032.c @@ -0,0 +1,23 @@ +/* PR rtl-optimization/84032 */ +/* { dg-do compile } */ +/* { dg-options "-O1 -fmodulo-sched" } */ +/* { dg-additional-options "-mcpu=power6" { target { powerpc-*-* } } } */ + +void +yr (int cm) +{ + int ka = cm; + + for (;;) + { + short int m0; + + for (m0 = 0; m0 < 6; ++m0) + { + ka &= 1; + cm *= 2; + } + + ka = (ka == 0) ? cm : 0; + } +} diff --git a/gcc/testsuite/gcc.dg/pr87979.c b/gcc/testsuite/gcc.dg/pr87979.c new file mode 100644 index 00000000000..d3d595f4f81 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr87979.c @@ -0,0 +1,11 @@ +/* PR rtl-optimization/87979 */ +/* { dg-do compile } */ +/* { dg-options "-Os -fmodulo-sched -fno-tree-loop-im" } */ +/* { dg-additional-options "-march=z196" { target { s390*-*-* } } } */ + +void foo(void) +{ + static int m; + for (int i = 0; i < 10; ++i) + m++; +} -- cgit v1.2.3 From 04d3d4e5efa4ea1120d4faa688bce1e49d60fbc1 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Sat, 27 Apr 2019 00:16:24 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270618 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index f9053ef63f8..56b7f4d8965 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190426 +20190427 -- cgit v1.2.3 From b8dbec1c26f67dd88c20b4d9f82a286c00db19df Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Sun, 28 Apr 2019 00:16:13 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270628 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 56b7f4d8965..72336896a4c 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190427 +20190428 -- cgit v1.2.3 From b8d8caff59625c1a2f40aa571a6df106c31ab352 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Mon, 29 Apr 2019 00:16:10 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270635 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 72336896a4c..5ffe417f629 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190428 +20190429 -- cgit v1.2.3 From 29f5ac3ee0b9fcafa03d98e9297fcf6df523472e Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Mon, 29 Apr 2019 07:54:34 +0000 Subject: Fix POLY_INT_CST/CONST_POLY_INT typo (PR 89631) 2019-04-29 Richard Sandiford gcc/ Backport from mainline: 2019-03-08 Richard Sandiford PR debug/89631 * dwarf2cfi.c (dwarf2out_frame_debug_expr): Use CONST_POLY_INT instead of POLY_INT_CST. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270641 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 9 +++++++++ gcc/dwarf2cfi.c | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 0a839840696..eceaf4879f6 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2019-04-29 Richard Sandiford + + Backport from mainline: + 2019-03-08 Richard Sandiford + + PR debug/89631 + * dwarf2cfi.c (dwarf2out_frame_debug_expr): Use CONST_POLY_INT + instead of POLY_INT_CST. + 2019-04-26 Roman Zhuykov Backport from mainline diff --git a/gcc/dwarf2cfi.c b/gcc/dwarf2cfi.c index 07e6a5a2887..bed6c981852 100644 --- a/gcc/dwarf2cfi.c +++ b/gcc/dwarf2cfi.c @@ -1762,7 +1762,7 @@ dwarf2out_frame_debug_expr (rtx expr) /* Rule 6 */ case CONST_INT: - case POLY_INT_CST: + case CONST_POLY_INT: cur_trace->cfa_temp.reg = dwf_regno (dest); cur_trace->cfa_temp.offset = rtx_to_poly_int64 (src); break; -- cgit v1.2.3 From bf4fda7b8bfb88882f1f09a6c435463896147125 Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Mon, 29 Apr 2019 07:56:02 +0000 Subject: Fix aarch64_evpc_tbl guard (PR 85910) 2018-04-29 Richard Sandiford gcc/ Backport from mainline: 2018-08-23 Richard Sandiford PR target/85910 * config/aarch64/aarch64.c (aarch64_expand_vec_perm_const_1): Fix aarch64_evpc_tbl guard. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270642 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 9 +++++++++ gcc/config/aarch64/aarch64.c | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index eceaf4879f6..ac315bfb468 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2019-04-29 Richard Sandiford + + Backport from mainline: + 2018-08-23 Richard Sandiford + + PR target/85910 + * config/aarch64/aarch64.c (aarch64_expand_vec_perm_const_1): Fix + aarch64_evpc_tbl guard. + 2019-04-29 Richard Sandiford Backport from mainline: diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c index 349ca0c047b..64eab084683 100644 --- a/gcc/config/aarch64/aarch64.c +++ b/gcc/config/aarch64/aarch64.c @@ -15623,7 +15623,7 @@ aarch64_expand_vec_perm_const_1 (struct expand_vec_perm_d *d) return true; if (d->vec_flags == VEC_SVE_DATA) return aarch64_evpc_sve_tbl (d); - else if (d->vec_flags == VEC_SVE_DATA) + else if (d->vec_flags == VEC_ADVSIMD) return aarch64_evpc_tbl (d); } return false; -- cgit v1.2.3 From dad42290b6f3e98de3bc68879b5e2d5eea828a11 Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Mon, 29 Apr 2019 08:32:27 +0000 Subject: Fix output_constructor_bitfield handling of wide bitfields (PR89037) The testcase was failing because we were trying to access TREE_INT_CST_ELT (x, 1) of a 128-bit integer that was small enough to need only a single element. 2019-04-29 Richard Sandiford gcc/ Backport from mainline: 2019-01-25 Richard Sandiford PR middle-end/89037 * varasm.c (output_constructor_bitfield): Use wi::extract_uhwi instead of accessing TREE_INT_CST_ELT directly. gcc/testsuite/ Backport from mainline: 2019-01-25 Richard Sandiford PR middle-end/89037 * gcc.dg/pr89037.c: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270643 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 9 +++++++++ gcc/testsuite/ChangeLog | 8 ++++++++ gcc/testsuite/gcc.dg/pr89037.c | 24 ++++++++++++++++++++++++ gcc/varasm.c | 22 +++++++++------------- 4 files changed, 50 insertions(+), 13 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/pr89037.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ac315bfb468..986b7a86904 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2019-04-29 Richard Sandiford + + Backport from mainline: + 2019-01-25 Richard Sandiford + + PR middle-end/89037 + * varasm.c (output_constructor_bitfield): Use wi::extract_uhwi + instead of accessing TREE_INT_CST_ELT directly. + 2019-04-29 Richard Sandiford Backport from mainline: diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 29ba0b4d464..9c1a100b70b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2019-04-29 Richard Sandiford + + Backport from mainline: + 2019-01-25 Richard Sandiford + + PR middle-end/89037 + * gcc.dg/pr89037.c: New test. + 2019-04-26 Roman Zhuykov Backport from mainline diff --git a/gcc/testsuite/gcc.dg/pr89037.c b/gcc/testsuite/gcc.dg/pr89037.c new file mode 100644 index 00000000000..551136741d7 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr89037.c @@ -0,0 +1,24 @@ +/* { dg-do run { target int128 } } */ +/* { dg-options "" } */ + +struct s +{ + __int128 y : 66; +}; +typedef struct s T; +T a[] = { 1, 10000, 0x12345, 0xff000001, 1ULL << 63, (__int128) 1 << 64, + ((__int128) 1 << 64) | 1 }; + +int +main (void) +{ + if (a[0].y != 1 + || a[1].y != 10000 + || a[2].y != 0x12345 + || a[3].y != 0xff000001 + || a[4].y != (1ULL << 63) + || a[5].y != ((__int128) 1 << 64) + || a[6].y != (((__int128) 1 << 64) | 1)) + __builtin_abort (); + return 0; +} diff --git a/gcc/varasm.c b/gcc/varasm.c index 2a1eac0f99d..664b5dcd7a8 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -5292,7 +5292,7 @@ output_constructor_bitfield (oc_local_state *local, unsigned int bit_offset) { int this_time; int shift; - HOST_WIDE_INT value; + unsigned HOST_WIDE_INT value; HOST_WIDE_INT next_byte = next_offset / BITS_PER_UNIT; HOST_WIDE_INT next_bit = next_offset % BITS_PER_UNIT; @@ -5324,15 +5324,13 @@ output_constructor_bitfield (oc_local_state *local, unsigned int bit_offset) this_time = end - shift + 1; } - /* Now get the bits from the appropriate constant word. */ - value = TREE_INT_CST_ELT (local->val, shift / HOST_BITS_PER_WIDE_INT); - shift = shift & (HOST_BITS_PER_WIDE_INT - 1); + /* Now get the bits we want to insert. */ + value = wi::extract_uhwi (wi::to_widest (local->val), + shift, this_time); /* Get the result. This works only when: 1 <= this_time <= HOST_BITS_PER_WIDE_INT. */ - local->byte |= (((value >> shift) - & (((HOST_WIDE_INT) 2 << (this_time - 1)) - 1)) - << (BITS_PER_UNIT - this_time - next_bit)); + local->byte |= value << (BITS_PER_UNIT - this_time - next_bit); } else { @@ -5349,15 +5347,13 @@ output_constructor_bitfield (oc_local_state *local, unsigned int bit_offset) this_time = HOST_BITS_PER_WIDE_INT - (shift & (HOST_BITS_PER_WIDE_INT - 1)); - /* Now get the bits from the appropriate constant word. */ - value = TREE_INT_CST_ELT (local->val, shift / HOST_BITS_PER_WIDE_INT); - shift = shift & (HOST_BITS_PER_WIDE_INT - 1); + /* Now get the bits we want to insert. */ + value = wi::extract_uhwi (wi::to_widest (local->val), + shift, this_time); /* Get the result. This works only when: 1 <= this_time <= HOST_BITS_PER_WIDE_INT. */ - local->byte |= (((value >> shift) - & (((HOST_WIDE_INT) 2 << (this_time - 1)) - 1)) - << next_bit); + local->byte |= value << next_bit; } next_offset += this_time; -- cgit v1.2.3 From 78d101b8a812ca7bfd13ebf55e46bef1e87a1814 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Tue, 30 Apr 2019 00:16:07 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270670 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 5ffe417f629..3556de5f593 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190429 +20190430 -- cgit v1.2.3 From 9991f9bc58f766dc2443d0521a0ad2c6ac03b742 Mon Sep 17 00:00:00 2001 From: Richard Earnshaw Date: Tue, 30 Apr 2019 09:25:31 +0000 Subject: PR target/90075 Prefer bsl/bit/bif for copysignf. (backport GCC-8) This patch is to fix the ICE caused in expand pattern of copysignf builtin. This is a back port to r267019 of trunk. gcc: 2019-04-29 Srinath Parvathaneni Backport from mainline 2018-12-11 Richard Earnshaw PR target/37369 * config/aarch64/iterators.md (sizem1): Add sizes for SFmode and DFmode. (Vbtype): Add SFmode mapping. * config/aarch64/aarch64.md (copysigndf3, copysignsf3): Delete. (copysign3): New expand pattern. (copysign3_insn): New insn pattern. testsuite: 2019-04-29 Srinath Parvathaneni PR target/90075 * gcc.target/aarch64/pr90075.c: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270683 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 13 ++++++ gcc/config/aarch64/aarch64.md | 68 +++++++++++++++--------------- gcc/config/aarch64/iterators.md | 5 ++- gcc/testsuite/ChangeLog | 5 +++ gcc/testsuite/gcc.target/aarch64/pr90075.c | 21 +++++++++ 5 files changed, 76 insertions(+), 36 deletions(-) create mode 100644 gcc/testsuite/gcc.target/aarch64/pr90075.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 986b7a86904..e62dcd51791 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,16 @@ +2019-04-30 Srinath Parvathaneni + + Backport from mainline + 2018-12-11 Richard Earnshaw + + PR target/37369 + * config/aarch64/iterators.md (sizem1): Add sizes for + SFmode and DFmode. + (Vbtype): Add SFmode mapping. + * config/aarch64/aarch64.md (copysigndf3, copysignsf3): Delete. + (copysign3): New expand pattern. + (copysign3_insn): New insn pattern. + 2019-04-29 Richard Sandiford Backport from mainline: diff --git a/gcc/config/aarch64/aarch64.md b/gcc/config/aarch64/aarch64.md index 32a0e1f3685..11c0ef00dcf 100644 --- a/gcc/config/aarch64/aarch64.md +++ b/gcc/config/aarch64/aarch64.md @@ -189,6 +189,7 @@ UNSPEC_CLASTB UNSPEC_FADDA UNSPEC_REV_SUBREG + UNSPEC_COPYSIGN ]) (define_c_enum "unspecv" [ @@ -5427,49 +5428,48 @@ ;; LDR d2, #(1 << 63) ;; BSL v2.8b, [y], [x] ;; -;; or another, equivalent, sequence using one of BSL/BIT/BIF. -;; aarch64_simd_bsldf will select the best suited of these instructions -;; to generate based on register allocation, and knows how to partially -;; constant fold based on the values of X and Y, so expand through that. - -(define_expand "copysigndf3" - [(match_operand:DF 0 "register_operand") - (match_operand:DF 1 "register_operand") - (match_operand:DF 2 "register_operand")] +;; or another, equivalent, sequence using one of BSL/BIT/BIF. Because +;; we expect these operations to nearly always operate on +;; floating-point values, we do not want the operation to be +;; simplified into a bit-field insert operation that operates on the +;; integer side, since typically that would involve three inter-bank +;; register copies. As we do not expect copysign to be followed by +;; other logical operations on the result, it seems preferable to keep +;; this as an unspec operation, rather than exposing the underlying +;; logic to the compiler. + +(define_expand "copysign3" + [(match_operand:GPF 0 "register_operand") + (match_operand:GPF 1 "register_operand") + (match_operand:GPF 2 "register_operand")] "TARGET_FLOAT && TARGET_SIMD" { - rtx mask = gen_reg_rtx (DImode); - emit_move_insn (mask, GEN_INT (HOST_WIDE_INT_1U << 63)); - emit_insn (gen_aarch64_simd_bsldf (operands[0], mask, - operands[2], operands[1])); + rtx bitmask = gen_reg_rtx (mode); + emit_move_insn (bitmask, GEN_INT (HOST_WIDE_INT_M1U + << (GET_MODE_BITSIZE (mode) - 1))); + emit_insn (gen_copysign3_insn (operands[0], operands[1], operands[2], + bitmask)); DONE; } ) -;; As above, but we must first get to a 64-bit value if we wish to use -;; aarch64_simd_bslv2sf. - -(define_expand "copysignsf3" - [(match_operand:SF 0 "register_operand") - (match_operand:SF 1 "register_operand") - (match_operand:SF 2 "register_operand")] +(define_insn "copysign3_insn" + [(set (match_operand:GPF 0 "register_operand" "=w,w,w,r") + (unspec:GPF [(match_operand:GPF 1 "register_operand" "w,0,w,r") + (match_operand:GPF 2 "register_operand" "w,w,0,0") + (match_operand: 3 "register_operand" + "0,w,w,X")] + UNSPEC_COPYSIGN))] "TARGET_FLOAT && TARGET_SIMD" -{ - rtx v_bitmask = gen_reg_rtx (V2SImode); - - /* Juggle modes to get us in to a vector mode for BSL. */ - rtx op1 = lowpart_subreg (DImode, operands[1], SFmode); - rtx op2 = lowpart_subreg (V2SFmode, operands[2], SFmode); - rtx tmp = gen_reg_rtx (V2SFmode); - emit_move_insn (v_bitmask, - aarch64_simd_gen_const_vector_dup (V2SImode, - HOST_WIDE_INT_M1U << 31)); - emit_insn (gen_aarch64_simd_bslv2sf (tmp, v_bitmask, op2, op1)); - emit_move_insn (operands[0], lowpart_subreg (SFmode, tmp, V2SFmode)); - DONE; -} + "@ + bsl\\t%0., %2., %1. + bit\\t%0., %2., %3. + bif\\t%0., %1., %3. + bfxil\\t%0, %1, #0, " + [(set_attr "type" "neon_bsl,neon_bsl,neon_bsl,bfm")] ) + ;; For xorsign (x, y), we want to generate: ;; ;; LDR d2, #1<<63 diff --git a/gcc/config/aarch64/iterators.md b/gcc/config/aarch64/iterators.md index 25991d97836..21d66d36f82 100644 --- a/gcc/config/aarch64/iterators.md +++ b/gcc/config/aarch64/iterators.md @@ -578,7 +578,8 @@ (define_mode_attr sizen [(QI "8") (HI "16") (SI "32") (DI "64")]) ;; Give the ordinal of the MSB in the mode -(define_mode_attr sizem1 [(QI "#7") (HI "#15") (SI "#31") (DI "#63")]) +(define_mode_attr sizem1 [(QI "#7") (HI "#15") (SI "#31") (DI "#63") + (HF "#15") (SF "#31") (DF "#63")]) ;; Attribute to describe constants acceptable in logical operations (define_mode_attr lconst [(SI "K") (DI "L")]) @@ -664,7 +665,7 @@ (V8HF "16b") (V2SF "8b") (V4SF "16b") (V2DF "16b") (DI "8b") (DF "8b") - (SI "8b")]) + (SI "8b") (SF "8b")]) ;; Define element mode for each vector mode. (define_mode_attr VEL [(V8QI "QI") (V16QI "QI") (VNx16QI "QI") diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 9c1a100b70b..a04f01ceca6 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-04-30 Srinath Parvathaneni + + PR target/90075 + * gcc.target/aarch64/pr90075.c: New test. + 2019-04-29 Richard Sandiford Backport from mainline: diff --git a/gcc/testsuite/gcc.target/aarch64/pr90075.c b/gcc/testsuite/gcc.target/aarch64/pr90075.c new file mode 100644 index 00000000000..cae7e618fc0 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/pr90075.c @@ -0,0 +1,21 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-O1" } */ + +typedef struct { + float one, two; +} twofloats; + +float +bug (twofloats tf) +{ + float f1, f2; + union { + twofloats tfloats; + float arr[2]; + } utfloats; + + utfloats.tfloats = tf; + f1 = utfloats.arr[1]; + f2 = __builtin_copysignf (0, f1); + return f2; +} -- cgit v1.2.3 From fa61103bc4a756e01e9b7a064669ca29e0f6311c Mon Sep 17 00:00:00 2001 From: Ramana Radhakrishnan Date: Tue, 30 Apr 2019 14:57:50 +0000 Subject: [Patch AArch64] Add __ARM_FEATURE_ATOMICS This keeps coming up repeatedly and the ACLE has finally added __ARM_FEATURE_ATOMICS for the LSE feature in GCC. This is now part of the latest ACLE release (https://developer.arm.com/docs/101028/latest/5-feature-test-macros) I know it's late for GCC-9 but this is a simple macro which need not wait for another year. Ok for trunk and to backport to all release branches ? Tested with a simple build and a smoke test. Backport from mainline. PR target/86538 * config/aarch64/aarch64-c.c (aarch64_update_cpp_builtins): Define __ARM_FEATURE_ATOMICS git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270702 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 8 ++++++++ gcc/config/aarch64/aarch64-c.c | 1 + 2 files changed, 9 insertions(+) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e62dcd51791..facb5cbbc6b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2019-04-30 Ramana Radhakrishnan + + Backport from mainline. + 2019-04-30 Ramana Radhakrishnan + PR target/86538 + * config/aarch64/aarch64-c.c (aarch64_update_cpp_builtins): + Define __ARM_FEATURE_ATOMICS + 2019-04-30 Srinath Parvathaneni Backport from mainline diff --git a/gcc/config/aarch64/aarch64-c.c b/gcc/config/aarch64/aarch64-c.c index 40c738c7c3b..108c0120394 100644 --- a/gcc/config/aarch64/aarch64-c.c +++ b/gcc/config/aarch64/aarch64-c.c @@ -146,6 +146,7 @@ aarch64_update_cpp_builtins (cpp_reader *pfile) builtin_define_with_int_value ("__ARM_FEATURE_SVE_BITS", bits); } + aarch64_def_or_undef (TARGET_LSE, "__ARM_FEATURE_ATOMICS", pfile); aarch64_def_or_undef (TARGET_AES, "__ARM_FEATURE_AES", pfile); aarch64_def_or_undef (TARGET_SHA2, "__ARM_FEATURE_SHA2", pfile); aarch64_def_or_undef (TARGET_SHA3, "__ARM_FEATURE_SHA3", pfile); -- cgit v1.2.3 From 5e1e6213e577d7d1817ee17e517804d2974c6192 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 30 Apr 2019 20:28:56 +0000 Subject: Backported from mainline 2019-02-20 Jakub Jelinek PR middle-end/88074 PR middle-end/89415 * toplev.c (do_compile): Double the emin/emax exponents to workaround buggy mpc_norm. * gcc.dg/pr88074-2.c: New test. 2019-02-19 Richard Biener PR middle-end/88074 * toplev.c (do_compile): Initialize mpfr's exponent range based on available float modes. * gcc.dg/pr88074.c: New testcase. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270712 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 18 +++++++++++++++++- gcc/testsuite/ChangeLog | 14 ++++++++++++++ gcc/testsuite/gcc.dg/pr88074-2.c | 17 +++++++++++++++++ gcc/testsuite/gcc.dg/pr88074.c | 14 ++++++++++++++ gcc/toplev.c | 28 ++++++++++++++++++++++++++++ 5 files changed, 90 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.dg/pr88074-2.c create mode 100644 gcc/testsuite/gcc.dg/pr88074.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index facb5cbbc6b..756c3c2308b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,10 +1,26 @@ +2019-04-30 Jakub Jelinek + + Backported from mainline + 2019-02-20 Jakub Jelinek + + PR middle-end/88074 + PR middle-end/89415 + * toplev.c (do_compile): Double the emin/emax exponents to workaround + buggy mpc_norm. + + 2019-02-19 Richard Biener + + PR middle-end/88074 + * toplev.c (do_compile): Initialize mpfr's exponent range + based on available float modes. + 2019-04-30 Ramana Radhakrishnan Backport from mainline. 2019-04-30 Ramana Radhakrishnan PR target/86538 * config/aarch64/aarch64-c.c (aarch64_update_cpp_builtins): - Define __ARM_FEATURE_ATOMICS + Define __ARM_FEATURE_ATOMICS. 2019-04-30 Srinath Parvathaneni diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index a04f01ceca6..795b4fc4d33 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,17 @@ +2019-04-30 Jakub Jelinek + + Backported from mainline + 2019-02-20 Jakub Jelinek + + PR middle-end/88074 + PR middle-end/89415 + * gcc.dg/pr88074-2.c: New test. + + 2019-02-19 Richard Biener + + PR middle-end/88074 + * gcc.dg/pr88074.c: New testcase. + 2019-04-30 Srinath Parvathaneni PR target/90075 diff --git a/gcc/testsuite/gcc.dg/pr88074-2.c b/gcc/testsuite/gcc.dg/pr88074-2.c new file mode 100644 index 00000000000..a93c19dccce --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr88074-2.c @@ -0,0 +1,17 @@ +/* PR middle-end/88074 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-optimized" } */ +/* { dg-add-options float128 } */ +/* { dg-require-effective-target float128 } */ +/* { dg-final { scan-tree-dump-not "link_error " "optimized" } } */ + +extern void link_error (void); +int +main () +{ + if (((__FLT128_MAX__ * 0.5 + __FLT128_MAX__ * 0.5i) + / (__FLT128_MAX__ * 0.25 + __FLT128_MAX__ * 0.25i)) + != (_Complex _Float128) 2) + link_error (); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/pr88074.c b/gcc/testsuite/gcc.dg/pr88074.c new file mode 100644 index 00000000000..9f64cc11424 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr88074.c @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-options "-O" } */ + +#include + +int main() +{ + _Complex double x; + __real x = 3.091e+8; + __imag x = -4.045e+8; + /* This used to spend huge amounts of compile-time inside mpc. */ + volatile _Complex double y = ctan (x); + return 0; +} diff --git a/gcc/toplev.c b/gcc/toplev.c index b066bcc7229..bdf021e828a 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -2110,6 +2110,34 @@ do_compile () else int_n_enabled_p[i] = false; + /* Initialize mpfrs exponent range. This is important to get + underflow/overflow in a reasonable timeframe. */ + machine_mode mode; + int min_exp = -1; + int max_exp = 1; + FOR_EACH_MODE_IN_CLASS (mode, MODE_FLOAT) + if (SCALAR_FLOAT_MODE_P (mode)) + { + const real_format *fmt = REAL_MODE_FORMAT (mode); + if (fmt) + { + /* fmt->emin - fmt->p + 1 should be enough but the + back-and-forth dance in real_to_decimal_for_mode we + do for checking fails due to rounding effects then. */ + if ((fmt->emin - fmt->p) < min_exp) + min_exp = fmt->emin - fmt->p; + if (fmt->emax > max_exp) + max_exp = fmt->emax; + } + } + /* E.g. mpc_norm assumes it can square a number without bothering with + with range scaling, so until that is fixed, double the minimum + and maximum exponents, plus add some buffer for arithmetics + on the squared numbers. */ + if (mpfr_set_emin (2 * (min_exp - 1)) + || mpfr_set_emax (2 * (max_exp + 1))) + sorry ("mpfr not configured to handle all float modes"); + /* Set up the back-end if requested. */ if (!no_backend) backend_init (); -- cgit v1.2.3 From e8599cf3150f91bdb75fbd9aef1587a1e271ad4c Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 30 Apr 2019 20:29:44 +0000 Subject: Backported from mainline 2019-02-20 Jakub Jelinek David Malcolm PR middle-end/89091 * fold-const.c (decode_field_reference): Return NULL_TREE if lang_hooks.types.type_for_size returns NULL. Check it before overwriting *exp_. Use return NULL_TREE instead of return 0. * gcc.dg/torture/pr89091.c: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270713 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 8 ++++++++ gcc/fold-const.c | 11 +++++++---- gcc/testsuite/ChangeLog | 6 ++++++ gcc/testsuite/gcc.dg/torture/pr89091.c | 10 ++++++++++ 4 files changed, 31 insertions(+), 4 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/torture/pr89091.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 756c3c2308b..b2cf83ed322 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,6 +1,14 @@ 2019-04-30 Jakub Jelinek Backported from mainline + 2019-02-20 Jakub Jelinek + David Malcolm + + PR middle-end/89091 + * fold-const.c (decode_field_reference): Return NULL_TREE if + lang_hooks.types.type_for_size returns NULL. Check it before + overwriting *exp_. Use return NULL_TREE instead of return 0. + 2019-02-20 Jakub Jelinek PR middle-end/88074 diff --git a/gcc/fold-const.c b/gcc/fold-const.c index af67feb5fbc..984b91a90d7 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -4239,7 +4239,7 @@ decode_field_reference (location_t loc, tree *exp_, HOST_WIDE_INT *pbitsize, There are problems with FP fields since the type_for_size call below can fail for, e.g., XFmode. */ if (! INTEGRAL_TYPE_P (TREE_TYPE (exp))) - return 0; + return NULL_TREE; /* We are interested in the bare arrangement of bits, so strip everything that doesn't affect the machine mode. However, record the type of the @@ -4255,7 +4255,7 @@ decode_field_reference (location_t loc, tree *exp_, HOST_WIDE_INT *pbitsize, exp = TREE_OPERAND (exp, 0); STRIP_NOPS (exp); STRIP_NOPS (and_mask); if (TREE_CODE (and_mask) != INTEGER_CST) - return 0; + return NULL_TREE; } poly_int64 poly_bitsize, poly_bitpos; @@ -4271,7 +4271,11 @@ decode_field_reference (location_t loc, tree *exp_, HOST_WIDE_INT *pbitsize, || (! AGGREGATE_TYPE_P (TREE_TYPE (inner)) && compare_tree_int (TYPE_SIZE (TREE_TYPE (inner)), *pbitpos + *pbitsize) < 0)) - return 0; + return NULL_TREE; + + unsigned_type = lang_hooks.types.type_for_size (*pbitsize, 1); + if (unsigned_type == NULL_TREE) + return NULL_TREE; *exp_ = exp; @@ -4282,7 +4286,6 @@ decode_field_reference (location_t loc, tree *exp_, HOST_WIDE_INT *pbitsize, *punsignedp = TYPE_UNSIGNED (outer_type); /* Compute the mask to access the bitfield. */ - unsigned_type = lang_hooks.types.type_for_size (*pbitsize, 1); precision = TYPE_PRECISION (unsigned_type); mask = build_int_cst_type (unsigned_type, -1); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 795b4fc4d33..6012138b60d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,6 +1,12 @@ 2019-04-30 Jakub Jelinek Backported from mainline + 2019-02-20 Jakub Jelinek + David Malcolm + + PR middle-end/89091 + * gcc.dg/torture/pr89091.c: New test. + 2019-02-20 Jakub Jelinek PR middle-end/88074 diff --git a/gcc/testsuite/gcc.dg/torture/pr89091.c b/gcc/testsuite/gcc.dg/torture/pr89091.c new file mode 100644 index 00000000000..98967245e89 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr89091.c @@ -0,0 +1,10 @@ +/* PR middle-end/89091 */ +/* { dg-do compile { target int128 } } */ + +struct S { unsigned __int128 s : 65; }; + +int +foo (struct S *x, int y) +{ + return y && x->s; +} -- cgit v1.2.3 From eb2cdccdc8622aa6b98bdb804a1060fdfa3e5ffe Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 30 Apr 2019 20:30:27 +0000 Subject: Backported from mainline 2019-02-20 Jakub Jelinek PR middle-end/89412 * expr.c (expand_assignment): If result is a MEM, use change_address instead of simplify_gen_subreg. * gcc.c-torture/compile/pr89412.c: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270714 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 6 ++++++ gcc/expr.c | 10 +++++++--- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.c-torture/compile/pr89412.c | 16 ++++++++++++++++ 4 files changed, 34 insertions(+), 3 deletions(-) create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr89412.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b2cf83ed322..159ddbdd7b0 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,6 +1,12 @@ 2019-04-30 Jakub Jelinek Backported from mainline + 2019-02-20 Jakub Jelinek + + PR middle-end/89412 + * expr.c (expand_assignment): If result is a MEM, use change_address + instead of simplify_gen_subreg. + 2019-02-20 Jakub Jelinek David Malcolm diff --git a/gcc/expr.c b/gcc/expr.c index bac0c787e4f..201fe4a55d3 100644 --- a/gcc/expr.c +++ b/gcc/expr.c @@ -5187,9 +5187,13 @@ expand_assignment (tree to, tree from, bool nontemporal) } else { - rtx from_rtx - = simplify_gen_subreg (to_mode, result, - TYPE_MODE (TREE_TYPE (from)), 0); + rtx from_rtx; + if (MEM_P (result)) + from_rtx = change_address (result, to_mode, NULL_RTX); + else + from_rtx + = simplify_gen_subreg (to_mode, result, + TYPE_MODE (TREE_TYPE (from)), 0); if (from_rtx) { emit_move_insn (XEXP (to_rtx, 0), diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 6012138b60d..fb8828893b9 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,6 +1,11 @@ 2019-04-30 Jakub Jelinek Backported from mainline + 2019-02-20 Jakub Jelinek + + PR middle-end/89412 + * gcc.c-torture/compile/pr89412.c: New test. + 2019-02-20 Jakub Jelinek David Malcolm diff --git a/gcc/testsuite/gcc.c-torture/compile/pr89412.c b/gcc/testsuite/gcc.c-torture/compile/pr89412.c new file mode 100644 index 00000000000..0d6ddd5db94 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr89412.c @@ -0,0 +1,16 @@ +/* PR middle-end/89412 */ + +struct S { double a, b; } d; +int e; +double f; + +void +foo () +{ + _Complex double h; + while (e) + { + f = h; + *(struct S *) &h = d; + } +} -- cgit v1.2.3 From be119f6623527bd4c0a65eeb94bf228168191d76 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 30 Apr 2019 20:31:26 +0000 Subject: Backported from mainline 2019-02-20 Jakub Jelinek PR c++/89405 * decl.c (maybe_commonize_var): When clearing TREE_PUBLIC and DECL_COMMON, set DECL_INTERFACE_KNOWN. * g++.dg/cpp1z/inline-var5.C: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270715 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cp/ChangeLog | 9 +++++++++ gcc/cp/decl.c | 1 + gcc/testsuite/ChangeLog | 3 +++ gcc/testsuite/g++.dg/cpp1z/inline-var5.C | 11 +++++++++++ 4 files changed, 24 insertions(+) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index ad157c3f961..efcbc9c0188 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,12 @@ +2019-04-30 Jakub Jelinek + + Backported from mainline + 2019-02-20 Jakub Jelinek + + PR c++/89405 + * decl.c (maybe_commonize_var): When clearing TREE_PUBLIC and + DECL_COMMON, set DECL_INTERFACE_KNOWN. + 2019-03-08 Jason Merrill PR c++/88820 - ICE with CTAD and member template used in DMI. diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index f6af3f9f573..0bd03c2d5cb 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -5616,6 +5616,7 @@ maybe_commonize_var (tree decl) be merged. */ TREE_PUBLIC (decl) = 0; DECL_COMMON (decl) = 0; + DECL_INTERFACE_KNOWN (decl) = 1; const char *msg; if (DECL_INLINE_VAR_P (decl)) msg = G_("sorry: semantics of inline variable " diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index fb8828893b9..e30b53e6357 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -3,6 +3,9 @@ Backported from mainline 2019-02-20 Jakub Jelinek + PR c++/89405 + * g++.dg/cpp1z/inline-var5.C: New test. + PR middle-end/89412 * gcc.c-torture/compile/pr89412.c: New test. diff --git a/gcc/testsuite/g++.dg/cpp1z/inline-var5.C b/gcc/testsuite/g++.dg/cpp1z/inline-var5.C index 27730106f27..6d1edd288ae 100644 --- a/gcc/testsuite/g++.dg/cpp1z/inline-var5.C +++ b/gcc/testsuite/g++.dg/cpp1z/inline-var5.C @@ -1,3 +1,14 @@ +// PR c++/89405 +// { dg-do compile { target c++17 } } +// { dg-options "-fno-weak" } + +template +struct S +{ + static constexpr int a = N; // { dg-warning "semantics of inline variable" } +}; // { dg-message "you can work around this" "" { target *-*-* } .-1 } + +const int *x = &S<0>::a; // PR c++/87921 // { dg-do compile { target c++17 } } -- cgit v1.2.3 From 85ae4831de49ef53cb3ed806848b45cfcd86d21e Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 30 Apr 2019 20:32:14 +0000 Subject: Backported from mainline 2019-02-20 Jakub Jelinek PR c++/89403 * decl2.c (c_parse_final_cleanups): Move TREE_ASM_WRITTEN setting for flag_syntax_only from here... * semantics.c (expand_or_defer_fn_1): ... here. * g++.dg/cpp0x/pr89403.C: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270716 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cp/ChangeLog | 5 +++++ gcc/cp/decl2.c | 5 ----- gcc/cp/semantics.c | 7 ++++++- gcc/testsuite/ChangeLog | 3 +++ gcc/testsuite/g++.dg/cpp0x/pr89403.C | 18 ++++++++++++++++++ 5 files changed, 32 insertions(+), 6 deletions(-) create mode 100644 gcc/testsuite/g++.dg/cpp0x/pr89403.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index efcbc9c0188..2786a81229f 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -3,6 +3,11 @@ Backported from mainline 2019-02-20 Jakub Jelinek + PR c++/89403 + * decl2.c (c_parse_final_cleanups): Move TREE_ASM_WRITTEN setting + for flag_syntax_only from here... + * semantics.c (expand_or_defer_fn_1): ... here. + PR c++/89405 * decl.c (maybe_commonize_var): When clearing TREE_PUBLIC and DECL_COMMON, set DECL_INTERFACE_KNOWN. diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index 1043af49b91..2bff2f0b27b 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -4888,11 +4888,6 @@ c_parse_final_cleanups (void) /* Generate RTL for this function now that we know we need it. */ expand_or_defer_fn (decl); - /* If we're compiling -fsyntax-only pretend that this - function has been written out so that we don't try to - expand it again. */ - if (flag_syntax_only) - TREE_ASM_WRITTEN (decl) = 1; reconsider = true; } } diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 0d7d75a1a60..99a042f8375 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -4268,7 +4268,12 @@ expand_or_defer_fn_1 (tree fn) /* There's no reason to do any of the work here if we're only doing semantic analysis; this code just generates RTL. */ if (flag_syntax_only) - return false; + { + /* Pretend that this function has been written out so that we don't try + to expand it again. */ + TREE_ASM_WRITTEN (fn) = 1; + return false; + } return true; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e30b53e6357..1710151ae92 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -3,6 +3,9 @@ Backported from mainline 2019-02-20 Jakub Jelinek + PR c++/89403 + * g++.dg/cpp0x/pr89403.C: New test. + PR c++/89405 * g++.dg/cpp1z/inline-var5.C: New test. diff --git a/gcc/testsuite/g++.dg/cpp0x/pr89403.C b/gcc/testsuite/g++.dg/cpp0x/pr89403.C new file mode 100644 index 00000000000..9dc7dff8bcc --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/pr89403.C @@ -0,0 +1,18 @@ +// PR c++/89403 +// { dg-do compile { target c++11 } } +// { dg-options "-Os -fsyntax-only" } + +template +struct A : T { + constexpr A() : T() { } +}; + +template +struct B { + A b; + constexpr B() { } +}; + +struct C { struct {} s; }; +constexpr B b{}; +constexpr C c = b.b; -- cgit v1.2.3 From 5205c09516fdd2bf5e0d87cf9450e74fc34f1dcd Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 30 Apr 2019 20:33:24 +0000 Subject: Backported from mainline 2019-02-28 Jakub Jelinek PR c/89520 * convert.c (convert_to_real_1, convert_to_integer_1): Punt for builtins if they don't have a single scalar floating point argument. Formatting fixes. * gcc.dg/pr89520-1.c: New test. * gcc.dg/pr89520-2.c: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270717 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 7 +++++++ gcc/convert.c | 29 +++++++++++++++++++-------- gcc/testsuite/ChangeLog | 6 ++++++ gcc/testsuite/gcc.dg/pr89520-1.c | 13 +++++++++++++ gcc/testsuite/gcc.dg/pr89520-2.c | 42 ++++++++++++++++++++++++++++++++++++++++ 5 files changed, 89 insertions(+), 8 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/pr89520-1.c create mode 100644 gcc/testsuite/gcc.dg/pr89520-2.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 159ddbdd7b0..92b636d9fd1 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,6 +1,13 @@ 2019-04-30 Jakub Jelinek Backported from mainline + 2019-02-28 Jakub Jelinek + + PR c/89520 + * convert.c (convert_to_real_1, convert_to_integer_1): Punt for + builtins if they don't have a single scalar floating point argument. + Formatting fixes. + 2019-02-20 Jakub Jelinek PR middle-end/89412 diff --git a/gcc/convert.c b/gcc/convert.c index 68705f3e9b0..83bcec26486 100644 --- a/gcc/convert.c +++ b/gcc/convert.c @@ -193,12 +193,15 @@ convert_to_real_1 (tree type, tree expr, bool fold_p) CASE_MATHFN (FABS) CASE_MATHFN (LOGB) #undef CASE_MATHFN + if (call_expr_nargs (expr) != 1 + || !SCALAR_FLOAT_TYPE_P (TREE_TYPE (CALL_EXPR_ARG (expr, 0)))) + break; { tree arg0 = strip_float_extensions (CALL_EXPR_ARG (expr, 0)); tree newtype = type; - /* We have (outertype)sqrt((innertype)x). Choose the wider mode from - the both as the safe type for operation. */ + /* We have (outertype)sqrt((innertype)x). Choose the wider mode + from the both as the safe type for operation. */ if (TYPE_PRECISION (TREE_TYPE (arg0)) > TYPE_PRECISION (type)) newtype = TREE_TYPE (arg0); @@ -592,7 +595,8 @@ convert_to_integer_1 (tree type, tree expr, bool dofold) CASE_FLT_FN (BUILT_IN_ROUND): CASE_FLT_FN_FLOATN_NX (BUILT_IN_ROUND): /* Only convert in ISO C99 mode and with -fno-math-errno. */ - if (!targetm.libc_has_function (function_c99_misc) || flag_errno_math) + if (!targetm.libc_has_function (function_c99_misc) + || flag_errno_math) break; if (outprec < TYPE_PRECISION (integer_type_node) || (outprec == TYPE_PRECISION (integer_type_node) @@ -615,7 +619,8 @@ convert_to_integer_1 (tree type, tree expr, bool dofold) CASE_FLT_FN (BUILT_IN_RINT): CASE_FLT_FN_FLOATN_NX (BUILT_IN_RINT): /* Only convert in ISO C99 mode and with -fno-math-errno. */ - if (!targetm.libc_has_function (function_c99_misc) || flag_errno_math) + if (!targetm.libc_has_function (function_c99_misc) + || flag_errno_math) break; if (outprec < TYPE_PRECISION (integer_type_node) || (outprec == TYPE_PRECISION (integer_type_node) @@ -631,14 +636,20 @@ convert_to_integer_1 (tree type, tree expr, bool dofold) CASE_FLT_FN (BUILT_IN_TRUNC): CASE_FLT_FN_FLOATN_NX (BUILT_IN_TRUNC): - return convert_to_integer_1 (type, CALL_EXPR_ARG (s_expr, 0), dofold); + if (call_expr_nargs (s_expr) != 1 + || !SCALAR_FLOAT_TYPE_P (TREE_TYPE (CALL_EXPR_ARG (s_expr, 0)))) + break; + return convert_to_integer_1 (type, CALL_EXPR_ARG (s_expr, 0), + dofold); default: break; } - if (fn) - { + if (fn + && call_expr_nargs (s_expr) == 1 + && SCALAR_FLOAT_TYPE_P (TREE_TYPE (CALL_EXPR_ARG (s_expr, 0)))) + { tree newexpr = build_call_expr (fn, 1, CALL_EXPR_ARG (s_expr, 0)); return convert_to_integer_1 (type, newexpr, dofold); } @@ -668,7 +679,9 @@ convert_to_integer_1 (tree type, tree expr, bool dofold) break; } - if (fn) + if (fn + && call_expr_nargs (s_expr) == 1 + && SCALAR_FLOAT_TYPE_P (TREE_TYPE (CALL_EXPR_ARG (s_expr, 0)))) { tree newexpr = build_call_expr (fn, 1, CALL_EXPR_ARG (s_expr, 0)); return convert_to_integer_1 (type, newexpr, dofold); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 1710151ae92..b3a5277f534 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,6 +1,12 @@ 2019-04-30 Jakub Jelinek Backported from mainline + 2019-02-28 Jakub Jelinek + + PR c/89520 + * gcc.dg/pr89520-1.c: New test. + * gcc.dg/pr89520-2.c: New test. + 2019-02-20 Jakub Jelinek PR c++/89403 diff --git a/gcc/testsuite/gcc.dg/pr89520-1.c b/gcc/testsuite/gcc.dg/pr89520-1.c new file mode 100644 index 00000000000..128e8359d40 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr89520-1.c @@ -0,0 +1,13 @@ +/* PR c/89520 */ +/* { dg-do compile } */ +/* { dg-options "-Ofast -w" } */ + +#define A(name) __typeof (__builtin_##name (0)) name (); long name##1 () { return name (); } +#define B(name) A(name) A(name##f) A(name##l) +B (ceil) +B (floor) +B (round) +B (trunc) +B (nearbyint) +B (rint) +B (logb) diff --git a/gcc/testsuite/gcc.dg/pr89520-2.c b/gcc/testsuite/gcc.dg/pr89520-2.c new file mode 100644 index 00000000000..8edafa7f4e1 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr89520-2.c @@ -0,0 +1,42 @@ +/* PR c/89520 */ +/* { dg-do compile } */ +/* { dg-options "-Ofast -w" } */ + +#define A(name) __typeof (__builtin_##name (0)) name (); \ + float name##1 () { return name (); } \ + double name##2 () { return name (); } +#define B(name) A(name) A(name##l) +B (cosh) +B (exp) +B (exp10) +B (exp2) +B (expm1) +B (gamma) +B (j0) +B (j1) +B (lgamma) +B (pow10) +B (sinh) +B (tgamma) +B (y0) +B (y1) +B (acos) +B (acosh) +B (asin) +B (asinh) +B (atan) +B (atanh) +B (cbrt) +B (cos) +B (erf) +B (erfc) +B (log) +B (log10) +B (log2) +B (log1p) +B (sin) +B (tan) +B (tanh) +B (sqrt) +B (fabs) +B (logb) -- cgit v1.2.3 From 3795bd1975bb420f1e8e3fe21edfe6568e00487e Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 30 Apr 2019 20:34:49 +0000 Subject: Backported from mainline 2019-02-28 Jakub Jelinek PR c/89521 * gcc.dg/pr89521-1.c: New test. * gcc.dg/pr89521-2.c: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270718 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/gcc.dg/pr89521-1.c | 13 +++++++++++++ gcc/testsuite/gcc.dg/pr89521-2.c | 42 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 59 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/pr89521-1.c create mode 100644 gcc/testsuite/gcc.dg/pr89521-2.c diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b3a5277f534..5a7bea46e28 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -3,6 +3,10 @@ Backported from mainline 2019-02-28 Jakub Jelinek + PR c/89521 + * gcc.dg/pr89521-1.c: New test. + * gcc.dg/pr89521-2.c: New test. + PR c/89520 * gcc.dg/pr89520-1.c: New test. * gcc.dg/pr89520-2.c: New test. diff --git a/gcc/testsuite/gcc.dg/pr89521-1.c b/gcc/testsuite/gcc.dg/pr89521-1.c new file mode 100644 index 00000000000..ebf2c5932c3 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr89521-1.c @@ -0,0 +1,13 @@ +/* PR c/89521 */ +/* { dg-do compile } */ +/* { dg-options "-Ofast -w" } */ + +#define A(name) __typeof (__builtin_##name (0)) name (); long name##1 () { return name (1); } +#define B(name) A(name) A(name##f) A(name##l) +B (ceil) +B (floor) +B (round) +B (trunc) +B (nearbyint) +B (rint) +B (logb) diff --git a/gcc/testsuite/gcc.dg/pr89521-2.c b/gcc/testsuite/gcc.dg/pr89521-2.c new file mode 100644 index 00000000000..5e37c918fc2 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr89521-2.c @@ -0,0 +1,42 @@ +/* PR c/89521 */ +/* { dg-do compile } */ +/* { dg-options "-Ofast -w" } */ + +#define A(name) __typeof (__builtin_##name (0)) name (); \ + float name##1 () { return name (1); } \ + double name##2 () { return name (1); } +#define B(name) A(name) A(name##l) +B (cosh) +B (exp) +B (exp10) +B (exp2) +B (expm1) +B (gamma) +B (j0) +B (j1) +B (lgamma) +B (pow10) +B (sinh) +B (tgamma) +B (y0) +B (y1) +B (acos) +B (acosh) +B (asin) +B (asinh) +B (atan) +B (atanh) +B (cbrt) +B (cos) +B (erf) +B (erfc) +B (log) +B (log10) +B (log2) +B (log1p) +B (sin) +B (tan) +B (tanh) +B (sqrt) +B (fabs) +B (logb) -- cgit v1.2.3 From 80943d57b7f3ae203848c2a27d45d2bad80043b1 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 30 Apr 2019 20:36:17 +0000 Subject: Backported from mainline 2019-03-05 Jakub Jelinek PR middle-end/89590 * builtins.c (maybe_emit_free_warning): Punt if free doesn't have exactly one argument. * gcc.dg/pr89590.c: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270719 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 6 ++++++ gcc/builtins.c | 3 +++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/pr89590.c | 11 +++++++++++ 4 files changed, 25 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/pr89590.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 92b636d9fd1..1b928c65ec1 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,6 +1,12 @@ 2019-04-30 Jakub Jelinek Backported from mainline + 2019-03-05 Jakub Jelinek + + PR middle-end/89590 + * builtins.c (maybe_emit_free_warning): Punt if free doesn't have + exactly one argument. + 2019-02-28 Jakub Jelinek PR c/89520 diff --git a/gcc/builtins.c b/gcc/builtins.c index a71555e8198..8241c975901 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -10088,6 +10088,9 @@ maybe_emit_sprintf_chk_warning (tree exp, enum built_in_function fcode) static void maybe_emit_free_warning (tree exp) { + if (call_expr_nargs (exp) != 1) + return; + tree arg = CALL_EXPR_ARG (exp, 0); STRIP_NOPS (arg); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 5a7bea46e28..2400f05c692 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,6 +1,11 @@ 2019-04-30 Jakub Jelinek Backported from mainline + 2019-03-05 Jakub Jelinek + + PR middle-end/89590 + * gcc.dg/pr89590.c: New test. + 2019-02-28 Jakub Jelinek PR c/89521 diff --git a/gcc/testsuite/gcc.dg/pr89590.c b/gcc/testsuite/gcc.dg/pr89590.c new file mode 100644 index 00000000000..441b0f9c47e --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr89590.c @@ -0,0 +1,11 @@ +/* PR middle-end/89590 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -Wall -w" } */ + +void free (void *); + +void +foo (void) +{ + ((void (*)()) free) (); +} -- cgit v1.2.3 From 403740420bc2f442a6cc76ea66397c3e735d2508 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 30 Apr 2019 20:37:12 +0000 Subject: Backported from mainline 2019-03-05 Jakub Jelinek PR target/89587 * config/rs6000/t-linux (MULTIARCH_DIRNAME): Set to non-empty only if_multiarch. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270720 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 4 ++++ gcc/config/rs6000/t-linux | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 1b928c65ec1..c23ec6646c6 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -3,6 +3,10 @@ Backported from mainline 2019-03-05 Jakub Jelinek + PR target/89587 + * config/rs6000/t-linux (MULTIARCH_DIRNAME): Set to non-empty only + if_multiarch. + PR middle-end/89590 * builtins.c (maybe_emit_free_warning): Punt if free doesn't have exactly one argument. diff --git a/gcc/config/rs6000/t-linux b/gcc/config/rs6000/t-linux index acfde1f48ae..aeb7440c492 100644 --- a/gcc/config/rs6000/t-linux +++ b/gcc/config/rs6000/t-linux @@ -4,7 +4,7 @@ ifeq (,$(filter $(with_cpu),$(SOFT_FLOAT_CPUS))$(findstring soft,$(with_float))) ifneq (,$(findstring powerpc64,$(target))) MULTILIB_OSDIRNAMES := .=../lib64$(call if_multiarch,:powerpc64-linux-gnu) else -MULTIARCH_DIRNAME := powerpc-linux-gnu +MULTIARCH_DIRNAME := $(call if_multiarch,powerpc-linux-gnu) endif ifneq (,$(findstring powerpcle,$(target))) MULTIARCH_DIRNAME := $(subst -linux,le-linux,$(MULTIARCH_DIRNAME)) -- cgit v1.2.3 From 11457da484deddbdb9ca2922c9c44021e261ed0b Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 30 Apr 2019 20:38:01 +0000 Subject: Backported from mainline 2019-03-06 Jakub Jelinek PR c++/87148 * init.c (build_value_init_noctor): Ignore flexible array members. * g++.dg/ext/flexary34.C: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270721 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cp/ChangeLog | 5 +++++ gcc/cp/init.c | 9 +++++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/ext/flexary34.C | 10 ++++++++++ 4 files changed, 29 insertions(+) create mode 100644 gcc/testsuite/g++.dg/ext/flexary34.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 2786a81229f..a7c77ddea49 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,6 +1,11 @@ 2019-04-30 Jakub Jelinek Backported from mainline + 2019-03-06 Jakub Jelinek + + PR c++/87148 + * init.c (build_value_init_noctor): Ignore flexible array members. + 2019-02-20 Jakub Jelinek PR c++/89403 diff --git a/gcc/cp/init.c b/gcc/cp/init.c index 302c603876a..3d44b03abfe 100644 --- a/gcc/cp/init.c +++ b/gcc/cp/init.c @@ -419,6 +419,15 @@ build_value_init_noctor (tree type, tsubst_flags_t complain) if (ftype == error_mark_node) continue; + /* Ignore flexible array members for value initialization. */ + if (TREE_CODE (ftype) == ARRAY_TYPE + && !COMPLETE_TYPE_P (ftype) + && !TYPE_DOMAIN (ftype) + && COMPLETE_TYPE_P (TREE_TYPE (ftype)) + && (next_initializable_field (DECL_CHAIN (field)) + == NULL_TREE)) + continue; + /* We could skip vfields and fields of types with user-defined constructors, but I think that won't improve performance at all; it should be simpler in general just diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 2400f05c692..ea87928cf3d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,6 +1,11 @@ 2019-04-30 Jakub Jelinek Backported from mainline + 2019-03-06 Jakub Jelinek + + PR c++/87148 + * g++.dg/ext/flexary34.C: New test. + 2019-03-05 Jakub Jelinek PR middle-end/89590 diff --git a/gcc/testsuite/g++.dg/ext/flexary34.C b/gcc/testsuite/g++.dg/ext/flexary34.C new file mode 100644 index 00000000000..bbbbf852692 --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/flexary34.C @@ -0,0 +1,10 @@ +// PR c++/87148 +// { dg-do compile } +// { dg-options "-pedantic" } + +struct Tst { int i; char t[]; }; // { dg-warning "forbids flexible array member" } + +Tst t {}; // { dg-warning "extended initializer lists only available with" "" { target c++98_only } } +Tst u = Tst(); +void foo () { Tst u = {}; } +Tst *bar () { return new Tst (); } -- cgit v1.2.3 From 13dca0bfc345a4181b0e35ca1430a6671cf3a491 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 30 Apr 2019 20:38:32 +0000 Subject: Backported from mainline 2019-03-08 Jakub Jelinek PR c++/82075 * g++.dg/cpp1z/decomp49.C: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270722 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/cpp1z/decomp49.C | 14 ++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp1z/decomp49.C diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ea87928cf3d..0ce6e5c51d0 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,6 +1,11 @@ 2019-04-30 Jakub Jelinek Backported from mainline + 2019-03-08 Jakub Jelinek + + PR c++/82075 + * g++.dg/cpp1z/decomp49.C: New test. + 2019-03-06 Jakub Jelinek PR c++/87148 diff --git a/gcc/testsuite/g++.dg/cpp1z/decomp49.C b/gcc/testsuite/g++.dg/cpp1z/decomp49.C new file mode 100644 index 00000000000..525eb45af51 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1z/decomp49.C @@ -0,0 +1,14 @@ +// PR c++/82075 +// { dg-do run { target c++11 } } +// { dg-options "" } + +struct B { }; +struct D : B { int i; }; + +int +main () +{ + auto [i] = D{}; // { dg-warning "only available with" "" { target c++14_down } } + if (i != 0) + __builtin_abort (); +} -- cgit v1.2.3 From 0a61c01d4d9eb882d108a35d796cafc2413999b9 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 30 Apr 2019 20:39:17 +0000 Subject: Backported from mainline 2019-03-09 Jakub Jelinek PR c/88568 * attribs.c (handle_dll_attribute): Don't clear TREE_STATIC for dllimport on VAR_DECLs with RECORD_TYPE or UNION_TYPE DECL_CONTEXT. * g++.dg/other/pr88568.C: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270723 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 6 ++++++ gcc/attribs.c | 7 +++++-- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/other/pr88568.C | 13 +++++++++++++ 4 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/g++.dg/other/pr88568.C diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c23ec6646c6..aa514312603 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,6 +1,12 @@ 2019-04-30 Jakub Jelinek Backported from mainline + 2019-03-09 Jakub Jelinek + + PR c/88568 + * attribs.c (handle_dll_attribute): Don't clear TREE_STATIC for + dllimport on VAR_DECLs with RECORD_TYPE or UNION_TYPE DECL_CONTEXT. + 2019-03-05 Jakub Jelinek PR target/89587 diff --git a/gcc/attribs.c b/gcc/attribs.c index f5f660a6a9a..fc21f799d92 100644 --- a/gcc/attribs.c +++ b/gcc/attribs.c @@ -1685,8 +1685,11 @@ handle_dll_attribute (tree * pnode, tree name, tree args, int flags, a function global scope, unless declared static. */ if (current_function_decl != NULL_TREE && !TREE_STATIC (node)) TREE_PUBLIC (node) = 1; - /* Clear TREE_STATIC because DECL_EXTERNAL is set. */ - TREE_STATIC (node) = 0; + /* Clear TREE_STATIC because DECL_EXTERNAL is set, unless + it is a C++ static data member. */ + if (DECL_CONTEXT (node) == NULL_TREE + || !RECORD_OR_UNION_TYPE_P (DECL_CONTEXT (node))) + TREE_STATIC (node) = 0; } if (*no_add_attrs == false) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 0ce6e5c51d0..5f42394daee 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,6 +1,11 @@ 2019-04-30 Jakub Jelinek Backported from mainline + 2019-03-09 Jakub Jelinek + + PR c/88568 + * g++.dg/other/pr88568.C: New test. + 2019-03-08 Jakub Jelinek PR c++/82075 diff --git a/gcc/testsuite/g++.dg/other/pr88568.C b/gcc/testsuite/g++.dg/other/pr88568.C new file mode 100644 index 00000000000..9d344fd9147 --- /dev/null +++ b/gcc/testsuite/g++.dg/other/pr88568.C @@ -0,0 +1,13 @@ +// PR c/88568 +// { dg-do compile } +// { dg-require-dll "" } + +struct S { + __attribute__((dllimport)) static const char foo[]; +}; + +int +foo (int x) +{ + return S::foo[x]; +} -- cgit v1.2.3 From 3bce5bd9920a9099439a5245ab940bc4dffc35b2 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 30 Apr 2019 20:40:17 +0000 Subject: Backported from mainline 2019-03-11 Jakub Jelinek PR fortran/89651 * trans-openmp.c (gfc_omp_clause_default_ctor): Set TREE_NO_WARNING on decl if adding COND_EXPR for allocatable. (gfc_omp_clause_copy_ctor): Set TREE_NO_WARNING on dest. * gfortran.dg/gomp/pr89651.f90: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270724 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fortran/ChangeLog | 10 ++++++++++ gcc/fortran/trans-openmp.c | 6 ++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gfortran.dg/gomp/pr89651.f90 | 21 +++++++++++++++++++++ 4 files changed, 42 insertions(+) create mode 100644 gcc/testsuite/gfortran.dg/gomp/pr89651.f90 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 41b79383ee6..62df8f809d0 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,13 @@ +2019-04-30 Jakub Jelinek + + Backported from mainline + 2019-03-11 Jakub Jelinek + + PR fortran/89651 + * trans-openmp.c (gfc_omp_clause_default_ctor): Set TREE_NO_WARNING + on decl if adding COND_EXPR for allocatable. + (gfc_omp_clause_copy_ctor): Set TREE_NO_WARNING on dest. + 2019-04-24 Paul Thomas Backport from mainline diff --git a/gcc/fortran/trans-openmp.c b/gcc/fortran/trans-openmp.c index db21602b314..1eaad896503 100644 --- a/gcc/fortran/trans-openmp.c +++ b/gcc/fortran/trans-openmp.c @@ -548,6 +548,9 @@ gfc_omp_clause_default_ctor (tree clause, tree decl, tree outer) build3_loc (input_location, COND_EXPR, void_type_node, cond, then_b, else_b)); + /* Avoid -W*uninitialized warnings. */ + if (DECL_P (decl)) + TREE_NO_WARNING (decl) = 1; } else gfc_add_expr_to_block (&block, then_b); @@ -654,6 +657,9 @@ gfc_omp_clause_copy_ctor (tree clause, tree dest, tree src) gfc_add_expr_to_block (&block, build3_loc (input_location, COND_EXPR, void_type_node, cond, then_b, else_b)); + /* Avoid -W*uninitialized warnings. */ + if (DECL_P (dest)) + TREE_NO_WARNING (dest) = 1; return gfc_finish_block (&block); } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 5f42394daee..dab5e1ca0f1 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,6 +1,11 @@ 2019-04-30 Jakub Jelinek Backported from mainline + 2019-03-11 Jakub Jelinek + + PR fortran/89651 + * gfortran.dg/gomp/pr89651.f90: New test. + 2019-03-09 Jakub Jelinek PR c/88568 diff --git a/gcc/testsuite/gfortran.dg/gomp/pr89651.f90 b/gcc/testsuite/gfortran.dg/gomp/pr89651.f90 new file mode 100644 index 00000000000..b5054fdb5d8 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/gomp/pr89651.f90 @@ -0,0 +1,21 @@ +! PR fortran/89651 +! { dg-do compile } +! { dg-additional-options "-Wuninitialized" } + +program pr89651 + integer :: n + real, allocatable :: t(:) + n = 10 + allocate (t(n), source = 0.0) +!$omp parallel firstprivate(t) + print *, sum (t) ! { dg-bogus "lbound' may be used uninitialized in this function" } + ! { dg-bogus "ubound' may be used uninitialized in this function" "" { target *-*-* } .-1 } + ! { dg-bogus "offset' may be used uninitialized in this function" "" { target *-*-* } .-2 } +!$omp end parallel +!$omp parallel private(t) + t = 0.0 + print *, sum (t) ! { dg-bogus "lbound' may be used uninitialized in this function" } + ! { dg-bogus "ubound' may be used uninitialized in this function" "" { target *-*-* } .-1 } + ! { dg-bogus "offset' may be used uninitialized in this function" "" { target *-*-* } .-2 } +!$omp end parallel +end program pr89651 -- cgit v1.2.3 From 869c0bad63a136ae6cccff2b5cf4c8801530b33f Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 30 Apr 2019 20:41:09 +0000 Subject: Backported from mainline 2019-03-12 Jakub Jelinek PR middle-end/89663 * builtins.c (expand_builtin_int_roundingfn, expand_builtin_int_roundingfn_2): Return NULL_RTX instead of gcc_unreachable if validate_arglist fails. * gcc.c-torture/compile/pr89663-1.c: New test. * gcc.c-torture/compile/pr89663-2.c: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270725 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 7 +++ gcc/builtins.c | 4 +- gcc/testsuite/ChangeLog | 6 ++ gcc/testsuite/gcc.c-torture/compile/pr89663-1.c | 81 ++++++++++++++++++++++++ gcc/testsuite/gcc.c-torture/compile/pr89663-2.c | 82 +++++++++++++++++++++++++ 5 files changed, 178 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr89663-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr89663-2.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index aa514312603..6bf1f285cf1 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,6 +1,13 @@ 2019-04-30 Jakub Jelinek Backported from mainline + 2019-03-12 Jakub Jelinek + + PR middle-end/89663 + * builtins.c (expand_builtin_int_roundingfn, + expand_builtin_int_roundingfn_2): Return NULL_RTX instead of + gcc_unreachable if validate_arglist fails. + 2019-03-09 Jakub Jelinek PR c/88568 diff --git a/gcc/builtins.c b/gcc/builtins.c index 8241c975901..14624a641cd 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -2560,7 +2560,7 @@ expand_builtin_int_roundingfn (tree exp, rtx target) tree arg; if (!validate_arglist (exp, REAL_TYPE, VOID_TYPE)) - gcc_unreachable (); + return NULL_RTX; arg = CALL_EXPR_ARG (exp, 0); @@ -2696,7 +2696,7 @@ expand_builtin_int_roundingfn_2 (tree exp, rtx target) enum built_in_function fallback_fn = BUILT_IN_NONE; if (!validate_arglist (exp, REAL_TYPE, VOID_TYPE)) - gcc_unreachable (); + return NULL_RTX; arg = CALL_EXPR_ARG (exp, 0); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index dab5e1ca0f1..20586cc07aa 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,6 +1,12 @@ 2019-04-30 Jakub Jelinek Backported from mainline + 2019-03-12 Jakub Jelinek + + PR middle-end/89663 + * gcc.c-torture/compile/pr89663-1.c: New test. + * gcc.c-torture/compile/pr89663-2.c: New test. + 2019-03-11 Jakub Jelinek PR fortran/89651 diff --git a/gcc/testsuite/gcc.c-torture/compile/pr89663-1.c b/gcc/testsuite/gcc.c-torture/compile/pr89663-1.c new file mode 100644 index 00000000000..4fc2d0d4cb5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr89663-1.c @@ -0,0 +1,81 @@ +/* PR middle-end/89663 */ + +int irint (); +long lrint (); +long long llrint (); +int iround (); +long lround (); +long long llround (); +int iceil (); +long lceil (); +long long llceil (); +int ifloor (); +long lfloor (); +long long llfloor (); +int irintf (); +long lrintf (); +long long llrintf (); +int iroundf (); +long lroundf (); +long long llroundf (); +int iceilf (); +long lceilf (); +long long llceilf (); +int ifloorf (); +long lfloorf (); +long long llfloorf (); +int irintl (); +long lrintl (); +long long llrintl (); +int iroundl (); +long lroundl (); +long long llroundl (); +int iceill (); +long lceill (); +long long llceill (); +int ifloorl (); +long lfloorl (); +long long llfloorl (); + +void +foo (long long *p) +{ + int n = 0; +#define T(f) p[n++] = f (1); + T (irint) + T (lrint) + T (llrint) + T (iround) + T (lround) + T (llround) + T (iceil) + T (lceil) + T (llceil) + T (ifloor) + T (lfloor) + T (llfloor) + T (irintf) + T (lrintf) + T (llrintf) + T (iroundf) + T (lroundf) + T (llroundf) + T (iceilf) + T (lceilf) + T (llceilf) + T (ifloorf) + T (lfloorf) + T (llfloorf) + T (irintl) + T (lrintl) + T (llrintl) + T (iroundl) + T (lroundl) + T (llroundl) + T (iceill) + T (lceill) + T (llceill) + T (ifloorl) + T (lfloorl) + T (llfloorl) +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr89663-2.c b/gcc/testsuite/gcc.c-torture/compile/pr89663-2.c new file mode 100644 index 00000000000..052fe69f40e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr89663-2.c @@ -0,0 +1,82 @@ +/* PR middle-end/89663 */ + +int irint (double); +long lrint (double); +long long llrint (double); +int iround (double); +long lround (double); +long long llround (double); +int iceil (double); +long lceil (double); +long long llceil (double); +int ifloor (double); +long lfloor (double); +long long llfloor (double); +int irintf (float); +long lrintf (float); +long long llrintf (float); +int iroundf (float); +long lroundf (float); +long long llroundf (float); +int iceilf (float); +long lceilf (float); +long long llceilf (float); +int ifloorf (float); +long lfloorf (float); +long long llfloorf (float); +int irintl (long double); +long lrintl (long double); +long long llrintl (long double); +int iroundl (long double); +long lroundl (long double); +long long llroundl (long double); +int iceill (long double); +long lceill (long double); +long long llceill (long double); +int ifloorl (long double); +long lfloorl (long double); +long long llfloorl (long double); + +void +foo (long long *p) +{ + int (*fn) (int); + int n = 0; +#define T(f) fn = (int (*) (int)) f; p[n++] = fn (1); + T (irint) + T (lrint) + T (llrint) + T (iround) + T (lround) + T (llround) + T (iceil) + T (lceil) + T (llceil) + T (ifloor) + T (lfloor) + T (llfloor) + T (irintf) + T (lrintf) + T (llrintf) + T (iroundf) + T (lroundf) + T (llroundf) + T (iceilf) + T (lceilf) + T (llceilf) + T (ifloorf) + T (lfloorf) + T (llfloorf) + T (irintl) + T (lrintl) + T (llrintl) + T (iroundl) + T (lroundl) + T (llroundl) + T (iceill) + T (lceill) + T (llceill) + T (ifloorl) + T (lfloorl) + T (llfloorl) +} -- cgit v1.2.3 From 3c50ca639ad4fe4779a7af7db7c7bc62761da669 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 30 Apr 2019 20:41:49 +0000 Subject: Backported from mainline 2019-03-13 Jakub Jelinek PR middle-end/88588 * omp-simd-clone.c (ipa_simd_modify_stmt_ops): Handle PHI args. (ipa_simd_modify_function_body): Handle PHIs. * c-c++-common/gomp/pr88588.c: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270726 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 6 ++++ gcc/omp-simd-clone.c | 50 ++++++++++++++++++++++++++++++- gcc/testsuite/ChangeLog | 5 ++++ gcc/testsuite/c-c++-common/gomp/pr88588.c | 18 +++++++++++ 4 files changed, 78 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/c-c++-common/gomp/pr88588.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6bf1f285cf1..f32dc8a12e9 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,6 +1,12 @@ 2019-04-30 Jakub Jelinek Backported from mainline + 2019-03-13 Jakub Jelinek + + PR middle-end/88588 + * omp-simd-clone.c (ipa_simd_modify_stmt_ops): Handle PHI args. + (ipa_simd_modify_function_body): Handle PHIs. + 2019-03-12 Jakub Jelinek PR middle-end/89663 diff --git a/gcc/omp-simd-clone.c b/gcc/omp-simd-clone.c index 8b4cd9cb72f..c408f349b81 100644 --- a/gcc/omp-simd-clone.c +++ b/gcc/omp-simd-clone.c @@ -868,6 +868,18 @@ ipa_simd_modify_stmt_ops (tree *tp, int *walk_subtrees, void *data) if (tp != orig_tp) { + if (gimple_code (info->stmt) == GIMPLE_PHI + && cand + && TREE_CODE (*orig_tp) == ADDR_EXPR + && TREE_CODE (TREE_OPERAND (*orig_tp, 0)) == PARM_DECL + && cand->alias_ptr_type) + { + gcc_assert (TREE_CODE (cand->alias_ptr_type) == SSA_NAME); + *orig_tp = cand->alias_ptr_type; + info->modified = true; + return NULL_TREE; + } + repl = build_fold_addr_expr (repl); gimple *stmt; if (is_gimple_debug (info->stmt)) @@ -884,7 +896,18 @@ ipa_simd_modify_stmt_ops (tree *tp, int *walk_subtrees, void *data) stmt = gimple_build_assign (make_ssa_name (TREE_TYPE (repl)), repl); repl = gimple_assign_lhs (stmt); } - gimple_stmt_iterator gsi = gsi_for_stmt (info->stmt); + gimple_stmt_iterator gsi; + if (gimple_code (info->stmt) == GIMPLE_PHI) + { + gsi = gsi_after_labels (single_succ (ENTRY_BLOCK_PTR_FOR_FN (cfun))); + /* Cache SSA_NAME for next time. */ + if (cand + && TREE_CODE (*orig_tp) == ADDR_EXPR + && TREE_CODE (TREE_OPERAND (*orig_tp, 0)) == PARM_DECL) + cand->alias_ptr_type = repl; + } + else + gsi = gsi_for_stmt (info->stmt); gsi_insert_before (&gsi, stmt, GSI_SAME_STMT); *orig_tp = repl; } @@ -985,6 +1008,31 @@ ipa_simd_modify_function_body (struct cgraph_node *node, { gimple_stmt_iterator gsi; + for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi)) + { + gphi *phi = as_a (gsi_stmt (gsi)); + int i, n = gimple_phi_num_args (phi); + info.stmt = phi; + struct walk_stmt_info wi; + memset (&wi, 0, sizeof (wi)); + info.modified = false; + wi.info = &info; + for (i = 0; i < n; ++i) + { + int walk_subtrees = 1; + tree arg = gimple_phi_arg_def (phi, i); + tree op = arg; + ipa_simd_modify_stmt_ops (&op, &walk_subtrees, &wi); + if (op != arg) + { + SET_PHI_ARG_DEF (phi, i, op); + gcc_assert (TREE_CODE (op) == SSA_NAME); + if (gimple_phi_arg_edge (phi, i)->flags & EDGE_ABNORMAL) + SSA_NAME_OCCURS_IN_ABNORMAL_PHI (op) = 1; + } + } + } + gsi = gsi_start_bb (bb); while (!gsi_end_p (gsi)) { diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 20586cc07aa..557087975bf 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,6 +1,11 @@ 2019-04-30 Jakub Jelinek Backported from mainline + 2019-03-13 Jakub Jelinek + + PR middle-end/88588 + * c-c++-common/gomp/pr88588.c: New test. + 2019-03-12 Jakub Jelinek PR middle-end/89663 diff --git a/gcc/testsuite/c-c++-common/gomp/pr88588.c b/gcc/testsuite/c-c++-common/gomp/pr88588.c new file mode 100644 index 00000000000..fb1a671b1ee --- /dev/null +++ b/gcc/testsuite/c-c++-common/gomp/pr88588.c @@ -0,0 +1,18 @@ +/* PR middle-end/88588 */ +/* { dg-do compile } */ +/* { dg-options "-fopenmp -O1" } */ + +int *v; + +#pragma omp declare simd +void +foo (int x) +{ + int *a = &x; + + for (;;) + { + *v = *a; + a = v; + } +} -- cgit v1.2.3 From 745cca5eff03f1989926cb97f8282ba5e44d737d Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 30 Apr 2019 20:42:20 +0000 Subject: Backported from mainline 2019-03-13 Jakub Jelinek PR debug/89498 * dwarf2out.c (size_of_die): For dw_val_class_view_list always use DWARF_OFFSET_SIZE. (value_format): For dw_val_class_view_list never use DW_FORM_loclistx. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270727 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 5 +++++ gcc/dwarf2out.c | 6 ++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f32dc8a12e9..36c63f3b103 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -3,6 +3,11 @@ Backported from mainline 2019-03-13 Jakub Jelinek + PR debug/89498 + * dwarf2out.c (size_of_die): For dw_val_class_view_list always use + DWARF_OFFSET_SIZE. + (value_format): For dw_val_class_view_list never use DW_FORM_loclistx. + PR middle-end/88588 * omp-simd-clone.c (ipa_simd_modify_stmt_ops): Handle PHI args. (ipa_simd_modify_function_body): Handle PHIs. diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 36884c71fe0..0020685cce2 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -9343,7 +9343,6 @@ size_of_die (dw_die_ref die) } break; case dw_val_class_loc_list: - case dw_val_class_view_list: if (dwarf_split_debug_info && dwarf_version >= 5) { gcc_assert (AT_loc_list (a)->num_assigned); @@ -9352,6 +9351,9 @@ size_of_die (dw_die_ref die) else size += DWARF_OFFSET_SIZE; break; + case dw_val_class_view_list: + size += DWARF_OFFSET_SIZE; + break; case dw_val_class_range_list: if (value_format (a) == DW_FORM_rnglistx) { @@ -9725,12 +9727,12 @@ value_format (dw_attr_node *a) gcc_unreachable (); } case dw_val_class_loc_list: - case dw_val_class_view_list: if (dwarf_split_debug_info && dwarf_version >= 5 && AT_loc_list (a)->num_assigned) return DW_FORM_loclistx; /* FALLTHRU */ + case dw_val_class_view_list: case dw_val_class_range_list: /* For range lists in DWARF 5, use DW_FORM_rnglistx from .debug_info.dwo but in .debug_info use DW_FORM_sec_offset, which is shorter if we -- cgit v1.2.3 From 6b1656b13cfad0428b6d081486b0517b6c2ad997 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 30 Apr 2019 20:43:07 +0000 Subject: Backported from mainline 2019-03-14 Jakub Jelinek PR c++/89512 * semantics.c (finish_qualified_id_expr): Reject variable templates. * g++.dg/cpp1y/var-templ61.C: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270728 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cp/ChangeLog | 5 +++++ gcc/cp/semantics.c | 8 ++++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/cpp1y/var-templ61.C | 20 ++++++++++++++++++++ 4 files changed, 38 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp1y/var-templ61.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index a7c77ddea49..0ef01e33d49 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,6 +1,11 @@ 2019-04-30 Jakub Jelinek Backported from mainline + 2019-03-14 Jakub Jelinek + + PR c++/89512 + * semantics.c (finish_qualified_id_expr): Reject variable templates. + 2019-03-06 Jakub Jelinek PR c++/87148 diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 99a042f8375..22bc6a5b597 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -2102,6 +2102,14 @@ finish_qualified_id_expr (tree qualifying_class, expr = build_offset_ref (qualifying_class, expr, /*address_p=*/false, complain); } + else if (!template_p + && TREE_CODE (expr) == TEMPLATE_DECL + && !DECL_FUNCTION_TEMPLATE_P (expr)) + { + if (complain & tf_error) + error ("%qE missing template arguments", expr); + return error_mark_node; + } else { /* In a template, return a SCOPE_REF for most qualified-ids diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 557087975bf..8ae1812ad8f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,6 +1,11 @@ 2019-04-30 Jakub Jelinek Backported from mainline + 2019-03-14 Jakub Jelinek + + PR c++/89512 + * g++.dg/cpp1y/var-templ61.C: New test. + 2019-03-13 Jakub Jelinek PR middle-end/88588 diff --git a/gcc/testsuite/g++.dg/cpp1y/var-templ61.C b/gcc/testsuite/g++.dg/cpp1y/var-templ61.C new file mode 100644 index 00000000000..be2fe0f4423 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/var-templ61.C @@ -0,0 +1,20 @@ +// PR c++/89512 +// { dg-do compile { target c++14 } } + +struct A { + template + static const int a = 0; +}; + +struct B { + template + static int foo () + { + return T::a; // { dg-error "missing template arguments" } + } +}; + +int bar () +{ + return B::foo (); // { dg-message "required from here" } +} -- cgit v1.2.3 From 24e608d4439410303b8872a053d274bcf1f9bb9f Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 30 Apr 2019 20:43:58 +0000 Subject: Backported from mainline 2019-03-14 Jakub Jelinek PR tree-optimization/89703 * tree-ssa-strlen.c (valid_builtin_call): Punt if stmt call types aren't compatible also with builtin_decl_explicit. Check pure or non-pure status of BUILT_IN_STR{{,N}CMP,N{LEN,{CAT,CPY}{,_CHK}}} and BUILT_IN_STPNCPY{,_CHK}. * gcc.c-torture/compile/pr89703-1.c: New test. * gcc.c-torture/compile/pr89703-2.c: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270729 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 8 ++++++++ gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/gcc.c-torture/compile/pr89703-1.c | 13 +++++++++++++ gcc/testsuite/gcc.c-torture/compile/pr89703-2.c | 13 +++++++++++++ gcc/tree-ssa-strlen.c | 14 ++++++++++++++ 5 files changed, 52 insertions(+) create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr89703-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr89703-2.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 36c63f3b103..2565ab379f2 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,6 +1,14 @@ 2019-04-30 Jakub Jelinek Backported from mainline + 2019-03-14 Jakub Jelinek + + PR tree-optimization/89703 + * tree-ssa-strlen.c (valid_builtin_call): Punt if stmt call types + aren't compatible also with builtin_decl_explicit. Check pure + or non-pure status of BUILT_IN_STR{{,N}CMP,N{LEN,{CAT,CPY}{,_CHK}}} + and BUILT_IN_STPNCPY{,_CHK}. + 2019-03-13 Jakub Jelinek PR debug/89498 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 8ae1812ad8f..a963fdccbc9 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -3,6 +3,10 @@ Backported from mainline 2019-03-14 Jakub Jelinek + PR tree-optimization/89703 + * gcc.c-torture/compile/pr89703-1.c: New test. + * gcc.c-torture/compile/pr89703-2.c: New test. + PR c++/89512 * g++.dg/cpp1y/var-templ61.C: New test. diff --git a/gcc/testsuite/gcc.c-torture/compile/pr89703-1.c b/gcc/testsuite/gcc.c-torture/compile/pr89703-1.c new file mode 100644 index 00000000000..958cc7744e1 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr89703-1.c @@ -0,0 +1,13 @@ +/* PR tree-optimization/89703 */ + +typedef __SIZE_TYPE__ size_t; +extern char *strlen (const char *); +extern char *strnlen (const char *, size_t); +extern char c[2]; + +void +foo (char **q) +{ + q[0] = strlen (c); + q[1] = strnlen (c, 2); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr89703-2.c b/gcc/testsuite/gcc.c-torture/compile/pr89703-2.c new file mode 100644 index 00000000000..d2676ded0ca --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr89703-2.c @@ -0,0 +1,13 @@ +/* PR tree-optimization/89703 */ + +typedef __SIZE_TYPE__ size_t; +extern void *memcpy (void *, const void *, size_t); +extern char *strlen (const char *); +extern char c[2]; + +void +foo (char **q) +{ + memcpy (c, "a", 2); + q[0] = strlen (c); +} diff --git a/gcc/tree-ssa-strlen.c b/gcc/tree-ssa-strlen.c index 50b0724ab39..55e82e7b638 100644 --- a/gcc/tree-ssa-strlen.c +++ b/gcc/tree-ssa-strlen.c @@ -996,10 +996,18 @@ valid_builtin_call (gimple *stmt) return false; tree callee = gimple_call_fndecl (stmt); + tree decl = builtin_decl_explicit (DECL_FUNCTION_CODE (callee)); + if (decl + && decl != callee + && !gimple_builtin_call_types_compatible_p (stmt, decl)) + return false; + switch (DECL_FUNCTION_CODE (callee)) { case BUILT_IN_MEMCMP: case BUILT_IN_MEMCMP_EQ: + case BUILT_IN_STRCMP: + case BUILT_IN_STRNCMP: case BUILT_IN_STRCHR: case BUILT_IN_STRCHR_CHKP: case BUILT_IN_STRLEN: @@ -1024,6 +1032,8 @@ valid_builtin_call (gimple *stmt) case BUILT_IN_STPCPY_CHK: case BUILT_IN_STPCPY_CHKP: case BUILT_IN_STPCPY_CHK_CHKP: + case BUILT_IN_STPNCPY: + case BUILT_IN_STPNCPY_CHK: case BUILT_IN_STRCAT: case BUILT_IN_STRCAT_CHK: case BUILT_IN_STRCAT_CHKP: @@ -1032,6 +1042,10 @@ valid_builtin_call (gimple *stmt) case BUILT_IN_STRCPY_CHK: case BUILT_IN_STRCPY_CHKP: case BUILT_IN_STRCPY_CHK_CHKP: + case BUILT_IN_STRNCAT: + case BUILT_IN_STRNCAT_CHK: + case BUILT_IN_STRNCPY: + case BUILT_IN_STRNCPY_CHK: /* The above functions should be neither const nor pure. Punt if they aren't. */ if (gimple_vdef (stmt) == NULL_TREE || gimple_vuse (stmt) == NULL_TREE) -- cgit v1.2.3 From 876baf3d93471705b54d3d7f1971f8a4e816389f Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 30 Apr 2019 20:44:48 +0000 Subject: Backported from mainline 2019-03-14 Jakub Jelinek PR rtl-optimization/89679 * expmed.c (expand_mult_const): Don't add a REG_EQUAL note if it would contain a paradoxical SUBREG. * gcc.dg/pr89679.c: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270730 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 4 ++++ gcc/expmed.c | 21 ++++++++++++++------- gcc/testsuite/ChangeLog | 3 +++ gcc/testsuite/gcc.dg/pr89679.c | 26 ++++++++++++++++++++++++++ 4 files changed, 47 insertions(+), 7 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/pr89679.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 2565ab379f2..a81f25783ee 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -3,6 +3,10 @@ Backported from mainline 2019-03-14 Jakub Jelinek + PR rtl-optimization/89679 + * expmed.c (expand_mult_const): Don't add a REG_EQUAL note if it + would contain a paradoxical SUBREG. + PR tree-optimization/89703 * tree-ssa-strlen.c (valid_builtin_call): Punt if stmt call types aren't compatible also with builtin_decl_explicit. Check pure diff --git a/gcc/expmed.c b/gcc/expmed.c index fd16c1590f1..cee0d6ae630 100644 --- a/gcc/expmed.c +++ b/gcc/expmed.c @@ -3352,13 +3352,20 @@ expand_mult_const (machine_mode mode, rtx op0, HOST_WIDE_INT val, tem = gen_lowpart (nmode, op0); } - insn = get_last_insn (); - wide_int wval_so_far - = wi::uhwi (val_so_far, - GET_MODE_PRECISION (as_a (nmode))); - rtx c = immed_wide_int_const (wval_so_far, nmode); - set_dst_reg_note (insn, REG_EQUAL, gen_rtx_MULT (nmode, tem, c), - accum_inner); + /* Don't add a REG_EQUAL note if tem is a paradoxical SUBREG. + In that case, only the low bits of accum would be guaranteed to + be equal to the content of the REG_EQUAL note, the upper bits + can be anything. */ + if (!paradoxical_subreg_p (tem)) + { + insn = get_last_insn (); + wide_int wval_so_far + = wi::uhwi (val_so_far, + GET_MODE_PRECISION (as_a (nmode))); + rtx c = immed_wide_int_const (wval_so_far, nmode); + set_dst_reg_note (insn, REG_EQUAL, gen_rtx_MULT (nmode, tem, c), + accum_inner); + } } } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index a963fdccbc9..f92c4a11bd1 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -3,6 +3,9 @@ Backported from mainline 2019-03-14 Jakub Jelinek + PR rtl-optimization/89679 + * gcc.dg/pr89679.c: New test. + PR tree-optimization/89703 * gcc.c-torture/compile/pr89703-1.c: New test. * gcc.c-torture/compile/pr89703-2.c: New test. diff --git a/gcc/testsuite/gcc.dg/pr89679.c b/gcc/testsuite/gcc.dg/pr89679.c new file mode 100644 index 00000000000..0d6e2d2c871 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr89679.c @@ -0,0 +1,26 @@ +/* PR rtl-optimization/89679 */ +/* { dg-do run } */ +/* { dg-options "-Og -frerun-cse-after-loop -fno-tree-fre" } */ + +unsigned short g; + +void +foo (unsigned long long x) +{ + if (x != 0xffff) + __builtin_abort (); +} + +int +main () +{ +#if __SIZEOF_SHORT__ == 2 && __SIZEOF_INT__ == 4 && __CHAR_BIT__ == 8 + unsigned short d = 0; + unsigned long long x, c = ~0; + c = c >> d; + __builtin_memset (&d, c, 2); + x = d + g; + foo (x); +#endif + return 0; +} -- cgit v1.2.3 From 04b150129a5e8dc1588fa77cb7c44309cc4329fd Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 30 Apr 2019 20:45:28 +0000 Subject: Backported from mainline 2019-03-14 Jakub Jelinek PR ipa/89684 * multiple_target.c (create_dispatcher_calls): Change references_to_redirect from vector of ipa_ref * to vector of ipa_ref. In the node->iterate_referring loop, push *ref rather than ref, call ref->remove_reference () and always pass 0 to iterate_referring. * gcc.target/i386/pr89684.c: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270731 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 6 ++++++ gcc/multiple_target.c | 14 +++++++++----- gcc/testsuite/ChangeLog | 3 +++ gcc/testsuite/gcc.target/i386/pr89684.c | 23 +++++++++++++++++++++++ 4 files changed, 41 insertions(+), 5 deletions(-) create mode 100644 gcc/testsuite/gcc.target/i386/pr89684.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a81f25783ee..7fcca2f45d2 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -3,6 +3,12 @@ Backported from mainline 2019-03-14 Jakub Jelinek + PR ipa/89684 + * multiple_target.c (create_dispatcher_calls): Change + references_to_redirect from vector of ipa_ref * to vector of ipa_ref. + In the node->iterate_referring loop, push *ref rather than ref, call + ref->remove_reference () and always pass 0 to iterate_referring. + PR rtl-optimization/89679 * expmed.c (expand_mult_const): Don't add a REG_EQUAL note if it would contain a paradoxical SUBREG. diff --git a/gcc/multiple_target.c b/gcc/multiple_target.c index be15af3142c..87000dba214 100644 --- a/gcc/multiple_target.c +++ b/gcc/multiple_target.c @@ -103,10 +103,16 @@ create_dispatcher_calls (struct cgraph_node *node) inode->resolve_alias (cgraph_node::get (resolver_decl)); auto_vec edges_to_redirect; - auto_vec references_to_redirect; + /* We need to capture the references by value rather than just pointers to them + and remove them right away, as removing them later would invalidate what + some other reference pointers point to. */ + auto_vec references_to_redirect; - for (unsigned i = 0; node->iterate_referring (i, ref); i++) - references_to_redirect.safe_push (ref); + while (node->iterate_referring (0, ref)) + { + references_to_redirect.safe_push (*ref); + ref->remove_reference (); + } /* We need to remember NEXT_CALLER as it could be modified in the loop. */ for (cgraph_edge *e = node->callers; e ; e = e->next_caller) @@ -146,13 +152,11 @@ create_dispatcher_calls (struct cgraph_node *node) } symtab_node *source = ref->referring; - ref->remove_reference (); source->create_reference (inode, IPA_REF_ADDR); } else if (ref->use == IPA_REF_ALIAS) { symtab_node *source = ref->referring; - ref->remove_reference (); source->create_reference (inode, IPA_REF_ALIAS); source->add_to_same_comdat_group (inode); } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index f92c4a11bd1..90dcaa8c9a0 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -3,6 +3,9 @@ Backported from mainline 2019-03-14 Jakub Jelinek + PR ipa/89684 + * gcc.target/i386/pr89684.c: New test. + PR rtl-optimization/89679 * gcc.dg/pr89679.c: New test. diff --git a/gcc/testsuite/gcc.target/i386/pr89684.c b/gcc/testsuite/gcc.target/i386/pr89684.c new file mode 100644 index 00000000000..85801bfc25f --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr89684.c @@ -0,0 +1,23 @@ +/* PR ipa/89684 */ +/* { dg-do compile } */ +/* { dg-require-ifunc "" } */ + +void bar (int, void (*) (void)); + +__attribute__((target_clones ("default", "avx"))) +void foo (void) +{ + bar (0, foo); + bar (0, foo); +} + +__attribute__((target_clones ("default", "avx", "avx2"))) +void baz (void) +{ + bar (0, foo); + bar (0, foo); + bar (0, foo); + bar (0, foo); + bar (0, foo); + bar (0, foo); +} -- cgit v1.2.3 From d8889ff86a8d6d47a953c6d61c614b983d06902b Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 30 Apr 2019 20:46:09 +0000 Subject: Backported from mainline 2019-03-15 Jakub Jelinek PR debug/89704 * dwarf2out.c (add_const_value_attribute): Return false for MINUS, SIGN_EXTEND and ZERO_EXTEND. * gcc.dg/debug/pr89704.c: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270732 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 6 ++++++ gcc/dwarf2out.c | 3 +++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/debug/pr89704.c | 14 ++++++++++++++ 4 files changed, 28 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/debug/pr89704.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 7fcca2f45d2..b9914f08323 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,6 +1,12 @@ 2019-04-30 Jakub Jelinek Backported from mainline + 2019-03-15 Jakub Jelinek + + PR debug/89704 + * dwarf2out.c (add_const_value_attribute): Return false for MINUS, + SIGN_EXTEND and ZERO_EXTEND. + 2019-03-14 Jakub Jelinek PR ipa/89684 diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 0020685cce2..2ea8a2222b0 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -19675,6 +19675,9 @@ add_const_value_attribute (dw_die_ref die, rtx rtl) case HIGH: case CONST_FIXED: + case MINUS: + case SIGN_EXTEND: + case ZERO_EXTEND: return false; case MEM: diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 90dcaa8c9a0..b13befaa552 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,6 +1,11 @@ 2019-04-30 Jakub Jelinek Backported from mainline + 2019-03-15 Jakub Jelinek + + PR debug/89704 + * gcc.dg/debug/pr89704.c: New test. + 2019-03-14 Jakub Jelinek PR ipa/89684 diff --git a/gcc/testsuite/gcc.dg/debug/pr89704.c b/gcc/testsuite/gcc.dg/debug/pr89704.c new file mode 100644 index 00000000000..4a8cf4fa456 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/pr89704.c @@ -0,0 +1,14 @@ +/* PR debug/89704 */ +/* { dg-do compile } */ + +typedef __INTPTR_TYPE__ intptr_t; + +int +foo (void) +{ + lab1:; + lab2:; + static int i = (intptr_t) &&lab1 - (intptr_t) &&lab2; + static int j = (intptr_t) &&lab1 - (intptr_t) &&lab2; + return i; +} -- cgit v1.2.3 From 85fb93ee5e5e4a1fada0d404cd6202cf50c71bb7 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 30 Apr 2019 20:46:59 +0000 Subject: Backported from mainline 2019-03-19 Jakub Jelinek PR c/89734 * c-decl.c (grokdeclarator): Call c_build_qualified_type on function return type even if quals_used is 0. Formatting fixes. * gcc.dg/pr89734.c: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270733 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/c/ChangeLog | 9 +++++++++ gcc/c/c-decl.c | 9 +++++---- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/pr89734.c | 12 ++++++++++++ 4 files changed, 31 insertions(+), 4 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/pr89734.c diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index 55401b181dc..bc4ad34100e 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,12 @@ +2019-04-30 Jakub Jelinek + + Backported from mainline + 2019-03-19 Jakub Jelinek + + PR c/89734 + * c-decl.c (grokdeclarator): Call c_build_qualified_type on function + return type even if quals_used is 0. Formatting fixes. + 2019-02-22 Release Manager * GCC 8.3.0 released. diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c index 4da9fe994f3..d5cb59bc1ac 100644 --- a/gcc/c/c-decl.c +++ b/gcc/c/c-decl.c @@ -6436,10 +6436,12 @@ grokdeclarator (const struct c_declarator *declarator, quals_used &= TYPE_QUAL_ATOMIC; if (quals_used && VOID_TYPE_P (type) && really_funcdef) pedwarn (specs_loc, 0, - "function definition has qualified void return type"); + "function definition has qualified void " + "return type"); else warning_at (specs_loc, OPT_Wignored_qualifiers, - "type qualifiers ignored on function return type"); + "type qualifiers ignored on function " + "return type"); /* Ensure an error for restrict on invalid types; the DR#423 resolution is not entirely clear about @@ -6449,8 +6451,7 @@ grokdeclarator (const struct c_declarator *declarator, && (!POINTER_TYPE_P (type) || !C_TYPE_OBJECT_OR_INCOMPLETE_P (TREE_TYPE (type)))) error_at (loc, "invalid use of %"); - if (quals_used) - type = c_build_qualified_type (type, quals_used); + type = c_build_qualified_type (type, quals_used); } type_quals = TYPE_UNQUALIFIED; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b13befaa552..ec13da4c17c 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,6 +1,11 @@ 2019-04-30 Jakub Jelinek Backported from mainline + 2019-03-19 Jakub Jelinek + + PR c/89734 + * gcc.dg/pr89734.c: New test. + 2019-03-15 Jakub Jelinek PR debug/89704 diff --git a/gcc/testsuite/gcc.dg/pr89734.c b/gcc/testsuite/gcc.dg/pr89734.c new file mode 100644 index 00000000000..4dc27548ab2 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr89734.c @@ -0,0 +1,12 @@ +/* PR c/89734 */ +/* { dg-do compile } */ +/* { dg-options "" } */ + +typedef const int CI; +typedef _Atomic int AI; + +CI foo (void); +const int foo (void); + +AI baz (void); +_Atomic int baz (void); -- cgit v1.2.3 From 5ad37dcca1d13b0a6a2973639364f6baef5984d5 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 30 Apr 2019 20:47:52 +0000 Subject: Backported from mainline 2019-03-19 Jakub Jelinek PR target/89726 * config/i386/i386.c (ix86_expand_floorceildf_32): In ceil compensation use x2 += 1 instead of x2 -= -1 and when honoring signed zeros, do another copysign after the compensation. * gcc.target/i386/fpprec-1.c (x): Add 6 new constants. (expect_round, expect_rint, expect_floor, expect_ceil, expect_trunc): Add expected results for them. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270734 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 7 +++++++ gcc/config/i386/i386.c | 17 +++++++++-------- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.target/i386/fpprec-1.c | 8 ++++++++ 4 files changed, 29 insertions(+), 8 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b9914f08323..fa605c874e9 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,6 +1,13 @@ 2019-04-30 Jakub Jelinek Backported from mainline + 2019-03-19 Jakub Jelinek + + PR target/89726 + * config/i386/i386.c (ix86_expand_floorceildf_32): In ceil + compensation use x2 += 1 instead of x2 -= -1 and when honoring + signed zeros, do another copysign after the compensation. + 2019-03-15 Jakub Jelinek PR debug/89704 diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 30a20af8fab..98ddfb971fe 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -45624,8 +45624,10 @@ ix86_expand_floorceildf_32 (rtx operand0, rtx operand1, bool do_floor) x2 -= 1; Compensate. Ceil: if (x2 < x) - x2 -= -1; - return x2; + x2 += 1; + if (HONOR_SIGNED_ZEROS (mode)) + x2 = copysign (x2, x); + return x2; */ machine_mode mode = GET_MODE (operand0); rtx xa, TWO52, tmp, one, res, mask; @@ -45651,17 +45653,16 @@ ix86_expand_floorceildf_32 (rtx operand0, rtx operand1, bool do_floor) /* xa = copysign (xa, operand1) */ ix86_sse_copysign_to_positive (xa, xa, res, mask); - /* generate 1.0 or -1.0 */ - one = force_reg (mode, - const_double_from_real_value (do_floor - ? dconst1 : dconstm1, mode)); + /* generate 1.0 */ + one = force_reg (mode, const_double_from_real_value (dconst1, mode)); /* Compensate: xa = xa - (xa > operand1 ? 1 : 0) */ tmp = ix86_expand_sse_compare_mask (UNGT, xa, res, !do_floor); emit_insn (gen_rtx_SET (tmp, gen_rtx_AND (mode, one, tmp))); - /* We always need to subtract here to preserve signed zero. */ - tmp = expand_simple_binop (mode, MINUS, + tmp = expand_simple_binop (mode, do_floor ? MINUS : PLUS, xa, tmp, NULL_RTX, 0, OPTAB_DIRECT); + if (!do_floor && HONOR_SIGNED_ZEROS (mode)) + ix86_sse_copysign_to_positive (tmp, tmp, res, mask); emit_move_insn (res, tmp); emit_label (label); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ec13da4c17c..0d09a5a109a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -3,6 +3,11 @@ Backported from mainline 2019-03-19 Jakub Jelinek + PR target/89726 + * gcc.target/i386/fpprec-1.c (x): Add 6 new constants. + (expect_round, expect_rint, expect_floor, expect_ceil, expect_trunc): + Add expected results for them. + PR c/89734 * gcc.dg/pr89734.c: New test. diff --git a/gcc/testsuite/gcc.target/i386/fpprec-1.c b/gcc/testsuite/gcc.target/i386/fpprec-1.c index 1c17c1d10a0..4e55a225bb8 100644 --- a/gcc/testsuite/gcc.target/i386/fpprec-1.c +++ b/gcc/testsuite/gcc.target/i386/fpprec-1.c @@ -11,6 +11,9 @@ double x[] = { __builtin_nan(""), __builtin_inf(), -__builtin_inf(), 0x1.0000000000001p-1, 0x1.fffffffffffffp-2, 0x1.0000000000001p+0, 0x1.fffffffffffffp-1, 0x1.8000000000001p+0, 0x1.7ffffffffffffp+0, + -0x1.0000000000001p-1, -0x1.fffffffffffffp-2, + -0x1.0000000000001p+0, -0x1.fffffffffffffp-1, + -0x1.8000000000001p+0, -0x1.7ffffffffffffp+0, -0.0, 0.0, -0.5, 0.5, -1.0, 1.0, -1.5, 1.5, -2.0, 2.0, -2.5, 2.5 }; #define NUM (sizeof(x)/sizeof(double)) @@ -19,6 +22,7 @@ double expect_round[] = { __builtin_nan(""), __builtin_inf(), -__builtin_inf(), -0x1.fffffffffffffp+1023, 0x1.fffffffffffffp+1023, -0.0, 0.0, 1.0, 0.0, 1.0, 1.0, 2.0, 1.0, + -1.0, -0.0, -1.0, -1.0, -2.0, -1.0, -0.0, 0.0, -1.0, 1.0, -1.0, 1.0, -2.0, 2.0, -2.0, 2.0, -3.0, 3.0 }; @@ -26,6 +30,7 @@ double expect_rint[] = { __builtin_nan(""), __builtin_inf(), -__builtin_inf(), -0x1.fffffffffffffp+1023, 0x1.fffffffffffffp+1023, -0.0, 0.0, 1.0, 0.0, 1.0, 1.0, 2.0, 1.0, + -1.0, -0.0, -1.0, -1.0, -2.0, -1.0, -0.0, 0.0, -0.0, 0.0, -1.0, 1.0, -2.0, 2.0, -2.0, 2.0, -2.0, 2.0 }; @@ -33,6 +38,7 @@ double expect_floor[] = { __builtin_nan(""), __builtin_inf(), -__builtin_inf(), -0x1.fffffffffffffp+1023, 0x1.fffffffffffffp+1023, -1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 1.0, 1.0, + -1.0, -1.0, -2.0, -1.0, -2.0, -2.0, -0.0, 0.0, -1.0, 0.0, -1.0, 1.0, -2.0, 1.0, -2.0, 2.0, -3.0, 2.0 }; @@ -40,6 +46,7 @@ double expect_ceil[] = { __builtin_nan(""), __builtin_inf(), -__builtin_inf(), -0x1.fffffffffffffp+1023, 0x1.fffffffffffffp+1023, -0.0, 1.0, 1.0, 1.0, 2.0, 1.0, 2.0, 2.0, + -0.0, -0.0, -1.0, -0.0, -1.0, -1.0, -0.0, 0.0, -0.0, 1.0, -1.0, 1.0, -1.0, 2.0, -2.0, 2.0, -2.0, 3.0 }; @@ -47,6 +54,7 @@ double expect_trunc[] = { __builtin_nan(""), __builtin_inf(), -__builtin_inf(), -0x1.fffffffffffffp+1023, 0x1.fffffffffffffp+1023, -0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 1.0, 1.0, + -0.0, -0.0, -1.0, -0.0, -1.0, -1.0, -0.0, 0.0, -0.0, 0.0, -1.0, 1.0, -1.0, 1.0, -2.0, 2.0, -2.0, 2.0 }; -- cgit v1.2.3 From f16de2b42bedec0118444bad90a48836328d3de6 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 30 Apr 2019 20:49:38 +0000 Subject: Backported from mainline 2019-03-19 Jakub Jelinek PR target/89752 * gimplify.c (gimplify_asm_expr): For output argument with TREE_ADDRESSABLE type, clear allows_reg if it allows memory, otherwise diagnose error. * g++.dg/ext/asm15.C: Check for particular diagnostic wording. * g++.dg/ext/asm16.C: Likewise. * g++.dg/ext/asm17.C: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270735 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 5 +++++ gcc/gimplify.c | 13 +++++++++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/ext/asm15.C | 3 ++- gcc/testsuite/g++.dg/ext/asm16.C | 3 ++- gcc/testsuite/g++.dg/ext/asm17.C | 11 +++++++++++ 6 files changed, 38 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/g++.dg/ext/asm17.C diff --git a/gcc/ChangeLog b/gcc/ChangeLog index fa605c874e9..94a15f2fa6f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -3,6 +3,11 @@ Backported from mainline 2019-03-19 Jakub Jelinek + PR target/89752 + * gimplify.c (gimplify_asm_expr): For output argument with + TREE_ADDRESSABLE type, clear allows_reg if it allows memory, otherwise + diagnose error. + PR target/89726 * config/i386/i386.c (ix86_expand_floorceildf_32): In ceil compensation use x2 += 1 instead of x2 -= -1 and when honoring diff --git a/gcc/gimplify.c b/gcc/gimplify.c index 12041973d84..8b94f520967 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -6144,6 +6144,19 @@ gimplify_asm_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p) is_inout = false; } + /* If we can't make copies, we can only accept memory. */ + if (TREE_ADDRESSABLE (TREE_TYPE (TREE_VALUE (link)))) + { + if (allows_mem) + allows_reg = 0; + else + { + error ("impossible constraint in %"); + error ("non-memory output %d must stay in memory", i); + return GS_ERROR; + } + } + if (!allows_reg && allows_mem) mark_addressable (TREE_VALUE (link)); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 0d09a5a109a..0b81462cd8a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -3,6 +3,11 @@ Backported from mainline 2019-03-19 Jakub Jelinek + PR target/89752 + * g++.dg/ext/asm15.C: Check for particular diagnostic wording. + * g++.dg/ext/asm16.C: Likewise. + * g++.dg/ext/asm17.C: New test. + PR target/89726 * gcc.target/i386/fpprec-1.c (x): Add 6 new constants. (expect_round, expect_rint, expect_floor, expect_ceil, expect_trunc): diff --git a/gcc/testsuite/g++.dg/ext/asm15.C b/gcc/testsuite/g++.dg/ext/asm15.C index c4946ddc536..6c6f3dfc3db 100644 --- a/gcc/testsuite/g++.dg/ext/asm15.C +++ b/gcc/testsuite/g++.dg/ext/asm15.C @@ -6,5 +6,6 @@ struct S { S (); ~S (); int s; }; void foo (S &s) { - __asm volatile ("" : "+r" (s) : : "memory"); // { dg-error "" } + __asm volatile ("" : "+r" (s) : : "memory"); // { dg-error "impossible constraint" } + // { dg-error "must stay in memory" "" { target *-*-* } .-1 } } diff --git a/gcc/testsuite/g++.dg/ext/asm16.C b/gcc/testsuite/g++.dg/ext/asm16.C index 565cbb33e5f..9ebb4dc15f9 100644 --- a/gcc/testsuite/g++.dg/ext/asm16.C +++ b/gcc/testsuite/g++.dg/ext/asm16.C @@ -6,5 +6,6 @@ struct S { S (); ~S (); int s[64]; } s; void foo () { - __asm volatile ("" : "=r" (s) : : "memory"); // { dg-error "" } + __asm volatile ("" : "=r" (s) : : "memory"); // { dg-error "impossible constraint" } + // { dg-error "must stay in memory" "" { target *-*-* } .-1 } } diff --git a/gcc/testsuite/g++.dg/ext/asm17.C b/gcc/testsuite/g++.dg/ext/asm17.C new file mode 100644 index 00000000000..9e7de37013e --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/asm17.C @@ -0,0 +1,11 @@ +// PR target/89752 +// { dg-do compile } + +struct A { A (); ~A (); short c; }; + +void +foo () +{ + A a0, a1; + __asm volatile ("" : "+rm" (a0), "+rm" (a1)); +} -- cgit v1.2.3 From fa8c568c281583d824a7c1fa276178a6427dc990 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 30 Apr 2019 20:50:18 +0000 Subject: Backported from mainline 2019-03-19 Jakub Jelinek PR rtl-optimization/89768 * loop-unroll.c (unroll_loop_constant_iterations): Use gen_int_mode instead of GEN_INT. (unroll_loop_runtime_iterations): Likewise. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270736 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 5 +++++ gcc/loop-unroll.c | 8 ++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 94a15f2fa6f..08304db21ea 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -3,6 +3,11 @@ Backported from mainline 2019-03-19 Jakub Jelinek + PR rtl-optimization/89768 + * loop-unroll.c (unroll_loop_constant_iterations): Use gen_int_mode + instead of GEN_INT. + (unroll_loop_runtime_iterations): Likewise. + PR target/89752 * gimplify.c (gimplify_asm_expr): For output argument with TREE_ADDRESSABLE type, clear allows_reg if it allows memory, otherwise diff --git a/gcc/loop-unroll.c b/gcc/loop-unroll.c index 0f50747aa08..e52e4c75bc6 100644 --- a/gcc/loop-unroll.c +++ b/gcc/loop-unroll.c @@ -651,7 +651,7 @@ unroll_loop_constant_iterations (struct loop *loop) if (loop->any_likely_upper_bound) loop->nb_iterations_likely_upper_bound = wi::udiv_trunc (loop->nb_iterations_likely_upper_bound, max_unroll + 1); - desc->niter_expr = GEN_INT (desc->niter); + desc->niter_expr = gen_int_mode (desc->niter, desc->mode); /* Remove the edges. */ FOR_EACH_VEC_ELT (remove_edges, i, e) @@ -1019,9 +1019,9 @@ unroll_loop_runtime_iterations (struct loop *loop) preheader = split_edge (loop_preheader_edge (loop)); /* Add in count of edge from switch block. */ preheader->count += iter_count; - branch_code = compare_and_jump_seq (copy_rtx (niter), GEN_INT (j), EQ, - block_label (preheader), p, - NULL); + branch_code = compare_and_jump_seq (copy_rtx (niter), + gen_int_mode (j, desc->mode), EQ, + block_label (preheader), p, NULL); /* We rely on the fact that the compare and jump cannot be optimized out, and hence the cfg we create is correct. */ -- cgit v1.2.3 From b2ba2f223c4a04a5ee1da2adfbea77489dd00d75 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 30 Apr 2019 20:50:48 +0000 Subject: Backported from mainline 2019-03-20 Jakub Jelinek PR target/89752 * lra-constraints.c (process_alt_operands) : For BLKmode, don't update this_alternative nor this_alternative_set. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270737 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 6 ++++++ gcc/lra-constraints.c | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 08304db21ea..fb3a6d53fbb 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,6 +1,12 @@ 2019-04-30 Jakub Jelinek Backported from mainline + 2019-03-20 Jakub Jelinek + + PR target/89752 + * lra-constraints.c (process_alt_operands) : For BLKmode, don't + update this_alternative nor this_alternative_set. + 2019-03-19 Jakub Jelinek PR rtl-optimization/89768 diff --git a/gcc/lra-constraints.c b/gcc/lra-constraints.c index e3adf78e57c..484e9fa148c 100644 --- a/gcc/lra-constraints.c +++ b/gcc/lra-constraints.c @@ -2315,6 +2315,8 @@ process_alt_operands (int only_alternative) break; reg: + if (mode == BLKmode) + break; this_alternative = reg_class_subunion[this_alternative][cl]; IOR_HARD_REG_SET (this_alternative_set, reg_class_contents[cl]); @@ -2325,8 +2327,6 @@ process_alt_operands (int only_alternative) IOR_HARD_REG_SET (this_costly_alternative_set, reg_class_contents[cl]); } - if (mode == BLKmode) - break; winreg = true; if (REG_P (op)) { -- cgit v1.2.3 From 2f5484a5dcf041ba74291ef6900f2857cbd623e7 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 30 Apr 2019 20:51:42 +0000 Subject: Backported from mainline 2019-03-21 Jakub Jelinek PR c++/89767 * parser.c (cp_parser_lambda_introducer): Add ids and first_capture_id variables, check for duplicates in this function. * lambda.c (add_capture): Don't check for duplicates nor use IDENTIFIER_MARKED. (register_capture_members): Don't clear IDENTIFIER_MARKED here. * g++.dg/cpp1y/lambda-init18.C: New test. * g++.dg/cpp1y/lambda-init19.C: New test. * g++.dg/cpp1y/pr89767.C: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270738 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cp/ChangeLog | 9 ++++ gcc/cp/lambda.c | 15 ------- gcc/cp/parser.c | 72 +++++++++++++++++++++++------- gcc/testsuite/ChangeLog | 7 +++ gcc/testsuite/g++.dg/cpp1y/lambda-init18.C | 12 +++++ gcc/testsuite/g++.dg/cpp1y/lambda-init19.C | 15 +++++++ gcc/testsuite/g++.dg/cpp1y/pr89767.C | 32 +++++++++++++ 7 files changed, 132 insertions(+), 30 deletions(-) create mode 100644 gcc/testsuite/g++.dg/cpp1y/lambda-init18.C create mode 100644 gcc/testsuite/g++.dg/cpp1y/lambda-init19.C create mode 100644 gcc/testsuite/g++.dg/cpp1y/pr89767.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 0ef01e33d49..d45898f9995 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,6 +1,15 @@ 2019-04-30 Jakub Jelinek Backported from mainline + 2019-03-21 Jakub Jelinek + + PR c++/89767 + * parser.c (cp_parser_lambda_introducer): Add ids and first_capture_id + variables, check for duplicates in this function. + * lambda.c (add_capture): Don't check for duplicates nor use + IDENTIFIER_MARKED. + (register_capture_members): Don't clear IDENTIFIER_MARKED here. + 2019-03-14 Jakub Jelinek PR c++/89512 diff --git a/gcc/cp/lambda.c b/gcc/cp/lambda.c index 6c04393f1b1..744880bd532 100644 --- a/gcc/cp/lambda.c +++ b/gcc/cp/lambda.c @@ -612,19 +612,6 @@ add_capture (tree lambda, tree id, tree orig_init, bool by_reference_p, IDENTIFIER_LENGTH (id) + 1); name = get_identifier (buf); - /* If TREE_TYPE isn't set, we're still in the introducer, so check - for duplicates. */ - if (!LAMBDA_EXPR_CLOSURE (lambda)) - { - if (IDENTIFIER_MARKED (name)) - { - pedwarn (input_location, 0, - "already captured %qD in lambda expression", id); - return NULL_TREE; - } - IDENTIFIER_MARKED (name) = true; - } - if (variadic) type = make_pack_expansion (type); @@ -685,8 +672,6 @@ register_capture_members (tree captures) if (PACK_EXPANSION_P (field)) field = PACK_EXPANSION_PATTERN (field); - /* We set this in add_capture to avoid duplicates. */ - IDENTIFIER_MARKED (DECL_NAME (field)) = false; finish_member_declaration (field); } diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index e479ed96d30..f69e80b6e03 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -10266,6 +10266,11 @@ cp_parser_lambda_introducer (cp_parser* parser, tree lambda_expr) first = false; } + hash_set *ids = NULL; +#if GCC_VERSION >= 8000 + char ids_buf[sizeof (hash_set) + __alignof__ (hash_set) - 1]; +#endif + tree first_capture_id = NULL_TREE; while (cp_lexer_next_token_is_not (parser->lexer, CPP_CLOSE_SQUARE)) { cp_token* capture_token; @@ -10301,11 +10306,14 @@ cp_parser_lambda_introducer (cp_parser* parser, tree lambda_expr) pedwarn (loc, 0, "explicit by-copy capture of % redundant " "with by-copy capture default"); cp_lexer_consume_token (parser->lexer); - add_capture (lambda_expr, - /*id=*/this_identifier, - /*initializer=*/finish_this_expr (), - /*by_reference_p=*/true, - explicit_init_p); + if (LAMBDA_EXPR_THIS_CAPTURE (lambda_expr)) + pedwarn (input_location, 0, + "already captured %qD in lambda expression", + this_identifier); + else + add_capture (lambda_expr, /*id=*/this_identifier, + /*initializer=*/finish_this_expr (), + /*by_reference_p=*/true, explicit_init_p); continue; } @@ -10319,11 +10327,14 @@ cp_parser_lambda_introducer (cp_parser* parser, tree lambda_expr) "-std=c++17 or -std=gnu++17"); cp_lexer_consume_token (parser->lexer); cp_lexer_consume_token (parser->lexer); - add_capture (lambda_expr, - /*id=*/this_identifier, - /*initializer=*/finish_this_expr (), - /*by_reference_p=*/false, - explicit_init_p); + if (LAMBDA_EXPR_THIS_CAPTURE (lambda_expr)) + pedwarn (input_location, 0, + "already captured %qD in lambda expression", + this_identifier); + else + add_capture (lambda_expr, /*id=*/this_identifier, + /*initializer=*/finish_this_expr (), + /*by_reference_p=*/false, explicit_init_p); continue; } @@ -10445,11 +10456,35 @@ cp_parser_lambda_introducer (cp_parser* parser, tree lambda_expr) "default", capture_id); } - add_capture (lambda_expr, - capture_id, - capture_init_expr, - /*by_reference_p=*/capture_kind == BY_REFERENCE, - explicit_init_p); + /* Check for duplicates. + Optimize for the zero or one explicit captures cases and only create + the hash_set after adding second capture. */ + bool found = false; + if (ids && ids->elements ()) + found = ids->add (capture_id); + else if (first_capture_id == NULL_TREE) + first_capture_id = capture_id; + else if (capture_id == first_capture_id) + found = true; + else + { +#if GCC_VERSION >= 8000 + ids = new (ids_buf + + (-(uintptr_t) ids_buf + & (__alignof__ (hash_set ) - 1))) hash_set ; +#else + ids = new hash_set ; +#endif + ids->add (first_capture_id); + ids->add (capture_id); + } + if (found) + pedwarn (input_location, 0, + "already captured %qD in lambda expression", capture_id); + else + add_capture (lambda_expr, capture_id, capture_init_expr, + /*by_reference_p=*/capture_kind == BY_REFERENCE, + explicit_init_p); /* If there is any qualification still in effect, clear it now; we will be starting fresh with the next capture. */ @@ -10458,6 +10493,13 @@ cp_parser_lambda_introducer (cp_parser* parser, tree lambda_expr) parser->object_scope = NULL_TREE; } + if (ids) +#if GCC_VERSION >= 8000 + ids->~hash_set (); +#else + delete ids; +#endif + cp_parser_require (parser, CPP_CLOSE_SQUARE, RT_CLOSE_SQUARE); } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 0b81462cd8a..fc4835b09b7 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,6 +1,13 @@ 2019-04-30 Jakub Jelinek Backported from mainline + 2019-03-21 Jakub Jelinek + + PR c++/89767 + * g++.dg/cpp1y/lambda-init18.C: New test. + * g++.dg/cpp1y/lambda-init19.C: New test. + * g++.dg/cpp1y/pr89767.C: New test. + 2019-03-19 Jakub Jelinek PR target/89752 diff --git a/gcc/testsuite/g++.dg/cpp1y/lambda-init18.C b/gcc/testsuite/g++.dg/cpp1y/lambda-init18.C new file mode 100644 index 00000000000..5a866009e78 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/lambda-init18.C @@ -0,0 +1,12 @@ +// PR c++/89767 +// { dg-do compile { target c++14 } } + +void bar (int); + +void +foo () +{ + int x = 0; + auto z = [x, y = [x] { bar (x); }] { y (); bar (x); }; + z (); +} diff --git a/gcc/testsuite/g++.dg/cpp1y/lambda-init19.C b/gcc/testsuite/g++.dg/cpp1y/lambda-init19.C new file mode 100644 index 00000000000..830ecc03a08 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/lambda-init19.C @@ -0,0 +1,15 @@ +// PR c++/89767 +// { dg-do compile { target c++14 } } + +void bar (int); + +void +foo () +{ + int x = 0; + int a = 0, b = 0, c = 0, d = 0, e = 0, f = 0, g = 0, h = 0; + auto z = [x, y = [x] { bar (x); }, x] { y (); bar (x); }; // { dg-error "already captured 'x' in lambda expression" } + auto w = [x, a, b, c, d, y = [x] { bar (x); }, e, f, g, h, x] { y (); bar (x + a + b + c + d + e + f + g + h); }; // { dg-error "already captured 'x' in lambda expression" } + z (); + w (); +} diff --git a/gcc/testsuite/g++.dg/cpp1y/pr89767.C b/gcc/testsuite/g++.dg/cpp1y/pr89767.C new file mode 100644 index 00000000000..108de51926e --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/pr89767.C @@ -0,0 +1,32 @@ +// PR c++/89767 +// { dg-do compile { target c++14 } } +// { dg-options "-O2 -Wall" } + +template struct e { using g = d; }; +template class> using h = e; +template class i> +using j = typename h::g; +template int k(c); +template class au; +struct l { template using m = typename c::f; }; +struct s : l { using af = j *, m>; }; +template struct o; +template using q = typename o::g; +template struct r; +template struct r { typedef c aj; }; +template struct al { typename r::aj operator*(); void operator++(); }; +template +bool operator!=(al, al); +template struct ap; +template +struct ap : ap<1, as...> {}; +template struct ap {}; +template class au : public ap<0, at...> {}; +template +struct o> : o

> {}; +template struct o<0, au> { typedef ar g; }; +template constexpr ar av(ap __t) { return ar (); } +template constexpr q> aw(au __t) { av

(__t); return q> (); } +struct bg { typedef s::af af; }; +struct F { typedef al bk; bk begin(); bk end(); }; +void bo() { int t = 0; F cv; for (auto bp : cv) [t, n = k(aw<1>(bp))] {}; } -- cgit v1.2.3 From a50098076ad2a29986d3058622737a258b74b4ef Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 30 Apr 2019 20:52:54 +0000 Subject: Backported from mainline 2019-03-22 Jakub Jelinek PR c++/60702 * cp-tree.h (get_tls_wrapper_fn): Remove declaration. (maybe_get_tls_wrapper_call): Declare. * decl2.c (get_tls_wrapper_fn): Make static. (maybe_get_tls_wrapper_call): New function. * typeck.c (build_class_member_access_expr): Handle accesses to TLS variables. * semantics.c (finish_qualified_id_expr): Likewise. (finish_id_expression_1): Use maybe_get_tls_wrapper_call. * pt.c (tsubst_copy_and_build): Likewise. * g++.dg/tls/thread_local11.C: New test. * g++.dg/tls/thread_local11.h: New test. * g++.dg/tls/thread_local12a.C: New test. * g++.dg/tls/thread_local12b.C: New test. * g++.dg/tls/thread_local12c.C: New test. * g++.dg/tls/thread_local12d.C: New test. * g++.dg/tls/thread_local12e.C: New test. * g++.dg/tls/thread_local12f.C: New test. * g++.dg/tls/thread_local12g.C: New test. * g++.dg/tls/thread_local12h.C: New test. * g++.dg/tls/thread_local12i.C: New test. * g++.dg/tls/thread_local12j.C: New test. * g++.dg/tls/thread_local12k.C: New test. * g++.dg/tls/thread_local12l.C: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270739 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cp/ChangeLog | 13 ++++++++ gcc/cp/cp-tree.h | 2 +- gcc/cp/decl2.c | 18 ++++++++++- gcc/cp/pt.c | 15 +++------- gcc/cp/semantics.c | 18 ++++------- gcc/cp/typeck.c | 6 ++++ gcc/testsuite/ChangeLog | 18 +++++++++++ gcc/testsuite/g++.dg/tls/thread_local11.C | 48 ++++++++++++++++++++++++++++++ gcc/testsuite/g++.dg/tls/thread_local11.h | 26 ++++++++++++++++ gcc/testsuite/g++.dg/tls/thread_local12a.C | 12 ++++++++ gcc/testsuite/g++.dg/tls/thread_local12b.C | 12 ++++++++ gcc/testsuite/g++.dg/tls/thread_local12c.C | 12 ++++++++ gcc/testsuite/g++.dg/tls/thread_local12d.C | 12 ++++++++ gcc/testsuite/g++.dg/tls/thread_local12e.C | 12 ++++++++ gcc/testsuite/g++.dg/tls/thread_local12f.C | 12 ++++++++ gcc/testsuite/g++.dg/tls/thread_local12g.C | 12 ++++++++ gcc/testsuite/g++.dg/tls/thread_local12h.C | 12 ++++++++ gcc/testsuite/g++.dg/tls/thread_local12i.C | 12 ++++++++ gcc/testsuite/g++.dg/tls/thread_local12j.C | 12 ++++++++ gcc/testsuite/g++.dg/tls/thread_local12k.C | 12 ++++++++ gcc/testsuite/g++.dg/tls/thread_local12l.C | 12 ++++++++ 21 files changed, 283 insertions(+), 25 deletions(-) create mode 100644 gcc/testsuite/g++.dg/tls/thread_local11.C create mode 100644 gcc/testsuite/g++.dg/tls/thread_local11.h create mode 100644 gcc/testsuite/g++.dg/tls/thread_local12a.C create mode 100644 gcc/testsuite/g++.dg/tls/thread_local12b.C create mode 100644 gcc/testsuite/g++.dg/tls/thread_local12c.C create mode 100644 gcc/testsuite/g++.dg/tls/thread_local12d.C create mode 100644 gcc/testsuite/g++.dg/tls/thread_local12e.C create mode 100644 gcc/testsuite/g++.dg/tls/thread_local12f.C create mode 100644 gcc/testsuite/g++.dg/tls/thread_local12g.C create mode 100644 gcc/testsuite/g++.dg/tls/thread_local12h.C create mode 100644 gcc/testsuite/g++.dg/tls/thread_local12i.C create mode 100644 gcc/testsuite/g++.dg/tls/thread_local12j.C create mode 100644 gcc/testsuite/g++.dg/tls/thread_local12k.C create mode 100644 gcc/testsuite/g++.dg/tls/thread_local12l.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index d45898f9995..e39566c977c 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,6 +1,19 @@ 2019-04-30 Jakub Jelinek Backported from mainline + 2019-03-22 Jakub Jelinek + + PR c++/60702 + * cp-tree.h (get_tls_wrapper_fn): Remove declaration. + (maybe_get_tls_wrapper_call): Declare. + * decl2.c (get_tls_wrapper_fn): Make static. + (maybe_get_tls_wrapper_call): New function. + * typeck.c (build_class_member_access_expr): Handle accesses to TLS + variables. + * semantics.c (finish_qualified_id_expr): Likewise. + (finish_id_expression_1): Use maybe_get_tls_wrapper_call. + * pt.c (tsubst_copy_and_build): Likewise. + 2019-03-21 Jakub Jelinek PR c++/89767 diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index 0f24b4fc945..c519c8ede2e 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -6390,7 +6390,7 @@ extern tree cp_build_parm_decl (tree, tree, tree); extern tree get_guard (tree); extern tree get_guard_cond (tree, bool); extern tree set_guard (tree); -extern tree get_tls_wrapper_fn (tree); +extern tree maybe_get_tls_wrapper_call (tree); extern void mark_needed (tree); extern bool decl_needed_p (tree); extern void note_vague_linkage_fn (tree); diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index 2bff2f0b27b..c977e288d11 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -3357,7 +3357,7 @@ get_tls_init_fn (tree var) VAR and then returns a reference to VAR. The wrapper function is used in place of VAR everywhere VAR is mentioned. */ -tree +static tree get_tls_wrapper_fn (tree var) { /* Only C++11 TLS vars need this wrapper fn. */ @@ -3409,6 +3409,22 @@ get_tls_wrapper_fn (tree var) return fn; } +/* If EXPR is a thread_local variable that should be wrapped by init + wrapper function, return a call to that function, otherwise return + NULL. */ + +tree +maybe_get_tls_wrapper_call (tree expr) +{ + if (VAR_P (expr) + && !processing_template_decl + && !cp_unevaluated_operand + && CP_DECL_THREAD_LOCAL_P (expr)) + if (tree wrap = get_tls_wrapper_fn (expr)) + return build_cxx_call (wrap, 0, NULL, tf_warning_or_error); + return NULL; +} + /* At EOF, generate the definition for the TLS wrapper function FN: T& var_wrapper() { diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index d0001c4895b..db27ad28f3b 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -18894,17 +18894,10 @@ tsubst_copy_and_build (tree t, { tree r = tsubst_copy (t, args, complain, in_decl); /* ??? We're doing a subset of finish_id_expression here. */ - if (VAR_P (r) - && !processing_template_decl - && !cp_unevaluated_operand - && (TREE_STATIC (r) || DECL_EXTERNAL (r)) - && CP_DECL_THREAD_LOCAL_P (r)) - { - if (tree wrap = get_tls_wrapper_fn (r)) - /* Replace an evaluated use of the thread_local variable with - a call to its wrapper. */ - r = build_cxx_call (wrap, 0, NULL, tf_warning_or_error); - } + if (tree wrap = maybe_get_tls_wrapper_call (r)) + /* Replace an evaluated use of the thread_local variable with + a call to its wrapper. */ + r = wrap; else if (outer_automatic_var_p (r)) r = process_outer_var_ref (r, complain); diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 22bc6a5b597..84a83eb70ba 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -2125,6 +2125,8 @@ finish_qualified_id_expr (tree qualifying_class, expr = build_qualified_name (TREE_TYPE (expr), qualifying_class, expr, template_p); + else if (tree wrap = maybe_get_tls_wrapper_call (expr)) + expr = wrap; expr = convert_from_reference (expr); } @@ -3720,18 +3722,10 @@ finish_id_expression (tree id_expression, *non_integral_constant_expression_p = true; } - tree wrap; - if (VAR_P (decl) - && !cp_unevaluated_operand - && !processing_template_decl - && (TREE_STATIC (decl) || DECL_EXTERNAL (decl)) - && CP_DECL_THREAD_LOCAL_P (decl) - && (wrap = get_tls_wrapper_fn (decl))) - { - /* Replace an evaluated use of the thread_local variable with - a call to its wrapper. */ - decl = build_cxx_call (wrap, 0, NULL, tf_warning_or_error); - } + if (tree wrap = maybe_get_tls_wrapper_call (decl)) + /* Replace an evaluated use of the thread_local variable with + a call to its wrapper. */ + decl = wrap; else if (TREE_CODE (decl) == TEMPLATE_ID_EXPR && !dependent_p && variable_template_p (TREE_OPERAND (decl, 0))) diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index afc1fd795b2..719535549e4 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -2437,6 +2437,12 @@ build_class_member_access_expr (cp_expr object, tree member, /* A static data member. */ result = member; mark_exp_read (object); + + if (tree wrap = maybe_get_tls_wrapper_call (result)) + /* Replace an evaluated use of the thread_local variable with + a call to its wrapper. */ + result = wrap; + /* If OBJECT has side-effects, they are supposed to occur. */ if (TREE_SIDE_EFFECTS (object)) result = build2 (COMPOUND_EXPR, TREE_TYPE (result), object, result); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index fc4835b09b7..d217e1872be 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,6 +1,24 @@ 2019-04-30 Jakub Jelinek Backported from mainline + 2019-03-22 Jakub Jelinek + + PR c++/60702 + * g++.dg/tls/thread_local11.C: New test. + * g++.dg/tls/thread_local11.h: New test. + * g++.dg/tls/thread_local12a.C: New test. + * g++.dg/tls/thread_local12b.C: New test. + * g++.dg/tls/thread_local12c.C: New test. + * g++.dg/tls/thread_local12d.C: New test. + * g++.dg/tls/thread_local12e.C: New test. + * g++.dg/tls/thread_local12f.C: New test. + * g++.dg/tls/thread_local12g.C: New test. + * g++.dg/tls/thread_local12h.C: New test. + * g++.dg/tls/thread_local12i.C: New test. + * g++.dg/tls/thread_local12j.C: New test. + * g++.dg/tls/thread_local12k.C: New test. + * g++.dg/tls/thread_local12l.C: New test. + 2019-03-21 Jakub Jelinek PR c++/89767 diff --git a/gcc/testsuite/g++.dg/tls/thread_local11.C b/gcc/testsuite/g++.dg/tls/thread_local11.C new file mode 100644 index 00000000000..036d91ac41e --- /dev/null +++ b/gcc/testsuite/g++.dg/tls/thread_local11.C @@ -0,0 +1,48 @@ +// PR c++/60702 +// { dg-do compile { target c++11 } } +// { dg-add-options tls } +// { dg-require-effective-target tls_runtime } +// { dg-additional-options "-fdump-tree-gimple" } +// { dg-final { scan-tree-dump-times "_ZTW2s1" 2 "gimple" } } +// { dg-final { scan-tree-dump-times "_ZTW2s2" 2 "gimple" } } +// { dg-final { scan-tree-dump-times "_ZTW2s3" 2 "gimple" } } +// { dg-final { scan-tree-dump-times "_ZTW2s4" 2 "gimple" } } +// { dg-final { scan-tree-dump-times "_ZTWN1T2u1E" 2 "gimple" } } +// { dg-final { scan-tree-dump-times "_ZTWN1T2u2E" 2 "gimple" } } +// { dg-final { scan-tree-dump-times "_ZTWN1T2u3E" 2 "gimple" } } +// { dg-final { scan-tree-dump-times "_ZTWN1T2u4E" 2 "gimple" } } +// { dg-final { scan-tree-dump-times "_ZTWN1T2u5E" 2 "gimple" } } +// { dg-final { scan-tree-dump-times "_ZTWN1T2u6E" 2 "gimple" } } +// { dg-final { scan-tree-dump-times "_ZTWN1T2u7E" 2 "gimple" } } +// { dg-final { scan-tree-dump-times "_ZTWN1T2u8E" 2 "gimple" } } +// { dg-final { scan-tree-dump-times "_ZTH2s1" 1 "gimple" } } +// { dg-final { scan-tree-dump-times "_ZTH2s2" 1 "gimple" } } +// { dg-final { scan-tree-dump-times "_ZTH2s3" 1 "gimple" } } +// { dg-final { scan-tree-dump-times "_ZTH2s4" 1 "gimple" } } +// { dg-final { scan-tree-dump-times "_ZTHN1T2u1E" 1 "gimple" } } +// { dg-final { scan-tree-dump-times "_ZTHN1T2u2E" 1 "gimple" } } +// { dg-final { scan-tree-dump-times "_ZTHN1T2u3E" 1 "gimple" } } +// { dg-final { scan-tree-dump-times "_ZTHN1T2u4E" 1 "gimple" } } +// { dg-final { scan-tree-dump-times "_ZTHN1T2u5E" 1 "gimple" } } +// { dg-final { scan-tree-dump-times "_ZTHN1T2u6E" 1 "gimple" } } +// { dg-final { scan-tree-dump-times "_ZTHN1T2u7E" 1 "gimple" } } +// { dg-final { scan-tree-dump-times "_ZTHN1T2u8E" 1 "gimple" } } + +#include "thread_local11.h" + +void +foo () +{ + f1 (); + f2 (); + f3 (); + f4 (); + f5 (); + f6 (); + f7<0> (); + f8<0> (); + f9<0> (); + f10<0> (); + f11<0> (); + f12<0> (); +} diff --git a/gcc/testsuite/g++.dg/tls/thread_local11.h b/gcc/testsuite/g++.dg/tls/thread_local11.h new file mode 100644 index 00000000000..761b42dfe60 --- /dev/null +++ b/gcc/testsuite/g++.dg/tls/thread_local11.h @@ -0,0 +1,26 @@ +// PR c++/60702 + +extern "C" void abort (); +struct S { S () { i = 42; }; int i; }; +thread_local S s1, s2, s3, s4; +struct T { static thread_local S u1, u2, u3, u4, u5, u6, u7, u8; int i; } t; +thread_local S T::u1, T::u2, T::u3, T::u4, T::u5, T::u6, T::u7, T::u8; + +S *f1 () { return &s1; } +int *f2 () { return &s2.i; } +S *f3 () { return &t.u1; } +int *f4 () { return &t.u2.i; } +S *f5 () { return &T::u3; } +int *f6 () { return &T::u4.i; } +template +S *f7 () { return &s3; } +template +int *f8 () { return &s4.i; } +template +S *f9 () { return &t.u5; } +template +int *f10 () { return &t.u6.i; } +template +S *f11 () { return &T::u7; } +template +int *f12 () { return &T::u8.i; } diff --git a/gcc/testsuite/g++.dg/tls/thread_local12a.C b/gcc/testsuite/g++.dg/tls/thread_local12a.C new file mode 100644 index 00000000000..87a17160d0a --- /dev/null +++ b/gcc/testsuite/g++.dg/tls/thread_local12a.C @@ -0,0 +1,12 @@ +// PR c++/60702 +// { dg-do run { target c++11 } } +// { dg-add-options tls } +// { dg-require-effective-target tls_runtime } + +#include "thread_local11.h" + +int +main () +{ + if (f1 ()->i != 42) abort (); +} diff --git a/gcc/testsuite/g++.dg/tls/thread_local12b.C b/gcc/testsuite/g++.dg/tls/thread_local12b.C new file mode 100644 index 00000000000..498bacec99a --- /dev/null +++ b/gcc/testsuite/g++.dg/tls/thread_local12b.C @@ -0,0 +1,12 @@ +// PR c++/60702 +// { dg-do run { target c++11 } } +// { dg-add-options tls } +// { dg-require-effective-target tls_runtime } + +#include "thread_local11.h" + +int +main () +{ + if (*f2 () != 42) abort (); +} diff --git a/gcc/testsuite/g++.dg/tls/thread_local12c.C b/gcc/testsuite/g++.dg/tls/thread_local12c.C new file mode 100644 index 00000000000..92add8f7db9 --- /dev/null +++ b/gcc/testsuite/g++.dg/tls/thread_local12c.C @@ -0,0 +1,12 @@ +// PR c++/60702 +// { dg-do run { target c++11 } } +// { dg-add-options tls } +// { dg-require-effective-target tls_runtime } + +#include "thread_local11.h" + +int +main () +{ + if (f3 ()->i != 42) abort (); +} diff --git a/gcc/testsuite/g++.dg/tls/thread_local12d.C b/gcc/testsuite/g++.dg/tls/thread_local12d.C new file mode 100644 index 00000000000..78631366ba4 --- /dev/null +++ b/gcc/testsuite/g++.dg/tls/thread_local12d.C @@ -0,0 +1,12 @@ +// PR c++/60702 +// { dg-do run { target c++11 } } +// { dg-add-options tls } +// { dg-require-effective-target tls_runtime } + +#include "thread_local11.h" + +int +main () +{ + if (*f4 () != 42) abort (); +} diff --git a/gcc/testsuite/g++.dg/tls/thread_local12e.C b/gcc/testsuite/g++.dg/tls/thread_local12e.C new file mode 100644 index 00000000000..95c44f76a05 --- /dev/null +++ b/gcc/testsuite/g++.dg/tls/thread_local12e.C @@ -0,0 +1,12 @@ +// PR c++/60702 +// { dg-do run { target c++11 } } +// { dg-add-options tls } +// { dg-require-effective-target tls_runtime } + +#include "thread_local11.h" + +int +main () +{ + if (f5 ()->i != 42) abort (); +} diff --git a/gcc/testsuite/g++.dg/tls/thread_local12f.C b/gcc/testsuite/g++.dg/tls/thread_local12f.C new file mode 100644 index 00000000000..e7795dc060b --- /dev/null +++ b/gcc/testsuite/g++.dg/tls/thread_local12f.C @@ -0,0 +1,12 @@ +// PR c++/60702 +// { dg-do run { target c++11 } } +// { dg-add-options tls } +// { dg-require-effective-target tls_runtime } + +#include "thread_local11.h" + +int +main () +{ + if (*f6 () != 42) abort (); +} diff --git a/gcc/testsuite/g++.dg/tls/thread_local12g.C b/gcc/testsuite/g++.dg/tls/thread_local12g.C new file mode 100644 index 00000000000..c7c964a053d --- /dev/null +++ b/gcc/testsuite/g++.dg/tls/thread_local12g.C @@ -0,0 +1,12 @@ +// PR c++/60702 +// { dg-do run { target c++11 } } +// { dg-add-options tls } +// { dg-require-effective-target tls_runtime } + +#include "thread_local11.h" + +int +main () +{ + if (f7<0> ()->i != 42) abort (); +} diff --git a/gcc/testsuite/g++.dg/tls/thread_local12h.C b/gcc/testsuite/g++.dg/tls/thread_local12h.C new file mode 100644 index 00000000000..32b6841d6b8 --- /dev/null +++ b/gcc/testsuite/g++.dg/tls/thread_local12h.C @@ -0,0 +1,12 @@ +// PR c++/60702 +// { dg-do run { target c++11 } } +// { dg-add-options tls } +// { dg-require-effective-target tls_runtime } + +#include "thread_local11.h" + +int +main () +{ + if (*f8<0> () != 42) abort (); +} diff --git a/gcc/testsuite/g++.dg/tls/thread_local12i.C b/gcc/testsuite/g++.dg/tls/thread_local12i.C new file mode 100644 index 00000000000..815e14eaa69 --- /dev/null +++ b/gcc/testsuite/g++.dg/tls/thread_local12i.C @@ -0,0 +1,12 @@ +// PR c++/60702 +// { dg-do run { target c++11 } } +// { dg-add-options tls } +// { dg-require-effective-target tls_runtime } + +#include "thread_local11.h" + +int +main () +{ + if (f9<0> ()->i != 42) abort (); +} diff --git a/gcc/testsuite/g++.dg/tls/thread_local12j.C b/gcc/testsuite/g++.dg/tls/thread_local12j.C new file mode 100644 index 00000000000..0009de15e0e --- /dev/null +++ b/gcc/testsuite/g++.dg/tls/thread_local12j.C @@ -0,0 +1,12 @@ +// PR c++/60702 +// { dg-do run { target c++11 } } +// { dg-add-options tls } +// { dg-require-effective-target tls_runtime } + +#include "thread_local11.h" + +int +main () +{ + if (*f10<0> () != 42) abort (); +} diff --git a/gcc/testsuite/g++.dg/tls/thread_local12k.C b/gcc/testsuite/g++.dg/tls/thread_local12k.C new file mode 100644 index 00000000000..589e87226ab --- /dev/null +++ b/gcc/testsuite/g++.dg/tls/thread_local12k.C @@ -0,0 +1,12 @@ +// PR c++/60702 +// { dg-do run { target c++11 } } +// { dg-add-options tls } +// { dg-require-effective-target tls_runtime } + +#include "thread_local11.h" + +int +main () +{ + if (f11<0> ()->i != 42) abort (); +} diff --git a/gcc/testsuite/g++.dg/tls/thread_local12l.C b/gcc/testsuite/g++.dg/tls/thread_local12l.C new file mode 100644 index 00000000000..273e1be020d --- /dev/null +++ b/gcc/testsuite/g++.dg/tls/thread_local12l.C @@ -0,0 +1,12 @@ +// PR c++/60702 +// { dg-do run { target c++11 } } +// { dg-add-options tls } +// { dg-require-effective-target tls_runtime } + +#include "thread_local11.h" + +int +main () +{ + if (*f12<0> () != 42) abort (); +} -- cgit v1.2.3 From 0fd1fa1dd3f219b4e33f27925710684fc475a907 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 30 Apr 2019 20:53:29 +0000 Subject: Backported from mainline 2019-03-25 Jakub Jelinek PR c++/60702 * g++.dg/tls/thread_local11.C: Remove scan-tree-dump-times directives for _ZTH* calls. * g++.dg/tls/thread_local11a.C: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270740 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/testsuite/ChangeLog | 7 +++++++ gcc/testsuite/g++.dg/tls/thread_local11.C | 12 ------------ gcc/testsuite/g++.dg/tls/thread_local11a.C | 20 ++++++++++++++++++++ 3 files changed, 27 insertions(+), 12 deletions(-) create mode 100644 gcc/testsuite/g++.dg/tls/thread_local11a.C diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index d217e1872be..487f1d85bad 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,6 +1,13 @@ 2019-04-30 Jakub Jelinek Backported from mainline + 2019-03-25 Jakub Jelinek + + PR c++/60702 + * g++.dg/tls/thread_local11.C: Remove scan-tree-dump-times directives + for _ZTH* calls. + * g++.dg/tls/thread_local11a.C: New test. + 2019-03-22 Jakub Jelinek PR c++/60702 diff --git a/gcc/testsuite/g++.dg/tls/thread_local11.C b/gcc/testsuite/g++.dg/tls/thread_local11.C index 036d91ac41e..273ee03d702 100644 --- a/gcc/testsuite/g++.dg/tls/thread_local11.C +++ b/gcc/testsuite/g++.dg/tls/thread_local11.C @@ -15,18 +15,6 @@ // { dg-final { scan-tree-dump-times "_ZTWN1T2u6E" 2 "gimple" } } // { dg-final { scan-tree-dump-times "_ZTWN1T2u7E" 2 "gimple" } } // { dg-final { scan-tree-dump-times "_ZTWN1T2u8E" 2 "gimple" } } -// { dg-final { scan-tree-dump-times "_ZTH2s1" 1 "gimple" } } -// { dg-final { scan-tree-dump-times "_ZTH2s2" 1 "gimple" } } -// { dg-final { scan-tree-dump-times "_ZTH2s3" 1 "gimple" } } -// { dg-final { scan-tree-dump-times "_ZTH2s4" 1 "gimple" } } -// { dg-final { scan-tree-dump-times "_ZTHN1T2u1E" 1 "gimple" } } -// { dg-final { scan-tree-dump-times "_ZTHN1T2u2E" 1 "gimple" } } -// { dg-final { scan-tree-dump-times "_ZTHN1T2u3E" 1 "gimple" } } -// { dg-final { scan-tree-dump-times "_ZTHN1T2u4E" 1 "gimple" } } -// { dg-final { scan-tree-dump-times "_ZTHN1T2u5E" 1 "gimple" } } -// { dg-final { scan-tree-dump-times "_ZTHN1T2u6E" 1 "gimple" } } -// { dg-final { scan-tree-dump-times "_ZTHN1T2u7E" 1 "gimple" } } -// { dg-final { scan-tree-dump-times "_ZTHN1T2u8E" 1 "gimple" } } #include "thread_local11.h" diff --git a/gcc/testsuite/g++.dg/tls/thread_local11a.C b/gcc/testsuite/g++.dg/tls/thread_local11a.C new file mode 100644 index 00000000000..d8c4a6dc0ab --- /dev/null +++ b/gcc/testsuite/g++.dg/tls/thread_local11a.C @@ -0,0 +1,20 @@ +// PR c++/60702 +// { dg-do compile { target c++11 } } +// { dg-add-options tls } +// { dg-require-alias "" } +// { dg-require-effective-target tls_runtime } +// { dg-additional-options "-fdump-tree-gimple" } +// { dg-final { scan-tree-dump-times "_ZTH2s1" 1 "gimple" } } +// { dg-final { scan-tree-dump-times "_ZTH2s2" 1 "gimple" } } +// { dg-final { scan-tree-dump-times "_ZTH2s3" 1 "gimple" } } +// { dg-final { scan-tree-dump-times "_ZTH2s4" 1 "gimple" } } +// { dg-final { scan-tree-dump-times "_ZTHN1T2u1E" 1 "gimple" } } +// { dg-final { scan-tree-dump-times "_ZTHN1T2u2E" 1 "gimple" } } +// { dg-final { scan-tree-dump-times "_ZTHN1T2u3E" 1 "gimple" } } +// { dg-final { scan-tree-dump-times "_ZTHN1T2u4E" 1 "gimple" } } +// { dg-final { scan-tree-dump-times "_ZTHN1T2u5E" 1 "gimple" } } +// { dg-final { scan-tree-dump-times "_ZTHN1T2u6E" 1 "gimple" } } +// { dg-final { scan-tree-dump-times "_ZTHN1T2u7E" 1 "gimple" } } +// { dg-final { scan-tree-dump-times "_ZTHN1T2u8E" 1 "gimple" } } + +#include "thread_local11.C" -- cgit v1.2.3 From d34883b21ed37efeed680963e785b6aed0f48cb0 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 30 Apr 2019 20:54:16 +0000 Subject: Backported from mainline 2019-03-26 Jakub Jelinek PR c++/89796 * semantics.c (finish_omp_atomic): Add warning_sentinel for -Wunused-value around finish_expr_stmt call. * g++.dg/gomp/pr89796.C: New test. * gcc.dg/gomp/pr89796.c: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270741 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cp/ChangeLog | 6 +++++ gcc/cp/semantics.c | 5 ++++ gcc/testsuite/ChangeLog | 6 +++++ gcc/testsuite/g++.dg/gomp/pr89796.C | 53 +++++++++++++++++++++++++++++++++++++ gcc/testsuite/gcc.dg/gomp/pr89796.c | 23 ++++++++++++++++ 5 files changed, 93 insertions(+) create mode 100644 gcc/testsuite/g++.dg/gomp/pr89796.C create mode 100644 gcc/testsuite/gcc.dg/gomp/pr89796.c diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index e39566c977c..d8904c6e8ab 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,6 +1,12 @@ 2019-04-30 Jakub Jelinek Backported from mainline + 2019-03-26 Jakub Jelinek + + PR c++/89796 + * semantics.c (finish_omp_atomic): Add warning_sentinel for + -Wunused-value around finish_expr_stmt call. + 2019-03-22 Jakub Jelinek PR c++/60702 diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 84a83eb70ba..2b803249904 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -8462,6 +8462,11 @@ finish_omp_atomic (enum tree_code code, enum tree_code opcode, tree lhs, stmt = build2 (OMP_ATOMIC, void_type_node, integer_zero_node, stmt); OMP_ATOMIC_SEQ_CST (stmt) = seq_cst; } + + /* Avoid -Wunused-value warnings here, the whole construct has side-effects + and even if it might be wrapped from fold-const.c or c-omp.c wrapped + in some tree that appears to be unused, the value is not unused. */ + warning_sentinel w (warn_unused_value); finish_expr_stmt (stmt); } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 487f1d85bad..a05a682e012 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,6 +1,12 @@ 2019-04-30 Jakub Jelinek Backported from mainline + 2019-03-26 Jakub Jelinek + + PR c++/89796 + * g++.dg/gomp/pr89796.C: New test. + * gcc.dg/gomp/pr89796.c: New test. + 2019-03-25 Jakub Jelinek PR c++/60702 diff --git a/gcc/testsuite/g++.dg/gomp/pr89796.C b/gcc/testsuite/g++.dg/gomp/pr89796.C new file mode 100644 index 00000000000..6bbc34eae32 --- /dev/null +++ b/gcc/testsuite/g++.dg/gomp/pr89796.C @@ -0,0 +1,53 @@ +// PR c++/89796 +// { dg-do compile } +// { dg-additional-options "-Wunused-value" } + +int +f1 (int &c) +{ + int r; + #pragma omp atomic capture // { dg-bogus "value computed is not used" } + { r = c; c++; } + return r; +} + +template +int +f2 (int &c) +{ + int r; + #pragma omp atomic capture // { dg-bogus "value computed is not used" } + { r = c; c++; } + return r; +} + +int +f3 (int &c) +{ + return f2 <0> (c); +} + +int +f4 (int *p) +{ + int r; + #pragma omp atomic capture // { dg-bogus "value computed is not used" } + { r = *p; (*p)++; } + return r; +} + +template +int +f5 (int *p) +{ + int r; + #pragma omp atomic capture // { dg-bogus "value computed is not used" } + { r = *p; (*p)++; } + return r; +} + +int +f6 (int *p) +{ + return f5 <0> (p); +} diff --git a/gcc/testsuite/gcc.dg/gomp/pr89796.c b/gcc/testsuite/gcc.dg/gomp/pr89796.c new file mode 100644 index 00000000000..14f509311fa --- /dev/null +++ b/gcc/testsuite/gcc.dg/gomp/pr89796.c @@ -0,0 +1,23 @@ +/* PR c++/89796 */ +/* { dg-do compile } */ +/* { dg-additional-options "-Wunused-value" } */ + +int +f1 (int *p) +{ + int r; + #pragma omp atomic capture /* { dg-bogus "value computed is not used" } */ + { r = *p; (*p)++; } + return r; +} + +int +f2 (int *p) +{ + int s + = ({ int r; + #pragma omp atomic capture /* { dg-bogus "value computed is not used" } */ + { r = *p; (*p)++; } + r; }); + return s; +} -- cgit v1.2.3 From d95a9d4926e0e9a033ddc9c67f969c0fced17b98 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 30 Apr 2019 20:55:14 +0000 Subject: Backported from mainline 2019-03-28 Jakub Jelinek PR middle-end/89621 * tree-inline.h (struct copy_body_data): Add dont_remap_vla_if_no_change flag. * tree-inline.c (remap_type_3, remap_type_2): New functions. (remap_type): Don't remap vla types if id->dont_remap_vla_if_no_change and remap_type_2 returns false. * omp-low.c (new_omp_context): Set ctx->cb.dont_remap_vla_if_no_change. * gfortran.dg/gomp/pr89621.f90: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270742 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 10 ++++ gcc/omp-low.c | 1 + gcc/testsuite/ChangeLog | 5 ++ gcc/testsuite/gfortran.dg/gomp/pr89621.f90 | 18 ++++++ gcc/tree-inline.c | 91 +++++++++++++++++++++++++++++- gcc/tree-inline.h | 7 +++ 6 files changed, 131 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gfortran.dg/gomp/pr89621.f90 diff --git a/gcc/ChangeLog b/gcc/ChangeLog index fb3a6d53fbb..9a543943783 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,6 +1,16 @@ 2019-04-30 Jakub Jelinek Backported from mainline + 2019-03-28 Jakub Jelinek + + PR middle-end/89621 + * tree-inline.h (struct copy_body_data): Add + dont_remap_vla_if_no_change flag. + * tree-inline.c (remap_type_3, remap_type_2): New functions. + (remap_type): Don't remap vla types if id->dont_remap_vla_if_no_change + and remap_type_2 returns false. + * omp-low.c (new_omp_context): Set ctx->cb.dont_remap_vla_if_no_change. + 2019-03-20 Jakub Jelinek PR target/89752 diff --git a/gcc/omp-low.c b/gcc/omp-low.c index 144076f080c..102a998146d 100644 --- a/gcc/omp-low.c +++ b/gcc/omp-low.c @@ -851,6 +851,7 @@ new_omp_context (gimple *stmt, omp_context *outer_ctx) ctx->cb.copy_decl = omp_copy_decl; ctx->cb.eh_lp_nr = 0; ctx->cb.transform_call_graph_edges = CB_CGE_MOVE; + ctx->cb.dont_remap_vla_if_no_change = true; ctx->depth = 1; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index a05a682e012..21f4ee6b5b1 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,6 +1,11 @@ 2019-04-30 Jakub Jelinek Backported from mainline + 2019-03-28 Jakub Jelinek + + PR middle-end/89621 + * gfortran.dg/gomp/pr89621.f90: New test. + 2019-03-26 Jakub Jelinek PR c++/89796 diff --git a/gcc/testsuite/gfortran.dg/gomp/pr89621.f90 b/gcc/testsuite/gfortran.dg/gomp/pr89621.f90 new file mode 100644 index 00000000000..24ac18c061b --- /dev/null +++ b/gcc/testsuite/gfortran.dg/gomp/pr89621.f90 @@ -0,0 +1,18 @@ +! PR middle-end/89621 +! { dg-do compile } + +subroutine sub(str) + character(*), intent(in) :: str +end subroutine sub + +program pr89621 + implicit none + integer i + character(len=:), allocatable :: str + str = "test" + !$omp parallel do + do i = 1, 10 + call sub(str) + enddo + !$omp end parallel do +end program pr89621 diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c index f7a3216d792..c9ff5a2afc2 100644 --- a/gcc/tree-inline.c +++ b/gcc/tree-inline.c @@ -578,6 +578,92 @@ remap_type_1 (tree type, copy_body_data *id) return new_tree; } +/* Helper function for remap_type_2, called through walk_tree. */ + +static tree +remap_type_3 (tree *tp, int *walk_subtrees, void *data) +{ + copy_body_data *id = (copy_body_data *) data; + + if (TYPE_P (*tp)) + *walk_subtrees = 0; + + else if (DECL_P (*tp) && remap_decl (*tp, id) != *tp) + return *tp; + + return NULL_TREE; +} + +/* Return true if TYPE needs to be remapped because remap_decl on any + needed embedded decl returns something other than that decl. */ + +static bool +remap_type_2 (tree type, copy_body_data *id) +{ + tree t; + +#define RETURN_TRUE_IF_VAR(T) \ + do \ + { \ + tree _t = (T); \ + if (_t) \ + { \ + if (DECL_P (_t) && remap_decl (_t, id) != _t) \ + return true; \ + if (!TYPE_SIZES_GIMPLIFIED (type) \ + && walk_tree (&_t, remap_type_3, id, NULL)) \ + return true; \ + } \ + } \ + while (0) + + switch (TREE_CODE (type)) + { + case POINTER_TYPE: + case REFERENCE_TYPE: + case FUNCTION_TYPE: + case METHOD_TYPE: + return remap_type_2 (TREE_TYPE (type), id); + + case INTEGER_TYPE: + case REAL_TYPE: + case FIXED_POINT_TYPE: + case ENUMERAL_TYPE: + case BOOLEAN_TYPE: + RETURN_TRUE_IF_VAR (TYPE_MIN_VALUE (type)); + RETURN_TRUE_IF_VAR (TYPE_MAX_VALUE (type)); + return false; + + case ARRAY_TYPE: + if (remap_type_2 (TREE_TYPE (type), id) + || (TYPE_DOMAIN (type) && remap_type_2 (TYPE_DOMAIN (type), id))) + return true; + break; + + case RECORD_TYPE: + case UNION_TYPE: + case QUAL_UNION_TYPE: + for (t = TYPE_FIELDS (type); t; t = DECL_CHAIN (t)) + if (TREE_CODE (t) == FIELD_DECL) + { + RETURN_TRUE_IF_VAR (DECL_FIELD_OFFSET (t)); + RETURN_TRUE_IF_VAR (DECL_SIZE (t)); + RETURN_TRUE_IF_VAR (DECL_SIZE_UNIT (t)); + if (TREE_CODE (type) == QUAL_UNION_TYPE) + RETURN_TRUE_IF_VAR (DECL_QUALIFIER (t)); + } + break; + + default: + return false; + } + + RETURN_TRUE_IF_VAR (TYPE_SIZE (type)); + RETURN_TRUE_IF_VAR (TYPE_SIZE_UNIT (type)); + return false; +#undef RETURN_TRUE_IF_VAR +} + tree remap_type (tree type, copy_body_data *id) { @@ -593,7 +679,10 @@ remap_type (tree type, copy_body_data *id) return *node; /* The type only needs remapping if it's variably modified. */ - if (! variably_modified_type_p (type, id->src_fn)) + if (! variably_modified_type_p (type, id->src_fn) + /* Don't remap if copy_decl method doesn't always return a new + decl and for all embedded decls returns the passed in decl. */ + || (id->dont_remap_vla_if_no_change && !remap_type_2 (type, id))) { insert_decl_map (id, type, type); return type; diff --git a/gcc/tree-inline.h b/gcc/tree-inline.h index d0ebbcaa342..773ef96792c 100644 --- a/gcc/tree-inline.h +++ b/gcc/tree-inline.h @@ -119,6 +119,13 @@ struct copy_body_data /* > 0 if we are remapping a type currently. */ int remapping_type_depth; + /* Usually copy_decl callback always creates new decls, in that case + we want to remap all variably_modified_type_p types. If this flag + is set, remap_type will do further checks to see if remap_decl + of any decls mentioned in the type will remap to anything but itself + and only in that case will actually remap the type. */ + bool dont_remap_vla_if_no_change; + /* A function to be called when duplicating BLOCK nodes. */ void (*transform_lang_insert_block) (tree); -- cgit v1.2.3 From bb875701d9315c97f01a845874f56286964e37ab Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 30 Apr 2019 20:55:58 +0000 Subject: Backported from mainline 2019-03-29 Jakub Jelinek PR c/89872 * gimplify.c (gimplify_compound_literal_expr): Don't optimize a non-addressable complit into its initializer if it is volatile. * gcc.dg/tree-ssa/pr89872.c: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270743 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 6 ++++++ gcc/gimplify.c | 1 + gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/tree-ssa/pr89872.c | 27 +++++++++++++++++++++++++++ 4 files changed, 39 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/pr89872.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 9a543943783..db946c74e85 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,6 +1,12 @@ 2019-04-30 Jakub Jelinek Backported from mainline + 2019-03-29 Jakub Jelinek + + PR c/89872 + * gimplify.c (gimplify_compound_literal_expr): Don't optimize a + non-addressable complit into its initializer if it is volatile. + 2019-03-28 Jakub Jelinek PR middle-end/89621 diff --git a/gcc/gimplify.c b/gcc/gimplify.c index 8b94f520967..bdb15a8fd14 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -4650,6 +4650,7 @@ gimplify_compound_literal_expr (tree *expr_p, gimple_seq *pre_p, otherwise we'd generate a new temporary, and we can as well just use the decl we already have. */ else if (!TREE_ADDRESSABLE (decl) + && !TREE_THIS_VOLATILE (decl) && init && (fallback & fb_lvalue) == 0 && gimple_test_f (init)) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 21f4ee6b5b1..870ca19103a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,6 +1,11 @@ 2019-04-30 Jakub Jelinek Backported from mainline + 2019-03-29 Jakub Jelinek + + PR c/89872 + * gcc.dg/tree-ssa/pr89872.c: New test. + 2019-03-28 Jakub Jelinek PR middle-end/89621 diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr89872.c b/gcc/testsuite/gcc.dg/tree-ssa/pr89872.c new file mode 100644 index 00000000000..c081cd5f9ec --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr89872.c @@ -0,0 +1,27 @@ +/* PR c/89872 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-optimized" } */ +/* { dg-final { scan-tree-dump-times " ={v} 1;" 1 "optimized" } } */ +/* { dg-final { scan-tree-dump-times " ={v} 2;" 1 "optimized" } } */ +/* { dg-final { scan-tree-dump-times " ={v} 3;" 1 "optimized" } } */ +/* { dg-final { scan-tree-dump-times " ={v} 4;" 1 "optimized" } } */ +/* { dg-final { scan-tree-dump-times " ={v} 0;" 1 "optimized" } } */ +/* { dg-final { scan-tree-dump-times " ={v} " 10 "optimized" } } */ + +void +foo (void) +{ + (volatile int){1} + (volatile int){2}; +} + +void +bar (void) +{ + (volatile int){3}; +} + +void +baz (void) +{ + (volatile int){4} / (volatile int){0}; +} -- cgit v1.2.3 From 88297342649a3fd6c850947609f28eed452cff65 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 30 Apr 2019 20:56:40 +0000 Subject: Backported from mainline 2019-03-29 Jakub Jelinek PR sanitizer/89869 * typeck.c: Include gimplify.h. (cp_build_modify_expr) : Unshare rhs before using it for second time. Formatting fixes. * g++.dg/ubsan/vptr-14.C: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270744 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cp/ChangeLog | 7 +++++++ gcc/cp/typeck.c | 25 ++++++++++++++++--------- gcc/testsuite/ChangeLog | 3 +++ gcc/testsuite/g++.dg/ubsan/vptr-14.C | 18 ++++++++++++++++++ 4 files changed, 44 insertions(+), 9 deletions(-) create mode 100644 gcc/testsuite/g++.dg/ubsan/vptr-14.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index d8904c6e8ab..2092675ba2a 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,6 +1,13 @@ 2019-04-30 Jakub Jelinek Backported from mainline + 2019-03-29 Jakub Jelinek + + PR sanitizer/89869 + * typeck.c: Include gimplify.h. + (cp_build_modify_expr) : Unshare rhs before using it + for second time. Formatting fixes. + 2019-03-26 Jakub Jelinek PR c++/89796 diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index 719535549e4..69a206b6d24 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -40,6 +40,7 @@ along with GCC; see the file COPYING3. If not see #include "stringpool.h" #include "attribs.h" #include "asan.h" +#include "gimplify.h" static tree cp_build_addr_expr_strict (tree, tsubst_flags_t); static tree cp_build_function_call (tree, tree, tsubst_flags_t); @@ -7988,8 +7989,6 @@ cp_build_modify_expr (location_t loc, tree lhs, enum tree_code modifycode, /* Produce (a ? (b = rhs) : (c = rhs)) except that the RHS goes through a save-expr so the code to compute it is only emitted once. */ - tree cond; - if (VOID_TYPE_P (TREE_TYPE (rhs))) { if (complain & tf_error) @@ -8004,13 +8003,21 @@ cp_build_modify_expr (location_t loc, tree lhs, enum tree_code modifycode, if (!lvalue_or_else (lhs, lv_assign, complain)) return error_mark_node; - cond = build_conditional_expr - (input_location, TREE_OPERAND (lhs, 0), - cp_build_modify_expr (loc, TREE_OPERAND (lhs, 1), - modifycode, rhs, complain), - cp_build_modify_expr (loc, TREE_OPERAND (lhs, 2), - modifycode, rhs, complain), - complain); + tree op1 = cp_build_modify_expr (loc, TREE_OPERAND (lhs, 1), + modifycode, rhs, complain); + /* When sanitizing undefined behavior, even when rhs doesn't need + stabilization at this point, the sanitization might add extra + SAVE_EXPRs in there and so make sure there is no tree sharing + in the rhs, otherwise those SAVE_EXPRs will have initialization + only in one of the two branches. */ + if (sanitize_flags_p (SANITIZE_UNDEFINED + | SANITIZE_UNDEFINED_NONDEFAULT)) + rhs = unshare_expr (rhs); + tree op2 = cp_build_modify_expr (loc, TREE_OPERAND (lhs, 2), + modifycode, rhs, complain); + tree cond = build_conditional_expr (input_location, + TREE_OPERAND (lhs, 0), op1, op2, + complain); if (cond == error_mark_node) return cond; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 870ca19103a..074a0907a69 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -3,6 +3,9 @@ Backported from mainline 2019-03-29 Jakub Jelinek + PR sanitizer/89869 + * g++.dg/ubsan/vptr-14.C: New test. + PR c/89872 * gcc.dg/tree-ssa/pr89872.c: New test. diff --git a/gcc/testsuite/g++.dg/ubsan/vptr-14.C b/gcc/testsuite/g++.dg/ubsan/vptr-14.C new file mode 100644 index 00000000000..2247ad99fcc --- /dev/null +++ b/gcc/testsuite/g++.dg/ubsan/vptr-14.C @@ -0,0 +1,18 @@ +// PR sanitizer/89869 +// { dg-do run } +// { dg-options "-fsanitize=vptr -fno-sanitize-recover=vptr" } + +struct S { S *s = 0; virtual ~S () {} }; + +void +foo (S *x, S *y) +{ + (x->s ? y : x) = x->s; +} + +int +main () +{ + S a; + foo (&a, 0); +} -- cgit v1.2.3 From a09b48cf8ce9d717ad1cdc7836fed3bf51343f75 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 30 Apr 2019 20:58:00 +0000 Subject: Backported from mainline 2019-04-09 Jakub Jelinek PR tree-optimization/89998 * gimple-ssa-sprintf.c (try_substitute_return_value): Use lhs type instead of integer_type_node if possible, don't add ranges if return type is not compatible with int. * gimple-fold.c (gimple_fold_builtin_sprintf, gimple_fold_builtin_snprintf): Use lhs type instead of hardcoded integer_type_node. * gcc.c-torture/compile/pr89998-1.c: New test. * gcc.c-torture/compile/pr89998-2.c: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270745 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 10 ++++++ gcc/gimple-fold.c | 29 +++++++++-------- gcc/gimple-ssa-sprintf.c | 8 ++--- gcc/testsuite/ChangeLog | 6 ++++ gcc/testsuite/gcc.c-torture/compile/pr89998-1.c | 42 +++++++++++++++++++++++++ gcc/testsuite/gcc.c-torture/compile/pr89998-2.c | 4 +++ 6 files changed, 80 insertions(+), 19 deletions(-) create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr89998-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr89998-2.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index db946c74e85..fcb9c1a1777 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,6 +1,16 @@ 2019-04-30 Jakub Jelinek Backported from mainline + 2019-04-09 Jakub Jelinek + + PR tree-optimization/89998 + * gimple-ssa-sprintf.c (try_substitute_return_value): Use lhs type + instead of integer_type_node if possible, don't add ranges if return + type is not compatible with int. + * gimple-fold.c (gimple_fold_builtin_sprintf, + gimple_fold_builtin_snprintf): Use lhs type instead of hardcoded + integer_type_node. + 2019-03-29 Jakub Jelinek PR c/89872 diff --git a/gcc/gimple-fold.c b/gcc/gimple-fold.c index ee98ae51246..1117c9d6b44 100644 --- a/gcc/gimple-fold.c +++ b/gcc/gimple-fold.c @@ -3031,11 +3031,10 @@ gimple_fold_builtin_sprintf (gimple_stmt_iterator *gsi) gimple_seq stmts = NULL; gimple *repl = gimple_build_call (fn, 2, dest, fmt); gimple_seq_add_stmt_without_update (&stmts, repl); - if (gimple_call_lhs (stmt)) + if (tree lhs = gimple_call_lhs (stmt)) { - repl = gimple_build_assign (gimple_call_lhs (stmt), - build_int_cst (integer_type_node, - strlen (fmt_str))); + repl = gimple_build_assign (lhs, build_int_cst (TREE_TYPE (lhs), + strlen (fmt_str))); gimple_seq_add_stmt_without_update (&stmts, repl); gsi_replace_with_seq_vops (gsi, stmts); /* gsi now points at the assignment to the lhs, get a @@ -3079,12 +3078,12 @@ gimple_fold_builtin_sprintf (gimple_stmt_iterator *gsi) gimple_seq stmts = NULL; gimple *repl = gimple_build_call (fn, 2, dest, orig); gimple_seq_add_stmt_without_update (&stmts, repl); - if (gimple_call_lhs (stmt)) + if (tree lhs = gimple_call_lhs (stmt)) { - if (!useless_type_conversion_p (integer_type_node, + if (!useless_type_conversion_p (TREE_TYPE (lhs), TREE_TYPE (orig_len))) - orig_len = fold_convert (integer_type_node, orig_len); - repl = gimple_build_assign (gimple_call_lhs (stmt), orig_len); + orig_len = fold_convert (TREE_TYPE (lhs), orig_len); + repl = gimple_build_assign (lhs, orig_len); gimple_seq_add_stmt_without_update (&stmts, repl); gsi_replace_with_seq_vops (gsi, stmts); /* gsi now points at the assignment to the lhs, get a @@ -3164,10 +3163,10 @@ gimple_fold_builtin_snprintf (gimple_stmt_iterator *gsi) gimple_seq stmts = NULL; gimple *repl = gimple_build_call (fn, 2, dest, fmt); gimple_seq_add_stmt_without_update (&stmts, repl); - if (gimple_call_lhs (stmt)) + if (tree lhs = gimple_call_lhs (stmt)) { - repl = gimple_build_assign (gimple_call_lhs (stmt), - build_int_cst (integer_type_node, len)); + repl = gimple_build_assign (lhs, + build_int_cst (TREE_TYPE (lhs), len)); gimple_seq_add_stmt_without_update (&stmts, repl); gsi_replace_with_seq_vops (gsi, stmts); /* gsi now points at the assignment to the lhs, get a @@ -3216,12 +3215,12 @@ gimple_fold_builtin_snprintf (gimple_stmt_iterator *gsi) gimple_seq stmts = NULL; gimple *repl = gimple_build_call (fn, 2, dest, orig); gimple_seq_add_stmt_without_update (&stmts, repl); - if (gimple_call_lhs (stmt)) + if (tree lhs = gimple_call_lhs (stmt)) { - if (!useless_type_conversion_p (integer_type_node, + if (!useless_type_conversion_p (TREE_TYPE (lhs), TREE_TYPE (orig_len))) - orig_len = fold_convert (integer_type_node, orig_len); - repl = gimple_build_assign (gimple_call_lhs (stmt), orig_len); + orig_len = fold_convert (TREE_TYPE (lhs), orig_len); + repl = gimple_build_assign (lhs, orig_len); gimple_seq_add_stmt_without_update (&stmts, repl); gsi_replace_with_seq_vops (gsi, stmts); /* gsi now points at the assignment to the lhs, get a diff --git a/gcc/gimple-ssa-sprintf.c b/gcc/gimple-ssa-sprintf.c index 5cc4133aba7..3ee36bce55d 100644 --- a/gcc/gimple-ssa-sprintf.c +++ b/gcc/gimple-ssa-sprintf.c @@ -3662,10 +3662,10 @@ try_substitute_return_value (gimple_stmt_iterator *gsi, are badly declared. */ && !stmt_ends_bb_p (info.callstmt)) { - tree cst = build_int_cst (integer_type_node, retval[0]); + tree cst = build_int_cst (lhs ? TREE_TYPE (lhs) : integer_type_node, + retval[0]); - if (lhs == NULL_TREE - && info.nowrite) + if (lhs == NULL_TREE && info.nowrite) { /* Remove the call to the bounded function with a zero size (e.g., snprintf(0, 0, "%i", 123)) if there is no lhs. */ @@ -3706,7 +3706,7 @@ try_substitute_return_value (gimple_stmt_iterator *gsi, } } } - else if (lhs) + else if (lhs && types_compatible_p (TREE_TYPE (lhs), integer_type_node)) { bool setrange = false; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 074a0907a69..7a046440b1d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,6 +1,12 @@ 2019-04-30 Jakub Jelinek Backported from mainline + 2019-04-09 Jakub Jelinek + + PR tree-optimization/89998 + * gcc.c-torture/compile/pr89998-1.c: New test. + * gcc.c-torture/compile/pr89998-2.c: New test. + 2019-03-29 Jakub Jelinek PR sanitizer/89869 diff --git a/gcc/testsuite/gcc.c-torture/compile/pr89998-1.c b/gcc/testsuite/gcc.c-torture/compile/pr89998-1.c new file mode 100644 index 00000000000..87be00ce3ce --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr89998-1.c @@ -0,0 +1,42 @@ +/* PR tree-optimization/89998 */ + +unsigned int sprintf (char *str, const char *fmt, ...); +unsigned int snprintf (char *str, __SIZE_TYPE__ len, const char *fmt, ...); + +int +f1 (char *s) +{ + return sprintf (s, "foo"); +} + +int +f2 (char *s) +{ + return sprintf (s, "%d", 123); +} + +int +f3 (int *p, char *s) +{ + const char *t = "bar"; + return sprintf (s, "%s", t); +} + +int +f4 (char *s) +{ + return snprintf (s, 8, "foo"); +} + +int +f5 (char *s) +{ + return snprintf (s, 8, "%d", 123); +} + +int +f6 (int *p, char *s) +{ + const char *t = "bar"; + return snprintf (s, 8, "%s", t); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr89998-2.c b/gcc/testsuite/gcc.c-torture/compile/pr89998-2.c new file mode 100644 index 00000000000..19e318b8905 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr89998-2.c @@ -0,0 +1,4 @@ +/* PR tree-optimization/89998 */ +/* { dg-additional-options "-fno-printf-return-value" } */ + +#include "pr89998-1.c" -- cgit v1.2.3 From 34a52405e26f953b7a7fc3f4495c00a2340a40dd Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 30 Apr 2019 21:00:42 +0000 Subject: 2019-04-10 Jakub Jelinek PR c++/90010 * gimple-ssa-sprintf.c (target_to_host): Fix handling of targstr with strlen in between hostsz-3 and hostsz-1 inclusive when no translation is needed, and when translation is needed, only append ... if the string length is hostsz or more bytes long. Avoid using strncpy or strcat. * gcc.dg/pr90010.c: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270746 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 9 +++++++++ gcc/gimple-ssa-sprintf.c | 16 ++++++++++------ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/pr90010.c | 27 +++++++++++++++++++++++++++ 4 files changed, 51 insertions(+), 6 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/pr90010.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index fcb9c1a1777..cb1dcb595e4 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,6 +1,15 @@ 2019-04-30 Jakub Jelinek Backported from mainline + 2019-04-10 Jakub Jelinek + + PR c++/90010 + * gimple-ssa-sprintf.c (target_to_host): Fix handling of targstr + with strlen in between hostsz-3 and hostsz-1 inclusive when no + translation is needed, and when translation is needed, only append + ... if the string length is hostsz or more bytes long. Avoid using + strncpy or strcat. + 2019-04-09 Jakub Jelinek PR tree-optimization/89998 diff --git a/gcc/gimple-ssa-sprintf.c b/gcc/gimple-ssa-sprintf.c index 3ee36bce55d..613b3fe1efa 100644 --- a/gcc/gimple-ssa-sprintf.c +++ b/gcc/gimple-ssa-sprintf.c @@ -376,9 +376,14 @@ target_to_host (char *hostr, size_t hostsz, const char *targstr) overlong strings just like the translated strings are. */ if (target_to_host_charmap['\0'] == 1) { - strncpy (hostr, targstr, hostsz - 4); - if (strlen (targstr) >= hostsz) - strcpy (hostr + hostsz - 4, "..."); + size_t len = strlen (targstr); + if (len >= hostsz) + { + memcpy (hostr, targstr, hostsz - 4); + strcpy (hostr + hostsz - 4, "..."); + } + else + memcpy (hostr, targstr, len + 1); return hostr; } @@ -392,10 +397,9 @@ target_to_host (char *hostr, size_t hostsz, const char *targstr) if (!*targstr) break; - if (size_t (ph - hostr) == hostsz - 4) + if (size_t (ph - hostr) == hostsz) { - *ph = '\0'; - strcat (ph, "..."); + strcpy (ph - 4, "..."); break; } } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 7a046440b1d..6a33f5c1e4f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,6 +1,11 @@ 2019-04-30 Jakub Jelinek Backported from mainline + 2019-04-10 Jakub Jelinek + + PR c++/90010 + * gcc.dg/pr90010.c: New test. + 2019-04-09 Jakub Jelinek PR tree-optimization/89998 diff --git a/gcc/testsuite/gcc.dg/pr90010.c b/gcc/testsuite/gcc.dg/pr90010.c new file mode 100644 index 00000000000..5cd5dd2deec --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr90010.c @@ -0,0 +1,27 @@ +/* PR c++/90010 */ +/* { dg-do compile } */ +/* { dg-options "-Wall" } */ + +char b[4096] = "abc"; +void bar (char *); + +void +foo () +{ + char d[4096]; + __builtin_snprintf (d, sizeof d, "%sfoobarbazquxquuxquuzthudfred", b); /* { dg-warning "'foobarbazquxquuxquuzthudfred' directive output may be truncated writing 28 bytes into a region of size between 1 and 4096" } */ + /* { dg-message "'__builtin_snprintf' output between 29 and 4124 bytes into a destination of size 4096" "" { target *-*-* } .-1 } */ + bar (d); + __builtin_snprintf (d, sizeof d, "%sfoobarbazquxquuxquuzcorgefred", b); /* { dg-warning "'foobarbazquxquuxquuzcorgefred' directive output may be truncated writing 29 bytes into a region of size between 1 and 4096" } */ + /* { dg-message "'__builtin_snprintf' output between 30 and 4125 bytes into a destination of size 4096" "" { target *-*-* } .-1 } */ + bar (d); + __builtin_snprintf (d, sizeof d, "%sfoobarbazquxquuxquuzcorgewaldo", b); /* { dg-warning "'foobarbazquxquuxquuzcorgewaldo' directive output may be truncated writing 30 bytes into a region of size between 1 and 4096" } */ + /* { dg-message "'__builtin_snprintf' output between 31 and 4126 bytes into a destination of size 4096" "" { target *-*-* } .-1 } */ + bar (d); + __builtin_snprintf (d, sizeof d, "%sfoobarbazquxquuxquuzcorgegarply", b); /* { dg-warning "'foobarbazquxquuxquuzcorgegarply' directive output may be truncated writing 31 bytes into a region of size between 1 and 4096" } */ + /* { dg-message "'__builtin_snprintf' output between 32 and 4127 bytes into a destination of size 4096" "" { target *-*-* } .-1 } */ + bar (d); + __builtin_snprintf (d, sizeof d, "%sfoobarfredquxquuxquuzcorgegarply", b); /* { dg-warning "'foobarfredquxquuxquuzcorgega\.\.\.' directive output may be truncated writing 32 bytes into a region of size between 1 and 4096" } */ + /* { dg-message "'__builtin_snprintf' output between 33 and 4128 bytes into a destination of size 4096" "" { target *-*-* } .-1 } */ + bar (d); +} -- cgit v1.2.3 From bd0fea86bf027a4532163b155c106db877ee7ce9 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 30 Apr 2019 21:01:23 +0000 Subject: Backported from mainline 2019-04-11 Jakub Jelinek PR rtl-optimization/89965 * dce.c (sp_based_mem_offset): New function. (find_call_stack_args): Use sp_based_mem_offset. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270747 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 6 ++ gcc/dce.c | 204 ++++++++++++++++++++-------------------------------------- 2 files changed, 75 insertions(+), 135 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index cb1dcb595e4..c32d32cca62 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,6 +1,12 @@ 2019-04-30 Jakub Jelinek Backported from mainline + 2019-04-11 Jakub Jelinek + + PR rtl-optimization/89965 + * dce.c (sp_based_mem_offset): New function. + (find_call_stack_args): Use sp_based_mem_offset. + 2019-04-10 Jakub Jelinek PR c++/90010 diff --git a/gcc/dce.c b/gcc/dce.c index ce2edc43efb..180e78accc5 100644 --- a/gcc/dce.c +++ b/gcc/dce.c @@ -265,6 +265,58 @@ check_argument_store (HOST_WIDE_INT size, HOST_WIDE_INT off, return true; } +/* If MEM has sp address, return 0, if it has sp + const address, + return that const, if it has reg address where reg is set to sp + const + and FAST is false, return const, otherwise return + INTTYPE_MINUMUM (HOST_WIDE_INT). */ + +static HOST_WIDE_INT +sp_based_mem_offset (rtx_call_insn *call_insn, const_rtx mem, bool fast) +{ + HOST_WIDE_INT off = 0; + rtx addr = XEXP (mem, 0); + if (GET_CODE (addr) == PLUS + && REG_P (XEXP (addr, 0)) + && CONST_INT_P (XEXP (addr, 1))) + { + off = INTVAL (XEXP (addr, 1)); + addr = XEXP (addr, 0); + } + if (addr == stack_pointer_rtx) + return off; + + if (!REG_P (addr) || fast) + return INTTYPE_MINIMUM (HOST_WIDE_INT); + + /* If not fast, use chains to see if addr wasn't set to sp + offset. */ + df_ref use; + FOR_EACH_INSN_USE (use, call_insn) + if (rtx_equal_p (addr, DF_REF_REG (use))) + break; + + if (use == NULL) + return INTTYPE_MINIMUM (HOST_WIDE_INT); + + struct df_link *defs; + for (defs = DF_REF_CHAIN (use); defs; defs = defs->next) + if (! DF_REF_IS_ARTIFICIAL (defs->ref)) + break; + + if (defs == NULL) + return INTTYPE_MINIMUM (HOST_WIDE_INT); + + rtx set = single_set (DF_REF_INSN (defs->ref)); + if (!set) + return INTTYPE_MINIMUM (HOST_WIDE_INT); + + if (GET_CODE (SET_SRC (set)) != PLUS + || XEXP (SET_SRC (set), 0) != stack_pointer_rtx + || !CONST_INT_P (XEXP (SET_SRC (set), 1))) + return INTTYPE_MINIMUM (HOST_WIDE_INT); + + off += INTVAL (XEXP (SET_SRC (set), 1)); + return off; +} /* Try to find all stack stores of CALL_INSN arguments if ACCUMULATE_OUTGOING_ARGS. If all stack stores have been found @@ -302,58 +354,13 @@ find_call_stack_args (rtx_call_insn *call_insn, bool do_mark, bool fast, if (GET_CODE (XEXP (p, 0)) == USE && MEM_P (XEXP (XEXP (p, 0), 0))) { - rtx mem = XEXP (XEXP (p, 0), 0), addr; - HOST_WIDE_INT off = 0, size; + rtx mem = XEXP (XEXP (p, 0), 0); + HOST_WIDE_INT size; if (!MEM_SIZE_KNOWN_P (mem) || !MEM_SIZE (mem).is_constant (&size)) return false; - addr = XEXP (mem, 0); - if (GET_CODE (addr) == PLUS - && REG_P (XEXP (addr, 0)) - && CONST_INT_P (XEXP (addr, 1))) - { - off = INTVAL (XEXP (addr, 1)); - addr = XEXP (addr, 0); - } - if (addr != stack_pointer_rtx) - { - if (!REG_P (addr)) - return false; - /* If not fast, use chains to see if addr wasn't set to - sp + offset. */ - if (!fast) - { - df_ref use; - struct df_link *defs; - rtx set; - - FOR_EACH_INSN_USE (use, call_insn) - if (rtx_equal_p (addr, DF_REF_REG (use))) - break; - - if (use == NULL) - return false; - - for (defs = DF_REF_CHAIN (use); defs; defs = defs->next) - if (! DF_REF_IS_ARTIFICIAL (defs->ref)) - break; - - if (defs == NULL) - return false; - - set = single_set (DF_REF_INSN (defs->ref)); - if (!set) - return false; - - if (GET_CODE (SET_SRC (set)) != PLUS - || XEXP (SET_SRC (set), 0) != stack_pointer_rtx - || !CONST_INT_P (XEXP (SET_SRC (set), 1))) - return false; - - off += INTVAL (XEXP (SET_SRC (set), 1)); - } - else - return false; - } + HOST_WIDE_INT off = sp_based_mem_offset (call_insn, mem, fast); + if (off == INTTYPE_MINIMUM (HOST_WIDE_INT)) + return false; min_sp_off = MIN (min_sp_off, off); max_sp_off = MAX (max_sp_off, off + size); } @@ -369,40 +376,14 @@ find_call_stack_args (rtx_call_insn *call_insn, bool do_mark, bool fast, if (GET_CODE (XEXP (p, 0)) == USE && MEM_P (XEXP (XEXP (p, 0), 0))) { - rtx mem = XEXP (XEXP (p, 0), 0), addr; - HOST_WIDE_INT off = 0, byte, size; + rtx mem = XEXP (XEXP (p, 0), 0); /* Checked in the previous iteration. */ - size = MEM_SIZE (mem).to_constant (); - addr = XEXP (mem, 0); - if (GET_CODE (addr) == PLUS - && REG_P (XEXP (addr, 0)) - && CONST_INT_P (XEXP (addr, 1))) - { - off = INTVAL (XEXP (addr, 1)); - addr = XEXP (addr, 0); - } - if (addr != stack_pointer_rtx) - { - df_ref use; - struct df_link *defs; - rtx set; - - FOR_EACH_INSN_USE (use, call_insn) - if (rtx_equal_p (addr, DF_REF_REG (use))) - break; - - for (defs = DF_REF_CHAIN (use); defs; defs = defs->next) - if (! DF_REF_IS_ARTIFICIAL (defs->ref)) - break; - - set = single_set (DF_REF_INSN (defs->ref)); - off += INTVAL (XEXP (SET_SRC (set), 1)); - } - for (byte = off; byte < off + size; byte++) - { - if (!bitmap_set_bit (sp_bytes, byte - min_sp_off)) - gcc_unreachable (); - } + HOST_WIDE_INT size = MEM_SIZE (mem).to_constant (); + HOST_WIDE_INT off = sp_based_mem_offset (call_insn, mem, fast); + gcc_checking_assert (off != INTTYPE_MINIMUM (HOST_WIDE_INT)); + for (HOST_WIDE_INT byte = off; byte < off + size; byte++) + if (!bitmap_set_bit (sp_bytes, byte - min_sp_off)) + gcc_unreachable (); } /* Walk backwards, looking for argument stores. The search stops @@ -411,9 +392,6 @@ find_call_stack_args (rtx_call_insn *call_insn, bool do_mark, bool fast, ret = false; for (insn = PREV_INSN (call_insn); insn; insn = prev_insn) { - rtx set, mem, addr; - HOST_WIDE_INT off; - if (insn == BB_HEAD (BLOCK_FOR_INSN (call_insn))) prev_insn = NULL; else @@ -425,61 +403,17 @@ find_call_stack_args (rtx_call_insn *call_insn, bool do_mark, bool fast, if (!NONDEBUG_INSN_P (insn)) continue; - set = single_set (insn); + rtx set = single_set (insn); if (!set || SET_DEST (set) == stack_pointer_rtx) break; if (!MEM_P (SET_DEST (set))) continue; - mem = SET_DEST (set); - addr = XEXP (mem, 0); - off = 0; - if (GET_CODE (addr) == PLUS - && REG_P (XEXP (addr, 0)) - && CONST_INT_P (XEXP (addr, 1))) - { - off = INTVAL (XEXP (addr, 1)); - addr = XEXP (addr, 0); - } - if (addr != stack_pointer_rtx) - { - if (!REG_P (addr)) - break; - if (!fast) - { - df_ref use; - struct df_link *defs; - rtx set; - - FOR_EACH_INSN_USE (use, insn) - if (rtx_equal_p (addr, DF_REF_REG (use))) - break; - - if (use == NULL) - break; - - for (defs = DF_REF_CHAIN (use); defs; defs = defs->next) - if (! DF_REF_IS_ARTIFICIAL (defs->ref)) - break; - - if (defs == NULL) - break; - - set = single_set (DF_REF_INSN (defs->ref)); - if (!set) - break; - - if (GET_CODE (SET_SRC (set)) != PLUS - || XEXP (SET_SRC (set), 0) != stack_pointer_rtx - || !CONST_INT_P (XEXP (SET_SRC (set), 1))) - break; - - off += INTVAL (XEXP (SET_SRC (set), 1)); - } - else - break; - } + rtx mem = SET_DEST (set); + HOST_WIDE_INT off = sp_based_mem_offset (call_insn, mem, fast); + if (off == INTTYPE_MINIMUM (HOST_WIDE_INT)) + break; HOST_WIDE_INT size; if (!MEM_SIZE_KNOWN_P (mem) -- cgit v1.2.3 From 186fd2c411d4a554de589b030fb03432f433ad03 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 30 Apr 2019 21:02:08 +0000 Subject: Backported from mainline 2019-04-12 Jakub Jelinek PR rtl-optimization/90026 * cfgcleanup.c (try_optimize_cfg): When removing empty bb with no successors, look for BARRIERs inside of the whole BB_FOOTER chain rather than just at the start of it. If e->src BB_FOOTER is not NULL in cfglayout mode, use emit_barrier_after_bb. * g++.dg/opt/pr90026.C: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270748 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 8 ++++++++ gcc/cfgcleanup.c | 20 ++++++++++---------- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/opt/pr90026.C | 24 ++++++++++++++++++++++++ 4 files changed, 47 insertions(+), 10 deletions(-) create mode 100644 gcc/testsuite/g++.dg/opt/pr90026.C diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c32d32cca62..5b4e4869b00 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,6 +1,14 @@ 2019-04-30 Jakub Jelinek Backported from mainline + 2019-04-12 Jakub Jelinek + + PR rtl-optimization/90026 + * cfgcleanup.c (try_optimize_cfg): When removing empty bb with no + successors, look for BARRIERs inside of the whole BB_FOOTER chain + rather than just at the start of it. If e->src BB_FOOTER is not NULL + in cfglayout mode, use emit_barrier_after_bb. + 2019-04-11 Jakub Jelinek PR rtl-optimization/89965 diff --git a/gcc/cfgcleanup.c b/gcc/cfgcleanup.c index 4a3bfe16d07..4d7d21b6822 100644 --- a/gcc/cfgcleanup.c +++ b/gcc/cfgcleanup.c @@ -2705,23 +2705,23 @@ try_optimize_cfg (int mode) if (current_ir_type () == IR_RTL_CFGLAYOUT) { - if (BB_FOOTER (b) - && BARRIER_P (BB_FOOTER (b))) + rtx_insn *insn; + for (insn = BB_FOOTER (b); + insn; insn = NEXT_INSN (insn)) + if (BARRIER_P (insn)) + break; + if (insn) FOR_EACH_EDGE (e, ei, b->preds) - if ((e->flags & EDGE_FALLTHRU) - && BB_FOOTER (e->src) == NULL) + if ((e->flags & EDGE_FALLTHRU)) { - if (BB_FOOTER (b)) + if (BB_FOOTER (b) + && BB_FOOTER (e->src) == NULL) { BB_FOOTER (e->src) = BB_FOOTER (b); BB_FOOTER (b) = NULL; } else - { - start_sequence (); - BB_FOOTER (e->src) = emit_barrier (); - end_sequence (); - } + emit_barrier_after_bb (e->src); } } else diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 6a33f5c1e4f..c1687072e0e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,6 +1,11 @@ 2019-04-30 Jakub Jelinek Backported from mainline + 2019-04-12 Jakub Jelinek + + PR rtl-optimization/90026 + * g++.dg/opt/pr90026.C: New test. + 2019-04-10 Jakub Jelinek PR c++/90010 diff --git a/gcc/testsuite/g++.dg/opt/pr90026.C b/gcc/testsuite/g++.dg/opt/pr90026.C new file mode 100644 index 00000000000..3971ef09367 --- /dev/null +++ b/gcc/testsuite/g++.dg/opt/pr90026.C @@ -0,0 +1,24 @@ +// PR rtl-optimization/90026 +// { dg-do compile } +// { dg-options "-fnon-call-exceptions -ftracer -O2 -w" } + +typedef __SIZE_TYPE__ size_t; +struct S { int *b; ~S () { delete b; } }; +void bar (); +char c[sizeof (int)]; + +void * +operator new (size_t, void *) +{ + __builtin_unreachable (); +} + +void +foo () +{ + S a; + if (a.b) + a.b = new int (); + bar (); + new (c) int (); +} -- cgit v1.2.3 From 517ebbb4d224b45457f78ebf3537ef43d09d01da Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 30 Apr 2019 21:03:11 +0000 Subject: Backported from mainline 2019-04-12 Jakub Jelinek PR c/89946 * varasm.c (assemble_start_function): Don't use tree_fits_uhwi_p and gcc_unreachable if it fails, just call tree_to_uhwi which verifies that too. Test TREE_CHAIN instead of list_length > 1. Start warning message with a lower-case letter. Formatting fixes. * c-attribs.c (handle_patchable_function_entry_attribute): Add function comment. Warn if arguments of the attribute are not positive integer constants. * c-c++-common/pr89946.c: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270749 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 6 ++++++ gcc/c-family/ChangeLog | 10 ++++++++++ gcc/c-family/c-attribs.c | 23 +++++++++++++++++++++-- gcc/testsuite/ChangeLog | 3 +++ gcc/testsuite/c-c++-common/pr89946.c | 7 +++++++ gcc/varasm.c | 23 ++++++++--------------- 6 files changed, 55 insertions(+), 17 deletions(-) create mode 100644 gcc/testsuite/c-c++-common/pr89946.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 5b4e4869b00..267d23c65e1 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -3,6 +3,12 @@ Backported from mainline 2019-04-12 Jakub Jelinek + PR c/89946 + * varasm.c (assemble_start_function): Don't use tree_fits_uhwi_p + and gcc_unreachable if it fails, just call tree_to_uhwi which + verifies that too. Test TREE_CHAIN instead of list_length > 1. + Start warning message with a lower-case letter. Formatting fixes. + PR rtl-optimization/90026 * cfgcleanup.c (try_optimize_cfg): When removing empty bb with no successors, look for BARRIERs inside of the whole BB_FOOTER chain diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index 58ca7b6c1d3..904173f29df 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,13 @@ +2019-04-30 Jakub Jelinek + + Backported from mainline + 2019-04-12 Jakub Jelinek + + PR c/89946 + * c-attribs.c (handle_patchable_function_entry_attribute): Add + function comment. Warn if arguments of the attribute are not positive + integer constants. + 2019-04-09 Eric Botcazou * c-ada-spec.c (print_destructor): Deal with deleting destructors. diff --git a/gcc/c-family/c-attribs.c b/gcc/c-family/c-attribs.c index c9e799e0fcd..a7ca376c911 100644 --- a/gcc/c-family/c-attribs.c +++ b/gcc/c-family/c-attribs.c @@ -3562,9 +3562,28 @@ handle_fallthrough_attribute (tree *, tree name, tree, int, return NULL_TREE; } +/* Handle a "patchable_function_entry" attributes; arguments as in + struct attribute_spec.handler. */ + static tree -handle_patchable_function_entry_attribute (tree *, tree, tree, int, bool *) +handle_patchable_function_entry_attribute (tree *, tree name, tree args, + int, bool *no_add_attrs) { - /* Nothing to be done here. */ + for (; args; args = TREE_CHAIN (args)) + { + tree val = TREE_VALUE (args); + if (val && TREE_CODE (val) != IDENTIFIER_NODE + && TREE_CODE (val) != FUNCTION_DECL) + val = default_conversion (val); + + if (!tree_fits_uhwi_p (val)) + { + warning (OPT_Wattributes, + "%qE attribute argument %qE is not an integer constant", + name, val); + *no_add_attrs = true; + return NULL_TREE; + } + } return NULL_TREE; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c1687072e0e..510220e6986 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -3,6 +3,9 @@ Backported from mainline 2019-04-12 Jakub Jelinek + PR c/89946 + * c-c++-common/pr89946.c: New test. + PR rtl-optimization/90026 * g++.dg/opt/pr90026.C: New test. diff --git a/gcc/testsuite/c-c++-common/pr89946.c b/gcc/testsuite/c-c++-common/pr89946.c new file mode 100644 index 00000000000..23acd63fc6a --- /dev/null +++ b/gcc/testsuite/c-c++-common/pr89946.c @@ -0,0 +1,7 @@ +/* PR c/89946 */ + +__attribute__((patchable_function_entry (-1))) void foo (void) {} /* { dg-warning "'patchable_function_entry' attribute argument '-1' is not an integer constant" } */ +__attribute__((patchable_function_entry (5, -5))) void bar (void) {} /* { dg-warning "'patchable_function_entry' attribute argument '-5' is not an integer constant" } */ +int i, j; +__attribute__((patchable_function_entry (i))) void baz (void) {} /* { dg-warning "'patchable_function_entry' attribute argument 'i' is not an integer constant" } */ +__attribute__((patchable_function_entry (2, j))) void qux (void) {} /* { dg-warning "'patchable_function_entry' attribute argument 'j' is not an integer constant" } */ diff --git a/gcc/varasm.c b/gcc/varasm.c index 664b5dcd7a8..dfe20dd415a 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -1857,28 +1857,20 @@ assemble_start_function (tree decl, const char *fnname) tree pp_val = TREE_VALUE (patchable_function_entry_attr); tree patchable_function_entry_value1 = TREE_VALUE (pp_val); - if (tree_fits_uhwi_p (patchable_function_entry_value1)) - patch_area_size = tree_to_uhwi (patchable_function_entry_value1); - else - gcc_unreachable (); - + patch_area_size = tree_to_uhwi (patchable_function_entry_value1); patch_area_entry = 0; - if (list_length (pp_val) > 1) + if (TREE_CHAIN (pp_val) != NULL_TREE) { - tree patchable_function_entry_value2 = - TREE_VALUE (TREE_CHAIN (pp_val)); - - if (tree_fits_uhwi_p (patchable_function_entry_value2)) - patch_area_entry = tree_to_uhwi (patchable_function_entry_value2); - else - gcc_unreachable (); + tree patchable_function_entry_value2 + = TREE_VALUE (TREE_CHAIN (pp_val)); + patch_area_entry = tree_to_uhwi (patchable_function_entry_value2); } } if (patch_area_entry > patch_area_size) { if (patch_area_size > 0) - warning (OPT_Wattributes, "Patchable function entry > size"); + warning (OPT_Wattributes, "patchable function entry > size"); patch_area_entry = 0; } @@ -1898,7 +1890,8 @@ assemble_start_function (tree decl, const char *fnname) /* And the area after the label. Record it if we haven't done so yet. */ if (patch_area_size > patch_area_entry) targetm.asm_out.print_patchable_function_entry (asm_out_file, - patch_area_size-patch_area_entry, + patch_area_size + - patch_area_entry, patch_area_entry == 0); if (lookup_attribute ("no_split_stack", DECL_ATTRIBUTES (decl))) -- cgit v1.2.3 From 4a117b933b3a5de37241c050ff4fc1e91d1c8fd4 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 30 Apr 2019 21:03:56 +0000 Subject: Backported from mainline 2019-04-12 Jakub Jelinek PR rtl-optimization/89965 * dce.c: Include rtl-iter.h. (struct check_argument_load_data): New type. (check_argument_load): New function. (find_call_stack_args): Check for loads from stack slots still tracked in sp_bytes and punt if any is found. * gcc.target/i386/pr89965.c: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270750 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 7 +++++ gcc/dce.c | 53 +++++++++++++++++++++++++++++++-- gcc/testsuite/ChangeLog | 3 ++ gcc/testsuite/gcc.target/i386/pr89965.c | 39 ++++++++++++++++++++++++ 4 files changed, 100 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gcc.target/i386/pr89965.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 267d23c65e1..851694757c9 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -3,6 +3,13 @@ Backported from mainline 2019-04-12 Jakub Jelinek + PR rtl-optimization/89965 + * dce.c: Include rtl-iter.h. + (struct check_argument_load_data): New type. + (check_argument_load): New function. + (find_call_stack_args): Check for loads from stack slots still tracked + in sp_bytes and punt if any is found. + PR c/89946 * varasm.c (assemble_start_function): Don't use tree_fits_uhwi_p and gcc_unreachable if it fails, just call tree_to_uhwi which diff --git a/gcc/dce.c b/gcc/dce.c index 180e78accc5..79c30e866dc 100644 --- a/gcc/dce.c +++ b/gcc/dce.c @@ -35,6 +35,7 @@ along with GCC; see the file COPYING3. If not see #include "valtrack.h" #include "tree-pass.h" #include "dbgcnt.h" +#include "rtl-iter.h" /* ------------------------------------------------------------------------- @@ -318,6 +319,48 @@ sp_based_mem_offset (rtx_call_insn *call_insn, const_rtx mem, bool fast) return off; } +/* Data for check_argument_load called via note_uses. */ +struct check_argument_load_data { + bitmap sp_bytes; + HOST_WIDE_INT min_sp_off, max_sp_off; + rtx_call_insn *call_insn; + bool fast; + bool load_found; +}; + +/* Helper function for find_call_stack_args. Check if there are + any loads from the argument slots in between the const/pure call + and store to the argument slot, set LOAD_FOUND if any is found. */ + +static void +check_argument_load (rtx *loc, void *data) +{ + struct check_argument_load_data *d + = (struct check_argument_load_data *) data; + subrtx_iterator::array_type array; + FOR_EACH_SUBRTX (iter, array, *loc, NONCONST) + { + const_rtx mem = *iter; + HOST_WIDE_INT size; + if (MEM_P (mem) + && MEM_SIZE_KNOWN_P (mem) + && MEM_SIZE (mem).is_constant (&size)) + { + HOST_WIDE_INT off = sp_based_mem_offset (d->call_insn, mem, d->fast); + if (off != INTTYPE_MINIMUM (HOST_WIDE_INT) + && off < d->max_sp_off + && off + size > d->min_sp_off) + for (HOST_WIDE_INT byte = MAX (off, d->min_sp_off); + byte < MIN (off + size, d->max_sp_off); byte++) + if (bitmap_bit_p (d->sp_bytes, byte - d->min_sp_off)) + { + d->load_found = true; + return; + } + } + } +} + /* Try to find all stack stores of CALL_INSN arguments if ACCUMULATE_OUTGOING_ARGS. If all stack stores have been found and it is therefore safe to eliminate the call, return true, @@ -387,8 +430,10 @@ find_call_stack_args (rtx_call_insn *call_insn, bool do_mark, bool fast, } /* Walk backwards, looking for argument stores. The search stops - when seeing another call, sp adjustment or memory store other than - argument store. */ + when seeing another call, sp adjustment, memory store other than + argument store or a read from an argument stack slot. */ + struct check_argument_load_data data + = { sp_bytes, min_sp_off, max_sp_off, call_insn, fast, false }; ret = false; for (insn = PREV_INSN (call_insn); insn; insn = prev_insn) { @@ -407,6 +452,10 @@ find_call_stack_args (rtx_call_insn *call_insn, bool do_mark, bool fast, if (!set || SET_DEST (set) == stack_pointer_rtx) break; + note_uses (&PATTERN (insn), check_argument_load, &data); + if (data.load_found) + break; + if (!MEM_P (SET_DEST (set))) continue; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 510220e6986..3053b0a3c64 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -3,6 +3,9 @@ Backported from mainline 2019-04-12 Jakub Jelinek + PR rtl-optimization/89965 + * gcc.target/i386/pr89965.c: New test. + PR c/89946 * c-c++-common/pr89946.c: New test. diff --git a/gcc/testsuite/gcc.target/i386/pr89965.c b/gcc/testsuite/gcc.target/i386/pr89965.c new file mode 100644 index 00000000000..db6382cbf80 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr89965.c @@ -0,0 +1,39 @@ +/* PR rtl-optimization/89965 */ +/* { dg-do run } */ +/* { dg-options "-O -mtune=nano-x2 -fcaller-saves -fexpensive-optimizations -fno-tree-dce -fno-tree-ter" } */ +/* { dg-additional-options "-march=i386" { target ia32 } } */ + +int a; + +__attribute__ ((noipa)) unsigned long long +foo (unsigned char c, unsigned d, unsigned e, unsigned long long f, + unsigned char g, unsigned h, unsigned long long i) +{ + (void) d; + unsigned short j = __builtin_mul_overflow_p (~0, h, c); + e <<= e; + i >>= 7; + c *= i; + i /= 12; + a = __builtin_popcount (c); + __builtin_add_overflow (e, a, &f); + return c + f + g + j + h; +} + +__attribute__ ((noipa)) void +bar (void) +{ + char buf[64]; + __builtin_memset (buf, 0x55, sizeof buf); + asm volatile ("" : : "r" (&buf[0]) : "memory"); +} + +int +main (void) +{ + bar (); + unsigned long long x = foo (2, 0, 0, 0, 0, 0, 0); + if (x != 0) + __builtin_abort (); + return 0; +} -- cgit v1.2.3 From 212a746b085680a944796f7318f272922f3c291d Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 30 Apr 2019 21:05:00 +0000 Subject: Backported from mainline 2019-04-12 Jakub Jelinek PR c/89933 * c-decl.c (merge_decls): When newdecl's type is its main variant, don't try to remove it from the variant list, but instead assert it has no variants. * decl.c (duplicate_decls): When newdecl's type is its main variant, don't try to remove it from the variant list, but instead assert it has no variants. * c-c++-common/pr89933.c: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270751 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/c/ChangeLog | 7 +++++++ gcc/c/c-decl.c | 17 ++++++++++------- gcc/cp/ChangeLog | 7 +++++++ gcc/cp/decl.c | 17 ++++++++++------- gcc/testsuite/ChangeLog | 3 +++ gcc/testsuite/c-c++-common/pr89933.c | 5 +++++ 6 files changed, 42 insertions(+), 14 deletions(-) create mode 100644 gcc/testsuite/c-c++-common/pr89933.c diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index bc4ad34100e..0e0552366c8 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,6 +1,13 @@ 2019-04-30 Jakub Jelinek Backported from mainline + 2019-04-12 Jakub Jelinek + + PR c/89933 + * c-decl.c (merge_decls): When newdecl's type is its main variant, + don't try to remove it from the variant list, but instead assert + it has no variants. + 2019-03-19 Jakub Jelinek PR c/89734 diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c index d5cb59bc1ac..0fdbb067ee4 100644 --- a/gcc/c/c-decl.c +++ b/gcc/c/c-decl.c @@ -2352,13 +2352,16 @@ merge_decls (tree newdecl, tree olddecl, tree newtype, tree oldtype) if (TYPE_NAME (TREE_TYPE (newdecl)) == newdecl) { tree remove = TREE_TYPE (newdecl); - for (tree t = TYPE_MAIN_VARIANT (remove); ; - t = TYPE_NEXT_VARIANT (t)) - if (TYPE_NEXT_VARIANT (t) == remove) - { - TYPE_NEXT_VARIANT (t) = TYPE_NEXT_VARIANT (remove); - break; - } + if (TYPE_MAIN_VARIANT (remove) == remove) + gcc_assert (TYPE_NEXT_VARIANT (remove) == NULL_TREE); + else + for (tree t = TYPE_MAIN_VARIANT (remove); ; + t = TYPE_NEXT_VARIANT (t)) + if (TYPE_NEXT_VARIANT (t) == remove) + { + TYPE_NEXT_VARIANT (t) = TYPE_NEXT_VARIANT (remove); + break; + } } } diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 2092675ba2a..5621121b8c1 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,6 +1,13 @@ 2019-04-30 Jakub Jelinek Backported from mainline + 2019-04-12 Jakub Jelinek + + PR c/89933 + * decl.c (duplicate_decls): When newdecl's type is its main variant, + don't try to remove it from the variant list, but instead assert + it has no variants. + 2019-03-29 Jakub Jelinek PR sanitizer/89869 diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 0bd03c2d5cb..19562d4df0a 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -2163,13 +2163,16 @@ next_arg:; if (TYPE_NAME (TREE_TYPE (newdecl)) == newdecl) { tree remove = TREE_TYPE (newdecl); - for (tree t = TYPE_MAIN_VARIANT (remove); ; - t = TYPE_NEXT_VARIANT (t)) - if (TYPE_NEXT_VARIANT (t) == remove) - { - TYPE_NEXT_VARIANT (t) = TYPE_NEXT_VARIANT (remove); - break; - } + if (TYPE_MAIN_VARIANT (remove) == remove) + gcc_assert (TYPE_NEXT_VARIANT (remove) == NULL_TREE); + else + for (tree t = TYPE_MAIN_VARIANT (remove); ; + t = TYPE_NEXT_VARIANT (t)) + if (TYPE_NEXT_VARIANT (t) == remove) + { + TYPE_NEXT_VARIANT (t) = TYPE_NEXT_VARIANT (remove); + break; + } } } else if (merge_attr) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 3053b0a3c64..74d845ad53c 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -3,6 +3,9 @@ Backported from mainline 2019-04-12 Jakub Jelinek + PR c/89933 + * c-c++-common/pr89933.c: New test. + PR rtl-optimization/89965 * gcc.target/i386/pr89965.c: New test. diff --git a/gcc/testsuite/c-c++-common/pr89933.c b/gcc/testsuite/c-c++-common/pr89933.c new file mode 100644 index 00000000000..870504d4208 --- /dev/null +++ b/gcc/testsuite/c-c++-common/pr89933.c @@ -0,0 +1,5 @@ +/* PR c/89933 */ +/* { dg-do compile } */ + +typedef unsigned int a __attribute__ ((__aligned__(8), __may_alias__)); +typedef unsigned int a __attribute__ ((__aligned__(8), __may_alias__)); -- cgit v1.2.3 From 11f6d70212932632402cb560947f2af499675d06 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 30 Apr 2019 21:05:39 +0000 Subject: Backported from mainline 2019-04-16 Jakub Jelinek PR tree-optimization/90090 * tree-ssa-math-opts.c (is_division_by): Ignore divisions that can throw internally. (is_division_by_square): Likewise. Formatting fix. * g++.dg/opt/pr90090.C: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270752 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 7 +++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/opt/pr90090.C | 19 +++++++++++++++++++ gcc/tree-ssa-math-opts.c | 10 +++++----- 4 files changed, 36 insertions(+), 5 deletions(-) create mode 100644 gcc/testsuite/g++.dg/opt/pr90090.C diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 851694757c9..fb93d7f1a9f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,6 +1,13 @@ 2019-04-30 Jakub Jelinek Backported from mainline + 2019-04-16 Jakub Jelinek + + PR tree-optimization/90090 + * tree-ssa-math-opts.c (is_division_by): Ignore divisions that can + throw internally. + (is_division_by_square): Likewise. Formatting fix. + 2019-04-12 Jakub Jelinek PR rtl-optimization/89965 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 74d845ad53c..06ffda37c18 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,6 +1,11 @@ 2019-04-30 Jakub Jelinek Backported from mainline + 2019-04-16 Jakub Jelinek + + PR tree-optimization/90090 + * g++.dg/opt/pr90090.C: New test. + 2019-04-12 Jakub Jelinek PR c/89933 diff --git a/gcc/testsuite/g++.dg/opt/pr90090.C b/gcc/testsuite/g++.dg/opt/pr90090.C new file mode 100644 index 00000000000..f60a888733f --- /dev/null +++ b/gcc/testsuite/g++.dg/opt/pr90090.C @@ -0,0 +1,19 @@ +// PR tree-optimization/90090 +// { dg-do compile } +// { dg-options "-Ofast -fno-associative-math -fsignaling-nans -fno-tree-dce -fnon-call-exceptions" } + +double bar (double, double, double, double, double); +double baz (); + +double +foo (double a) +{ + try + { + return bar (1.0/a, 2.0/a, 4.0/a, 8.0/a, 16.0/a); + } + catch (...) + { + return baz (); + } +} diff --git a/gcc/tree-ssa-math-opts.c b/gcc/tree-ssa-math-opts.c index a8f275bb78f..dcb1db3ebbc 100644 --- a/gcc/tree-ssa-math-opts.c +++ b/gcc/tree-ssa-math-opts.c @@ -334,7 +334,8 @@ is_division_by (gimple *use_stmt, tree def) /* Do not recognize x / x as valid division, as we are getting confused later by replacing all immediate uses x in such a stmt. */ - && gimple_assign_rhs1 (use_stmt) != def; + && gimple_assign_rhs1 (use_stmt) != def + && !stmt_can_throw_internal (use_stmt); } /* Return whether USE_STMT is DEF * DEF. */ @@ -359,13 +360,12 @@ is_division_by_square (gimple *use_stmt, tree def) { if (gimple_code (use_stmt) == GIMPLE_ASSIGN && gimple_assign_rhs_code (use_stmt) == RDIV_EXPR - && gimple_assign_rhs1 (use_stmt) != gimple_assign_rhs2 (use_stmt)) + && gimple_assign_rhs1 (use_stmt) != gimple_assign_rhs2 (use_stmt) + && !stmt_can_throw_internal (use_stmt)) { tree denominator = gimple_assign_rhs2 (use_stmt); if (TREE_CODE (denominator) == SSA_NAME) - { - return is_square_of (SSA_NAME_DEF_STMT (denominator), def); - } + return is_square_of (SSA_NAME_DEF_STMT (denominator), def); } return 0; } -- cgit v1.2.3 From e50f45b3889639ce8115a224f3c39dfc09fcd611 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 30 Apr 2019 21:06:33 +0000 Subject: Backported from mainline 2019-04-16 Jakub Jelinek PR rtl-optimization/90082 * dce.c (can_delete_call): New function. (deletable_insn_p, mark_insn): Use it. * gcc.dg/pr90082.c: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270753 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 4 ++++ gcc/dce.c | 32 ++++++++++++++++++++++++++++---- gcc/testsuite/ChangeLog | 3 +++ gcc/testsuite/gcc.dg/pr90082.c | 13 +++++++++++++ 4 files changed, 48 insertions(+), 4 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/pr90082.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index fb93d7f1a9f..f31efcac490 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -3,6 +3,10 @@ Backported from mainline 2019-04-16 Jakub Jelinek + PR rtl-optimization/90082 + * dce.c (can_delete_call): New function. + (deletable_insn_p, mark_insn): Use it. + PR tree-optimization/90090 * tree-ssa-math-opts.c (is_division_by): Ignore divisions that can throw internally. diff --git a/gcc/dce.c b/gcc/dce.c index 79c30e866dc..bea9a5d544b 100644 --- a/gcc/dce.c +++ b/gcc/dce.c @@ -87,6 +87,32 @@ deletable_insn_p_1 (rtx body) } } +/* Don't delete calls that may throw if we cannot do so. */ + +static bool +can_delete_call (rtx_insn *insn) +{ + if (cfun->can_delete_dead_exceptions && can_alter_cfg) + return true; + if (!insn_nothrow_p (insn)) + return false; + if (can_alter_cfg) + return true; + /* If we can't alter cfg, even when the call can't throw exceptions, it + might have EDGE_ABNORMAL_CALL edges and so we shouldn't delete such + calls. */ + gcc_assert (CALL_P (insn)); + if (BLOCK_FOR_INSN (insn) && BB_END (BLOCK_FOR_INSN (insn)) == insn) + { + edge e; + edge_iterator ei; + + FOR_EACH_EDGE (e, ei, BLOCK_FOR_INSN (insn)->succs) + if ((e->flags & EDGE_ABNORMAL_CALL) != 0) + return false; + } + return true; +} /* Return true if INSN is a normal instruction that can be deleted by the DCE pass. */ @@ -111,8 +137,7 @@ deletable_insn_p (rtx_insn *insn, bool fast, bitmap arg_stores) && (RTL_CONST_OR_PURE_CALL_P (insn) && !RTL_LOOPING_CONST_OR_PURE_CALL_P (insn)) /* Don't delete calls that may throw if we cannot do so. */ - && ((cfun->can_delete_dead_exceptions && can_alter_cfg) - || insn_nothrow_p (insn))) + && can_delete_call (insn)) return find_call_stack_args (as_a (insn), false, fast, arg_stores); @@ -205,8 +230,7 @@ mark_insn (rtx_insn *insn, bool fast) && !SIBLING_CALL_P (insn) && (RTL_CONST_OR_PURE_CALL_P (insn) && !RTL_LOOPING_CONST_OR_PURE_CALL_P (insn)) - && ((cfun->can_delete_dead_exceptions && can_alter_cfg) - || insn_nothrow_p (insn))) + && can_delete_call (insn)) find_call_stack_args (as_a (insn), true, fast, NULL); } } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 06ffda37c18..775c68ff5aa 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -3,6 +3,9 @@ Backported from mainline 2019-04-16 Jakub Jelinek + PR rtl-optimization/90082 + * gcc.dg/pr90082.c: New test. + PR tree-optimization/90090 * g++.dg/opt/pr90090.C: New test. diff --git a/gcc/testsuite/gcc.dg/pr90082.c b/gcc/testsuite/gcc.dg/pr90082.c new file mode 100644 index 00000000000..bb8293fb633 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr90082.c @@ -0,0 +1,13 @@ +/* PR rtl-optimization/90082 */ +/* { dg-do compile } */ +/* { dg-options "-O1 -fnon-call-exceptions -ftrapv" } */ + +void *buf[5]; + +void +foo (int a) +{ + if (__builtin_setjmp (buf) == 0) + __asm__ ("" : : "n" (a * 2)); /* { dg-error "impossible constraint in 'asm'" } */ + /* { dg-warning "asm operand 0 probably doesn't match constraints" "" { target *-*-* } .-1 } */ +} -- cgit v1.2.3 From 4db37c5012e19db7bf4d9058229ba49d9bd0a6c2 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 30 Apr 2019 21:07:37 +0000 Subject: Backported from mainline 2019-04-19 Jakub Jelinek PR c++/90108 * c-decl.c (merge_decls): If remove is main variant and DECL_ORIGINAL_TYPE is some other type, remove a DECL_ORIGINAL_TYPE variant that has newdecl as TYPE_NAME if any. * decl.c (duplicate_decls): If remove is main variant and DECL_ORIGINAL_TYPE is some other type, remove a DECL_ORIGINAL_TYPE variant that has newdecl as TYPE_NAME if any. * c-c++-common/pr90108.c: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270754 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/c/ChangeLog | 7 +++++++ gcc/c/c-decl.c | 19 ++++++++++++++++++- gcc/cp/ChangeLog | 7 +++++++ gcc/cp/decl.c | 19 ++++++++++++++++++- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/c-c++-common/pr90108.c | 6 ++++++ 6 files changed, 61 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/c-c++-common/pr90108.c diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index 0e0552366c8..159abab1866 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,6 +1,13 @@ 2019-04-30 Jakub Jelinek Backported from mainline + 2019-04-19 Jakub Jelinek + + PR c++/90108 + * c-decl.c (merge_decls): If remove is main variant and + DECL_ORIGINAL_TYPE is some other type, remove a DECL_ORIGINAL_TYPE + variant that has newdecl as TYPE_NAME if any. + 2019-04-12 Jakub Jelinek PR c/89933 diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c index 0fdbb067ee4..7ac69d027b5 100644 --- a/gcc/c/c-decl.c +++ b/gcc/c/c-decl.c @@ -2353,7 +2353,24 @@ merge_decls (tree newdecl, tree olddecl, tree newtype, tree oldtype) { tree remove = TREE_TYPE (newdecl); if (TYPE_MAIN_VARIANT (remove) == remove) - gcc_assert (TYPE_NEXT_VARIANT (remove) == NULL_TREE); + { + gcc_assert (TYPE_NEXT_VARIANT (remove) == NULL_TREE); + /* If remove is the main variant, no need to remove that + from the list. One of the DECL_ORIGINAL_TYPE + variants, e.g. created for aligned attribute, might still + refer to the newdecl TYPE_DECL though, so remove that one + in that case. */ + if (DECL_ORIGINAL_TYPE (newdecl) + && DECL_ORIGINAL_TYPE (newdecl) != remove) + for (tree t = TYPE_MAIN_VARIANT (DECL_ORIGINAL_TYPE (newdecl)); + t; t = TYPE_MAIN_VARIANT (t)) + if (TYPE_NAME (TYPE_NEXT_VARIANT (t)) == newdecl) + { + TYPE_NEXT_VARIANT (t) + = TYPE_NEXT_VARIANT (TYPE_NEXT_VARIANT (t)); + break; + } + } else for (tree t = TYPE_MAIN_VARIANT (remove); ; t = TYPE_NEXT_VARIANT (t)) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 5621121b8c1..fc0e6a4cc6e 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,6 +1,13 @@ 2019-04-30 Jakub Jelinek Backported from mainline + 2019-04-19 Jakub Jelinek + + PR c++/90108 + * decl.c (duplicate_decls): If remove is main variant and + DECL_ORIGINAL_TYPE is some other type, remove a DECL_ORIGINAL_TYPE + variant that has newdecl as TYPE_NAME if any. + 2019-04-12 Jakub Jelinek PR c/89933 diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 19562d4df0a..211b113a0c9 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -2164,7 +2164,24 @@ next_arg:; { tree remove = TREE_TYPE (newdecl); if (TYPE_MAIN_VARIANT (remove) == remove) - gcc_assert (TYPE_NEXT_VARIANT (remove) == NULL_TREE); + { + gcc_assert (TYPE_NEXT_VARIANT (remove) == NULL_TREE); + /* If remove is the main variant, no need to remove that + from the list. One of the DECL_ORIGINAL_TYPE + variants, e.g. created for aligned attribute, might still + refer to the newdecl TYPE_DECL though, so remove that one + in that case. */ + if (tree orig = DECL_ORIGINAL_TYPE (newdecl)) + if (orig != remove) + for (tree t = TYPE_MAIN_VARIANT (orig); t; + t = TYPE_MAIN_VARIANT (t)) + if (TYPE_NAME (TYPE_NEXT_VARIANT (t)) == newdecl) + { + TYPE_NEXT_VARIANT (t) + = TYPE_NEXT_VARIANT (TYPE_NEXT_VARIANT (t)); + break; + } + } else for (tree t = TYPE_MAIN_VARIANT (remove); ; t = TYPE_NEXT_VARIANT (t)) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 775c68ff5aa..2b51cb69c06 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,6 +1,11 @@ 2019-04-30 Jakub Jelinek Backported from mainline + 2019-04-19 Jakub Jelinek + + PR c++/90108 + * c-c++-common/pr90108.c: New test. + 2019-04-16 Jakub Jelinek PR rtl-optimization/90082 diff --git a/gcc/testsuite/c-c++-common/pr90108.c b/gcc/testsuite/c-c++-common/pr90108.c new file mode 100644 index 00000000000..fa5b8461aae --- /dev/null +++ b/gcc/testsuite/c-c++-common/pr90108.c @@ -0,0 +1,6 @@ +/* PR c++/90108 */ +/* { dg-do compile } */ +/* { dg-options "--param ggc-min-heapsize=0" } */ + +typedef unsigned int a __attribute__ ((__aligned__(8), __may_alias__)); +typedef unsigned int a __attribute__ ((__aligned__(8), __may_alias__)); -- cgit v1.2.3 From 7c961be511ed98a3dddb9d2aa8d627e3be1f7bb6 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 30 Apr 2019 21:08:27 +0000 Subject: Backported from mainline 2019-04-24 Jakub Jelinek PR tree-optimization/90208 * tree-cfg.c (remove_bb): Move forced labels from removed bbs after labels of new_bb, not before them. * gcc.dg/tsan/pr90208-2.c: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270755 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 6 ++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/tsan/pr90208-2.c | 20 ++++++++++++++++++++ gcc/tree-cfg.c | 2 +- 4 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.dg/tsan/pr90208-2.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f31efcac490..fb0197bc285 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,6 +1,12 @@ 2019-04-30 Jakub Jelinek Backported from mainline + 2019-04-24 Jakub Jelinek + + PR tree-optimization/90208 + * tree-cfg.c (remove_bb): Move forced labels from removed bbs + after labels of new_bb, not before them. + 2019-04-16 Jakub Jelinek PR rtl-optimization/90082 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 2b51cb69c06..914ca37e08d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,6 +1,11 @@ 2019-04-30 Jakub Jelinek Backported from mainline + 2019-04-24 Jakub Jelinek + + PR tree-optimization/90208 + * gcc.dg/tsan/pr90208-2.c: New test. + 2019-04-19 Jakub Jelinek PR c++/90108 diff --git a/gcc/testsuite/gcc.dg/tsan/pr90208-2.c b/gcc/testsuite/gcc.dg/tsan/pr90208-2.c new file mode 100644 index 00000000000..c3823d0a400 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tsan/pr90208-2.c @@ -0,0 +1,20 @@ +/* PR tree-optimization/90208 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -fexceptions -fsanitize=thread" } */ + +void *b[5]; +void foo (void); + +void +bar (int d) +{ + while (d) + foo (); +} + +void +baz (void) +{ + bar (2); + __builtin_setjmp (b); +} diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c index 9a5edd19039..a52a1a16246 100644 --- a/gcc/tree-cfg.c +++ b/gcc/tree-cfg.c @@ -2307,7 +2307,7 @@ remove_bb (basic_block bb) new_bb = single_succ (new_bb); gcc_assert (new_bb != bb); } - new_gsi = gsi_start_bb (new_bb); + new_gsi = gsi_after_labels (new_bb); gsi_remove (&i, false); gsi_insert_before (&new_gsi, stmt, GSI_NEW_STMT); } -- cgit v1.2.3 From 02b59e1036cc5b30188dff03f21cc06980250360 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 30 Apr 2019 21:09:20 +0000 Subject: Backported from mainline 2019-04-24 Jakub Jelinek PR target/90187 * config/i386/i386.c (ix86_expand_sse_fp_minmax): Force if_true into a register if both if_true and if_false are MEMs. * g++.dg/opt/pr90187.C: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270756 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 4 ++++ gcc/config/i386/i386.c | 2 ++ gcc/testsuite/ChangeLog | 3 +++ gcc/testsuite/g++.dg/opt/pr90187.C | 15 +++++++++++++++ 4 files changed, 24 insertions(+) create mode 100644 gcc/testsuite/g++.dg/opt/pr90187.C diff --git a/gcc/ChangeLog b/gcc/ChangeLog index fb0197bc285..56ce99ce102 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -3,6 +3,10 @@ Backported from mainline 2019-04-24 Jakub Jelinek + PR target/90187 + * config/i386/i386.c (ix86_expand_sse_fp_minmax): Force if_true into + a register if both if_true and if_false are MEMs. + PR tree-optimization/90208 * tree-cfg.c (remove_bb): Move forced labels from removed bbs after labels of new_bb, not before them. diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 98ddfb971fe..8959ed5a6d5 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -23981,6 +23981,8 @@ ix86_expand_sse_fp_minmax (rtx dest, enum rtx_code code, rtx cmp_op0, else { code = is_min ? SMIN : SMAX; + if (MEM_P (if_true) && MEM_P (if_false)) + if_true = force_reg (mode, if_true); tmp = gen_rtx_fmt_ee (code, mode, if_true, if_false); } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 914ca37e08d..1bc01599ba4 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -3,6 +3,9 @@ Backported from mainline 2019-04-24 Jakub Jelinek + PR target/90187 + * g++.dg/opt/pr90187.C: New test. + PR tree-optimization/90208 * gcc.dg/tsan/pr90208-2.c: New test. diff --git a/gcc/testsuite/g++.dg/opt/pr90187.C b/gcc/testsuite/g++.dg/opt/pr90187.C new file mode 100644 index 00000000000..ed9e9fe3226 --- /dev/null +++ b/gcc/testsuite/g++.dg/opt/pr90187.C @@ -0,0 +1,15 @@ +// PR target/90187 +// { dg-do compile } +// { dg-options "-Ofast -ffloat-store" } + +double a[64]; +double *foo (void); + +void +bar (int x, const double *y) +{ + int i; + for (i = 0; i < x; i++) + if (y[i] < a[i]) + a[i] = y[i]; +} -- cgit v1.2.3 From 573b26eee348bb89ce594eaff9a6fcb87f596d3d Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 30 Apr 2019 21:11:06 +0000 Subject: Backported from mainline 2019-04-24 Jakub Jelinek PR target/90193 * rtl.c (classify_insn): Return JUMP_INSN for asm goto. * emit-rtl.c (try_split): Copy over REG_LABEL_TARGET. * gcc.target/i386/pr90193.c: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270757 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 4 ++++ gcc/emit-rtl.c | 1 + gcc/rtl.c | 5 +++++ gcc/testsuite/ChangeLog | 3 +++ gcc/testsuite/gcc.target/i386/pr90193.c | 21 +++++++++++++++++++++ 5 files changed, 34 insertions(+) create mode 100644 gcc/testsuite/gcc.target/i386/pr90193.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 56ce99ce102..4a30f1cbcdc 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -3,6 +3,10 @@ Backported from mainline 2019-04-24 Jakub Jelinek + PR target/90193 + * rtl.c (classify_insn): Return JUMP_INSN for asm goto. + * emit-rtl.c (try_split): Copy over REG_LABEL_TARGET. + PR target/90187 * config/i386/i386.c (ix86_expand_sse_fp_minmax): Force if_true into a register if both if_true and if_false are MEMs. diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c index 613030fa814..543445116f0 100644 --- a/gcc/emit-rtl.c +++ b/gcc/emit-rtl.c @@ -3940,6 +3940,7 @@ try_split (rtx pat, rtx_insn *trial, int last) break; case REG_NON_LOCAL_GOTO: + case REG_LABEL_TARGET: for (insn = insn_last; insn != NULL_RTX; insn = PREV_INSN (insn)) { if (JUMP_P (insn)) diff --git a/gcc/rtl.c b/gcc/rtl.c index 90bbc7c6861..dc03e1e5426 100644 --- a/gcc/rtl.c +++ b/gcc/rtl.c @@ -731,6 +731,8 @@ classify_insn (rtx x) return CALL_INSN; if (ANY_RETURN_P (x)) return JUMP_INSN; + if (GET_CODE (x) == ASM_OPERANDS && ASM_OPERANDS_LABEL_VEC (x)) + return JUMP_INSN; if (GET_CODE (x) == SET) { if (GET_CODE (SET_DEST (x)) == PC) @@ -757,6 +759,9 @@ classify_insn (rtx x) return CALL_INSN; if (has_return_p) return JUMP_INSN; + if (GET_CODE (XVECEXP (x, 0, 0)) == ASM_OPERANDS + && ASM_OPERANDS_LABEL_VEC (XVECEXP (x, 0, 0))) + return JUMP_INSN; } #ifdef GENERATOR_FILE if (GET_CODE (x) == MATCH_OPERAND diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 1bc01599ba4..f181bbd5bcf 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -3,6 +3,9 @@ Backported from mainline 2019-04-24 Jakub Jelinek + PR target/90193 + * gcc.target/i386/pr90193.c: New test. + PR target/90187 * g++.dg/opt/pr90187.C: New test. diff --git a/gcc/testsuite/gcc.target/i386/pr90193.c b/gcc/testsuite/gcc.target/i386/pr90193.c new file mode 100644 index 00000000000..194cffe539b --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr90193.c @@ -0,0 +1,21 @@ +/* PR target/90193 * +/* { dg-do link } */ +/* { dg-options "-O1" } */ +/* { dg-require-effective-target tls } */ + +__thread int var; + +static int +foo (void) +{ + asm goto ("jmp %l[l]\n\t" : : "m" (var) : : l); + return 0; +l: + return 1; +} + +int +main () +{ + return foo (); +} -- cgit v1.2.3 From 71742268444bb73096d48b14f1bd45813c239019 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Wed, 1 May 2019 00:16:07 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270761 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 3556de5f593..1c23fed7df1 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190430 +20190501 -- cgit v1.2.3 From e5b1516f0bcc4c9f4c567e78c51596451f80474f Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Thu, 2 May 2019 00:16:09 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270784 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 1c23fed7df1..5a926471efd 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190501 +20190502 -- cgit v1.2.3 From 39d3320af89458f2ffd7709d997d49687f094a1c Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Fri, 3 May 2019 00:16:13 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270829 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 5a926471efd..0da9b2ee7af 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190502 +20190503 -- cgit v1.2.3 From f61ad458e6f61bc678d6939fb1a796a527af4f81 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Fri, 3 May 2019 08:18:48 +0000 Subject: 2019-05-03 Richard Biener Backport from mainline 2019-03-14 Richard Biener PR middle-end/89698 * fold-const.c (operand_equal_p): For INDIRECT_REF check that the access types are similar. * g++.dg/torture/pr89698.C: New testcase. 2019-03-07 Richard Biener PR tree-optimization/89595 * tree-ssa-dom.c (dom_opt_dom_walker::optimize_stmt): Take stmt iterator as reference, take boolean output parameter to indicate whether the stmt was removed and thus the iterator already advanced. (dom_opt_dom_walker::before_dom_children): Re-iterate over stmts created by folding. * gcc.dg/torture/pr89595.c: New testcase. 2019-03-14 Richard Biener PR tree-optimization/89710 * tree-ssa-loop-ch.c (should_duplicate_loop_header_p): Use safe_dyn_cast. * gcc.dg/torture/pr89710.c: New testcase. 2019-04-15 Richard Biener PR tree-optimization/90071 * tree-ssa-reassoc.c (init_range_entry): Do not pick up abnormal operands from def stmts. * gcc.dg/torture/pr90071.c: New testcase. 2018-08-20 Bernd Edlinger PR target/86984 * expr.c (expand_assignment): Assert that bitpos is positive. (store_field): Likewise (expand_expr_real_1): Make sure that bitpos is positive. * config/alpha/alpha.h (CONSTANT_ADDRESS_P): Avoid signed integer overflow. * gcc.target/alpha/pr86984.c: New test. 2019-03-14 Richard Biener PR target/89711 * config/i386/i386.c (make_resolver_func): Properly set DECL_CONTEXT on the RESULT_DECL. * config/rs6000/rs6000.c (make_resolver_func): Likewise. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270841 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 47 +++++++++++++++++++++++++++++++++++ gcc/config/alpha/alpha.h | 2 +- gcc/config/i386/i386.c | 1 + gcc/config/rs6000/rs6000.c | 1 + gcc/expr.c | 11 ++++++++ gcc/fold-const.c | 14 ++++++++--- gcc/testsuite/ChangeLog | 28 +++++++++++++++++++++ gcc/tree-ssa-dom.c | 62 ++++++++++++++++++++++++++++++++++++++-------- gcc/tree-ssa-loop-ch.c | 2 +- gcc/tree-ssa-reassoc.c | 3 ++- 10 files changed, 153 insertions(+), 18 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4a30f1cbcdc..216e48bb2d0 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,50 @@ +2019-05-03 Richard Biener + + Backport from mainline + 2019-03-14 Richard Biener + + PR middle-end/89698 + * fold-const.c (operand_equal_p): For INDIRECT_REF check + that the access types are similar. + + 2019-03-07 Richard Biener + + PR tree-optimization/89595 + * tree-ssa-dom.c (dom_opt_dom_walker::optimize_stmt): Take + stmt iterator as reference, take boolean output parameter to + indicate whether the stmt was removed and thus the iterator + already advanced. + (dom_opt_dom_walker::before_dom_children): Re-iterate over + stmts created by folding. + + 2019-03-14 Richard Biener + + PR tree-optimization/89710 + * tree-ssa-loop-ch.c (should_duplicate_loop_header_p): Use + safe_dyn_cast. + + 2019-04-15 Richard Biener + + PR tree-optimization/90071 + * tree-ssa-reassoc.c (init_range_entry): Do not pick up + abnormal operands from def stmts. + + 2018-08-20 Bernd Edlinger + + PR target/86984 + * expr.c (expand_assignment): Assert that bitpos is positive. + (store_field): Likewise + (expand_expr_real_1): Make sure that bitpos is positive. + * config/alpha/alpha.h (CONSTANT_ADDRESS_P): Avoid signed + integer overflow. + + 2019-03-14 Richard Biener + + PR target/89711 + * config/i386/i386.c (make_resolver_func): Properly set + DECL_CONTEXT on the RESULT_DECL. + * config/rs6000/rs6000.c (make_resolver_func): Likewise. + 2019-04-30 Jakub Jelinek Backported from mainline diff --git a/gcc/config/alpha/alpha.h b/gcc/config/alpha/alpha.h index 1d3238565d5..b3b34ee041a 100644 --- a/gcc/config/alpha/alpha.h +++ b/gcc/config/alpha/alpha.h @@ -678,7 +678,7 @@ enum reg_class { #define CONSTANT_ADDRESS_P(X) \ (CONST_INT_P (X) \ - && (unsigned HOST_WIDE_INT) (INTVAL (X) + 0x8000) < 0x10000) + && (UINTVAL (X) + 0x8000) < 0x10000) /* The macros REG_OK_FOR..._P assume that the arg is a REG rtx and check its validity for a certain class. diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 8959ed5a6d5..00952f51fa4 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -32844,6 +32844,7 @@ make_resolver_func (const tree default_decl, } /* Build result decl and add to function_decl. */ t = build_decl (UNKNOWN_LOCATION, RESULT_DECL, NULL_TREE, ptr_type_node); + DECL_CONTEXT (t) = decl; DECL_ARTIFICIAL (t) = 1; DECL_IGNORED_P (t) = 1; DECL_RESULT (decl) = t; diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 7b69f82a415..78d124a312d 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -37862,6 +37862,7 @@ make_resolver_func (const tree default_decl, /* Build result decl and add to function_decl. */ tree t = build_decl (UNKNOWN_LOCATION, RESULT_DECL, NULL_TREE, ptr_type_node); + DECL_CONTEXT (t) = decl; DECL_ARTIFICIAL (t) = 1; DECL_IGNORED_P (t) = 1; DECL_RESULT (decl) = t; diff --git a/gcc/expr.c b/gcc/expr.c index 201fe4a55d3..8bf5cc28b13 100644 --- a/gcc/expr.c +++ b/gcc/expr.c @@ -5262,6 +5262,7 @@ expand_assignment (tree to, tree from, bool nontemporal) MEM_VOLATILE_P (to_rtx) = 1; } + gcc_checking_assert (known_ge (bitpos, 0)); if (optimize_bitfield_assignment_op (bitsize, bitpos, bitregion_start, bitregion_end, mode1, to_rtx, to, from, @@ -7119,6 +7120,7 @@ store_field (rtx target, poly_int64 bitsize, poly_int64 bitpos, } /* Store the value in the bitfield. */ + gcc_assert (known_ge (bitpos, 0)); store_bit_field (target, bitsize, bitpos, bitregion_start, bitregion_end, mode, temp, reverse); @@ -10662,6 +10664,14 @@ expand_expr_real_1 (tree exp, rtx target, machine_mode tmode, mode2 = CONSTANT_P (op0) ? TYPE_MODE (TREE_TYPE (tem)) : GET_MODE (op0); + /* Make sure bitpos is not negative, it can wreak havoc later. */ + if (maybe_lt (bitpos, 0)) + { + gcc_checking_assert (offset == NULL_TREE); + offset = size_int (bits_to_bytes_round_down (bitpos)); + bitpos = num_trailing_bits (bitpos); + } + /* If we have either an offset, a BLKmode result, or a reference outside the underlying object, we must force it to memory. Such a case can occur in Ada if we have unchecked conversion @@ -10910,6 +10920,7 @@ expand_expr_real_1 (tree exp, rtx target, machine_mode tmode, && GET_MODE_CLASS (ext_mode) == MODE_INT) reversep = TYPE_REVERSE_STORAGE_ORDER (type); + gcc_checking_assert (known_ge (bitpos, 0)); op0 = extract_bit_field (op0, bitsize, bitpos, unsignedp, (modifier == EXPAND_STACK_PARM ? NULL_RTX : target), diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 984b91a90d7..0e15c01727a 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -3179,10 +3179,16 @@ operand_equal_p (const_tree arg0, const_tree arg1, unsigned int flags) switch (TREE_CODE (arg0)) { case INDIRECT_REF: - if (!(flags & OEP_ADDRESS_OF) - && (TYPE_ALIGN (TREE_TYPE (arg0)) - != TYPE_ALIGN (TREE_TYPE (arg1)))) - return 0; + if (!(flags & OEP_ADDRESS_OF)) + { + if (TYPE_ALIGN (TREE_TYPE (arg0)) + != TYPE_ALIGN (TREE_TYPE (arg1))) + return 0; + /* Verify that the access types are compatible. */ + if (TYPE_MAIN_VARIANT (TREE_TYPE (arg0)) + != TYPE_MAIN_VARIANT (TREE_TYPE (arg1))) + return 0; + } flags &= ~OEP_ADDRESS_OF; return OP_SAME (0); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index f181bbd5bcf..b672b29b707 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,31 @@ +2019-05-03 Richard Biener + + Backport from mainline + 2019-03-14 Richard Biener + + PR middle-end/89698 + * g++.dg/torture/pr89698.C: New testcase. + + 2019-03-07 Richard Biener + + PR tree-optimization/89595 + * gcc.dg/torture/pr89595.c: New testcase. + + 2019-03-14 Richard Biener + + PR tree-optimization/89710 + * gcc.dg/torture/pr89710.c: New testcase. + + 2019-04-15 Richard Biener + + PR tree-optimization/90071 + * gcc.dg/torture/pr90071.c: New testcase. + + 2018-08-20 Bernd Edlinger + + PR target/86984 + * gcc.target/alpha/pr86984.c: New test. + 2019-04-30 Jakub Jelinek Backported from mainline diff --git a/gcc/tree-ssa-dom.c b/gcc/tree-ssa-dom.c index 0ebcc6d43c7..fc0ae33aadb 100644 --- a/gcc/tree-ssa-dom.c +++ b/gcc/tree-ssa-dom.c @@ -616,7 +616,7 @@ private: various tables mantained by DOM. Returns the taken edge if the statement is a conditional with a statically determined value. */ - edge optimize_stmt (basic_block, gimple_stmt_iterator); + edge optimize_stmt (basic_block, gimple_stmt_iterator *, bool *); }; /* Jump threading, redundancy elimination and const/copy propagation. @@ -1455,10 +1455,48 @@ dom_opt_dom_walker::before_dom_children (basic_block bb) m_avail_exprs_stack->pop_to_marker (); edge taken_edge = NULL; + /* Initialize visited flag ahead of us, it has undefined state on + pass entry. */ for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi)) + gimple_set_visited (gsi_stmt (gsi), false); + for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi);) { + /* Do not optimize a stmt twice, substitution might end up with + _3 = _3 which is not valid. */ + if (gimple_visited_p (gsi_stmt (gsi))) + { + gsi_next (&gsi); + continue; + } + + /* Compute range information and optimize the stmt. */ evrp_range_analyzer.record_ranges_from_stmt (gsi_stmt (gsi), false); - taken_edge = this->optimize_stmt (bb, gsi); + bool removed_p = false; + taken_edge = this->optimize_stmt (bb, &gsi, &removed_p); + if (!removed_p) + gimple_set_visited (gsi_stmt (gsi), true); + + /* Go back and visit stmts inserted by folding after substituting + into the stmt at gsi. */ + if (gsi_end_p (gsi)) + { + gcc_checking_assert (removed_p); + gsi = gsi_last_bb (bb); + while (!gsi_end_p (gsi) && !gimple_visited_p (gsi_stmt (gsi))) + gsi_prev (&gsi); + } + else + { + do + { + gsi_prev (&gsi); + } + while (!gsi_end_p (gsi) && !gimple_visited_p (gsi_stmt (gsi))); + } + if (gsi_end_p (gsi)) + gsi = gsi_start_bb (bb); + else + gsi_next (&gsi); } /* Now prepare to process dominated blocks. */ @@ -1923,7 +1961,8 @@ test_for_singularity (gimple *stmt, gcond *dummy_cond, condition to an equality condition. */ edge -dom_opt_dom_walker::optimize_stmt (basic_block bb, gimple_stmt_iterator si) +dom_opt_dom_walker::optimize_stmt (basic_block bb, gimple_stmt_iterator *si, + bool *removed_p) { gimple *stmt, *old_stmt; bool may_optimize_p; @@ -1931,7 +1970,7 @@ dom_opt_dom_walker::optimize_stmt (basic_block bb, gimple_stmt_iterator si) bool was_noreturn; edge retval = NULL; - old_stmt = stmt = gsi_stmt (si); + old_stmt = stmt = gsi_stmt (*si); was_noreturn = is_gimple_call (stmt) && gimple_call_noreturn_p (stmt); if (dump_file && (dump_flags & TDF_DETAILS)) @@ -1954,9 +1993,9 @@ dom_opt_dom_walker::optimize_stmt (basic_block bb, gimple_stmt_iterator si) /* Try to fold the statement making sure that STMT is kept up to date. */ - if (fold_stmt (&si)) + if (fold_stmt (si)) { - stmt = gsi_stmt (si); + stmt = gsi_stmt (*si); gimple_set_modified (stmt, true); if (dump_file && (dump_flags & TDF_DETAILS)) @@ -2005,8 +2044,8 @@ dom_opt_dom_walker::optimize_stmt (basic_block bb, gimple_stmt_iterator si) && DECL_BUILT_IN_CLASS (callee) == BUILT_IN_NORMAL && DECL_FUNCTION_CODE (callee) == BUILT_IN_CONSTANT_P) { - propagate_tree_value_into_stmt (&si, integer_zero_node); - stmt = gsi_stmt (si); + propagate_tree_value_into_stmt (si, integer_zero_node); + stmt = gsi_stmt (*si); } } @@ -2062,9 +2101,9 @@ dom_opt_dom_walker::optimize_stmt (basic_block bb, gimple_stmt_iterator si) } update_stmt_if_modified (stmt); - eliminate_redundant_computations (&si, m_const_and_copies, + eliminate_redundant_computations (si, m_const_and_copies, m_avail_exprs_stack); - stmt = gsi_stmt (si); + stmt = gsi_stmt (*si); /* Perform simple redundant store elimination. */ if (gimple_assign_single_p (stmt) @@ -2091,13 +2130,14 @@ dom_opt_dom_walker::optimize_stmt (basic_block bb, gimple_stmt_iterator si) { basic_block bb = gimple_bb (stmt); unlink_stmt_vdef (stmt); - if (gsi_remove (&si, true)) + if (gsi_remove (si, true)) { bitmap_set_bit (need_eh_cleanup, bb->index); if (dump_file && (dump_flags & TDF_DETAILS)) fprintf (dump_file, " Flagged to clear EH edges.\n"); } release_defs (stmt); + *removed_p = true; return retval; } } diff --git a/gcc/tree-ssa-loop-ch.c b/gcc/tree-ssa-loop-ch.c index 92e0c435e98..1d99be305ab 100644 --- a/gcc/tree-ssa-loop-ch.c +++ b/gcc/tree-ssa-loop-ch.c @@ -99,7 +99,7 @@ should_duplicate_loop_header_p (basic_block header, struct loop *loop, } last = last_stmt (header); - if (gimple_code (last) != GIMPLE_COND) + if (!last || gimple_code (last) != GIMPLE_COND) { if (dump_file && (dump_flags & TDF_DETAILS)) fprintf (dump_file, diff --git a/gcc/tree-ssa-reassoc.c b/gcc/tree-ssa-reassoc.c index 91f85990b09..dacb668ff84 100644 --- a/gcc/tree-ssa-reassoc.c +++ b/gcc/tree-ssa-reassoc.c @@ -2143,7 +2143,8 @@ init_range_entry (struct range_entry *r, tree exp, gimple *stmt) exp_type = boolean_type_node; } - if (TREE_CODE (arg0) != SSA_NAME) + if (TREE_CODE (arg0) != SSA_NAME + || SSA_NAME_OCCURS_IN_ABNORMAL_PHI (arg0)) break; loc = gimple_location (stmt); switch (code) -- cgit v1.2.3 From 4cc8781aaeef39611b42d7592fd2e5f3d7c9e328 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Sat, 4 May 2019 00:16:09 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270865 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 0da9b2ee7af..5f6d0f687b2 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190503 +20190504 -- cgit v1.2.3 From 3caa12cf4b749afb0a308fe421aaff6ec14fa456 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Sun, 5 May 2019 00:16:12 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270879 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 5f6d0f687b2..85c1ae6931e 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190504 +20190505 -- cgit v1.2.3 From 5f9d451e3f7e09950f502a62c85fe97fca2640b3 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Mon, 6 May 2019 00:16:09 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270890 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 85c1ae6931e..fdc375fade3 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190505 +20190506 -- cgit v1.2.3 From fa569223c630cefa499214f7664027c351a49120 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Mon, 6 May 2019 09:40:15 +0000 Subject: 2019-05-03 Richard Biener Backport from mainline 2019-03-14 Richard Biener PR middle-end/89698 * fold-const.c (operand_equal_p): For INDIRECT_REF check that the access types are similar. * g++.dg/torture/pr89698.C: New testcase. 2019-03-07 Richard Biener PR tree-optimization/89595 * tree-ssa-dom.c (dom_opt_dom_walker::optimize_stmt): Take stmt iterator as reference, take boolean output parameter to indicate whether the stmt was removed and thus the iterator already advanced. (dom_opt_dom_walker::before_dom_children): Re-iterate over stmts created by folding. * gcc.dg/torture/pr89595.c: New testcase. 2019-03-14 Richard Biener PR tree-optimization/89710 * tree-ssa-loop-ch.c (should_duplicate_loop_header_p): Use safe_dyn_cast. * gcc.dg/torture/pr89710.c: New testcase. 2019-04-15 Richard Biener PR tree-optimization/90071 * tree-ssa-reassoc.c (init_range_entry): Do not pick up abnormal operands from def stmts. * gcc.dg/torture/pr90071.c: New testcase. 2018-08-20 Bernd Edlinger PR target/86984 * expr.c (expand_assignment): Assert that bitpos is positive. (store_field): Likewise (expand_expr_real_1): Make sure that bitpos is positive. * config/alpha/alpha.h (CONSTANT_ADDRESS_P): Avoid signed integer overflow. * gcc.target/alpha/pr86984.c: New test. 2019-03-14 Richard Biener PR target/89711 * config/i386/i386.c (make_resolver_func): Properly set DECL_CONTEXT on the RESULT_DECL. * config/rs6000/rs6000.c (make_resolver_func): Likewise. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270904 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/testsuite/g++.dg/torture/pr89698.C | 28 ++++++++++ gcc/testsuite/gcc.dg/torture/pr89595.c | 39 +++++++++++++ gcc/testsuite/gcc.dg/torture/pr89710.c | 30 ++++++++++ gcc/testsuite/gcc.dg/torture/pr90071.c | 24 ++++++++ gcc/testsuite/gcc.target/alpha/pr86984.c | 96 ++++++++++++++++++++++++++++++++ 5 files changed, 217 insertions(+) create mode 100644 gcc/testsuite/g++.dg/torture/pr89698.C create mode 100644 gcc/testsuite/gcc.dg/torture/pr89595.c create mode 100644 gcc/testsuite/gcc.dg/torture/pr89710.c create mode 100644 gcc/testsuite/gcc.dg/torture/pr90071.c create mode 100644 gcc/testsuite/gcc.target/alpha/pr86984.c diff --git a/gcc/testsuite/g++.dg/torture/pr89698.C b/gcc/testsuite/g++.dg/torture/pr89698.C new file mode 100644 index 00000000000..fbeb7976c0f --- /dev/null +++ b/gcc/testsuite/g++.dg/torture/pr89698.C @@ -0,0 +1,28 @@ +/* { dg-do run } */ + +extern "C" void abort (void); + +class A { + virtual void f(){}; +public: + int x; + A(int in): x(in) {}; +}; + +class B: public A { +public: + int y; + B(int in):A(in-1), y(in) {}; +}; + +int test(void) +{ + int res; + B b(2); + A* bp = &b; + void* vp = dynamic_cast(bp); + if (((A*)vp)->x == 1 && ((B*)vp)->y == 2) + return 1; + return 0; +} +int main() { if (test() != 1) abort (); return 0; } diff --git a/gcc/testsuite/gcc.dg/torture/pr89595.c b/gcc/testsuite/gcc.dg/torture/pr89595.c new file mode 100644 index 00000000000..ebd834f32a4 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr89595.c @@ -0,0 +1,39 @@ +/* { dg-do run } */ +/* { dg-additional-options "-fgimple" } */ + +int __attribute__((noipa)) +__GIMPLE(startwith("dom")) bar(int cond, int val) +{ + int i; + + if (0 != 0) + goto bb_6; + else + goto bb_2; + +bb_2: + if (cond_5(D) != 0) + goto bb_4; + else + goto bb_5; + +bb_4: + i_6 = val_2(D); + i_1 = val_2(D) > 0 ? i_6 : 0; + +bb_5: + i_3 = __PHI (bb_4: i_1, bb_2: 0); + return i_3; + +bb_6: + i_4 = 1; + i_9 = 2; + goto bb_2; +} + +int main() +{ + if (bar (1, 1) != 1) + __builtin_abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/torture/pr89710.c b/gcc/testsuite/gcc.dg/torture/pr89710.c new file mode 100644 index 00000000000..01e875e1042 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr89710.c @@ -0,0 +1,30 @@ +/* { dg-do compile } */ + +void +gm (int *); + +__attribute__ ((returns_twice)) void +jg (void) +{ +} + +void +eb (void) +{ + int r6 = 0; + + if (r6 != 0) + gm (&r6); +} + +void +gm (int *r6) +{ + jg (); + + for (;;) + { + eb (); + *r6 = 0; + } +} diff --git a/gcc/testsuite/gcc.dg/torture/pr90071.c b/gcc/testsuite/gcc.dg/torture/pr90071.c new file mode 100644 index 00000000000..bfa7239139a --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr90071.c @@ -0,0 +1,24 @@ +/* { dg-do compile } */ + +int a; +static int b; + +void +foo () +{ + int d; + int e = (int) (__INTPTR_TYPE__) &&f; + void *g = &&h; +h: ++e; + if (a) + i: goto *g; + for (;;) + { + e = 0; + if (b) + goto i; + } +f: + goto *({ d || e < 0 || e >= 2; }); + &e; +} diff --git a/gcc/testsuite/gcc.target/alpha/pr86984.c b/gcc/testsuite/gcc.target/alpha/pr86984.c new file mode 100644 index 00000000000..f6a98d4ed9c --- /dev/null +++ b/gcc/testsuite/gcc.target/alpha/pr86984.c @@ -0,0 +1,96 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -Wall -Wwrite-strings -Werror -fmerge-all-constants -fno-stack-protector -mieee -fdump-rtl-expand" } */ + +struct expression { + unsigned long int num; +}; +union YYSTYPE { + unsigned long int num; + struct expression *exp; +}; + +typedef union YYSTYPE YYSTYPE; + +struct expression * new_exp_0 (int); + +union yyalloc { + short yyss_alloc; +}; + +static const signed char yypact[] = { + -9, -9, -10, -10, -9, 8, 36, -10, 13, -10, -9, -9, -9, -9, -9, -9, -9, -10, 26, 41, 45, 18, -2, 14, -10, -9, 36 }; +static const unsigned char yydefact[] = { + 0, 0, 12, 11, 0, 0, 2, 10, 0, 1, 0, 0, 0, 0, 0, 0, 0, 13, 0, 4, 5, 6, 7, 8, 9, 0, 3 }; + +static const signed char yypgoto[3] = "\366\366\377"; +static const signed char yydefgoto[3] = "\377\005\006"; + +static const unsigned char yytable[] = { + 7, 1, 2, 8, 3, 4, 15, 16, 9, 18, 19, 20, 21, 22, 23, 24, 10, 11, 12, 13, 14, 15, 16, 16, 26, 14, 15, 16, 17, 10, 11, 12, 13, 14, 15, 16, 0, 0, 25, 10, 11, 12, 13, 14, 15, 16, 12, 13, 14, 15, 16, 13, 14, 15, 16 }; + +static const signed char yycheck[] = { + 1, 10, 11, 4, 13, 14, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 3, 4, 5, 6, 7, 8, 9, 9, 25, 7, 8, 9, 15, 3, 4, 5, 6, 7, 8, 9, -1, -1, 12, 3, 4, 5, 6, 7, 8, 9, 5, 6, 7, 8, 9, 6, 7, 8, 9 }; + +static const unsigned char yyr1[] = { + 0, 16, 17, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18 }; + +static const unsigned char yyr2[] = { + 0, 2, 1, 5, 3, 3, 3, 3, 3, 3, 2, 1, 1, 3 }; + +int __gettextparse (void) +{ + int yystate = 0; + short yyssa[200]; + short *yyss = yyss; + short *yyssp = yyssa; + YYSTYPE yyvsa[200]; + YYSTYPE *yyvsp = yyvsa; + enum { yystacksize = 200 }; + int yylen = 0; + goto yysetstate; + yynewstate: yyssp++; + yysetstate: *yyssp = yystate; + + if (yyss + yystacksize - 1 <= yyssp) + { + long unsigned int yysize = yyssp - yyss + 1; + { + short *yyss1 = yyss; + union yyalloc *yyptr = (union yyalloc *) __builtin_malloc ((yystacksize * (sizeof (short) + sizeof (YYSTYPE)) + (sizeof (union yyalloc) - 1))); + if (!yyptr) return 0; + __builtin_memcpy (&yyptr->yyss_alloc, yyss, yysize * sizeof *(yyss)); + yyss = &yyptr->yyss_alloc; + if (yyss1 != yyssa) __builtin_free (yyss1); + } + if (yyss + yystacksize - 1 <= yyssp) + return 0; + } + + int yyn = yypact[yystate]; + if (yyn == -10) + goto yydefault; + + yyn = yytable[yyn]; + if (yyn <= 0) + goto yyreduce; + + yydefault: yyn = yydefact[yystate]; + yyreduce: yylen = yyr2[yyn]; + + YYSTYPE yyval; + if (yyn == 12 && (yyval.exp = new_exp_0 (0)) != 0) + (yyval.exp)->num = (yyvsp[0].num); + + (yyvsp -= yylen, yyssp -= yylen); + yyn = yyr1[yyn]; + yystate = yypgoto[yyn - 16] + *yyssp; + if (0 <= yystate && yystate <= 54 && yycheck[yystate] == *yyssp) + yystate = yytable[yystate]; + else + yystate = yydefgoto[yyn - 16]; + + goto yynewstate; +} + +/* { dg-final { scan-rtl-dump-not "const_int 230584300921" "expand" } } */ +/* { dg-final { scan-assembler-not "yypgoto\\+230584300921" } } */ -- cgit v1.2.3 From 45040f6c5c1a0cfad4460baa055e7697c7194129 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Mon, 6 May 2019 12:40:18 +0000 Subject: 2019-05-06 Richard Biener PR bootstrap/90359 Backport from mainline 2019-03-11 Jakub Jelinek PR middle-end/89655 PR bootstrap/89656 * vr-values.c (vr_values::update_value_range): If old_vr->varying_p (), don't update it, make new_vr also VARYING and return false. * gcc.c-torture/compile/pr89655.c: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270907 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 12 ++++++++++++ gcc/testsuite/ChangeLog | 10 ++++++++++ gcc/testsuite/gcc.c-torture/compile/pr89655.c | 15 +++++++++++++++ gcc/vr-values.c | 7 ++++++- 4 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr89655.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 216e48bb2d0..04037522c12 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,15 @@ +2019-05-06 Richard Biener + + PR bootstrap/90359 + Backport from mainline + 2019-03-11 Jakub Jelinek + + PR middle-end/89655 + PR bootstrap/89656 + * vr-values.c (vr_values::update_value_range): If + old_vr->varying_p (), don't update it, make new_vr also VARYING + and return false. + 2019-05-03 Richard Biener Backport from mainline diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b672b29b707..34708a4c6ff 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,13 @@ +2019-05-06 Richard Biener + + PR bootstrap/90359 + Backport from mainline + 2019-03-11 Jakub Jelinek + + PR middle-end/89655 + PR bootstrap/89656 + * gcc.c-torture/compile/pr89655.c: New test. + 2019-05-03 Richard Biener Backport from mainline diff --git a/gcc/testsuite/gcc.c-torture/compile/pr89655.c b/gcc/testsuite/gcc.c-torture/compile/pr89655.c new file mode 100644 index 00000000000..f304c673206 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr89655.c @@ -0,0 +1,15 @@ +/* PR middle-end/89655 */ + +int a, b, d; +char *c; + +void +foo (void) +{ + int f = a; + for (;;) + { + for (f = 0; f < (a > 3 ? : a); f++) + b = c[f] ? c[(f + 2 > a - 1 ? a - 1 : 2) * d] : 0; + } +} diff --git a/gcc/vr-values.c b/gcc/vr-values.c index 22243e95bd6..aa8d81d22d6 100644 --- a/gcc/vr-values.c +++ b/gcc/vr-values.c @@ -211,7 +211,12 @@ vr_values::update_value_range (const_tree var, value_range *new_vr) the same. We may not have is_new when transitioning to UNDEFINED. If old_vr->type is VARYING, we shouldn't be called. */ - if (new_vr->type == VR_UNDEFINED) + if (old_vr->type == VR_VARYING) + { + set_value_range_to_varying (new_vr); + is_new = false; + } + else if (new_vr->type == VR_UNDEFINED) { BITMAP_FREE (new_vr->equiv); set_value_range_to_varying (old_vr); -- cgit v1.2.3 From 562363d45fcd890d78e872c40b1d433fdd07a253 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Tue, 7 May 2019 00:16:27 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270931 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index fdc375fade3..962d70b7e9f 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190506 +20190507 -- cgit v1.2.3 From 6e4cc4608a3d703669a0d2348288df0e9ab49a7d Mon Sep 17 00:00:00 2001 From: Rainer Orth Date: Tue, 7 May 2019 15:23:00 +0000 Subject: Fix make install-gcc-specs with empty GCC_SPECS_FILES * gcc-interface/Makefile.in (install-gcc-specs): Use foreach. Honor DESTDIR. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270949 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ada/ChangeLog | 5 +++++ gcc/ada/gcc-interface/Makefile.in | 5 ++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 626c590a6ab..52ac68e07b0 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,8 @@ +2019-05-07 Rainer Orth + + * gcc-interface/Makefile.in (install-gcc-specs): Use foreach. + Honor DESTDIR. + 2019-02-23 Eric Botcazou PR ada/89349 diff --git a/gcc/ada/gcc-interface/Makefile.in b/gcc/ada/gcc-interface/Makefile.in index ebb955ebce5..0258f106d40 100644 --- a/gcc/ada/gcc-interface/Makefile.in +++ b/gcc/ada/gcc-interface/Makefile.in @@ -2285,9 +2285,8 @@ gnatlink-re: ../stamp-tools gnatmake-re install-gcc-specs: # Install all the requested GCC spec files. - for f in $(GCC_SPEC_FILES); do \ - $(INSTALL_DATA_DATE) $(srcdir)/ada/$$f $(libsubdir)/; \ - done + $(foreach f,$(GCC_SPEC_FILES), \ + $(INSTALL_DATA_DATE) $(srcdir)/ada/$(f) $(DESTDIR)$(libsubdir)/;) install-gnatlib: ../stamp-gnatlib-$(RTSDIR) install-gcc-specs $(RMDIR) $(DESTDIR)$(ADA_RTL_OBJ_DIR) -- cgit v1.2.3 From 58f18378aeaeb16c7bce69dbe90f75d27b17e3b1 Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Tue, 7 May 2019 15:45:42 +0000 Subject: LWG 2537 fix priority_queue constructors to establish invariant This change is safe to make ion the branch, because the constructors are currently incorrect and unusable (unless the supplied container already contains a heap, in which case the new make_heap calls are redundant but harmless). Backport from mainline 2019-02-14 Jonathan Wakely * doc/xml/manual/intro.xml: Document LWG 2537 status. * include/bits/stl_queue.h (priority_queue(const Compare&, const Container&, const Alloc&)) (priority_queue(const Compare&, Container&&, const Alloc&)): Call make_heap. * testsuite/23_containers/priority_queue/dr2537.cc: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270956 138bc75d-0d04-0410-961f-82ee72b054a4 --- libstdc++-v3/ChangeLog | 12 ++++++ libstdc++-v3/doc/xml/manual/intro.xml | 8 ++++ libstdc++-v3/include/bits/stl_queue.h | 8 +++- .../23_containers/priority_queue/dr2537.cc | 50 ++++++++++++++++++++++ 4 files changed, 76 insertions(+), 2 deletions(-) create mode 100644 libstdc++-v3/testsuite/23_containers/priority_queue/dr2537.cc diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 45bb87b3342..ef2556696bf 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,15 @@ +2019-05-07 Jonathan Wakely + + Backport from mainline + 2019-02-14 Jonathan Wakely + + * doc/xml/manual/intro.xml: Document LWG 2537 status. + * include/bits/stl_queue.h + (priority_queue(const Compare&, const Container&, const Alloc&)) + (priority_queue(const Compare&, Container&&, const Alloc&)): Call + make_heap. + * testsuite/23_containers/priority_queue/dr2537.cc: New test. + 2019-02-22 Jonathan Wakely PR libstdc++/89446 diff --git a/libstdc++-v3/doc/xml/manual/intro.xml b/libstdc++-v3/doc/xml/manual/intro.xml index 71c2d8bbba0..099045c3375 100644 --- a/libstdc++-v3/doc/xml/manual/intro.xml +++ b/libstdc++-v3/doc/xml/manual/intro.xml @@ -1105,6 +1105,14 @@ requirements of the license of GCC. ill-formed. + 2537: + Constructors for priority_queue taking allocators + should call make_heap + + + Call make_heap. + + 2583: There is no way to supply an allocator for basic_string(str, pos) diff --git a/libstdc++-v3/include/bits/stl_queue.h b/libstdc++-v3/include/bits/stl_queue.h index 60116c1b49a..f6828def591 100644 --- a/libstdc++-v3/include/bits/stl_queue.h +++ b/libstdc++-v3/include/bits/stl_queue.h @@ -504,14 +504,18 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION priority_queue(const _Compare& __x, const _Alloc& __a) : c(__a), comp(__x) { } + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2537. Constructors [...] taking allocators should call make_heap template> priority_queue(const _Compare& __x, const _Sequence& __c, const _Alloc& __a) - : c(__c, __a), comp(__x) { } + : c(__c, __a), comp(__x) + { std::make_heap(c.begin(), c.end(), comp); } template> priority_queue(const _Compare& __x, _Sequence&& __c, const _Alloc& __a) - : c(std::move(__c), __a), comp(__x) { } + : c(std::move(__c), __a), comp(__x) + { std::make_heap(c.begin(), c.end(), comp); } template> priority_queue(const priority_queue& __q, const _Alloc& __a) diff --git a/libstdc++-v3/testsuite/23_containers/priority_queue/dr2537.cc b/libstdc++-v3/testsuite/23_containers/priority_queue/dr2537.cc new file mode 100644 index 00000000000..ecb51780ee5 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/priority_queue/dr2537.cc @@ -0,0 +1,50 @@ +// Copyright (C) 2019 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 +// . + +// { dg-do run { target c++11 } } + +#include +#include + +struct Q : std::priority_queue +{ + using priority_queue::priority_queue; + + bool is_heap() const + { return std::is_heap(c.begin(), c.end()); } +}; + +void +test01() +{ + const Q::value_compare cmp; + const Q::container_type c{ 2, 3, 5, 7, 11, 13, 17, 19, 23 }; + const Q::container_type::allocator_type a; + + Q q1(cmp, c, a); + VERIFY( q1.is_heap() ); + + auto c2 = c; + Q q2(cmp, std::move(c2), a); + VERIFY( q2.is_heap() ); +} + +int +main() +{ + test01(); +} -- cgit v1.2.3 From 90f0f303b621b27c8aa9681769a3f56421ea4155 Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Tue, 7 May 2019 15:45:51 +0000 Subject: DR 2586 fix value category in uses-allocator checks Because uses-allocator construction is invariably done with a const lvalue the __uses_alloc helper should use a const lvalue for the is_constructible checks. Otherwise, it can detect that the type can be constructed from an rvalue, and then an error happens when a const lvalue is passed to the constructor instead. Prior to LWG DR 2586 scoped_allocator_adaptor incorrectly used an rvalue type in the is_constructible check and then used a non-const lvalue for the actual construction. The other components using uses-allocator construction (tuple and polymorphic_allocator) have always done so with a const lvalue allocator, although the use of __use_alloc in our implementation meant they behaved the same as scoped_allocator_adaptor and incorrectly used rvalues for the is_constructible checks. In C++20 the P0591R4 changes mean that all uses-allocator construction is defined in terms of the new uses_allocator_construction_args functions, which always use a const lvalue allocator. The changes in this patch ensure that the __use_alloc helper correctly matches the requirements in the standard, consistently using a const lvalue allocator for the is_constructible checks and the actual constructor arguments. Backport from mainline 2019-02-14 Jonathan Wakely * doc/xml/manual/intro.xml: Document LWG 2586 status. * include/bits/uses_allocator.h (__uses_alloc): Use const lvalue allocator type in is_constructible checks. * testsuite/20_util/scoped_allocator/69293_neg.cc: Adjust dg-error. * testsuite/20_util/scoped_allocator/dr2586.cc: New test. * testsuite/20_util/tuple/cons/allocators.cc: Add test using problematic type from LWG 2586 discussion. * testsuite/20_util/uses_allocator/69293_neg.cc: Adjust dg-error. * testsuite/20_util/uses_allocator/cons_neg.cc: Likewise. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270957 138bc75d-0d04-0410-961f-82ee72b054a4 --- libstdc++-v3/ChangeLog | 13 +++++++++ libstdc++-v3/doc/xml/manual/intro.xml | 8 +++++ libstdc++-v3/include/bits/uses_allocator.h | 11 ++++--- .../20_util/scoped_allocator/69293_neg.cc | 2 +- .../testsuite/20_util/scoped_allocator/dr2586.cc | 34 ++++++++++++++++++++++ .../testsuite/20_util/tuple/cons/allocators.cc | 14 +++++++++ .../testsuite/20_util/uses_allocator/69293_neg.cc | 2 +- .../testsuite/20_util/uses_allocator/cons_neg.cc | 2 +- 8 files changed, 79 insertions(+), 7 deletions(-) create mode 100644 libstdc++-v3/testsuite/20_util/scoped_allocator/dr2586.cc diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index ef2556696bf..464bcf8811d 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -3,6 +3,19 @@ Backport from mainline 2019-02-14 Jonathan Wakely + * doc/xml/manual/intro.xml: Document LWG 2586 status. + * include/bits/uses_allocator.h (__uses_alloc): Use const lvalue + allocator type in is_constructible checks. + * testsuite/20_util/scoped_allocator/69293_neg.cc: Adjust dg-error. + * testsuite/20_util/scoped_allocator/dr2586.cc: New test. + * testsuite/20_util/tuple/cons/allocators.cc: Add test using + problematic type from LWG 2586 discussion. + * testsuite/20_util/uses_allocator/69293_neg.cc: Adjust dg-error. + * testsuite/20_util/uses_allocator/cons_neg.cc: Likewise. + + Backport from mainline + 2019-02-14 Jonathan Wakely + * doc/xml/manual/intro.xml: Document LWG 2537 status. * include/bits/stl_queue.h (priority_queue(const Compare&, const Container&, const Alloc&)) diff --git a/libstdc++-v3/doc/xml/manual/intro.xml b/libstdc++-v3/doc/xml/manual/intro.xml index 099045c3375..66ad6e7062d 100644 --- a/libstdc++-v3/doc/xml/manual/intro.xml +++ b/libstdc++-v3/doc/xml/manual/intro.xml @@ -1120,6 +1120,14 @@ requirements of the license of GCC. Add new constructor + 2586: + Wrong value category used in scoped_allocator_adaptor::construct() + + + Change internal helper for uses-allocator construction + to always check using const lvalue allocators. + + 2684: priority_queue lacking comparator typedef diff --git a/libstdc++-v3/include/bits/uses_allocator.h b/libstdc++-v3/include/bits/uses_allocator.h index 820a2a59894..203758cfee3 100644 --- a/libstdc++-v3/include/bits/uses_allocator.h +++ b/libstdc++-v3/include/bits/uses_allocator.h @@ -83,14 +83,17 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template struct __uses_alloc : conditional< - is_constructible<_Tp, allocator_arg_t, _Alloc, _Args...>::value, + is_constructible<_Tp, allocator_arg_t, const _Alloc&, _Args...>::value, __uses_alloc1<_Alloc>, __uses_alloc2<_Alloc>>::type { + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2586. Wrong value category used in scoped_allocator_adaptor::construct static_assert(__or_< - is_constructible<_Tp, allocator_arg_t, _Alloc, _Args...>, - is_constructible<_Tp, _Args..., _Alloc>>::value, "construction with" - " an allocator must be possible if uses_allocator is true"); + is_constructible<_Tp, allocator_arg_t, const _Alloc&, _Args...>, + is_constructible<_Tp, _Args..., const _Alloc&>>::value, + "construction with an allocator must be possible" + " if uses_allocator is true"); }; template diff --git a/libstdc++-v3/testsuite/20_util/scoped_allocator/69293_neg.cc b/libstdc++-v3/testsuite/20_util/scoped_allocator/69293_neg.cc index 621ff47c7a3..3b2da30a065 100644 --- a/libstdc++-v3/testsuite/20_util/scoped_allocator/69293_neg.cc +++ b/libstdc++-v3/testsuite/20_util/scoped_allocator/69293_neg.cc @@ -46,5 +46,5 @@ test01() scoped_alloc sa; auto p = sa.allocate(1); sa.construct(p); // this is required to be ill-formed - // { dg-error "static assertion failed" "" { target *-*-* } 90 } + // { dg-error "failed: .* uses_allocator is true" "" { target *-*-* } 0 } } diff --git a/libstdc++-v3/testsuite/20_util/scoped_allocator/dr2586.cc b/libstdc++-v3/testsuite/20_util/scoped_allocator/dr2586.cc new file mode 100644 index 00000000000..11aab8a420b --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/scoped_allocator/dr2586.cc @@ -0,0 +1,34 @@ +// Copyright (C) 2019 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 +// . + +// { dg-do compile { target c++11 } } + +#include +#include + +// DR 2586. Wrong value category used in scoped_allocator_adaptor::construct() + +struct X { + using allocator_type = std::allocator; + X(std::allocator_arg_t, allocator_type&&) { } + X(const allocator_type&) { } +}; + +int main() { + std::scoped_allocator_adaptor> sa; + sa.construct(sa.allocate(1)); +} diff --git a/libstdc++-v3/testsuite/20_util/tuple/cons/allocators.cc b/libstdc++-v3/testsuite/20_util/tuple/cons/allocators.cc index eb444f76cbe..85e43c9c16f 100644 --- a/libstdc++-v3/testsuite/20_util/tuple/cons/allocators.cc +++ b/libstdc++-v3/testsuite/20_util/tuple/cons/allocators.cc @@ -181,9 +181,23 @@ void test02() test_type empty = make_tuple(); } +void test03() +{ + struct dr2586 + { + using allocator_type = std::allocator; + dr2586(std::allocator_arg_t, allocator_type&&) { } + dr2586(const allocator_type&) { } + }; + + const dr2586::allocator_type a; + std::tuple t{std::allocator_arg, a}; +} + int main() { test01(); test02(); + test03(); return 0; } diff --git a/libstdc++-v3/testsuite/20_util/uses_allocator/69293_neg.cc b/libstdc++-v3/testsuite/20_util/uses_allocator/69293_neg.cc index 348ed41a7bc..b1c6eab4c23 100644 --- a/libstdc++-v3/testsuite/20_util/uses_allocator/69293_neg.cc +++ b/libstdc++-v3/testsuite/20_util/uses_allocator/69293_neg.cc @@ -44,5 +44,5 @@ test01() { alloc_type a; std::tuple t(std::allocator_arg, a); // this is required to be ill-formed - // { dg-error "static assertion failed" "" { target *-*-* } 90 } + // { dg-error "failed: .* uses_allocator is true" "" { target *-*-* } 0 } } diff --git a/libstdc++-v3/testsuite/20_util/uses_allocator/cons_neg.cc b/libstdc++-v3/testsuite/20_util/uses_allocator/cons_neg.cc index 8894e389cec..b0525d1f290 100644 --- a/libstdc++-v3/testsuite/20_util/uses_allocator/cons_neg.cc +++ b/libstdc++-v3/testsuite/20_util/uses_allocator/cons_neg.cc @@ -43,4 +43,4 @@ void test01() tuple t(allocator_arg, a, 1); } -// { dg-error "static assertion failed" "" { target *-*-* } 90 } +// { dg-error "failed: .* uses_allocator is true" "" { target *-*-* } 0 } -- cgit v1.2.3 From e66b609e8cac9fce2844f4e01c58e03a7e8dcea1 Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Tue, 7 May 2019 15:45:55 +0000 Subject: Fix text of hyperlink in manual Backport from mainline 2019-03-08 Jonathan Wakely * doc/xml/manual/using.xml: Use link element instead of xref. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270958 138bc75d-0d04-0410-961f-82ee72b054a4 --- libstdc++-v3/ChangeLog | 5 +++++ libstdc++-v3/doc/html/manual/using_macros.html | 3 ++- libstdc++-v3/doc/xml/manual/using.xml | 4 ++-- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 464bcf8811d..e08d8812224 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,5 +1,10 @@ 2019-05-07 Jonathan Wakely + Backport from mainline + 2019-03-08 Jonathan Wakely + + * doc/xml/manual/using.xml: Use link element instead of xref. + Backport from mainline 2019-02-14 Jonathan Wakely diff --git a/libstdc++-v3/doc/html/manual/using_macros.html b/libstdc++-v3/doc/html/manual/using_macros.html index 7030bd2d0fd..dad6564a97d 100644 --- a/libstdc++-v3/doc/html/manual/using_macros.html +++ b/libstdc++-v3/doc/html/manual/using_macros.html @@ -116,7 +116,8 @@ enabled for std::vector<T, std::allocator<T>> and only when std::allocator is derived from - the section called “Implementation”. The annotations + new_allocator + or malloc_allocator. The annotations must be present on all vector operations or none, so this macro must be defined to the same value for all translation units that create, destroy or modify vectors. diff --git a/libstdc++-v3/doc/xml/manual/using.xml b/libstdc++-v3/doc/xml/manual/using.xml index 873fac402b5..c9013c32d27 100644 --- a/libstdc++-v3/doc/xml/manual/using.xml +++ b/libstdc++-v3/doc/xml/manual/using.xml @@ -1130,8 +1130,8 @@ g++ -Winvalid-pch -I. -include stdc++.h -H -g -O2 hello.cc -o test.exe enabled for std::vector<T, std::allocator<T>> and only when std::allocator is derived from - new_allocator - or malloc_allocator. The annotations + new_allocator + or malloc_allocator. The annotations must be present on all vector operations or none, so this macro must be defined to the same value for all translation units that create, destroy or modify vectors. -- cgit v1.2.3 From 72efb96126aa42e75a9befcb5e59ec0378c4790b Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Tue, 7 May 2019 15:45:59 +0000 Subject: PR libstdc++/89629 fix _Hash_bytes for lengths > INT_MAX Backport from mainline 2019-03-11 Jonathan Wakely PR libstdc++/89629 * libsupc++/hash_bytes.cc [__SIZEOF_SIZE_T__ == 8] (_Hash_bytes): Use correct type for len_aligned. * testsuite/20_util/hash/89629.cc: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270959 138bc75d-0d04-0410-961f-82ee72b054a4 --- libstdc++-v3/ChangeLog | 8 ++++++ libstdc++-v3/libsupc++/hash_bytes.cc | 2 +- libstdc++-v3/testsuite/20_util/hash/89629.cc | 43 ++++++++++++++++++++++++++++ 3 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 libstdc++-v3/testsuite/20_util/hash/89629.cc diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index e08d8812224..c1d54b5f319 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,5 +1,13 @@ 2019-05-07 Jonathan Wakely + Backport from mainline + 2019-03-11 Jonathan Wakely + + PR libstdc++/89629 + * libsupc++/hash_bytes.cc [__SIZEOF_SIZE_T__ == 8] (_Hash_bytes): + Use correct type for len_aligned. + * testsuite/20_util/hash/89629.cc: New test. + Backport from mainline 2019-03-08 Jonathan Wakely diff --git a/libstdc++-v3/libsupc++/hash_bytes.cc b/libstdc++-v3/libsupc++/hash_bytes.cc index c6a563e76ba..ee8e2235818 100644 --- a/libstdc++-v3/libsupc++/hash_bytes.cc +++ b/libstdc++-v3/libsupc++/hash_bytes.cc @@ -139,7 +139,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION // Remove the bytes not divisible by the sizeof(size_t). This // allows the main loop to process the data as 64-bit integers. - const int len_aligned = len & ~0x7; + const size_t len_aligned = len & ~(size_t)0x7; const char* const end = buf + len_aligned; size_t hash = seed ^ (len * mul); for (const char* p = buf; p != end; p += 8) diff --git a/libstdc++-v3/testsuite/20_util/hash/89629.cc b/libstdc++-v3/testsuite/20_util/hash/89629.cc new file mode 100644 index 00000000000..fd8273087fc --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/hash/89629.cc @@ -0,0 +1,43 @@ +// Copyright (C) 2019 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 +// . + +// { dg-do run { target { lp64 || llp64 } } } +// { dg-require-effective-target c++11 } +// { dg-require-effective-target run_expensive_tests } + +#include +#include + +void +test01() +{ + const std::size_t big = std::size_t(1) << 31; + std::string s; + try { + s.resize(big, 'a'); + } catch (const std::bad_alloc&) { + return; // try to avoid a FAIL if memory allocation fails + } + // PR libstdc++/89629 + (void) std::hash{}(s); +} + +int +main() +{ + test01(); +} -- cgit v1.2.3 From 075fd07ebff2b377c73d5c9c09f9aa2cbaef2f4d Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Tue, 7 May 2019 15:46:05 +0000 Subject: PR libstdc++/85965 delay static assertions until types are complete The static assertions added for PR libstdc++/48101 were at class scope and so were evaluated too eagerly, when it might not be possible to determine whether the function objects are invocable with the key types. The problematic cases are where the key type is not known to be convertible to the argument type(s) of the function object until later, after a type has been completed. Specifically, if the key type is a pointer to a derived class and the function object's argument type is a pointer to a base class, then the derived-to-base conversion is only valid once the derived type is complete. By moving the static assertions to the destructor they will only be evaluated when the destructor is instantiated, at which point whether the key type can be passed to the function object should be knowable. The ideal place to do the checks would be only when the function objects are actually invoked, but that would mean adding the checks in numerous places, so the destructor is used instead. The tests need to be adjusted because the "required from here" line is now the location of the destructor, not the point of instantiation in the test file. For the map and multimap tests which check two specializations, the dg-error matching the assertion text matches both cases. Also check the diagnostic output for the template arguments, to ensure both specializations trigger the assertion. Backport from mainline 2019-03-26 Jonathan Wakely PR libstdc++/85965 * include/bits/hashtable.h (_Hashtable): Move static assertions to destructor so they are not evaluated until the _Key type is complete. * include/bits/stl_tree.h (_Rb_tree): Likewise. * testsuite/23_containers/set/85965.cc: New test. * testsuite/23_containers/unordered_set/85965.cc: New test. * testsuite/23_containers/map/48101_neg.cc: Replace "here" errors with regexp matching the corresponding _Rb_tree specialization. * testsuite/23_containers/multimap/48101_neg.cc: Likewise. * testsuite/23_containers/multiset/48101_neg.cc: Remove "here" error. * testsuite/23_containers/set/48101_neg.cc: Likewise. * testsuite/23_containers/unordered_map/48101_neg.cc: Likewise. * testsuite/23_containers/unordered_multimap/48101_neg.cc: Likewise. * testsuite/23_containers/unordered_multiset/48101_neg.cc: Likewise. * testsuite/23_containers/unordered_set/48101_neg.cc: Likewise. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270960 138bc75d-0d04-0410-961f-82ee72b054a4 --- libstdc++-v3/ChangeLog | 19 ++++++++++++++ libstdc++-v3/include/bits/hashtable.h | 11 ++++---- libstdc++-v3/include/bits/stl_tree.h | 27 +++++++++++--------- .../testsuite/23_containers/map/48101_neg.cc | 6 +++-- .../testsuite/23_containers/multimap/48101_neg.cc | 6 +++-- .../testsuite/23_containers/multiset/48101_neg.cc | 2 +- .../testsuite/23_containers/set/48101_neg.cc | 2 +- libstdc++-v3/testsuite/23_containers/set/85965.cc | 29 ++++++++++++++++++++++ .../23_containers/unordered_map/48101_neg.cc | 2 +- .../23_containers/unordered_multimap/48101_neg.cc | 2 +- .../23_containers/unordered_multiset/48101_neg.cc | 2 +- .../23_containers/unordered_set/48101_neg.cc | 2 +- .../testsuite/23_containers/unordered_set/85965.cc | 29 ++++++++++++++++++++++ 13 files changed, 112 insertions(+), 27 deletions(-) create mode 100644 libstdc++-v3/testsuite/23_containers/set/85965.cc create mode 100644 libstdc++-v3/testsuite/23_containers/unordered_set/85965.cc diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index c1d54b5f319..c52c1a9f860 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,5 +1,24 @@ 2019-05-07 Jonathan Wakely + Backport from mainline + 2019-03-26 Jonathan Wakely + + PR libstdc++/85965 + * include/bits/hashtable.h (_Hashtable): Move static assertions to + destructor so they are not evaluated until the _Key type is complete. + * include/bits/stl_tree.h (_Rb_tree): Likewise. + * testsuite/23_containers/set/85965.cc: New test. + * testsuite/23_containers/unordered_set/85965.cc: New test. + * testsuite/23_containers/map/48101_neg.cc: Replace "here" errors + with regexp matching the corresponding _Rb_tree specialization. + * testsuite/23_containers/multimap/48101_neg.cc: Likewise. + * testsuite/23_containers/multiset/48101_neg.cc: Remove "here" error. + * testsuite/23_containers/set/48101_neg.cc: Likewise. + * testsuite/23_containers/unordered_map/48101_neg.cc: Likewise. + * testsuite/23_containers/unordered_multimap/48101_neg.cc: Likewise. + * testsuite/23_containers/unordered_multiset/48101_neg.cc: Likewise. + * testsuite/23_containers/unordered_set/48101_neg.cc: Likewise. + Backport from mainline 2019-03-11 Jonathan Wakely diff --git a/libstdc++-v3/include/bits/hashtable.h b/libstdc++-v3/include/bits/hashtable.h index ba1d35dbecf..475cda6cac5 100644 --- a/libstdc++-v3/include/bits/hashtable.h +++ b/libstdc++-v3/include/bits/hashtable.h @@ -192,11 +192,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION static_assert(is_same{}, "unordered container must have the same value_type as its allocator"); #endif - static_assert(__is_invocable{}, - "hash function must be invocable with an argument of key type"); - static_assert(__is_invocable{}, - "key equality predicate must be invocable with two arguments of " - "key type"); using __traits_type = _Traits; using __hash_cached = typename __traits_type::__hash_cached; @@ -1373,6 +1368,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { clear(); _M_deallocate_buckets(); + + static_assert(__is_invocable{}, + "hash function must be invocable with an argument of key type"); + static_assert(__is_invocable{}, + "key equality predicate must be invocable with two arguments of " + "key type"); } template _Alloc_traits; -#if __cplusplus >= 201103L - static_assert(__is_invocable<_Compare&, const _Key&, const _Key&>{}, - "comparison object must be invocable with two arguments of key type"); -# if __cplusplus >= 201703L - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 2542. Missing const requirements for associative containers - static_assert(is_invocable_v, - "comparison object must be invocable as const"); -# endif // C++17 -#endif // C++11 - protected: typedef _Rb_tree_node_base* _Base_ptr; typedef const _Rb_tree_node_base* _Const_Base_ptr; @@ -962,7 +951,21 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION #endif ~_Rb_tree() _GLIBCXX_NOEXCEPT - { _M_erase(_M_begin()); } + { + _M_erase(_M_begin()); + +#if __cplusplus >= 201103L + static_assert(__is_invocable<_Compare&, const _Key&, const _Key&>{}, + "comparison object must be invocable " + "with two arguments of key type"); +# if __cplusplus >= 201703L + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2542. Missing const requirements for associative containers + static_assert(is_invocable_v, + "comparison object must be invocable as const"); +# endif // C++17 +#endif // C++11 + } _Rb_tree& operator=(const _Rb_tree& __x); diff --git a/libstdc++-v3/testsuite/23_containers/map/48101_neg.cc b/libstdc++-v3/testsuite/23_containers/map/48101_neg.cc index df913161bf3..9a63a0aa3c7 100644 --- a/libstdc++-v3/testsuite/23_containers/map/48101_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/map/48101_neg.cc @@ -23,8 +23,10 @@ void test01() { - std::map> c; // { dg-error "here" } - std::map> c2; // { dg-error "here" } + std::map> c; + std::map> c2; } +// { dg-error "_Compare = std::less" "" { target *-*-* } 0 } +// { dg-error "_Compare = std::allocator" "" { target *-*-* } 0 } // { dg-error "comparison object must be invocable" "" { target *-*-* } 0 } diff --git a/libstdc++-v3/testsuite/23_containers/multimap/48101_neg.cc b/libstdc++-v3/testsuite/23_containers/multimap/48101_neg.cc index 5b4e335c91d..5b5f75d6d8c 100644 --- a/libstdc++-v3/testsuite/23_containers/multimap/48101_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/multimap/48101_neg.cc @@ -23,8 +23,10 @@ void test01() { - std::multimap> c; // { dg-error "here" } - std::multimap> c2; // { dg-error "here" } + std::multimap> c; + std::multimap> c2; } +// { dg-error "_Compare = std::less" "" { target *-*-* } 0 } +// { dg-error "_Compare = std::allocator" "" { target *-*-* } 0 } // { dg-error "comparison object must be invocable" "" { target *-*-* } 0 } diff --git a/libstdc++-v3/testsuite/23_containers/multiset/48101_neg.cc b/libstdc++-v3/testsuite/23_containers/multiset/48101_neg.cc index b815f86219b..b8f92b89bc0 100644 --- a/libstdc++-v3/testsuite/23_containers/multiset/48101_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/multiset/48101_neg.cc @@ -23,7 +23,7 @@ void test01() { std::multiset c; // { dg-error "here" } - std::multiset> c2; // { dg-error "here" } + std::multiset> c2; } // { dg-error "non-const, non-volatile value_type" "" { target *-*-* } 0 } diff --git a/libstdc++-v3/testsuite/23_containers/set/48101_neg.cc b/libstdc++-v3/testsuite/23_containers/set/48101_neg.cc index 9cd728d9bc6..c70c1779a76 100644 --- a/libstdc++-v3/testsuite/23_containers/set/48101_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/set/48101_neg.cc @@ -23,7 +23,7 @@ void test01() { std::set c; // { dg-error "here" } - std::set> c2; // { dg-error "here" } + std::set> c2; } // { dg-error "non-const, non-volatile value_type" "" { target *-*-* } 0 } diff --git a/libstdc++-v3/testsuite/23_containers/set/85965.cc b/libstdc++-v3/testsuite/23_containers/set/85965.cc new file mode 100644 index 00000000000..54d501f6c4f --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/set/85965.cc @@ -0,0 +1,29 @@ +// Copyright (C) 2019 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 +// . + +// { dg-do compile { target c++11 } } + +#include + +struct Base { }; +struct Derived; // derives from Base, but incomplete at this point + +struct Foo +{ + // PR libstdc++/85965 + std::set> s; +}; diff --git a/libstdc++-v3/testsuite/23_containers/unordered_map/48101_neg.cc b/libstdc++-v3/testsuite/23_containers/unordered_map/48101_neg.cc index 956835c916a..17a7c88cddf 100644 --- a/libstdc++-v3/testsuite/23_containers/unordered_map/48101_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/unordered_map/48101_neg.cc @@ -23,7 +23,7 @@ void test01() { using namespace std; - unordered_map, hash> c2; // { dg-error "here" } + unordered_map, hash> c2; } // { dg-error "hash function must be invocable" "" { target *-*-* } 0 } diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multimap/48101_neg.cc b/libstdc++-v3/testsuite/23_containers/unordered_multimap/48101_neg.cc index ca717e313c6..309e43f71d6 100644 --- a/libstdc++-v3/testsuite/23_containers/unordered_multimap/48101_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/unordered_multimap/48101_neg.cc @@ -23,7 +23,7 @@ void test01() { using namespace std; - unordered_multimap, hash> c2; // { dg-error "here" } + unordered_multimap, hash> c2; } // { dg-error "hash function must be invocable" "" { target *-*-* } 0 } diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multiset/48101_neg.cc b/libstdc++-v3/testsuite/23_containers/unordered_multiset/48101_neg.cc index a06c302ad6b..223a8ebbf61 100644 --- a/libstdc++-v3/testsuite/23_containers/unordered_multiset/48101_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/unordered_multiset/48101_neg.cc @@ -24,7 +24,7 @@ test01() { using namespace std; unordered_multiset> c; // { dg-error "here" } - unordered_multiset, hash> c2; // { dg-error "here" } + unordered_multiset, hash> c2; } // { dg-error "non-const, non-volatile value_type" "" { target *-*-* } 0 } diff --git a/libstdc++-v3/testsuite/23_containers/unordered_set/48101_neg.cc b/libstdc++-v3/testsuite/23_containers/unordered_set/48101_neg.cc index 61f79f917e0..1a10286bb2b 100644 --- a/libstdc++-v3/testsuite/23_containers/unordered_set/48101_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/unordered_set/48101_neg.cc @@ -24,7 +24,7 @@ test01() { using namespace std; unordered_set> c; // { dg-error "here" } - unordered_set, hash> c2; // { dg-error "here" } + unordered_set, hash> c2; } // { dg-error "non-const, non-volatile value_type" "" { target *-*-* } 0 } diff --git a/libstdc++-v3/testsuite/23_containers/unordered_set/85965.cc b/libstdc++-v3/testsuite/23_containers/unordered_set/85965.cc new file mode 100644 index 00000000000..8b90b369901 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_set/85965.cc @@ -0,0 +1,29 @@ +// Copyright (C) 2019 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 +// . + +// { dg-do compile { target c++11 } } + +#include + +struct Base { }; +struct Derived; // derives from Base, but incomplete at this point + +struct Foo +{ + // PR libstdc++/85965 + std::unordered_set, std::hash> u; +}; -- cgit v1.2.3 From 35ba6da371ad94d7ac2f36e2832a02e0c29eb6c0 Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Tue, 7 May 2019 15:46:09 +0000 Subject: Make filesystem::path safe for self assignment The standard says "If *this and p are the same object, has no effect." Previously we ended up clearing the path. Backport from mainline 2019-04-05 Jonathan Wakely * include/bits/fs_path.h (path::operator=(path&&)): Check for self assignment. * testsuite/27_io/filesystem/path/assign/copy.cc: Test self assignment. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270961 138bc75d-0d04-0410-961f-82ee72b054a4 --- libstdc++-v3/ChangeLog | 8 ++++++++ libstdc++-v3/include/bits/fs_path.h | 3 +++ .../testsuite/27_io/filesystem/path/assign/copy.cc | 18 ++++++++++++++++++ 3 files changed, 29 insertions(+) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index c52c1a9f860..f8091dbfb8e 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,5 +1,13 @@ 2019-05-07 Jonathan Wakely + Backport from mainline + 2019-04-05 Jonathan Wakely + + * include/bits/fs_path.h (path::operator=(path&&)): Check for self + assignment. + * testsuite/27_io/filesystem/path/assign/copy.cc: Test self + assignment. + Backport from mainline 2019-03-26 Jonathan Wakely diff --git a/libstdc++-v3/include/bits/fs_path.h b/libstdc++-v3/include/bits/fs_path.h index fb85d489fd8..d9e18bfc30a 100644 --- a/libstdc++-v3/include/bits/fs_path.h +++ b/libstdc++-v3/include/bits/fs_path.h @@ -789,6 +789,9 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 inline path& path::operator=(path&& __p) noexcept { + if (&__p == this) + return *this; + _M_pathname = std::move(__p._M_pathname); _M_cmpts = std::move(__p._M_cmpts); _M_type = __p._M_type; diff --git a/libstdc++-v3/testsuite/27_io/filesystem/path/assign/copy.cc b/libstdc++-v3/testsuite/27_io/filesystem/path/assign/copy.cc index e8391f46e2d..20d2d880f08 100644 --- a/libstdc++-v3/testsuite/27_io/filesystem/path/assign/copy.cc +++ b/libstdc++-v3/testsuite/27_io/filesystem/path/assign/copy.cc @@ -21,6 +21,7 @@ #include #include +#include using std::filesystem::path; using __gnu_test::compare_paths; @@ -48,9 +49,26 @@ test02() } } +void +test03() +{ + // self assignment should have no effect + const path orig = "foo/bar/baz"; + path p = orig; + const auto ptr1 = p.c_str(); + const auto ptr2 = p.begin()->c_str(); + p = std::move(p); + __gnu_test::compare_paths(p, orig); + p = p; + __gnu_test::compare_paths(p, orig); + VERIFY( ptr1 == p.c_str() ); + VERIFY( ptr2 == p.begin()->c_str() ); +} + int main() { test01(); test02(); + test03(); } -- cgit v1.2.3 From d3d01a9592101f9fc2760f2dade4b32181f6a7f8 Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Tue, 7 May 2019 15:46:13 +0000 Subject: Fix directory_iterator handling of DT_UNKNOWN We need to handle DT_UNKNOWN earlier, not only during directory recursion, so that the cached file_type value in the directory_entry won't be used. Backport from mainline 2019-04-05 Jonathan Wakely * src/filesystem/std-dir.cc (_Dir::advance(bool, error_code&)): Handle d_type == DT_UNKNOWN immediately. (_Dir::should_recurse(bool, error_code&)): Remove file_type::unknown handling here. * testsuite/27_io/filesystem/iterators/caching.cc: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270962 138bc75d-0d04-0410-961f-82ee72b054a4 --- libstdc++-v3/ChangeLog | 9 +++ libstdc++-v3/src/filesystem/std-dir.cc | 8 ++- .../27_io/filesystem/iterators/caching.cc | 76 ++++++++++++++++++++++ 3 files changed, 92 insertions(+), 1 deletion(-) create mode 100644 libstdc++-v3/testsuite/27_io/filesystem/iterators/caching.cc diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index f8091dbfb8e..0a84cc6cd0a 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -3,6 +3,15 @@ Backport from mainline 2019-04-05 Jonathan Wakely + * src/filesystem/std-dir.cc (_Dir::advance(bool, error_code&)): Handle + d_type == DT_UNKNOWN immediately. + (_Dir::should_recurse(bool, error_code&)): Remove file_type::unknown + handling here. + * testsuite/27_io/filesystem/iterators/caching.cc: New test. + + Backport from mainline + 2019-04-05 Jonathan Wakely + * include/bits/fs_path.h (path::operator=(path&&)): Check for self assignment. * testsuite/27_io/filesystem/path/assign/copy.cc: Test self diff --git a/libstdc++-v3/src/filesystem/std-dir.cc b/libstdc++-v3/src/filesystem/std-dir.cc index 98eb22ab920..c14fa185974 100644 --- a/libstdc++-v3/src/filesystem/std-dir.cc +++ b/libstdc++-v3/src/filesystem/std-dir.cc @@ -57,7 +57,13 @@ struct fs::_Dir : _Dir_base { if (const auto entp = _Dir_base::advance(skip_permission_denied, ec)) { - entry = fs::directory_entry{path / entp->d_name, get_file_type(*entp)}; + file_type type = file_type::none; +#ifdef _GLIBCXX_HAVE_STRUCT_DIRENT_D_TYPE + // Even if the OS supports dirent::d_type the filesystem might not: + if (entp->d_type != DT_UNKNOWN) + type = get_file_type(*entp); +#endif + entry = fs::directory_entry{path / entp->d_name, type}; return true; } else if (!ec) diff --git a/libstdc++-v3/testsuite/27_io/filesystem/iterators/caching.cc b/libstdc++-v3/testsuite/27_io/filesystem/iterators/caching.cc new file mode 100644 index 00000000000..101b0cd6b49 --- /dev/null +++ b/libstdc++-v3/testsuite/27_io/filesystem/iterators/caching.cc @@ -0,0 +1,76 @@ +// Copyright (C) 2019 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 +// . + +// { dg-options "-std=gnu++17 -lstdc++fs" } +// { dg-do run { target c++17 } } +// { dg-require-filesystem-ts "" } + +#include +#include +#include + +namespace fs = std::filesystem; + +__gnu_test::scoped_file +create_dir(fs::path dir = __gnu_test::nonexistent_path()) +{ + fs::create_directory(dir); + return { dir, __gnu_test::scoped_file::adopt_file }; +} + +void +test01() +{ + auto testdir = create_dir(); + __gnu_test::scoped_file file1(testdir.path/"file1"); + __gnu_test::scoped_file file2(testdir.path/"file2"); + + fs::directory_iterator it(testdir.path); + VERIFY( it->is_regular_file() ); + ++it; + VERIFY( it->is_regular_file() ); + ++it; + VERIFY( it == fs::directory_iterator{} ); +} + +void +test02() +{ + auto testdir = create_dir(); + const auto sub1 = create_dir(testdir.path/"sub1"); + __gnu_test::scoped_file file1(sub1.path / "file"); + const auto sub2 = create_dir(testdir.path/"sub2"); + __gnu_test::scoped_file file2(sub2.path / "file"); + + fs::recursive_directory_iterator it(testdir.path); + VERIFY( it->is_directory() ); + ++it; + VERIFY( it->is_regular_file() ); + ++it; + VERIFY( it->is_directory() ); + ++it; + VERIFY( it->is_regular_file() ); + ++it; + VERIFY( it == fs::recursive_directory_iterator{} ); +} + +int +main() +{ + test01(); + test02(); +} -- cgit v1.2.3 From 03469097df14de49307571bf0be3b0aa1533e46e Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Tue, 7 May 2019 15:46:17 +0000 Subject: Update documentation regarding bogus memory leaks in libstdc++ Backport from mainline 2019-04-10 Jonathan Wakely * doc/xml/faq.xml: Add information about emergency EH pool. * doc/xml/manual/debug.xml: Update list of memory debugging tools. Move outdated information on mt_allocator to a separate section. * doc/xml/manual/evolution.xml: Clarify that GLIBCXX_FORCE_NEW doesn't affect the default allocator. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270963 138bc75d-0d04-0410-961f-82ee72b054a4 --- libstdc++-v3/ChangeLog | 9 ++++ libstdc++-v3/doc/xml/faq.xml | 24 +++++++--- libstdc++-v3/doc/xml/manual/debug.xml | 79 +++++++++++++++++++------------ libstdc++-v3/doc/xml/manual/evolution.xml | 9 ++-- 4 files changed, 79 insertions(+), 42 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 0a84cc6cd0a..64231040c1b 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,5 +1,14 @@ 2019-05-07 Jonathan Wakely + Backport from mainline + 2019-04-10 Jonathan Wakely + + * doc/xml/faq.xml: Add information about emergency EH pool. + * doc/xml/manual/debug.xml: Update list of memory debugging tools. + Move outdated information on mt_allocator to a separate section. + * doc/xml/manual/evolution.xml: Clarify that GLIBCXX_FORCE_NEW + doesn't affect the default allocator. + Backport from mainline 2019-04-05 Jonathan Wakely diff --git a/libstdc++-v3/doc/xml/faq.xml b/libstdc++-v3/doc/xml/faq.xml index edc07f16acb..b4bf333e26a 100644 --- a/libstdc++-v3/doc/xml/faq.xml +++ b/libstdc++-v3/doc/xml/faq.xml @@ -1001,21 +1001,31 @@ - Memory leaks in containers + Memory leaks in libstdc++ - - This answer is old and probably no longer be relevant. - - A few people have reported that the standard containers appear + Since GCC 5.1.0, libstdc++ automatically allocates a pool + of a few dozen kilobytes on startup. This pool is used to ensure it's + possible to throw exceptions (such as bad_alloc) + even when malloc is unable to allocate any more memory. + With some versions of valgrind + this pool will be shown as "still reachable" when the process exits, e.g. + still reachable: 72,704 bytes in 1 blocks. + This memory is not a leak, because it's still in use by libstdc++, + and the memory will be returned to the OS when the process exits. + Later versions of valgrind know how to free this + pool as the process exits, and so won't show any "still reachable" memory. + + + In the past, a few people reported that the standard containers appear to leak memory when tested with memory checkers such as valgrind. Under some (non-default) configurations the library's allocators keep free memory in a - pool for later reuse, rather than returning it to the OS. Although - this memory is always reachable by the library and is never + pool for later reuse, rather than deallocating it with delete + Although this memory is always reachable by the library and is never lost, memory debugging tools can report it as a leak. If you want to test the library for memory leaks please read Tips for memory leak hunting diff --git a/libstdc++-v3/doc/xml/manual/debug.xml b/libstdc++-v3/doc/xml/manual/debug.xml index 37e330d3ed2..091e0b6914c 100644 --- a/libstdc++-v3/doc/xml/manual/debug.xml +++ b/libstdc++-v3/doc/xml/manual/debug.xml @@ -94,50 +94,35 @@

Memory Leak Hunting + + On many targets GCC supports AddressSanitizer, a fast memory error detector, + which is enabled by the option. + - There are various third party memory tracing and debug utilities + There are also various third party memory tracing and debug utilities that can be used to provide detailed memory allocation information about C++ code. An exhaustive list of tools is not going to be attempted, but includes mtrace, valgrind, - mudflap, and the non-free commercial product - purify. In addition, libcwd has a - replacement for the global new and delete operators that can track - memory allocation and deallocation and provide useful memory - statistics. - - - - Regardless of the memory debugging tool being used, there is one - thing of great importance to keep in mind when debugging C++ code - that uses new and delete: there are - different kinds of allocation schemes that can be used by - std::allocator. For implementation details, see the mt allocator documentation and - look specifically for GLIBCXX_FORCE_NEW. - - - - In a nutshell, the optional mt_allocator - is a high-performance pool allocator, and can - give the mistaken impression that in a suspect executable, memory is - being leaked, when in reality the memory "leak" is a pool being used - by the library's allocator and is reclaimed after program - termination. + mudflap (no longer supported since GCC 4.9.0), ElectricFence, + and the non-free commercial product purify. + In addition, libcwd, jemalloc and TCMalloc have replacements + for the global new and delete operators + that can track memory allocation and deallocation and provide useful + memory statistics. For valgrind, there are some specific items to keep in mind. First of all, use a version of valgrind that will work with current GNU C++ tools: the first that can do this is valgrind 1.0.4, but later - versions should work at least as well. Second of all, use a - completely unoptimized build to avoid confusing valgrind. Third, use - GLIBCXX_FORCE_NEW to keep extraneous pool allocation noise from - cluttering debug information. + versions should work better. Second, using an unoptimized build + might avoid confusing valgrind. - Fourth, it may be necessary to force deallocation in other libraries - as well, namely the "C" library. On linux, this can be accomplished + Third, it may be necessary to force deallocation in other libraries + as well, namely the "C" library. On GNU/Linux, this can be accomplished with the appropriate use of the __cxa_atexit or atexit functions. @@ -157,7 +142,6 @@ } - or, using __cxa_atexit: @@ -184,6 +168,39 @@ valgrind -v --num-callers=20 --leak-check=yes --leak-resolution=high --show-reachable=yes a.out +
+Non-memory leaks in Pool and MT allocators + + + There are different kinds of allocation schemes that can be used by + std::allocator. Prior to GCC 3.4.0 the default was to use + a pooling allocator, pool_allocator, + which is still available as the optional + __pool_alloc extension. + Another optional extension, __mt_alloc, + is a high-performance pool allocator. + + + + In a suspect executable these pooling allocators can give + the mistaken impression that memory is being leaked, + when in reality the memory "leak" is a pool being used + by the library's allocator and is reclaimed after program + termination. + + + + If you're using memory debugging tools on a program that uses + one of these pooling allocators, you can set the environment variable + GLIBCXX_FORCE_NEW to keep extraneous pool allocation + noise from cluttering debug information. + For more details, see the + mt allocator + documentation and look specifically for GLIBCXX_FORCE_NEW. + + +
+
Data Race Hunting diff --git a/libstdc++-v3/doc/xml/manual/evolution.xml b/libstdc++-v3/doc/xml/manual/evolution.xml index 3288e2f6cf2..90b2f7b6f28 100644 --- a/libstdc++-v3/doc/xml/manual/evolution.xml +++ b/libstdc++-v3/doc/xml/manual/evolution.xml @@ -80,11 +80,12 @@ Removal of ext/tree, moved to For GCC releases from 2.95 through the 3.1 series, defining __USE_MALLOC on the gcc command line would change the - default allocation strategy to instead use malloc and - free. For the 3.2 and 3.3 release series the same + default allocation strategy to instead use malloc and + free. For the 3.2 and 3.3 release series the same functionality was spelled _GLIBCXX_FORCE_NEW. From - GCC 3.4 onwards the functionality is enabled by setting - GLIBCXX_FORCE_NEW in the environment, see + GCC 3.4 onwards the default allocator uses new anyway, + but for the optional pooling allocators the functionality is enabled by + setting GLIBCXX_FORCE_NEW in the environment, see the mt allocator chapter for details. -- cgit v1.2.3 From bd9236db204457e73627dc3a7eda5d64de7b47c8 Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Tue, 7 May 2019 15:46:21 +0000 Subject: Add constexpr to std::optional::value_or(U&&)&& In C++1z drafts up to N4606 the constexpr keyword was missing from the detailed description of this function, despite being shown in the class synopsis. That was fixed editorially for N4618, but our implementation was not corrected to match. Backport from mainline 2019-04-17 Jonathan Wakely * include/std/optional (optional::value_or(U&&) &&): Add missing constexpr specifier. * testsuite/20_util/optional/constexpr/observers/4.cc: Check value_or for disengaged optionals and rvalue optionals. * testsuite/20_util/optional/observers/4.cc: Likewise. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270964 138bc75d-0d04-0410-961f-82ee72b054a4 --- libstdc++-v3/ChangeLog | 9 +++++ libstdc++-v3/include/std/optional | 2 +- .../20_util/optional/constexpr/observers/4.cc | 38 ++++++++++++++++++++-- .../testsuite/20_util/optional/observers/4.cc | 34 ++++++++++++++++++- 4 files changed, 78 insertions(+), 5 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 64231040c1b..510763be2da 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,5 +1,14 @@ 2019-05-07 Jonathan Wakely + Backport from mainline + 2019-04-17 Jonathan Wakely + + * include/std/optional (optional::value_or(U&&) &&): Add missing + constexpr specifier. + * testsuite/20_util/optional/constexpr/observers/4.cc: Check value_or + for disengaged optionals and rvalue optionals. + * testsuite/20_util/optional/observers/4.cc: Likewise. + Backport from mainline 2019-04-10 Jonathan Wakely diff --git a/libstdc++-v3/include/std/optional b/libstdc++-v3/include/std/optional index c40812f5e59..9f5d24e0220 100644 --- a/libstdc++-v3/include/std/optional +++ b/libstdc++-v3/include/std/optional @@ -1256,7 +1256,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } template - _Tp + constexpr _Tp value_or(_Up&& __u) && { static_assert(is_move_constructible_v<_Tp>); diff --git a/libstdc++-v3/testsuite/20_util/optional/constexpr/observers/4.cc b/libstdc++-v3/testsuite/20_util/optional/constexpr/observers/4.cc index 7743221adf7..12b0b9393c6 100644 --- a/libstdc++-v3/testsuite/20_util/optional/constexpr/observers/4.cc +++ b/libstdc++-v3/testsuite/20_util/optional/constexpr/observers/4.cc @@ -25,10 +25,42 @@ struct value_type int i; }; -int main() +void test01() { constexpr std::optional o { value_type { 51 } }; constexpr value_type fallback { 3 }; - static_assert( o.value_or(fallback).i == 51, "" ); - static_assert( o.value_or(fallback).i == (*o).i, "" ); + static_assert( o.value_or(fallback).i == 51 ); + static_assert( o.value_or(fallback).i == (*o).i ); +} + +void test02() +{ + constexpr std::optional o; + constexpr value_type fallback { 3 }; + static_assert( o.value_or(fallback).i == 3 ); +} + +template + constexpr std::optional + make_rvalue(T t) + { return std::optional{t}; } + +void test03() +{ + constexpr value_type fallback { 3 }; + static_assert( make_rvalue(value_type{51}).value_or(fallback).i == 51 ); +} + +void test04() +{ + constexpr value_type fallback { 3 }; + static_assert( make_rvalue(std::nullopt).value_or(fallback).i == 3 ); +} + +int main() +{ + test01(); + test02(); + test03(); + test04(); } diff --git a/libstdc++-v3/testsuite/20_util/optional/observers/4.cc b/libstdc++-v3/testsuite/20_util/optional/observers/4.cc index ac8515f4cff..6f528b5c916 100644 --- a/libstdc++-v3/testsuite/20_util/optional/observers/4.cc +++ b/libstdc++-v3/testsuite/20_util/optional/observers/4.cc @@ -26,10 +26,42 @@ struct value_type int i; }; -int main() +void test01() { std::optional o { value_type { 51 } }; value_type fallback { 3 }; VERIFY( o.value_or(fallback).i == 51 ); VERIFY( o.value_or(fallback).i == (*o).i ); } + +void test02() +{ + std::optional o; + value_type fallback { 3 }; + VERIFY( o.value_or(fallback).i == 3 ); +} + +void test03() +{ + std::optional o { value_type { 51 } }; + value_type fallback { 3 }; + VERIFY( std::move(o).value_or(fallback).i == 51 ); + VERIFY( o.has_value() ); + VERIFY( std::move(o).value_or(fallback).i == (*o).i ); +} + +void test04() +{ + std::optional o; + value_type fallback { 3 }; + VERIFY( std::move(o).value_or(fallback).i == 3 ); + VERIFY( !o.has_value() ); +} + +int main() +{ + test01(); + test02(); + test03(); + test04(); +} -- cgit v1.2.3 From a8cad0f6118e17e08a61861a9412ba9559c45c65 Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Tue, 7 May 2019 15:46:32 +0000 Subject: PR libstdc++/90105 make forward_list::sort stable While testing the fix I also discovered that operator== assumes the elements are comparable with operator!= which is not required. Backport from mainline 2019-04-17 Jonathan Wakely PR libstdc++/90105 * include/bits/forward_list.tcc (operator==): Do not use operator!= to compare elements. (forward_list::sort(Comp)): When elements are equal take the one earlier in the list, so that sort is stable. * testsuite/23_containers/forward_list/operations/90105.cc: New test. * testsuite/23_containers/forward_list/comparable.cc: Test with types that meet the minimum EqualityComparable and LessThanComparable requirements. Remove irrelevant comment. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270965 138bc75d-0d04-0410-961f-82ee72b054a4 --- libstdc++-v3/ChangeLog | 13 +++++ libstdc++-v3/include/bits/forward_list.tcc | 6 +-- .../23_containers/forward_list/comparable.cc | 44 +++++++++++++--- .../23_containers/forward_list/operations/90105.cc | 60 ++++++++++++++++++++++ 4 files changed, 113 insertions(+), 10 deletions(-) create mode 100644 libstdc++-v3/testsuite/23_containers/forward_list/operations/90105.cc diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 510763be2da..fe60dd25abd 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -3,6 +3,19 @@ Backport from mainline 2019-04-17 Jonathan Wakely + PR libstdc++/90105 + * include/bits/forward_list.tcc (operator==): Do not use operator!= to + compare elements. + (forward_list::sort(Comp)): When elements are equal take the one + earlier in the list, so that sort is stable. + * testsuite/23_containers/forward_list/operations/90105.cc: New test. + * testsuite/23_containers/forward_list/comparable.cc: Test with + types that meet the minimum EqualityComparable and LessThanComparable + requirements. Remove irrelevant comment. + + Backport from mainline + 2019-04-17 Jonathan Wakely + * include/std/optional (optional::value_or(U&&) &&): Add missing constexpr specifier. * testsuite/20_util/optional/constexpr/observers/4.cc: Check value_or diff --git a/libstdc++-v3/include/bits/forward_list.tcc b/libstdc++-v3/include/bits/forward_list.tcc index b41fbbb52f2..fb90e81c363 100644 --- a/libstdc++-v3/include/bits/forward_list.tcc +++ b/libstdc++-v3/include/bits/forward_list.tcc @@ -375,7 +375,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER auto __iy = __ly.cbegin(); while (__ix != __lx.cend() && __iy != __ly.cend()) { - if (*__ix != *__iy) + if (!(*__ix == *__iy)) return false; ++__ix; ++__iy; @@ -445,9 +445,9 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER __p = static_cast<_Node*>(__p->_M_next); --__psize; } - else if (__comp(*__p->_M_valptr(), *__q->_M_valptr())) + else if (!__comp(*__q->_M_valptr(), *__p->_M_valptr())) { - // First node of p is lower; e must come from p. + // First node of q is not lower; e must come from p. __e = __p; __p = static_cast<_Node*>(__p->_M_next); --__psize; diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/comparable.cc b/libstdc++-v3/testsuite/23_containers/forward_list/comparable.cc index aea2db96538..d7a50ee85f7 100644 --- a/libstdc++-v3/testsuite/23_containers/forward_list/comparable.cc +++ b/libstdc++-v3/testsuite/23_containers/forward_list/comparable.cc @@ -17,15 +17,11 @@ // with this library; see the file COPYING3. If not see // . - -// NOTE: This makes use of the fact that we know how moveable -// is implemented on list (via swap). If the implementation changed -// this test may begin to fail. - #include #include -int main() +void +test01() { std::forward_list a = {0.0, 1.0, 2.0, 3.0, 4.0}; std::forward_list b = {0.0, 1.0, 2.0, 3.0, 4.0, 5.0}; @@ -43,6 +39,40 @@ int main() VERIFY((b > a) == true); VERIFY((b >= a) == true); VERIFY((b <= a) == false); +} + +void +test02() +{ + // The EqualityComparable requirements only require == + struct X { + bool operator==(const X&) const { return true; } + }; + + std::forward_list a(2); + const auto b = a; + VERIFY( a == b ); +} + +void +test03() +{ + // The LessThanComparable requirements only require < + struct X { + bool operator<(const X&) const { return false; } + }; - return 0; + std::forward_list a(2); + const auto b = a; + VERIFY( !(a < b) ); + VERIFY( !(a > b) ); + VERIFY( a <= b ); + VERIFY( a >= b ); +} + +int main() +{ + test01(); + test02(); + test03(); } diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/operations/90105.cc b/libstdc++-v3/testsuite/23_containers/forward_list/operations/90105.cc new file mode 100644 index 00000000000..3c1478e2e34 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/forward_list/operations/90105.cc @@ -0,0 +1,60 @@ +// Copyright (C) 2019 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 +// . + +// { dg-do run { target c++11 } } + +#include +#include + +// PR libstdc++/90105 - std::forward_list::sort() is not "stable" + +struct X +{ + int key; + int val; +}; + +bool operator<(const X& l, const X& r) +{ return l.key < r.key; } + +bool operator==(const X& l, const X& r) +{ return l.key == r.key && l.val == r.val; } + +void +test01() +{ + std::forward_list l{ {1, 1}, {2, 2}, {1, 3}, {0, 4}, {2, 5}, {0, 6} }; + l.sort(); + std::forward_list exp{ {0, 4}, {0, 6}, {1, 1}, {1, 3}, {2, 2}, {2, 5} }; + VERIFY( l == exp ); +} + +void +test02() +{ + std::forward_list l{ {1, 1}, {1, 2}, {1, 3}, {1, 4}, {1, 5}, {1, 6} }; + const std::forward_list exp = l; + l.sort(); + VERIFY( l == exp ); +} + +int +main() +{ + test01(); + test02(); +} -- cgit v1.2.3 From 83fa412967602cbb92cce7123d44d9b0395feec9 Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Tue, 7 May 2019 15:46:36 +0000 Subject: PR libstdc++/90165 constrain variant(T&&) constructor Backport from mainline 2019-04-23 Jonathan Wakely PR libstdc++/90165 * include/std/variant (variant::__is_in_place_tag) (variant::__not_in_place_tag): New helpers for variant(T&&) constructor constraint. (variant::variant(T&&)): Use __not_in_place_tag in constraints. * testsuite/20_util/variant/compile.cc: Check variant(T&&) constructor isn't used for in_place_type or in_place_index arguments. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270966 138bc75d-0d04-0410-961f-82ee72b054a4 --- libstdc++-v3/ChangeLog | 11 +++++++++++ libstdc++-v3/include/std/variant | 12 ++++++++++++ libstdc++-v3/testsuite/20_util/variant/compile.cc | 6 ++++++ 3 files changed, 29 insertions(+) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index fe60dd25abd..31623b72c13 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,5 +1,16 @@ 2019-05-07 Jonathan Wakely + Backport from mainline + 2019-04-23 Jonathan Wakely + + PR libstdc++/90165 + * include/std/variant (variant::__is_in_place_tag) + (variant::__not_in_place_tag): New helpers for variant(T&&) + constructor constraint. + (variant::variant(T&&)): Use __not_in_place_tag in constraints. + * testsuite/20_util/variant/compile.cc: Check variant(T&&) constructor + isn't used for in_place_type or in_place_index arguments. + Backport from mainline 2019-04-17 Jonathan Wakely diff --git a/libstdc++-v3/include/std/variant b/libstdc++-v3/include/std/variant index 6cef89852ba..ee39c4fc001 100644 --- a/libstdc++-v3/include/std/variant +++ b/libstdc++-v3/include/std/variant @@ -1076,6 +1076,17 @@ namespace __variant using _Traits = __detail::__variant::_Traits<_Types...>; + template + struct __is_in_place_tag : false_type { }; + template + struct __is_in_place_tag> : true_type { }; + template + struct __is_in_place_tag> : true_type { }; + + template + static constexpr bool __not_in_place_tag + = !__is_in_place_tag>::value; + public: variant() = default; variant(const variant& __rhs) = default; @@ -1087,6 +1098,7 @@ namespace __variant template, variant>>, typename = enable_if_t<(sizeof...(_Types)>0)>, + typename = enable_if_t<__not_in_place_tag<_Tp>>, typename = enable_if_t<__exactly_once<__accepted_type<_Tp&&>> && is_constructible_v<__accepted_type<_Tp&&>, _Tp&&>>> constexpr diff --git a/libstdc++-v3/testsuite/20_util/variant/compile.cc b/libstdc++-v3/testsuite/20_util/variant/compile.cc index 0b8eaf04b0d..811389a8fd7 100644 --- a/libstdc++-v3/testsuite/20_util/variant/compile.cc +++ b/libstdc++-v3/testsuite/20_util/variant/compile.cc @@ -129,10 +129,15 @@ void arbitrary_ctor() static_assert(noexcept(variant(DefaultNoexcept{})), ""); } +struct none { none() = delete; }; +struct any { template any(T&&) {} }; + void in_place_index_ctor() { variant a(in_place_index<0>, "a"); variant b(in_place_index<1>, {'a'}); + + static_assert(!is_constructible_v, std::in_place_index_t<0>>, "PR libstdc++/90165"); } void in_place_type_ctor() @@ -140,6 +145,7 @@ void in_place_type_ctor() variant a(in_place_type, "a"); variant b(in_place_type, {'a'}); static_assert(!is_constructible_v, in_place_type_t, const char*>, ""); + static_assert(!is_constructible_v, std::in_place_type_t>, "PR libstdc++/90165"); } void dtor() -- cgit v1.2.3 From 7b5d59da00ede65c31008f5d20d6263f07212e47 Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Tue, 7 May 2019 15:46:40 +0000 Subject: PR libstdc++/88740 Print assertion messages to stderr Backport from mainline 2019-01-22 Jonathan Wakely PR libstdc++/88740 * testsuite/util/testsuite_hooks.h [stderr] (VERIFY): Use fprintf to write to stderr instead of using printf. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270967 138bc75d-0d04-0410-961f-82ee72b054a4 --- libstdc++-v3/ChangeLog | 7 +++++++ libstdc++-v3/testsuite/util/testsuite_hooks.h | 11 +++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 31623b72c13..bacdb178e81 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,5 +1,12 @@ 2019-05-07 Jonathan Wakely + Backport from mainline + 2019-01-22 Jonathan Wakely + + PR libstdc++/88740 + * testsuite/util/testsuite_hooks.h [stderr] (VERIFY): Use fprintf to + write to stderr instead of using printf. + Backport from mainline 2019-04-23 Jonathan Wakely diff --git a/libstdc++-v3/testsuite/util/testsuite_hooks.h b/libstdc++-v3/testsuite/util/testsuite_hooks.h index 36b53ac23f7..9700f0b7761 100644 --- a/libstdc++-v3/testsuite/util/testsuite_hooks.h +++ b/libstdc++-v3/testsuite/util/testsuite_hooks.h @@ -46,18 +46,25 @@ #include #include #include +#include #ifdef _GLIBCXX_HAVE_SYS_STAT_H #include #endif +#ifdef stderr +# define _VERIFY_PRINT(S, F, L, P, C) __builtin_fprintf(stderr, S, F, L, P, C) +#else +# define _VERIFY_PRINT(S, F, L, P, C) __builtin_printf(S, F, L, P, C) +#endif + #define VERIFY(fn) \ do \ { \ if (! (fn)) \ { \ - __builtin_printf("%s:%d: %s: Assertion '%s' failed.\n", \ - __FILE__, __LINE__, __PRETTY_FUNCTION__, #fn); \ + _VERIFY_PRINT("%s:%d: %s: Assertion '%s' failed.\n", \ + __FILE__, __LINE__, __PRETTY_FUNCTION__, #fn); \ __builtin_abort(); \ } \ } while (false) -- cgit v1.2.3 From abdf58280cc307c87e5e13c7828567c6990b7f38 Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Tue, 7 May 2019 15:46:44 +0000 Subject: PR libstdc++/89102 fix common_type<> and common_type specializations This is a partial implementation of the revised std::common_type rules from P0435R1. Backport from mainline 2019-02-06 Jonathan Wakely PR libstdc++/89102 (partial) * include/std/type_traits (common_type<>): Define. (common_type): Derive from common_type. * testsuite/20_util/common_type/requirements/explicit_instantiation.cc: Test zero-length template argument list. * testsuite/20_util/common_type/requirements/sfinae_friendly_1.cc: Test additional single argument cases. * testsuite/20_util/common_type/requirements/sfinae_friendly_2.cc: Adjust expected error. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270968 138bc75d-0d04-0410-961f-82ee72b054a4 --- libstdc++-v3/ChangeLog | 13 +++++++++++++ libstdc++-v3/include/std/type_traits | 7 ++++++- .../common_type/requirements/explicit_instantiation.cc | 1 + .../20_util/common_type/requirements/sfinae_friendly_1.cc | 13 +++++++++++++ .../20_util/common_type/requirements/sfinae_friendly_2.cc | 2 +- 5 files changed, 34 insertions(+), 2 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index bacdb178e81..836ccd33b6e 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,5 +1,18 @@ 2019-05-07 Jonathan Wakely + Backport from mainline + 2019-02-06 Jonathan Wakely + + PR libstdc++/89102 (partial) + * include/std/type_traits (common_type<>): Define. + (common_type): Derive from common_type. + * testsuite/20_util/common_type/requirements/explicit_instantiation.cc: + Test zero-length template argument list. + * testsuite/20_util/common_type/requirements/sfinae_friendly_1.cc: + Test additional single argument cases. + * testsuite/20_util/common_type/requirements/sfinae_friendly_2.cc: + Adjust expected error. + Backport from mainline 2019-01-22 Jonathan Wakely diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits index 06c46ea312e..220f4991546 100644 --- a/libstdc++-v3/include/std/type_traits +++ b/libstdc++-v3/include/std/type_traits @@ -2024,9 +2024,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION struct __expanded_common_type_wrapper<__failure_type, _Args...> { typedef __failure_type type; }; + template<> + struct common_type<> + { }; + template struct common_type<_Tp> - { typedef typename decay<_Tp>::type type; }; + : common_type<_Tp, _Tp> + { }; template struct common_type<_Tp, _Up> diff --git a/libstdc++-v3/testsuite/20_util/common_type/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/20_util/common_type/requirements/explicit_instantiation.cc index 4a71021f2a0..08a317b95b6 100644 --- a/libstdc++-v3/testsuite/20_util/common_type/requirements/explicit_instantiation.cc +++ b/libstdc++-v3/testsuite/20_util/common_type/requirements/explicit_instantiation.cc @@ -30,6 +30,7 @@ namespace std typedef void test_type5; typedef const void test_type6; + template struct common_type<>; template struct common_type; template struct common_type; template struct common_type; diff --git a/libstdc++-v3/testsuite/20_util/common_type/requirements/sfinae_friendly_1.cc b/libstdc++-v3/testsuite/20_util/common_type/requirements/sfinae_friendly_1.cc index 0907f9df24b..e933d5206b6 100644 --- a/libstdc++-v3/testsuite/20_util/common_type/requirements/sfinae_friendly_1.cc +++ b/libstdc++-v3/testsuite/20_util/common_type/requirements/sfinae_friendly_1.cc @@ -159,7 +159,10 @@ namespace std { }; } +static_assert(is_type, int>(), ""); +static_assert(is_type, int>(), ""); static_assert(is_type, int>(), ""); +static_assert(is_type, int>(), ""); static_assert(is_type, ScEn>(), ""); static_assert(is_type, UnscEn>(), ""); static_assert(is_type, int>(), ""); @@ -180,6 +183,8 @@ static_assert(is_type, const volatile int*>(), ""); static_assert(is_type, const volatile void*>(), ""); +static_assert(is_type, void>(), ""); +static_assert(is_type, void>(), ""); static_assert(is_type, void>(), ""); static_assert(is_type, void>(), ""); static_assert(is_type, int>(), ""); @@ -316,6 +321,14 @@ static_assert(!has_type>(), ""); static_assert(!has_type, std::initializer_list>>(), ""); +// PR libstdc++/89102 +static_assert(!has_type>(), ""); +static_assert(!has_type>(), ""); +static_assert(!has_type>(), ""); +static_assert(!has_type>(), ""); +static_assert(!has_type>(), ""); +static_assert(!has_type>(), ""); + void test(int i) { auto local_lmd1 = [=](int, double) { return i + i; }; diff --git a/libstdc++-v3/testsuite/20_util/common_type/requirements/sfinae_friendly_2.cc b/libstdc++-v3/testsuite/20_util/common_type/requirements/sfinae_friendly_2.cc index 8b0e9fd3f33..7758a7d08e5 100644 --- a/libstdc++-v3/testsuite/20_util/common_type/requirements/sfinae_friendly_2.cc +++ b/libstdc++-v3/testsuite/20_util/common_type/requirements/sfinae_friendly_2.cc @@ -25,7 +25,7 @@ template constexpr std::array::type, sizeof...(Args)> -make_array(Args&&... args) // { dg-error "invalid use" } +make_array(Args&&... args) // { dg-error "no type.*common_type<>" } { typedef typename std::common_type::type CT; return std::array{static_cast -- cgit v1.2.3 From 8afa7428f75567c437693345676c6a1b6afaffa6 Mon Sep 17 00:00:00 2001 From: Marek Polacek Date: Tue, 7 May 2019 16:23:19 +0000 Subject: PR c++/88857 - ICE with value-initialization of argument in template. * call.c (convert_like_real): Don't call build_value_init in template. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270970 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cp/ChangeLog | 8 ++++++++ gcc/cp/call.c | 3 ++- gcc/testsuite/g++.dg/cpp0x/initlist-value4.C | 12 ++++++++++++ 3 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/cpp0x/initlist-value4.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index fc0e6a4cc6e..dfa8c74ec45 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,11 @@ +2019-05-07 Marek Polacek + + Backported from mainline + 2019-02-27 Marek Polacek + + PR c++/88857 - ICE with value-initialization of argument in template. + * call.c (convert_like_real): Don't call build_value_init in template. + 2019-04-30 Jakub Jelinek Backported from mainline diff --git a/gcc/cp/call.c b/gcc/cp/call.c index f16f2895402..f66ddfc3a70 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -6775,7 +6775,8 @@ convert_like_real (conversion *convs, tree expr, tree fn, int argnum, /* If we're initializing from {}, it's value-initialization. */ if (BRACE_ENCLOSED_INITIALIZER_P (expr) && CONSTRUCTOR_NELTS (expr) == 0 - && TYPE_HAS_DEFAULT_CONSTRUCTOR (totype)) + && TYPE_HAS_DEFAULT_CONSTRUCTOR (totype) + && !processing_template_decl) { bool direct = CONSTRUCTOR_IS_DIRECT_INIT (expr); if (abstract_virtuals_error_sfinae (NULL_TREE, totype, complain)) diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist-value4.C b/gcc/testsuite/g++.dg/cpp0x/initlist-value4.C new file mode 100644 index 00000000000..427147ff7f2 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/initlist-value4.C @@ -0,0 +1,12 @@ +// PR c++/88857 +// { dg-do compile { target c++11 } } + +class S { int a; }; +void foo (const S &, int); + +template +void +bar () +{ + foo ({}); // { dg-error "too few arguments to function" } +} -- cgit v1.2.3 From 23f201b5fdff2b37b74eabc4d803e74c0f33c403 Mon Sep 17 00:00:00 2001 From: Marek Polacek Date: Tue, 7 May 2019 16:25:26 +0000 Subject: PR c++/89214 - ICE when initializing aggregates with bases. * typeck2.c (digest_init_r): Warn about object slicing instead of crashing. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270971 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cp/ChangeLog | 6 +++++ gcc/cp/typeck2.c | 25 +++++++++++++++-- gcc/testsuite/g++.dg/cpp1z/aggr-base8.C | 48 +++++++++++++++++++++++++++++++++ gcc/testsuite/g++.dg/cpp1z/aggr-base9.C | 33 +++++++++++++++++++++++ 4 files changed, 110 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/g++.dg/cpp1z/aggr-base8.C create mode 100644 gcc/testsuite/g++.dg/cpp1z/aggr-base9.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index dfa8c74ec45..eb971a9940d 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -6,6 +6,12 @@ PR c++/88857 - ICE with value-initialization of argument in template. * call.c (convert_like_real): Don't call build_value_init in template. + 2019-03-25 Marek Polacek + + PR c++/89214 - ICE when initializing aggregates with bases. + * typeck2.c (digest_init_r): Warn about object slicing instead of + crashing. + 2019-04-30 Jakub Jelinek Backported from mainline diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c index 34284074a21..b28044c11dc 100644 --- a/gcc/cp/typeck2.c +++ b/gcc/cp/typeck2.c @@ -1142,8 +1142,29 @@ digest_init_r (tree type, tree init, int nested, int flags, { tree elt = CONSTRUCTOR_ELT (init, 0)->value; if (reference_related_p (type, TREE_TYPE (elt))) - /* We should have fixed this in reshape_init. */ - gcc_unreachable (); + { + /* In C++17, aggregates can have bases, thus participate in + aggregate initialization. In the following case: + + struct B { int c; }; + struct D : B { }; + D d{{D{{42}}}}; + + there's an extra set of braces, so the D temporary initializes + the first element of d, which is the B base subobject. The base + of type B is copy-initialized from the D temporary, causing + object slicing. */ + tree field = next_initializable_field (TYPE_FIELDS (type)); + if (field && DECL_FIELD_IS_BASE (field)) + { + if (warning_at (loc, 0, "initializing a base class of type %qT " + "results in object slicing", TREE_TYPE (field))) + inform (loc, "remove %<{ }%> around initializer"); + } + else + /* We should have fixed this in reshape_init. */ + gcc_unreachable (); + } } if (BRACE_ENCLOSED_INITIALIZER_P (init) diff --git a/gcc/testsuite/g++.dg/cpp1z/aggr-base8.C b/gcc/testsuite/g++.dg/cpp1z/aggr-base8.C new file mode 100644 index 00000000000..8b495a80cb3 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1z/aggr-base8.C @@ -0,0 +1,48 @@ +// PR c++/89214 +// { dg-do compile { target c++17 } } + +struct A +{ + A (int); +}; + +struct BB +{ + A a; +}; + +struct B : BB +{ +}; + +void +foo () +{ + B b1 = {42}; + B b2 = {{42}}; + B b3 = {{{42}}}; + + B b4 = B{42}; + B b5 = B{{42}}; + B b6 = B{{{42}}}; + + B b7 = {B{42}}; + B b8 = {B{{42}}}; + B b9 = {B{{{42}}}}; + + B b10 = {{B{42}}}; // { dg-warning "initializing a base class of type .BB. results in object slicing" } + B b11 = {{B{{42}}}}; // { dg-warning "initializing a base class of type .BB. results in object slicing" } + B b12 = {{B{{{42}}}}}; // { dg-warning "initializing a base class of type .BB. results in object slicing" } + + B bb1{42}; + B bb2{{42}}; + B bb3{{{42}}}; + + B bb7{B{42}}; + B bb8{B{{42}}}; + B bb9{B{{{42}}}}; + + B bb10{{B{42}}}; // { dg-warning "initializing a base class of type .BB. results in object slicing" } + B bb11{{B{{42}}}}; // { dg-warning "initializing a base class of type .BB. results in object slicing" } + B bb12{{B{{{42}}}}}; // { dg-warning "initializing a base class of type .BB. results in object slicing" } +} diff --git a/gcc/testsuite/g++.dg/cpp1z/aggr-base9.C b/gcc/testsuite/g++.dg/cpp1z/aggr-base9.C new file mode 100644 index 00000000000..56aa59cb64a --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1z/aggr-base9.C @@ -0,0 +1,33 @@ +// PR c++/89214 +// { dg-do compile { target c++17 } } + +struct B { + int c; +}; + +struct D : B { }; + +void +foo () +{ + D d1 = {42}; + D d2 = {{42}}; + + D d4 = D{42}; + D d5 = D{{42}}; + + D d7 = {D{42}}; + D d8 = {D{{42}}}; + + D d10 = {{D{42}}}; // { dg-warning "initializing a base class of type .B. results in object slicing" } + D d11 = {{D{{42}}}}; // { dg-warning "initializing a base class of type .B. results in object slicing" } + + D dd1{42}; + D dd2{{42}}; + + D dd7{D{42}}; + D dd8{D{{42}}}; + + D dd10{{D{42}}}; // { dg-warning "initializing a base class of type .B. results in object slicing" } + D dd11{{D{{42}}}}; // { dg-warning "initializing a base class of type .B. results in object slicing" } +} -- cgit v1.2.3 From 1a01e0277aaf9a912b8cf0474d39d3d7dc678367 Mon Sep 17 00:00:00 2001 From: Marek Polacek Date: Tue, 7 May 2019 16:26:38 +0000 Subject: PR c++/89511 - ICE with using-declaration and unscoped enumerator. * parser.c (cp_parser_using_declaration): For an unscoped enum only use its context if it's not a function declaration. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270972 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/parser.c | 3 ++- gcc/testsuite/g++.dg/cpp0x/using-enum-3.C | 21 +++++++++++++++++++++ 3 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/cpp0x/using-enum-3.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index eb971a9940d..c2e8c7ded75 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -12,6 +12,12 @@ * typeck2.c (digest_init_r): Warn about object slicing instead of crashing. + 2019-02-27 Marek Polacek + + PR c++/89511 - ICE with using-declaration and unscoped enumerator. + * parser.c (cp_parser_using_declaration): For an unscoped enum + only use its context if it's not a function declaration. + 2019-04-30 Jakub Jelinek Backported from mainline diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index f69e80b6e03..921916a0844 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -18815,7 +18815,8 @@ cp_parser_using_declaration (cp_parser* parser, /*is_declaration=*/true); if (!qscope) qscope = global_namespace; - else if (UNSCOPED_ENUM_P (qscope)) + else if (UNSCOPED_ENUM_P (qscope) + && !TYPE_FUNCTION_SCOPE_P (qscope)) qscope = CP_TYPE_CONTEXT (qscope); if (access_declaration_p && cp_parser_error_occurred (parser)) diff --git a/gcc/testsuite/g++.dg/cpp0x/using-enum-3.C b/gcc/testsuite/g++.dg/cpp0x/using-enum-3.C new file mode 100644 index 00000000000..edc16890cb1 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/using-enum-3.C @@ -0,0 +1,21 @@ +// PR c++/89511 +// { dg-do compile { target c++11 } } + +void f () +{ + enum e { a }; + using e::a; // { dg-error "not a namespace or unscoped enum" } +} + +struct S { + enum E { A }; + using E::A; // { dg-error "type .S. is not a base type for type .S." } +}; + +namespace N { + enum E { B }; +} + +struct T { + using N::E::B; // { dg-error "using-declaration for non-member at class scope" } +}; -- cgit v1.2.3 From e6e5ec1f1210f5145e06402d83dea2b3430b48cb Mon Sep 17 00:00:00 2001 From: Marek Polacek Date: Tue, 7 May 2019 16:28:11 +0000 Subject: PR c++/89705 - ICE with reference binding with conversion function. * call.c (reference_binding): If the result of the conversion function is a prvalue of non-class type, use the cv-unqualified type. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270973 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/call.c | 3 +++ gcc/testsuite/g++.dg/cpp0x/rv-conv2.C | 18 ++++++++++++++++++ 3 files changed, 27 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp0x/rv-conv2.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index c2e8c7ded75..9bf010b6bd9 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -18,6 +18,12 @@ * parser.c (cp_parser_using_declaration): For an unscoped enum only use its context if it's not a function declaration. + 2019-03-25 Marek Polacek + + PR c++/89705 - ICE with reference binding with conversion function. + * call.c (reference_binding): If the result of the conversion function + is a prvalue of non-class type, use the cv-unqualified type. + 2019-04-30 Jakub Jelinek Backported from mainline diff --git a/gcc/cp/call.c b/gcc/cp/call.c index f66ddfc3a70..4e6d37d6f05 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -1767,6 +1767,9 @@ reference_binding (tree rto, tree rfrom, tree expr, bool c_cast_p, int flags, && DECL_CONV_FN_P (t->cand->fn)) { tree ftype = TREE_TYPE (TREE_TYPE (t->cand->fn)); + /* A prvalue of non-class type is cv-unqualified. */ + if (TREE_CODE (ftype) != REFERENCE_TYPE && !CLASS_TYPE_P (ftype)) + ftype = cv_unqualified (ftype); int sflags = (flags|LOOKUP_NO_CONVERSION)&~LOOKUP_NO_TEMP_BIND; conversion *new_second = reference_binding (rto, ftype, NULL_TREE, c_cast_p, diff --git a/gcc/testsuite/g++.dg/cpp0x/rv-conv2.C b/gcc/testsuite/g++.dg/cpp0x/rv-conv2.C new file mode 100644 index 00000000000..9b9b154995b --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/rv-conv2.C @@ -0,0 +1,18 @@ +// PR c++/89705 +// { dg-do compile { target c++11 } } + +struct W { operator const volatile int(); }; +const int& rci = W(); + +struct X { operator const int(); }; +int&& rri = X(); + +struct Y { operator volatile int(); }; +int&& rri2 = Y(); + +struct Z { operator const volatile int(); }; +volatile int&& rri3 = Z(); + +enum E { A }; +struct S { operator const E(); }; +E&& rre = S(); -- cgit v1.2.3 From 3d9a8fc2c79586289d81b1b45e2529a44ee3b839 Mon Sep 17 00:00:00 2001 From: Marek Polacek Date: Tue, 7 May 2019 16:29:39 +0000 Subject: PR c++/89876 - ICE with deprecated conversion. * call.c (convert_like_real): Only give warnings with tf_warning. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270974 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cp/ChangeLog | 5 +++++ gcc/cp/call.c | 3 ++- gcc/testsuite/g++.dg/warn/conv5.C | 11 +++++++++++ 3 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/warn/conv5.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 9bf010b6bd9..ba00c9ddb34 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -24,6 +24,11 @@ * call.c (reference_binding): If the result of the conversion function is a prvalue of non-class type, use the cv-unqualified type. + 2019-03-29 Marek Polacek + + PR c++/89876 - ICE with deprecated conversion. + * call.c (convert_like_real): Only give warnings with tf_warning. + 2019-04-30 Jakub Jelinek Backported from mainline diff --git a/gcc/cp/call.c b/gcc/cp/call.c index 4e6d37d6f05..11bd5420fe7 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -7114,7 +7114,8 @@ convert_like_real (conversion *convs, tree expr, tree fn, int argnum, case ck_qual: /* Warn about deprecated conversion if appropriate. */ - string_conv_p (totype, expr, 1); + if (complain & tf_warning) + string_conv_p (totype, expr, 1); break; case ck_ptr: diff --git a/gcc/testsuite/g++.dg/warn/conv5.C b/gcc/testsuite/g++.dg/warn/conv5.C new file mode 100644 index 00000000000..e238f9f30b7 --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/conv5.C @@ -0,0 +1,11 @@ +// PR c++/89876 +// { dg-do compile { target c++11 } } +// { dg-prune-output "sorry" } + +template +T f (T, char*); + +template +decltype (f (T (), "")) g (T) { return ""; } // { dg-error "invalid conversion" } + +void h () { g (0); } -- cgit v1.2.3 From 55362112ed3233f55c3532c67d911f288ab2fe61 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Wed, 8 May 2019 00:16:09 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@270995 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 962d70b7e9f..5d48a22e5da 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190507 +20190508 -- cgit v1.2.3 From 6bae0f8aeded5c22a7fa7162eb438c0831e9f1bd Mon Sep 17 00:00:00 2001 From: Kelvin Nilsen Date: Wed, 8 May 2019 22:23:11 +0000 Subject: gcc/ChangeLog: 2019-05-08 Kelvin Nilsen Backport from mainline. 2019-05-06 Kelvin Nilsen PR target/89424 * config/rs6000/rs6000.c (rs6000_expand_vector_extract): Add handling of V1TImode. gcc/testsuite/ChangeLog: 2019-05-08 Kelvin Nilsen Backport from mainline. 2019-05-06 Kelvin Nilsen PR target/89424 * gcc.target/powerpc/pr89424-0.c: New test. * gcc.target/powerpc/vsx-builtin-13a.c: Define macro PR89424 to enable testing of newly patched capability. * gcc.target/powerpc/vsx-builtin-13b.c: Likewise. * gcc.target/powerpc/vsx-builtin-20a.c: Likewise. * gcc.target/powerpc/vsx-builtin-20b.c: Likewise. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@271020 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 9 +++ gcc/config/rs6000/rs6000.c | 4 ++ gcc/testsuite/ChangeLog | 13 ++++ gcc/testsuite/gcc.target/powerpc/pr89424-0.c | 76 ++++++++++++++++++++++ gcc/testsuite/gcc.target/powerpc/vsx-builtin-13a.c | 2 +- gcc/testsuite/gcc.target/powerpc/vsx-builtin-13b.c | 2 +- gcc/testsuite/gcc.target/powerpc/vsx-builtin-20a.c | 2 +- gcc/testsuite/gcc.target/powerpc/vsx-builtin-20b.c | 2 +- 8 files changed, 106 insertions(+), 4 deletions(-) create mode 100644 gcc/testsuite/gcc.target/powerpc/pr89424-0.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 04037522c12..6e40bea8f16 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2019-05-08 Kelvin Nilsen + + Backport from mainline. + 2019-05-06 Kelvin Nilsen + + PR target/89424 + * config/rs6000/rs6000.c (rs6000_expand_vector_extract): Add + handling of V1TImode. + 2019-05-06 Richard Biener PR bootstrap/90359 diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 78d124a312d..e33c1cec534 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -7424,6 +7424,10 @@ rs6000_expand_vector_extract (rtx target, rtx vec, rtx elt) switch (mode) { + case E_V1TImode: + emit_move_insn (target, gen_lowpart (TImode, vec)); + return; + case E_V2DFmode: emit_insn (gen_vsx_extract_v2df_var (target, vec, elt)); return; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 34708a4c6ff..b4de83ec079 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,16 @@ +2019-05-08 Kelvin Nilsen + + Backport from mainline. + 2019-05-06 Kelvin Nilsen + + PR target/89424 + * gcc.target/powerpc/pr89424-0.c: New test. + * gcc.target/powerpc/vsx-builtin-13a.c: Define macro PR89424 to + enable testing of newly patched capability. + * gcc.target/powerpc/vsx-builtin-13b.c: Likewise. + * gcc.target/powerpc/vsx-builtin-20a.c: Likewise. + * gcc.target/powerpc/vsx-builtin-20b.c: Likewise. + 2019-05-06 Richard Biener PR bootstrap/90359 diff --git a/gcc/testsuite/gcc.target/powerpc/pr89424-0.c b/gcc/testsuite/gcc.target/powerpc/pr89424-0.c new file mode 100644 index 00000000000..301cf90ce5f --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/pr89424-0.c @@ -0,0 +1,76 @@ +/* { dg-do run { target { powerpc*-*-* && lp64 } } } */ +/* { dg-require-effective-target vsx_hw } */ +/* { dg-options "-mvsx" } */ + +/* This test should run the same on any target that supports vsx + instructions. Intentionally not specifying cpu in order to test + all code generation paths. */ + +#include + +extern void abort (void); + +/* Define PR89626 after that pr is addressed. */ +#ifdef PR89626 +#define SIGNED +#else +#define SIGNED signed +#endif + +#define CONST0 (((__int128) 31415926539) << 60) + +/* Test that indices > length of vector are applied modulo the vector + length. */ + + +/* Test for variable selector and vector residing in register. */ +__attribute__((noinline)) +__int128 ei (vector SIGNED __int128 v, int i) +{ + return __builtin_vec_ext_v1ti (v, i); +} + +/* Test for variable selector and vector residing in memory. */ +__int128 mei (vector SIGNED __int128 *vp, int i) +{ + return __builtin_vec_ext_v1ti (*vp, i); +} + +int main (int argc, char *argv[]) { + vector SIGNED __int128 dv = { CONST0 }; + __int128 d; + + d = ei (dv, 0); + if (d != CONST0) + abort (); + + d = ei (dv, 1); + if (d != CONST0) + abort (); + + d = ei (dv, 2); + if (d != CONST0) + abort (); + + d = ei (dv, 3); + if (d != CONST0) + abort (); + + d = mei (&dv, 0); + if (d != CONST0) + abort (); + + d = mei (&dv, 1); + if (d != CONST0) + abort (); + + d = mei (&dv, 2); + if (d != CONST0) + abort (); + + d = mei (&dv, 3); + if (d != CONST0) + abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/powerpc/vsx-builtin-13a.c b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-13a.c index 907bcce9236..7dc6bd994e4 100644 --- a/gcc/testsuite/gcc.target/powerpc/vsx-builtin-13a.c +++ b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-13a.c @@ -9,7 +9,7 @@ #include /* Define this after PR89424 is addressed. */ -#undef PR89424 +#define PR89424 /* Define this after PR89626 is addressed. */ #undef PR89626 diff --git a/gcc/testsuite/gcc.target/powerpc/vsx-builtin-13b.c b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-13b.c index e1d791ded4f..168227214fc 100644 --- a/gcc/testsuite/gcc.target/powerpc/vsx-builtin-13b.c +++ b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-13b.c @@ -9,7 +9,7 @@ #include /* Define this after PR89424 is addressed. */ -#undef PR89424 +#define PR89424 /* Define this after PR89626 is addressed. */ #undef PR89626 diff --git a/gcc/testsuite/gcc.target/powerpc/vsx-builtin-20a.c b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-20a.c index 638f5a1c904..12350c3ed7a 100644 --- a/gcc/testsuite/gcc.target/powerpc/vsx-builtin-20a.c +++ b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-20a.c @@ -9,7 +9,7 @@ #include /* Define this after PR89424 is addressed. */ -#undef PR89424 +#define PR89424 extern void abort (void); diff --git a/gcc/testsuite/gcc.target/powerpc/vsx-builtin-20b.c b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-20b.c index 7b127a06c77..37fb7133ba0 100644 --- a/gcc/testsuite/gcc.target/powerpc/vsx-builtin-20b.c +++ b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-20b.c @@ -9,7 +9,7 @@ #include /* Define this after PR89424 is addressed. */ -#undef PR89424 +#define PR89424 extern void abort (void); -- cgit v1.2.3 From 975f1b7e026e465f559a2342a06361ed1a19ab85 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Thu, 9 May 2019 00:16:09 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@271024 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 5d48a22e5da..fab1183c011 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190508 +20190509 -- cgit v1.2.3 From 589e8350ed12e89752d1164eee6e224cf00cd29f Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Fri, 10 May 2019 00:16:08 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@271049 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index fab1183c011..675f162cc2b 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190509 +20190510 -- cgit v1.2.3 From e554f9fb4faed9c5da07c0569f940efb581d1050 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Sat, 11 May 2019 00:16:11 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@271085 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 675f162cc2b..d1d12926139 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190510 +20190511 -- cgit v1.2.3 From 8885054470ccb157712ee70888f7163db61cd067 Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Sat, 11 May 2019 11:38:51 +0000 Subject: PR libstdc++/81266 fix std::thread::native_handle_type test The test uses remove_pointer because in most cases native_handle_type is a pointer to the actual type that the C++ class contains. However, for std::thread, native_handle_type is the same type as the type contained in std::thread, and so remove_pointer is not needed. On targets where pthread_t is a pointer type remove_pointer is not a no-op, instead it transforms pthread_t and causes the test to fail. The fix is to not apply remove_pointer when testing std::thread. Backport from mainline 2019-05-10 Jonathan Wakely PR libstdc++/81266 * testsuite/util/thread/all.h: Do not use remove_pointer for std::thread::native_handle_type. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@271095 138bc75d-0d04-0410-961f-82ee72b054a4 --- libstdc++-v3/ChangeLog | 9 +++++++++ libstdc++-v3/testsuite/util/thread/all.h | 8 +++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 836ccd33b6e..95a559c7f90 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,12 @@ +2019-05-11 Jonathan Wakely + + Backport from mainline + 2019-05-10 Jonathan Wakely + + PR libstdc++/81266 + * testsuite/util/thread/all.h: Do not use remove_pointer for + std::thread::native_handle_type. + 2019-05-07 Jonathan Wakely Backport from mainline diff --git a/libstdc++-v3/testsuite/util/thread/all.h b/libstdc++-v3/testsuite/util/thread/all.h index fc64998fdea..672a20852e4 100644 --- a/libstdc++-v3/testsuite/util/thread/all.h +++ b/libstdc++-v3/testsuite/util/thread/all.h @@ -25,6 +25,7 @@ #include #include #include +#include // C++11 only. namespace __gnu_test @@ -39,7 +40,12 @@ namespace __gnu_test // Remove possible pointer type. typedef typename test_type::native_handle_type native_handle; - typedef typename std::remove_pointer::type native_type; + // For std::thread native_handle_type is the type of its data member, + // for other types it's a pointer to the type of the data member. + typedef typename std::conditional< + std::is_same::value, + native_handle, + typename std::remove_pointer::type>::type native_type; int st = sizeof(test_type); int snt = sizeof(native_type); -- cgit v1.2.3 From cef5ac6121b89b94356ec1dde2fc9221450d20b0 Mon Sep 17 00:00:00 2001 From: Andreas Tobler Date: Sat, 11 May 2019 20:56:33 +0000 Subject: 2019-05-11 Andreas Tobler Backport from mainline. 2019-04-25 Andreas Tobler * config/i386/freebsd64.h: Add bits for 32-bit multilib support. * config/i386/t-freebsd64: New file. * config.gcc: Add the t-freebsd64 for multilib support. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@271100 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 9 +++++++++ gcc/config.gcc | 5 ++++- gcc/config/i386/freebsd64.h | 5 ++++- gcc/config/i386/t-freebsd64 | 30 ++++++++++++++++++++++++++++++ 4 files changed, 47 insertions(+), 2 deletions(-) create mode 100644 gcc/config/i386/t-freebsd64 diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6e40bea8f16..ee52664bfb3 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2019-05-11 Andreas Tobler + + Backport from mainline. + 2019-04-25 Andreas Tobler + + * config/i386/freebsd64.h: Add bits for 32-bit multilib support. + * config/i386/t-freebsd64: New file. + * config.gcc: Add the t-freebsd64 for multilib support. + 2019-05-08 Kelvin Nilsen Backport from mainline. diff --git a/gcc/config.gcc b/gcc/config.gcc index 7af8e028104..6349300c863 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -4676,7 +4676,10 @@ case ${target} in ;; i[34567]86-*-dragonfly* | x86_64-*-dragonfly*) ;; - i[34567]86-*-freebsd* | x86_64-*-freebsd*) + i[34567]86-*-freebsd*) + ;; + x86_64-*-freebsd*) + tmake_file="${tmake_file} i386/t-freebsd64" ;; ia64*-*-linux*) ;; diff --git a/gcc/config/i386/freebsd64.h b/gcc/config/i386/freebsd64.h index d7fbe946698..f4a4548595d 100644 --- a/gcc/config/i386/freebsd64.h +++ b/gcc/config/i386/freebsd64.h @@ -31,7 +31,7 @@ along with GCC; see the file COPYING3. If not see #undef LINK_SPEC #define LINK_SPEC "\ - %{m32:-m elf_i386_fbsd} \ + %{m32:-m elf_i386_fbsd}%{!m32:-m elf_x86_64_fbsd} \ %{p:%nconsider using '-pg' instead of '-p' with gprof(1)} \ %{v:-V} \ %{assert*} %{R*} %{rpath*} %{defsym*} \ @@ -42,3 +42,6 @@ along with GCC; see the file COPYING3. If not see -dynamic-linker %(fbsd_dynamic_linker) } \ %{static:-Bstatic}} \ %{symbolic:-Bsymbolic}" + +#undef MULTILIB_DEFAULTS +#define MULTILIB_DEFAULTS { "m64" } diff --git a/gcc/config/i386/t-freebsd64 b/gcc/config/i386/t-freebsd64 new file mode 100644 index 00000000000..0dd05d479ac --- /dev/null +++ b/gcc/config/i386/t-freebsd64 @@ -0,0 +1,30 @@ +# Copyright (C) 2019 Free Software Foundation, Inc. +# +# This file is part of GCC. +# +# GCC is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GCC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GCC; see the file COPYING3. If not see +# . + +# The 32-bit libraries are found in /usr/lib32 + +# To support i386 and x86-64, the directory structrue +# should be: +# +# /lib has x86-64 libraries. +# /lib32 has i386 libraries. +# + +MULTILIB_OPTIONS = m32 +MULTILIB_DIRNAMES = 32 +MULTILIB_OSDIRNAMES = ../lib32 -- cgit v1.2.3 From 8634750244a5c55a191f8695df60f1a84a943f13 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Sun, 12 May 2019 00:16:11 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@271103 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index d1d12926139..cde09019832 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190511 +20190512 -- cgit v1.2.3 From c59fb9424d320d3dc8918f14b73189b375755251 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Mon, 13 May 2019 00:16:15 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@271113 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index cde09019832..8f70fa8dbec 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190512 +20190513 -- cgit v1.2.3 From b84ef90c9f12b2ba776f75e18637652f23f03840 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Tue, 14 May 2019 00:16:08 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@271142 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 8f70fa8dbec..a27c52edf73 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190513 +20190514 -- cgit v1.2.3 From 48998492589a60fd137821749c0be0646cc55348 Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Tue, 14 May 2019 09:12:35 +0000 Subject: Backport r271116 2019-05-14 Martin Liska Backport from mainline 2019-05-13 Martin Liska PR gcov-profile/90380 * gcov.c (enum loop_type): Remove the enum and the operator. (handle_cycle): Assert that we should not reach a negative count. (circuit): Use loop_found instead of a tri-state loop_type. (get_cycles_count): Do not handle NEGATIVE_LOOP as it can't happen. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@271154 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 14 ++++++++++++++ gcc/gcov.c | 53 ++++++++++++++++++----------------------------------- 2 files changed, 32 insertions(+), 35 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ee52664bfb3..cf582436bee 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,17 @@ +2019-05-14 Martin Liska + + Backport from mainline + 2019-05-13 Martin Liska + + PR gcov-profile/90380 + * gcov.c (enum loop_type): Remove the enum and + the operator. + (handle_cycle): Assert that we should not reach + a negative count. + (circuit): Use loop_found instead of a tri-state loop_type. + (get_cycles_count): Do not handle NEGATIVE_LOOP as it can't + happen. + 2019-05-11 Andreas Tobler Backport from mainline. diff --git a/gcc/gcov.c b/gcc/gcov.c index c7c52ce3629..47c784a9388 100644 --- a/gcc/gcov.c +++ b/gcc/gcov.c @@ -604,27 +604,11 @@ bool function_info::group_line_p (unsigned n, unsigned src_idx) typedef vector arc_vector_t; typedef vector block_vector_t; -/* Enum with types of loop in CFG. */ - -enum loop_type -{ - NO_LOOP = 0, - LOOP = 1, - NEGATIVE_LOOP = 3 -}; - -/* Loop_type operator that merges two values: A and B. */ - -inline loop_type& operator |= (loop_type& a, loop_type b) -{ - return a = static_cast (a | b); -} - /* Handle cycle identified by EDGES, where the function finds minimum cs_count and subtract the value from all counts. The subtracted value is added to COUNT. Returns type of loop. */ -static loop_type +static void handle_cycle (const arc_vector_t &edges, int64_t &count) { /* Find the minimum edge of the cycle, and reduce all nodes in the cycle by @@ -640,7 +624,7 @@ handle_cycle (const arc_vector_t &edges, int64_t &count) for (unsigned i = 0; i < edges.size (); i++) edges[i]->cs_count -= cycle_count; - return cycle_count < 0 ? NEGATIVE_LOOP : LOOP; + gcc_assert (cycle_count >= 0); } /* Unblock a block U from BLOCKED. Apart from that, iterate all blocks @@ -671,12 +655,12 @@ unblock (const block_info *u, block_vector_t &blocked, blocked by a block. COUNT is accumulated count of the current LINE. Returns what type of loop it contains. */ -static loop_type +static bool circuit (block_info *v, arc_vector_t &path, block_info *start, block_vector_t &blocked, vector &block_lists, line_info &linfo, int64_t &count) { - loop_type result = NO_LOOP; + bool loop_found = false; /* Add v to the block list. */ gcc_assert (find (blocked.begin (), blocked.end (), v) == blocked.end ()); @@ -691,15 +675,19 @@ circuit (block_info *v, arc_vector_t &path, block_info *start, path.push_back (arc); if (w == start) - /* Cycle has been found. */ - result |= handle_cycle (path, count); + { + /* Cycle has been found. */ + handle_cycle (path, count); + loop_found = true; + } else if (find (blocked.begin (), blocked.end (), w) == blocked.end ()) - result |= circuit (w, path, start, blocked, block_lists, linfo, count); + loop_found |= circuit (w, path, start, blocked, block_lists, linfo, + count); path.pop_back (); } - if (result != NO_LOOP) + if (loop_found) unblock (v, blocked, block_lists); else for (arc_info *arc = v->succ; arc; arc = arc->succ_next) @@ -716,14 +704,13 @@ circuit (block_info *v, arc_vector_t &path, block_info *start, list.push_back (v); } - return result; + return loop_found; } -/* Find cycles for a LINFO. If HANDLE_NEGATIVE_CYCLES is set and the line - contains a negative loop, then perform the same function once again. */ +/* Find cycles for a LINFO. */ static gcov_type -get_cycles_count (line_info &linfo, bool handle_negative_cycles = true) +get_cycles_count (line_info &linfo) { /* Note that this algorithm works even if blocks aren't in sorted order. Each iteration of the circuit detection is completely independent @@ -731,7 +718,7 @@ get_cycles_count (line_info &linfo, bool handle_negative_cycles = true) Therefore, operating on a permuted order (i.e., non-sorted) only has the effect of permuting the output cycles. */ - loop_type result = NO_LOOP; + bool loop_found = false; gcov_type count = 0; for (vector::iterator it = linfo.blocks.begin (); it != linfo.blocks.end (); it++) @@ -739,14 +726,10 @@ get_cycles_count (line_info &linfo, bool handle_negative_cycles = true) arc_vector_t path; block_vector_t blocked; vector block_lists; - result |= circuit (*it, path, *it, blocked, block_lists, linfo, - count); + loop_found |= circuit (*it, path, *it, blocked, block_lists, linfo, + count); } - /* If we have a negative cycle, repeat the find_cycles routine. */ - if (result == NEGATIVE_LOOP && handle_negative_cycles) - count += get_cycles_count (linfo, false); - return count; } -- cgit v1.2.3 From 1e301377748da3d2ea8911a84b546966dacf9b8d Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Tue, 14 May 2019 09:12:47 +0000 Subject: Backport r271117 2019-05-14 Martin Liska Backport from mainline 2019-05-13 Martin Liska PR gcov-profile/90380 * gcov.c (handle_cycle): Do not support zero cycle count, it should not be possible. (path_contains_zero_cycle_arc): New function. (circuit): Ignore zero cycle arc counts. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@271155 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 11 +++++++++++ gcc/gcov.c | 24 ++++++++++++++++++++---- 2 files changed, 31 insertions(+), 4 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index cf582436bee..ee8b0b02a24 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,14 @@ +2019-05-14 Martin Liska + + Backport from mainline + 2019-05-13 Martin Liska + + PR gcov-profile/90380 + * gcov.c (handle_cycle): Do not support zero cycle count, + it should not be possible. + (path_contains_zero_cycle_arc): New function. + (circuit): Ignore zero cycle arc counts. + 2019-05-14 Martin Liska Backport from mainline diff --git a/gcc/gcov.c b/gcc/gcov.c index 47c784a9388..a99802079dc 100644 --- a/gcc/gcov.c +++ b/gcc/gcov.c @@ -624,7 +624,7 @@ handle_cycle (const arc_vector_t &edges, int64_t &count) for (unsigned i = 0; i < edges.size (); i++) edges[i]->cs_count -= cycle_count; - gcc_assert (cycle_count >= 0); + gcc_assert (cycle_count > 0); } /* Unblock a block U from BLOCKED. Apart from that, iterate all blocks @@ -650,6 +650,17 @@ unblock (const block_info *u, block_vector_t &blocked, unblock (*it, blocked, block_lists); } +/* Return true when PATH contains a zero cycle arc count. */ + +static bool +path_contains_zero_cycle_arc (arc_vector_t &path) +{ + for (unsigned i = 0; i < path.size (); i++) + if (path[i]->cs_count == 0) + return true; + return false; +} + /* Find circuit going to block V, PATH is provisional seen cycle. BLOCKED is vector of blocked vertices, BLOCK_LISTS contains vertices blocked by a block. COUNT is accumulated count of the current LINE. @@ -670,7 +681,9 @@ circuit (block_info *v, arc_vector_t &path, block_info *start, for (arc_info *arc = v->succ; arc; arc = arc->succ_next) { block_info *w = arc->dst; - if (w < start || !linfo.has_block (w)) + if (w < start + || arc->cs_count == 0 + || !linfo.has_block (w)) continue; path.push_back (arc); @@ -680,7 +693,8 @@ circuit (block_info *v, arc_vector_t &path, block_info *start, handle_cycle (path, count); loop_found = true; } - else if (find (blocked.begin (), blocked.end (), w) == blocked.end ()) + else if (!path_contains_zero_cycle_arc (path) + && find (blocked.begin (), blocked.end (), w) == blocked.end ()) loop_found |= circuit (w, path, start, blocked, block_lists, linfo, count); @@ -693,7 +707,9 @@ circuit (block_info *v, arc_vector_t &path, block_info *start, for (arc_info *arc = v->succ; arc; arc = arc->succ_next) { block_info *w = arc->dst; - if (w < start || !linfo.has_block (w)) + if (w < start + || arc->cs_count == 0 + || !linfo.has_block (w)) continue; size_t index -- cgit v1.2.3 From 6ab794fd47df3f726d173f2f9a2413f64813aa76 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Wed, 15 May 2019 00:16:08 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@271195 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index a27c52edf73..bd0ad5b1f1b 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190514 +20190515 -- cgit v1.2.3 From 440abd25784876a8b0b1bea9626b9c0337eadc2e Mon Sep 17 00:00:00 2001 From: David Edelsohn Date: Wed, 15 May 2019 17:01:42 +0000 Subject: * xcoffout.h (xcoff_private_rodata_section_name): Declare. * xcoffout.c (xcoff_private_rodata_section_name): Define. * config/rs6000/rs6000.c (rs6000_xcoff_asm_init_sections): Create read_only_private_data_section using coff_private_rodata_section_name. (rs6000_xcoff_file_start): Generate coff_private_rodata_section_name. PR target/61976 * config/rs6000/rs6000.c (rs6000_function_arg): Don't pass aggregates in FPRs on AIX. Ensure type is non-NULL. (rs6000_arg_partial_bytes): Same. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@271255 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 13 +++++++++++++ gcc/config/rs6000/rs6000.c | 18 ++++++++++++------ gcc/xcoffout.c | 1 + gcc/xcoffout.h | 1 + 4 files changed, 27 insertions(+), 6 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ee8b0b02a24..37f1c7c6446 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,16 @@ +2019-05-15 David Edelsohn + + * xcoffout.h (xcoff_private_rodata_section_name): Declare. + * xcoffout.c (xcoff_private_rodata_section_name): Define. + * config/rs6000/rs6000.c (rs6000_xcoff_asm_init_sections): Create + read_only_private_data_section using coff_private_rodata_section_name. + (rs6000_xcoff_file_start): Generate coff_private_rodata_section_name. + + PR target/61976 + * config/rs6000/rs6000.c (rs6000_function_arg): Don't pass aggregates + in FPRs on AIX. Ensure type is non-NULL. + (rs6000_arg_partial_bytes): Same. + 2019-05-14 Martin Liska Backport from mainline diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index e33c1cec534..79dc864ffa1 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -12615,7 +12615,9 @@ rs6000_function_arg (cumulative_args_t cum_v, machine_mode mode, if (elt_mode == TDmode && (cum->fregno % 2) == 1) cum->fregno++; - if (USE_FP_FOR_ARG_P (cum, elt_mode)) + if (USE_FP_FOR_ARG_P (cum, elt_mode) + && !(TARGET_AIX && !TARGET_ELF + && type != NULL && AGGREGATE_TYPE_P (type))) { rtx rvec[GP_ARG_NUM_REG + AGGR_ARG_NUM_REG + 1]; rtx r, off; @@ -12751,7 +12753,9 @@ rs6000_arg_partial_bytes (cumulative_args_t cum_v, machine_mode mode, align_words = rs6000_parm_start (mode, type, cum->words); - if (USE_FP_FOR_ARG_P (cum, elt_mode)) + if (USE_FP_FOR_ARG_P (cum, elt_mode) + && !(TARGET_AIX && !TARGET_ELF + && type != NULL && AGGREGATE_TYPE_P (type))) { unsigned long n_fpreg = (GET_MODE_SIZE (elt_mode) + 7) >> 3; @@ -34218,6 +34222,10 @@ rs6000_xcoff_asm_init_sections (void) rs6000_xcoff_output_readwrite_section_asm_op, &xcoff_private_data_section_name); + read_only_private_data_section + = get_unnamed_section (0, rs6000_xcoff_output_readonly_section_asm_op, + &xcoff_private_rodata_section_name); + tls_data_section = get_unnamed_section (SECTION_TLS, rs6000_xcoff_output_tls_section_asm_op, @@ -34228,10 +34236,6 @@ rs6000_xcoff_asm_init_sections (void) rs6000_xcoff_output_tls_section_asm_op, &xcoff_private_data_section_name); - read_only_private_data_section - = get_unnamed_section (0, rs6000_xcoff_output_readonly_section_asm_op, - &xcoff_private_data_section_name); - toc_section = get_unnamed_section (0, rs6000_xcoff_output_toc_section_asm_op, NULL); @@ -34412,6 +34416,8 @@ rs6000_xcoff_file_start (void) main_input_filename, ".bss_"); rs6000_gen_section_name (&xcoff_private_data_section_name, main_input_filename, ".rw_"); + rs6000_gen_section_name (&xcoff_private_rodata_section_name, + main_input_filename, ".rop_"); rs6000_gen_section_name (&xcoff_read_only_section_name, main_input_filename, ".ro_"); rs6000_gen_section_name (&xcoff_tls_data_section_name, diff --git a/gcc/xcoffout.c b/gcc/xcoffout.c index 53156a70fcb..e6b1cd03515 100644 --- a/gcc/xcoffout.c +++ b/gcc/xcoffout.c @@ -64,6 +64,7 @@ static const char *xcoff_current_function_file; char *xcoff_bss_section_name; char *xcoff_private_data_section_name; +char *xcoff_private_rodata_section_name; char *xcoff_tls_data_section_name; char *xcoff_tbss_section_name; char *xcoff_read_only_section_name; diff --git a/gcc/xcoffout.h b/gcc/xcoffout.h index 505df4e2a50..cb23b5e7062 100644 --- a/gcc/xcoffout.h +++ b/gcc/xcoffout.h @@ -127,6 +127,7 @@ extern const char *xcoff_current_include_file; extern char *xcoff_bss_section_name; extern char *xcoff_private_data_section_name; +extern char *xcoff_private_rodata_section_name; extern char *xcoff_tls_data_section_name; extern char *xcoff_tbss_section_name; extern char *xcoff_read_only_section_name; -- cgit v1.2.3 From 44d5e7c5bf790c0dfe8b84bd4798d867a3f88145 Mon Sep 17 00:00:00 2001 From: David Edelsohn Date: Wed, 15 May 2019 17:06:22 +0000 Subject: Correct ChangeLog formatting. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@271256 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 37f1c7c6446..f9aba0326ae 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,11 +1,15 @@ 2019-05-15 David Edelsohn + Backport from mainline + 2019-04-11 David Edelsohn * xcoffout.h (xcoff_private_rodata_section_name): Declare. * xcoffout.c (xcoff_private_rodata_section_name): Define. * config/rs6000/rs6000.c (rs6000_xcoff_asm_init_sections): Create read_only_private_data_section using coff_private_rodata_section_name. (rs6000_xcoff_file_start): Generate coff_private_rodata_section_name. + 2018-12-04 David Edelsohn + 2018-12-13 David Edelsohn PR target/61976 * config/rs6000/rs6000.c (rs6000_function_arg): Don't pass aggregates in FPRs on AIX. Ensure type is non-NULL. -- cgit v1.2.3 From 9f4ba14bde1f3f63ce54121807e6dfdc753d6641 Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Wed, 15 May 2019 20:27:45 +0000 Subject: PR libstdc++/90454.cc path construction from void* Make the filesystem::path constructors SFINAE away for void* arguments, instead of giving an error due to iterator_traits::reference. Backport from mainline 2019-05-13 Jonathan Wakely PR libstdc++/90454.cc path construction from void* * include/bits/fs_path.h (path::_Path): Use remove_pointer so that pointers to void are rejected as well as void. * include/experimental/bits/fs_path.h (path::_Path): Likewise. * testsuite/27_io/filesystem/path/construct/80762.cc: Also check pointers to void. * testsuite/experimental/filesystem/path/construct/80762.cc: Likewise. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@271265 138bc75d-0d04-0410-961f-82ee72b054a4 --- libstdc++-v3/ChangeLog | 13 +++++++++++++ libstdc++-v3/include/bits/fs_path.h | 2 +- libstdc++-v3/include/experimental/bits/fs_path.h | 9 +++++---- .../testsuite/27_io/filesystem/path/construct/80762.cc | 10 ++++++++++ .../experimental/filesystem/path/construct/80762.cc | 10 ++++++++++ 5 files changed, 39 insertions(+), 5 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 95a559c7f90..916bb1b31cb 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,16 @@ +2019-05-15 Jonathan Wakely + + Backport from mainline + 2019-05-13 Jonathan Wakely + + PR libstdc++/90454.cc path construction from void* + * include/bits/fs_path.h (path::_Path): Use remove_pointer so that + pointers to void are rejected as well as void. + * include/experimental/bits/fs_path.h (path::_Path): Likewise. + * testsuite/27_io/filesystem/path/construct/80762.cc: Also check + pointers to void. + * testsuite/experimental/filesystem/path/construct/80762.cc: Likewise. + 2019-05-11 Jonathan Wakely Backport from mainline diff --git a/libstdc++-v3/include/bits/fs_path.h b/libstdc++-v3/include/bits/fs_path.h index d9e18bfc30a..256b1d0a97f 100644 --- a/libstdc++-v3/include/bits/fs_path.h +++ b/libstdc++-v3/include/bits/fs_path.h @@ -107,7 +107,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 template using _Path = typename std::enable_if<__and_<__not_, path>>, - __not_>, + __not_>>, __constructible_from<_Tp1, _Tp2>>::value, path>::type; diff --git a/libstdc++-v3/include/experimental/bits/fs_path.h b/libstdc++-v3/include/experimental/bits/fs_path.h index 088d62f8f43..e419569b8ca 100644 --- a/libstdc++-v3/include/experimental/bits/fs_path.h +++ b/libstdc++-v3/include/experimental/bits/fs_path.h @@ -120,11 +120,12 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 : decltype(__is_path_src(std::declval<_Source>(), 0)) { }; - template + template::type, + typename _Tp1_noptr = typename remove_pointer<_Tp1>::type> using _Path = typename - std::enable_if<__and_<__not_::type, - path>>, - __not_>, + std::enable_if<__and_<__not_>, + __not_>, __constructible_from<_Tp1, _Tp2>>::value, path>::type; diff --git a/libstdc++-v3/testsuite/27_io/filesystem/path/construct/80762.cc b/libstdc++-v3/testsuite/27_io/filesystem/path/construct/80762.cc index 15a79fd4e12..c418da0bc37 100644 --- a/libstdc++-v3/testsuite/27_io/filesystem/path/construct/80762.cc +++ b/libstdc++-v3/testsuite/27_io/filesystem/path/construct/80762.cc @@ -22,8 +22,18 @@ using std::filesystem::path; +// PR libstdc++/80762.cc static_assert( !std::is_constructible_v ); static_assert( !std::is_constructible_v ); static_assert( !std::is_constructible_v ); static_assert( !std::is_constructible_v ); static_assert( !std::is_constructible_v ); + +// PR libstdc++/90454.cc +static_assert( !std::is_constructible_v ); +static_assert( !std::is_constructible_v ); +static_assert( !std::is_constructible_v ); +static_assert( !std::is_constructible_v ); +static_assert( !std::is_constructible_v ); +static_assert( !std::is_constructible_v ); +static_assert( !std::is_constructible_v ); diff --git a/libstdc++-v3/testsuite/experimental/filesystem/path/construct/80762.cc b/libstdc++-v3/testsuite/experimental/filesystem/path/construct/80762.cc index 84ea48b11b1..3366a1299a1 100644 --- a/libstdc++-v3/testsuite/experimental/filesystem/path/construct/80762.cc +++ b/libstdc++-v3/testsuite/experimental/filesystem/path/construct/80762.cc @@ -22,8 +22,18 @@ using std::experimental::filesystem::path; +// PR libstdc++/80762.cc static_assert( !std::is_constructible::value, "" ); static_assert( !std::is_constructible::value, "" ); static_assert( !std::is_constructible::value, "" ); static_assert( !std::is_constructible::value, "" ); static_assert( !std::is_constructible::value, "" ); + +// PR libstdc++/90454.cc +static_assert( !std::is_constructible::value, "" ); +static_assert( !std::is_constructible::value, "" ); +static_assert( !std::is_constructible::value, "" ); +static_assert( !std::is_constructible::value, "" ); +static_assert( !std::is_constructible::value, "" ); +static_assert( !std::is_constructible::value, "" ); +static_assert( !std::is_constructible::value, "" ); -- cgit v1.2.3 From 2b50e359bd904ab012cc2e5a62af378a251335e4 Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Wed, 15 May 2019 20:27:50 +0000 Subject: Fix filesystem::path tests The root_path.cc test had some debugging macros left in accidentally, so didn't FAIL correctly if an assertion failed. Backport from mainline 2019-04-30 Jonathan Wakely * testsuite/27_io/filesystem/path/decompose/root_path.cc: Remove macros accidentally left in. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@271266 138bc75d-0d04-0410-961f-82ee72b054a4 --- libstdc++-v3/ChangeLog | 6 ++++++ libstdc++-v3/testsuite/27_io/filesystem/path/decompose/root_path.cc | 5 ----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 916bb1b31cb..50631125630 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,5 +1,11 @@ 2019-05-15 Jonathan Wakely + Backport from mainline + 2019-04-30 Jonathan Wakely + + * testsuite/27_io/filesystem/path/decompose/root_path.cc: Remove + macros accidentally left in. + Backport from mainline 2019-05-13 Jonathan Wakely diff --git a/libstdc++-v3/testsuite/27_io/filesystem/path/decompose/root_path.cc b/libstdc++-v3/testsuite/27_io/filesystem/path/decompose/root_path.cc index 0b7b0760a73..d6c75eeea2a 100644 --- a/libstdc++-v3/testsuite/27_io/filesystem/path/decompose/root_path.cc +++ b/libstdc++-v3/testsuite/27_io/filesystem/path/decompose/root_path.cc @@ -36,10 +36,6 @@ test01() VERIFY( p2.root_path() == path("/") ); } -#undef VERIFY -#define VERIFY(X) do { if (!(X)) { __builtin_puts("FAIL: " #X); } } while(false) -#define DUMP(X, Y, Z) do { if (!(Y == Z)) { __builtin_printf("%s %s %s\n", X.c_str(), Y.c_str(), Z.c_str()); } } while(false) - void test02() { @@ -49,7 +45,6 @@ test02() path rootn = p.root_name(); path rootd = p.root_directory(); VERIFY( rootp == (rootn / rootd) ); - DUMP(p, rootp , (rootn / rootd) ); } } -- cgit v1.2.3 From 44924d5541a7ddb55cfdb4228d5e396066138599 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Thu, 16 May 2019 00:16:10 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@271273 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index bd0ad5b1f1b..eed4fcb48d1 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190515 +20190516 -- cgit v1.2.3 From 669c7d38c37884695368cf4fe96ec6f5ebd35192 Mon Sep 17 00:00:00 2001 From: Kelvin Nilsen Date: Thu, 16 May 2019 21:10:32 +0000 Subject: gcc/ChangeLog: 2019-05-16 Kelvin Nilsen Backport from mainline. 2019-05-07 Kelvin Nilsen PR target/89765 * config/rs6000/rs6000-c.c (altivec_resolve_overloaded_builtin): In handling of ALTIVEC_BUILTIN_VEC_INSERT, use modular arithmetic to compute vector element selector for both constant and variable operands. gcc/testsuite/ChangeLog: 2019-05-16 Kelvin Nilsen Backport from mainline. 2019-05-07 Kelvin Nilsen PR target/89765 * gcc.target/powerpc/pr89765-mc.c: New test. * gcc.target/powerpc/vsx-builtin-10c.c: New test. * gcc.target/powerpc/vsx-builtin-10d.c: New test. * gcc.target/powerpc/vsx-builtin-11c.c: New test. * gcc.target/powerpc/vsx-builtin-11d.c: New test. * gcc.target/powerpc/vsx-builtin-12c.c: New test. * gcc.target/powerpc/vsx-builtin-12d.c: New test. * gcc.target/powerpc/vsx-builtin-13c.c: New test. * gcc.target/powerpc/vsx-builtin-13d.c: New test. * gcc.target/powerpc/vsx-builtin-14c.c: New test. * gcc.target/powerpc/vsx-builtin-14d.c: New test. * gcc.target/powerpc/vsx-builtin-15c.c: New test. * gcc.target/powerpc/vsx-builtin-15d.c: New test. * gcc.target/powerpc/vsx-builtin-16c.c: New test. * gcc.target/powerpc/vsx-builtin-16d.c: New test. * gcc.target/powerpc/vsx-builtin-17c.c: New test. * gcc.target/powerpc/vsx-builtin-17d.c: New test. * gcc.target/powerpc/vsx-builtin-18c.c: New test. * gcc.target/powerpc/vsx-builtin-18d.c: New test. * gcc.target/powerpc/vsx-builtin-19c.c: New test. * gcc.target/powerpc/vsx-builtin-19d.c: New test. * gcc.target/powerpc/vsx-builtin-20c.c: New test. * gcc.target/powerpc/vsx-builtin-20d.c: New test. * gcc.target/powerpc/vsx-builtin-9c.c: New test. * gcc.target/powerpc/vsx-builtin-9d.c: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@271297 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 11 + gcc/config/rs6000/rs6000-c.c | 22 +- gcc/testsuite/ChangeLog | 32 ++ gcc/testsuite/gcc.target/powerpc/pr89765-mc.c | 400 +++++++++++++++++++++ gcc/testsuite/gcc.target/powerpc/vsx-builtin-10c.c | 155 ++++++++ gcc/testsuite/gcc.target/powerpc/vsx-builtin-10d.c | 155 ++++++++ gcc/testsuite/gcc.target/powerpc/vsx-builtin-11c.c | 149 ++++++++ gcc/testsuite/gcc.target/powerpc/vsx-builtin-11d.c | 149 ++++++++ gcc/testsuite/gcc.target/powerpc/vsx-builtin-12c.c | 112 ++++++ gcc/testsuite/gcc.target/powerpc/vsx-builtin-12d.c | 112 ++++++ gcc/testsuite/gcc.target/powerpc/vsx-builtin-13c.c | 115 ++++++ gcc/testsuite/gcc.target/powerpc/vsx-builtin-13d.c | 115 ++++++ gcc/testsuite/gcc.target/powerpc/vsx-builtin-14c.c | 149 ++++++++ gcc/testsuite/gcc.target/powerpc/vsx-builtin-14d.c | 149 ++++++++ gcc/testsuite/gcc.target/powerpc/vsx-builtin-15c.c | 151 ++++++++ gcc/testsuite/gcc.target/powerpc/vsx-builtin-15d.c | 151 ++++++++ gcc/testsuite/gcc.target/powerpc/vsx-builtin-16c.c | 180 ++++++++++ gcc/testsuite/gcc.target/powerpc/vsx-builtin-16d.c | 163 +++++++++ gcc/testsuite/gcc.target/powerpc/vsx-builtin-17c.c | 154 ++++++++ gcc/testsuite/gcc.target/powerpc/vsx-builtin-17d.c | 154 ++++++++ gcc/testsuite/gcc.target/powerpc/vsx-builtin-18c.c | 148 ++++++++ gcc/testsuite/gcc.target/powerpc/vsx-builtin-18d.c | 148 ++++++++ gcc/testsuite/gcc.target/powerpc/vsx-builtin-19c.c | 122 +++++++ gcc/testsuite/gcc.target/powerpc/vsx-builtin-19d.c | 122 +++++++ gcc/testsuite/gcc.target/powerpc/vsx-builtin-20c.c | 115 ++++++ gcc/testsuite/gcc.target/powerpc/vsx-builtin-20d.c | 115 ++++++ gcc/testsuite/gcc.target/powerpc/vsx-builtin-9c.c | 164 +++++++++ gcc/testsuite/gcc.target/powerpc/vsx-builtin-9d.c | 164 +++++++++ 28 files changed, 3868 insertions(+), 8 deletions(-) create mode 100644 gcc/testsuite/gcc.target/powerpc/pr89765-mc.c create mode 100644 gcc/testsuite/gcc.target/powerpc/vsx-builtin-10c.c create mode 100644 gcc/testsuite/gcc.target/powerpc/vsx-builtin-10d.c create mode 100644 gcc/testsuite/gcc.target/powerpc/vsx-builtin-11c.c create mode 100644 gcc/testsuite/gcc.target/powerpc/vsx-builtin-11d.c create mode 100644 gcc/testsuite/gcc.target/powerpc/vsx-builtin-12c.c create mode 100644 gcc/testsuite/gcc.target/powerpc/vsx-builtin-12d.c create mode 100644 gcc/testsuite/gcc.target/powerpc/vsx-builtin-13c.c create mode 100644 gcc/testsuite/gcc.target/powerpc/vsx-builtin-13d.c create mode 100644 gcc/testsuite/gcc.target/powerpc/vsx-builtin-14c.c create mode 100644 gcc/testsuite/gcc.target/powerpc/vsx-builtin-14d.c create mode 100644 gcc/testsuite/gcc.target/powerpc/vsx-builtin-15c.c create mode 100644 gcc/testsuite/gcc.target/powerpc/vsx-builtin-15d.c create mode 100644 gcc/testsuite/gcc.target/powerpc/vsx-builtin-16c.c create mode 100644 gcc/testsuite/gcc.target/powerpc/vsx-builtin-16d.c create mode 100644 gcc/testsuite/gcc.target/powerpc/vsx-builtin-17c.c create mode 100644 gcc/testsuite/gcc.target/powerpc/vsx-builtin-17d.c create mode 100644 gcc/testsuite/gcc.target/powerpc/vsx-builtin-18c.c create mode 100644 gcc/testsuite/gcc.target/powerpc/vsx-builtin-18d.c create mode 100644 gcc/testsuite/gcc.target/powerpc/vsx-builtin-19c.c create mode 100644 gcc/testsuite/gcc.target/powerpc/vsx-builtin-19d.c create mode 100644 gcc/testsuite/gcc.target/powerpc/vsx-builtin-20c.c create mode 100644 gcc/testsuite/gcc.target/powerpc/vsx-builtin-20d.c create mode 100644 gcc/testsuite/gcc.target/powerpc/vsx-builtin-9c.c create mode 100644 gcc/testsuite/gcc.target/powerpc/vsx-builtin-9d.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f9aba0326ae..e64f42d6b80 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,14 @@ +2019-05-16 Kelvin Nilsen + + Backport from mainline. + 2019-05-07 Kelvin Nilsen + + PR target/89765 + * config/rs6000/rs6000-c.c (altivec_resolve_overloaded_builtin): + In handling of ALTIVEC_BUILTIN_VEC_INSERT, use modular arithmetic + to compute vector element selector for both constant and variable + operands. + 2019-05-15 David Edelsohn Backport from mainline diff --git a/gcc/config/rs6000/rs6000-c.c b/gcc/config/rs6000/rs6000-c.c index a448bfafc25..eb19c75bfa4 100644 --- a/gcc/config/rs6000/rs6000-c.c +++ b/gcc/config/rs6000/rs6000-c.c @@ -6787,11 +6787,13 @@ altivec_resolve_overloaded_builtin (location_t loc, tree fndecl, /* If we can use the VSX xxpermdi instruction, use that for insert. */ mode = TYPE_MODE (arg1_type); if ((mode == V2DFmode || mode == V2DImode) && VECTOR_UNIT_VSX_P (mode) - && TREE_CODE (arg2) == INTEGER_CST - && wi::ltu_p (wi::to_wide (arg2), 2)) + && TREE_CODE (arg2) == INTEGER_CST) { + wide_int selector = wi::to_wide (arg2); + selector = wi::umod_trunc (selector, 2); tree call = NULL_TREE; + arg2 = wide_int_to_tree (TREE_TYPE (arg2), selector); if (mode == V2DFmode) call = rs6000_builtin_decls[VSX_BUILTIN_VEC_SET_V2DF]; else if (mode == V2DImode) @@ -6803,11 +6805,12 @@ altivec_resolve_overloaded_builtin (location_t loc, tree fndecl, return build_call_expr (call, 3, arg1, arg0, arg2); } else if (mode == V1TImode && VECTOR_UNIT_VSX_P (mode) - && TREE_CODE (arg2) == INTEGER_CST - && wi::eq_p (wi::to_wide (arg2), 0)) + && TREE_CODE (arg2) == INTEGER_CST) { tree call = rs6000_builtin_decls[VSX_BUILTIN_VEC_SET_V1TI]; + wide_int selector = wi::zero(32); + arg2 = wide_int_to_tree (TREE_TYPE (arg2), selector); /* Note, __builtin_vec_insert_ has vector and scalar types reversed. */ return build_call_expr (call, 3, arg1, arg0, arg2); @@ -6815,10 +6818,13 @@ altivec_resolve_overloaded_builtin (location_t loc, tree fndecl, /* Build *(((arg1_inner_type*)&(vector type){arg1})+arg2) = arg0. */ arg1_inner_type = TREE_TYPE (arg1_type); - arg2 = build_binary_op (loc, BIT_AND_EXPR, arg2, - build_int_cst (TREE_TYPE (arg2), - TYPE_VECTOR_SUBPARTS (arg1_type) - - 1), 0); + if (TYPE_VECTOR_SUBPARTS (arg1_type) == 1) + arg2 = build_int_cst (TREE_TYPE (arg2), 0); + else + arg2 = build_binary_op (loc, BIT_AND_EXPR, arg2, + build_int_cst (TREE_TYPE (arg2), + TYPE_VECTOR_SUBPARTS (arg1_type) + - 1), 0); decl = build_decl (loc, VAR_DECL, NULL_TREE, arg1_type); DECL_EXTERNAL (decl) = 0; TREE_PUBLIC (decl) = 0; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b4de83ec079..9d8e462f791 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,35 @@ +2019-05-16 Kelvin Nilsen + + Backport from mainline. + 2019-05-07 Kelvin Nilsen + + PR target/89765 + * gcc.target/powerpc/pr89765-mc.c: New test. + * gcc.target/powerpc/vsx-builtin-10c.c: New test. + * gcc.target/powerpc/vsx-builtin-10d.c: New test. + * gcc.target/powerpc/vsx-builtin-11c.c: New test. + * gcc.target/powerpc/vsx-builtin-11d.c: New test. + * gcc.target/powerpc/vsx-builtin-12c.c: New test. + * gcc.target/powerpc/vsx-builtin-12d.c: New test. + * gcc.target/powerpc/vsx-builtin-13c.c: New test. + * gcc.target/powerpc/vsx-builtin-13d.c: New test. + * gcc.target/powerpc/vsx-builtin-14c.c: New test. + * gcc.target/powerpc/vsx-builtin-14d.c: New test. + * gcc.target/powerpc/vsx-builtin-15c.c: New test. + * gcc.target/powerpc/vsx-builtin-15d.c: New test. + * gcc.target/powerpc/vsx-builtin-16c.c: New test. + * gcc.target/powerpc/vsx-builtin-16d.c: New test. + * gcc.target/powerpc/vsx-builtin-17c.c: New test. + * gcc.target/powerpc/vsx-builtin-17d.c: New test. + * gcc.target/powerpc/vsx-builtin-18c.c: New test. + * gcc.target/powerpc/vsx-builtin-18d.c: New test. + * gcc.target/powerpc/vsx-builtin-19c.c: New test. + * gcc.target/powerpc/vsx-builtin-19d.c: New test. + * gcc.target/powerpc/vsx-builtin-20c.c: New test. + * gcc.target/powerpc/vsx-builtin-20d.c: New test. + * gcc.target/powerpc/vsx-builtin-9c.c: New test. + * gcc.target/powerpc/vsx-builtin-9d.c: New test. + 2019-05-08 Kelvin Nilsen Backport from mainline. diff --git a/gcc/testsuite/gcc.target/powerpc/pr89765-mc.c b/gcc/testsuite/gcc.target/powerpc/pr89765-mc.c new file mode 100644 index 00000000000..8384536058b --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/pr89765-mc.c @@ -0,0 +1,400 @@ +/* { dg-do run { target int128 } } */ +/* { dg-require-effective-target vsx_hw } */ +/* { dg-options "-mvsx -O2" } */ + +/* This test should run the same on any target that supports vsx + instructions. Intentionally not specifying cpu in order to test + all code generation paths. */ + +#include +#include +#include + +#include + +static vector unsigned __int128 +deoptimize_uint128 (vector unsigned __int128 a) +{ + __asm__ (" # %x0" : "+v" (a)); + return a; +} + +static vector unsigned long long int +deoptimize_ulong (vector unsigned long long int a) +{ + __asm__ (" # %x0" : "+v" (a)); + return a; +} + +static vector unsigned int +deoptimize_uint (vector unsigned int a) +{ + __asm__ (" # %x0" : "+v" (a)); + return a; +} + +static vector unsigned char +deoptimize_uchar (vector unsigned char a) +{ + __asm__ (" # %x0" : "+v" (a)); + return a; +} + +static vector unsigned short +deoptimize_ushort (vector unsigned short a) +{ + __asm__ (" # %x0" : "+v" (a)); + return a; +} + +__attribute ((noinline)) +vector unsigned __int128 +set_auto_n_uint128 (vector unsigned __int128 a, int n, unsigned __int128 x) +{ + return vec_insert (x, a, n); +} + +__attribute ((noinline)) +vector unsigned long long int +set_auto_n_ulong (vector unsigned long long int a, int n, + unsigned long long int x) +{ + return vec_insert (x, a, n); +} + +__attribute ((noinline)) +vector unsigned int +set_auto_n_uint (vector unsigned int a, int n, unsigned int x) +{ + return vec_insert (x, a, n); +} + +__attribute ((noinline)) +vector unsigned char +set_auto_n_uchar (vector unsigned char a, int n, unsigned char x) +{ + return vec_insert (x, a, n); +} + +__attribute ((noinline)) +vector unsigned short +set_auto_n_ushort (vector unsigned short a, int n, unsigned short x) +{ + return vec_insert (x, a, n); +} + +__attribute ((noinline)) +unsigned __int128 +get_auto_n_uint128 (vector unsigned __int128 a, int n) +{ + return vec_extract (a, n); +} + +__attribute ((noinline)) +unsigned long long int +get_auto_n_ulong (vector unsigned long long int a, int n) +{ + return vec_extract (a, n); +} + +__attribute ((noinline)) +unsigned int +get_auto_n_uint (vector unsigned int a, int n) +{ + return vec_extract (a, n); +} + +__attribute ((noinline)) +unsigned char +get_auto_n_uchar (vector unsigned char a, int n) +{ + return vec_extract (a, n); +} + +__attribute ((noinline)) +unsigned short +get_auto_n_ushort (vector unsigned short a, int n) +{ + return vec_extract (a, n); +} + +int check_uint128_element (int i, unsigned __int128 entry) +{ + printf ("checking uint128 entry at index %d\n", i); + + return (entry == ((((unsigned __int128) 0xffeeddccbbaa9988ULL) << 64) + | 0x0706050403020100ULL)); +} + +unsigned __int128 get_uint128_element (int i) +{ + return ((((unsigned __int128) 0xffeeddccbbaa9988ULL) << 64) + | 0x0706050403020100ULL); +} + +int check_ulong_element (int i, unsigned long long int entry) +{ + printf ("checking ulong entry 0x%llx at index %d\n", entry, i); + + switch (i % 2) + { + case 0: return (entry == 0x9999901010ULL); + case 1: return (entry == 0x7777733333ULL); + default: + return 0; + } +} + +unsigned long long int get_ulong_element (int i) +{ + switch (i % 2) + { + case 0: return 0x9999901010ULL; + case 1: return 0x7777733333ULL; + } +} + +int check_uint_element (int i, unsigned int entry) +{ + printf ("checking uint entry 0x%x at index %d\n", entry, i); + + switch (i % 4) + { + case 0: return (entry == 0x99999); + case 1: return (entry == 0x01010); + case 2: return (entry == 0x77777); + case 3: return (entry == 0x33333); + default: + return 0; + } +} + +unsigned int get_uint_element (int i) +{ + switch (i % 4) + { + case 0: return 0x99999; + case 1: return 0x01010; + case 2: return 0x77777; + case 3: return 0x33333; + } +} + +int check_uchar_element (int i, unsigned char entry) +{ + printf ("checking uchar entry 0x%x at index %d\n", entry, i); + switch (i % 16) + { + case 0: return (entry == 0x90); + case 1: return (entry == 0x80); + case 2: return (entry == 0x70); + case 3: return (entry == 0x60); + case 4: return (entry == 0x50); + case 5: return (entry == 0x40); + case 6: return (entry == 0x30); + case 7: return (entry == 0x20); + case 8: return (entry == 0x10); + case 9: return (entry == 0xf0); + case 10: return (entry == 0xe0); + case 11: return (entry == 0xd0); + case 12: return (entry == 0xc0); + case 13: return (entry == 0xb0); + case 14: return (entry == 0xa0); + case 15: return (entry == 0xff); + default: + return 0; + } +} + +unsigned char get_uchar_element (int i) +{ + switch (i % 16) + { + case 0: return 0x90; + case 1: return 0x80; + case 2: return 0x70; + case 3: return 0x60; + case 4: return 0x50; + case 5: return 0x40; + case 6: return 0x30; + case 7: return 0x20; + case 8: return 0x10; + case 9: return 0xf0; + case 10: return 0xe0; + case 11: return 0xd0; + case 12: return 0xc0; + case 13: return 0xb0; + case 14: return 0xa0; + case 15: return 0xff; + } +} + +int check_ushort_element (int i, unsigned short entry) +{ + printf ("checking ushort entry 0x%x at index %d\n", entry, i); + switch (i % 8) + { + case 0: return (entry == 0x9988); + case 1: return (entry == 0x8877); + case 2: return (entry == 0x7766); + case 3: return (entry == 0x6655); + case 4: return (entry == 0x5544); + case 5: return (entry == 0x4433); + case 6: return (entry == 0x3322); + case 7: return (entry == 0x2211); + default: + return 0; + } +} + +unsigned short get_ushort_element (int i) +{ + switch (i % 8) + { + case 0: return 0x9988; + case 1: return 0x8877; + case 2: return 0x7766; + case 3: return 0x6655; + case 4: return 0x5544; + case 5: return 0x4433; + case 6: return 0x3322; + case 7: return 0x2211; + } +} + +vector unsigned __int128 +init_auto_uint128 (vector unsigned __int128 a) +{ + int i; + for (i = 0; i < 32; i += 3) + a = set_auto_n_uint128 (a, i, get_uint128_element (i)); + return a; +} + +void do_auto_uint128 (vector unsigned __int128 a) +{ + int i; + unsigned __int128 c; + for (i = 0; i < 32; i += 3) + { + c = get_auto_n_uint128 (a, i); + if (!check_uint128_element (i, c)) abort (); + } +} + +vector unsigned long long int +init_auto_ulong (vector unsigned long long int a) +{ + int i; + for (i = 0; i < 32; i += 3) + a = set_auto_n_ulong (a, i, get_ulong_element (i)); + return a; +} + +void do_auto_ulong (vector unsigned long long int a) +{ + int i; + unsigned long long int c; + for (i = 0; i < 32; i += 3) + { + c = get_auto_n_ulong (a, i); + if (!check_ulong_element (i, c)) abort (); + } + } + +vector unsigned int init_auto_uint (vector unsigned int a) +{ + int i; + for (i = 0; i < 32; i += 3) + a = set_auto_n_uint (a, i, get_uint_element (i)); + return a; +} + +void do_auto_uint (vector unsigned int a) +{ + int i; + unsigned int c; + for (i = 0; i < 32; i += 3) + { + c = get_auto_n_uint (a, i); + if (!check_uint_element (i, c)) abort (); + } + } + +vector unsigned short init_auto_ushort ( vector unsigned short a ) +{ + int i; + for (i = 0; i < 32; i += 3) + a = set_auto_n_ushort (a, i, get_ushort_element (i)); + return a; +} + +void do_auto_ushort (vector unsigned short a) +{ + int i; + unsigned short c; + for (i = 0; i < 32; i += 3) + { + c = get_auto_n_ushort (a, i); + if (!check_ushort_element (i, c)) abort (); + } +} + +vector unsigned char init_auto_uchar (vector unsigned char a) +{ + int i; + for (i = 0; i < 32; i += 3) + a = set_auto_n_uchar (a, i, get_uchar_element (i)); + return a; +} + +void do_auto_uchar (vector unsigned char a) +{ + int i; + unsigned char c; + for (i = 0; i < 32; i += 3) + { + c = get_auto_n_uchar (a, i); + if (!check_uchar_element (i, c)) abort (); + } +} + +int +main (void) +{ + size_t i; + + vector unsigned __int128 u = { 0 }; + vector unsigned __int128 du; + + vector unsigned long long int v = { 0, 0 }; + vector unsigned long long int dv; + + vector unsigned int x = { 0, 0, 0, 0 }; + vector unsigned int dx; + + vector unsigned char y = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + vector unsigned char dy; + + vector unsigned short z = { 0, 0, 0, 0, 0, 0, 0, 0 }; + vector unsigned short dz; + + du = init_auto_uint128 (u); + dv = init_auto_ulong (v); + dx = init_auto_uint (x); + dy = init_auto_uchar (y); + dz = init_auto_ushort (z); + + du = deoptimize_uint128 (du); + dv = deoptimize_ulong (dv); + dx = deoptimize_uint (dx); + dy = deoptimize_uchar (dy); + dz = deoptimize_ushort (dz); + + do_auto_uint128 (du); + do_auto_ulong (dv); + do_auto_uint (dx); + do_auto_uchar (dy); + do_auto_ushort (dz); + return 0; +} diff --git a/gcc/testsuite/gcc.target/powerpc/vsx-builtin-10c.c b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-10c.c new file mode 100644 index 00000000000..5ed6424d64f --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-10c.c @@ -0,0 +1,155 @@ +/* { dg-do run } */ +/* { dg-require-effective-target vmx_hw } */ +/* { dg-options "-maltivec" } */ + +/* This test should run the same on any target that supports altivec/vmx + instructions. Intentionally not specifying cpu in order to test + all code generation paths. */ + +#include + +extern void abort (void); + +#define CONST0 (0) +#define CONST1 (1) +#define CONST2 (2) +#define CONST3 (3) +#define CONST4 (4) +#define CONST5 (5) +#define CONST6 (6) +#define CONST7 (7) + + +/* Test that indices > length of vector are applied modulo the vector + length. */ + +/* Test for vector residing in register. */ +vector short s3 (vector short v, short x) +{ + return vec_insert (x, v, 3); +} + +vector short s7 (vector short v, short x) +{ + return vec_insert (x, v, 7); +} + +vector short s21 (vector short v, short x) +{ + return vec_insert (x, v, 21); +} + +vector short s30 (vector short v, short x) +{ + return vec_insert (x, v, 30); +} + +/* Test for vector residing in memory. */ +vector short ms3 (vector short *vp, short x) +{ + return vec_insert (x, *vp, 3); +} + +vector short ms7 (vector short *vp, short x) +{ + return vec_insert (x, *vp, 7); +} + +vector short ms21 (vector short *vp, short x) +{ + return vec_insert (x, *vp, 21); +} + +vector short ms30 (vector short *vp, short x) +{ + return vec_insert (x, *vp, 30); +} + +/* Test the same with variable indices. */ + +/* Test for variable selector and vector residing in register. */ +__attribute__((noinline)) +vector short ci (vector short v, int i, short x) +{ + return vec_insert (x, v, i); +} + +/* Test for variable selector and vector residing in memory. */ +__attribute__((noinline)) +vector short mci (vector short *vp, int i, short x) +{ + return vec_insert (x, *vp, i); +} + + +int main (int argc, short *argv[]) { + vector short sv = { + CONST0, CONST1, CONST2, CONST3, CONST4, CONST5, CONST6, CONST7 }; + short s; + + sv = s3 (sv, CONST6); + if (sv [3] != CONST6) + abort (); + + sv = s7 (sv, CONST4); + if (sv [7] != CONST4) + abort (); + + sv = s21 (sv, CONST3); + if (sv [5] != CONST3) + abort (); + + sv = s30 (sv, CONST2); + if (sv [6] != CONST2) + abort (); + + sv = ms3 (&sv, CONST5); + if (sv [3] != CONST5) + abort (); + + sv = ms7 (&sv, CONST1); + if (sv [7] != CONST1) + abort (); + + sv = ms21 (&sv, CONST2); + if (sv [5] != CONST2) + abort (); + + sv = ms30 (&sv, CONST0); + if (sv [6] != CONST0) + abort (); + + sv = ci (sv, 5, CONST6); + if (sv [5] != CONST6) + abort (); + + sv = ci (sv, 2, CONST4); + if (sv [2] != CONST4) + abort (); + + sv = ci (sv, 15, CONST3); + if (sv [7] != CONST3) + abort (); + + sv = ci (sv, 28, CONST3); + if (sv [4] != CONST3) + abort (); + + sv = mci (&sv, 5, CONST3); + if (sv [5] != CONST3) + abort (); + + sv = mci (&sv, 12, CONST7); + if (sv [4] != CONST7) + abort (); + + sv = mci (&sv, 25, CONST6); + if (sv [1] != CONST6) + abort (); + + sv = mci (&sv, 16, CONST5); + if (sv [0] != CONST5) + abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/powerpc/vsx-builtin-10d.c b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-10d.c new file mode 100644 index 00000000000..c9aaecad920 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-10d.c @@ -0,0 +1,155 @@ +/* { dg-do run } */ +/* { dg-require-effective-target vmx_hw } */ +/* { dg-options "-maltivec -O3" } */ + +/* This test should run the same on any target that supports altivec/vmx + instructions. Intentionally not specifying cpu in order to test + all code generation paths. */ + +#include + +extern void abort (void); + +#define CONST0 (0) +#define CONST1 (1) +#define CONST2 (2) +#define CONST3 (3) +#define CONST4 (4) +#define CONST5 (5) +#define CONST6 (6) +#define CONST7 (7) + + +/* Test that indices > length of vector are applied modulo the vector + length. */ + +/* Test for vector residing in register. */ +vector short s3 (vector short v, short x) +{ + return vec_insert (x, v, 3); +} + +vector short s7 (vector short v, short x) +{ + return vec_insert (x, v, 7); +} + +vector short s21 (vector short v, short x) +{ + return vec_insert (x, v, 21); +} + +vector short s30 (vector short v, short x) +{ + return vec_insert (x, v, 30); +} + +/* Test for vector residing in memory. */ +vector short ms3 (vector short *vp, short x) +{ + return vec_insert (x, *vp, 3); +} + +vector short ms7 (vector short *vp, short x) +{ + return vec_insert (x, *vp, 7); +} + +vector short ms21 (vector short *vp, short x) +{ + return vec_insert (x, *vp, 21); +} + +vector short ms30 (vector short *vp, short x) +{ + return vec_insert (x, *vp, 30); +} + +/* Test the same with variable indices. */ + +/* Test for variable selector and vector residing in register. */ +__attribute__((noinline)) +vector short ci (vector short v, int i, short x) +{ + return vec_insert (x, v, i); +} + +/* Test for variable selector and vector residing in memory. */ +__attribute__((noinline)) +vector short mci (vector short *vp, int i, short x) +{ + return vec_insert (x, *vp, i); +} + + +int main (int argc, short *argv[]) { + vector short sv = { + CONST0, CONST1, CONST2, CONST3, CONST4, CONST5, CONST6, CONST7 }; + short s; + + sv = s3 (sv, CONST6); + if (sv [3] != CONST6) + abort (); + + sv = s7 (sv, CONST4); + if (sv [7] != CONST4) + abort (); + + sv = s21 (sv, CONST3); + if (sv [5] != CONST3) + abort (); + + sv = s30 (sv, CONST2); + if (sv [6] != CONST2) + abort (); + + sv = ms3 (&sv, CONST5); + if (sv [3] != CONST5) + abort (); + + sv = ms7 (&sv, CONST1); + if (sv [7] != CONST1) + abort (); + + sv = ms21 (&sv, CONST2); + if (sv [5] != CONST2) + abort (); + + sv = ms30 (&sv, CONST0); + if (sv [6] != CONST0) + abort (); + + sv = ci (sv, 5, CONST6); + if (sv [5] != CONST6) + abort (); + + sv = ci (sv, 2, CONST4); + if (sv [2] != CONST4) + abort (); + + sv = ci (sv, 15, CONST3); + if (sv [7] != CONST3) + abort (); + + sv = ci (sv, 28, CONST3); + if (sv [4] != CONST3) + abort (); + + sv = mci (&sv, 5, CONST3); + if (sv [5] != CONST3) + abort (); + + sv = mci (&sv, 12, CONST7); + if (sv [4] != CONST7) + abort (); + + sv = mci (&sv, 25, CONST6); + if (sv [1] != CONST6) + abort (); + + sv = mci (&sv, 16, CONST5); + if (sv [0] != CONST5) + abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/powerpc/vsx-builtin-11c.c b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-11c.c new file mode 100644 index 00000000000..8e514aa2b1f --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-11c.c @@ -0,0 +1,149 @@ +/* { dg-do run } */ +/* { dg-require-effective-target vmx_hw } */ +/* { dg-options "-maltivec" } */ + +/* This test should run the same on any target that supports altivec/vmx + instructions. Intentionally not specifying cpu in order to test + all code generation paths. */ + +#include + +extern void abort (void); + +#define CONST0 (0) +#define CONST1 (1) +#define CONST2 (2) +#define CONST3 (3) + +/* Test that indices > length of vector are applied modulo the vector + length. */ + +/* Test for vector residing in register. */ +vector int s3 (vector int v, int x) +{ + return vec_insert (x, v, 3); +} + +vector int s1 (vector int v, int x) +{ + return vec_insert (x, v, 1); +} + +vector int s21 (vector int v, int x) +{ + return vec_insert (x, v, 21); +} + +vector int s30 (vector int v, int x) +{ + return vec_insert (x, v, 30); +} + +/* Test for vector residing in memory. */ +vector int ms3 (vector int *vp, int x) +{ + return vec_insert (x, *vp, 3); +} + +vector int ms1 (vector int *vp, int x) +{ + return vec_insert (x, *vp, 1); +} + +vector int ms21 (vector int *vp, int x) +{ + return vec_insert (x, *vp, 21); +} + +vector int ms30 (vector int *vp, int x) +{ + return vec_insert (x, *vp, 30); +} + +/* Test the same with variable indices. */ + +/* Test for variable selector and vector residing in register. */ +__attribute__((noinline)) +vector int ci (vector int v, int i, int x) +{ + return vec_insert (x, v, i); +} + +/* Test for variable selector and vector residing in memory. */ +__attribute__((noinline)) +vector int mci(vector int *vp, int i, int x) +{ + return vec_insert (x, *vp, i); +} + + +int main (int argc, int *argv[]) { + vector int sv = { CONST0, CONST1, CONST2, CONST3 }; + int s; + + sv = s3 (sv, CONST1); + if (sv [3] != CONST1) + abort (); + + sv = s1 (sv, CONST3); + if (sv [1] != CONST3) + abort (); + + sv = s21 (sv, CONST0); + if (sv [1] != CONST0) + abort (); + + sv = s30 (sv, CONST1); + if (sv [2] != CONST1) + abort (); + + sv = ms3 (&sv, CONST2); + if (sv [3] != CONST2) + abort (); + + sv = ms1 (&sv, CONST0); + if (sv [1] != CONST0) + abort (); + + sv = ms21 (&sv, CONST3); + if (sv [1] != CONST3) + abort (); + + sv = ms30 (&sv, CONST0); + if (sv [2] != CONST0) + abort (); + + sv = ci (sv, 5, CONST0); + if (sv [1] != CONST0) + abort (); + + sv = ci (sv, 2, CONST3); + if (sv [2] != CONST3) + abort (); + + sv = ci (sv, 15, CONST1); + if (sv [3] != CONST1) + abort (); + + sv = ci (sv, 28, CONST3); + if (sv [0] != CONST3) + abort (); + + sv = mci (&sv, 5, CONST2); + if (sv [1] != CONST2) + abort (); + + sv = mci (&sv, 12, CONST1); + if (sv [0] != CONST1) + abort (); + + sv = mci (&sv, 25, CONST2); + if (sv [1] != CONST2) + abort (); + + sv = mci (&sv, 16, CONST3); + if (sv [0] != CONST3) + abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/powerpc/vsx-builtin-11d.c b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-11d.c new file mode 100644 index 00000000000..116802aeece --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-11d.c @@ -0,0 +1,149 @@ +/* { dg-do run } */ +/* { dg-require-effective-target vmx_hw } */ +/* { dg-options "-maltivec -O3" } */ + +/* This test should run the same on any target that supports altivec/vmx + instructions. Intentionally not specifying cpu in order to test + all code generation paths. */ + +#include + +extern void abort (void); + +#define CONST0 (0) +#define CONST1 (1) +#define CONST2 (2) +#define CONST3 (3) + +/* Test that indices > length of vector are applied modulo the vector + length. */ + +/* Test for vector residing in register. */ +vector int s3 (vector int v, int x) +{ + return vec_insert (x, v, 3); +} + +vector int s1 (vector int v, int x) +{ + return vec_insert (x, v, 1); +} + +vector int s21 (vector int v, int x) +{ + return vec_insert (x, v, 21); +} + +vector int s30 (vector int v, int x) +{ + return vec_insert (x, v, 30); +} + +/* Test for vector residing in memory. */ +vector int ms3 (vector int *vp, int x) +{ + return vec_insert (x, *vp, 3); +} + +vector int ms1 (vector int *vp, int x) +{ + return vec_insert (x, *vp, 1); +} + +vector int ms21 (vector int *vp, int x) +{ + return vec_insert (x, *vp, 21); +} + +vector int ms30 (vector int *vp, int x) +{ + return vec_insert (x, *vp, 30); +} + +/* Test the same with variable indices. */ + +/* Test for variable selector and vector residing in register. */ +__attribute__((noinline)) +vector int ci (vector int v, int i, int x) +{ + return vec_insert (x, v, i); +} + +/* Test for variable selector and vector residing in memory. */ +__attribute__((noinline)) +vector int mci(vector int *vp, int i, int x) +{ + return vec_insert (x, *vp, i); +} + + +int main (int argc, int *argv[]) { + vector int sv = { CONST0, CONST1, CONST2, CONST3 }; + int s; + + sv = s3 (sv, CONST1); + if (sv [3] != CONST1) + abort (); + + sv = s1 (sv, CONST3); + if (sv [1] != CONST3) + abort (); + + sv = s21 (sv, CONST0); + if (sv [1] != CONST0) + abort (); + + sv = s30 (sv, CONST1); + if (sv [2] != CONST1) + abort (); + + sv = ms3 (&sv, CONST2); + if (sv [3] != CONST2) + abort (); + + sv = ms1 (&sv, CONST0); + if (sv [1] != CONST0) + abort (); + + sv = ms21 (&sv, CONST3); + if (sv [1] != CONST3) + abort (); + + sv = ms30 (&sv, CONST0); + if (sv [2] != CONST0) + abort (); + + sv = ci (sv, 5, CONST0); + if (sv [1] != CONST0) + abort (); + + sv = ci (sv, 2, CONST3); + if (sv [2] != CONST3) + abort (); + + sv = ci (sv, 15, CONST1); + if (sv [3] != CONST1) + abort (); + + sv = ci (sv, 28, CONST3); + if (sv [0] != CONST3) + abort (); + + sv = mci (&sv, 5, CONST2); + if (sv [1] != CONST2) + abort (); + + sv = mci (&sv, 12, CONST1); + if (sv [0] != CONST1) + abort (); + + sv = mci (&sv, 25, CONST2); + if (sv [1] != CONST2) + abort (); + + sv = mci (&sv, 16, CONST3); + if (sv [0] != CONST3) + abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/powerpc/vsx-builtin-12c.c b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-12c.c new file mode 100644 index 00000000000..1e57bc46cdd --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-12c.c @@ -0,0 +1,112 @@ +/* { dg-do run { target int128 } } */ +/* { dg-require-effective-target vsx_hw } */ +/* { dg-options "-mvsx" } */ + +/* This test should run the same on any target that supports vsx + instructions. Intentionally not specifying cpu in order to test + all code generation paths. */ + +#include + +extern void abort (void); + +#define CONST0 (31415926539LL) +#define CONST1 (2 * 31415926539LL) +#define CONST2 (3 * 31415926539LL) +#define CONST3 (4 * 31415926539LL) + +/* Test that indices > length of vector are applied modulo the vector + length. */ + +/* Test for vector residing in register. */ +vector long long int e0 (vector long long int v, long long int x) +{ + return vec_insert (x, v, 0); +} + +vector long long int e3 (vector long long int v, long long int x) +{ + return vec_insert (x, v, 3); +} + +/* Test for vector residing in memory. */ +vector long long int me0 (vector long long int *vp, long long int x) +{ + return vec_insert (x, *vp, 0); +} + +vector long long int me3 (vector long long int *vp, long long int x) +{ + return vec_insert (x, *vp, 3); +} + +/* Test the same with variable indices. */ + +/* Test for variable selector and vector residing in register. */ +__attribute__((noinline)) +vector long long int ei (vector long long int v, int i, long long int x) +{ + return vec_insert (x, v, i); +} + +/* Test for variable selector and vector residing in memory. */ +__attribute__((noinline)) +vector long long int mei (vector long long int *vp, int i, long long int x) +{ + return vec_insert (x, *vp, i); +} + +int main (int argc, char *argv[]) { + vector long long int dv = { CONST0, CONST1 }; + long long int d; + + dv = e0 (dv, CONST3); + if (dv [0] != CONST3) + abort (); + + dv = e3 (dv, CONST0); + if (dv [1] != CONST0) + abort (); + + dv = me0 (&dv, CONST1); + if (dv [0] != CONST1) + abort (); + + dv = me3 (&dv, CONST2); + if (dv [1] != CONST2) + abort (); + + dv = ei (dv, 0, CONST3); + if (dv [0] != CONST3) + abort (); + + dv = ei (dv, 1, CONST2); + if (dv [1] != CONST2) + abort (); + + dv = ei (dv, 2, CONST1); + if (dv [0] != CONST1) + abort (); + + dv = ei (dv, 3, CONST3); + if (dv [1] != CONST3) + abort (); + + dv = mei (&dv, 0, CONST1); + if (dv [0] != CONST1) + abort (); + + dv = mei (&dv, 1, CONST0); + if (dv [1] != CONST0) + abort (); + + dv = mei (&dv, 2, CONST1); + if (dv [0] != CONST1) + abort (); + + dv = mei (&dv, 3, CONST2); + if (dv [1] != CONST2) + abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/powerpc/vsx-builtin-12d.c b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-12d.c new file mode 100644 index 00000000000..3bf06085fb5 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-12d.c @@ -0,0 +1,112 @@ +/* { dg-do run { target int128 } } */ +/* { dg-require-effective-target vsx_hw } */ +/* { dg-options "-mvsx -O3" } */ + +/* This test should run the same on any target that supports vsx + instructions. Intentionally not specifying cpu in order to test + all code generation paths. */ + +#include + +extern void abort (void); + +#define CONST0 (31415926539LL) +#define CONST1 (2 * 31415926539LL) +#define CONST2 (3 * 31415926539LL) +#define CONST3 (4 * 31415926539LL) + +/* Test that indices > length of vector are applied modulo the vector + length. */ + +/* Test for vector residing in register. */ +vector long long int e0 (vector long long int v, long long int x) +{ + return vec_insert (x, v, 0); +} + +vector long long int e3 (vector long long int v, long long int x) +{ + return vec_insert (x, v, 3); +} + +/* Test for vector residing in memory. */ +vector long long int me0 (vector long long int *vp, long long int x) +{ + return vec_insert (x, *vp, 0); +} + +vector long long int me3 (vector long long int *vp, long long int x) +{ + return vec_insert (x, *vp, 3); +} + +/* Test the same with variable indices. */ + +/* Test for variable selector and vector residing in register. */ +__attribute__((noinline)) +vector long long int ei (vector long long int v, int i, long long int x) +{ + return vec_insert (x, v, i); +} + +/* Test for variable selector and vector residing in memory. */ +__attribute__((noinline)) +vector long long int mei (vector long long int *vp, int i, long long int x) +{ + return vec_insert (x, *vp, i); +} + +int main (int argc, char *argv[]) { + vector long long int dv = { CONST0, CONST1 }; + long long int d; + + dv = e0 (dv, CONST3); + if (dv [0] != CONST3) + abort (); + + dv = e3 (dv, CONST0); + if (dv [1] != CONST0) + abort (); + + dv = me0 (&dv, CONST1); + if (dv [0] != CONST1) + abort (); + + dv = me3 (&dv, CONST2); + if (dv [1] != CONST2) + abort (); + + dv = ei (dv, 0, CONST3); + if (dv [0] != CONST3) + abort (); + + dv = ei (dv, 1, CONST2); + if (dv [1] != CONST2) + abort (); + + dv = ei (dv, 2, CONST1); + if (dv [0] != CONST1) + abort (); + + dv = ei (dv, 3, CONST3); + if (dv [1] != CONST3) + abort (); + + dv = mei (&dv, 0, CONST1); + if (dv [0] != CONST1) + abort (); + + dv = mei (&dv, 1, CONST0); + if (dv [1] != CONST0) + abort (); + + dv = mei (&dv, 2, CONST1); + if (dv [0] != CONST1) + abort (); + + dv = mei (&dv, 3, CONST2); + if (dv [1] != CONST2) + abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/powerpc/vsx-builtin-13c.c b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-13c.c new file mode 100644 index 00000000000..43c6bed7695 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-13c.c @@ -0,0 +1,115 @@ +/* { dg-do run { target int128 } } */ +/* { dg-require-effective-target vsx_hw } */ +/* { dg-options "-mvsx" } */ + +/* This test should run the same on any target that supports vsx + instructions. Intentionally not specifying cpu in order to test + all code generation paths. */ + +#include + +#define SIGNED signed + +extern void abort (void); + +#define CONST0 (((SIGNED __int128) 31415926539) << 60) +#define CONST1 (((SIGNED __int128) 31415926539) << 55) +#define CONST2 (((SIGNED __int128) 31415926539) << 50) +#define CONST3 (((SIGNED __int128) 31415926539) << 45) + +/* Test that indices > length of vector are applied modulo the vector + length. */ + +/* Test for vector residing in register. */ +vector SIGNED __int128 e0 (vector SIGNED __int128 v, SIGNED __int128 x) +{ + return vec_insert (x, v, 0); +} + +vector SIGNED __int128 e3 (vector SIGNED __int128 v, SIGNED __int128 x) +{ + return vec_insert (x, v, 3); +} + +/* Test for vector residing in memory. */ +vector SIGNED __int128 me0 (vector SIGNED __int128 *vp, SIGNED __int128 x) +{ + return vec_insert (x, *vp, 0); +} + +vector SIGNED __int128 me3 (vector SIGNED __int128 *vp, SIGNED __int128 x) +{ + return vec_insert (x, *vp, 3); +} + +/* Test the same with variable indices. */ + +/* Test for variable selector and vector residing in register. */ +__attribute__((noinline)) +vector SIGNED __int128 +ei (vector SIGNED __int128 v, int i, SIGNED __int128 x) +{ + return vec_insert (x, v, i); +} + +/* Test for variable selector and vector residing in memory. */ +__attribute__((noinline)) +vector SIGNED __int128 +mei (vector SIGNED __int128 *vp, int i, SIGNED __int128 x) +{ + return vec_insert (x, *vp, i); +} + +int main (int argc, char *argv[]) { + vector SIGNED __int128 dv = { CONST0 }; + SIGNED __int128 d; + + dv = e0 (dv, CONST3); + if (dv [0] != CONST3) + abort (); + + dv = e3 (dv, CONST1); + if (dv [0] != CONST1) + abort (); + + dv = me0 (&dv, CONST2); + if (dv [0] != CONST2) + abort (); + + dv = me3 (&dv, CONST3); + if (dv [0] != CONST3) + abort (); + + dv = ei (dv, 0, CONST1); + if (dv [0] != CONST1) + abort (); + + dv = ei (dv, 1, CONST2); + if (dv [0] != CONST2) + abort (); + + dv = ei (dv, 2, CONST3); + if (dv [0] != CONST3) + abort (); + + dv = ei (dv, 3, CONST1); + if (dv [0] != CONST1) + abort (); + + dv = mei (&dv, 0, CONST2); + if (dv [0] != CONST2) + abort (); + + dv = mei (&dv, 1, CONST3); + if (dv [0] != CONST3) + abort (); + + dv = mei (&dv, 2, CONST1); + if (dv [0] != CONST1) + abort (); + + dv = mei (&dv, 3, CONST2); + if (dv [0] != CONST2) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.target/powerpc/vsx-builtin-13d.c b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-13d.c new file mode 100644 index 00000000000..257de552e64 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-13d.c @@ -0,0 +1,115 @@ +/* { dg-do run { target int128 } } */ +/* { dg-require-effective-target vsx_hw } */ +/* { dg-options "-mvsx -O3" } */ + +/* This test should run the same on any target that supports vsx + instructions. Intentionally not specifying cpu in order to test + all code generation paths. */ + +#include + +#define SIGNED signed + +extern void abort (void); + +#define CONST0 (((SIGNED __int128) 31415926539) << 60) +#define CONST1 (((SIGNED __int128) 31415926539) << 55) +#define CONST2 (((SIGNED __int128) 31415926539) << 50) +#define CONST3 (((SIGNED __int128) 31415926539) << 45) + +/* Test that indices > length of vector are applied modulo the vector + length. */ + +/* Test for vector residing in register. */ +vector SIGNED __int128 e0 (vector SIGNED __int128 v, SIGNED __int128 x) +{ + return vec_insert (x, v, 0); +} + +vector SIGNED __int128 e3 (vector SIGNED __int128 v, SIGNED __int128 x) +{ + return vec_insert (x, v, 3); +} + +/* Test for vector residing in memory. */ +vector SIGNED __int128 me0 (vector SIGNED __int128 *vp, SIGNED __int128 x) +{ + return vec_insert (x, *vp, 0); +} + +vector SIGNED __int128 me3 (vector SIGNED __int128 *vp, SIGNED __int128 x) +{ + return vec_insert (x, *vp, 3); +} + +/* Test the same with variable indices. */ + +/* Test for variable selector and vector residing in register. */ +__attribute__((noinline)) +vector SIGNED __int128 +ei (vector SIGNED __int128 v, int i, SIGNED __int128 x) +{ + return vec_insert (x, v, i); +} + +/* Test for variable selector and vector residing in memory. */ +__attribute__((noinline)) +vector SIGNED __int128 +mei (vector SIGNED __int128 *vp, int i, SIGNED __int128 x) +{ + return vec_insert (x, *vp, i); +} + +int main (int argc, char *argv[]) { + vector SIGNED __int128 dv = { CONST0 }; + SIGNED __int128 d; + + dv = e0 (dv, CONST3); + if (dv [0] != CONST3) + abort (); + + dv = e3 (dv, CONST1); + if (dv [0] != CONST1) + abort (); + + dv = me0 (&dv, CONST2); + if (dv [0] != CONST2) + abort (); + + dv = me3 (&dv, CONST3); + if (dv [0] != CONST3) + abort (); + + dv = ei (dv, 0, CONST1); + if (dv [0] != CONST1) + abort (); + + dv = ei (dv, 1, CONST2); + if (dv [0] != CONST2) + abort (); + + dv = ei (dv, 2, CONST3); + if (dv [0] != CONST3) + abort (); + + dv = ei (dv, 3, CONST1); + if (dv [0] != CONST1) + abort (); + + dv = mei (&dv, 0, CONST2); + if (dv [0] != CONST2) + abort (); + + dv = mei (&dv, 1, CONST3); + if (dv [0] != CONST3) + abort (); + + dv = mei (&dv, 2, CONST1); + if (dv [0] != CONST1) + abort (); + + dv = mei (&dv, 3, CONST2); + if (dv [0] != CONST2) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.target/powerpc/vsx-builtin-14c.c b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-14c.c new file mode 100644 index 00000000000..5ba4bd59eb3 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-14c.c @@ -0,0 +1,149 @@ +/* { dg-do run } */ +/* { dg-require-effective-target vmx_hw } */ +/* { dg-options "-maltivec" } */ + +/* This test should run the same on any target that supports altivec/vmx + instructions. Intentionally not specifying cpu in order to test + all code generation paths. */ + +#include + +extern void abort (void); + +#define CONST0 ((float) (3.1415926539)) +#define CONST1 ((float) (3.1415926539 * 2)) +#define CONST2 ((float) (3.1415926539 * 3)) +#define CONST3 ((float) (3.1415926539 * 4)) + +/* Test that indices > length of vector are applied modulo the vector + length. */ + +/* Test for vector residing in register. */ +vector float e0(vector float v, float x) +{ + return vec_insert (x, v, 0); +} + +vector float e1(vector float v, float x) +{ + return vec_insert (x, v, 1); +} + +vector float e7(vector float v, float x) +{ + return vec_insert (x, v, 7); +} + +vector float e8(vector float v, float x) +{ + return vec_insert (x, v, 8); +} + +/* Test for vector residing in memory. */ +vector float me0(vector float *vp, float x) +{ + return vec_insert (x, *vp, 0); +} + +vector float me1(vector float *vp, float x) +{ + return vec_insert (x, *vp, 1); +} + +vector float me13(vector float *vp, float x) +{ + return vec_insert (x, *vp, 13); +} + +vector float me15(vector float *vp, float x) +{ + return vec_insert (x, *vp, 15); +} + +/* Test the same with variable indices. */ + +/* Test for variable selector and vector residing in register. */ +__attribute__((noinline)) +vector float ei(vector float v, int i, float x) +{ + return vec_insert (x, v, i); +} + +/* Test for variable selector and vector residing in memory. */ +__attribute__((noinline)) +vector float mei(vector float *vp, int i, float x) +{ + return vec_insert (x, *vp, i); +} + + +int main (int argc, char *argv[]) { + vector float dv = { CONST0, CONST1, CONST2, CONST3 }; + float d; + + dv = e0 (dv, CONST3); + if (dv [0] != CONST3) + abort (); + + dv = e1 (dv, CONST0); + if (dv [1] != CONST0) + abort (); + + dv = e7 (dv, CONST2); + if (dv [3] != CONST2) + abort (); + + dv = e8 (dv, CONST1); + if (dv [0] != CONST1) + abort (); + + dv = me0 (&dv, CONST2); + if (dv [0] != CONST2) + abort (); + + dv = me1 (&dv, CONST3); + if (dv [1] != CONST3) + abort (); + + dv = me13 (&dv, CONST2); + if (dv [1] != CONST2) + abort (); + + dv = me15 (&dv, CONST1); + if (dv [3] != CONST1) + abort (); + + dv = ei (dv, 0, CONST3); + if (dv [0] != CONST3) + abort (); + + dv = ei (dv, 2, CONST1); + if (dv [2] != CONST1) + abort (); + + dv = ei (dv, 11, CONST0); + if (dv [3] != CONST0) + abort (); + + dv = ei (dv, 17, CONST2); + if (dv [1] != CONST2) + abort (); + + dv = mei (&dv, 0, CONST1); + if (dv [0] != CONST1) + abort (); + + dv = mei (&dv, 1, CONST0); + if (dv [1] != CONST0) + abort (); + + dv = mei (&dv, 15, CONST1); + if (dv [3] != CONST1) + abort (); + + dv = mei (&dv, 6, CONST0); + if (dv [2] != CONST0) + abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/powerpc/vsx-builtin-14d.c b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-14d.c new file mode 100644 index 00000000000..63784a2e220 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-14d.c @@ -0,0 +1,149 @@ +/* { dg-do run } */ +/* { dg-require-effective-target vmx_hw } */ +/* { dg-options "-maltivec -O3" } */ + +/* This test should run the same on any target that supports altivec/vmx + instructions. Intentionally not specifying cpu in order to test + all code generation paths. */ + +#include + +extern void abort (void); + +#define CONST0 ((float) (3.1415926539)) +#define CONST1 ((float) (3.1415926539 * 2)) +#define CONST2 ((float) (3.1415926539 * 3)) +#define CONST3 ((float) (3.1415926539 * 4)) + +/* Test that indices > length of vector are applied modulo the vector + length. */ + +/* Test for vector residing in register. */ +vector float e0(vector float v, float x) +{ + return vec_insert (x, v, 0); +} + +vector float e1(vector float v, float x) +{ + return vec_insert (x, v, 1); +} + +vector float e7(vector float v, float x) +{ + return vec_insert (x, v, 7); +} + +vector float e8(vector float v, float x) +{ + return vec_insert (x, v, 8); +} + +/* Test for vector residing in memory. */ +vector float me0(vector float *vp, float x) +{ + return vec_insert (x, *vp, 0); +} + +vector float me1(vector float *vp, float x) +{ + return vec_insert (x, *vp, 1); +} + +vector float me13(vector float *vp, float x) +{ + return vec_insert (x, *vp, 13); +} + +vector float me15(vector float *vp, float x) +{ + return vec_insert (x, *vp, 15); +} + +/* Test the same with variable indices. */ + +/* Test for variable selector and vector residing in register. */ +__attribute__((noinline)) +vector float ei(vector float v, int i, float x) +{ + return vec_insert (x, v, i); +} + +/* Test for variable selector and vector residing in memory. */ +__attribute__((noinline)) +vector float mei(vector float *vp, int i, float x) +{ + return vec_insert (x, *vp, i); +} + + +int main (int argc, char *argv[]) { + vector float dv = { CONST0, CONST1, CONST2, CONST3 }; + float d; + + dv = e0 (dv, CONST3); + if (dv [0] != CONST3) + abort (); + + dv = e1 (dv, CONST0); + if (dv [1] != CONST0) + abort (); + + dv = e7 (dv, CONST2); + if (dv [3] != CONST2) + abort (); + + dv = e8 (dv, CONST1); + if (dv [0] != CONST1) + abort (); + + dv = me0 (&dv, CONST2); + if (dv [0] != CONST2) + abort (); + + dv = me1 (&dv, CONST3); + if (dv [1] != CONST3) + abort (); + + dv = me13 (&dv, CONST2); + if (dv [1] != CONST2) + abort (); + + dv = me15 (&dv, CONST1); + if (dv [3] != CONST1) + abort (); + + dv = ei (dv, 0, CONST3); + if (dv [0] != CONST3) + abort (); + + dv = ei (dv, 2, CONST1); + if (dv [2] != CONST1) + abort (); + + dv = ei (dv, 11, CONST0); + if (dv [3] != CONST0) + abort (); + + dv = ei (dv, 17, CONST2); + if (dv [1] != CONST2) + abort (); + + dv = mei (&dv, 0, CONST1); + if (dv [0] != CONST1) + abort (); + + dv = mei (&dv, 1, CONST0); + if (dv [1] != CONST0) + abort (); + + dv = mei (&dv, 15, CONST1); + if (dv [3] != CONST1) + abort (); + + dv = mei (&dv, 6, CONST0); + if (dv [2] != CONST0) + abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/powerpc/vsx-builtin-15c.c b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-15c.c new file mode 100644 index 00000000000..1a23191e253 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-15c.c @@ -0,0 +1,151 @@ +/* { dg-do run { target int128 } } */ +/* { dg-require-effective-target vsx_hw } */ +/* { dg-options "-mvsx" } */ + +/* This test should run the same on any target that supports vsx + instructions. Intentionally not specifying cpu in order to test + all code generation paths. */ + +#include + +extern void abort (void); + +#define CONST0 (3.1415926539) +#define CONST1 (3.1415926539 * 2) +#define CONST2 (3.1415926539 * 3) +#define CONST3 (3.1415926539 * 4) + + +/* Test that indices > length of vector are applied modulo the vector + length. */ + +/* Test for vector residing in register. */ +vector double e0(vector double v, double x) +{ + return vec_insert (x, v, 0); +} + +vector double e1(vector double v, double x) +{ + return vec_insert (x, v, 1); +} + +vector double e2(vector double v, double x) +{ + return vec_insert (x, v, 2); +} + +vector double e3(vector double v, double x) +{ + return vec_insert (x, v, 3); +} + +/* Test for vector residing in memory. */ +vector double me0(vector double *vp, double x) +{ + return vec_insert (x, *vp, 0); +} + +vector double me1(vector double *vp, double x) +{ + return vec_insert (x, *vp, 1); +} + +vector double me2(vector double *vp, double x) +{ + return vec_insert (x, *vp, 2); +} + +vector double me3(vector double *vp, double x) +{ + return vec_insert (x, *vp, 3); +} + +/* Test the same with variable indices. */ + +/* Test for variable selector and vector residing in register. */ +__attribute__((noinline)) +vector double ei(vector double v, int i, double x) +{ + return vec_insert (x, v, i); +} + +/* Test for variable selector and vector residing in memory. */ +__attribute__((noinline)) +vector double mei(vector double *vp, int i, double x) +{ + return vec_insert (x, *vp, i); +} + +int main (int argc, char *argv[]) { + vector double dv; + double d; + dv[0] = CONST0; + dv[1] = CONST1; + + dv = e0 (dv, CONST3); + if (dv [0] != CONST3) + abort (); + + dv = e1 (dv, CONST2); + if (dv [1] != CONST2) + abort (); + + dv = e2 (dv, CONST1); + if (dv [0] != CONST1) + abort (); + + dv = e3 (dv, CONST0); + if (dv [1] != CONST0) + abort (); + + dv = me0 (&dv, CONST2); + if (dv [0] != CONST2) + abort (); + + dv = me1 (&dv, CONST3); + if (dv [1] != CONST3) + abort (); + + dv = me2 (&dv, CONST1); + if (dv [0] != CONST1) + abort (); + + dv = me3 (&dv, CONST0); + if (dv [1] != CONST0) + abort (); + + dv = ei (dv, 0, CONST1); + if (dv [0] != CONST1) + abort (); + + dv = ei (dv, 1, CONST0); + if (dv [1] != CONST0) + abort (); + + dv = ei (dv, 2, CONST3); + if (dv [0] != CONST3) + abort (); + + dv = ei (dv, 3, CONST2); + if (dv [1] != CONST2) + abort (); + + dv = mei (&dv, 0, CONST1); + if (dv [0] != CONST1) + abort (); + + dv = mei (&dv, 1, CONST0); + if (dv [1] != CONST0) + abort (); + + dv = mei (&dv, 2, CONST2); + if (dv [0] != CONST2) + abort (); + + dv = mei (&dv, 3, CONST3); + if (dv [1] != CONST3) + abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/powerpc/vsx-builtin-15d.c b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-15d.c new file mode 100644 index 00000000000..71f200d831b --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-15d.c @@ -0,0 +1,151 @@ +/* { dg-do run { target int128 } } */ +/* { dg-require-effective-target vsx_hw } */ +/* { dg-options "-mvsx -O3" } */ + +/* This test should run the same on any target that supports vsx + instructions. Intentionally not specifying cpu in order to test + all code generation paths. */ + +#include + +extern void abort (void); + +#define CONST0 (3.1415926539) +#define CONST1 (3.1415926539 * 2) +#define CONST2 (3.1415926539 * 3) +#define CONST3 (3.1415926539 * 4) + + +/* Test that indices > length of vector are applied modulo the vector + length. */ + +/* Test for vector residing in register. */ +vector double e0(vector double v, double x) +{ + return vec_insert (x, v, 0); +} + +vector double e1(vector double v, double x) +{ + return vec_insert (x, v, 1); +} + +vector double e2(vector double v, double x) +{ + return vec_insert (x, v, 2); +} + +vector double e3(vector double v, double x) +{ + return vec_insert (x, v, 3); +} + +/* Test for vector residing in memory. */ +vector double me0(vector double *vp, double x) +{ + return vec_insert (x, *vp, 0); +} + +vector double me1(vector double *vp, double x) +{ + return vec_insert (x, *vp, 1); +} + +vector double me2(vector double *vp, double x) +{ + return vec_insert (x, *vp, 2); +} + +vector double me3(vector double *vp, double x) +{ + return vec_insert (x, *vp, 3); +} + +/* Test the same with variable indices. */ + +/* Test for variable selector and vector residing in register. */ +__attribute__((noinline)) +vector double ei(vector double v, int i, double x) +{ + return vec_insert (x, v, i); +} + +/* Test for variable selector and vector residing in memory. */ +__attribute__((noinline)) +vector double mei(vector double *vp, int i, double x) +{ + return vec_insert (x, *vp, i); +} + +int main (int argc, char *argv[]) { + vector double dv; + double d; + dv[0] = CONST0; + dv[1] = CONST1; + + dv = e0 (dv, CONST3); + if (dv [0] != CONST3) + abort (); + + dv = e1 (dv, CONST2); + if (dv [1] != CONST2) + abort (); + + dv = e2 (dv, CONST1); + if (dv [0] != CONST1) + abort (); + + dv = e3 (dv, CONST0); + if (dv [1] != CONST0) + abort (); + + dv = me0 (&dv, CONST2); + if (dv [0] != CONST2) + abort (); + + dv = me1 (&dv, CONST3); + if (dv [1] != CONST3) + abort (); + + dv = me2 (&dv, CONST1); + if (dv [0] != CONST1) + abort (); + + dv = me3 (&dv, CONST0); + if (dv [1] != CONST0) + abort (); + + dv = ei (dv, 0, CONST1); + if (dv [0] != CONST1) + abort (); + + dv = ei (dv, 1, CONST0); + if (dv [1] != CONST0) + abort (); + + dv = ei (dv, 2, CONST3); + if (dv [0] != CONST3) + abort (); + + dv = ei (dv, 3, CONST2); + if (dv [1] != CONST2) + abort (); + + dv = mei (&dv, 0, CONST1); + if (dv [0] != CONST1) + abort (); + + dv = mei (&dv, 1, CONST0); + if (dv [1] != CONST0) + abort (); + + dv = mei (&dv, 2, CONST2); + if (dv [0] != CONST2) + abort (); + + dv = mei (&dv, 3, CONST3); + if (dv [1] != CONST3) + abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/powerpc/vsx-builtin-16c.c b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-16c.c new file mode 100644 index 00000000000..eea4d406230 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-16c.c @@ -0,0 +1,180 @@ +/* { dg-do run } */ +/* { dg-require-effective-target vmx_hw } */ +/* { dg-options "-maltivec" } */ + +/* This test should run the same on any target that supports altivec/vmx + instructions. Intentionally not specifying cpu in order to test + all code generation paths. */ + +#include +#include + +extern void abort (void); + +#define CONST0 (0) +#define CONST1 (1) +#define CONST2 (2) +#define CONST3 (3) +#define CONST4 (4) +#define CONST5 (5) +#define CONST6 (6) +#define CONST7 (7) +#define CONST8 (8) +#define CONST9 (9) +#define CONSTA (10) +#define CONSTB (11) +#define CONSTC (12) +#define CONSTD (13) +#define CONSTE (14) +#define CONSTF (15) + + +/* Test that indices > length of vector are applied modulo the vector + length. */ + +/* Test for vector residing in register. */ +vector unsigned char c0 (vector unsigned char v, unsigned char x) +{ + return vec_insert (x, v, 0); +} + +vector unsigned char c9 (vector unsigned char v, unsigned char x) +{ + return vec_insert (x, v, 9); +} + +vector unsigned char c21 (vector unsigned char v, unsigned char x) +{ + return vec_insert (x, v, 21); +} + +vector unsigned char c30 (vector unsigned char v, unsigned char x) +{ + return vec_insert (x, v, 30); +} + +/* Test for vector residing in memory. */ +vector unsigned char mc0 (vector unsigned char *vp, unsigned char x) +{ + return vec_insert (x, *vp, 0); +} + +vector unsigned char mc9 (vector unsigned char *vp, unsigned char x) +{ + return vec_insert (x, *vp, 9); +} + +vector unsigned char mc21 (vector unsigned char *vp, unsigned char x) +{ + return vec_insert (x, *vp, 21); +} + +vector unsigned char mc30 (vector unsigned char *vp, unsigned char x) +{ + return vec_insert (x, *vp, 30); +} + +/* Test the same with variable indices. */ + +/* Test for variable selector and vector residing in register. */ +__attribute__((noinline)) +vector unsigned char ci (vector unsigned char v, int i, unsigned char x) +{ + return vec_insert (x, v, i); +} + +/* Test for variable selector and vector residing in memory. */ +__attribute__((noinline)) +vector unsigned char mci (vector unsigned char *vp, int i, unsigned char x) +{ + return vec_insert (x, *vp, i); +} + + +int main (int argc, char *argv[]) { + vector unsigned char cv = { CONST0, CONST1, CONST2, CONST3, + CONST4, CONST5, CONST6, CONST7, + CONST8, CONST9, CONSTA, CONSTB, + CONSTC, CONSTD, CONSTE, CONSTF }; + printf ("A\n"); + cv = c0 (cv, CONST3); + if (cv [0] != CONST3) + abort (); + + printf ("B\n"); + cv = c9 (cv, CONST2); + if (cv [9] != CONST2) + abort (); + + printf ("C\n"); + cv = c21 (cv, CONSTF); + if (cv [5] != CONSTF) + abort (); + + printf ("D\n"); + cv = c30 (cv, CONST3); + if (cv [14] != CONST3) + abort (); + + printf ("E\n"); + cv = mc0 (&cv, CONST4); + if (cv [0] != CONST4) + abort (); + + printf ("F\n"); + cv = mc9 (&cv, CONST3); + if (cv [9] != CONST3) + abort (); + + printf ("G\n"); + cv = mc21 (&cv, CONST1); + if (cv [5] != CONST1) + abort (); + + printf ("H\n"); + cv = mc30 (&cv, CONSTC); + if (cv [14] != CONSTC) + abort (); + + printf ("I\n"); + cv = ci (cv, 8, CONSTD); + if (cv [8] != CONSTD) + abort (); + + printf ("J\n"); + cv = ci (cv, 13, CONST5); + if (cv [13] != CONST5) + abort (); + + printf ("K\n"); + cv = ci (cv, 23, CONST6); + if (cv [7] != CONST6) + abort (); + + printf ("L\n"); + cv = ci (cv, 31, CONST7); + if (cv [15] != CONST7) + abort (); + + printf ("M\n"); + cv = mci (&cv, 5, CONST8); + if (cv [5] != CONST8) + abort (); + + printf ("N\n"); + cv = mci (&cv, 12, CONST9); + if (cv [12] != CONST9) + abort (); + + printf ("O\n"); + cv = mci (&cv, 25, CONSTA); + if (cv [9] != CONSTA) + abort (); + + printf ("P\n"); + cv = mci (&cv, 16, CONSTB); + if (cv [0] != CONSTB) + abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/powerpc/vsx-builtin-16d.c b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-16d.c new file mode 100644 index 00000000000..f899e57f2d4 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-16d.c @@ -0,0 +1,163 @@ +/* { dg-do run } */ +/* { dg-require-effective-target vmx_hw } */ +/* { dg-options "-maltivec -O3" } */ + +/* This test should run the same on any target that supports altivec/vmx + instructions. Intentionally not specifying cpu in order to test + all code generation paths. */ + +#include + +extern void abort (void); + +#define CONST0 (0) +#define CONST1 (1) +#define CONST2 (2) +#define CONST3 (3) +#define CONST4 (4) +#define CONST5 (5) +#define CONST6 (6) +#define CONST7 (7) +#define CONST8 (8) +#define CONST9 (9) +#define CONSTA (10) +#define CONSTB (11) +#define CONSTC (12) +#define CONSTD (13) +#define CONSTE (14) +#define CONSTF (15) + + +/* Test that indices > length of vector are applied modulo the vector + length. */ + +/* Test for vector residing in register. */ +vector unsigned char c0 (vector unsigned char v, unsigned char x) +{ + return vec_insert (x, v, 0); +} + +vector unsigned char c9 (vector unsigned char v, unsigned char x) +{ + return vec_insert (x, v, 9); +} + +vector unsigned char c21 (vector unsigned char v, unsigned char x) +{ + return vec_insert (x, v, 21); +} + +vector unsigned char c30 (vector unsigned char v, unsigned char x) +{ + return vec_insert (x, v, 30); +} + +/* Test for vector residing in memory. */ +vector unsigned char mc0 (vector unsigned char *vp, unsigned char x) +{ + return vec_insert (x, *vp, 0); +} + +vector unsigned char mc9 (vector unsigned char *vp, unsigned char x) +{ + return vec_insert (x, *vp, 9); +} + +vector unsigned char mc21 (vector unsigned char *vp, unsigned char x) +{ + return vec_insert (x, *vp, 21); +} + +vector unsigned char mc30 (vector unsigned char *vp, unsigned char x) +{ + return vec_insert (x, *vp, 30); +} + +/* Test the same with variable indices. */ + +/* Test for variable selector and vector residing in register. */ +__attribute__((noinline)) +vector unsigned char ci (vector unsigned char v, int i, unsigned char x) +{ + return vec_insert (x, v, i); +} + +/* Test for variable selector and vector residing in memory. */ +__attribute__((noinline)) +vector unsigned char mci (vector unsigned char *vp, int i, unsigned char x) +{ + return vec_insert (x, *vp, i); +} + + +int main (int argc, char *argv[]) { + vector unsigned char cv = { CONST0, CONST1, CONST2, CONST3, + CONST4, CONST5, CONST6, CONST7, + CONST8, CONST9, CONSTA, CONSTB, + CONSTC, CONSTD, CONSTE, CONSTF }; + cv = c0 (cv, CONST3); + if (cv [0] != CONST3) + abort (); + + cv = c9 (cv, CONST2); + if (cv [9] != CONST2) + abort (); + + cv = c21 (cv, CONSTF); + if (cv [5] != CONSTF) + abort (); + + cv = c30 (cv, CONST3); + if (cv [14] != CONST3) + abort (); + + cv = mc0 (&cv, CONST4); + if (cv [0] != CONST4) + abort (); + + cv = mc9 (&cv, CONST3); + if (cv [9] != CONST3) + abort (); + + cv = mc21 (&cv, CONST1); + if (cv [5] != CONST1) + abort (); + + cv = mc30 (&cv, CONSTC); + if (cv [14] != CONSTC) + abort (); + + cv = ci (cv, 8, CONSTD); + if (cv [8] != CONSTD) + abort (); + + cv = ci (cv, 13, CONST5); + if (cv [13] != CONST5) + abort (); + + cv = ci (cv, 23, CONST6); + if (cv [7] != CONST6) + abort (); + + cv = ci (cv, 31, CONST7); + if (cv [15] != CONST7) + abort (); + + cv = mci (&cv, 5, CONST8); + if (cv [5] != CONST8) + abort (); + + cv = mci (&cv, 12, CONST9); + if (cv [12] != CONST9) + abort (); + + cv = mci (&cv, 25, CONSTA); + if (cv [9] != CONSTA) + abort (); + + cv = mci (&cv, 16, CONSTB); + if (cv [0] != CONSTB) + abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/powerpc/vsx-builtin-17c.c b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-17c.c new file mode 100644 index 00000000000..b95dbcdde15 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-17c.c @@ -0,0 +1,154 @@ +/* { dg-do run } */ +/* { dg-require-effective-target vmx_hw } */ +/* { dg-options "-maltivec" } */ + +/* This test should run the same on any target that supports altivec/vmx + instructions. Intentionally not specifying cpu in order to test + all code generation paths. */ + +#include + +extern void abort (void); + +#define CONST0 (0) +#define CONST1 (1) +#define CONST2 (2) +#define CONST3 (3) +#define CONST4 (4) +#define CONST5 (5) +#define CONST6 (6) +#define CONST7 (7) + + +/* Test that indices > length of vector are applied modulo the vector + length. */ + +/* Test for vector residing in register. */ +vector unsigned short s3 (vector unsigned short v, unsigned short x) +{ + return vec_insert (x, v, 3); +} + +vector unsigned short s7 (vector unsigned short v, unsigned short x) +{ + return vec_insert (x, v, 7); +} + +vector unsigned short s21 (vector unsigned short v, unsigned short x) +{ + return vec_insert (x, v, 21); +} + +vector unsigned short s30 (vector unsigned short v, unsigned short x) +{ + return vec_insert (x, v, 30); +} + +/* Test for vector residing in memory. */ +vector unsigned short ms3 (vector unsigned short *vp, unsigned short x) +{ + return vec_insert (x, *vp, 3); +} + +vector unsigned short ms7 (vector unsigned short *vp, unsigned short x) +{ + return vec_insert (x, *vp, 7); +} + +vector unsigned short ms21 (vector unsigned short *vp, unsigned short x) +{ + return vec_insert (x, *vp, 21); +} + +vector unsigned short ms30 (vector unsigned short *vp, unsigned short x) +{ + return vec_insert (x, *vp, 30); +} + +/* Test the same with variable indices. */ + +/* Test for variable selector and vector residing in register. */ +__attribute__((noinline)) +vector unsigned short ci (vector unsigned short v, int i, unsigned short x) +{ + return vec_insert (x, v, i); +} + +/* Test for variable selector and vector residing in memory. */ +__attribute__((noinline)) +vector unsigned short mci (vector unsigned short *vp, int i, unsigned short x) +{ + return vec_insert (x, *vp, i); +} + + +int main (int argc, unsigned short *argv[]) { + vector unsigned short sv = { + CONST0, CONST1, CONST2, CONST3, CONST4, CONST5, CONST6, CONST7 }; + + sv = s3 (sv, CONST1); + if (sv [3] != CONST1) + abort (); + + sv = s7 (sv, CONST2); + if (sv [7] != CONST2) + abort (); + + sv = s21 (sv, CONST3); + if (sv [5] != CONST3) + abort (); + + sv = s30 (sv, CONST4); + if (sv [6] != CONST4) + abort (); + + sv = ms3 (&sv, CONST5); + if (sv [3] != CONST5) + abort (); + + sv = ms7 (&sv, CONST6); + if (sv [7] != CONST6) + abort (); + + sv = ms21 (&sv, CONST7); + if (sv [5] != CONST7) + abort (); + + sv = ms30 (&sv, CONST0); + if (sv [6] != CONST0) + abort (); + + sv = ci (sv, 5, CONST1); + if (sv [5] != CONST1) + abort (); + + sv = ci (sv, 2, CONST3); + if (sv [2] != CONST3) + abort (); + + sv = ci (sv, 15, CONST2); + if (sv [7] != CONST2) + abort (); + + sv = ci (sv, 28, CONST5); + if (sv [4] != CONST5) + abort (); + + sv = mci (&sv, 5, CONST4); + if (sv [5] != CONST4) + abort (); + + sv = mci (&sv, 12, CONST6); + if (sv [4] != CONST6) + abort (); + + sv = mci (&sv, 25, CONST7); + if (sv [1] != CONST7) + abort (); + + sv = mci (&sv, 16, CONST4); + if (sv [0] != CONST4) + abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/powerpc/vsx-builtin-17d.c b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-17d.c new file mode 100644 index 00000000000..b95dbcdde15 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-17d.c @@ -0,0 +1,154 @@ +/* { dg-do run } */ +/* { dg-require-effective-target vmx_hw } */ +/* { dg-options "-maltivec" } */ + +/* This test should run the same on any target that supports altivec/vmx + instructions. Intentionally not specifying cpu in order to test + all code generation paths. */ + +#include + +extern void abort (void); + +#define CONST0 (0) +#define CONST1 (1) +#define CONST2 (2) +#define CONST3 (3) +#define CONST4 (4) +#define CONST5 (5) +#define CONST6 (6) +#define CONST7 (7) + + +/* Test that indices > length of vector are applied modulo the vector + length. */ + +/* Test for vector residing in register. */ +vector unsigned short s3 (vector unsigned short v, unsigned short x) +{ + return vec_insert (x, v, 3); +} + +vector unsigned short s7 (vector unsigned short v, unsigned short x) +{ + return vec_insert (x, v, 7); +} + +vector unsigned short s21 (vector unsigned short v, unsigned short x) +{ + return vec_insert (x, v, 21); +} + +vector unsigned short s30 (vector unsigned short v, unsigned short x) +{ + return vec_insert (x, v, 30); +} + +/* Test for vector residing in memory. */ +vector unsigned short ms3 (vector unsigned short *vp, unsigned short x) +{ + return vec_insert (x, *vp, 3); +} + +vector unsigned short ms7 (vector unsigned short *vp, unsigned short x) +{ + return vec_insert (x, *vp, 7); +} + +vector unsigned short ms21 (vector unsigned short *vp, unsigned short x) +{ + return vec_insert (x, *vp, 21); +} + +vector unsigned short ms30 (vector unsigned short *vp, unsigned short x) +{ + return vec_insert (x, *vp, 30); +} + +/* Test the same with variable indices. */ + +/* Test for variable selector and vector residing in register. */ +__attribute__((noinline)) +vector unsigned short ci (vector unsigned short v, int i, unsigned short x) +{ + return vec_insert (x, v, i); +} + +/* Test for variable selector and vector residing in memory. */ +__attribute__((noinline)) +vector unsigned short mci (vector unsigned short *vp, int i, unsigned short x) +{ + return vec_insert (x, *vp, i); +} + + +int main (int argc, unsigned short *argv[]) { + vector unsigned short sv = { + CONST0, CONST1, CONST2, CONST3, CONST4, CONST5, CONST6, CONST7 }; + + sv = s3 (sv, CONST1); + if (sv [3] != CONST1) + abort (); + + sv = s7 (sv, CONST2); + if (sv [7] != CONST2) + abort (); + + sv = s21 (sv, CONST3); + if (sv [5] != CONST3) + abort (); + + sv = s30 (sv, CONST4); + if (sv [6] != CONST4) + abort (); + + sv = ms3 (&sv, CONST5); + if (sv [3] != CONST5) + abort (); + + sv = ms7 (&sv, CONST6); + if (sv [7] != CONST6) + abort (); + + sv = ms21 (&sv, CONST7); + if (sv [5] != CONST7) + abort (); + + sv = ms30 (&sv, CONST0); + if (sv [6] != CONST0) + abort (); + + sv = ci (sv, 5, CONST1); + if (sv [5] != CONST1) + abort (); + + sv = ci (sv, 2, CONST3); + if (sv [2] != CONST3) + abort (); + + sv = ci (sv, 15, CONST2); + if (sv [7] != CONST2) + abort (); + + sv = ci (sv, 28, CONST5); + if (sv [4] != CONST5) + abort (); + + sv = mci (&sv, 5, CONST4); + if (sv [5] != CONST4) + abort (); + + sv = mci (&sv, 12, CONST6); + if (sv [4] != CONST6) + abort (); + + sv = mci (&sv, 25, CONST7); + if (sv [1] != CONST7) + abort (); + + sv = mci (&sv, 16, CONST4); + if (sv [0] != CONST4) + abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/powerpc/vsx-builtin-18c.c b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-18c.c new file mode 100644 index 00000000000..19932629d4b --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-18c.c @@ -0,0 +1,148 @@ +/* { dg-do run } */ +/* { dg-require-effective-target vmx_hw } */ +/* { dg-options "-maltivec" } */ + +/* This test should run the same on any target that supports altivec/vmx + instructions. Unsigned Intentionally not specifying cpu in order to test + all code generation paths. */ + +#include + +extern void abort (void); + +#define CONST0 (0) +#define CONST1 (1) +#define CONST2 (2) +#define CONST3 (3) + +/* Test that indices > length of vector are applied modulo the vector + length. */ + +/* Test for vector residing in register. */ +vector unsigned int s3 (vector unsigned int v, unsigned int x) +{ + return vec_insert (x, v, 3); +} + +vector unsigned int s1 (vector unsigned int v, unsigned int x) +{ + return vec_insert (x, v, 1); +} + +vector unsigned int s21 (vector unsigned int v, unsigned int x) +{ + return vec_insert (x, v, 21); +} + +vector unsigned int s30 (vector unsigned int v, unsigned int x) +{ + return vec_insert (x, v, 30); +} + +/* Test for vector residing in memory. */ +vector unsigned int ms3 (vector unsigned int *vp, unsigned int x) +{ + return vec_insert (x, *vp, 3); +} + +vector unsigned int ms1(vector unsigned int *vp, unsigned int x) +{ + return vec_insert (x, *vp, 1); +} + +vector unsigned int ms21(vector unsigned int *vp, unsigned int x) +{ + return vec_insert (x, *vp, 21); +} + +vector unsigned int ms30(vector unsigned int *vp, unsigned int x) +{ + return vec_insert (x, *vp, 30); +} + +/* Test the same with variable indices. */ + +/* Test for variable selector and vector residing in register. */ +__attribute__((noinline)) +vector unsigned int ci (vector unsigned int v, int i, unsigned int x) +{ + return vec_insert (x, v, i); +} + +/* Test for variable selector and vector residing in memory. */ +__attribute__((noinline)) +vector unsigned int mci(vector unsigned int *vp, int i, unsigned int x) +{ + return vec_insert (x, *vp, i); +} + + +int main (int argc, unsigned char *argv[]) { + vector unsigned int sv = { CONST0, CONST1, CONST2, CONST3 }; + + sv = s3 (sv, CONST2); + if (sv [3] != CONST2) + abort (); + + sv = s1 (sv, CONST2); + if (sv [1] != CONST2) + abort (); + + sv = s21 (sv, CONST3); + if (sv [1] != CONST3) + abort (); + + sv = s30 (sv, CONST1); + if (sv [2] != CONST1) + abort (); + + sv = ms3 (&sv, CONST0); + if (sv [3] != CONST0) + abort (); + + sv = ms1 (&sv, CONST0); + if (sv [1] != CONST0) + abort (); + + sv = ms21 (&sv, CONST1); + if (sv [1] != CONST1) + abort (); + + sv = ms30 (&sv, CONST0); + if (sv [2] != CONST0) + abort (); + + sv = ci (sv, 5, CONST3); + if (sv [1] != CONST3) + abort (); + + sv = ci (sv, 2, CONST0); + if (sv [2] != CONST0) + abort (); + + sv = ci (sv, 15, CONST1); + if (sv [3] != CONST1) + abort (); + + sv = ci (sv, 28, CONST3); + if (sv [0] != CONST3) + abort (); + + sv = mci (&sv, 5, CONST0); + if (sv [1] != CONST0) + abort (); + + sv = mci (&sv, 12, CONST2); + if (sv [0] != CONST2) + abort (); + + sv = mci (&sv, 25, CONST3); + if (sv [1] != CONST3) + abort (); + + sv = mci (&sv, 16, CONST1); + if (sv [0] != CONST1) + abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/powerpc/vsx-builtin-18d.c b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-18d.c new file mode 100644 index 00000000000..8c643aaafd3 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-18d.c @@ -0,0 +1,148 @@ +/* { dg-do run } */ +/* { dg-require-effective-target vmx_hw } */ +/* { dg-options "-maltivec -O3" } */ + +/* This test should run the same on any target that supports altivec/vmx + instructions. Unsigned Intentionally not specifying cpu in order to test + all code generation paths. */ + +#include + +extern void abort (void); + +#define CONST0 (0) +#define CONST1 (1) +#define CONST2 (2) +#define CONST3 (3) + +/* Test that indices > length of vector are applied modulo the vector + length. */ + +/* Test for vector residing in register. */ +vector unsigned int s3 (vector unsigned int v, unsigned int x) +{ + return vec_insert (x, v, 3); +} + +vector unsigned int s1 (vector unsigned int v, unsigned int x) +{ + return vec_insert (x, v, 1); +} + +vector unsigned int s21 (vector unsigned int v, unsigned int x) +{ + return vec_insert (x, v, 21); +} + +vector unsigned int s30 (vector unsigned int v, unsigned int x) +{ + return vec_insert (x, v, 30); +} + +/* Test for vector residing in memory. */ +vector unsigned int ms3 (vector unsigned int *vp, unsigned int x) +{ + return vec_insert (x, *vp, 3); +} + +vector unsigned int ms1(vector unsigned int *vp, unsigned int x) +{ + return vec_insert (x, *vp, 1); +} + +vector unsigned int ms21(vector unsigned int *vp, unsigned int x) +{ + return vec_insert (x, *vp, 21); +} + +vector unsigned int ms30(vector unsigned int *vp, unsigned int x) +{ + return vec_insert (x, *vp, 30); +} + +/* Test the same with variable indices. */ + +/* Test for variable selector and vector residing in register. */ +__attribute__((noinline)) +vector unsigned int ci (vector unsigned int v, int i, unsigned int x) +{ + return vec_insert (x, v, i); +} + +/* Test for variable selector and vector residing in memory. */ +__attribute__((noinline)) +vector unsigned int mci(vector unsigned int *vp, int i, unsigned int x) +{ + return vec_insert (x, *vp, i); +} + + +int main (int argc, unsigned char *argv[]) { + vector unsigned int sv = { CONST0, CONST1, CONST2, CONST3 }; + + sv = s3 (sv, CONST2); + if (sv [3] != CONST2) + abort (); + + sv = s1 (sv, CONST2); + if (sv [1] != CONST2) + abort (); + + sv = s21 (sv, CONST3); + if (sv [1] != CONST3) + abort (); + + sv = s30 (sv, CONST1); + if (sv [2] != CONST1) + abort (); + + sv = ms3 (&sv, CONST0); + if (sv [3] != CONST0) + abort (); + + sv = ms1 (&sv, CONST0); + if (sv [1] != CONST0) + abort (); + + sv = ms21 (&sv, CONST1); + if (sv [1] != CONST1) + abort (); + + sv = ms30 (&sv, CONST0); + if (sv [2] != CONST0) + abort (); + + sv = ci (sv, 5, CONST3); + if (sv [1] != CONST3) + abort (); + + sv = ci (sv, 2, CONST0); + if (sv [2] != CONST0) + abort (); + + sv = ci (sv, 15, CONST1); + if (sv [3] != CONST1) + abort (); + + sv = ci (sv, 28, CONST3); + if (sv [0] != CONST3) + abort (); + + sv = mci (&sv, 5, CONST0); + if (sv [1] != CONST0) + abort (); + + sv = mci (&sv, 12, CONST2); + if (sv [0] != CONST2) + abort (); + + sv = mci (&sv, 25, CONST3); + if (sv [1] != CONST3) + abort (); + + sv = mci (&sv, 16, CONST1); + if (sv [0] != CONST1) + abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/powerpc/vsx-builtin-19c.c b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-19c.c new file mode 100644 index 00000000000..3ff0dfe20b0 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-19c.c @@ -0,0 +1,122 @@ +/* { dg-do run { target int128 } } */ +/* { dg-require-effective-target vsx_hw } */ +/* { dg-options "-mvsx" } */ + +/* This test should run the same on any target that supports vsx + instructions. Intentionally not specifying cpu in order to test + all code generation paths. */ + +#include + +extern void abort (void); + +#define CONST0 (31415926539LL) +#define CONST1 (2 * 31415926539LL) +#define CONST2 (3 * 31415926539LL) +#define CONST3 (4 * 31415926539LL) +#define CONST4 (5 * 31415926539LL) +#define CONST5 (6 * 31415926539LL) +#define CONST6 (7 * 31415926539LL) +#define CONST7 (8 * 31415926539LL) + +/* Test that indices > length of vector are applied modulo the vector + length. */ + +/* Test for vector residing in register. */ +vector unsigned long long int +e0 (vector unsigned long long int v, unsigned long long int x) +{ + return vec_insert (x, v, 0); +} + +vector unsigned long long int +e3 (vector unsigned long long int v, unsigned long long int x) +{ + return vec_insert (x, v, 3); +} + +/* Test for vector residing in memory. */ +vector unsigned long long int +me0 (vector unsigned long long int *vp, unsigned long long int x) +{ + return vec_insert (x, *vp, 0); +} + +vector unsigned long long int +me3 (vector unsigned long long int *vp, unsigned long long int x) +{ + return vec_insert (x, *vp, 3); +} + +/* Test the same with variable indices. */ + +/* Test for variable selector and vector residing in register. */ +__attribute__((noinline)) +vector unsigned long long int +ei (vector unsigned long long int v, int i, unsigned long long int x) +{ + return vec_insert (x, v, i); +} + +/* Test for variable selector and vector residing in memory. */ +__attribute__((noinline)) +vector unsigned long long int +mei (vector unsigned long long int *vp, int i, unsigned long long int x) +{ + return vec_insert (x, *vp, i); +} + +int main (int argc, char *argv[]) { + vector unsigned long long int dv = { CONST0, CONST1 }; + unsigned long long int d; + + dv = e0 (dv, CONST7); + if (dv [0] != CONST7) + abort (); + + dv = e3 (dv, CONST2); + if (dv [1] != CONST2) + abort (); + + dv = me0 (&dv, CONST4); + if (dv [0] != CONST4) + abort (); + + dv = me3 (&dv, CONST3); + if (dv [1] != CONST3) + abort (); + + dv = ei (dv, 0, CONST5); + if (dv [0] != CONST5) + abort (); + + dv = ei (dv, 1, CONST2); + if (dv [1] != CONST2) + abort (); + + dv = ei (dv, 2, CONST3); + if (dv [0] != CONST3) + abort (); + + dv = ei (dv, 3, CONST6); + if (dv [1] != CONST6) + abort (); + + dv = mei (&dv, 0, CONST1); + if (dv [0] != CONST1) + abort (); + + dv = mei (&dv, 1, CONST3); + if (dv [1] != CONST3) + abort (); + + dv = mei (&dv, 2, CONST1); + if (dv [0] != CONST1) + abort (); + + dv = mei (&dv, 3, CONST2); + if (dv [1] != CONST2) + abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/powerpc/vsx-builtin-19d.c b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-19d.c new file mode 100644 index 00000000000..d0236df5308 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-19d.c @@ -0,0 +1,122 @@ +/* { dg-do run { target int128 } } */ +/* { dg-require-effective-target vsx_hw } */ +/* { dg-options "-mvsx -O3" } */ + +/* This test should run the same on any target that supports vsx + instructions. Intentionally not specifying cpu in order to test + all code generation paths. */ + +#include + +extern void abort (void); + +#define CONST0 (31415926539LL) +#define CONST1 (2 * 31415926539LL) +#define CONST2 (3 * 31415926539LL) +#define CONST3 (4 * 31415926539LL) +#define CONST4 (5 * 31415926539LL) +#define CONST5 (6 * 31415926539LL) +#define CONST6 (7 * 31415926539LL) +#define CONST7 (8 * 31415926539LL) + +/* Test that indices > length of vector are applied modulo the vector + length. */ + +/* Test for vector residing in register. */ +vector unsigned long long int +e0 (vector unsigned long long int v, unsigned long long int x) +{ + return vec_insert (x, v, 0); +} + +vector unsigned long long int +e3 (vector unsigned long long int v, unsigned long long int x) +{ + return vec_insert (x, v, 3); +} + +/* Test for vector residing in memory. */ +vector unsigned long long int +me0 (vector unsigned long long int *vp, unsigned long long int x) +{ + return vec_insert (x, *vp, 0); +} + +vector unsigned long long int +me3 (vector unsigned long long int *vp, unsigned long long int x) +{ + return vec_insert (x, *vp, 3); +} + +/* Test the same with variable indices. */ + +/* Test for variable selector and vector residing in register. */ +__attribute__((noinline)) +vector unsigned long long int +ei (vector unsigned long long int v, int i, unsigned long long int x) +{ + return vec_insert (x, v, i); +} + +/* Test for variable selector and vector residing in memory. */ +__attribute__((noinline)) +vector unsigned long long int +mei (vector unsigned long long int *vp, int i, unsigned long long int x) +{ + return vec_insert (x, *vp, i); +} + +int main (int argc, char *argv[]) { + vector unsigned long long int dv = { CONST0, CONST1 }; + unsigned long long int d; + + dv = e0 (dv, CONST7); + if (dv [0] != CONST7) + abort (); + + dv = e3 (dv, CONST2); + if (dv [1] != CONST2) + abort (); + + dv = me0 (&dv, CONST4); + if (dv [0] != CONST4) + abort (); + + dv = me3 (&dv, CONST3); + if (dv [1] != CONST3) + abort (); + + dv = ei (dv, 0, CONST5); + if (dv [0] != CONST5) + abort (); + + dv = ei (dv, 1, CONST2); + if (dv [1] != CONST2) + abort (); + + dv = ei (dv, 2, CONST3); + if (dv [0] != CONST3) + abort (); + + dv = ei (dv, 3, CONST6); + if (dv [1] != CONST6) + abort (); + + dv = mei (&dv, 0, CONST1); + if (dv [0] != CONST1) + abort (); + + dv = mei (&dv, 1, CONST3); + if (dv [1] != CONST3) + abort (); + + dv = mei (&dv, 2, CONST1); + if (dv [0] != CONST1) + abort (); + + dv = mei (&dv, 3, CONST2); + if (dv [1] != CONST2) + abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/powerpc/vsx-builtin-20c.c b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-20c.c new file mode 100644 index 00000000000..e56d500515e --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-20c.c @@ -0,0 +1,115 @@ +/* { dg-do run { target int128 } } */ +/* { dg-require-effective-target vsx_hw } */ +/* { dg-options "-mvsx" } */ + +/* This test should run the same on any target that supports vsx + instructions. Intentionally not specifying cpu in order to test + all code generation paths. */ + +#include + +extern void abort (void); + +#define CONST0 (((unsigned __int128) 31415926539) << 60) +#define CONST1 (((unsigned __int128) 31415926539) << 54) +#define CONST2 (((unsigned __int128) 31415926539) << 48) +#define CONST3 (((unsigned __int128) 31415926539) << 32) + +/* Test that indices > length of vector are applied modulo the vector + length. */ + +/* Test for vector residing in register. */ +vector unsigned __int128 e0 (vector unsigned __int128 v, unsigned __int128 x) +{ + return vec_insert (x, v, 0); +} + +vector unsigned __int128 e3 (vector unsigned __int128 v, unsigned __int128 x) +{ + return vec_insert (x, v, 3); +} + +/* Test for vector residing in memory. */ +vector unsigned __int128 +me0 (vector unsigned __int128 *vp, unsigned __int128 x) +{ + return vec_insert (x, *vp, 0); +} + +vector unsigned __int128 +me3 (vector unsigned __int128 *vp, unsigned __int128 x) +{ + return vec_insert (x, *vp, 3); +} + +/* Test the same with variable indices. */ + +/* Test for variable selector and vector residing in register. */ +__attribute__((noinline)) +vector unsigned __int128 +ei (vector unsigned __int128 v, int i, unsigned __int128 x) +{ + return vec_insert (x, v, i); +} + +/* Test for variable selector and vector residing in memory. */ +__attribute__((noinline)) +vector unsigned __int128 +mei (vector unsigned __int128 *vp, int i, unsigned __int128 x) +{ + return vec_insert (x, *vp, i); +} + +int main (int argc, char *argv[]) { + vector unsigned __int128 dv = { CONST0 }; + + dv = e0 (dv, CONST3); + if (dv [0] != CONST3) + abort (); + + dv = e3 (dv, CONST2); + if (dv [0] != CONST2) + abort (); + + dv = me0 (&dv, CONST1); + if (dv [0] != CONST1) + abort (); + + dv = me3 (&dv, CONST3); + if (dv [0] != CONST3) + abort (); + + dv = ei (dv, 0, CONST0); + if (dv [0] != CONST0) + abort (); + + dv = ei (dv, 1, CONST1); + if (dv [0] != CONST1) + abort (); + + dv = ei (dv, 2, CONST2); + if (dv [0] != CONST2) + abort (); + + dv = ei (dv, 3, CONST3); + if (dv [0] != CONST3) + abort (); + + dv = mei (&dv, 0, CONST0); + if (dv [0] != CONST0) + abort (); + + dv = mei (&dv, 1, CONST1); + if (dv [0] != CONST1) + abort (); + + dv = mei (&dv, 2, CONST2); + if (dv [0] != CONST2) + abort (); + + dv = mei (&dv, 3, CONST3); + if (dv [0] != CONST3) + abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/powerpc/vsx-builtin-20d.c b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-20d.c new file mode 100644 index 00000000000..17c7b0e48a9 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-20d.c @@ -0,0 +1,115 @@ +/* { dg-do run { target int128 } } */ +/* { dg-require-effective-target vsx_hw } */ +/* { dg-options "-mvsx -O3" } */ + +/* This test should run the same on any target that supports vsx + instructions. Intentionally not specifying cpu in order to test + all code generation paths. */ + +#include + +extern void abort (void); + +#define CONST0 (((unsigned __int128) 31415926539) << 60) +#define CONST1 (((unsigned __int128) 31415926539) << 54) +#define CONST2 (((unsigned __int128) 31415926539) << 48) +#define CONST3 (((unsigned __int128) 31415926539) << 32) + +/* Test that indices > length of vector are applied modulo the vector + length. */ + +/* Test for vector residing in register. */ +vector unsigned __int128 e0 (vector unsigned __int128 v, unsigned __int128 x) +{ + return vec_insert (x, v, 0); +} + +vector unsigned __int128 e3 (vector unsigned __int128 v, unsigned __int128 x) +{ + return vec_insert (x, v, 3); +} + +/* Test for vector residing in memory. */ +vector unsigned __int128 +me0 (vector unsigned __int128 *vp, unsigned __int128 x) +{ + return vec_insert (x, *vp, 0); +} + +vector unsigned __int128 +me3 (vector unsigned __int128 *vp, unsigned __int128 x) +{ + return vec_insert (x, *vp, 3); +} + +/* Test the same with variable indices. */ + +/* Test for variable selector and vector residing in register. */ +__attribute__((noinline)) +vector unsigned __int128 +ei (vector unsigned __int128 v, int i, unsigned __int128 x) +{ + return vec_insert (x, v, i); +} + +/* Test for variable selector and vector residing in memory. */ +__attribute__((noinline)) +vector unsigned __int128 +mei (vector unsigned __int128 *vp, int i, unsigned __int128 x) +{ + return vec_insert (x, *vp, i); +} + +int main (int argc, char *argv[]) { + vector unsigned __int128 dv = { CONST0 }; + + dv = e0 (dv, CONST3); + if (dv [0] != CONST3) + abort (); + + dv = e3 (dv, CONST2); + if (dv [0] != CONST2) + abort (); + + dv = me0 (&dv, CONST1); + if (dv [0] != CONST1) + abort (); + + dv = me3 (&dv, CONST3); + if (dv [0] != CONST3) + abort (); + + dv = ei (dv, 0, CONST0); + if (dv [0] != CONST0) + abort (); + + dv = ei (dv, 1, CONST1); + if (dv [0] != CONST1) + abort (); + + dv = ei (dv, 2, CONST2); + if (dv [0] != CONST2) + abort (); + + dv = ei (dv, 3, CONST3); + if (dv [0] != CONST3) + abort (); + + dv = mei (&dv, 0, CONST0); + if (dv [0] != CONST0) + abort (); + + dv = mei (&dv, 1, CONST1); + if (dv [0] != CONST1) + abort (); + + dv = mei (&dv, 2, CONST2); + if (dv [0] != CONST2) + abort (); + + dv = mei (&dv, 3, CONST3); + if (dv [0] != CONST3) + abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/powerpc/vsx-builtin-9c.c b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-9c.c new file mode 100644 index 00000000000..3bec1474954 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-9c.c @@ -0,0 +1,164 @@ +/* { dg-do run } */ +/* { dg-require-effective-target vmx_hw } */ +/* { dg-options "-maltivec" } */ + +/* This test should run the same on any target that supports altivec/vmx + instructions. Intentionally not specifying cpu in order to test + all code generation paths. */ + +#include + +extern void abort (void); + +#define CONST0 (0) +#define CONST1 (1) +#define CONST2 (2) +#define CONST3 (3) +#define CONST4 (4) +#define CONST5 (5) +#define CONST6 (6) +#define CONST7 (7) +#define CONST8 (8) +#define CONST9 (9) +#define CONSTA (10) +#define CONSTB (11) +#define CONSTC (12) +#define CONSTD (13) +#define CONSTE (14) +#define CONSTF (15) + + +/* Test that indices > length of vector are applied modulo the vector + length. */ + +/* Test for vector residing in register. */ +vector signed char c0 (vector signed char v, signed char x) +{ + return vec_insert (x, v, 0); +} + +vector signed char c9 (vector signed char v, signed char x) +{ + return vec_insert (x, v, 9); +} + +vector signed char c21 (vector signed char v, signed char x) +{ + return vec_insert (x, v, 21); +} + +vector signed char c30 (vector signed char v, signed char x) +{ + return vec_insert (x, v, 30); +} + +/* Test for vector residing in memory. */ +vector signed char mc0 (vector signed char *vp, signed char x) +{ + return vec_insert (x, *vp, 0); +} + +vector signed char mc9 (vector signed char *vp, signed char x) +{ + return vec_insert (x, *vp, 9); +} + +vector signed char mc21 (vector signed char *vp, signed char x) +{ + return vec_insert (x, *vp, 21); +} + +vector signed char mc30 (vector signed char *vp, signed char x) +{ + return vec_insert (x, *vp, 30); +} + +/* Test the same with variable indices. */ + +/* Test for variable selector and vector residing in register. */ +__attribute__((noinline)) +vector signed char ci (vector signed char v, int i, signed char x) +{ + return vec_insert (x, v, i); +} + +/* Test for variable selector and vector residing in memory. */ +__attribute__((noinline)) +vector signed char mci(vector signed char *vp, int i, signed char x) { + return vec_insert (x, *vp, i); +} + + +int main (int argc, char *argv[]) { + vector signed char cv = { CONST0, CONST1, CONST2, CONST3, + CONST4, CONST5, CONST6, CONST7, + CONST8, CONST9, CONSTA, CONSTB, + CONSTC, CONSTD, CONSTE, CONSTF }; + signed char c; + + cv = c0 (cv, CONSTF); + if (cv [0] != CONSTF) + abort (); + + cv = c9 (cv, CONST7); + if (cv [9] != CONST7) + abort (); + + cv = c21 (cv, CONSTA); + if (cv [5] != CONSTA) + abort (); + + cv = c30 (cv, CONSTC); + if (cv [14] != CONSTC) + abort (); + + cv = mc0 (&cv, CONSTB); + if (cv [0] != CONSTB) + abort (); + + cv = mc9 (&cv, CONST1); + if (cv [9] != CONST1) + abort (); + + cv = mc21 (&cv, CONST7); + if (cv [5] != CONST7) + abort (); + + cv = mc30 (&cv, CONST2); + if (cv [14] != CONST2) + abort (); + + cv = ci (cv, 8, CONST4); + if (cv [8] != CONST4) + abort (); + + cv = ci (cv, 13, CONSTB); + if (cv [13] != CONSTB) + abort (); + + cv = ci (cv, 23, CONST3); + if (cv [7] != CONST3) + abort (); + + cv = ci (cv, 31, CONST2); + if (cv [15] != CONST2) + abort (); + + cv = mci (&cv, 5, CONST1); + if (cv [5] != CONST1) + abort (); + + cv = mci (&cv, 12, CONST3); + if (cv [12] != CONST3) + abort (); + + cv = mci (&cv, 25, CONST5); + if (cv [9] != CONST5) + abort (); + + cv = mci (&cv, 16, CONSTD); + if (cv [0] != CONSTD) + abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/powerpc/vsx-builtin-9d.c b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-9d.c new file mode 100644 index 00000000000..1e70c521fec --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-9d.c @@ -0,0 +1,164 @@ +/* { dg-do run } */ +/* { dg-require-effective-target vmx_hw } */ +/* { dg-options "-maltivec -O3" } */ + +/* This test should run the same on any target that supports altivec/vmx + instructions. Intentionally not specifying cpu in order to test + all code generation paths. */ + +#include + +extern void abort (void); + +#define CONST0 (0) +#define CONST1 (1) +#define CONST2 (2) +#define CONST3 (3) +#define CONST4 (4) +#define CONST5 (5) +#define CONST6 (6) +#define CONST7 (7) +#define CONST8 (8) +#define CONST9 (9) +#define CONSTA (10) +#define CONSTB (11) +#define CONSTC (12) +#define CONSTD (13) +#define CONSTE (14) +#define CONSTF (15) + + +/* Test that indices > length of vector are applied modulo the vector + length. */ + +/* Test for vector residing in register. */ +vector signed char c0 (vector signed char v, signed char x) +{ + return vec_insert (x, v, 0); +} + +vector signed char c9 (vector signed char v, signed char x) +{ + return vec_insert (x, v, 9); +} + +vector signed char c21 (vector signed char v, signed char x) +{ + return vec_insert (x, v, 21); +} + +vector signed char c30 (vector signed char v, signed char x) +{ + return vec_insert (x, v, 30); +} + +/* Test for vector residing in memory. */ +vector signed char mc0 (vector signed char *vp, signed char x) +{ + return vec_insert (x, *vp, 0); +} + +vector signed char mc9 (vector signed char *vp, signed char x) +{ + return vec_insert (x, *vp, 9); +} + +vector signed char mc21 (vector signed char *vp, signed char x) +{ + return vec_insert (x, *vp, 21); +} + +vector signed char mc30 (vector signed char *vp, signed char x) +{ + return vec_insert (x, *vp, 30); +} + +/* Test the same with variable indices. */ + +/* Test for variable selector and vector residing in register. */ +__attribute__((noinline)) +vector signed char ci (vector signed char v, int i, signed char x) +{ + return vec_insert (x, v, i); +} + +/* Test for variable selector and vector residing in memory. */ +__attribute__((noinline)) +vector signed char mci(vector signed char *vp, int i, signed char x) { + return vec_insert (x, *vp, i); +} + + +int main (int argc, char *argv[]) { + vector signed char cv = { CONST0, CONST1, CONST2, CONST3, + CONST4, CONST5, CONST6, CONST7, + CONST8, CONST9, CONSTA, CONSTB, + CONSTC, CONSTD, CONSTE, CONSTF }; + signed char c; + + cv = c0 (cv, CONSTF); + if (cv [0] != CONSTF) + abort (); + + cv = c9 (cv, CONST7); + if (cv [9] != CONST7) + abort (); + + cv = c21 (cv, CONSTA); + if (cv [5] != CONSTA) + abort (); + + cv = c30 (cv, CONSTC); + if (cv [14] != CONSTC) + abort (); + + cv = mc0 (&cv, CONSTB); + if (cv [0] != CONSTB) + abort (); + + cv = mc9 (&cv, CONST1); + if (cv [9] != CONST1) + abort (); + + cv = mc21 (&cv, CONST7); + if (cv [5] != CONST7) + abort (); + + cv = mc30 (&cv, CONST2); + if (cv [14] != CONST2) + abort (); + + cv = ci (cv, 8, CONST4); + if (cv [8] != CONST4) + abort (); + + cv = ci (cv, 13, CONSTB); + if (cv [13] != CONSTB) + abort (); + + cv = ci (cv, 23, CONST3); + if (cv [7] != CONST3) + abort (); + + cv = ci (cv, 31, CONST2); + if (cv [15] != CONST2) + abort (); + + cv = mci (&cv, 5, CONST1); + if (cv [5] != CONST1) + abort (); + + cv = mci (&cv, 12, CONST3); + if (cv [12] != CONST3) + abort (); + + cv = mci (&cv, 25, CONST5); + if (cv [9] != CONST5) + abort (); + + cv = mci (&cv, 16, CONSTD); + if (cv [0] != CONSTD) + abort (); + + return 0; +} -- cgit v1.2.3 From 80bf1d1e5f1ae83f3b27a88d26c42ecdffdffb82 Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Thu, 16 May 2019 23:09:51 +0000 Subject: PR libstdc++/90299 make filesystem::absolute overloads consistent In this implementation it is an error to pass the empty path to absolute, because the empty path doesn't represent any file in the filesystem so the function cannot meet its postcondition. Currently the absolute(const path&, error_code&) overload reports an error for the empty path, but using errc::no_such_file_or_directory, and the other overload does not report an error. This patch makes them consistntly report an errc::invalid_argument error for the empty path. Backport from mainline 2019-05-04 Jonathan Wakely PR libstdc++/90299 * src/filesystem/std-ops.cc (absolute(const path&)): Report an error if the argument is an empty path. (absolute(const path&, error_code&)): Use invalid_argument as error code instead of no_such_file_or_directory. * testsuite/27_io/filesystem/operations/absolute.cc: Check handling of non-existent paths and empty paths with both overloads of absolute. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@271302 138bc75d-0d04-0410-961f-82ee72b054a4 --- libstdc++-v3/ChangeLog | 13 ++++++++++ libstdc++-v3/src/filesystem/std-ops.cc | 5 +++- .../27_io/filesystem/operations/absolute.cc | 28 ++++++++++++++++++++++ 3 files changed, 45 insertions(+), 1 deletion(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 50631125630..5aae6a39422 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,16 @@ +2019-05-17 Jonathan Wakely + + Backport from mainline + 2019-05-04 Jonathan Wakely + + PR libstdc++/90299 + * src/filesystem/std-ops.cc (absolute(const path&)): Report an error + if the argument is an empty path. + (absolute(const path&, error_code&)): Use invalid_argument as error + code instead of no_such_file_or_directory. + * testsuite/27_io/filesystem/operations/absolute.cc: Check handling + of non-existent paths and empty paths with both overloads of absolute. + 2019-05-15 Jonathan Wakely Backport from mainline diff --git a/libstdc++-v3/src/filesystem/std-ops.cc b/libstdc++-v3/src/filesystem/std-ops.cc index c0742d73b5c..40de0de8579 100644 --- a/libstdc++-v3/src/filesystem/std-ops.cc +++ b/libstdc++-v3/src/filesystem/std-ops.cc @@ -77,6 +77,9 @@ fs::absolute(const path& p) std::make_error_code(errc::not_supported))); return ret; #else + if (p.empty()) + _GLIBCXX_THROW_OR_ABORT(filesystem_error("cannot make absolute path", p, + make_error_code(std::errc::invalid_argument))); return current_path() / p; #endif } @@ -87,7 +90,7 @@ fs::absolute(const path& p, error_code& ec) path ret; if (p.empty()) { - ec = make_error_code(std::errc::no_such_file_or_directory); + ec = make_error_code(std::errc::invalid_argument); return ret; } if (p.is_absolute()) diff --git a/libstdc++-v3/testsuite/27_io/filesystem/operations/absolute.cc b/libstdc++-v3/testsuite/27_io/filesystem/operations/absolute.cc index 413a86758f0..3f1ed72424a 100644 --- a/libstdc++-v3/testsuite/27_io/filesystem/operations/absolute.cc +++ b/libstdc++-v3/testsuite/27_io/filesystem/operations/absolute.cc @@ -50,9 +50,37 @@ test02() VERIFY( absolute(p3) == (std::filesystem::current_path()/p3) ); } +void +test03() +{ + // PR libstdc++/90299 + const path p = __gnu_test::nonexistent_path(); + std::error_code ec; + const path pabs = absolute(p, ec); + VERIFY( !ec ); + VERIFY( pabs.is_absolute() ); + + const path pabs2 = absolute(p); + VERIFY( pabs2 == pabs ); + + const path eabs = absolute(path{}, ec); + VERIFY( ec == std::errc::invalid_argument ); + VERIFY( eabs.empty() ); + + try { + absolute(path{}); + VERIFY( false ); + } catch (const std::filesystem::filesystem_error& e) { + VERIFY( e.code() == std::errc::invalid_argument ); + VERIFY( e.path1().empty() ); + VERIFY( e.path2().empty() ); + } +} + int main() { test01(); test02(); + test03(); } -- cgit v1.2.3 From 0765ef5499e89fae945e7dac442768c03eabbc82 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Fri, 17 May 2019 00:16:08 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@271305 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index eed4fcb48d1..4b208e8911d 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190516 +20190517 -- cgit v1.2.3 From 192e424cdc946f9a76787758977c58dd5087b9a1 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Sat, 18 May 2019 00:16:08 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@271366 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 4b208e8911d..f4dea2d0fae 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190517 +20190518 -- cgit v1.2.3 From 3aeda93cdcb9962dfea85082aee1f74ddb75f557 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Sun, 19 May 2019 00:16:08 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@271373 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index f4dea2d0fae..296d86488dc 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190518 +20190519 -- cgit v1.2.3 From 65c2217fc1ba83de6f9aadbbf834f5dc7bfe4e84 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Mon, 20 May 2019 00:16:37 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@271392 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 296d86488dc..544c8f4614e 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190519 +20190520 -- cgit v1.2.3 From f44adfe1bfc1751146b9c80c364ceac561c622f9 Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Mon, 20 May 2019 13:04:39 +0000 Subject: PR c++/90532 Ensure __is_constructible(T[]) is false An array of an unknown bound is an incomplete type, so no object of such a type can be constructed. This means __is_constructible should always be false for an array of unknown bound. This patch also changes the std::is_default_constructible trait to use std::is_constructible, which now gives the right answer for arrays of unknown bound. gcc/cp: Backported from mainline 2019-05-20 Jonathan Wakely PR c++/90532 Ensure __is_constructible(T[]) is false * method.c (is_xible_helper): Return error_mark_node for construction of an array of unknown bound. gcc/testsuite: Backported from mainline 2019-05-20 Jonathan Wakely PR c++/90532 Ensure __is_constructible(T[]) is false * g++.dg/ext/90532.C: New test. libstdc++-v3: Backported from mainline 2019-05-20 Jonathan Wakely PR c++/90532 Ensure __is_constructible(T[]) is false * include/std/type_traits (__do_is_default_constructible_impl) (__is_default_constructible_atom, __is_default_constructible_safe): Remove. (is_default_constructible): Use is_constructible. * testsuite/20_util/is_constructible/value.cc: Check int[] case. * testsuite/20_util/is_default_constructible/value.cc: Likewise. * testsuite/20_util/is_trivially_constructible/value.cc: Likewise. * testsuite/20_util/is_trivially_default_constructible/value.cc: Likewise. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@271418 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cp/ChangeLog | 9 ++++ gcc/cp/method.c | 2 + gcc/testsuite/ChangeLog | 8 ++++ gcc/testsuite/g++.dg/ext/90532.C | 27 +++++++++++ libstdc++-v3/ChangeLog | 16 +++++++ libstdc++-v3/include/std/type_traits | 52 +++------------------- .../testsuite/20_util/is_constructible/value.cc | 7 +++ .../20_util/is_default_constructible/value.cc | 10 +++++ .../20_util/is_trivially_constructible/value.cc | 2 + .../is_trivially_default_constructible/value.cc | 9 ++++ 10 files changed, 95 insertions(+), 47 deletions(-) create mode 100644 gcc/testsuite/g++.dg/ext/90532.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index ba00c9ddb34..7dce9c0162b 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,12 @@ +2019-05-20 Jonathan Wakely + + Backported from mainline + 2019-05-20 Jonathan Wakely + + PR c++/90532 Ensure __is_constructible(T[]) is false + * method.c (is_xible_helper): Return error_mark_node for construction + of an array of unknown bound. + 2019-05-07 Marek Polacek Backported from mainline diff --git a/gcc/cp/method.c b/gcc/cp/method.c index d10f1a6d2be..ad568bbe3af 100644 --- a/gcc/cp/method.c +++ b/gcc/cp/method.c @@ -1201,6 +1201,8 @@ is_xible_helper (enum tree_code code, tree to, tree from, bool trivial) expr = assignable_expr (to, from); else if (trivial && from && TREE_CHAIN (from)) return error_mark_node; // only 0- and 1-argument ctors can be trivial + else if (TREE_CODE (to) == ARRAY_TYPE && !TYPE_DOMAIN (to)) + return error_mark_node; // can't construct an array of unknown bound else expr = constructible_expr (to, from); return expr; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 9d8e462f791..4f01a866927 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2019-05-20 Jonathan Wakely + + Backported from mainline + 2019-05-20 Jonathan Wakely + + PR c++/90532 Ensure __is_constructible(T[]) is false + * g++.dg/ext/90532.C: New test. + 2019-05-16 Kelvin Nilsen Backport from mainline. diff --git a/gcc/testsuite/g++.dg/ext/90532.C b/gcc/testsuite/g++.dg/ext/90532.C new file mode 100644 index 00000000000..acdc4e2b07e --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/90532.C @@ -0,0 +1,27 @@ +// { dg-do compile { target c++11 } } +// PR c++/90532 +static_assert( !__is_constructible(int[]), "" ); +static_assert( !__is_constructible(int[], int), "" ); +static_assert( !__is_constructible(int[], int[]), "" ); +static_assert( !__is_trivially_constructible(int[]), "" ); +static_assert( !__is_trivially_constructible(int[], int), "" ); +static_assert( !__is_trivially_constructible(int[], int[]), "" ); +static_assert( !__is_trivially_constructible(int[], int(&)[]), "" ); +static_assert( !__is_trivially_constructible(int[], void), "" ); +struct A { }; +static_assert( !__is_constructible(A[]), "" ); +static_assert( !__is_constructible(A[], const A&), "" ); +static_assert( !__is_constructible(A[], const A[]), "" ); +static_assert( !__is_trivially_constructible(A[]), "" ); +static_assert( !__is_trivially_constructible(A[], const A&), "" ); +static_assert( !__is_trivially_constructible(A[], const A[]), "" ); +static_assert( !__is_trivially_constructible(A[], A(&)[]), "" ); +static_assert( !__is_trivially_constructible(A[], void), "" ); +struct B { B(); }; +static_assert( !__is_constructible(B[]), "" ); +static_assert( !__is_constructible(B[], const B&), "" ); +static_assert( !__is_trivially_constructible(B[]), "" ); +static_assert( !__is_trivially_constructible(B[], const B&), "" ); +static_assert( !__is_trivially_constructible(B[], const B[]), "" ); +static_assert( !__is_trivially_constructible(B[], B(&)[]), "" ); +static_assert( !__is_trivially_constructible(B[], void), "" ); diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 5aae6a39422..661d394d4e3 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,19 @@ +2019-05-20 Jonathan Wakely + + Backported from mainline + 2019-05-20 Jonathan Wakely + + PR c++/90532 Ensure __is_constructible(T[]) is false + * include/std/type_traits (__do_is_default_constructible_impl) + (__is_default_constructible_atom, __is_default_constructible_safe): + Remove. + (is_default_constructible): Use is_constructible. + * testsuite/20_util/is_constructible/value.cc: Check int[] case. + * testsuite/20_util/is_default_constructible/value.cc: Likewise. + * testsuite/20_util/is_trivially_constructible/value.cc: Likewise. + * testsuite/20_util/is_trivially_default_constructible/value.cc: + Likewise. + 2019-05-17 Jonathan Wakely Backport from mainline diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits index 220f4991546..e0394179963 100644 --- a/libstdc++-v3/include/std/type_traits +++ b/libstdc++-v3/include/std/type_traits @@ -867,58 +867,16 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION : public __is_nt_destructible_safe<_Tp>::type { }; - struct __do_is_default_constructible_impl - { - template - static true_type __test(int); - - template - static false_type __test(...); - }; - - template - struct __is_default_constructible_impl - : public __do_is_default_constructible_impl - { - typedef decltype(__test<_Tp>(0)) type; - }; - - template - struct __is_default_constructible_atom - : public __and_<__not_>, - __is_default_constructible_impl<_Tp>> - { }; - - template::value> - struct __is_default_constructible_safe; - - // The following technique is a workaround for a current core language - // restriction, which does not allow for array types to occur in - // functional casts of the form T(). Complete arrays can be default- - // constructed, if the element type is default-constructible, but - // arrays with unknown bounds are not. - template - struct __is_default_constructible_safe<_Tp, true> - : public __and_<__is_array_known_bounds<_Tp>, - __is_default_constructible_atom::type>> - { }; - - template - struct __is_default_constructible_safe<_Tp, false> - : public __is_default_constructible_atom<_Tp>::type + /// is_constructible + template + struct is_constructible + : public __bool_constant<__is_constructible(_Tp, _Args...)> { }; /// is_default_constructible template struct is_default_constructible - : public __is_default_constructible_safe<_Tp>::type - { }; - - /// is_constructible - template - struct is_constructible - : public __bool_constant<__is_constructible(_Tp, _Args...)> + : public is_constructible<_Tp>::type { }; template::value> diff --git a/libstdc++-v3/testsuite/20_util/is_constructible/value.cc b/libstdc++-v3/testsuite/20_util/is_constructible/value.cc index b461503c84f..ffabc999a62 100644 --- a/libstdc++-v3/testsuite/20_util/is_constructible/value.cc +++ b/libstdc++-v3/testsuite/20_util/is_constructible/value.cc @@ -35,4 +35,11 @@ void test01() static_assert(test_property(false), ""); static_assert(test_property(false), ""); + static_assert(test_property(false), "PR c++/90532"); + static_assert(test_property(false), "PR c++/90532"); + static_assert(test_property(false), "PR c++/90532"); + static_assert(test_property(false), "PR c++/90532"); } diff --git a/libstdc++-v3/testsuite/20_util/is_default_constructible/value.cc b/libstdc++-v3/testsuite/20_util/is_default_constructible/value.cc index 810810e7d49..9a646d9407a 100644 --- a/libstdc++-v3/testsuite/20_util/is_default_constructible/value.cc +++ b/libstdc++-v3/testsuite/20_util/is_default_constructible/value.cc @@ -138,3 +138,13 @@ static_assert(!std::is_default_constructible::value, "Error"); static_assert(!std::is_default_constructible::value, "Error"); static_assert(!std::is_default_constructible::value, "Error"); static_assert(!std::is_default_constructible::value, "Error"); + +static_assert(!std::is_default_constructible::value, "PR c++/90532"); +static_assert(!std::is_default_constructible::value, "PR c++/90532"); +static_assert(!std::is_default_constructible::value, "PR c++/90532"); +static_assert(!std::is_default_constructible::value, "PR c++/90532"); +static_assert(!std::is_default_constructible::value, "PR c++/90532"); +static_assert(!std::is_default_constructible::value, "PR c++/90532"); +static_assert(!std::is_default_constructible::value, "PR c++/90532"); +static_assert(!std::is_default_constructible::value, "PR c++/90532"); +static_assert(!std::is_default_constructible::value, "PR c++/90532"); diff --git a/libstdc++-v3/testsuite/20_util/is_trivially_constructible/value.cc b/libstdc++-v3/testsuite/20_util/is_trivially_constructible/value.cc index f260c2a7927..284d0973bf5 100644 --- a/libstdc++-v3/testsuite/20_util/is_trivially_constructible/value.cc +++ b/libstdc++-v3/testsuite/20_util/is_trivially_constructible/value.cc @@ -180,4 +180,6 @@ void test01() MoveOnly, const MoveOnly&>(false), ""); static_assert(test_property(false), ""); + static_assert(test_property(false), "PR c++/90532"); } diff --git a/libstdc++-v3/testsuite/20_util/is_trivially_default_constructible/value.cc b/libstdc++-v3/testsuite/20_util/is_trivially_default_constructible/value.cc index e77b38a0763..3cf3302f7f9 100644 --- a/libstdc++-v3/testsuite/20_util/is_trivially_default_constructible/value.cc +++ b/libstdc++-v3/testsuite/20_util/is_trivially_default_constructible/value.cc @@ -62,4 +62,13 @@ void test01() construct::Nontrivial>(false), ""); static_assert(test_category(true), ""); + + static_assert(test_category(false), "PR c++/90532"); + struct A { }; + static_assert(test_category(false), "PR c++/90532"); + struct B { B() { } }; + static_assert(test_category(false), "PR c++/90532"); } -- cgit v1.2.3 From f390252d13b5714b911275c1bbe15c1fa5e69d89 Mon Sep 17 00:00:00 2001 From: Jeff Law Date: Mon, 20 May 2019 19:10:27 +0000 Subject: * config/mips/mips.c (mips_dwarf_frame_reg_mode): Replace TARGET_FLOAT64 with !TARGET_FLOAT32, thus handling both fp64 and fpxx modes. * g++.dg/eh/o32-fp.C: New. * gcc.target/mips/dwarfregtable-1.c: New. * gcc.target/mips/dwarfregtable-2.c: New. * gcc.target/mips/dwarfregtable-3.c: New. * gcc.target/mips/dwarfregtable-4.c: New. * gcc.target/mips/dwarfregtable.h: New. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@271434 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 9 +++++ gcc/config/mips/mips.c | 2 +- gcc/testsuite/ChangeLog | 12 +++++++ gcc/testsuite/g++.dg/eh/o32-fp.C | 47 +++++++++++++++++++++++++ gcc/testsuite/gcc.target/mips/dwarfregtable-1.c | 5 +++ gcc/testsuite/gcc.target/mips/dwarfregtable-2.c | 5 +++ gcc/testsuite/gcc.target/mips/dwarfregtable-3.c | 5 +++ gcc/testsuite/gcc.target/mips/dwarfregtable-4.c | 5 +++ gcc/testsuite/gcc.target/mips/dwarfregtable.h | 22 ++++++++++++ 9 files changed, 111 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/eh/o32-fp.C create mode 100644 gcc/testsuite/gcc.target/mips/dwarfregtable-1.c create mode 100644 gcc/testsuite/gcc.target/mips/dwarfregtable-2.c create mode 100644 gcc/testsuite/gcc.target/mips/dwarfregtable-3.c create mode 100644 gcc/testsuite/gcc.target/mips/dwarfregtable-4.c create mode 100644 gcc/testsuite/gcc.target/mips/dwarfregtable.h diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e64f42d6b80..d963ed7169c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2019-05-20 Jeff Law + + Backport from mainline + 2019-05-17 Dragan Mladjenovic + + * config/mips/mips.c (mips_dwarf_frame_reg_mode): Replace + TARGET_FLOAT64 with !TARGET_FLOAT32, thus handling both fp64 + and fpxx modes. + 2019-05-16 Kelvin Nilsen Backport from mainline. diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c index aabd4b1580f..3981bcf2ea3 100644 --- a/gcc/config/mips/mips.c +++ b/gcc/config/mips/mips.c @@ -9532,7 +9532,7 @@ mips_dwarf_frame_reg_mode (int regno) { machine_mode mode = default_dwarf_frame_reg_mode (regno); - if (FP_REG_P (regno) && mips_abi == ABI_32 && TARGET_FLOAT64) + if (FP_REG_P (regno) && mips_abi == ABI_32 && !TARGET_FLOAT32) mode = SImode; return mode; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 4f01a866927..68fecaf20e5 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,15 @@ +2019-05-20 Jeff Law + + Backported from mainline + 2019-05-17 Dragan Mladjenovic + + * g++.dg/eh/o32-fp.C: New. + * gcc.target/mips/dwarfregtable-1.c: New. + * gcc.target/mips/dwarfregtable-2.c: New. + * gcc.target/mips/dwarfregtable-3.c: New. + * gcc.target/mips/dwarfregtable-4.c: New. + * gcc.target/mips/dwarfregtable.h: New. + 2019-05-20 Jonathan Wakely Backported from mainline diff --git a/gcc/testsuite/g++.dg/eh/o32-fp.C b/gcc/testsuite/g++.dg/eh/o32-fp.C new file mode 100644 index 00000000000..08fa51bc203 --- /dev/null +++ b/gcc/testsuite/g++.dg/eh/o32-fp.C @@ -0,0 +1,47 @@ +// Test whether call saved float are restored properly for O32 ABI +// { dg-do run { target { { { mips*-*-linux* } && hard_float } && { ! mips64 } } } } +// { dg-options "-O2" } + +void __attribute__((noinline)) +bar (void) +{ + throw 1; +} + +void __attribute__((noinline)) +foo (void) +{ + register double f20 __asm__ ("f20") = 0.0; + register double f22 __asm__ ("f22") = 0.0; + register double f24 __asm__ ("f24") = 0.0; + register double f26 __asm__ ("f26") = 0.0; + register double f28 __asm__ ("f28") = 0.0; + register double f30 __asm__ ("f30") = 0.0; + __asm__ __volatile__("":"+f"(f20),"+f"(f22),"+f"(f24),"+f"(f26),"+f"(f30)); + bar (); +} + +int +main (void) +{ + register double f20 __asm__ ("f20") = 12.0; + register double f22 __asm__ ("f22") = 13.0; + register double f24 __asm__ ("f24") = 14.0; + register double f26 __asm__ ("f26") = 15.0; + register double f28 __asm__ ("f28") = 16.0; + register double f30 __asm__ ("f30") = 17.0; + + try + { + foo (); + } + catch (...) + { + __asm__ ("":"+f"(f20),"+f"(f22),"+f"(f24),"+f"(f26),"+f"(f30)); + } + + if (f20 != 12.0 || f22 != 13.0 || f24 != 14.0 + || f26 != 15.0 || f28 != 16.0 || f30 != 17.0) + __builtin_abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.target/mips/dwarfregtable-1.c b/gcc/testsuite/gcc.target/mips/dwarfregtable-1.c new file mode 100644 index 00000000000..93d0844e6e8 --- /dev/null +++ b/gcc/testsuite/gcc.target/mips/dwarfregtable-1.c @@ -0,0 +1,5 @@ +/* Check if content of dwarf reg size table matches the expected. */ +/* { dg-do run } */ +/* { dg-options "-mabi=32 -mfp32" } */ + +#include "dwarfregtable.h" diff --git a/gcc/testsuite/gcc.target/mips/dwarfregtable-2.c b/gcc/testsuite/gcc.target/mips/dwarfregtable-2.c new file mode 100644 index 00000000000..c6dea942a13 --- /dev/null +++ b/gcc/testsuite/gcc.target/mips/dwarfregtable-2.c @@ -0,0 +1,5 @@ +/* Check if content of dwarf reg size table matches the expected. */ +/* { dg-do run } */ +/* { dg-options "-mabi=32 -mfpxx" } */ + +#include "dwarfregtable.h" diff --git a/gcc/testsuite/gcc.target/mips/dwarfregtable-3.c b/gcc/testsuite/gcc.target/mips/dwarfregtable-3.c new file mode 100644 index 00000000000..87937c4f0e1 --- /dev/null +++ b/gcc/testsuite/gcc.target/mips/dwarfregtable-3.c @@ -0,0 +1,5 @@ +/* Check if content of dwarf reg size table matches the expected. */ +/* { dg-do run } */ +/* { dg-options "-mabi=32 -mfp64" } */ + +#include "dwarfregtable.h" diff --git a/gcc/testsuite/gcc.target/mips/dwarfregtable-4.c b/gcc/testsuite/gcc.target/mips/dwarfregtable-4.c new file mode 100644 index 00000000000..2dd6dea3be7 --- /dev/null +++ b/gcc/testsuite/gcc.target/mips/dwarfregtable-4.c @@ -0,0 +1,5 @@ +/* Check if content of dwarf reg size table matches the expected. */ +/* { dg-do run } */ +/* { dg-options "-mabi=32 -mfp64 -modd-spreg" } */ + +#include "dwarfregtable.h" diff --git a/gcc/testsuite/gcc.target/mips/dwarfregtable.h b/gcc/testsuite/gcc.target/mips/dwarfregtable.h new file mode 100644 index 00000000000..403f65fb7b4 --- /dev/null +++ b/gcc/testsuite/gcc.target/mips/dwarfregtable.h @@ -0,0 +1,22 @@ + +typedef unsigned Unwind_Word __attribute__((__mode__(__unwind_word__))); + +#define DWARF_FRAME_REGISTERS 188 + +static unsigned char ref_dwarf_reg_size_table[DWARF_FRAME_REGISTERS + 1] = + { + [0 ... 66] = sizeof (Unwind_Word), + [80 ... 181] = sizeof (Unwind_Word) + }; + +static unsigned char dwarf_reg_size_table[DWARF_FRAME_REGISTERS + 1] = {}; + +int +main (void) +{ + __builtin_init_dwarf_reg_size_table (dwarf_reg_size_table); + if (__builtin_memcmp (ref_dwarf_reg_size_table, + dwarf_reg_size_table, DWARF_FRAME_REGISTERS + 1) != 0) + __builtin_abort (); + return 0; +} -- cgit v1.2.3 From 97d811614c0437591b31c7e4d2eda8c43e046d4a Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Tue, 21 May 2019 00:16:09 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@271447 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 544c8f4614e..2a1c9a61f83 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190520 +20190521 -- cgit v1.2.3 From 9ae2b9edaf758d41e22912d2cb550e763571e8eb Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Tue, 21 May 2019 04:43:06 +0000 Subject: [RTEMS] Change multilibs for ARM Account for Cortex-M3 Errata 602117. The -mfix-cortex-m3-ldrd option is enabled by default, if -mcpu=cortex-m3 is used. gcc/ * config/arm/t-rtems: Replace ARMv7-M multilibs with Cortex-M multilibs. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@271453 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 8 ++++++++ gcc/config/arm/t-rtems | 11 ++++++----- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d963ed7169c..18526a6b489 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2019-05-21 Sebastian Huber + + Backported from mainline + 2019-05-16 Sebastian Huber + + * config/arm/t-rtems: Replace ARMv7-M multilibs with Cortex-M + multilibs. + 2019-05-20 Jeff Law Backport from mainline diff --git a/gcc/config/arm/t-rtems b/gcc/config/arm/t-rtems index c07378657c8..94a2eb7dd0b 100644 --- a/gcc/config/arm/t-rtems +++ b/gcc/config/arm/t-rtems @@ -17,8 +17,8 @@ MULTILIB_DIRNAMES += eb MULTILIB_OPTIONS += mthumb MULTILIB_DIRNAMES += thumb -MULTILIB_OPTIONS += march=armv5te+fp/march=armv6-m/march=armv7-a/march=armv7-a+simd/march=armv7-r/march=armv7-r+fp/march=armv7-m/march=armv7e-m+fp/march=armv7e-m+fp.dp -MULTILIB_DIRNAMES += armv5te+fp armv6-m armv7-a armv7-a+simd armv7-r armv7-r+fp armv7-m armv7e-m+fp armv7e-m+fp.dp +MULTILIB_OPTIONS += march=armv5te+fp/march=armv6-m/march=armv7-a/march=armv7-a+simd/march=armv7-r/march=armv7-r+fp/mcpu=cortex-m3/mcpu=cortex-m4/mcpu=cortex-m4+nofp/mcpu=cortex-m7 +MULTILIB_DIRNAMES += armv5te+fp armv6-m armv7-a armv7-a+simd armv7-r armv7-r+fp cortex-m3 cortex-m4 cortex-m4+nofp cortex-m7 MULTILIB_OPTIONS += mfloat-abi=hard MULTILIB_DIRNAMES += hard @@ -31,7 +31,8 @@ MULTILIB_REQUIRED += mthumb/march=armv7-a+simd/mfloat-abi=hard MULTILIB_REQUIRED += mthumb/march=armv7-a MULTILIB_REQUIRED += mthumb/march=armv7-r+fp/mfloat-abi=hard MULTILIB_REQUIRED += mthumb/march=armv7-r -MULTILIB_REQUIRED += mthumb/march=armv7e-m+fp/mfloat-abi=hard -MULTILIB_REQUIRED += mthumb/march=armv7e-m+fp.dp/mfloat-abi=hard -MULTILIB_REQUIRED += mthumb/march=armv7-m +MULTILIB_REQUIRED += mthumb/mcpu=cortex-m3 +MULTILIB_REQUIRED += mthumb/mcpu=cortex-m4/mfloat-abi=hard +MULTILIB_REQUIRED += mthumb/mcpu=cortex-m4+nofp +MULTILIB_REQUIRED += mthumb/mcpu=cortex-m7/mfloat-abi=hard MULTILIB_REQUIRED += mthumb -- cgit v1.2.3 From e74e399710eb55c96e8fd7c8b7da5e08b5c5493a Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Wed, 22 May 2019 00:16:15 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@271494 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 2a1c9a61f83..e90ed15bef8 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190521 +20190522 -- cgit v1.2.3 From f4e1a8860592abbae7aad1655087c5b1874ae407 Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Wed, 22 May 2019 07:42:52 +0000 Subject: c-family/ Backport from mainline 2018-05-10 Eric Botcazou PR c++/85400 * c-attribs.c (handle_visibility_attribute): Do not set no_add_attrs. cp/ Backport from mainline 2018-05-10 Eric Botcazou PR c++/85400 * decl2.c (adjust_var_decl_tls_model): New static function. (comdat_linkage): Call it on a variable. (maybe_make_one_only): Likewise. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@271502 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/c-family/ChangeLog | 8 ++++++++ gcc/c-family/c-attribs.c | 5 ++--- gcc/cp/ChangeLog | 10 ++++++++++ gcc/cp/decl2.c | 16 ++++++++++++++++ gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/g++.dg/tls/pr85400.C | 24 ++++++++++++++++++++++++ 6 files changed, 64 insertions(+), 3 deletions(-) create mode 100644 gcc/testsuite/g++.dg/tls/pr85400.C diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index 904173f29df..aaa2b88e810 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,11 @@ +2019-05-22 Eric Botcazou + + Backport from mainline + 2018-05-10 Eric Botcazou + + PR c++/85400 + * c-attribs.c (handle_visibility_attribute): Do not set no_add_attrs. + 2019-04-30 Jakub Jelinek Backported from mainline diff --git a/gcc/c-family/c-attribs.c b/gcc/c-family/c-attribs.c index a7ca376c911..8f9f4702378 100644 --- a/gcc/c-family/c-attribs.c +++ b/gcc/c-family/c-attribs.c @@ -2310,14 +2310,13 @@ handle_visibility_attribute (tree *node, tree name, tree args, static tree handle_tls_model_attribute (tree *node, tree name, tree args, - int ARG_UNUSED (flags), bool *no_add_attrs) + int ARG_UNUSED (flags), + bool *ARG_UNUSED (no_add_attrs)) { tree id; tree decl = *node; enum tls_model kind; - *no_add_attrs = true; - if (!VAR_P (decl) || !DECL_THREAD_LOCAL_P (decl)) { warning (OPT_Wattributes, "%qE attribute ignored", name); diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 7dce9c0162b..f945e61e0af 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,13 @@ +2019-05-22 Eric Botcazou + + Backport from mainline + 2018-05-10 Eric Botcazou + + PR c++/85400 + * decl2.c (adjust_var_decl_tls_model): New static function. + (comdat_linkage): Call it on a variable. + (maybe_make_one_only): Likewise. + 2019-05-20 Jonathan Wakely Backported from mainline diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index c977e288d11..6977e5c4c91 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -1838,6 +1838,17 @@ mark_vtable_entries (tree decl) } } +/* Adjust the TLS model on variable DECL if need be, typically after + the linkage of DECL has been modified. */ + +static void +adjust_var_decl_tls_model (tree decl) +{ + if (CP_DECL_THREAD_LOCAL_P (decl) + && !lookup_attribute ("tls_model", DECL_ATTRIBUTES (decl))) + set_decl_tls_model (decl, decl_default_tls_model (decl)); +} + /* Set DECL up to have the closest approximation of "initialized common" linkage available. */ @@ -1888,6 +1899,9 @@ comdat_linkage (tree decl) if (TREE_PUBLIC (decl)) DECL_COMDAT (decl) = 1; + + if (VAR_P (decl)) + adjust_var_decl_tls_model (decl); } /* For win32 we also want to put explicit instantiations in @@ -1926,6 +1940,8 @@ maybe_make_one_only (tree decl) /* Mark it needed so we don't forget to emit it. */ node->forced_by_abi = true; TREE_USED (decl) = 1; + + adjust_var_decl_tls_model (decl); } } } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 68fecaf20e5..12f556c82d9 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2019-05-22 Eric Botcazou + + * g++.dg/tls/pr85400.C: New test. + 2019-05-20 Jeff Law Backported from mainline diff --git a/gcc/testsuite/g++.dg/tls/pr85400.C b/gcc/testsuite/g++.dg/tls/pr85400.C new file mode 100644 index 00000000000..f8d1bceaca5 --- /dev/null +++ b/gcc/testsuite/g++.dg/tls/pr85400.C @@ -0,0 +1,24 @@ +// PR c++/85400 +// Testcase by Brian Vandenberg + +// { dg-do link { target c++11 } } +// { dg-require-effective-target fpic } +// { dg-require-effective-target shared } +// { dg-require-effective-target tls } +// { dg-options "-shared -fPIC -O" } +// { dg-add-options tls } + +struct Test +{ + int blah (int y) + { + thread_local int mything = 3; + mything = y > 0 ? y : mything; + return mything; + } +}; + +int stuff (Test& test, int y) +{ + return test.blah(y); +} -- cgit v1.2.3 From 2be1a4aedb295565a180702b8354740317695f68 Mon Sep 17 00:00:00 2001 From: Uros Bizjak Date: Wed, 22 May 2019 22:50:39 +0000 Subject: =?UTF-8?q?=09Backported=20from=20mainline=20=092019-05-21=20=20Ur?= =?UTF-8?q?o=C5=A1=20Bizjak=20=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * config/i386/cpuid.h (__cpuid): For 32bit targets, zero %ebx and %ecx bafore calling cpuid with leaf 1 or non-constant leaf argument. 2019-05-21 Uroš Bizjak PR target/90547 * config/i386/i386.md (anddi_1 to andsi_1_zext splitter): Avoid calling gen_lowpart with CONST operand. testsuite/ChangeLog: Backported from mainline 2019-05-21 Uroš Bizjak PR target/90547 * gcc.target/i386/pr90547.c: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@271529 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 15 +++++++++++++++ gcc/config/i386/cpuid.h | 17 +++++++++++++++++ gcc/config/i386/i386.md | 8 ++++++++ gcc/testsuite/ChangeLog | 8 ++++++++ gcc/testsuite/gcc.target/i386/pr90547.c | 21 +++++++++++++++++++++ 5 files changed, 69 insertions(+) create mode 100644 gcc/testsuite/gcc.target/i386/pr90547.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 18526a6b489..3ab35443c55 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,18 @@ +2019-05-23 Uroš Bizjak + + Backported from mainline + 2019-05-21 Uroš Bizjak + + * config/i386/cpuid.h (__cpuid): For 32bit targets, zero + %ebx and %ecx bafore calling cpuid with leaf 1 or + non-constant leaf argument. + + 2019-05-21 Uroš Bizjak + + PR target/90547 + * config/i386/i386.md (anddi_1 to andsi_1_zext splitter): + Avoid calling gen_lowpart with CONST operand. + 2019-05-21 Sebastian Huber Backported from mainline diff --git a/gcc/config/i386/cpuid.h b/gcc/config/i386/cpuid.h index a26c5e49795..962e7532a85 100644 --- a/gcc/config/i386/cpuid.h +++ b/gcc/config/i386/cpuid.h @@ -178,10 +178,27 @@ #define signature_VORTEX_ecx 0x436f5320 #define signature_VORTEX_edx 0x36387865 +#ifndef __x86_64__ +/* At least one cpu (Winchip 2) does not set %ebx and %ecx + for cpuid leaf 1. Forcibly zero the two registers before + calling cpuid as a precaution. */ +#define __cpuid(level, a, b, c, d) \ + do { \ + if (__builtin_constant_p (level) && (level) != 1) \ + __asm__ ("cpuid\n\t" \ + : "=a" (a), "=b" (b), "=c" (c), "=d" (d) \ + : "0" (level)); \ + else \ + __asm__ ("cpuid\n\t" \ + : "=a" (a), "=b" (b), "=c" (c), "=d" (d) \ + : "0" (level), "1" (0), "2" (0)); \ + } while (0) +#else #define __cpuid(level, a, b, c, d) \ __asm__ ("cpuid\n\t" \ : "=a" (a), "=b" (b), "=c" (c), "=d" (d) \ : "0" (level)) +#endif #define __cpuid_count(level, count, a, b, c, d) \ __asm__ ("cpuid\n\t" \ diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md index 417b6e61a7e..2bb58236d88 100644 --- a/gcc/config/i386/i386.md +++ b/gcc/config/i386/i386.md @@ -8949,6 +8949,14 @@ operands[2] = shallow_copy_rtx (operands[2]); PUT_MODE (operands[2], SImode); } + else if (GET_CODE (operands[2]) == CONST) + { + /* (const:DI (plus:DI (symbol_ref:DI ("...")) (const_int N))) */ + operands[2] = copy_rtx (operands[2]); + PUT_MODE (operands[2], SImode); + PUT_MODE (XEXP (operands[2], 0), SImode); + PUT_MODE (XEXP (XEXP (operands[2], 0), 0), SImode); + } else operands[2] = gen_lowpart (SImode, operands[2]); }) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 12f556c82d9..06acca854f5 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2019-05-23 Uroš Bizjak + + Backported from mainline + 2019-05-21 Uroš Bizjak + + PR target/90547 + * gcc.target/i386/pr90547.c: New test. + 2019-05-22 Eric Botcazou * g++.dg/tls/pr85400.C: New test. diff --git a/gcc/testsuite/gcc.target/i386/pr90547.c b/gcc/testsuite/gcc.target/i386/pr90547.c new file mode 100644 index 00000000000..fcfe66953b0 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr90547.c @@ -0,0 +1,21 @@ +/* PR target/90547 */ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +void +foo () +{ + void *g[] = {&&a, &&b}; + + for (unsigned c = 0x1F;; c >>= 1) + { + unsigned d = (long)("a"+1); + long e = 8; + + while (e) + { + a: goto *g[c&d]; + b: e--; + } + } +} -- cgit v1.2.3 From 8f3b0365bc84ba20de9def073ba1a582792da678 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Thu, 23 May 2019 00:16:08 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@271532 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index e90ed15bef8..63809aa8159 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190522 +20190523 -- cgit v1.2.3 From 3e4a108e0f316d53b1435189a045aae8132bc1e2 Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Thu, 23 May 2019 09:51:39 +0000 Subject: * gnat.dg/opt78.ad[sb]: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@271547 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/gnat.dg/opt78.adb | 16 ++++++++++++++++ gcc/testsuite/gnat.dg/opt78.ads | 13 +++++++++++++ 3 files changed, 33 insertions(+) create mode 100644 gcc/testsuite/gnat.dg/opt78.adb create mode 100644 gcc/testsuite/gnat.dg/opt78.ads diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 06acca854f5..b8e6b9abaf0 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2019-05-23 Eric Botcazou + + * gnat.dg/opt78.ad[sb]: New test. + 2019-05-23 Uroš Bizjak Backported from mainline diff --git a/gcc/testsuite/gnat.dg/opt78.adb b/gcc/testsuite/gnat.dg/opt78.adb new file mode 100644 index 00000000000..e46c92b2759 --- /dev/null +++ b/gcc/testsuite/gnat.dg/opt78.adb @@ -0,0 +1,16 @@ +-- { dg-do compile } +-- { dg-options "-O" } + +package body Opt78 is + + procedure Proc (P : UC; Msg : String) is + Default : UC := (1, "!"); + begin + if P = Default then + raise Program_Error; + else + raise Constraint_Error; + end if; + end; + +end Opt78; diff --git a/gcc/testsuite/gnat.dg/opt78.ads b/gcc/testsuite/gnat.dg/opt78.ads new file mode 100644 index 00000000000..2c489bd7b38 --- /dev/null +++ b/gcc/testsuite/gnat.dg/opt78.ads @@ -0,0 +1,13 @@ +package Opt78 is + + subtype Reasonable is Integer range 1..10; + + type UC (D: Reasonable := 2) is record + S: String (1 .. D) := "Hi"; + end record; + + type AUC is access all UC; + + procedure Proc (P : UC; Msg : String); + +end Opt78; -- cgit v1.2.3 From 1806056138552f2faebde8e76b0c10ffebddfc1e Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Thu, 23 May 2019 14:49:10 +0000 Subject: Fix missing or incorrect feature test macros Backported from mainline 2019-01-15 Jonathan Wakely * doc/xml/manual/status_cxx2017.xml: Document P0032R3 and P0307R2 status. * include/bits/stl_uninitialized.h (__cpp_lib_raw_memory_algorithms): Define. * include/std/any (__cpp_lib_any): Define as 201606L, because P0032R3 changes are supported. * include/std/optional (__cpp_lib_optional): Likewise. * include/std/variant (__cpp_lib_variant): Likewise. * libsupc++/exception (__cpp_lib_uncaught_exceptions): Define as long integer. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@271560 138bc75d-0d04-0410-961f-82ee72b054a4 --- libstdc++-v3/ChangeLog | 16 +++++++++++++++ libstdc++-v3/doc/xml/manual/status_cxx2017.xml | 27 +++++++++++++++++++++++++- libstdc++-v3/include/bits/stl_uninitialized.h | 6 ++++-- libstdc++-v3/include/std/any | 2 +- libstdc++-v3/include/std/optional | 2 +- libstdc++-v3/include/std/variant | 2 +- libstdc++-v3/libsupc++/exception | 4 ++-- 7 files changed, 51 insertions(+), 8 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 661d394d4e3..8e9675d5e2d 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,19 @@ +2019-05-23 Jonathan Wakely + + Backported from mainline + 2019-01-15 Jonathan Wakely + + * doc/xml/manual/status_cxx2017.xml: Document P0032R3 and P0307R2 + status. + * include/bits/stl_uninitialized.h (__cpp_lib_raw_memory_algorithms): + Define. + * include/std/any (__cpp_lib_any): Define as 201606L, because P0032R3 + changes are supported. + * include/std/optional (__cpp_lib_optional): Likewise. + * include/std/variant (__cpp_lib_variant): Likewise. + * libsupc++/exception (__cpp_lib_uncaught_exceptions): Define as long + integer. + 2019-05-20 Jonathan Wakely Backported from mainline diff --git a/libstdc++-v3/doc/xml/manual/status_cxx2017.xml b/libstdc++-v3/doc/xml/manual/status_cxx2017.xml index aa0914cff72..e1d658f92dd 100644 --- a/libstdc++-v3/doc/xml/manual/status_cxx2017.xml +++ b/libstdc++-v3/doc/xml/manual/status_cxx2017.xml @@ -382,7 +382,7 @@ Feature-testing recommendations for C++. 7.1 - + __cpp_lib_raw_memory_algorithms >= 201606L @@ -788,6 +788,31 @@ Feature-testing recommendations for C++. __cpp_lib_to_chars >= 201611 + + Homogeneous interface for variant, any and optional + + + P0032R3 + + + 7.1 + + __cpp_lib_any >= 201606 , + __cpp_lib_optional >= 201606 , + __cpp_lib_variant >= 201606 + + + + + Making Optional Greater Equal Again + + + P0307R2 + + + 7.1 + __cpp_lib_optional >= 201606 + diff --git a/libstdc++-v3/include/bits/stl_uninitialized.h b/libstdc++-v3/include/bits/stl_uninitialized.h index c740503052b..bb460f28e78 100644 --- a/libstdc++-v3/include/bits/stl_uninitialized.h +++ b/libstdc++-v3/include/bits/stl_uninitialized.h @@ -826,7 +826,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION #endif -#if __cplusplus > 201402L +#if __cplusplus >= 201703L +# define __cpp_lib_raw_memory_algorithms 201606L + template inline void uninitialized_default_construct(_ForwardIterator __first, @@ -877,7 +879,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION __count, __result); return {__res.first.base(), __res.second}; } -#endif +#endif // C++17 _GLIBCXX_END_NAMESPACE_VERSION } // namespace diff --git a/libstdc++-v3/include/std/any b/libstdc++-v3/include/std/any index a37eb38d665..e88e7fb0b6c 100644 --- a/libstdc++-v3/include/std/any +++ b/libstdc++-v3/include/std/any @@ -66,7 +66,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION #endif } -#define __cpp_lib_any 201603 +#define __cpp_lib_any 201606L /** * @brief A type-safe container of any type. diff --git a/libstdc++-v3/include/std/optional b/libstdc++-v3/include/std/optional index 9f5d24e0220..20153fb24c5 100644 --- a/libstdc++-v3/include/std/optional +++ b/libstdc++-v3/include/std/optional @@ -51,7 +51,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION * @{ */ -#define __cpp_lib_optional 201603 +#define __cpp_lib_optional 201606L template class optional; diff --git a/libstdc++-v3/include/std/variant b/libstdc++-v3/include/std/variant index ee39c4fc001..150d37505bc 100644 --- a/libstdc++-v3/include/std/variant +++ b/libstdc++-v3/include/std/variant @@ -68,7 +68,7 @@ namespace __variant } // namespace __variant } // namespace __detail -#define __cpp_lib_variant 201603 +#define __cpp_lib_variant 201606L template class tuple; template class variant; diff --git a/libstdc++-v3/libsupc++/exception b/libstdc++-v3/libsupc++/exception index e965961c0d8..d81e52634f6 100644 --- a/libstdc++-v3/libsupc++/exception +++ b/libstdc++-v3/libsupc++/exception @@ -101,8 +101,8 @@ namespace std _GLIBCXX17_DEPRECATED bool uncaught_exception() _GLIBCXX_USE_NOEXCEPT __attribute__ ((__pure__)); -#if __cplusplus > 201402L || !defined(__STRICT_ANSI__) // c++17 or gnu++98 -#define __cpp_lib_uncaught_exceptions 201411 +#if __cplusplus >= 201703L || !defined(__STRICT_ANSI__) // c++17 or gnu++98 +#define __cpp_lib_uncaught_exceptions 201411L /// The number of uncaught exceptions. int uncaught_exceptions() _GLIBCXX_USE_NOEXCEPT __attribute__ ((__pure__)); #endif -- cgit v1.2.3 From d40053255a33b81c19ad89180b0d5f1fc4603b03 Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Thu, 23 May 2019 14:49:15 +0000 Subject: PR libstdc++/90220 Fix any_cast for non-object types Backport from mainline 2019-04-24 Jonathan Wakely PR libstdc++/90220 (partial) * include/std/any (any_cast(any*), any_cast(const any*)): Do not attempt ill-formed static_cast to pointers to non-object types. * testsuite/20_util/any/misc/any_cast.cc: Test std::any_cast with function types. Backport from mainline 2019-04-24 Jonathan Wakely PR libstdc++/90220 * include/std/any (__any_caster): Use remove_cv_t instead of decay_t. Avoid a runtime check for types that can never be stored in std::any. * testsuite/20_util/any/misc/any_cast.cc: Test std::any_cast with array types. Backport from mainline 2019-05-23 Jonathan Wakely PR libstdc++/90220 * include/experimental/any (__any_caster): Constrain to only be callable for object types. Use remove_cv_t instead of decay_t. If the type decays or isn't copy constructible, compare the manager function to a dummy specialization. (__any_caster): Add overload constrained for non-object types. (any::_Manager_internal<_Op>): Add dummy specialization. * testsuite/experimental/any/misc/any_cast.cc: Test function types and array types. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@271561 138bc75d-0d04-0410-961f-82ee72b054a4 --- libstdc++-v3/ChangeLog | 33 +++++++++++++ libstdc++-v3/include/experimental/any | 38 +++++++++++++-- libstdc++-v3/include/std/any | 32 ++++++++----- .../testsuite/20_util/any/misc/any_cast.cc | 51 ++++++++++++++++++++ .../testsuite/experimental/any/misc/any_cast.cc | 56 ++++++++++++++++++++-- 5 files changed, 191 insertions(+), 19 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 8e9675d5e2d..ddea0c663ed 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,36 @@ +2019-05-23 Jonathan Wakely + + Backport from mainline + 2019-05-23 Jonathan Wakely + + PR libstdc++/90220 + * include/experimental/any (__any_caster): Constrain to only be + callable for object types. Use remove_cv_t instead of decay_t. + If the type decays or isn't copy constructible, compare the manager + function to a dummy specialization. + (__any_caster): Add overload constrained for non-object types. + (any::_Manager_internal<_Op>): Add dummy specialization. + * testsuite/experimental/any/misc/any_cast.cc: Test function types + and array types. + + Backport from mainline + 2019-04-24 Jonathan Wakely + + PR libstdc++/90220 + * include/std/any (__any_caster): Use remove_cv_t instead of decay_t. + Avoid a runtime check for types that can never be stored in std::any. + * testsuite/20_util/any/misc/any_cast.cc: Test std::any_cast with + array types. + + Backport from mainline + 2019-04-24 Jonathan Wakely + + PR libstdc++/90220 (partial) + * include/std/any (any_cast(any*), any_cast(const any*)): Do + not attempt ill-formed static_cast to pointers to non-object types. + * testsuite/20_util/any/misc/any_cast.cc: Test std::any_cast with + function types. + 2019-05-23 Jonathan Wakely Backported from mainline diff --git a/libstdc++-v3/include/experimental/any b/libstdc++-v3/include/experimental/any index 641c2cb9c31..67c7cd5f5a0 100644 --- a/libstdc++-v3/include/experimental/any +++ b/libstdc++-v3/include/experimental/any @@ -300,7 +300,8 @@ inline namespace fundamentals_v1 _Storage _M_storage; template - friend void* __any_caster(const any* __any); + friend enable_if_t::value, void*> + __any_caster(const any* __any); // Manage in-place contained object. template @@ -410,12 +411,24 @@ inline namespace fundamentals_v1 } // @} + /// @cond undocumented template - void* __any_caster(const any* __any) + enable_if_t::value, void*> + __any_caster(const any* __any) { - struct _None { }; - using _Up = decay_t<_Tp>; - using _Vp = conditional_t::value, _Up, _None>; + // any_cast returns non-null if __any->type() == typeid(T) and + // typeid(T) ignores cv-qualifiers so remove them: + using _Up = remove_cv_t<_Tp>; + // The contained value has a decayed type, so if decay_t is not U, + // then it's not possible to have a contained value of type U. + using __does_not_decay = is_same, _Up>; + // Only copy constructible types can be used for contained values. + using __is_copyable = is_copy_constructible<_Up>; + // If the type _Tp could never be stored in an any we don't want to + // instantiate _Manager<_Tp>, so use _Manager instead, which + // is explicitly specialized and has a no-op _S_manage function. + using _Vp = conditional_t<__and_<__does_not_decay, __is_copyable>::value, + _Up, any::_Op>; if (__any->_M_manager != &any::_Manager<_Vp>::_S_manage) return nullptr; any::_Arg __arg; @@ -423,6 +436,13 @@ inline namespace fundamentals_v1 return __arg._M_obj; } + // This overload exists so that std::any_cast(a) is well-formed. + template + enable_if_t::value, _Tp*> + __any_caster(const any*) noexcept + { return nullptr; } + /// @endcond + /** * @brief Access the contained object. * @@ -517,6 +537,14 @@ inline namespace fundamentals_v1 } } + // Dummy specialization used by __any_caster. + template<> + struct any::_Manager_internal + { + static void + _S_manage(_Op, const any*, _Arg*) { } + }; + // @} group any } // namespace fundamentals_v1 } // namespace experimental diff --git a/libstdc++-v3/include/std/any b/libstdc++-v3/include/std/any index e88e7fb0b6c..86b33fa5da8 100644 --- a/libstdc++-v3/include/std/any +++ b/libstdc++-v3/include/std/any @@ -506,14 +506,22 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template void* __any_caster(const any* __any) { - if constexpr (is_copy_constructible_v>) + // any_cast returns non-null if __any->type() == typeid(T) and + // typeid(T) ignores cv-qualifiers so remove them: + using _Up = remove_cv_t<_Tp>; + // The contained value has a decayed type, so if decay_t is not U, + // then it's not possible to have a contained value of type U: + if constexpr (!is_same_v, _Up>) + return nullptr; + // Only copy constructible types can be used for contained values: + else if constexpr (!is_copy_constructible_v<_Up>) + return nullptr; + // This check is equivalent to __any->type() == typeid(_Tp) + else if (__any->_M_manager == &any::_Manager<_Up>::_S_manage) { - if (__any->_M_manager == &any::_Manager>::_S_manage) - { - any::_Arg __arg; - __any->_M_manager(any::_Op_access, __any, &__arg); - return __arg._M_obj; - } + any::_Arg __arg; + __any->_M_manager(any::_Op_access, __any, &__arg); + return __arg._M_obj; } return nullptr; } @@ -532,16 +540,18 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template inline const _ValueType* any_cast(const any* __any) noexcept { - if (__any) - return static_cast<_ValueType*>(__any_caster<_ValueType>(__any)); + if constexpr (is_object_v<_ValueType>) + if (__any) + return static_cast<_ValueType*>(__any_caster<_ValueType>(__any)); return nullptr; } template inline _ValueType* any_cast(any* __any) noexcept { - if (__any) - return static_cast<_ValueType*>(__any_caster<_ValueType>(__any)); + if constexpr (is_object_v<_ValueType>) + if (__any) + return static_cast<_ValueType*>(__any_caster<_ValueType>(__any)); return nullptr; } // @} diff --git a/libstdc++-v3/testsuite/20_util/any/misc/any_cast.cc b/libstdc++-v3/testsuite/20_util/any/misc/any_cast.cc index 37a24d7653a..6508ca1e246 100644 --- a/libstdc++-v3/testsuite/20_util/any/misc/any_cast.cc +++ b/libstdc++-v3/testsuite/20_util/any/misc/any_cast.cc @@ -20,6 +20,7 @@ #include #include +#include #include #include @@ -121,6 +122,54 @@ void test05() VERIFY( p == nullptr ); } +void test06() +{ + // The contained value of a std::any is always an object type, + // but std::any_cast does not forbid checking for function types. + + any a(1); + void (*p1)() = any_cast(&a); + VERIFY( p1 == nullptr ); + int (*p2)(int) = any_cast(&a); + VERIFY( p2 == nullptr ); + int (*p3)() = any_cast(&std::as_const(a)); + VERIFY( p3 == nullptr ); + + try { + any_cast(a); + VERIFY( false ); + } catch (const std::bad_any_cast&) { + } + + try { + any_cast(std::move(a)); + VERIFY( false ); + } catch (const std::bad_any_cast&) { + } + + try { + any_cast(std::as_const(a)); + VERIFY( false ); + } catch (const std::bad_any_cast&) { + } +} + +void test07() +{ + int arr[3]; + any a(arr); + VERIFY( a.type() == typeid(int*) ); // contained value is decayed + + int (*p1)[3] = any_cast(&a); + VERIFY( a.type() != typeid(int[3]) ); // so any_cast should return nullptr + VERIFY( p1 == nullptr ); + int (*p2)[] = any_cast(&a); + VERIFY( a.type() != typeid(int[]) ); // so any_cast should return nullptr + VERIFY( p2 == nullptr ); + const int (*p3)[] = any_cast(&std::as_const(a)); + VERIFY( p3 == nullptr ); +} + int main() { test01(); @@ -128,4 +177,6 @@ int main() test03(); test04(); test05(); + test06(); + test07(); } diff --git a/libstdc++-v3/testsuite/experimental/any/misc/any_cast.cc b/libstdc++-v3/testsuite/experimental/any/misc/any_cast.cc index 0b21c92ac10..d9be41238d1 100644 --- a/libstdc++-v3/testsuite/experimental/any/misc/any_cast.cc +++ b/libstdc++-v3/testsuite/experimental/any/misc/any_cast.cc @@ -24,6 +24,7 @@ using std::experimental::any; using std::experimental::any_cast; +using std::experimental::bad_any_cast; void test01() { @@ -56,7 +57,6 @@ void test01() void test02() { - using std::experimental::bad_any_cast; any x(1); auto p = any_cast(&x); VERIFY(p == nullptr); @@ -105,7 +105,7 @@ void test03() MoveDeleted&& md3 = any_cast(any(std::move(md))); } -void test04() +void test05() { // PR libstdc++/69321 struct noncopyable { @@ -117,10 +117,60 @@ void test04() VERIFY( p == nullptr ); } +void test06() +{ + // The contained value of a std::any is always an object type, + // but any_cast does not forbid checking for function types. + + any a(1); + void (*p1)() = any_cast(&a); + VERIFY( p1 == nullptr ); + int (*p2)(int) = any_cast(&a); + VERIFY( p2 == nullptr ); + int (*p3)() = any_cast(&const_cast(a)); + VERIFY( p3 == nullptr ); + + try { + any_cast(a); + VERIFY( false ); + } catch (const bad_any_cast&) { + } + + try { + any_cast(std::move(a)); + VERIFY( false ); + } catch (const bad_any_cast&) { + } + + try { + any_cast(const_cast(a)); + VERIFY( false ); + } catch (const bad_any_cast&) { + } +} + +void test07() +{ + int arr[3]; + any a(arr); + VERIFY( a.type() == typeid(int*) ); // contained value is decayed + + int (*p1)[3] = any_cast(&a); + VERIFY( a.type() != typeid(int[3]) ); // so any_cast should return nullptr + VERIFY( p1 == nullptr ); + int (*p2)[] = any_cast(&a); + VERIFY( a.type() != typeid(int[]) ); // so any_cast should return nullptr + VERIFY( p2 == nullptr ); + const int (*p3)[] = any_cast(&const_cast(a)); + VERIFY( p3 == nullptr ); +} + int main() { test01(); test02(); test03(); - test04(); + test05(); + test06(); + test07(); } -- cgit v1.2.3 From 03f140e68bbd26cb9774b7bea30d92350ad351fc Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Thu, 23 May 2019 14:49:21 +0000 Subject: Make any_cast compare typeinfo as well as function pointers It's possible for the function pointer comparison to fail even though the type is correct, because the function could be defined multiple times with different addresses when shared libraries are in use. Retain the function pointer check for the common case where the check succeeds, but compare typeinfo (if RTTI is enabled) if the first check fails. Backport from mainline 2019-05-23 Jonathan Wakely * include/experimental/any (__any_caster): Use RTTI if comparing addresses fails, to support non-unique addresses in shared libraries. * include/std/any (__any_caster): Likewise. * testsuite/experimental/any/misc/any_cast_neg.cc: Use 0 for dg-error line number. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@271562 138bc75d-0d04-0410-961f-82ee72b054a4 --- libstdc++-v3/ChangeLog | 11 +++++++++++ libstdc++-v3/include/experimental/any | 17 ++++++++++++----- libstdc++-v3/include/std/any | 10 ++++++++-- .../testsuite/experimental/any/misc/any_cast_neg.cc | 2 +- 4 files changed, 32 insertions(+), 8 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index ddea0c663ed..fac55ce41ac 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,14 @@ +2019-05-23 Jonathan Wakely + + Backport from mainline + 2019-05-23 Jonathan Wakely + + * include/experimental/any (__any_caster): Use RTTI if comparing + addresses fails, to support non-unique addresses in shared libraries. + * include/std/any (__any_caster): Likewise. + * testsuite/experimental/any/misc/any_cast_neg.cc: Use 0 for dg-error + line number. + 2019-05-23 Jonathan Wakely Backport from mainline diff --git a/libstdc++-v3/include/experimental/any b/libstdc++-v3/include/experimental/any index 67c7cd5f5a0..fe5c822dd50 100644 --- a/libstdc++-v3/include/experimental/any +++ b/libstdc++-v3/include/experimental/any @@ -429,11 +429,18 @@ inline namespace fundamentals_v1 // is explicitly specialized and has a no-op _S_manage function. using _Vp = conditional_t<__and_<__does_not_decay, __is_copyable>::value, _Up, any::_Op>; - if (__any->_M_manager != &any::_Manager<_Vp>::_S_manage) - return nullptr; - any::_Arg __arg; - __any->_M_manager(any::_Op_access, __any, &__arg); - return __arg._M_obj; + // First try comparing function addresses, which works without RTTI + if (__any->_M_manager == &any::_Manager<_Vp>::_S_manage +#if __cpp_rtti + || __any->type() == typeid(_Tp) +#endif + ) + { + any::_Arg __arg; + __any->_M_manager(any::_Op_access, __any, &__arg); + return __arg._M_obj; + } + return nullptr; } // This overload exists so that std::any_cast(a) is well-formed. diff --git a/libstdc++-v3/include/std/any b/libstdc++-v3/include/std/any index 86b33fa5da8..0aa9281be83 100644 --- a/libstdc++-v3/include/std/any +++ b/libstdc++-v3/include/std/any @@ -503,6 +503,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } // @} + /// @cond undocumented template void* __any_caster(const any* __any) { @@ -516,8 +517,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION // Only copy constructible types can be used for contained values: else if constexpr (!is_copy_constructible_v<_Up>) return nullptr; - // This check is equivalent to __any->type() == typeid(_Tp) - else if (__any->_M_manager == &any::_Manager<_Up>::_S_manage) + // First try comparing function addresses, which works without RTTI + else if (__any->_M_manager == &any::_Manager<_Up>::_S_manage +#if __cpp_rtti + || __any->type() == typeid(_Tp) +#endif + ) { any::_Arg __arg; __any->_M_manager(any::_Op_access, __any, &__arg); @@ -525,6 +530,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } return nullptr; } + /// @endcond /** * @brief Access the contained object. diff --git a/libstdc++-v3/testsuite/experimental/any/misc/any_cast_neg.cc b/libstdc++-v3/testsuite/experimental/any/misc/any_cast_neg.cc index b71234c9c39..8bfffb10370 100644 --- a/libstdc++-v3/testsuite/experimental/any/misc/any_cast_neg.cc +++ b/libstdc++-v3/testsuite/experimental/any/misc/any_cast_neg.cc @@ -25,5 +25,5 @@ void test01() using std::experimental::any_cast; const any y(1); - any_cast(y); // { dg-error "qualifiers" "" { target { *-*-* } } 357 } + any_cast(y); // { dg-error "qualifiers" "" { target { *-*-* } } 0 } } -- cgit v1.2.3 From d0ae6665baa47be52c45da664e7d423309b49e2a Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Thu, 23 May 2019 15:06:30 +0000 Subject: Regenerate libstdc++ docs * doc/html/*: Regenerate. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@271563 138bc75d-0d04-0410-961f-82ee72b054a4 --- libstdc++-v3/ChangeLog | 4 ++ libstdc++-v3/doc/html/faq.html | 26 +++++++++---- libstdc++-v3/doc/html/index.html | 2 +- libstdc++-v3/doc/html/manual/api.html | 9 +++-- libstdc++-v3/doc/html/manual/bugs.html | 10 +++++ libstdc++-v3/doc/html/manual/debug.html | 64 ++++++++++++++++++-------------- libstdc++-v3/doc/html/manual/index.html | 2 +- libstdc++-v3/doc/html/manual/intro.html | 2 +- libstdc++-v3/doc/html/manual/status.html | 16 +++++++- libstdc++-v3/doc/html/manual/using.html | 2 +- 10 files changed, 93 insertions(+), 44 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index fac55ce41ac..da76b77e142 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,7 @@ +2019-05-23 Jonathan Wakely + + * doc/html/*: Regenerate. + 2019-05-23 Jonathan Wakely Backport from mainline diff --git a/libstdc++-v3/doc/html/faq.html b/libstdc++-v3/doc/html/faq.html index a0208269dd8..1f6934ef4c8 100644 --- a/libstdc++-v3/doc/html/faq.html +++ b/libstdc++-v3/doc/html/faq.html @@ -70,7 +70,7 @@ Program crashes when using library code in a dynamically-loaded library
6.7. - “Memory leaks” in containers + “Memory leaks” in libstdc++
6.8. list::size() is O(n)!
6.9. @@ -593,7 +593,7 @@ Program crashes when using library code in a dynamically-loaded library
6.7. - “Memory leaks” in containers + “Memory leaks” in libstdc++
6.8. list::size() is O(n)!
6.9. @@ -708,15 +708,27 @@     Link the executable:
    g++ -fPIC -rdynamic -o foo ... -L. -lfoo -ldl
    

6.7.

- Memory leaks in containers -

Note

This answer is old and probably no longer be relevant.

- A few people have reported that the standard containers appear + Memory leaks in libstdc++ +

+ Since GCC 5.1.0, libstdc++ automatically allocates a pool + of a few dozen kilobytes on startup. This pool is used to ensure it's + possible to throw exceptions (such as bad_alloc) + even when malloc is unable to allocate any more memory. + With some versions of valgrind + this pool will be shown as "still reachable" when the process exits, e.g. + still reachable: 72,704 bytes in 1 blocks. + This memory is not a leak, because it's still in use by libstdc++, + and the memory will be returned to the OS when the process exits. + Later versions of valgrind know how to free this + pool as the process exits, and so won't show any "still reachable" memory. +

+ In the past, a few people reported that the standard containers appear to leak memory when tested with memory checkers such as valgrind. Under some (non-default) configurations the library's allocators keep free memory in a - pool for later reuse, rather than returning it to the OS. Although - this memory is always reachable by the library and is never + pool for later reuse, rather than deallocating it with delete + Although this memory is always reachable by the library and is never lost, memory debugging tools can report it as a leak. If you want to test the library for memory leaks please read Tips for memory leak hunting diff --git a/libstdc++-v3/doc/html/index.html b/libstdc++-v3/doc/html/index.html index 30f0145607a..10955df7629 100644 --- a/libstdc++-v3/doc/html/index.html +++ b/libstdc++-v3/doc/html/index.html @@ -23,7 +23,7 @@


Table of Contents

The GNU C++ Library Manual
I. Introduction -
1. Status
Implementation Status
C++ 1998/2003
Implementation Status
Implementation Specific Behavior
C++ 2011
Implementation Specific Behavior
C++ 2014
C++ 2017
Implementation Specific Behavior
C++ TR1
Implementation Specific Behavior
C++ TR 24733
C++ IS 29124
Implementation Specific Behavior
License
The Code: GPL
The Documentation: GPL, FDL
Bugs
Implementation Bugs
Standard Bugs
2. Setup
Prerequisites
Configure
Make
3. Using
Command Options
Headers
Header Files
Mixing Headers
The C Headers and namespace std
Precompiled Headers
Macros
Dual ABI
Troubleshooting
Namespaces
Available Namespaces
namespace std
Using Namespace Composition
Linking
Almost Nothing
Finding Dynamic or Shared Libraries
Experimental Library Extensions
Concurrency
Prerequisites
Thread Safety
Atomics
IO
Structure
Defaults
Future
Alternatives
Containers
Exceptions
Exception Safety
Exception Neutrality
Doing without
Compatibility
With C
With POSIX thread cancellation
Debugging Support
Using g++
Debug Versions of Library Binary Files
Memory Leak Hunting
Data Race Hunting
Using gdb
Tracking uncaught exceptions
Debug Mode
Compile Time Checking
Profile-based Performance Analysis
II. +
1. Status
Implementation Status
C++ 1998/2003
Implementation Status
Implementation Specific Behavior
C++ 2011
Implementation Specific Behavior
C++ 2014
C++ 2017
Implementation Specific Behavior
C++ TR1
Implementation Specific Behavior
C++ TR 24733
C++ IS 29124
Implementation Specific Behavior
License
The Code: GPL
The Documentation: GPL, FDL
Bugs
Implementation Bugs
Standard Bugs
2. Setup
Prerequisites
Configure
Make
3. Using
Command Options
Headers
Header Files
Mixing Headers
The C Headers and namespace std
Precompiled Headers
Macros
Dual ABI
Troubleshooting
Namespaces
Available Namespaces
namespace std
Using Namespace Composition
Linking
Almost Nothing
Finding Dynamic or Shared Libraries
Experimental Library Extensions
Concurrency
Prerequisites
Thread Safety
Atomics
IO
Structure
Defaults
Future
Alternatives
Containers
Exceptions
Exception Safety
Exception Neutrality
Doing without
Compatibility
With C
With POSIX thread cancellation
Debugging Support
Using g++
Debug Versions of Library Binary Files
Memory Leak Hunting
Non-memory leaks in Pool and MT allocators
Data Race Hunting
Using gdb
Tracking uncaught exceptions
Debug Mode
Compile Time Checking
Profile-based Performance Analysis
II. Standard Contents
4. Support diff --git a/libstdc++-v3/doc/html/manual/api.html b/libstdc++-v3/doc/html/manual/api.html index e2d3c62d29f..c891000302e 100644 --- a/libstdc++-v3/doc/html/manual/api.html +++ b/libstdc++-v3/doc/html/manual/api.html @@ -28,11 +28,12 @@ Removal of ext/tree, moved to

3.2

Symbol versioning introduced for shared library.

Removal of include backward/strstream.h.

Allocator changes. Change __malloc_alloc to malloc_allocator and __new_alloc to new_allocator.

For GCC releases from 2.95 through the 3.1 series, defining __USE_MALLOC on the gcc command line would change the - default allocation strategy to instead use malloc and - free. For the 3.2 and 3.3 release series the same + default allocation strategy to instead use malloc and + free. For the 3.2 and 3.3 release series the same functionality was spelled _GLIBCXX_FORCE_NEW. From - GCC 3.4 onwards the functionality is enabled by setting - GLIBCXX_FORCE_NEW in the environment, see + GCC 3.4 onwards the default allocator uses new anyway, + but for the optional pooling allocators the functionality is enabled by + setting GLIBCXX_FORCE_NEW in the environment, see the mt allocator chapter for details.

Error handling in iostreams cleaned up, made consistent.

3.3

diff --git a/libstdc++-v3/doc/html/manual/bugs.html b/libstdc++-v3/doc/html/manual/bugs.html index 5163f248212..df69da077a2 100644 --- a/libstdc++-v3/doc/html/manual/bugs.html +++ b/libstdc++-v3/doc/html/manual/bugs.html @@ -492,10 +492,20 @@

Avoid using dynamic_cast when it would be ill-formed. +

2537: + Constructors for priority_queue taking allocators + should call make_heap + +

Call make_heap.

2583: There is no way to supply an allocator for basic_string(str, pos)

Add new constructor +

2586: + Wrong value category used in scoped_allocator_adaptor::construct() + +

Change internal helper for uses-allocator construction + to always check using const lvalue allocators.

2684: priority_queue lacking comparator typedef diff --git a/libstdc++-v3/doc/html/manual/debug.html b/libstdc++-v3/doc/html/manual/debug.html index 5e37b0e2476..bce4242cdde 100644 --- a/libstdc++-v3/doc/html/manual/debug.html +++ b/libstdc++-v3/doc/html/manual/debug.html @@ -53,40 +53,28 @@ This quick and dirty approach is often sufficient for quick debugging tasks, when you cannot or don't want to recompile your application to use the debug mode.

Memory Leak Hunting

- There are various third party memory tracing and debug utilities + On many targets GCC supports AddressSanitizer, a fast memory error detector, + which is enabled by the -fsanitize=address option. +

+ There are also various third party memory tracing and debug utilities that can be used to provide detailed memory allocation information about C++ code. An exhaustive list of tools is not going to be attempted, but includes mtrace, valgrind, - mudflap, and the non-free commercial product - purify. In addition, libcwd has a - replacement for the global new and delete operators that can track - memory allocation and deallocation and provide useful memory - statistics. -

- Regardless of the memory debugging tool being used, there is one - thing of great importance to keep in mind when debugging C++ code - that uses new and delete: there are - different kinds of allocation schemes that can be used by - std::allocator. For implementation details, see the mt allocator documentation and - look specifically for GLIBCXX_FORCE_NEW. -

- In a nutshell, the optional mt_allocator - is a high-performance pool allocator, and can - give the mistaken impression that in a suspect executable, memory is - being leaked, when in reality the memory "leak" is a pool being used - by the library's allocator and is reclaimed after program - termination. + mudflap (no longer supported since GCC 4.9.0), ElectricFence, + and the non-free commercial product purify. + In addition, libcwd, jemalloc and TCMalloc have replacements + for the global new and delete operators + that can track memory allocation and deallocation and provide useful + memory statistics.

For valgrind, there are some specific items to keep in mind. First of all, use a version of valgrind that will work with current GNU C++ tools: the first that can do this is valgrind 1.0.4, but later - versions should work at least as well. Second of all, use a - completely unoptimized build to avoid confusing valgrind. Third, use - GLIBCXX_FORCE_NEW to keep extraneous pool allocation noise from - cluttering debug information. + versions should work better. Second, using an unoptimized build + might avoid confusing valgrind.

- Fourth, it may be necessary to force deallocation in other libraries - as well, namely the "C" library. On linux, this can be accomplished + Third, it may be necessary to force deallocation in other libraries + as well, namely the "C" library. On GNU/Linux, this can be accomplished with the appropriate use of the __cxa_atexit or atexit functions.

@@ -121,7 +109,29 @@
   up the runtime environment, library, and test file, might be:
 

    valgrind -v --num-callers=20 --leak-check=yes --leak-resolution=high --show-reachable=yes a.out
-

Data Race Hunting

+

Non-memory leaks in Pool and MT allocators

+ There are different kinds of allocation schemes that can be used by + std::allocator. Prior to GCC 3.4.0 the default was to use + a pooling allocator, pool_allocator, + which is still available as the optional + __pool_alloc extension. + Another optional extension, __mt_alloc, + is a high-performance pool allocator. +

+ In a suspect executable these pooling allocators can give + the mistaken impression that memory is being leaked, + when in reality the memory "leak" is a pool being used + by the library's allocator and is reclaimed after program + termination. +

+ If you're using memory debugging tools on a program that uses + one of these pooling allocators, you can set the environment variable + GLIBCXX_FORCE_NEW to keep extraneous pool allocation + noise from cluttering debug information. + For more details, see the + mt allocator + documentation and look specifically for GLIBCXX_FORCE_NEW. +

Data Race Hunting

All synchronization primitives used in the library internals need to be understood by race detectors so that they do not produce false reports.

diff --git a/libstdc++-v3/doc/html/manual/index.html b/libstdc++-v3/doc/html/manual/index.html index 2930ff69420..eecb195a016 100644 --- a/libstdc++-v3/doc/html/manual/index.html +++ b/libstdc++-v3/doc/html/manual/index.html @@ -4,7 +4,7 @@


Table of Contents

I. Introduction -
1. Status
Implementation Status
C++ 1998/2003
Implementation Status
Implementation Specific Behavior
C++ 2011
Implementation Specific Behavior
C++ 2014
C++ 2017
Implementation Specific Behavior
C++ TR1
Implementation Specific Behavior
C++ TR 24733
C++ IS 29124
Implementation Specific Behavior
License
The Code: GPL
The Documentation: GPL, FDL
Bugs
Implementation Bugs
Standard Bugs
2. Setup
Prerequisites
Configure
Make
3. Using
Command Options
Headers
Header Files
Mixing Headers
The C Headers and namespace std
Precompiled Headers
Macros
Dual ABI
Troubleshooting
Namespaces
Available Namespaces
namespace std
Using Namespace Composition
Linking
Almost Nothing
Finding Dynamic or Shared Libraries
Experimental Library Extensions
Concurrency
Prerequisites
Thread Safety
Atomics
IO
Structure
Defaults
Future
Alternatives
Containers
Exceptions
Exception Safety
Exception Neutrality
Doing without
Compatibility
With C
With POSIX thread cancellation
Debugging Support
Using g++
Debug Versions of Library Binary Files
Memory Leak Hunting
Data Race Hunting
Using gdb
Tracking uncaught exceptions
Debug Mode
Compile Time Checking
Profile-based Performance Analysis
II. +
1. Status
Implementation Status
C++ 1998/2003
Implementation Status
Implementation Specific Behavior
C++ 2011
Implementation Specific Behavior
C++ 2014
C++ 2017
Implementation Specific Behavior
C++ TR1
Implementation Specific Behavior
C++ TR 24733
C++ IS 29124
Implementation Specific Behavior
License
The Code: GPL
The Documentation: GPL, FDL
Bugs
Implementation Bugs
Standard Bugs
2. Setup
Prerequisites
Configure
Make
3. Using
Command Options
Headers
Header Files
Mixing Headers
The C Headers and namespace std
Precompiled Headers
Macros
Dual ABI
Troubleshooting
Namespaces
Available Namespaces
namespace std
Using Namespace Composition
Linking
Almost Nothing
Finding Dynamic or Shared Libraries
Experimental Library Extensions
Concurrency
Prerequisites
Thread Safety
Atomics
IO
Structure
Defaults
Future
Alternatives
Containers
Exceptions
Exception Safety
Exception Neutrality
Doing without
Compatibility
With C
With POSIX thread cancellation
Debugging Support
Using g++
Debug Versions of Library Binary Files
Memory Leak Hunting
Non-memory leaks in Pool and MT allocators
Data Race Hunting
Using gdb
Tracking uncaught exceptions
Debug Mode
Compile Time Checking
Profile-based Performance Analysis
II. Standard Contents
4. Support diff --git a/libstdc++-v3/doc/html/manual/intro.html b/libstdc++-v3/doc/html/manual/intro.html index 8c24f521e1e..425b56e1efb 100644 --- a/libstdc++-v3/doc/html/manual/intro.html +++ b/libstdc++-v3/doc/html/manual/intro.html @@ -5,4 +5,4 @@ Prev The GNU C++ Library Manual Next
\ No newline at end of file + \ No newline at end of file diff --git a/libstdc++-v3/doc/html/manual/status.html b/libstdc++-v3/doc/html/manual/status.html index 811181e5df5..c7eb5f7fbeb 100644 --- a/libstdc++-v3/doc/html/manual/status.html +++ b/libstdc++-v3/doc/html/manual/status.html @@ -665,7 +665,7 @@ Feature-testing recommendations for C++. P0040R3 - 7.1 shared_ptr::weak_type + 7.1 __cpp_lib_raw_memory_algorithms >= 201606L shared_ptr::weak_type P0163R0 @@ -821,7 +821,19 @@ Feature-testing recommendations for C++. P0067R5 8 (only integral types supported) __has_include(<charconv>) - __cpp_lib_to_chars >= 201611

+ __cpp_lib_to_chars >= 201611 Homogeneous interface for variant, any and optional + + P0032R3 + + 7.1 + __cpp_lib_any >= 201606 , + __cpp_lib_optional >= 201606 , + __cpp_lib_variant >= 201606 + Making Optional Greater Equal Again + + P0307R2 + + 7.1 __cpp_lib_optional >= 201606

Note 1: This feature is supported in GCC 7.1 and 7.2 but before GCC 7.3 the __cpp_lib macro is not defined, and compilation will fail if the header is included without using -std to enable C++17 support. diff --git a/libstdc++-v3/doc/html/manual/using.html b/libstdc++-v3/doc/html/manual/using.html index 7ccb4e90abc..da32cac1c41 100644 --- a/libstdc++-v3/doc/html/manual/using.html +++ b/libstdc++-v3/doc/html/manual/using.html @@ -2,7 +2,7 @@ Chapter 3. Using

Chapter 3. Using

Command Options

Next


Chapter 3. Using

Command Options

The set of features available in the GNU C++ library is shaped by several GCC Command Options. Options that impact libstdc++ are -- cgit v1.2.3 From dfaa7df430054634ac29565f9232e7c070f903ad Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Thu, 23 May 2019 15:34:25 +0000 Subject: PR libstdc++/89466 avoid slow xsltproc command in configure Certain broken versions of xsltproc ignore the --nonet option and will attempt to fetch the docbook stylesheet from the WWW when it isn't in the local XML catalog. This patch checks for the local stylesheet directory first, and doesn't use xsltproc if no local stylesheets are found. Checking for the local directory is done using xmlcatalog if available, only checking the hardcoded list of directories if xmlcatalog fails. The right directory for Suse is added to the hardcoded list. This should avoid doing an xsltproc check that would need to download the stylesheet, so no network connection is made even if a broken xsltproc is present. Backport from mainline 2019-02-27 Jonathan Wakely PR libstdc++/89466 * acinclude.m4 (GLIBCXX_CONFIGURE_DOCBOOK): Reorder check for local stylesheet directories before check for xsltproc. Try to use xmlcatalog to find local stylesheet directory before trying hardcoded paths. Add path used by suse to hardcoded paths. Adjust xsltproc check to look for the same stylesheet as doc/Makefile.am uses. Don't use xsltproc if xmlcatalog fails to find a local stylesheet. * configure.ac: Check for xmlcatalog. * Makefile.in: Regenerate. * configure: Likewise. * doc/Makefile.in: Likewise. * include/Makefile.in: Likewise. * libsupc++/Makefile.in: Likewise. * po/Makefile.in: Likewise. * python/Makefile.in: Likewise. * src/Makefile.in: Likewise. * src/c++11/Makefile.in: Likewise. * src/c++17/Makefile.in: Likewise. * src/c++98/Makefile.in: Likewise. * src/filesystem/Makefile.in: Likewise. * testsuite/Makefile.in: Likewise. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@271568 138bc75d-0d04-0410-961f-82ee72b054a4 --- libstdc++-v3/ChangeLog | 27 ++ libstdc++-v3/Makefile.in | 1 + libstdc++-v3/acinclude.m4 | 47 +- libstdc++-v3/configure | 108 +++-- libstdc++-v3/configure.ac | 1 + libstdc++-v3/doc/Makefile.in | 1 + libstdc++-v3/include/Makefile.in | 1 + libstdc++-v3/libsupc++/Makefile.in | 1 + libstdc++-v3/po/Makefile.in | 1 + libstdc++-v3/python/Makefile.in | 1 + libstdc++-v3/src/Makefile.in | 1 + libstdc++-v3/src/c++11/Makefile.in | 1 + libstdc++-v3/src/c++17/Makefile.in | 754 ++++++++++++++++++++++++++++++++ libstdc++-v3/src/c++98/Makefile.in | 1 + libstdc++-v3/src/filesystem/Makefile.in | 1 + libstdc++-v3/testsuite/Makefile.in | 1 + 16 files changed, 899 insertions(+), 49 deletions(-) create mode 100644 libstdc++-v3/src/c++17/Makefile.in diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index da76b77e142..5f359ede685 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,30 @@ +2019-05-23 Jonathan Wakely + + Backport from mainline + 2019-02-27 Jonathan Wakely + + PR libstdc++/89466 + * acinclude.m4 (GLIBCXX_CONFIGURE_DOCBOOK): Reorder check for local + stylesheet directories before check for xsltproc. Try to use + xmlcatalog to find local stylesheet directory before trying hardcoded + paths. Add path used by suse to hardcoded paths. Adjust xsltproc + check to look for the same stylesheet as doc/Makefile.am uses. Don't + use xsltproc if xmlcatalog fails to find a local stylesheet. + * configure.ac: Check for xmlcatalog. + * Makefile.in: Regenerate. + * configure: Likewise. + * doc/Makefile.in: Likewise. + * include/Makefile.in: Likewise. + * libsupc++/Makefile.in: Likewise. + * po/Makefile.in: Likewise. + * python/Makefile.in: Likewise. + * src/Makefile.in: Likewise. + * src/c++11/Makefile.in: Likewise. + * src/c++17/Makefile.in: Likewise. + * src/c++98/Makefile.in: Likewise. + * src/filesystem/Makefile.in: Likewise. + * testsuite/Makefile.in: Likewise. + 2019-05-23 Jonathan Wakely * doc/html/*: Regenerate. diff --git a/libstdc++-v3/Makefile.in b/libstdc++-v3/Makefile.in index dbfdce67638..94cae462514 100644 --- a/libstdc++-v3/Makefile.in +++ b/libstdc++-v3/Makefile.in @@ -233,6 +233,7 @@ VTV_CXXLINKFLAGS = @VTV_CXXLINKFLAGS@ VTV_PCH_CXXFLAGS = @VTV_PCH_CXXFLAGS@ WARN_FLAGS = @WARN_FLAGS@ WERROR = @WERROR@ +XMLCATALOG = @XMLCATALOG@ XMLLINT = @XMLLINT@ XSLTPROC = @XSLTPROC@ XSL_STYLE_DIR = @XSL_STYLE_DIR@ diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4 index 4f37b6a6498..44e132beab5 100644 --- a/libstdc++-v3/acinclude.m4 +++ b/libstdc++-v3/acinclude.m4 @@ -642,34 +642,43 @@ dnl XSL_STYLE_DIR dnl AC_DEFUN([GLIBCXX_CONFIGURE_DOCBOOK], [ -AC_MSG_CHECKING([for docbook stylesheets for documentation creation]) -glibcxx_stylesheets=no -if test x${XSLTPROC} = xyes && echo '' | xsltproc --noout --nonet --xinclude http://docbook.sourceforge.net/release/xsl-ns/current/xhtml-1_1/docbook.xsl - 2>/dev/null; then - glibcxx_stylesheets=yes -fi -AC_MSG_RESULT($glibcxx_stylesheets) +glibcxx_docbook_url=http://docbook.sourceforge.net/release/xsl-ns/current/ AC_MSG_CHECKING([for local stylesheet directory]) glibcxx_local_stylesheets=no -if test x"$glibcxx_stylesheets" = x"yes"; then - if test -d /usr/share/sgml/docbook/xsl-ns-stylesheets; then - glibcxx_local_stylesheets=yes - XSL_STYLE_DIR=/usr/share/sgml/docbook/xsl-ns-stylesheets - fi - if test -d /usr/share/xml/docbook/stylesheet/docbook-xsl-ns; then - glibcxx_local_stylesheets=yes - XSL_STYLE_DIR=/usr/share/xml/docbook/stylesheet/docbook-xsl-ns - fi - if test -d /usr/share/xml/docbook/stylesheet/nwalsh5/current; then - glibcxx_local_stylesheets=yes - XSL_STYLE_DIR=/usr/share/xml/docbook/stylesheet/nwalsh5/current - fi +if test x${XMLCATALOG} = xyes && xsl_style_dir=`xmlcatalog "" $glibcxx_docbook_url 2>/dev/null` +then + XSL_STYLE_DIR=`echo $xsl_style_dir | sed -n 's;^file://;;p'` + glibcxx_local_stylesheets=yes +else + for dir in \ + /usr/share/sgml/docbook/xsl-ns-stylesheets \ + /usr/share/xml/docbook/stylesheet/docbook-xsl-ns \ + /usr/share/xml/docbook/stylesheet/nwalsh5/current \ + /usr/share/xml/docbook/stylesheet/nwalsh/current + do + if test -d $dir; then + glibcxx_local_stylesheets=yes + XSL_STYLE_DIR=$dir + break + fi + done fi AC_MSG_RESULT($glibcxx_local_stylesheets) if test x"$glibcxx_local_stylesheets" = x"yes"; then AC_SUBST(XSL_STYLE_DIR) AC_MSG_NOTICE($XSL_STYLE_DIR) + + AC_MSG_CHECKING([for docbook stylesheets for documentation creation]) + glibcxx_stylesheets=no + if test x${XMLCATALOG} = xno || xmlcatalog "" $glibcxx_docbook_url/xhtml/docbook.xsl >/dev/null 2>&1; then + if test x${XSLTPROC} = xyes && echo '<title/>' | xsltproc --noout --nonet --xinclude $glibcxx_docbook_url/xhtml/docbook.xsl - 2>/dev/null; then + glibcxx_stylesheets=yes + fi + fi + AC_MSG_RESULT($glibcxx_stylesheets) + else glibcxx_stylesheets=no fi diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure index 5535bfa2b5a..4d0c2ea6419 100755 --- a/libstdc++-v3/configure +++ b/libstdc++-v3/configure @@ -638,6 +638,7 @@ BUILD_EPUB_TRUE XSL_STYLE_DIR XMLLINT XSLTPROC +XMLCATALOG DOT DOXYGEN BUILD_INFO_FALSE @@ -11608,7 +11609,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11611 "configure" +#line 11612 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11714,7 +11715,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11717 "configure" +#line 11718 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -15400,7 +15401,7 @@ $as_echo "$glibcxx_cv_atomic_long_long" >&6; } # Fake what AC_TRY_COMPILE does. cat > conftest.$ac_ext << EOF -#line 15403 "configure" +#line 15404 "configure" int main() { typedef bool atomic_type; @@ -15435,7 +15436,7 @@ $as_echo "$glibcxx_cv_atomic_bool" >&6; } rm -f conftest* cat > conftest.$ac_ext << EOF -#line 15438 "configure" +#line 15439 "configure" int main() { typedef short atomic_type; @@ -15470,7 +15471,7 @@ $as_echo "$glibcxx_cv_atomic_short" >&6; } rm -f conftest* cat > conftest.$ac_ext << EOF -#line 15473 "configure" +#line 15474 "configure" int main() { // NB: _Atomic_word not necessarily int. @@ -15506,7 +15507,7 @@ $as_echo "$glibcxx_cv_atomic_int" >&6; } rm -f conftest* cat > conftest.$ac_ext << EOF -#line 15509 "configure" +#line 15510 "configure" int main() { typedef long long atomic_type; @@ -15587,7 +15588,7 @@ $as_echo "$as_me: WARNING: Performance of certain classes will degrade as a resu # unnecessary for this test. cat > conftest.$ac_ext << EOF -#line 15590 "configure" +#line 15591 "configure" int main() { _Decimal32 d1; @@ -15629,7 +15630,7 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu # unnecessary for this test. cat > conftest.$ac_ext << EOF -#line 15632 "configure" +#line 15633 "configure" template<typename T1, typename T2> struct same { typedef T2 type; }; @@ -15663,7 +15664,7 @@ $as_echo "$enable_int128" >&6; } rm -f conftest* cat > conftest.$ac_ext << EOF -#line 15666 "configure" +#line 15667 "configure" template<typename T1, typename T2> struct same { typedef T2 type; }; @@ -80857,6 +80858,44 @@ fi # Check for docbook +# Extract the first word of "xmlcatalog", so it can be a program name with args. +set dummy xmlcatalog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_XMLCATALOG+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$XMLCATALOG"; then + ac_cv_prog_XMLCATALOG="$XMLCATALOG" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_XMLCATALOG="yes" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_prog_XMLCATALOG" && ac_cv_prog_XMLCATALOG="no" +fi +fi +XMLCATALOG=$ac_cv_prog_XMLCATALOG +if test -n "$XMLCATALOG"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $XMLCATALOG" >&5 +$as_echo "$XMLCATALOG" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + # Extract the first word of "xsltproc", so it can be a program name with args. set dummy xsltproc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 @@ -80935,31 +80974,28 @@ fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for docbook stylesheets for documentation creation" >&5 -$as_echo_n "checking for docbook stylesheets for documentation creation... " >&6; } -glibcxx_stylesheets=no -if test x${XSLTPROC} = xyes && echo '<title/>' | xsltproc --noout --nonet --xinclude http://docbook.sourceforge.net/release/xsl-ns/current/xhtml-1_1/docbook.xsl - 2>/dev/null; then - glibcxx_stylesheets=yes -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_stylesheets" >&5 -$as_echo "$glibcxx_stylesheets" >&6; } +glibcxx_docbook_url=http://docbook.sourceforge.net/release/xsl-ns/current/ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for local stylesheet directory" >&5 $as_echo_n "checking for local stylesheet directory... " >&6; } glibcxx_local_stylesheets=no -if test x"$glibcxx_stylesheets" = x"yes"; then - if test -d /usr/share/sgml/docbook/xsl-ns-stylesheets; then - glibcxx_local_stylesheets=yes - XSL_STYLE_DIR=/usr/share/sgml/docbook/xsl-ns-stylesheets - fi - if test -d /usr/share/xml/docbook/stylesheet/docbook-xsl-ns; then - glibcxx_local_stylesheets=yes - XSL_STYLE_DIR=/usr/share/xml/docbook/stylesheet/docbook-xsl-ns - fi - if test -d /usr/share/xml/docbook/stylesheet/nwalsh5/current; then - glibcxx_local_stylesheets=yes - XSL_STYLE_DIR=/usr/share/xml/docbook/stylesheet/nwalsh5/current - fi +if test x${XMLCATALOG} = xyes && xsl_style_dir=`xmlcatalog "" $glibcxx_docbook_url 2>/dev/null` +then + XSL_STYLE_DIR=`echo $xsl_style_dir | sed -n 's;^file://;;p'` + glibcxx_local_stylesheets=yes +else + for dir in \ + /usr/share/sgml/docbook/xsl-ns-stylesheets \ + /usr/share/xml/docbook/stylesheet/docbook-xsl-ns \ + /usr/share/xml/docbook/stylesheet/nwalsh5/current \ + /usr/share/xml/docbook/stylesheet/nwalsh/current + do + if test -d $dir; then + glibcxx_local_stylesheets=yes + XSL_STYLE_DIR=$dir + break + fi + done fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_local_stylesheets" >&5 $as_echo "$glibcxx_local_stylesheets" >&6; } @@ -80968,6 +81004,18 @@ if test x"$glibcxx_local_stylesheets" = x"yes"; then { $as_echo "$as_me:${as_lineno-$LINENO}: $XSL_STYLE_DIR" >&5 $as_echo "$as_me: $XSL_STYLE_DIR" >&6;} + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for docbook stylesheets for documentation creation" >&5 +$as_echo_n "checking for docbook stylesheets for documentation creation... " >&6; } + glibcxx_stylesheets=no + if test x${XMLCATALOG} = xno || xmlcatalog "" $glibcxx_docbook_url/xhtml/docbook.xsl >/dev/null 2>&1; then + if test x${XSLTPROC} = xyes && echo '<title/>' | xsltproc --noout --nonet --xinclude $glibcxx_docbook_url/xhtml/docbook.xsl - 2>/dev/null; then + glibcxx_stylesheets=yes + fi + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_stylesheets" >&5 +$as_echo "$glibcxx_stylesheets" >&6; } + else glibcxx_stylesheets=no fi diff --git a/libstdc++-v3/configure.ac b/libstdc++-v3/configure.ac index 0ef96270c9c..5f72696f653 100644 --- a/libstdc++-v3/configure.ac +++ b/libstdc++-v3/configure.ac @@ -442,6 +442,7 @@ AC_CHECK_PROG([DOXYGEN], doxygen, yes, no) AC_CHECK_PROG([DOT], dot, yes, no) # Check for docbook +AC_CHECK_PROG([XMLCATALOG], xmlcatalog, yes, no) AC_CHECK_PROG([XSLTPROC], xsltproc, yes, no) AC_CHECK_PROG([XMLLINT], xmllint, yes, no) GLIBCXX_CONFIGURE_DOCBOOK diff --git a/libstdc++-v3/doc/Makefile.in b/libstdc++-v3/doc/Makefile.in index f68b1d72d10..eaec7f4173b 100644 --- a/libstdc++-v3/doc/Makefile.in +++ b/libstdc++-v3/doc/Makefile.in @@ -205,6 +205,7 @@ VTV_CXXLINKFLAGS = @VTV_CXXLINKFLAGS@ VTV_PCH_CXXFLAGS = @VTV_PCH_CXXFLAGS@ WARN_FLAGS = @WARN_FLAGS@ WERROR = @WERROR@ +XMLCATALOG = @XMLCATALOG@ # Validate existing XML structure. XMLLINT = xmllint diff --git a/libstdc++-v3/include/Makefile.in b/libstdc++-v3/include/Makefile.in index 948a5c1f1c5..44b87ec0480 100644 --- a/libstdc++-v3/include/Makefile.in +++ b/libstdc++-v3/include/Makefile.in @@ -205,6 +205,7 @@ VTV_CXXLINKFLAGS = @VTV_CXXLINKFLAGS@ VTV_PCH_CXXFLAGS = @VTV_PCH_CXXFLAGS@ WARN_FLAGS = @WARN_FLAGS@ WERROR = @WERROR@ +XMLCATALOG = @XMLCATALOG@ XMLLINT = @XMLLINT@ XSLTPROC = @XSLTPROC@ XSL_STYLE_DIR = @XSL_STYLE_DIR@ diff --git a/libstdc++-v3/libsupc++/Makefile.in b/libstdc++-v3/libsupc++/Makefile.in index 37644e8f4cc..244f6bfbf2a 100644 --- a/libstdc++-v3/libsupc++/Makefile.in +++ b/libstdc++-v3/libsupc++/Makefile.in @@ -278,6 +278,7 @@ VTV_CXXLINKFLAGS = @VTV_CXXLINKFLAGS@ VTV_PCH_CXXFLAGS = @VTV_PCH_CXXFLAGS@ WARN_FLAGS = @WARN_FLAGS@ WERROR = @WERROR@ +XMLCATALOG = @XMLCATALOG@ XMLLINT = @XMLLINT@ XSLTPROC = @XSLTPROC@ XSL_STYLE_DIR = @XSL_STYLE_DIR@ diff --git a/libstdc++-v3/po/Makefile.in b/libstdc++-v3/po/Makefile.in index 3fe137f1d97..b984752e5b1 100644 --- a/libstdc++-v3/po/Makefile.in +++ b/libstdc++-v3/po/Makefile.in @@ -205,6 +205,7 @@ VTV_CXXLINKFLAGS = @VTV_CXXLINKFLAGS@ VTV_PCH_CXXFLAGS = @VTV_PCH_CXXFLAGS@ WARN_FLAGS = @WARN_FLAGS@ WERROR = @WERROR@ +XMLCATALOG = @XMLCATALOG@ XMLLINT = @XMLLINT@ XSLTPROC = @XSLTPROC@ XSL_STYLE_DIR = @XSL_STYLE_DIR@ diff --git a/libstdc++-v3/python/Makefile.in b/libstdc++-v3/python/Makefile.in index 23fe7a6a697..a539ca1791f 100644 --- a/libstdc++-v3/python/Makefile.in +++ b/libstdc++-v3/python/Makefile.in @@ -235,6 +235,7 @@ VTV_CXXLINKFLAGS = @VTV_CXXLINKFLAGS@ VTV_PCH_CXXFLAGS = @VTV_PCH_CXXFLAGS@ WARN_FLAGS = @WARN_FLAGS@ WERROR = @WERROR@ +XMLCATALOG = @XMLCATALOG@ XMLLINT = @XMLLINT@ XSLTPROC = @XSLTPROC@ XSL_STYLE_DIR = @XSL_STYLE_DIR@ diff --git a/libstdc++-v3/src/Makefile.in b/libstdc++-v3/src/Makefile.in index f0ec7bc8e8e..70521750388 100644 --- a/libstdc++-v3/src/Makefile.in +++ b/libstdc++-v3/src/Makefile.in @@ -268,6 +268,7 @@ VTV_CXXLINKFLAGS = @VTV_CXXLINKFLAGS@ VTV_PCH_CXXFLAGS = @VTV_PCH_CXXFLAGS@ WARN_FLAGS = @WARN_FLAGS@ WERROR = @WERROR@ +XMLCATALOG = @XMLCATALOG@ XMLLINT = @XMLLINT@ XSLTPROC = @XSLTPROC@ XSL_STYLE_DIR = @XSL_STYLE_DIR@ diff --git a/libstdc++-v3/src/c++11/Makefile.in b/libstdc++-v3/src/c++11/Makefile.in index 977f1ab441d..6f8cd40db3d 100644 --- a/libstdc++-v3/src/c++11/Makefile.in +++ b/libstdc++-v3/src/c++11/Makefile.in @@ -243,6 +243,7 @@ VTV_CXXLINKFLAGS = @VTV_CXXLINKFLAGS@ VTV_PCH_CXXFLAGS = @VTV_PCH_CXXFLAGS@ WARN_FLAGS = @WARN_FLAGS@ WERROR = @WERROR@ +XMLCATALOG = @XMLCATALOG@ XMLLINT = @XMLLINT@ XSLTPROC = @XSLTPROC@ XSL_STYLE_DIR = @XSL_STYLE_DIR@ diff --git a/libstdc++-v3/src/c++17/Makefile.in b/libstdc++-v3/src/c++17/Makefile.in new file mode 100644 index 00000000000..26a4713831d --- /dev/null +++ b/libstdc++-v3/src/c++17/Makefile.in @@ -0,0 +1,754 @@ +# Makefile.in generated by automake 1.15.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2017 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +target_triplet = @target@ +subdir = src/c++17 +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \ + $(top_srcdir)/../config/enable.m4 \ + $(top_srcdir)/../config/futex.m4 \ + $(top_srcdir)/../config/hwcaps.m4 \ + $(top_srcdir)/../config/iconv.m4 \ + $(top_srcdir)/../config/lead-dot.m4 \ + $(top_srcdir)/../config/lib-ld.m4 \ + $(top_srcdir)/../config/lib-link.m4 \ + $(top_srcdir)/../config/lib-prefix.m4 \ + $(top_srcdir)/../config/lthostflags.m4 \ + $(top_srcdir)/../config/multi.m4 \ + $(top_srcdir)/../config/no-executables.m4 \ + $(top_srcdir)/../config/override.m4 \ + $(top_srcdir)/../config/stdint.m4 \ + $(top_srcdir)/../config/unwind_ipinfo.m4 \ + $(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \ + $(top_srcdir)/../ltsugar.m4 $(top_srcdir)/../ltversion.m4 \ + $(top_srcdir)/../lt~obsolete.m4 $(top_srcdir)/crossconfig.m4 \ + $(top_srcdir)/linkage.m4 $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/../config/gc++filt.m4 \ + $(top_srcdir)/../config/tls.m4 $(top_srcdir)/../config/gthr.m4 \ + $(top_srcdir)/../config/cet.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +LTLIBRARIES = $(noinst_LTLIBRARIES) +libc__17convenience_la_LIBADD = +@ENABLE_DUAL_ABI_TRUE@am__objects_1 = cow-fs_dir.lo cow-fs_ops.lo \ +@ENABLE_DUAL_ABI_TRUE@ cow-fs_path.lo +am__objects_2 = fs_dir.lo fs_ops.lo fs_path.lo memory_resource.lo \ + $(am__objects_1) +@ENABLE_DUAL_ABI_TRUE@am__objects_3 = cow-string-inst.lo +@ENABLE_EXTERN_TEMPLATE_TRUE@am__objects_4 = ostream-inst.lo \ +@ENABLE_EXTERN_TEMPLATE_TRUE@ string-inst.lo $(am__objects_3) +am_libc__17convenience_la_OBJECTS = $(am__objects_2) $(am__objects_4) +libc__17convenience_la_OBJECTS = $(am_libc__17convenience_la_OBJECTS) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = +am__depfiles_maybe = +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +AM_V_CXX = $(am__v_CXX_@AM_V@) +am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@) +am__v_CXX_0 = @echo " CXX " $@; +am__v_CXX_1 = +CXXLD = $(CXX) +AM_V_CXXLD = $(am__v_CXXLD_@AM_V@) +am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@) +am__v_CXXLD_0 = @echo " CXXLD " $@; +am__v_CXXLD_1 = +SOURCES = $(libc__17convenience_la_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +ABI_TWEAKS_SRCDIR = @ABI_TWEAKS_SRCDIR@ +ACLOCAL = @ACLOCAL@ +ALLOCATOR_H = @ALLOCATOR_H@ +ALLOCATOR_NAME = @ALLOCATOR_NAME@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS = @AS@ +ATOMICITY_SRCDIR = @ATOMICITY_SRCDIR@ +ATOMIC_FLAGS = @ATOMIC_FLAGS@ +ATOMIC_WORD_SRCDIR = @ATOMIC_WORD_SRCDIR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BASIC_FILE_CC = @BASIC_FILE_CC@ +BASIC_FILE_H = @BASIC_FILE_H@ +CC = @CC@ +CCODECVT_CC = @CCODECVT_CC@ +CCOLLATE_CC = @CCOLLATE_CC@ +CCTYPE_CC = @CCTYPE_CC@ +CFLAGS = @CFLAGS@ +CLOCALE_CC = @CLOCALE_CC@ +CLOCALE_H = @CLOCALE_H@ +CLOCALE_INTERNAL_H = @CLOCALE_INTERNAL_H@ +CMESSAGES_CC = @CMESSAGES_CC@ +CMESSAGES_H = @CMESSAGES_H@ +CMONEY_CC = @CMONEY_CC@ +CNUMERIC_CC = @CNUMERIC_CC@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CPU_DEFINES_SRCDIR = @CPU_DEFINES_SRCDIR@ +CPU_OPT_BITS_RANDOM = @CPU_OPT_BITS_RANDOM@ +CPU_OPT_EXT_RANDOM = @CPU_OPT_EXT_RANDOM@ +CSTDIO_H = @CSTDIO_H@ +CTIME_CC = @CTIME_CC@ +CTIME_H = @CTIME_H@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXFILT = @CXXFILT@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +C_INCLUDE_DIR = @C_INCLUDE_DIR@ +DBLATEX = @DBLATEX@ +DEBUG_FLAGS = @DEBUG_FLAGS@ +DEFS = @DEFS@ +DOT = @DOT@ +DOXYGEN = @DOXYGEN@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ERROR_CONSTANTS_SRCDIR = @ERROR_CONSTANTS_SRCDIR@ +EXEEXT = @EXEEXT@ +EXTRA_CFLAGS = @EXTRA_CFLAGS@ +EXTRA_CXX_FLAGS = @EXTRA_CXX_FLAGS@ +FGREP = @FGREP@ +GLIBCXX_INCLUDES = @GLIBCXX_INCLUDES@ +GLIBCXX_LIBS = @GLIBCXX_LIBS@ +GREP = @GREP@ +HWCAP_CFLAGS = @HWCAP_CFLAGS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LONG_DOUBLE_COMPAT_FLAGS = @LONG_DOUBLE_COMPAT_FLAGS@ +LTLIBICONV = @LTLIBICONV@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OPTIMIZE_CXXFLAGS = @OPTIMIZE_CXXFLAGS@ +OPT_LDFLAGS = @OPT_LDFLAGS@ +OS_INC_SRCDIR = @OS_INC_SRCDIR@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PDFLATEX = @PDFLATEX@ +RANLIB = @RANLIB@ +SECTION_FLAGS = @SECTION_FLAGS@ +SECTION_LDFLAGS = @SECTION_LDFLAGS@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +SYMVER_FILE = @SYMVER_FILE@ +TOPLEVEL_INCLUDES = @TOPLEVEL_INCLUDES@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +VTV_CXXFLAGS = @VTV_CXXFLAGS@ +VTV_CXXLINKFLAGS = @VTV_CXXLINKFLAGS@ +VTV_PCH_CXXFLAGS = @VTV_PCH_CXXFLAGS@ +WARN_FLAGS = @WARN_FLAGS@ +XMLCATALOG = @XMLCATALOG@ +XMLLINT = @XMLLINT@ +XSLTPROC = @XSLTPROC@ +XSL_STYLE_DIR = @XSL_STYLE_DIR@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__leading_dot = @am__leading_dot@ +am__tar = @am__tar@ +am__untar = @am__untar@ +baseline_dir = @baseline_dir@ +baseline_subdir_switch = @baseline_subdir_switch@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +check_msgfmt = @check_msgfmt@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +enable_shared = @enable_shared@ +enable_static = @enable_static@ +exec_prefix = @exec_prefix@ +get_gcc_base_ver = @get_gcc_base_ver@ +glibcxx_MOFILES = @glibcxx_MOFILES@ +glibcxx_PCHFLAGS = @glibcxx_PCHFLAGS@ +glibcxx_POFILES = @glibcxx_POFILES@ +glibcxx_builddir = @glibcxx_builddir@ +glibcxx_compiler_pic_flag = @glibcxx_compiler_pic_flag@ +glibcxx_compiler_shared_flag = @glibcxx_compiler_shared_flag@ +glibcxx_cxx98_abi = @glibcxx_cxx98_abi@ +glibcxx_localedir = @glibcxx_localedir@ +glibcxx_lt_pic_flag = @glibcxx_lt_pic_flag@ +glibcxx_prefixdir = @glibcxx_prefixdir@ +glibcxx_srcdir = @glibcxx_srcdir@ +glibcxx_toolexecdir = @glibcxx_toolexecdir@ +glibcxx_toolexeclibdir = @glibcxx_toolexeclibdir@ +gxx_include_dir = @gxx_include_dir@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +libtool_VERSION = @libtool_VERSION@ +localedir = @localedir@ +localstatedir = @localstatedir@ +lt_host_flags = @lt_host_flags@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +multi_basedir = @multi_basedir@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +port_specific_symbol_files = @port_specific_symbol_files@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +python_mod_dir = @python_mod_dir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +thread_header = @thread_header@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +toplevel_builddir = @toplevel_builddir@ +toplevel_srcdir = @toplevel_srcdir@ + +# May be used by various substitution variables. +gcc_version := $(shell @get_gcc_base_ver@ $(top_srcdir)/../gcc/BASE-VER) +MAINT_CHARSET = latin1 +mkinstalldirs = $(SHELL) $(toplevel_srcdir)/mkinstalldirs +PWD_COMMAND = $${PWDCMD-pwd} +STAMP = echo timestamp > +toolexecdir = $(glibcxx_toolexecdir) +toolexeclibdir = $(glibcxx_toolexeclibdir) +@ENABLE_WERROR_FALSE@WERROR_FLAG = +@ENABLE_WERROR_TRUE@WERROR_FLAG = -Werror +@ENABLE_EXTERN_TEMPLATE_FALSE@XTEMPLATE_FLAGS = +@ENABLE_EXTERN_TEMPLATE_TRUE@XTEMPLATE_FLAGS = -fno-implicit-templates + +# These bits are all figured out from configure. Look in acinclude.m4 +# or configure.ac to see how they are set. See GLIBCXX_EXPORT_FLAGS. +CONFIG_CXXFLAGS = \ + $(SECTION_FLAGS) $(HWCAP_CFLAGS) -frandom-seed=$@ + +WARN_CXXFLAGS = \ + $(WARN_FLAGS) $(WERROR_FLAG) -fdiagnostics-show-location=once + + +# -I/-D flags to pass when compiling. +AM_CPPFLAGS = $(GLIBCXX_INCLUDES) $(CPPFLAGS) + +# Convenience library for C++17 runtime. +noinst_LTLIBRARIES = libc++17convenience.la +headers = +@ENABLE_DUAL_ABI_FALSE@extra_string_inst_sources = +@ENABLE_DUAL_ABI_TRUE@extra_string_inst_sources = cow-string-inst.cc +@ENABLE_DUAL_ABI_FALSE@extra_fs_sources = +@ENABLE_DUAL_ABI_TRUE@extra_fs_sources = \ +@ENABLE_DUAL_ABI_TRUE@ cow-fs_dir.cc \ +@ENABLE_DUAL_ABI_TRUE@ cow-fs_ops.cc \ +@ENABLE_DUAL_ABI_TRUE@ cow-fs_path.cc + +# XTEMPLATE_FLAGS = +@ENABLE_EXTERN_TEMPLATE_FALSE@inst_sources = + +# XTEMPLATE_FLAGS = -fno-implicit-templates +@ENABLE_EXTERN_TEMPLATE_TRUE@inst_sources = \ +@ENABLE_EXTERN_TEMPLATE_TRUE@ ostream-inst.cc \ +@ENABLE_EXTERN_TEMPLATE_TRUE@ string-inst.cc \ +@ENABLE_EXTERN_TEMPLATE_TRUE@ $(extra_string_inst_sources) + +sources = \ + fs_dir.cc \ + fs_ops.cc \ + fs_path.cc \ + memory_resource.cc \ + $(extra_fs_sources) + +libc__17convenience_la_SOURCES = $(sources) $(inst_sources) + +# AM_CXXFLAGS needs to be in each subdirectory so that it can be +# modified in a per-library or per-sub-library way. Need to manually +# set this option because CONFIG_CXXFLAGS has to be after +# OPTIMIZE_CXXFLAGS on the compile line so that -O2 can be overridden +# as the occasion calls for it. +AM_CXXFLAGS = \ + -std=gnu++17 \ + $(glibcxx_lt_pic_flag) $(glibcxx_compiler_shared_flag) \ + $(XTEMPLATE_FLAGS) $(VTV_CXXFLAGS) \ + $(WARN_CXXFLAGS) $(OPTIMIZE_CXXFLAGS) $(CONFIG_CXXFLAGS) \ + -fimplicit-templates + +AM_MAKEFLAGS = \ + "gxx_include_dir=$(gxx_include_dir)" + + +# Libtool notes + +# 1) In general, libtool expects an argument such as `--tag=CXX' when +# using the C++ compiler, because that will enable the settings +# detected when C++ support was being configured. However, when no +# such flag is given in the command line, libtool attempts to figure +# it out by matching the compiler name in each configuration section +# against a prefix of the command line. The problem is that, if the +# compiler name and its initial flags stored in the libtool +# configuration file don't match those in the command line, libtool +# can't decide which configuration to use, and it gives up. The +# correct solution is to add `--tag CXX' to LTCXXCOMPILE and maybe +# CXXLINK, just after $(LIBTOOL), so that libtool doesn't have to +# attempt to infer which configuration to use. +# +# The second tag argument, `--tag disable-shared` means that libtool +# only compiles each source once, for static objects. In actuality, +# glibcxx_lt_pic_flag and glibcxx_compiler_shared_flag are added to +# the libtool command that is used create the object, which is +# suitable for shared libraries. The `--tag disable-shared` must be +# placed after --tag CXX lest things CXX undo the affect of +# disable-shared. + +# 2) Need to explicitly set LTCXXCOMPILE so that EXTRA_CXX_FLAGS is +# last. (That way, things like -O2 passed down from the toplevel can +# be overridden by --enable-debug.) +LTCXXCOMPILE = \ + $(LIBTOOL) --tag CXX --tag disable-shared \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=compile $(CXX) $(TOPLEVEL_INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) $(EXTRA_CXX_FLAGS) + +LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS)) + +# 3) We'd have a problem when building the shared libstdc++ object if +# the rules automake generates would be used. We cannot allow g++ to +# be used since this would add -lstdc++ to the link line which of +# course is problematic at this point. So, we get the top-level +# directory to configure libstdc++-v3 to use gcc as the C++ +# compilation driver. +CXXLINK = \ + $(LIBTOOL) --tag CXX --tag disable-shared \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CXX) \ + $(VTV_CXXLINKFLAGS) \ + $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) $(LTLDFLAGS) -o $@ + +all: all-am + +.SUFFIXES: +.SUFFIXES: .cc .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/fragment.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign --ignore-deps src/c++17/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign --ignore-deps src/c++17/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; +$(top_srcdir)/fragment.am $(am__empty): + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } + +libc++17convenience.la: $(libc__17convenience_la_OBJECTS) $(libc__17convenience_la_DEPENDENCIES) $(EXTRA_libc__17convenience_la_DEPENDENCIES) + $(AM_V_CXXLD)$(CXXLINK) $(libc__17convenience_la_OBJECTS) $(libc__17convenience_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +.cc.o: + $(AM_V_CXX)$(CXXCOMPILE) -c -o $@ $< + +.cc.obj: + $(AM_V_CXX)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.cc.lo: + $(AM_V_CXX)$(LTCXXCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ + mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-noinstLTLIBRARIES cscopelist-am ctags \ + ctags-am distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags dvi dvi-am html html-am info \ + info-am install install-am install-data install-data-am \ + install-dvi install-dvi-am install-exec install-exec-am \ + install-html install-html-am install-info install-info-am \ + install-man install-pdf install-pdf-am install-ps \ + install-ps-am install-strip installcheck installcheck-am \ + installdirs maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \ + uninstall-am + +.PRECIOUS: Makefile + + +vpath % $(top_srcdir)/src/c++17 + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/libstdc++-v3/src/c++98/Makefile.in b/libstdc++-v3/src/c++98/Makefile.in index d2b9079795c..f0dbcf1668d 100644 --- a/libstdc++-v3/src/c++98/Makefile.in +++ b/libstdc++-v3/src/c++98/Makefile.in @@ -239,6 +239,7 @@ VTV_CXXLINKFLAGS = @VTV_CXXLINKFLAGS@ VTV_PCH_CXXFLAGS = @VTV_PCH_CXXFLAGS@ WARN_FLAGS = @WARN_FLAGS@ WERROR = @WERROR@ +XMLCATALOG = @XMLCATALOG@ XMLLINT = @XMLLINT@ XSLTPROC = @XSLTPROC@ XSL_STYLE_DIR = @XSL_STYLE_DIR@ diff --git a/libstdc++-v3/src/filesystem/Makefile.in b/libstdc++-v3/src/filesystem/Makefile.in index 0b43889eeb2..f2cac1ad6e5 100644 --- a/libstdc++-v3/src/filesystem/Makefile.in +++ b/libstdc++-v3/src/filesystem/Makefile.in @@ -249,6 +249,7 @@ VTV_CXXLINKFLAGS = @VTV_CXXLINKFLAGS@ VTV_PCH_CXXFLAGS = @VTV_PCH_CXXFLAGS@ WARN_FLAGS = @WARN_FLAGS@ WERROR = @WERROR@ +XMLCATALOG = @XMLCATALOG@ XMLLINT = @XMLLINT@ XSLTPROC = @XSLTPROC@ XSL_STYLE_DIR = @XSL_STYLE_DIR@ diff --git a/libstdc++-v3/testsuite/Makefile.in b/libstdc++-v3/testsuite/Makefile.in index ddae2b2cd55..b030b2ce475 100644 --- a/libstdc++-v3/testsuite/Makefile.in +++ b/libstdc++-v3/testsuite/Makefile.in @@ -205,6 +205,7 @@ VTV_CXXLINKFLAGS = @VTV_CXXLINKFLAGS@ VTV_PCH_CXXFLAGS = @VTV_PCH_CXXFLAGS@ WARN_FLAGS = @WARN_FLAGS@ WERROR = @WERROR@ +XMLCATALOG = @XMLCATALOG@ XMLLINT = @XMLLINT@ XSLTPROC = @XSLTPROC@ XSL_STYLE_DIR = @XSL_STYLE_DIR@ -- cgit v1.2.3 From bcdd824bfa5198a5e8b29465e11cadda9b4b016c Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Fri, 24 May 2019 00:16:17 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@271586 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 63809aa8159..24fdea9a2a7 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190523 +20190524 -- cgit v1.2.3 From 25b7f60afbdfd8a969697b508b0e8ac2e7fe69ac Mon Sep 17 00:00:00 2001 From: Martin Liska <mliska@suse.cz> Date: Fri, 24 May 2019 07:44:15 +0000 Subject: Backport r271548 2019-05-24 Martin Liska <mliska@suse.cz> Backport from mainline 2019-05-23 Martin Liska <mliska@suse.cz> PR sanitizer/90570 * gimplify.c (gimplify_target_expr): Skip TREE_STATIC target expression similarly to gimplify_decl_expr. 2019-05-24 Martin Liska <mliska@suse.cz> Backport from mainline 2019-05-23 Martin Liska <mliska@suse.cz> PR sanitizer/90570 * g++.dg/asan/pr90570.C: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@271594 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 9 +++++++++ gcc/gimplify.c | 1 + gcc/testsuite/ChangeLog | 8 ++++++++ gcc/testsuite/g++.dg/asan/pr90570.C | 18 ++++++++++++++++++ 4 files changed, 36 insertions(+) create mode 100644 gcc/testsuite/g++.dg/asan/pr90570.C diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 3ab35443c55..6ae1ac88991 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2019-05-24 Martin Liska <mliska@suse.cz> + + Backport from mainline + 2019-05-23 Martin Liska <mliska@suse.cz> + + PR sanitizer/90570 + * gimplify.c (gimplify_target_expr): Skip TREE_STATIC target + expression similarly to gimplify_decl_expr. + 2019-05-23 Uroš Bizjak <ubizjak@gmail.com> Backported from mainline diff --git a/gcc/gimplify.c b/gcc/gimplify.c index bdb15a8fd14..2971293a720 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -6653,6 +6653,7 @@ gimplify_target_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p) } if (asan_poisoned_variables && DECL_ALIGN (temp) <= MAX_SUPPORTED_STACK_ALIGNMENT + && !TREE_STATIC (temp) && dbg_cnt (asan_use_after_scope) && !gimplify_omp_ctxp) { diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b8e6b9abaf0..cb5c53af0c3 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2019-05-24 Martin Liska <mliska@suse.cz> + + Backport from mainline + 2019-05-23 Martin Liska <mliska@suse.cz> + + PR sanitizer/90570 + * g++.dg/asan/pr90570.C: New test. + 2019-05-23 Eric Botcazou <ebotcazou@adacore.com> * gnat.dg/opt78.ad[sb]: New test. diff --git a/gcc/testsuite/g++.dg/asan/pr90570.C b/gcc/testsuite/g++.dg/asan/pr90570.C new file mode 100644 index 00000000000..c2366905516 --- /dev/null +++ b/gcc/testsuite/g++.dg/asan/pr90570.C @@ -0,0 +1,18 @@ +/* PR sanitizer/90570 */ +/* { dg-do run } */ + +#include <vector> + +struct stru +{ + std::vector<int> v{1,2,3,4}; + int i{5}; +}; + +int main() +{ + stru s1; + stru s2; + + return 0; +} -- cgit v1.2.3 From 57abaf1cb1eddf5a884c0217a94252a0123d9c63 Mon Sep 17 00:00:00 2001 From: John David Anglin <danglin@gcc.gnu.org> Date: Fri, 24 May 2019 23:17:09 +0000 Subject: PR target/90530 * config/pa/pa.c (pa_can_change_mode_class): Accept mode changes from DImode to SImode in floating-point registers on 64-bit target. * config/pa/pa.md (umulsidi3): Change nonimmediate_operand to register_operand in xmpyu patterns. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@271613 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 8 ++++++++ gcc/config/pa/pa.c | 7 ++++--- gcc/config/pa/pa.md | 8 ++++---- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6ae1ac88991..abb02dcd98a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2019-05-24 John David Anglin <danglin@gcc.gnu.org> + + PR target/90530 + * config/pa/pa.c (pa_can_change_mode_class): Accept mode changes from + DImode to SImode in floating-point registers on 64-bit target. + * config/pa/pa.md (umulsidi3): Change nonimmediate_operand to + register_operand in xmpyu patterns. + 2019-05-24 Martin Liska <mliska@suse.cz> Backport from mainline diff --git a/gcc/config/pa/pa.c b/gcc/config/pa/pa.c index 715700e2d1d..b3bd5f6f551 100644 --- a/gcc/config/pa/pa.c +++ b/gcc/config/pa/pa.c @@ -10039,10 +10039,11 @@ pa_can_change_mode_class (machine_mode from, machine_mode to, /* There is no way to load QImode or HImode values directly from memory to a FP register. SImode loads to the FP registers are not zero extended. On the 64-bit target, this conflicts with the definition - of LOAD_EXTEND_OP. Thus, we can't allow changing between modes with - different sizes in the floating-point registers. */ + of LOAD_EXTEND_OP. Thus, we reject all mode changes in the FP registers + except for DImode to SImode on the 64-bit target. It is handled by + register renaming in pa_print_operand. */ if (MAYBE_FP_REG_CLASS_P (rclass)) - return false; + return TARGET_64BIT && from == DImode && to == SImode; /* TARGET_HARD_REGNO_MODE_OK places modes with sizes larger than a word in specific sets of registers. Thus, we cannot allow changing diff --git a/gcc/config/pa/pa.md b/gcc/config/pa/pa.md index 77611503c67..4b78c4455a5 100644 --- a/gcc/config/pa/pa.md +++ b/gcc/config/pa/pa.md @@ -5319,8 +5319,8 @@ (define_insn "umulsidi3" [(set (match_operand:DI 0 "register_operand" "=f") - (mult:DI (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "f")) - (zero_extend:DI (match_operand:SI 2 "nonimmediate_operand" "f"))))] + (mult:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "f")) + (zero_extend:DI (match_operand:SI 2 "register_operand" "f"))))] "TARGET_PA_11 && ! TARGET_DISABLE_FPREGS && ! TARGET_SOFT_FLOAT" "xmpyu %1,%2,%0" [(set_attr "type" "fpmuldbl") @@ -5328,7 +5328,7 @@ (define_insn "" [(set (match_operand:DI 0 "register_operand" "=f") - (mult:DI (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "f")) + (mult:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "f")) (match_operand:DI 2 "uint32_operand" "f")))] "TARGET_PA_11 && ! TARGET_DISABLE_FPREGS && ! TARGET_SOFT_FLOAT && !TARGET_64BIT" "xmpyu %1,%R2,%0" @@ -5337,7 +5337,7 @@ (define_insn "" [(set (match_operand:DI 0 "register_operand" "=f") - (mult:DI (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "f")) + (mult:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "f")) (match_operand:DI 2 "uint32_operand" "f")))] "TARGET_PA_11 && ! TARGET_DISABLE_FPREGS && ! TARGET_SOFT_FLOAT && TARGET_64BIT" "xmpyu %1,%2R,%0" -- cgit v1.2.3 From 9b57c8ee7ae163be3b9d2c301c796f17e88eb1e1 Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Sat, 25 May 2019 00:16:10 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@271616 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 24fdea9a2a7..c026f96caa0 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190524 +20190525 -- cgit v1.2.3 From 7ea18df9774efea0256d72ad1107a52ff2a82ffb Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Sun, 26 May 2019 00:16:08 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@271625 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index c026f96caa0..adad08e62a8 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190525 +20190526 -- cgit v1.2.3 From a0b56ac90afd718e0aa9f4a2856f49a8d9be1a39 Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Mon, 27 May 2019 00:16:11 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@271642 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index adad08e62a8..31c40c53955 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190526 +20190527 -- cgit v1.2.3 From 9d46a028e74bcc84b8e6701328c5625c219a8081 Mon Sep 17 00:00:00 2001 From: Eric Botcazou <ebotcazou@adacore.com> Date: Mon, 27 May 2019 10:26:24 +0000 Subject: * gcc-interface/trans.c (Call_to_gnu): Use the unpadded type when putting back an intermediate conversion the type of the actuals. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@271649 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ada/ChangeLog | 5 +++++ gcc/ada/gcc-interface/trans.c | 2 +- gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/gnat.dg/unchecked_convert13.adb | 30 +++++++++++++++++++++++++++ 4 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gnat.dg/unchecked_convert13.adb diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 52ac68e07b0..543aa63f12d 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,8 @@ +2019-05-27 Eric Botcazou <ebotcazou@adacore.com> + + * gcc-interface/trans.c (Call_to_gnu): Use the unpadded type when + putting back an intermediate conversion the type of the actuals. + 2019-05-07 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> * gcc-interface/Makefile.in (install-gcc-specs): Use foreach. diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c index d76ff58affb..928ffe3b1bf 100644 --- a/gcc/ada/gcc-interface/trans.c +++ b/gcc/ada/gcc-interface/trans.c @@ -4575,7 +4575,7 @@ Call_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, tree gnu_target, since the parent is a procedure call, so put it back here. Note that we might have a dummy type here if the actual is the dereference of a pointer to it, but that's OK if the formal is passed by reference. */ - tree gnu_actual_type = gnat_to_gnu_type (Etype (gnat_actual)); + tree gnu_actual_type = get_unpadded_type (Etype (gnat_actual)); if (TYPE_IS_DUMMY_P (gnu_actual_type)) gcc_assert (is_true_formal_parm && DECL_BY_REF_P (gnu_formal)); else if (suppress_type_conversion diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index cb5c53af0c3..4ef4c6521a6 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2019-05-27 Eric Botcazou <ebotcazou@adacore.com> + + * gnat.dg/unchecked_convert13.adb: New test. + 2019-05-24 Martin Liska <mliska@suse.cz> Backport from mainline diff --git a/gcc/testsuite/gnat.dg/unchecked_convert13.adb b/gcc/testsuite/gnat.dg/unchecked_convert13.adb new file mode 100644 index 00000000000..6297e276e0f --- /dev/null +++ b/gcc/testsuite/gnat.dg/unchecked_convert13.adb @@ -0,0 +1,30 @@ +-- { dg-do compile } + +with Ada.Unchecked_Conversion; + +procedure Unchecked_Convert13 is + + type B16_T is mod 2 ** 16; + for B16_T'Size use 16; + for B16_T'Alignment use 1; + + type Rec_T is record + A : Short_Integer; + end record; + for Rec_T use record + A at 0 range 0 .. 15; + end record; + for Rec_T'Size use 16; + + Rec : constant Rec_T := (A => 0); + + function Rec_To_B16 is new Ada.Unchecked_Conversion (Rec_T, B16_T); + + procedure Nested (B16 : B16_T) is + begin + null; + end; + +begin + Nested (Rec_To_B16 (Rec)); +end; -- cgit v1.2.3 From a5c2431c5de4a93f4589d4776866005089733e2d Mon Sep 17 00:00:00 2001 From: Eric Botcazou <ebotcazou@adacore.com> Date: Mon, 27 May 2019 11:13:23 +0000 Subject: * gcc-interface/utils.c (maybe_pad_type): Issue the warning for the specific case of component types preferably. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@271657 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ada/ChangeLog | 5 +++++ gcc/ada/gcc-interface/utils.c | 10 +++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 543aa63f12d..d269f5f6a4d 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,8 @@ +2019-05-27 Eric Botcazou <ebotcazou@adacore.com> + + * gcc-interface/utils.c (maybe_pad_type): Issue the warning for the + specific case of component types preferably. + 2019-05-27 Eric Botcazou <ebotcazou@adacore.com> * gcc-interface/trans.c (Call_to_gnu): Use the unpadded type when diff --git a/gcc/ada/gcc-interface/utils.c b/gcc/ada/gcc-interface/utils.c index 45bc3bda23c..da751b18340 100644 --- a/gcc/ada/gcc-interface/utils.c +++ b/gcc/ada/gcc-interface/utils.c @@ -1519,14 +1519,14 @@ built: generated for some other corresponding source entity. */ if (Comes_From_Source (gnat_entity)) { - if (Present (gnat_error_node)) - post_error_ne_tree ("{^ }bits of & unused?", - gnat_error_node, gnat_entity, - size_diffop (size, orig_size)); - else if (is_component_type) + if (is_component_type) post_error_ne_tree ("component of& padded{ by ^ bits}?", gnat_entity, gnat_entity, size_diffop (size, orig_size)); + else if (Present (gnat_error_node)) + post_error_ne_tree ("{^ }bits of & unused?", + gnat_error_node, gnat_entity, + size_diffop (size, orig_size)); } } -- cgit v1.2.3 From cee7368e08f185d354a017f53730ca7d4c316fe8 Mon Sep 17 00:00:00 2001 From: Eric Botcazou <ebotcazou@adacore.com> Date: Mon, 27 May 2019 16:15:54 +0000 Subject: * dwarf2out.c (resolve_args_picking_1): Deal with DW_OP_GNU_addr_index and DW_OP_GNU_const_index opcodes. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@271666 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 5 +++++ gcc/dwarf2out.c | 2 ++ gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/gnat.dg/specs/array4.ads | 17 +++++++++++++++++ 4 files changed, 28 insertions(+) create mode 100644 gcc/testsuite/gnat.dg/specs/array4.ads diff --git a/gcc/ChangeLog b/gcc/ChangeLog index abb02dcd98a..626a9bf6ceb 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2019-05-27 Eric Botcazou <ebotcazou@adacore.com> + + * dwarf2out.c (resolve_args_picking_1): Deal with DW_OP_GNU_addr_index + and DW_OP_GNU_const_index opcodes. + 2019-05-24 John David Anglin <danglin@gcc.gnu.org> PR target/90530 diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 2ea8a2222b0..533652ac733 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -17893,6 +17893,8 @@ resolve_args_picking_1 (dw_loc_descr_ref loc, unsigned initial_frame_offset, case DW_OP_push_object_address: case DW_OP_call_frame_cfa: case DW_OP_GNU_variable_value: + case DW_OP_GNU_addr_index: + case DW_OP_GNU_const_index: ++frame_offset_; break; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 4ef4c6521a6..88cf3a9f166 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2019-05-27 Eric Botcazou <ebotcazou@adacore.com> + + * gnat.dg/specs/array4.ads: New test. + 2019-05-27 Eric Botcazou <ebotcazou@adacore.com> * gnat.dg/unchecked_convert13.adb: New test. diff --git a/gcc/testsuite/gnat.dg/specs/array4.ads b/gcc/testsuite/gnat.dg/specs/array4.ads new file mode 100644 index 00000000000..ab12c1e2a9e --- /dev/null +++ b/gcc/testsuite/gnat.dg/specs/array4.ads @@ -0,0 +1,17 @@ +-- { dg-do compile } +-- { dg-skip-if "missing -gsplit-dwarf support" { *-*-darwin* } } +-- { dg-options "-gsplit-dwarf" } + +package Array4 is + + type Arr1 is array (Positive range <>) of Boolean; + + Size : Positive := 20; + + type Rec is record + A : Arr1 (1 .. Size); + end record; + + type Arr2 is array (Positive range <>) of Rec; + +end Array4; -- cgit v1.2.3 From 9aa8215d15641681bb41b996f0eb9345f732b27f Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Tue, 28 May 2019 00:16:12 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@271675 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 31c40c53955..dfcfe3c1814 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190527 +20190528 -- cgit v1.2.3 From 92b38b96c605e43bbb25e66f25fe4801058db78c Mon Sep 17 00:00:00 2001 From: Eric Botcazou <ebotcazou@adacore.com> Date: Tue, 28 May 2019 08:06:48 +0000 Subject: 2019-05-28 Eric Botcazou <ebotcazou@adacore.com> * gcc-interface/trans.c (walk_nesting_tree): New static function. (finalize_nrv): Use it to walk the entire nesting tree. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@271687 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ada/ChangeLog | 5 +++++ gcc/ada/gcc-interface/trans.c | 20 +++++++++++++++----- gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/gnat.dg/opt79.adb | 28 ++++++++++++++++++++++++++++ gcc/testsuite/gnat.dg/opt79.ads | 7 +++++++ 5 files changed, 59 insertions(+), 5 deletions(-) create mode 100644 gcc/testsuite/gnat.dg/opt79.adb create mode 100644 gcc/testsuite/gnat.dg/opt79.ads diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index d269f5f6a4d..81136dcb251 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,8 @@ +2019-05-28 Eric Botcazou <ebotcazou@adacore.com> + + * gcc-interface/trans.c (walk_nesting_tree): New static function. + (finalize_nrv): Use it to walk the entire nesting tree. + 2019-05-27 Eric Botcazou <ebotcazou@adacore.com> * gcc-interface/utils.c (maybe_pad_type): Issue the warning for the diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c index 928ffe3b1bf..6e830bd4b2d 100644 --- a/gcc/ada/gcc-interface/trans.c +++ b/gcc/ada/gcc-interface/trans.c @@ -3534,6 +3534,20 @@ finalize_nrv_unc_r (tree *tp, int *walk_subtrees, void *data) return NULL_TREE; } +/* Apply FUNC to all the sub-trees of nested functions in NODE. FUNC is called + with the DATA and the address of each sub-tree. If FUNC returns a non-NULL + value, the traversal is stopped. */ + +static void +walk_nesting_tree (struct cgraph_node *node, walk_tree_fn func, void *data) +{ + for (node = node->nested; node; node = node->next_nested) + { + walk_tree_without_duplicates (&DECL_SAVED_TREE (node->decl), func, data); + walk_nesting_tree (node, func, data); + } +} + /* Finalize the Named Return Value optimization for FNDECL. The NRV bitmap contains the candidates for Named Return Value and OTHER is a list of the other return values. GNAT_RET is a representative return node. */ @@ -3541,7 +3555,6 @@ finalize_nrv_unc_r (tree *tp, int *walk_subtrees, void *data) static void finalize_nrv (tree fndecl, bitmap nrv, vec<tree, va_gc> *other, Node_Id gnat_ret) { - struct cgraph_node *node; struct nrv_data data; walk_tree_fn func; unsigned int i; @@ -3562,10 +3575,7 @@ finalize_nrv (tree fndecl, bitmap nrv, vec<tree, va_gc> *other, Node_Id gnat_ret return; /* Prune also the candidates that are referenced by nested functions. */ - node = cgraph_node::get_create (fndecl); - for (node = node->nested; node; node = node->next_nested) - walk_tree_without_duplicates (&DECL_SAVED_TREE (node->decl), prune_nrv_r, - &data); + walk_nesting_tree (cgraph_node::get_create (fndecl), prune_nrv_r, &data); if (bitmap_empty_p (nrv)) return; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 88cf3a9f166..4fac3e1de60 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2019-05-28 Eric Botcazou <ebotcazou@adacore.com> + + * gnat.dg/opt79.ad[sb]: New test. + 2019-05-27 Eric Botcazou <ebotcazou@adacore.com> * gnat.dg/specs/array4.ads: New test. diff --git a/gcc/testsuite/gnat.dg/opt79.adb b/gcc/testsuite/gnat.dg/opt79.adb new file mode 100644 index 00000000000..f58e25bc11d --- /dev/null +++ b/gcc/testsuite/gnat.dg/opt79.adb @@ -0,0 +1,28 @@ +-- { dg-do compile } +-- { dg-options "-O" } + +package body Opt79 is + + function F (I : Integer) return Arr is + A : Arr; + + procedure Nested is + + procedure Inner is + begin + A (1) := 0; + end; + + begin + Inner; + end; + + begin + Nested; + for J in A'Range loop + A (J) := I; + end loop; + return A; + end; + +end Opt79; diff --git a/gcc/testsuite/gnat.dg/opt79.ads b/gcc/testsuite/gnat.dg/opt79.ads new file mode 100644 index 00000000000..aa90c17f8dd --- /dev/null +++ b/gcc/testsuite/gnat.dg/opt79.ads @@ -0,0 +1,7 @@ +package Opt79 is + + type Arr is array (1 .. 8) of Integer; + + function F (I : Integer) return Arr; + +end Opt79; -- cgit v1.2.3 From 5e7903e09a7923af4478dc790d3e721a9a6f7ba7 Mon Sep 17 00:00:00 2001 From: Jonathan Wakely <jwakely@redhat.com> Date: Tue, 28 May 2019 14:57:35 +0000 Subject: PR libstdc++/90634 reduce allocations in filesystem::path construction PR libstdc++/90634 * include/bits/fs_path.h (path::path(path&&)): Only call _M_split_cmpts() for a path with multiple components. (path::_S_is_dir_sep()): Add missing 'static' keyword to function. * include/experimental/bits/fs_path.h: Likewise. * src/filesystem/path.cc (path::_M_split_cmpts()): Count number of components and reserve space in vector. Return early when there is only one component. * src/filesystem/std-path.cc (path::_M_split_cmpts()): Likewise. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@271710 138bc75d-0d04-0410-961f-82ee72b054a4 --- libstdc++-v3/ChangeLog | 12 ++++++ libstdc++-v3/include/bits/fs_path.h | 5 ++- libstdc++-v3/include/experimental/bits/fs_path.h | 5 ++- libstdc++-v3/src/filesystem/path.cc | 51 +++++++++++++++++++++++- libstdc++-v3/src/filesystem/std-path.cc | 46 ++++++++++++++++++++- 5 files changed, 111 insertions(+), 8 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 5f359ede685..872e292ecaa 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,15 @@ +2019-05-28 Jonathan Wakely <jwakely@redhat.com> + + PR libstdc++/90634 + * include/bits/fs_path.h (path::path(path&&)): Only call + _M_split_cmpts() for a path with multiple components. + (path::_S_is_dir_sep()): Add missing 'static' keyword to function. + * include/experimental/bits/fs_path.h: Likewise. + * src/filesystem/path.cc (path::_M_split_cmpts()): Count number of + components and reserve space in vector. Return early when there is + only one component. + * src/filesystem/std-path.cc (path::_M_split_cmpts()): Likewise. + 2019-05-23 Jonathan Wakely <jwakely@redhat.com> Backport from mainline diff --git a/libstdc++-v3/include/bits/fs_path.h b/libstdc++-v3/include/bits/fs_path.h index 256b1d0a97f..7ae68f623d1 100644 --- a/libstdc++-v3/include/bits/fs_path.h +++ b/libstdc++-v3/include/bits/fs_path.h @@ -168,7 +168,8 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 path(path&& __p) noexcept : _M_pathname(std::move(__p._M_pathname)), _M_type(__p._M_type) { - _M_split_cmpts(); + if (_M_type == _Type::_Multi) + _M_split_cmpts(); __p.clear(); } @@ -478,7 +479,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 static basic_string<_CharT, _Traits, _Allocator> _S_str_convert(const string_type&, const _Allocator& __a); - bool _S_is_dir_sep(value_type __ch) + static bool _S_is_dir_sep(value_type __ch) { #ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS return __ch == L'/' || __ch == preferred_separator; diff --git a/libstdc++-v3/include/experimental/bits/fs_path.h b/libstdc++-v3/include/experimental/bits/fs_path.h index e419569b8ca..705f76331b5 100644 --- a/libstdc++-v3/include/experimental/bits/fs_path.h +++ b/libstdc++-v3/include/experimental/bits/fs_path.h @@ -186,7 +186,8 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 path(path&& __p) noexcept : _M_pathname(std::move(__p._M_pathname)), _M_type(__p._M_type) { - _M_split_cmpts(); + if (_M_type == _Type::_Multi) + _M_split_cmpts(); __p.clear(); } @@ -460,7 +461,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 return _S_convert_loc(__tmp.data(), __tmp.data()+__tmp.size(), __loc); } - bool _S_is_dir_sep(value_type __ch) + static bool _S_is_dir_sep(value_type __ch) { #ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS return __ch == L'/' || __ch == preferred_separator; diff --git a/libstdc++-v3/src/filesystem/path.cc b/libstdc++-v3/src/filesystem/path.cc index 899d94e0067..ae29b29aab9 100644 --- a/libstdc++-v3/src/filesystem/path.cc +++ b/libstdc++-v3/src/filesystem/path.cc @@ -334,6 +334,28 @@ path::_M_split_cmpts() if (_M_pathname.empty()) return; + { + // Approximate count of components, to reserve space in _M_cmpts vector: + int count = 1; + bool saw_sep_last = _S_is_dir_sep(_M_pathname[0]); + bool saw_non_sep = !saw_sep_last; + for (value_type c : _M_pathname) + { + if (_S_is_dir_sep(c)) + saw_sep_last = true; + else if (saw_sep_last) + { + ++count; + saw_sep_last = false; + saw_non_sep = true; + } + } + if (saw_non_sep && saw_sep_last) + ++count; // empty filename after trailing slash + if (count > 1) + _M_cmpts.reserve(count); + } + size_t pos = 0; const size_t len = _M_pathname.size(); @@ -356,9 +378,13 @@ path::_M_split_cmpts() pos = 3; while (pos < len && !_S_is_dir_sep(_M_pathname[pos])) ++pos; + if (pos == len) + { + _M_type = _Type::_Root_name; + return; + } _M_add_root_name(pos); - if (pos < len) // also got root directory - _M_add_root_dir(pos); + _M_add_root_dir(pos); } else { @@ -367,6 +393,11 @@ path::_M_split_cmpts() _M_add_root_dir(0); } } + else if (pos == len) // got root directory only + { + _M_type = _Type::_Root_dir; + return; + } else // got root directory _M_add_root_dir(0); ++pos; @@ -375,12 +406,28 @@ path::_M_split_cmpts() else if (len > 1 && _M_pathname[1] == L':') { // got disk designator + if (len == 2) + { + _M_type = _Type::_Root_name; + return; + } _M_add_root_name(2); if (len > 2 && _S_is_dir_sep(_M_pathname[2])) _M_add_root_dir(2); pos = 2; } #endif + else + { + size_t n = 1; + for (; n < _M_pathname.size() && !_S_is_dir_sep(_M_pathname[n]); ++n) + { } + if (n == _M_pathname.size()) + { + _M_type = _Type::_Filename; + return; + } + } size_t back = pos; while (pos < len) diff --git a/libstdc++-v3/src/filesystem/std-path.cc b/libstdc++-v3/src/filesystem/std-path.cc index c5bf8099036..ec8384340be 100644 --- a/libstdc++-v3/src/filesystem/std-path.cc +++ b/libstdc++-v3/src/filesystem/std-path.cc @@ -539,6 +539,28 @@ path::_M_split_cmpts() } _M_type = _Type::_Multi; + { + // Approximate count of components, to reserve space in _M_cmpts vector: + int count = 1; + bool saw_sep_last = _S_is_dir_sep(_M_pathname[0]); + bool saw_non_sep = !saw_sep_last; + for (value_type c : _M_pathname) + { + if (_S_is_dir_sep(c)) + saw_sep_last = true; + else if (saw_sep_last) + { + ++count; + saw_sep_last = false; + saw_non_sep = true; + } + } + if (saw_non_sep && saw_sep_last) + ++count; // empty filename after trailing slash + if (count > 1) + _M_cmpts.reserve(count); + } + size_t pos = 0; const size_t len = _M_pathname.size(); @@ -555,9 +577,13 @@ path::_M_split_cmpts() pos = 3; while (pos < len && !_S_is_dir_sep(_M_pathname[pos])) ++pos; + if (pos == len) + { + _M_type = _Type::_Root_name; + return; + } _M_add_root_name(pos); - if (pos < len) // also got root directory - _M_add_root_dir(pos); + _M_add_root_dir(pos); } else { @@ -584,12 +610,28 @@ path::_M_split_cmpts() else if (len > 1 && _M_pathname[1] == L':') { // got disk designator + if (len == 2) + { + _M_type = _Type::_Root_name; + return; + } _M_add_root_name(2); if (len > 2 && _S_is_dir_sep(_M_pathname[2])) _M_add_root_dir(2); pos = 2; } #endif + else + { + size_t n = 1; + for (; n < _M_pathname.size() && !_S_is_dir_sep(_M_pathname[n]); ++n) + { } + if (n == _M_pathname.size()) + { + _M_type = _Type::_Filename; + return; + } + } size_t back = pos; while (pos < len) -- cgit v1.2.3 From ea8d6c1b7e387800ba59a3e022f4cba0a18c225f Mon Sep 17 00:00:00 2001 From: Jonathan Wakely <jwakely@redhat.com> Date: Tue, 28 May 2019 16:08:51 +0000 Subject: Fix check for root-directory path and add tests PR libstdc++/90634 * src/filesystem/path.cc (path::_M_split_cmpts()): Fix check for "/". * testsuite/27_io/filesystem/path/construct/90634.cc: New test. * testsuite/experimental/filesystem/path/construct/90634.cc: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@271712 138bc75d-0d04-0410-961f-82ee72b054a4 --- libstdc++-v3/ChangeLog | 5 ++ libstdc++-v3/src/filesystem/path.cc | 2 +- .../27_io/filesystem/path/construct/90634.cc | 70 ++++++++++++++++++++++ .../filesystem/path/construct/90634.cc | 67 +++++++++++++++++++++ 4 files changed, 143 insertions(+), 1 deletion(-) create mode 100644 libstdc++-v3/testsuite/27_io/filesystem/path/construct/90634.cc create mode 100644 libstdc++-v3/testsuite/experimental/filesystem/path/construct/90634.cc diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 872e292ecaa..8c876da2875 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,5 +1,10 @@ 2019-05-28 Jonathan Wakely <jwakely@redhat.com> + PR libstdc++/90634 + * src/filesystem/path.cc (path::_M_split_cmpts()): Fix check for "/". + * testsuite/27_io/filesystem/path/construct/90634.cc: New test. + * testsuite/experimental/filesystem/path/construct/90634.cc: New test. + PR libstdc++/90634 * include/bits/fs_path.h (path::path(path&&)): Only call _M_split_cmpts() for a path with multiple components. diff --git a/libstdc++-v3/src/filesystem/path.cc b/libstdc++-v3/src/filesystem/path.cc index ae29b29aab9..e4d339a1208 100644 --- a/libstdc++-v3/src/filesystem/path.cc +++ b/libstdc++-v3/src/filesystem/path.cc @@ -393,7 +393,7 @@ path::_M_split_cmpts() _M_add_root_dir(0); } } - else if (pos == len) // got root directory only + else if (len == 1) // got root directory only { _M_type = _Type::_Root_dir; return; diff --git a/libstdc++-v3/testsuite/27_io/filesystem/path/construct/90634.cc b/libstdc++-v3/testsuite/27_io/filesystem/path/construct/90634.cc new file mode 100644 index 00000000000..dc31a86089e --- /dev/null +++ b/libstdc++-v3/testsuite/27_io/filesystem/path/construct/90634.cc @@ -0,0 +1,70 @@ +// Copyright (C) 2019 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 -lstdc++fs" } +// { dg-do run { target c++17 } } +// { dg-require-filesystem-ts "" } + +#include <filesystem> +#include <cstdlib> +#include <testsuite_hooks.h> + +std::size_t bytes_allocated = 0; + +void* operator new(std::size_t n) +{ + bytes_allocated += n; + return std::malloc(n); +} + +void operator delete(void* p) noexcept { std::free(p); } +#if __cpp_sized_deallocation +void operator delete(void* p, std::size_t) noexcept { std::free(p); } +#endif + +void +test01() +{ + std::string s0; + std::string s1 = "/"; + std::string s2 = "///"; + std::string s3 = "filename"; + std::string s4 = "C:"; + std::string s5 = "\\"; + + using std::filesystem::path; + + bytes_allocated = 0; + path p0 = std::move(s0); + VERIFY( bytes_allocated == 0 ); + path p1 = std::move(s1); + VERIFY( bytes_allocated == 0 ); + path p2 = std::move(s2); + VERIFY( bytes_allocated == 0 ); + path p3 = std::move(s3); + VERIFY( bytes_allocated == 0 ); + path p4 = std::move(s4); + VERIFY( bytes_allocated == 0 ); + path p5 = std::move(s5); + VERIFY( bytes_allocated == 0 ); +} + +int +main() +{ + test01(); +} diff --git a/libstdc++-v3/testsuite/experimental/filesystem/path/construct/90634.cc b/libstdc++-v3/testsuite/experimental/filesystem/path/construct/90634.cc new file mode 100644 index 00000000000..ef4a804de42 --- /dev/null +++ b/libstdc++-v3/testsuite/experimental/filesystem/path/construct/90634.cc @@ -0,0 +1,67 @@ +// Copyright (C) 2019 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 "-DUSE_FILESYSTEM_TS -lstdc++fs" } +// { dg-do run { target c++11 } } +// { dg-require-filesystem-ts "" } + +#include <experimental/filesystem> +#include <cstdlib> +#include <testsuite_hooks.h> + +std::size_t bytes_allocated = 0; + +void* operator new(std::size_t n) +{ + bytes_allocated += n; + return std::malloc(n); +} + +void operator delete(void* p) noexcept { std::free(p); } +#if __cpp_sized_deallocation +void operator delete(void* p, std::size_t) noexcept { std::free(p); } +#endif + +void +test01() +{ + std::string s0; + std::string s1 = "/"; + std::string s2 = "filename"; + std::string s3 = "C:"; + std::string s4 = "\\"; + + using std::experimental::filesystem::path; + + bytes_allocated = 0; + path p0 = std::move(s0); + VERIFY( bytes_allocated == 0 ); + path p1 = std::move(s1); + VERIFY( bytes_allocated == 0 ); + path p2 = std::move(s2); + VERIFY( bytes_allocated == 0 ); + path p3 = std::move(s3); + VERIFY( bytes_allocated == 0 ); + path p4 = std::move(s4); + VERIFY( bytes_allocated == 0 ); +} + +int +main() +{ + test01(); +} -- cgit v1.2.3 From a53d1c1fd2d69e5bf9409483bd3dbf98cb77aac3 Mon Sep 17 00:00:00 2001 From: John David Anglin <danglin@gcc.gnu.org> Date: Tue, 28 May 2019 23:31:25 +0000 Subject: * config/pa/pa.c (hppa_profile_hook): Remove offset adjustment. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@271722 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 4 ++++ gcc/config/pa/pa.c | 19 +++++-------------- 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 626a9bf6ceb..ff788cfc107 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,7 @@ +2019-05-28 John David Anglin <danglin@gcc.gnu.org> + + * config/pa/pa.c (hppa_profile_hook): Remove offset adjustment. + 2019-05-27 Eric Botcazou <ebotcazou@adacore.com> * dwarf2out.c (resolve_args_picking_1): Deal with DW_OP_GNU_addr_index diff --git a/gcc/config/pa/pa.c b/gcc/config/pa/pa.c index b3bd5f6f551..6627fd90f6f 100644 --- a/gcc/config/pa/pa.c +++ b/gcc/config/pa/pa.c @@ -4569,10 +4569,6 @@ output_deferred_profile_counters (void) void hppa_profile_hook (int label_no) { - /* We use SImode for the address of the function in both 32 and - 64-bit code to avoid having to provide DImode versions of the - lcla2 and load_offset_label_address insn patterns. */ - rtx reg = gen_reg_rtx (SImode); rtx_code_label *label_rtx = gen_label_rtx (); int reg_parm_stack_space = REG_PARM_STACK_SPACE (NULL_TREE); rtx arg_bytes, begin_label_rtx, mcount, sym; @@ -4604,18 +4600,13 @@ hppa_profile_hook (int label_no) if (!use_mcount_pcrel_call) { /* The address of the function is loaded into %r25 with an instruction- - relative sequence that avoids the use of relocations. The sequence - is split so that the load_offset_label_address instruction can - occupy the delay slot of the call to _mcount. */ + relative sequence that avoids the use of relocations. We use SImode + for the address of the function in both 32 and 64-bit code to avoid + having to provide DImode versions of the lcla2 pattern. */ if (TARGET_PA_20) - emit_insn (gen_lcla2 (reg, label_rtx)); + emit_insn (gen_lcla2 (gen_rtx_REG (SImode, 25), label_rtx)); else - emit_insn (gen_lcla1 (reg, label_rtx)); - - emit_insn (gen_load_offset_label_address (gen_rtx_REG (SImode, 25), - reg, - begin_label_rtx, - label_rtx)); + emit_insn (gen_lcla1 (gen_rtx_REG (SImode, 25), label_rtx)); } if (!NO_DEFERRED_PROFILE_COUNTERS) -- cgit v1.2.3 From 5bea06dc21604f0a3de610d76587f6e07efbbc2c Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Wed, 29 May 2019 00:16:10 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@271724 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index dfcfe3c1814..d81d81e459a 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190528 +20190529 -- cgit v1.2.3 From f6a1ef4c23710a4bdf7945b631534e4d6129f445 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek <jakub@redhat.com> Date: Wed, 29 May 2019 16:02:56 +0000 Subject: PR fortran/90329 * lto-streamer.h (LTO_minor_version): Bump to 2. Backported from mainline 2019-05-29 Jakub Jelinek <jakub@redhat.com> PR fortran/90329 * lang.opt (fbroken-callers): Remove. (ftail-call-workaround, ftail-call-workaround=): New options. * gfortran.h (struct gfc_namespace): Add implicit_interface_calls. * interface.c (gfc_procedure_use): Set implicit_interface_calls for calls to implicit interface procedures. * trans-decl.c (create_function_arglist): Use flag_tail_call_workaround instead of flag_broken_callers. If it is not 2, also require sym->ns->implicit_interface_calls. * invoke.texi (fbroken-callers): Remove documentation. (ftail-call-workaround, ftail-call-workaround=): Document. 2019-05-19 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/90329 * invoke.texi: Document -fbroken-callers. * lang.opt: Add -fbroken-callers. * trans-decl.c (create_function_arglist): Only set DECL_HIDDEN_STRING_LENGTH if flag_broken_callers is set. 2019-05-16 Jakub Jelinek <jakub@redhat.com> PR fortran/90329 * tree-core.h (struct tree_decl_common): Document decl_nonshareable_flag for PARM_DECLs. * tree.h (DECL_HIDDEN_STRING_LENGTH): Define. * calls.c (expand_call): Don't try tail call if caller has any DECL_HIDDEN_STRING_LENGTH PARM_DECLs that are or might be passed on the stack and callee needs to pass any arguments on the stack. * tree-streamer-in.c (unpack_ts_decl_common_value_fields): Use else if instead of series of mutually exclusive ifs. Handle DECL_HIDDEN_STRING_LENGTH for PARM_DECLs. * tree-streamer-out.c (pack_ts_decl_common_value_fields): Likewise. * trans-decl.c (create_function_arglist): Set DECL_HIDDEN_STRING_LENGTH on hidden string length PARM_DECLs if len is constant. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@271744 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 21 +++++++++++++++++++++ gcc/calls.c | 22 ++++++++++++++++++++++ gcc/fortran/ChangeLog | 33 +++++++++++++++++++++++++++++++++ gcc/fortran/gfortran.h | 3 +++ gcc/fortran/interface.c | 1 + gcc/fortran/invoke.texi | 36 +++++++++++++++++++++++++++++++++++- gcc/fortran/lang.opt | 7 +++++++ gcc/fortran/trans-decl.c | 11 +++++++++++ gcc/lto-streamer.h | 2 +- gcc/tree-core.h | 1 + gcc/tree-streamer-in.c | 7 +++++-- gcc/tree-streamer-out.c | 7 +++++-- gcc/tree.h | 5 +++++ 13 files changed, 150 insertions(+), 6 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ff788cfc107..b5c2f429f59 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,24 @@ +2019-05-29 Jakub Jelinek <jakub@redhat.com> + + PR fortran/90329 + * lto-streamer.h (LTO_minor_version): Bump to 2. + + Backported from mainline + 2019-05-16 Jakub Jelinek <jakub@redhat.com> + + PR fortran/90329 + * tree-core.h (struct tree_decl_common): Document + decl_nonshareable_flag for PARM_DECLs. + * tree.h (DECL_HIDDEN_STRING_LENGTH): Define. + * calls.c (expand_call): Don't try tail call if caller + has any DECL_HIDDEN_STRING_LENGTH PARM_DECLs that are or might be + passed on the stack and callee needs to pass any arguments on the + stack. + * tree-streamer-in.c (unpack_ts_decl_common_value_fields): Use + else if instead of series of mutually exclusive ifs. Handle + DECL_HIDDEN_STRING_LENGTH for PARM_DECLs. + * tree-streamer-out.c (pack_ts_decl_common_value_fields): Likewise. + 2019-05-28 John David Anglin <danglin@gcc.gnu.org> * config/pa/pa.c (hppa_profile_hook): Remove offset adjustment. diff --git a/gcc/calls.c b/gcc/calls.c index e619f687b44..ed612b3f562 100644 --- a/gcc/calls.c +++ b/gcc/calls.c @@ -3754,6 +3754,28 @@ expand_call (tree exp, rtx target, int ignore) || dbg_cnt (tail_call) == false) try_tail_call = 0; + /* Workaround buggy C/C++ wrappers around Fortran routines with + character(len=constant) arguments if the hidden string length arguments + are passed on the stack; if the callers forget to pass those arguments, + attempting to tail call in such routines leads to stack corruption. + Avoid tail calls in functions where at least one such hidden string + length argument is passed (partially or fully) on the stack in the + caller and the callee needs to pass any arguments on the stack. + See PR90329. */ + if (try_tail_call && maybe_ne (args_size.constant, 0)) + for (tree arg = DECL_ARGUMENTS (current_function_decl); + arg; arg = DECL_CHAIN (arg)) + if (DECL_HIDDEN_STRING_LENGTH (arg) && DECL_INCOMING_RTL (arg)) + { + subrtx_iterator::array_type array; + FOR_EACH_SUBRTX (iter, array, DECL_INCOMING_RTL (arg), NONCONST) + if (MEM_P (*iter)) + { + try_tail_call = 0; + break; + } + } + /* If the user has marked the function as requiring tail-call optimization, attempt it. */ if (must_tail_call) diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 62df8f809d0..ee4f18e57a4 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,36 @@ +2019-05-29 Jakub Jelinek <jakub@redhat.com> + + PR fortran/90329 + Backported from mainline + 2019-05-29 Jakub Jelinek <jakub@redhat.com> + + PR fortran/90329 + * lang.opt (fbroken-callers): Remove. + (ftail-call-workaround, ftail-call-workaround=): New options. + * gfortran.h (struct gfc_namespace): Add implicit_interface_calls. + * interface.c (gfc_procedure_use): Set implicit_interface_calls + for calls to implicit interface procedures. + * trans-decl.c (create_function_arglist): Use flag_tail_call_workaround + instead of flag_broken_callers. If it is not 2, also require + sym->ns->implicit_interface_calls. + * invoke.texi (fbroken-callers): Remove documentation. + (ftail-call-workaround, ftail-call-workaround=): Document. + + 2019-05-19 Thomas Koenig <tkoenig@gcc.gnu.org> + + PR fortran/90329 + * invoke.texi: Document -fbroken-callers. + * lang.opt: Add -fbroken-callers. + * trans-decl.c (create_function_arglist): Only set + DECL_HIDDEN_STRING_LENGTH if flag_broken_callers is set. + + 2019-05-16 Jakub Jelinek <jakub@redhat.com> + + PR fortran/90329 + * trans-decl.c (create_function_arglist): Set + DECL_HIDDEN_STRING_LENGTH on hidden string length PARM_DECLs if + len is constant. + 2019-04-30 Jakub Jelinek <jakub@redhat.com> Backported from mainline diff --git a/gcc/fortran/gfortran.h b/gcc/fortran/gfortran.h index ebe6eab558b..16748a014e9 100644 --- a/gcc/fortran/gfortran.h +++ b/gcc/fortran/gfortran.h @@ -1857,6 +1857,9 @@ typedef struct gfc_namespace /* Set to 1 for !$ACC ROUTINE namespaces. */ unsigned oacc_routine:1; + + /* Set to 1 if there are any calls to procedures with implicit interface. */ + unsigned implicit_interface_calls:1; } gfc_namespace; diff --git a/gcc/fortran/interface.c b/gcc/fortran/interface.c index 9e06128f7b8..04850b0406c 100644 --- a/gcc/fortran/interface.c +++ b/gcc/fortran/interface.c @@ -3657,6 +3657,7 @@ gfc_procedure_use (gfc_symbol *sym, gfc_actual_arglist **ap, locus *where) gfc_warning (OPT_Wimplicit_procedure, "Procedure %qs called at %L is not explicitly declared", sym->name, where); + gfc_find_proc_namespace (sym->ns)->implicit_interface_calls = 1; } if (sym->attr.if_source == IFSRC_UNKNOWN) diff --git a/gcc/fortran/invoke.texi b/gcc/fortran/invoke.texi index 3d64056591e..ded17ac0f47 100644 --- a/gcc/fortran/invoke.texi +++ b/gcc/fortran/invoke.texi @@ -181,7 +181,8 @@ and warnings}. @item Code Generation Options @xref{Code Gen Options,,Options for code generation conventions}. @gccoptlist{-faggressive-function-elimination -fblas-matmul-limit=@var{n} @gol --fbounds-check -fcheck-array-temporaries @gol +-fbounds-check -ftail-call-workaround -ftail-call-workaround=@var{n} @gol +-fcheck-array-temporaries @gol -fcheck=@var{<all|array-temps|bounds|do|mem|pointer|recursion>} @gol -fcoarray=@var{<none|single|lib>} -fexternal-blas -ff2c -ffrontend-loop-interchange @gol @@ -1580,6 +1581,39 @@ warnings for generated array temporaries. @c Note: This option is also referred in gcc's manpage Deprecated alias for @option{-fcheck=bounds}. +@item -ftail-call-workaround +@itemx -ftail-call-workaround=@var{n} +@opindex @code{tail-call-workaround} +Some C interfaces to Fortran codes violate the gfortran ABI by +omitting the hidden character length arguments as described in +@xref{Argument passing conventions}. This can lead to crashes +because pushing arguments for tail calls can overflow the stack. + +To provide a workaround for existing binary packages, this option +disables tail call optimization for gfortran procedures with character +arguments. With @option{-ftail-call-workaround=2} tail call optimization +is disabled in all gfortran procedures with character arguments, +with @option{-ftail-call-workaround=1} or equivalent +@option{-ftail-call-workaround} only in gfortran procedures with character +arguments that call implicitly prototyped procedures. + +Using this option can lead to problems including crashes due to +insufficient stack space. + +It is @emph{very strongly} recommended to fix the code in question. +The @option{-fc-prototypes-external} option can be used to generate +prototypes which conform to gfortran's ABI, for inclusion in the +source code. + +Support for this option will likely be withdrawn in a future release +of gfortran. + +The negative form, @option{-fno-tail-call-workaround} or equivalent +@option{-ftail-call-workaround=0}, can be used to disable this option. + +Default is currently @option{-ftail-call-workaround}, this will change +in future releases. + @item -fcheck-array-temporaries @opindex @code{fcheck-array-temporaries} Deprecated alias for @option{-fcheck=array-temps}. diff --git a/gcc/fortran/lang.opt b/gcc/fortran/lang.opt index 1cb7b6b4f84..2e55aa07e65 100644 --- a/gcc/fortran/lang.opt +++ b/gcc/fortran/lang.opt @@ -742,6 +742,13 @@ fsign-zero Fortran Var(flag_sign_zero) Init(1) Apply negative sign to zero values. +ftail-call-workaround +Frotran Alias(ftail-call-workaround=,1,0) + +ftail-call-workaround= +Fortran RejectNegative Joined UInteger IntegerRange(0, 2) Var(flag_tail_call_workaround) Init(1) +Disallow tail call optimization when a calling routine may have omitted character lenghts. + funderscoring Fortran Var(flag_underscoring) Init(1) Append underscores to externally visible names. diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c index a68223d2040..79e9cc69974 100644 --- a/gcc/fortran/trans-decl.c +++ b/gcc/fortran/trans-decl.c @@ -2513,6 +2513,17 @@ create_function_arglist (gfc_symbol * sym) TREE_READONLY (length) = 1; gfc_finish_decl (length); + /* Marking the length DECL_HIDDEN_STRING_LENGTH will lead + to tail calls being disabled. Only do that if we + potentially have broken callers. */ + if (flag_tail_call_workaround + && f->sym->ts.u.cl + && f->sym->ts.u.cl->length + && f->sym->ts.u.cl->length->expr_type == EXPR_CONSTANT + && (flag_tail_call_workaround == 2 + || f->sym->ns->implicit_interface_calls)) + DECL_HIDDEN_STRING_LENGTH (length) = 1; + /* Remember the passed value. */ if (!f->sym->ts.u.cl || f->sym->ts.u.cl->passed_length) { diff --git a/gcc/lto-streamer.h b/gcc/lto-streamer.h index 11d9888dafb..8337dcb602d 100644 --- a/gcc/lto-streamer.h +++ b/gcc/lto-streamer.h @@ -121,7 +121,7 @@ along with GCC; see the file COPYING3. If not see form followed by the data for the string. */ #define LTO_major_version 7 -#define LTO_minor_version 1 +#define LTO_minor_version 2 typedef unsigned char lto_decl_flags_t; diff --git a/gcc/tree-core.h b/gcc/tree-core.h index 84f75e66ca9..04a1f0c6bae 100644 --- a/gcc/tree-core.h +++ b/gcc/tree-core.h @@ -1644,6 +1644,7 @@ struct GTY(()) tree_decl_common { /* In a VAR_DECL and PARM_DECL, this is DECL_READ_P. */ unsigned decl_read_flag : 1; /* In a VAR_DECL or RESULT_DECL, this is DECL_NONSHAREABLE. */ + /* In a PARM_DECL, this is DECL_HIDDEN_STRING_LENGTH. */ unsigned decl_nonshareable_flag : 1; /* DECL_OFFSET_ALIGN, used only for FIELD_DECLs. */ diff --git a/gcc/tree-streamer-in.c b/gcc/tree-streamer-in.c index f3911740569..363d396d3a8 100644 --- a/gcc/tree-streamer-in.c +++ b/gcc/tree-streamer-in.c @@ -252,7 +252,7 @@ unpack_ts_decl_common_value_fields (struct bitpack_d *bp, tree expr) LABEL_DECL_UID (expr) = -1; } - if (TREE_CODE (expr) == FIELD_DECL) + else if (TREE_CODE (expr) == FIELD_DECL) { DECL_PACKED (expr) = (unsigned) bp_unpack_value (bp, 1); DECL_NONADDRESSABLE_P (expr) = (unsigned) bp_unpack_value (bp, 1); @@ -260,12 +260,15 @@ unpack_ts_decl_common_value_fields (struct bitpack_d *bp, tree expr) expr->decl_common.off_align = bp_unpack_value (bp, 8); } - if (VAR_P (expr)) + else if (VAR_P (expr)) { DECL_HAS_DEBUG_EXPR_P (expr) = (unsigned) bp_unpack_value (bp, 1); DECL_NONLOCAL_FRAME (expr) = (unsigned) bp_unpack_value (bp, 1); } + else if (TREE_CODE (expr) == PARM_DECL) + DECL_HIDDEN_STRING_LENGTH (expr) = (unsigned) bp_unpack_value (bp, 1); + if (TREE_CODE (expr) == RESULT_DECL || TREE_CODE (expr) == PARM_DECL || VAR_P (expr)) diff --git a/gcc/tree-streamer-out.c b/gcc/tree-streamer-out.c index ba89f841b5c..c48a85b57f7 100644 --- a/gcc/tree-streamer-out.c +++ b/gcc/tree-streamer-out.c @@ -212,7 +212,7 @@ pack_ts_decl_common_value_fields (struct bitpack_d *bp, tree expr) bp_pack_var_len_unsigned (bp, EH_LANDING_PAD_NR (expr)); } - if (TREE_CODE (expr) == FIELD_DECL) + else if (TREE_CODE (expr) == FIELD_DECL) { bp_pack_value (bp, DECL_PACKED (expr), 1); bp_pack_value (bp, DECL_NONADDRESSABLE_P (expr), 1); @@ -220,12 +220,15 @@ pack_ts_decl_common_value_fields (struct bitpack_d *bp, tree expr) bp_pack_value (bp, expr->decl_common.off_align, 8); } - if (VAR_P (expr)) + else if (VAR_P (expr)) { bp_pack_value (bp, DECL_HAS_DEBUG_EXPR_P (expr), 1); bp_pack_value (bp, DECL_NONLOCAL_FRAME (expr), 1); } + else if (TREE_CODE (expr) == PARM_DECL) + bp_pack_value (bp, DECL_HIDDEN_STRING_LENGTH (expr), 1); + if (TREE_CODE (expr) == RESULT_DECL || TREE_CODE (expr) == PARM_DECL || VAR_P (expr)) diff --git a/gcc/tree.h b/gcc/tree.h index 324ef5b45e7..c0fa04e302a 100644 --- a/gcc/tree.h +++ b/gcc/tree.h @@ -909,6 +909,11 @@ extern void omp_clause_range_check_failed (const_tree, const char *, int, (TREE_CHECK2 (NODE, VAR_DECL, \ RESULT_DECL)->decl_common.decl_nonshareable_flag) +/* In a PARM_DECL, set for Fortran hidden string length arguments that some + buggy callers don't pass to the callee. */ +#define DECL_HIDDEN_STRING_LENGTH(NODE) \ + (TREE_CHECK (NODE, PARM_DECL)->decl_common.decl_nonshareable_flag) + /* In a CALL_EXPR, means that the call is the jump from a thunk to the thunked-to function. */ #define CALL_FROM_THUNK_P(NODE) (CALL_EXPR_CHECK (NODE)->base.protected_flag) -- cgit v1.2.3 From 2c006833c5430be329153c08fd3ee01c2d227064 Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Thu, 30 May 2019 00:16:10 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@271758 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index d81d81e459a..90e9b34cef5 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190529 +20190530 -- cgit v1.2.3 From 37b0646bc6e2398657f293199bd8edc081bbcc8e Mon Sep 17 00:00:00 2001 From: Jakub Jelinek <jakub@redhat.com> Date: Thu, 30 May 2019 09:35:27 +0000 Subject: * tree-predcom.c (is_inv_store_elimination_chain): Fix a typo - lenght to length. * lang.opt (ftail-call-workaround=): Fix a typo - lenghts to lengths. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@271772 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 5 +++++ gcc/fortran/ChangeLog | 4 ++++ gcc/fortran/lang.opt | 2 +- gcc/tree-predcom.c | 2 +- 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b5c2f429f59..e3b416f521e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2019-05-30 Jakub Jelinek <jakub@redhat.com> + + * tree-predcom.c (is_inv_store_elimination_chain): Fix a typo - lenght + to length. + 2019-05-29 Jakub Jelinek <jakub@redhat.com> PR fortran/90329 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index ee4f18e57a4..b56e769cad1 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,7 @@ +2019-05-30 Jakub Jelinek <jakub@redhat.com> + + * lang.opt (ftail-call-workaround=): Fix a typo - lenghts to lengths. + 2019-05-29 Jakub Jelinek <jakub@redhat.com> PR fortran/90329 diff --git a/gcc/fortran/lang.opt b/gcc/fortran/lang.opt index 2e55aa07e65..4d959dc6eca 100644 --- a/gcc/fortran/lang.opt +++ b/gcc/fortran/lang.opt @@ -747,7 +747,7 @@ Frotran Alias(ftail-call-workaround=,1,0) ftail-call-workaround= Fortran RejectNegative Joined UInteger IntegerRange(0, 2) Var(flag_tail_call_workaround) Init(1) -Disallow tail call optimization when a calling routine may have omitted character lenghts. +Disallow tail call optimization when a calling routine may have omitted character lengths. funderscoring Fortran Var(flag_underscoring) Init(1) diff --git a/gcc/tree-predcom.c b/gcc/tree-predcom.c index 4c0e7c7d231..c4c7613293d 100644 --- a/gcc/tree-predcom.c +++ b/gcc/tree-predcom.c @@ -1712,7 +1712,7 @@ is_inv_store_elimination_chain (struct loop *loop, chain_p chain) gcc_assert (!chain->has_max_use_after); - /* If loop iterates for unknown times or fewer times than chain->lenght, + /* If loop iterates for unknown times or fewer times than chain->length, we still need to setup root variable and propagate it with PHI node. */ tree niters = number_of_latch_executions (loop); if (TREE_CODE (niters) != INTEGER_CST -- cgit v1.2.3 From 073b1486a1a3ae8aef44dd1864c9c59a2eb88d29 Mon Sep 17 00:00:00 2001 From: Jonathan Wakely <jwakely@redhat.com> Date: Thu, 30 May 2019 10:36:25 +0000 Subject: Fix typo in libstdc++ documentation * doc/xml/manual/status_cxx2017.xml: Fix typo in documentation of implementation-defined support for [fs.conform.9945]. * doc/html/*: Regenerate. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@271776 138bc75d-0d04-0410-961f-82ee72b054a4 --- libstdc++-v3/ChangeLog | 6 ++++++ libstdc++-v3/doc/html/manual/status.html | 2 +- libstdc++-v3/doc/xml/manual/status_cxx2017.xml | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 8c876da2875..f16e1323236 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,9 @@ +2019-05-30 Jonathan Wakely <jwakely@redhat.com> + + * doc/xml/manual/status_cxx2017.xml: Fix typo in documentation of + implementation-defined support for [fs.conform.9945]. + * doc/html/*: Regenerate. + 2019-05-28 Jonathan Wakely <jwakely@redhat.com> PR libstdc++/90634 diff --git a/libstdc++-v3/doc/html/manual/status.html b/libstdc++-v3/doc/html/manual/status.html index c7eb5f7fbeb..d4aacc49ed5 100644 --- a/libstdc++-v3/doc/html/manual/status.html +++ b/libstdc++-v3/doc/html/manual/status.html @@ -951,7 +951,7 @@ and test for <code class="code">__STDCPP_MATH_SPEC_FUNCS__ >= 201003L</code>. </p><p> <span class="emphasis"><em>30.10.2.1 [fs.conform.9945]</em></span> The behavior of the filesystem library implementation will depend on - the target operating system. Some features will not be not supported + the target operating system. Some features will not be supported on some targets. </p><p> <span class="emphasis"><em>30.10.5 [fs.filesystem.syn]</em></span> diff --git a/libstdc++-v3/doc/xml/manual/status_cxx2017.xml b/libstdc++-v3/doc/xml/manual/status_cxx2017.xml index e1d658f92dd..d5ff74b4e2f 100644 --- a/libstdc++-v3/doc/xml/manual/status_cxx2017.xml +++ b/libstdc++-v3/doc/xml/manual/status_cxx2017.xml @@ -1074,7 +1074,7 @@ and test for <code>__STDCPP_MATH_SPEC_FUNCS__ >= 201003L</code>. <para> <emphasis>30.10.2.1 [fs.conform.9945]</emphasis> The behavior of the filesystem library implementation will depend on - the target operating system. Some features will not be not supported + the target operating system. Some features will not be supported on some targets. </para> -- cgit v1.2.3 From 0060f9f7cf035f43e51d90ca5da4090103362741 Mon Sep 17 00:00:00 2001 From: Marek Polacek <polacek@redhat.com> Date: Thu, 30 May 2019 12:21:11 +0000 Subject: * lang.opt (ftail-call-workaround): Fix a typo. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@271779 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fortran/ChangeLog | 4 ++++ gcc/fortran/lang.opt | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index b56e769cad1..426da2e8c26 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,7 @@ +2019-05-30 Marek Polacek <polacek@redhat.com> + + * lang.opt (ftail-call-workaround): Fix a typo. + 2019-05-30 Jakub Jelinek <jakub@redhat.com> * lang.opt (ftail-call-workaround=): Fix a typo - lenghts to lengths. diff --git a/gcc/fortran/lang.opt b/gcc/fortran/lang.opt index 4d959dc6eca..ec9c02228da 100644 --- a/gcc/fortran/lang.opt +++ b/gcc/fortran/lang.opt @@ -743,7 +743,7 @@ Fortran Var(flag_sign_zero) Init(1) Apply negative sign to zero values. ftail-call-workaround -Frotran Alias(ftail-call-workaround=,1,0) +Fortran Alias(ftail-call-workaround=,1,0) ftail-call-workaround= Fortran RejectNegative Joined UInteger IntegerRange(0, 2) Var(flag_tail_call_workaround) Init(1) -- cgit v1.2.3 From 8e49bd18cc405fa48eb50bb9c17dc4a57ef424f2 Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Fri, 31 May 2019 00:16:09 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@271793 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 90e9b34cef5..9e95ade7f0f 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190530 +20190531 -- cgit v1.2.3 From 6f64774ec86e03fca9d248837901d6d2f38c5175 Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Sat, 1 Jun 2019 00:16:09 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@271830 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 9e95ade7f0f..49b30520771 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190531 +20190601 -- cgit v1.2.3 From 5c5ee357fc572255c1225cd59e8fc0816869900e Mon Sep 17 00:00:00 2001 From: Iain Sandoe <iain@sandoe.co.uk> Date: Sat, 1 Jun 2019 07:27:19 +0000 Subject: Darwin, backport fix for powerpc-darwin long double symbol exports. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit During 8.x, the rs6000 target-specific mangling was reorganised which uncovered a long-standing bug in Darwin’s mangling for ‘IBM’ long double. Now the symbols are correctly mangled, and we end up with a bunch of test link fails. This patch adds the necessary subset of the Linux long double exports to Darwin’s export table. 2019-06-01 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline 2018-12-22 Iain Sandoe <iain@sandoe.co.uk> * /config/os/bsd/darwin/ppc-extra.ver: Append long double symbols. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@271833 138bc75d-0d04-0410-961f-82ee72b054a4 --- libstdc++-v3/ChangeLog | 7 +++++++ libstdc++-v3/config/os/bsd/darwin/ppc-extra.ver | 21 +++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index f16e1323236..f7f7bff6835 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,10 @@ +2019-06-01 Iain Sandoe <iain@sandoe.co.uk> + + Backport from mainline + 2018-12-22 Iain Sandoe <iain@sandoe.co.uk> + + * /config/os/bsd/darwin/ppc-extra.ver: Append long double symbols. + 2019-05-30 Jonathan Wakely <jwakely@redhat.com> * doc/xml/manual/status_cxx2017.xml: Fix typo in documentation of diff --git a/libstdc++-v3/config/os/bsd/darwin/ppc-extra.ver b/libstdc++-v3/config/os/bsd/darwin/ppc-extra.ver index ffe32b65658..f0aee9e8dac 100644 --- a/libstdc++-v3/config/os/bsd/darwin/ppc-extra.ver +++ b/libstdc++-v3/config/os/bsd/darwin/ppc-extra.ver @@ -1 +1,22 @@ __eprintf; +# 3.4 + _ZNSt14numeric_limitsIgE*; + _ZNSirsERg; + _ZNSolsEg; + _ZNSt13basic_istreamIwSt11char_traitsIwEErsERg; + _ZNSt13basic_ostreamIwSt11char_traitsIwEElsEg; + _ZSt14__convert_to_vIgEvPKcRT_RSt12_Ios_IostateRKP*; + _ZStlsIg[cw]St11char_traitsI[cw]EERSt13basic_ostreamIT0_T1_ES6_RKSt7complexIT_E; + _ZStrsIg[cw]St11char_traitsI[cw]EERSt13basic_istreamIT0_T1_ES6_RSt7complexIT_E; +# 3.4.7 + _ZNSi10_M_extractIgEERSiRT_; + _ZNSt13basic_istreamIwSt11char_traitsIwEE10_M_extractIgEERS2_RT_; + _ZNSo9_M_insertIgEERSoT_; + _ZNSt13basic_ostreamIwSt11char_traitsIwEE9_M_insertIgEERS2_T_; +# 3.4.10 + _ZNKSt3tr14hashIgEclEg; + _ZNKSt4hashIgEclEg; +# ldbl 1.3 + _ZT[IS]g; + _ZT[IS]Pg; + _ZT[IS]PKg; -- cgit v1.2.3 From aa76e1662f5fdcbb25a95f9dd5c5e3546a1f2168 Mon Sep 17 00:00:00 2001 From: Iain Sandoe <iain@sandoe.co.uk> Date: Sat, 1 Jun 2019 07:41:06 +0000 Subject: Darwin - backport fix for PR bootstrap/89864 2019-06-01 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline. 2019-05-11 Iain Sandoe <iain@sandoe.co.uk> PR bootstrap/89864 * inclhack.def (darwin_ucred__Atomic): Do not supply test_text for wrap fixes. * fixincl.x: Regenerated. Backport from mainline. 2019-04-18 Erik Schnetter <schnetter@gmail.com> Jakub Jelinek <jakub@redhat.com> Iain Sandoe <iain@sandoe.co.uk> PR bootstrap/89864 * inclhack.def (darwin_ucred__Atomic): New, work around _Atomic keyword use in headers included by C++. * fixincl.x: Regenerated. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@271834 138bc75d-0d04-0410-961f-82ee72b054a4 --- fixincludes/ChangeLog | 20 +++++++++++++++++ fixincludes/fixincl.x | 58 +++++++++++++++++++++++++++++++++++++++++++----- fixincludes/inclhack.def | 19 ++++++++++++++++ 3 files changed, 92 insertions(+), 5 deletions(-) diff --git a/fixincludes/ChangeLog b/fixincludes/ChangeLog index b2d1a9d1399..fdd328bcfde 100644 --- a/fixincludes/ChangeLog +++ b/fixincludes/ChangeLog @@ -1,3 +1,23 @@ +2019-06-01 Iain Sandoe <iain@sandoe.co.uk> + + Backport from mainline. + 2019-05-11 Iain Sandoe <iain@sandoe.co.uk> + + PR bootstrap/89864 + * inclhack.def (darwin_ucred__Atomic): Do not supply test_text + for wrap fixes. + * fixincl.x: Regenerated. + + Backport from mainline. + 2019-04-18 Erik Schnetter <schnetter@gmail.com> + Jakub Jelinek <jakub@redhat.com> + Iain Sandoe <iain@sandoe.co.uk> + + PR bootstrap/89864 + * inclhack.def (darwin_ucred__Atomic): New, work around _Atomic keyword + use in headers included by C++. + * fixincl.x: Regenerated. + 2019-02-22 Release Manager * GCC 8.3.0 released. diff --git a/fixincludes/fixincl.x b/fixincludes/fixincl.x index 9a2dc8b417f..1a1b05f47b9 100644 --- a/fixincludes/fixincl.x +++ b/fixincludes/fixincl.x @@ -2,11 +2,11 @@ * * DO NOT EDIT THIS FILE (fixincl.x) * - * It has been AutoGen-ed February 22, 2018 at 03:46:51 PM by AutoGen 5.18 + * It has been AutoGen-ed May 30, 2019 at 01:23:39 AM by AutoGen 5.17.4 * From the definitions inclhack.def * and the template file fixincl */ -/* DO NOT SVN-MERGE THIS FILE, EITHER Thu Feb 22 15:46:51 UTC 2018 +/* DO NOT SVN-MERGE THIS FILE, EITHER Thu May 30 01:23:39 BST 2019 * * You must regenerate it. Use the ./genfixes script. * @@ -15,7 +15,7 @@ * certain ANSI-incompatible system header files which are fixed to work * correctly with ANSI C and placed in a directory that GNU C will search. * - * This file contains 249 fixup descriptions. + * This file contains 250 fixup descriptions. * * See README for more information. * @@ -3220,6 +3220,48 @@ static const char* apzDarwin_Stdint_7Patch[] = { #endif", (char*)NULL }; +/* * * * * * * * * * * * * * * * * * * * * * * * * * + * + * Description of Darwin_Ucred__Atomic fix + */ +tSCC zDarwin_Ucred__AtomicName[] = + "darwin_ucred__Atomic"; + +/* + * File name selection pattern + */ +tSCC zDarwin_Ucred__AtomicList[] = + "sys/ucred.h\0"; +/* + * Machine/OS name selection pattern + */ +tSCC* apzDarwin_Ucred__AtomicMachs[] = { + "*-*-darwin*", + (const char*)NULL }; + +/* + * content selection pattern - do fix if pattern found + */ +tSCC zDarwin_Ucred__AtomicSelect0[] = + "_Atomic"; + +#define DARWIN_UCRED__ATOMIC_TEST_CT 1 +static tTestDesc aDarwin_Ucred__AtomicTests[] = { + { TT_EGREP, zDarwin_Ucred__AtomicSelect0, (regex_t*)NULL }, }; + +/* + * Fix Command Arguments for Darwin_Ucred__Atomic + */ +static const char* apzDarwin_Ucred__AtomicPatch[] = { + "wrap", + "#if (__STDC_VERSION__ < 201112L) || defined(__cplusplus)\n\ +# define _Atomic volatile\n\ +#endif\n", + "#if (__STDC_VERSION__ < 201112L) || defined(__cplusplus)\n\ +# undef _Atomic\n\ +#endif\n", + (char*)NULL }; + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * Description of Dec_Intern_Asm fix @@ -10099,9 +10141,9 @@ static const char* apzX11_SprintfPatch[] = { * * List of all fixes */ -#define REGEX_COUNT 287 +#define REGEX_COUNT 288 #define MACH_LIST_SIZE_LIMIT 187 -#define FIX_COUNT 249 +#define FIX_COUNT 250 /* * Enumerate the fixes @@ -10183,6 +10225,7 @@ typedef enum { DARWIN_STDINT_5_FIXIDX, DARWIN_STDINT_6_FIXIDX, DARWIN_STDINT_7_FIXIDX, + DARWIN_UCRED__ATOMIC_FIXIDX, DEC_INTERN_ASM_FIXIDX, DJGPP_WCHAR_H_FIXIDX, ECD_CURSOR_FIXIDX, @@ -10739,6 +10782,11 @@ tFixDesc fixDescList[ FIX_COUNT ] = { DARWIN_STDINT_7_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, aDarwin_Stdint_7Tests, apzDarwin_Stdint_7Patch, 0 }, + { zDarwin_Ucred__AtomicName, zDarwin_Ucred__AtomicList, + apzDarwin_Ucred__AtomicMachs, + DARWIN_UCRED__ATOMIC_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, + aDarwin_Ucred__AtomicTests, apzDarwin_Ucred__AtomicPatch, 0 }, + { zDec_Intern_AsmName, zDec_Intern_AsmList, apzDec_Intern_AsmMachs, DEC_INTERN_ASM_TEST_CT, FD_MACH_ONLY, diff --git a/fixincludes/inclhack.def b/fixincludes/inclhack.def index 77444db2333..c3687f73351 100644 --- a/fixincludes/inclhack.def +++ b/fixincludes/inclhack.def @@ -1592,6 +1592,25 @@ fix = { "#define UINTMAX_C(v) (v ## ULL)"; }; +/* The SDK included with XCode 10.2 has the file <sys/ucred.h> that uses the + C11 _Atomic keyword (exposing it to C++ code). The work-around here follows + the header in declaring the entity volatile when _Atomic is not available. +*/ +fix = { + hackname = darwin_ucred__Atomic; + mach = "*-*-darwin*"; + files = sys/ucred.h; + select = "_Atomic"; + c_fix = wrap; + c_fix_arg = "#if (__STDC_VERSION__ < 201112L) || defined(__cplusplus)\n" + "# define _Atomic volatile\n" + "#endif\n"; + c_fix_arg = "#if (__STDC_VERSION__ < 201112L) || defined(__cplusplus)\n" + "# undef _Atomic\n" + "#endif\n"; + test_text = ""; /* Don't provide this for wrap fixes. */ +}; + /* * Fix <c_asm.h> on Digital UNIX V4.0: * It contains a prototype for a DEC C internal asm() function, -- cgit v1.2.3 From 87b825c0b37e4b9cdc8f89918114fd1b803604a6 Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Sun, 2 Jun 2019 00:16:13 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@271841 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 49b30520771..e6878c2e100 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190601 +20190602 -- cgit v1.2.3 From fdd027e7efe24d10d603380ab11303fc942c1a8b Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Mon, 3 Jun 2019 00:16:09 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@271850 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index e6878c2e100..c734c6dcbad 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190602 +20190603 -- cgit v1.2.3 From fa45330c372d38a603510c4d98faadcf35f3e4b0 Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Tue, 4 Jun 2019 00:16:09 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@271897 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index c734c6dcbad..d33f61a34b6 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190603 +20190604 -- cgit v1.2.3 From 13e303d9fd133f948ae538232aff65eed63d7f28 Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Wed, 5 Jun 2019 00:16:09 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@271942 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index d33f61a34b6..2e5d7b20d0f 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190604 +20190605 -- cgit v1.2.3 From 1ddc575c255b2591032bed4cd37aeb57d922e7d7 Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Thu, 6 Jun 2019 00:16:10 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@271980 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 2e5d7b20d0f..ed0abfaef53 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190605 +20190606 -- cgit v1.2.3 From a9bd6dbc2db482523c60a2fe48527c061600e459 Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Fri, 7 Jun 2019 00:16:11 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@272025 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index ed0abfaef53..fb321a1d9f9 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190606 +20190607 -- cgit v1.2.3 From 570b8e106ffca7ff8dfa926640da2bfceb667f7e Mon Sep 17 00:00:00 2001 From: Iain Sandoe <iain@sandoe.co.uk> Date: Fri, 7 Jun 2019 07:36:18 +0000 Subject: Darwin, x86, backport fix for PR82920 (part1 code changes) gcc/ 2019-06-07 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline. 2019-05-12 Iain Sandoe <iain@sandoe.co.uk> PR target/82920 * config/i386/i386.c (ix86_output_jmp_thunk_or_indirect): New. (ix86_output_indirect_branch_via_reg): Use output mechanism accounting for __USER_LABEL_PREFIX__. (ix86_output_indirect_branch_via_push): Likewise. (ix86_output_function_return): Likewise. (ix86_output_indirect_function_return): Likewise. gcc/testsuite/ 2019-06-07 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline. 2019-05-12 Iain Sandoe <iain@sandoe.co.uk> Dominique d'Humieres <dominiq@gcc.gnu.org> PR target/82920 * gcc.target/i386/indirect-thunk-1.c: Adjust scan-asms for Darwin, do not use -fno-pic on Darwin. * gcc.target/i386/indirect-thunk-2.c: Likewise. * gcc.target/i386/indirect-thunk-3.c: Likewise. * gcc.target/i386/indirect-thunk-4.c: Likewise. * gcc.target/i386/indirect-thunk-7.c: Likewise. * gcc.target/i386/indirect-thunk-attr-1.c: Likewise. * gcc.target/i386/indirect-thunk-attr-2.c: Likewise. * gcc.target/i386/indirect-thunk-attr-3.c: Likewise. * gcc.target/i386/indirect-thunk-attr-4.c: Likewise. * gcc.target/i386/indirect-thunk-attr-5.c: Likewise. * gcc.target/i386/indirect-thunk-attr-6.c: Likewise. * gcc.target/i386/indirect-thunk-attr-7.c: Likewise. * gcc.target/i386/indirect-thunk-attr-8.c: Likewise. * gcc.target/i386/indirect-thunk-extern-1.c: Likewise. * gcc.target/i386/indirect-thunk-extern-2.c: Likewise. * gcc.target/i386/indirect-thunk-extern-3.c: Likewise. * gcc.target/i386/indirect-thunk-extern-4.c: Likewise. * gcc.target/i386/indirect-thunk-extern-7.c: Likewise. * gcc.target/i386/indirect-thunk-inline-1.c: Likewise. * gcc.target/i386/indirect-thunk-inline-2.c: Likewise. * gcc.target/i386/indirect-thunk-inline-3.c: Likewise. * gcc.target/i386/indirect-thunk-inline-4.c: Likewise. * gcc.target/i386/indirect-thunk-inline-7.c: Likewise. * gcc.target/i386/indirect-thunk-register-1.c: Likewise. * gcc.target/i386/indirect-thunk-register-2.c: Likewise. * gcc.target/i386/indirect-thunk-register-3.c: Likewise. * gcc.target/i386/indirect-thunk-register-4.c: Likewise. * gcc.target/i386/ret-thunk-1.c: Likewise. * gcc.target/i386/ret-thunk-10.c: Likewise. * gcc.target/i386/ret-thunk-11.c: Likewise. * gcc.target/i386/ret-thunk-12.c: Likewise. * gcc.target/i386/ret-thunk-13.c: Likewise. * gcc.target/i386/ret-thunk-14.c: Likewise. * gcc.target/i386/ret-thunk-15.c: Likewise. * gcc.target/i386/ret-thunk-16.c: Likewise. * gcc.target/i386/ret-thunk-2.c: Likewise. * gcc.target/i386/ret-thunk-22.c: Likewise. * gcc.target/i386/ret-thunk-23.c: Likewise. * gcc.target/i386/ret-thunk-24.c: Likewise. * gcc.target/i386/ret-thunk-3.c: Likewise. * gcc.target/i386/ret-thunk-4.c: Likewise. * gcc.target/i386/ret-thunk-5.c: Likewise. * gcc.target/i386/ret-thunk-6.c: Likewise. * gcc.target/i386/ret-thunk-7.c: Likewise. * gcc.target/i386/ret-thunk-8.c: Likewise. * gcc.target/i386/ret-thunk-9.c: Likewise. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@272031 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 13 ++++ gcc/config/i386/i386.c | 79 ++++++++++------------ gcc/testsuite/ChangeLog | 55 +++++++++++++++ gcc/testsuite/gcc.target/i386/indirect-thunk-1.c | 13 ++-- gcc/testsuite/gcc.target/i386/indirect-thunk-2.c | 13 ++-- gcc/testsuite/gcc.target/i386/indirect-thunk-3.c | 13 ++-- gcc/testsuite/gcc.target/i386/indirect-thunk-4.c | 13 ++-- gcc/testsuite/gcc.target/i386/indirect-thunk-7.c | 11 +-- .../gcc.target/i386/indirect-thunk-attr-1.c | 13 ++-- .../gcc.target/i386/indirect-thunk-attr-2.c | 13 ++-- .../gcc.target/i386/indirect-thunk-attr-3.c | 13 ++-- .../gcc.target/i386/indirect-thunk-attr-4.c | 13 ++-- .../gcc.target/i386/indirect-thunk-attr-5.c | 13 ++-- .../gcc.target/i386/indirect-thunk-attr-6.c | 13 ++-- .../gcc.target/i386/indirect-thunk-attr-7.c | 11 +-- .../gcc.target/i386/indirect-thunk-attr-8.c | 9 +-- .../gcc.target/i386/indirect-thunk-extern-1.c | 13 ++-- .../gcc.target/i386/indirect-thunk-extern-2.c | 13 ++-- .../gcc.target/i386/indirect-thunk-extern-3.c | 13 ++-- .../gcc.target/i386/indirect-thunk-extern-4.c | 10 +-- .../gcc.target/i386/indirect-thunk-extern-7.c | 9 +-- .../gcc.target/i386/indirect-thunk-inline-1.c | 13 ++-- .../gcc.target/i386/indirect-thunk-inline-2.c | 13 ++-- .../gcc.target/i386/indirect-thunk-inline-3.c | 13 ++-- .../gcc.target/i386/indirect-thunk-inline-4.c | 13 ++-- .../gcc.target/i386/indirect-thunk-inline-7.c | 9 +-- .../gcc.target/i386/indirect-thunk-register-1.c | 13 ++-- .../gcc.target/i386/indirect-thunk-register-2.c | 9 +-- .../gcc.target/i386/indirect-thunk-register-3.c | 9 +-- .../gcc.target/i386/indirect-thunk-register-4.c | 3 +- gcc/testsuite/gcc.target/i386/ret-thunk-1.c | 6 +- gcc/testsuite/gcc.target/i386/ret-thunk-10.c | 13 ++-- gcc/testsuite/gcc.target/i386/ret-thunk-11.c | 13 ++-- gcc/testsuite/gcc.target/i386/ret-thunk-12.c | 13 ++-- gcc/testsuite/gcc.target/i386/ret-thunk-13.c | 13 ++-- gcc/testsuite/gcc.target/i386/ret-thunk-14.c | 15 ++-- gcc/testsuite/gcc.target/i386/ret-thunk-15.c | 15 ++-- gcc/testsuite/gcc.target/i386/ret-thunk-16.c | 11 +-- gcc/testsuite/gcc.target/i386/ret-thunk-2.c | 6 +- gcc/testsuite/gcc.target/i386/ret-thunk-22.c | 12 ++-- gcc/testsuite/gcc.target/i386/ret-thunk-23.c | 12 ++-- gcc/testsuite/gcc.target/i386/ret-thunk-24.c | 12 ++-- gcc/testsuite/gcc.target/i386/ret-thunk-3.c | 6 +- gcc/testsuite/gcc.target/i386/ret-thunk-4.c | 6 +- gcc/testsuite/gcc.target/i386/ret-thunk-5.c | 6 +- gcc/testsuite/gcc.target/i386/ret-thunk-6.c | 6 +- gcc/testsuite/gcc.target/i386/ret-thunk-7.c | 6 +- gcc/testsuite/gcc.target/i386/ret-thunk-8.c | 6 +- gcc/testsuite/gcc.target/i386/ret-thunk-9.c | 17 +++-- 49 files changed, 400 insertions(+), 255 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e3b416f521e..0a1495627dc 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,16 @@ +2019-06-07 Iain Sandoe <iain@sandoe.co.uk> + + Backport from mainline. + 2019-05-12 Iain Sandoe <iain@sandoe.co.uk> + + PR target/82920 + * config/i386/i386.c (ix86_output_jmp_thunk_or_indirect): New. + (ix86_output_indirect_branch_via_reg): Use output mechanism + accounting for __USER_LABEL_PREFIX__. + (ix86_output_indirect_branch_via_push): Likewise. + (ix86_output_function_return): Likewise. + (ix86_output_indirect_function_return): Likewise. + 2019-05-30 Jakub Jelinek <jakub@redhat.com> * tree-predcom.c (is_inv_store_elimination_chain): Fix a typo - lenght diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 00952f51fa4..29272850ae6 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -28678,6 +28678,25 @@ ix86_nopic_noplt_attribute_p (rtx call_op) return false; } +/* Helper to output the jmp/call. */ +static void +ix86_output_jmp_thunk_or_indirect (const char *thunk_name, + enum indirect_thunk_prefix need_prefix, + const int regno) +{ + if (thunk_name != NULL) + { + if (need_prefix == indirect_thunk_prefix_bnd) + fprintf (asm_out_file, "\tbnd jmp\t"); + else + fprintf (asm_out_file, "\tjmp\t"); + assemble_name (asm_out_file, thunk_name); + putc ('\n', asm_out_file); + } + else + output_indirect_thunk (need_prefix, regno); +} + /* Output indirect branch via a call and return thunk. CALL_OP is a register which contains the branch target. XASM is the assembly template for CALL_OP. Branch is a tail call if SIBCALL_P is true. @@ -28719,25 +28738,17 @@ ix86_output_indirect_branch_via_reg (rtx call_op, bool sibcall_p) thunk_name = NULL; if (sibcall_p) - { - if (thunk_name != NULL) - { - if (need_prefix == indirect_thunk_prefix_bnd) - fprintf (asm_out_file, "\tbnd jmp\t%s\n", thunk_name); - else - fprintf (asm_out_file, "\tjmp\t%s\n", thunk_name); - } - else - output_indirect_thunk (need_prefix, regno); - } + ix86_output_jmp_thunk_or_indirect (thunk_name, need_prefix, regno); else { if (thunk_name != NULL) { if (need_prefix == indirect_thunk_prefix_bnd) - fprintf (asm_out_file, "\tbnd call\t%s\n", thunk_name); + fprintf (asm_out_file, "\tbnd call\t"); else - fprintf (asm_out_file, "\tcall\t%s\n", thunk_name); + fprintf (asm_out_file, "\tcall\t"); + assemble_name (asm_out_file, thunk_name); + putc ('\n', asm_out_file); return; } @@ -28761,15 +28772,7 @@ ix86_output_indirect_branch_via_reg (rtx call_op, bool sibcall_p) ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, indirectlabel1); - if (thunk_name != NULL) - { - if (need_prefix == indirect_thunk_prefix_bnd) - fprintf (asm_out_file, "\tbnd jmp\t%s\n", thunk_name); - else - fprintf (asm_out_file, "\tjmp\t%s\n", thunk_name); - } - else - output_indirect_thunk (need_prefix, regno); + ix86_output_jmp_thunk_or_indirect (thunk_name, need_prefix, regno); ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, indirectlabel2); @@ -28834,15 +28837,7 @@ ix86_output_indirect_branch_via_push (rtx call_op, const char *xasm, if (sibcall_p) { output_asm_insn (push_buf, &call_op); - if (thunk_name != NULL) - { - if (need_prefix == indirect_thunk_prefix_bnd) - fprintf (asm_out_file, "\tbnd jmp\t%s\n", thunk_name); - else - fprintf (asm_out_file, "\tjmp\t%s\n", thunk_name); - } - else - output_indirect_thunk (need_prefix, regno); + ix86_output_jmp_thunk_or_indirect (thunk_name, need_prefix, regno); } else { @@ -28901,15 +28896,7 @@ ix86_output_indirect_branch_via_push (rtx call_op, const char *xasm, output_asm_insn (push_buf, &call_op); - if (thunk_name != NULL) - { - if (need_prefix == indirect_thunk_prefix_bnd) - fprintf (asm_out_file, "\tbnd jmp\t%s\n", thunk_name); - else - fprintf (asm_out_file, "\tjmp\t%s\n", thunk_name); - } - else - output_indirect_thunk (need_prefix, regno); + ix86_output_jmp_thunk_or_indirect (thunk_name, need_prefix, regno); ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, indirectlabel2); @@ -28978,13 +28965,15 @@ ix86_output_function_return (bool long_p) if (need_prefix == indirect_thunk_prefix_bnd) { indirect_return_bnd_needed |= need_thunk; - fprintf (asm_out_file, "\tbnd jmp\t%s\n", thunk_name); + fprintf (asm_out_file, "\tbnd jmp\t"); } else { indirect_return_needed |= need_thunk; - fprintf (asm_out_file, "\tjmp\t%s\n", thunk_name); + fprintf (asm_out_file, "\tjmp\t"); } + assemble_name (asm_out_file, thunk_name); + putc ('\n', asm_out_file); } else output_indirect_thunk (need_prefix, INVALID_REGNUM); @@ -29025,7 +29014,7 @@ ix86_output_indirect_function_return (rtx ret_op) indirect_return_via_cx_bnd = true; indirect_thunks_bnd_used |= 1 << CX_REG; } - fprintf (asm_out_file, "\tbnd jmp\t%s\n", thunk_name); + fprintf (asm_out_file, "\tbnd jmp\t"); } else { @@ -29034,8 +29023,10 @@ ix86_output_indirect_function_return (rtx ret_op) indirect_return_via_cx = true; indirect_thunks_used |= 1 << CX_REG; } - fprintf (asm_out_file, "\tjmp\t%s\n", thunk_name); + fprintf (asm_out_file, "\tjmp\t"); } + assemble_name (asm_out_file, thunk_name); + putc ('\n', asm_out_file); } else output_indirect_thunk (need_prefix, regno); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 4fac3e1de60..b1f8f2b79b0 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,58 @@ +2019-06-07 Iain Sandoe <iain@sandoe.co.uk> + + Backport from mainline. + 2019-05-12 Iain Sandoe <iain@sandoe.co.uk> + Dominique d'Humieres <dominiq@gcc.gnu.org> + + PR target/82920 + * gcc.target/i386/indirect-thunk-1.c: Adjust scan-asms for Darwin, + do not use -fno-pic on Darwin. + * gcc.target/i386/indirect-thunk-2.c: Likewise. + * gcc.target/i386/indirect-thunk-3.c: Likewise. + * gcc.target/i386/indirect-thunk-4.c: Likewise. + * gcc.target/i386/indirect-thunk-7.c: Likewise. + * gcc.target/i386/indirect-thunk-attr-1.c: Likewise. + * gcc.target/i386/indirect-thunk-attr-2.c: Likewise. + * gcc.target/i386/indirect-thunk-attr-3.c: Likewise. + * gcc.target/i386/indirect-thunk-attr-4.c: Likewise. + * gcc.target/i386/indirect-thunk-attr-5.c: Likewise. + * gcc.target/i386/indirect-thunk-attr-6.c: Likewise. + * gcc.target/i386/indirect-thunk-attr-7.c: Likewise. + * gcc.target/i386/indirect-thunk-attr-8.c: Likewise. + * gcc.target/i386/indirect-thunk-extern-1.c: Likewise. + * gcc.target/i386/indirect-thunk-extern-2.c: Likewise. + * gcc.target/i386/indirect-thunk-extern-3.c: Likewise. + * gcc.target/i386/indirect-thunk-extern-4.c: Likewise. + * gcc.target/i386/indirect-thunk-extern-7.c: Likewise. + * gcc.target/i386/indirect-thunk-inline-1.c: Likewise. + * gcc.target/i386/indirect-thunk-inline-2.c: Likewise. + * gcc.target/i386/indirect-thunk-inline-3.c: Likewise. + * gcc.target/i386/indirect-thunk-inline-4.c: Likewise. + * gcc.target/i386/indirect-thunk-inline-7.c: Likewise. + * gcc.target/i386/indirect-thunk-register-1.c: Likewise. + * gcc.target/i386/indirect-thunk-register-2.c: Likewise. + * gcc.target/i386/indirect-thunk-register-3.c: Likewise. + * gcc.target/i386/indirect-thunk-register-4.c: Likewise. + * gcc.target/i386/ret-thunk-1.c: Likewise. + * gcc.target/i386/ret-thunk-10.c: Likewise. + * gcc.target/i386/ret-thunk-11.c: Likewise. + * gcc.target/i386/ret-thunk-12.c: Likewise. + * gcc.target/i386/ret-thunk-13.c: Likewise. + * gcc.target/i386/ret-thunk-14.c: Likewise. + * gcc.target/i386/ret-thunk-15.c: Likewise. + * gcc.target/i386/ret-thunk-16.c: Likewise. + * gcc.target/i386/ret-thunk-2.c: Likewise. + * gcc.target/i386/ret-thunk-22.c: Likewise. + * gcc.target/i386/ret-thunk-23.c: Likewise. + * gcc.target/i386/ret-thunk-24.c: Likewise. + * gcc.target/i386/ret-thunk-3.c: Likewise. + * gcc.target/i386/ret-thunk-4.c: Likewise. + * gcc.target/i386/ret-thunk-5.c: Likewise. + * gcc.target/i386/ret-thunk-6.c: Likewise. + * gcc.target/i386/ret-thunk-7.c: Likewise. + * gcc.target/i386/ret-thunk-8.c: Likewise. + * gcc.target/i386/ret-thunk-9.c: Likewise. + 2019-05-28 Eric Botcazou <ebotcazou@adacore.com> * gnat.dg/opt79.ad[sb]: New test. diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-1.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-1.c index 6e94d2c4865..052d24dabdf 100644 --- a/gcc/testsuite/gcc.target/i386/indirect-thunk-1.c +++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-1.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk -fno-pic" } */ +/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk" } */ +/* { dg-additional-options "-fno-pic" { target { ! *-*-darwin* } } } */ typedef void (*dispatch_t)(long offset); @@ -11,9 +12,11 @@ male_indirect_jump (long offset) dispatch(offset); } -/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*_?dispatch" { target *-*-linux* } } } */ -/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk_(r|e)ax" } } */ -/* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */ -/* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */ +/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*dispatch" { target *-*-linux* } } } */ +/* { dg-final { scan-assembler {movq[ \t]*_dispatch} { target { lp64 && *-*-darwin* } } } } */ +/* { dg-final { scan-assembler {movl[ \t]*l_dispatch\$non_lazy_ptr-L[0-9]+\$pb} { target { ia32 && *-*-darwin* } } } } */ +/* { dg-final { scan-assembler "jmp\[ \t\]*_?__x86_indirect_thunk_(r|e)ax" } } */ +/* { dg-final { scan-assembler {jmp[ \t]*\.?LIND} } } */ +/* { dg-final { scan-assembler {call[ \t]*\.?LIND} } } */ /* { dg-final { scan-assembler {\tpause} } } */ /* { dg-final { scan-assembler {\tlfence} } } */ diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-2.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-2.c index 3c467078964..2cfbd728b4b 100644 --- a/gcc/testsuite/gcc.target/i386/indirect-thunk-2.c +++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-2.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk -fno-pic" } */ +/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk " } */ +/* { dg-additional-options "-fno-pic" { target { ! *-*-darwin* } } } */ typedef void (*dispatch_t)(long offset); @@ -11,9 +12,11 @@ male_indirect_jump (long offset) dispatch[offset](offset); } -/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*_?dispatch" { target *-*-linux* } } } */ -/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk_(r|e)ax" } } */ -/* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */ -/* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */ +/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*dispatch" { target *-*-linux* } } } */ +/* { dg-final { scan-assembler {movq[ \t]*_dispatch} { target { lp64 && *-*-darwin* } } } } */ +/* { dg-final { scan-assembler {movl[ \t]*l_dispatch\$non_lazy_ptr-L[0-9]+\$pb} { target { ia32 && *-*-darwin* } } } } */ +/* { dg-final { scan-assembler "jmp\[ \t\]*_?__x86_indirect_thunk_(r|e)ax" } } */ +/* { dg-final { scan-assembler {jmp[ \t]*\.?LIND} } } */ +/* { dg-final { scan-assembler {call[ \t]*\.?LIND} } } */ /* { dg-final { scan-assembler {\tpause} } } */ /* { dg-final { scan-assembler {\tlfence} } } */ diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-3.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-3.c index e4c9b885d50..59bb08613b7 100644 --- a/gcc/testsuite/gcc.target/i386/indirect-thunk-3.c +++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-3.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk -fno-pic" } */ +/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk " } */ +/* { dg-additional-options "-fno-pic" { target { ! *-*-darwin* } } } */ typedef void (*dispatch_t)(long offset); @@ -12,9 +13,11 @@ male_indirect_jump (long offset) return 0; } -/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*_?dispatch" { target *-*-linux* } } } */ -/* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" } } */ -/* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */ -/* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */ +/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*dispatch" { target *-*-linux* } } } */ +/* { dg-final { scan-assembler {movq[ \t]*_dispatch} { target { lp64 && *-*-darwin* } } } } */ +/* { dg-final { scan-assembler {movl[ \t]*l_dispatch\$non_lazy_ptr-L[0-9]+\$pb} { target { ia32 && *-*-darwin* } } } } */ +/* { dg-final { scan-assembler "call\[ \t\]*_?__x86_indirect_thunk_(r|e)ax" } } */ +/* { dg-final { scan-assembler {jmp[ \t]*\.?LIND} } } */ +/* { dg-final { scan-assembler {call[ \t]*\.?LIND} } } */ /* { dg-final { scan-assembler {\tpause} } } */ /* { dg-final { scan-assembler {\tlfence} } } */ diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-4.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-4.c index b22554ae282..59640fab8f1 100644 --- a/gcc/testsuite/gcc.target/i386/indirect-thunk-4.c +++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-4.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk -fno-pic" } */ +/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk " } */ +/* { dg-additional-options "-fno-pic" { target { ! *-*-darwin* } } } */ typedef void (*dispatch_t)(long offset); @@ -12,9 +13,11 @@ male_indirect_jump (long offset) return 0; } -/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*_?dispatch" { target *-*-linux* } } } */ -/* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" } } */ -/* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */ -/* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */ +/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*dispatch" { target *-*-linux* } } } */ +/* { dg-final { scan-assembler {movq[ \t]*_dispatch} { target { lp64 && *-*-darwin* } } } } */ +/* { dg-final { scan-assembler {movl[ \t]*l_dispatch\$non_lazy_ptr-L[0-9]+\$pb} { target { ia32 && *-*-darwin* } } } } */ +/* { dg-final { scan-assembler "call\[ \t\]*_?__x86_indirect_thunk_(r|e)ax" } } */ +/* { dg-final { scan-assembler {jmp[ \t]*\.?LIND} } } */ +/* { dg-final { scan-assembler {call[ \t]*\.?LIND} } } */ /* { dg-final { scan-assembler {\tpause} } } */ /* { dg-final { scan-assembler {\tlfence} } } */ diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-7.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-7.c index 53868f46558..6f2eec85122 100644 --- a/gcc/testsuite/gcc.target/i386/indirect-thunk-7.c +++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-7.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk -fno-pic -fjump-tables" } */ +/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk -fjump-tables" } */ +/* { dg-additional-options "-fno-pic" { target { ! *-*-darwin* } } } */ void func0 (void); void func1 (void); @@ -36,8 +37,10 @@ bar (int i) } /* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*\.L\[0-9\]+\\(,%" { target *-*-linux* } } } */ -/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk_(r|e)ax" } } */ -/* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */ -/* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */ +/* { dg-final { scan-assembler {leaq[ \t]*L[0-9]+\(%rip\)} { target { lp64 && *-*-darwin* } } } } */ +/* { dg-final { scan-assembler {addl[ \t]*L[0-9]+-L[0-9]+\$pb} { target { ia32 && *-*-darwin* } } } } */ +/* { dg-final { scan-assembler "jmp\[ \t\]*_?__x86_indirect_thunk_(r|e)ax" } } */ +/* { dg-final { scan-assembler {jmp[ \t]*\.?LIND} } } */ +/* { dg-final { scan-assembler {call[ \t]*\.?LIND} } } */ /* { dg-final { scan-assembler {\tpause} } } */ /* { dg-final { scan-assembler {\tlfence} } } */ diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-1.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-1.c index 7106407b83d..8620bf1d836 100644 --- a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-1.c +++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-1.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -fno-pic" } */ +/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep " } */ +/* { dg-additional-options "-fno-pic" { target { ! *-*-darwin* } } } */ typedef void (*dispatch_t)(long offset); @@ -14,9 +15,11 @@ male_indirect_jump (long offset) dispatch(offset); } -/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*_?dispatch" { target *-*-linux* } } } */ -/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk_(r|e)ax" } } */ -/* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */ -/* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */ +/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*dispatch" { target *-*-linux* } } } */ +/* { dg-final { scan-assembler {movq[ \t]*_dispatch} { target { lp64 && *-*-darwin* } } } } */ +/* { dg-final { scan-assembler {movl[ \t]*l_dispatch\$non_lazy_ptr-L[0-9]+\$pb} { target { ia32 && *-*-darwin* } } } } */ +/* { dg-final { scan-assembler "jmp\[ \t\]*_?__x86_indirect_thunk_(r|e)ax" } } */ +/* { dg-final { scan-assembler {jmp[ \t]*\.?LIND} } } */ +/* { dg-final { scan-assembler {call[ \t]*\.?LIND} } } */ /* { dg-final { scan-assembler {\tpause} } } */ /* { dg-final { scan-assembler {\tlfence} } } */ diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-2.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-2.c index 27c7e5b029b..42e83416965 100644 --- a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-2.c +++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-2.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -fno-pic" } */ +/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep " } */ +/* { dg-additional-options "-fno-pic" { target { ! *-*-darwin* } } } */ typedef void (*dispatch_t)(long offset); @@ -12,9 +13,11 @@ male_indirect_jump (long offset) dispatch[offset](offset); } -/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*_?dispatch" { target *-*-linux* } } } */ -/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk_(r|e)ax" } } */ -/* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */ -/* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */ +/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*dispatch" { target *-*-linux* } } } */ +/* { dg-final { scan-assembler {movq[ \t]*_dispatch} { target { lp64 && *-*-darwin* } } } } */ +/* { dg-final { scan-assembler {movl[ \t]*l_dispatch\$non_lazy_ptr-L[0-9]+\$pb} { target { ia32 && *-*-darwin* } } } } */ +/* { dg-final { scan-assembler "jmp\[ \t\]*_?__x86_indirect_thunk_(r|e)ax" } } */ +/* { dg-final { scan-assembler {jmp[ \t]*\.?LIND} } } */ +/* { dg-final { scan-assembler {call[ \t]*\.?LIND} } } */ /* { dg-final { scan-assembler {\tpause} } } */ /* { dg-final { scan-assembler {\tlfence} } } */ diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-3.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-3.c index 89a2bac8403..6a9c51337d9 100644 --- a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-3.c +++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-3.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -fno-pic" } */ +/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep " } */ +/* { dg-additional-options "-fno-pic" { target { ! *-*-darwin* } } } */ typedef void (*dispatch_t)(long offset); @@ -14,9 +15,11 @@ male_indirect_jump (long offset) return 0; } -/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*_?dispatch" { target *-*-linux* } } } */ -/* { dg-final { scan-assembler-times "jmp\[ \t\]*\.LIND" 2 } } */ -/* { dg-final { scan-assembler-times "call\[ \t\]*\.LIND" 2 } } */ +/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*dispatch" { target *-*-linux* } } } */ +/* { dg-final { scan-assembler {movq[ \t]*_dispatch} { target { lp64 && *-*-darwin* } } } } */ +/* { dg-final { scan-assembler {movl[ \t]*l_dispatch\$non_lazy_ptr-L[0-9]+\$pb} { target { ia32 && *-*-darwin* } } } } */ +/* { dg-final { scan-assembler-times {jmp[ \t]*\.?LIND} 2 } } */ +/* { dg-final { scan-assembler-times {call[ \t]*\.?LIND} 2 } } */ /* { dg-final { scan-assembler {\tpause} } } */ /* { dg-final { scan-assembler {\tlfence} } } */ -/* { dg-final { scan-assembler-not "__x86_indirect_thunk" } } */ +/* { dg-final { scan-assembler-not "_?__x86_indirect_thunk" } } */ diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-4.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-4.c index 3eb83c3779a..85ec57b5a8d 100644 --- a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-4.c +++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-4.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -fno-pic" } */ +/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep " } */ +/* { dg-additional-options "-fno-pic" { target { ! *-*-darwin* } } } */ typedef void (*dispatch_t)(long offset); @@ -13,9 +14,11 @@ male_indirect_jump (long offset) return 0; } -/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*_?dispatch" { target *-*-linux* } } } */ -/* { dg-final { scan-assembler-times "jmp\[ \t\]*\.LIND" 2 } } */ -/* { dg-final { scan-assembler-times "call\[ \t\]*\.LIND" 2 } } */ +/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*dispatch" { target *-*-linux* } } } */ +/* { dg-final { scan-assembler {movq[ \t]*_dispatch} { target { lp64 && *-*-darwin* } } } } */ +/* { dg-final { scan-assembler {movl[ \t]*l_dispatch\$non_lazy_ptr-L[0-9]+\$pb} { target { ia32 && *-*-darwin* } } } } */ +/* { dg-final { scan-assembler-times {jmp[ \t]*\.?LIND} 2 } } */ +/* { dg-final { scan-assembler-times {call[ \t]*\.?LIND} 2 } } */ /* { dg-final { scan-assembler {\tpause} } } */ /* { dg-final { scan-assembler {\tlfence} } } */ -/* { dg-final { scan-assembler-not "__x86_indirect_thunk" } } */ +/* { dg-final { scan-assembler-not "_?__x86_indirect_thunk" } } */ diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-5.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-5.c index 0098dd1133d..db1d8fb9979 100644 --- a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-5.c +++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-5.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -fno-pic" } */ +/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep " } */ +/* { dg-additional-options "-fno-pic" { target { ! *-*-darwin* } } } */ typedef void (*dispatch_t)(long offset); @@ -14,8 +15,10 @@ male_indirect_jump (long offset) return 0; } -/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*_?dispatch" { target *-*-linux* } } } */ -/* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" } } */ +/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*dispatch" { target *-*-linux* } } } */ +/* { dg-final { scan-assembler {movq[ \t]*_dispatch} { target { lp64 && *-*-darwin* } } } } */ +/* { dg-final { scan-assembler {movl[ \t]*l_dispatch\$non_lazy_ptr-L[0-9]+\$pb} { target { ia32 && *-*-darwin* } } } } */ +/* { dg-final { scan-assembler "call\[ \t\]*_?__x86_indirect_thunk_(r|e)ax" } } */ /* { dg-final { scan-assembler-not {\t(lfence|pause)} } } */ -/* { dg-final { scan-assembler-not "jmp\[ \t\]*\.LIND" } } */ -/* { dg-final { scan-assembler-not "call\[ \t\]*\.LIND" } } */ +/* { dg-final { scan-assembler-not {jmp[ \t]*\.?LIND} } } */ +/* { dg-final { scan-assembler-not {call[ \t]*\.?LIND} } } */ diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-6.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-6.c index ece8de15a4b..24fc43b3ba5 100644 --- a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-6.c +++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-6.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -fno-pic" } */ +/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep " } */ +/* { dg-additional-options "-fno-pic" { target { ! *-*-darwin* } } } */ typedef void (*dispatch_t)(long offset); @@ -13,8 +14,10 @@ male_indirect_jump (long offset) return 0; } -/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*_?dispatch" { target *-*-linux* } } } */ -/* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" } } */ +/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*dispatch" { target *-*-linux* } } } */ +/* { dg-final { scan-assembler {movq[ \t]*_dispatch} { target { lp64 && *-*-darwin* } } } } */ +/* { dg-final { scan-assembler {movl[ \t]*l_dispatch\$non_lazy_ptr-L[0-9]+\$pb} { target { ia32 && *-*-darwin* } } } } */ +/* { dg-final { scan-assembler "call\[ \t\]*_?__x86_indirect_thunk_(r|e)ax" } } */ /* { dg-final { scan-assembler-not {\t(lfence|pause)} } } */ -/* { dg-final { scan-assembler-not "jmp\[ \t\]*\.LIND" } } */ -/* { dg-final { scan-assembler-not "call\[ \t\]*\.LIND" } } */ +/* { dg-final { scan-assembler-not {jmp[ \t]*\.?LIND} } } */ +/* { dg-final { scan-assembler-not {call[ \t]*\.?LIND} } } */ diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-7.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-7.c index ffe7350fce4..d5f2ba66af0 100644 --- a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-7.c +++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-7.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -fno-pic" } */ +/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep " } */ +/* { dg-additional-options "-fno-pic" { target { ! *-*-darwin* } } } */ void func0 (void); void func1 (void); @@ -37,7 +38,9 @@ bar (int i) } /* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*\.L\[0-9\]+\\(,%" { target *-*-linux* } } } */ -/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk(_nt|)_(r|e)ax" } } */ +/* { dg-final { scan-assembler {leaq[ \t]*L[0-9]+\(%rip\)} { target { lp64 && *-*-darwin* } } } } */ +/* { dg-final { scan-assembler {addl[ \t]*L[0-9]+-L[0-9]+\$pb} { target { ia32 && *-*-darwin* } } } } */ +/* { dg-final { scan-assembler "jmp\[ \t\]*_?__x86_indirect_thunk(_nt|)_(r|e)ax" } } */ /* { dg-final { scan-assembler-not {\t(lfence|pause)} } } */ -/* { dg-final { scan-assembler-not "jmp\[ \t\]*\.LIND" } } */ -/* { dg-final { scan-assembler-not "call\[ \t\]*\.LIND" } } */ +/* { dg-final { scan-assembler-not {jmp[ \t]*\.?LIND} } } */ +/* { dg-final { scan-assembler-not {call[ \t]*\.?LIND} } } */ diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-8.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-8.c index d730d31bda1..eb75968522b 100644 --- a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-8.c +++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-8.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk -fno-pic" } */ +/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk " } */ +/* { dg-additional-options "-fno-pic" { target { ! *-*-darwin* } } } */ void func0 (void); void func1 (void); @@ -36,7 +37,7 @@ bar (int i) } } -/* { dg-final { scan-assembler-not "__x86_indirect_thunk" } } */ +/* { dg-final { scan-assembler-not "_?__x86_indirect_thunk" } } */ /* { dg-final { scan-assembler-not {\t(lfence|pause)} } } */ -/* { dg-final { scan-assembler-not "jmp\[ \t\]*\.LIND" } } */ -/* { dg-final { scan-assembler-not "call\[ \t\]*\.LIND" } } */ +/* { dg-final { scan-assembler-not {jmp[ \t]*\.?LIND} } } */ +/* { dg-final { scan-assembler-not {call[ \t]*\.?LIND} } } */ diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-1.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-1.c index c09dd0afd2d..3dc02f80ff5 100644 --- a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-1.c +++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-1.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk-extern -fno-pic" } */ +/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk-extern " } */ +/* { dg-additional-options "-fno-pic" { target { ! *-*-darwin* } } } */ typedef void (*dispatch_t)(long offset); @@ -11,8 +12,10 @@ male_indirect_jump (long offset) dispatch(offset); } -/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*_?dispatch" { target *-*-linux* } } } */ -/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk_(r|e)ax" } } */ +/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*dispatch" { target *-*-linux* } } } */ +/* { dg-final { scan-assembler {movq[ \t]*_dispatch} { target { lp64 && *-*-darwin* } } } } */ +/* { dg-final { scan-assembler {movl[ \t]*l_dispatch\$non_lazy_ptr-L[0-9]+\$pb} { target { ia32 && *-*-darwin* } } } } */ +/* { dg-final { scan-assembler "jmp\[ \t\]*_?__x86_indirect_thunk_(r|e)ax" } } */ /* { dg-final { scan-assembler-not {\t(lfence|pause)} } } */ -/* { dg-final { scan-assembler-not "jmp\[ \t\]*\.LIND" } } */ -/* { dg-final { scan-assembler-not "call\[ \t\]*\.LIND" } } */ +/* { dg-final { scan-assembler-not {jmp[ \t]*\.?LIND} } } */ +/* { dg-final { scan-assembler-not {call[ \t]*\.LIND} } } */ diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-2.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-2.c index 826425a5115..c4adae23dd3 100644 --- a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-2.c +++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-2.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk-extern -fno-pic" } */ +/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk-extern " } */ +/* { dg-additional-options "-fno-pic" { target { ! *-*-darwin* } } } */ typedef void (*dispatch_t)(long offset); @@ -11,8 +12,10 @@ male_indirect_jump (long offset) dispatch[offset](offset); } -/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*_?dispatch" { target *-*-linux* } } } */ -/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk_(r|e)ax" } } */ +/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*dispatch" { target *-*-linux* } } } */ +/* { dg-final { scan-assembler {movq[ \t]*_dispatch} { target { lp64 && *-*-darwin* } } } } */ +/* { dg-final { scan-assembler {movl[ \t]*l_dispatch\$non_lazy_ptr-L[0-9]+\$pb} { target { ia32 && *-*-darwin* } } } } */ +/* { dg-final { scan-assembler "jmp\[ \t\]*_?__x86_indirect_thunk_(r|e)ax" } } */ /* { dg-final { scan-assembler-not {\t(lfence|pause)} } } */ -/* { dg-final { scan-assembler-not "jmp\[ \t\]*\.LIND" } } */ -/* { dg-final { scan-assembler-not "call\[ \t\]*\.LIND" } } */ +/* { dg-final { scan-assembler-not {jmp[ \t]*\.?LIND} } } */ +/* { dg-final { scan-assembler-not {call[ \t]*\.?LIND} } } */ diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-3.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-3.c index 385626850a2..b800b40b055 100644 --- a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-3.c +++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-3.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk-extern -fno-pic" } */ +/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk-extern " } */ +/* { dg-additional-options "-fno-pic" { target { ! *-*-darwin* } } } */ typedef void (*dispatch_t)(long offset); @@ -12,8 +13,10 @@ male_indirect_jump (long offset) return 0; } -/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*_?dispatch" { target *-*-linux* } } } */ -/* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" } } */ +/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*dispatch" { target *-*-linux* } } } */ +/* { dg-final { scan-assembler {movq[ \t]*_dispatch} { target { lp64 && *-*-darwin* } } } } */ +/* { dg-final { scan-assembler {movl[ \t]*l_dispatch\$non_lazy_ptr-L[0-9]+\$pb} { target { ia32 && *-*-darwin* } } } } */ +/* { dg-final { scan-assembler "call\[ \t\]*_?__x86_indirect_thunk_(r|e)ax" } } */ /* { dg-final { scan-assembler-not {\t(lfence|pause)} } } */ -/* { dg-final { scan-assembler-not "jmp\[ \t\]*\.LIND" } } */ -/* { dg-final { scan-assembler-not "call\[ \t\]*\.LIND" } } */ +/* { dg-final { scan-assembler-not {jmp[ \t]*\.?LIND} } } */ +/* { dg-final { scan-assembler-not {call[ \t]*\.?LIND} } } */ diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-4.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-4.c index 1ae49b137ca..f68902ddc25 100644 --- a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-4.c +++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-4.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk-extern -fno-pic" } */ +/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk-extern " } */ +/* { dg-additional-options "-fno-pic" { target { ! *-*-darwin* } } } */ typedef void (*dispatch_t)(long offset); @@ -12,7 +13,8 @@ male_indirect_jump (long offset) return 0; } -/* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target x32 } } } */ -/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*_?dispatch" { target *-*-linux* } } } */ -/* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" } } */ +/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*dispatch" { target *-*-linux* } } } */ +/* { dg-final { scan-assembler {movq[ \t]*_dispatch} { target { lp64 && *-*-darwin* } } } } */ +/* { dg-final { scan-assembler {movl[ \t]*l_dispatch\$non_lazy_ptr-L[0-9]+\$pb} { target { ia32 && *-*-darwin* } } } } */ +/* { dg-final { scan-assembler "call\[ \t\]*_?__x86_indirect_thunk_(r|e)ax" } } */ /* { dg-final { scan-assembler-not {\t(lfence|pause)} } } */ diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-7.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-7.c index 95c5cc176ae..f4c380f7dd2 100644 --- a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-7.c +++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-7.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk-extern -fno-pic -fjump-tables" } */ +/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk-extern -fjump-tables" } */ +/* { dg-additional-options "-fno-pic" { target { ! *-*-darwin* } } } */ void func0 (void); void func1 (void); @@ -36,7 +37,7 @@ bar (int i) } /* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*\.L\[0-9\]+\\(,%" { target *-*-linux* } } } */ -/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk(_nt|)_(r|e)ax" } } */ +/* { dg-final { scan-assembler "jmp\[ \t\]*_?__x86_indirect_thunk(_nt|)_(r|e)ax" } } */ /* { dg-final { scan-assembler-not {\t(lfence|pause)} } } */ -/* { dg-final { scan-assembler-not "jmp\[ \t\]*\.LIND" } } */ -/* { dg-final { scan-assembler-not "call\[ \t\]*\.LIND" } } */ +/* { dg-final { scan-assembler-not {jmp[ \t]*\.?LIND} } } */ +/* { dg-final { scan-assembler-not "call\[ \t\]*\.?LIND" } } */ diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-1.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-1.c index 869d9040838..7301490d49c 100644 --- a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-1.c +++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-1.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk-inline -fno-pic" } */ +/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk-inline " } */ +/* { dg-additional-options "-fno-pic" { target { ! *-*-darwin* } } } */ typedef void (*dispatch_t)(long offset); @@ -11,10 +12,12 @@ male_indirect_jump (long offset) dispatch(offset); } -/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*_?dispatch" { target *-*-linux* } } } */ -/* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */ -/* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */ +/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*dispatch" { target *-*-linux* } } } */ +/* { dg-final { scan-assembler {movq[ \t]*_dispatch} { target { lp64 && *-*-darwin* } } } } */ +/* { dg-final { scan-assembler {movl[ \t]*l_dispatch\$non_lazy_ptr-L[0-9]+\$pb} { target { ia32 && *-*-darwin* } } } } */ +/* { dg-final { scan-assembler {jmp[ \t]*\.?LIND} } } */ +/* { dg-final { scan-assembler {call[ \t]*\.?LIND} } } */ /* { dg-final { scan-assembler {\tpause} } } */ /* { dg-final { scan-assembler {\tlfence} } } */ -/* { dg-final { scan-assembler-not "__x86_indirect_thunk" } } */ +/* { dg-final { scan-assembler-not "_?__x86_indirect_thunk" } } */ /* { dg-final { scan-assembler-not "pushq\[ \t\]%rax" { target x32 } } } */ diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-2.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-2.c index c5c16ed8bd8..ef1ba02978d 100644 --- a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-2.c +++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-2.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk-inline -fno-pic" } */ +/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk-inline " } */ +/* { dg-additional-options "-fno-pic" { target { ! *-*-darwin* } } } */ typedef void (*dispatch_t)(long offset); @@ -11,10 +12,12 @@ male_indirect_jump (long offset) dispatch[offset](offset); } -/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*_?dispatch" { target *-*-linux* } } } */ -/* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */ -/* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */ +/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*dispatch" { target *-*-linux* } } } */ +/* { dg-final { scan-assembler {movq[ \t]*_dispatch} { target { lp64 && *-*-darwin* } } } } */ +/* { dg-final { scan-assembler {movl[ \t]*l_dispatch\$non_lazy_ptr-L[0-9]+\$pb} { target { ia32 && *-*-darwin* } } } } */ +/* { dg-final { scan-assembler {jmp[ \t]*\.?LIND} } } */ +/* { dg-final { scan-assembler {call[ \t]*\.?LIND} } } */ /* { dg-final { scan-assembler {\tpause} } } */ /* { dg-final { scan-assembler {\tlfence} } } */ -/* { dg-final { scan-assembler-not "__x86_indirect_thunk" } } */ +/* { dg-final { scan-assembler-not "_?__x86_indirect_thunk" } } */ /* { dg-final { scan-assembler-not "pushq\[ \t\]%rax" { target x32 } } } */ diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-3.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-3.c index 4a63ebed8ab..58de8f0393e 100644 --- a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-3.c +++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-3.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk-inline -fno-pic" } */ +/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk-inline " } */ +/* { dg-additional-options "-fno-pic" { target { ! *-*-darwin* } } } */ typedef void (*dispatch_t)(long offset); @@ -12,10 +13,12 @@ male_indirect_jump (long offset) return 0; } -/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*_?dispatch" { target *-*-linux* } } } */ -/* { dg-final { scan-assembler-times "jmp\[ \t\]*\.LIND" 2 } } */ -/* { dg-final { scan-assembler-times "call\[ \t\]*\.LIND" 2 } } */ +/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*dispatch" { target *-*-linux* } } } */ +/* { dg-final { scan-assembler {movq[ \t]*_dispatch} { target { lp64 && *-*-darwin* } } } } */ +/* { dg-final { scan-assembler {movl[ \t]*l_dispatch\$non_lazy_ptr-L[0-9]+\$pb} { target { ia32 && *-*-darwin* } } } } */ +/* { dg-final { scan-assembler-times {jmp[ \t]*\.?LIND} 2 } } */ +/* { dg-final { scan-assembler-times {call[ \t]*\.?LIND} 2 } } */ /* { dg-final { scan-assembler-times {\tpause} 1 } } */ /* { dg-final { scan-assembler-times {\tlfence} 1 } } */ -/* { dg-final { scan-assembler-not "__x86_indirect_thunk" } } */ +/* { dg-final { scan-assembler-not "_?__x86_indirect_thunk" } } */ /* { dg-final { scan-assembler-not "pushq\[ \t\]%rax" { target x32 } } } */ diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-4.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-4.c index a395ffca018..3be3ce07527 100644 --- a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-4.c +++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-4.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk-inline -fno-pic" } */ +/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk-inline " } */ +/* { dg-additional-options "-fno-pic" { target { ! *-*-darwin* } } } */ typedef void (*dispatch_t)(long offset); @@ -12,10 +13,12 @@ male_indirect_jump (long offset) return 0; } -/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*_?dispatch" { target *-*-linux* } } } */ -/* { dg-final { scan-assembler-times "jmp\[ \t\]*\.LIND" 2 } } */ -/* { dg-final { scan-assembler-times "call\[ \t\]*\.LIND" 2 } } */ +/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*dispatch" { target *-*-linux* } } } */ +/* { dg-final { scan-assembler {movq[ \t]*_dispatch} { target { lp64 && *-*-darwin* } } } } */ +/* { dg-final { scan-assembler {movl[ \t]*l_dispatch\$non_lazy_ptr-L[0-9]+\$pb} { target { ia32 && *-*-darwin* } } } } */ +/* { dg-final { scan-assembler-times {jmp[ \t]*\.?LIND} 2 } } */ +/* { dg-final { scan-assembler-times {call[ \t]*\.?LIND} 2 } } */ /* { dg-final { scan-assembler-times {\tpause} 1 } } */ /* { dg-final { scan-assembler-times {\tlfence} 1 } } */ -/* { dg-final { scan-assembler-not "__x86_indirect_thunk" } } */ +/* { dg-final { scan-assembler-not "_?__x86_indirect_thunk" } } */ /* { dg-final { scan-assembler-not "pushq\[ \t\]%rax" { target x32 } } } */ diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-7.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-7.c index e6f064959a1..b161faa44f6 100644 --- a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-7.c +++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-7.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk-inline -fno-pic -fjump-tables" } */ +/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk-inline -fjump-tables" } */ +/* { dg-additional-options "-fno-pic" { target { ! *-*-darwin* } } } */ void func0 (void); void func1 (void); @@ -37,8 +38,8 @@ bar (int i) /* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*\.L\[0-9\]+\\(,%" { target *-*-linux* } } } */ /* { dg-final { scan-assembler-not "pushq\[ \t\]%(r|e)ax" } } */ -/* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */ -/* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */ +/* { dg-final { scan-assembler {jmp[ \t]*\.?LIND} } } */ +/* { dg-final { scan-assembler {call[ \t]*\.?LIND} } } */ /* { dg-final { scan-assembler {\tpause} } } */ /* { dg-final { scan-assembler {\tlfence} } } */ -/* { dg-final { scan-assembler-not "__x86_indirect_thunk" } } */ +/* { dg-final { scan-assembler-not "_?__x86_indirect_thunk" } } */ diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-register-1.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-register-1.c index 7d396a31953..ea99fd8bdcb 100644 --- a/gcc/testsuite/gcc.target/i386/indirect-thunk-register-1.c +++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-register-1.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -mindirect-branch=thunk -mindirect-branch-register -fno-pic" } */ +/* { dg-options "-O2 -mindirect-branch=thunk -mindirect-branch-register " } */ +/* { dg-additional-options "-fno-pic" { target { ! *-*-darwin* } } } */ typedef void (*dispatch_t)(long offset); @@ -11,12 +12,12 @@ male_indirect_jump (long offset) dispatch(offset); } -/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk_(r|e)ax" } } */ -/* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */ -/* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */ +/* { dg-final { scan-assembler "jmp\[ \t\]*_?__x86_indirect_thunk_(r|e)ax" } } */ +/* { dg-final { scan-assembler {jmp[ \t]*\.?LIND} } } */ +/* { dg-final { scan-assembler {call[ \t]*\.?LIND} } } */ /* { dg-final { scan-assembler "mov\[ \t\](%eax|%rax), \\((%esp|%rsp)\\)" } } */ /* { dg-final { scan-assembler {\tpause} } } */ /* { dg-final { scan-assembler-not "push(?:l|q)\[ \t\]*_?dispatch" } } */ /* { dg-final { scan-assembler-not "pushq\[ \t\]%rax" } } */ -/* { dg-final { scan-assembler-not "__x86_indirect_thunk\n" } } */ -/* { dg-final { scan-assembler-not "__x86_indirect_thunk_bnd\n" } } */ +/* { dg-final { scan-assembler-not "_?__x86_indirect_thunk\n" } } */ +/* { dg-final { scan-assembler-not "_?__x86_indirect_thunk_bnd\n" } } */ diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-register-2.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-register-2.c index e7e616bb271..30847db480b 100644 --- a/gcc/testsuite/gcc.target/i386/indirect-thunk-register-2.c +++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-register-2.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -mindirect-branch=thunk-inline -mindirect-branch-register -fno-pic" } */ +/* { dg-options "-O2 -mindirect-branch=thunk-inline -mindirect-branch-register " } */ +/* { dg-additional-options "-fno-pic" { target { ! *-*-darwin* } } } */ typedef void (*dispatch_t)(long offset); @@ -11,10 +12,10 @@ male_indirect_jump (long offset) dispatch(offset); } -/* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */ -/* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */ +/* { dg-final { scan-assembler {jmp[ \t]*\.?LIND} } } */ +/* { dg-final { scan-assembler {call[ \t]*\.?LIND} } } */ /* { dg-final { scan-assembler "mov\[ \t\](%eax|%rax), \\((%esp|%rsp)\\)" } } */ /* { dg-final { scan-assembler {\tpause} } } */ /* { dg-final { scan-assembler-not "push(?:l|q)\[ \t\]*_?dispatch" } } */ /* { dg-final { scan-assembler-not "pushq\[ \t\]%rax" } } */ -/* { dg-final { scan-assembler-not "__x86_indirect_thunk" } } */ +/* { dg-final { scan-assembler-not "_?__x86_indirect_thunk" } } */ diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-register-3.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-register-3.c index 5320e923be2..cbe14d52d75 100644 --- a/gcc/testsuite/gcc.target/i386/indirect-thunk-register-3.c +++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-register-3.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -mindirect-branch=thunk-extern -mindirect-branch-register -fno-pic" } */ +/* { dg-options "-O2 -mindirect-branch=thunk-extern -mindirect-branch-register " } */ +/* { dg-additional-options "-fno-pic" { target { ! *-*-darwin* } } } */ typedef void (*dispatch_t)(long offset); @@ -11,9 +12,9 @@ male_indirect_jump (long offset) dispatch(offset); } -/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk_(r|e)ax" } } */ +/* { dg-final { scan-assembler "jmp\[ \t\]*_?__x86_indirect_thunk_(r|e)ax" } } */ /* { dg-final { scan-assembler-not "push(?:l|q)\[ \t\]*_?dispatch" } } */ /* { dg-final { scan-assembler-not "pushq\[ \t\]%rax" } } */ /* { dg-final { scan-assembler-not {\t(pause|pause|nop)} } } */ -/* { dg-final { scan-assembler-not "jmp\[ \t\]*\.LIND" } } */ -/* { dg-final { scan-assembler-not "call\[ \t\]*\.LIND" } } */ +/* { dg-final { scan-assembler-not {jmp[ \t]*\.?LIND} } } */ +/* { dg-final { scan-assembler-not {call[ \t]*\.?LIND} } } */ diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-register-4.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-register-4.c index f0cd9b75be8..6d2bfc911c1 100644 --- a/gcc/testsuite/gcc.target/i386/indirect-thunk-register-4.c +++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-register-4.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -mindirect-branch=keep -fno-pic" } */ +/* { dg-options "-O2 -mindirect-branch=keep " } */ +/* { dg-additional-options "-fno-pic" { target { ! *-*-darwin* } } } */ extern void (*func_p) (void); diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-1.c b/gcc/testsuite/gcc.target/i386/ret-thunk-1.c index 7223f67ba5e..77f2cf62e26 100644 --- a/gcc/testsuite/gcc.target/i386/ret-thunk-1.c +++ b/gcc/testsuite/gcc.target/i386/ret-thunk-1.c @@ -6,8 +6,8 @@ foo (void) { } -/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_return_thunk" } } */ -/* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */ -/* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */ +/* { dg-final { scan-assembler "jmp\[ \t\]*_?__x86_return_thunk" } } */ +/* { dg-final { scan-assembler {jmp[ \t]*\.?LIND} } } */ +/* { dg-final { scan-assembler {call[ \t]*\.?LIND} } } */ /* { dg-final { scan-assembler {\tpause} } } */ /* { dg-final { scan-assembler {\tlfence} } } */ diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-10.c b/gcc/testsuite/gcc.target/i386/ret-thunk-10.c index b245d21b002..05e96e78189 100644 --- a/gcc/testsuite/gcc.target/i386/ret-thunk-10.c +++ b/gcc/testsuite/gcc.target/i386/ret-thunk-10.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=thunk-inline -mindirect-branch=thunk -fno-pic" } */ +/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=thunk-inline -mindirect-branch=thunk " } */ +/* { dg-additional-options "-fno-pic" { target { ! *-*-darwin* } } } */ extern void (*bar) (void); @@ -10,11 +11,11 @@ foo (void) return 0; } -/* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */ -/* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */ -/* { dg-final { scan-assembler-not "jmp\[ \t\]*__x86_return_thunk" } } */ +/* { dg-final { scan-assembler {jmp[ \t]*\.?LIND} } } */ +/* { dg-final { scan-assembler {call[ \t]*\.?LIND} } } */ +/* { dg-final { scan-assembler-not "jmp\[ \t\]*_?__x86_return_thunk" } } */ /* { dg-final { scan-assembler-times {\tpause} 2 } } */ /* { dg-final { scan-assembler-times {\tlfence} 2 } } */ -/* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" } } */ -/* { dg-final { scan-assembler "__x86_indirect_thunk_(r|e)ax:" } } */ +/* { dg-final { scan-assembler "call\[ \t\]*_?__x86_indirect_thunk_(r|e)ax" } } */ +/* { dg-final { scan-assembler "_?__x86_indirect_thunk_(r|e)ax:" } } */ /* { dg-final { scan-assembler-not "pushq\[ \t\]%rax" } } */ diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-11.c b/gcc/testsuite/gcc.target/i386/ret-thunk-11.c index ce0543e1181..19df164beea 100644 --- a/gcc/testsuite/gcc.target/i386/ret-thunk-11.c +++ b/gcc/testsuite/gcc.target/i386/ret-thunk-11.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=thunk-extern -mindirect-branch=thunk -fno-pic" } */ +/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=thunk-extern -mindirect-branch=thunk " } */ +/* { dg-additional-options "-fno-pic" { target { ! *-*-darwin* } } } */ extern void (*bar) (void); @@ -10,11 +11,11 @@ foo (void) return 0; } -/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_return_thunk" } } */ +/* { dg-final { scan-assembler "jmp\[ \t\]*_?__x86_return_thunk" } } */ /* { dg-final { scan-assembler-times {\tpause} 1 } } */ /* { dg-final { scan-assembler-times {\tlfence} 1 } } */ -/* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */ -/* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */ -/* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" } } */ -/* { dg-final { scan-assembler "__x86_indirect_thunk_(r|e)ax:" } } */ +/* { dg-final { scan-assembler {jmp[ \t]*\.?LIND} } } */ +/* { dg-final { scan-assembler {call[ \t]*\.?LIND} } } */ +/* { dg-final { scan-assembler "call\[ \t\]*_?__x86_indirect_thunk_(r|e)ax" } } */ +/* { dg-final { scan-assembler "_?__x86_indirect_thunk_(r|e)ax:" } } */ /* { dg-final { scan-assembler-not "pushq\[ \t\]%rax" } } */ diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-12.c b/gcc/testsuite/gcc.target/i386/ret-thunk-12.c index 3b0023a0a6d..b4ca50041ac 100644 --- a/gcc/testsuite/gcc.target/i386/ret-thunk-12.c +++ b/gcc/testsuite/gcc.target/i386/ret-thunk-12.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk -fno-pic" } */ +/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk " } */ +/* { dg-additional-options "-fno-pic" { target { ! *-*-darwin* } } } */ extern void (*bar) (void); @@ -10,11 +11,11 @@ foo (void) return 0; } -/* { dg-final { scan-assembler-not "jmp\[ \t\]*__x86_return_thunk" } } */ +/* { dg-final { scan-assembler-not "jmp\[ \t\]*_?__x86_return_thunk" } } */ /* { dg-final { scan-assembler-times {\tpause} 1 } } */ /* { dg-final { scan-assembler-times {\tlfence} 1 } } */ -/* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */ -/* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */ -/* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" } } */ -/* { dg-final { scan-assembler "__x86_indirect_thunk_(r|e)ax:" } } */ +/* { dg-final { scan-assembler {jmp[ \t]*\.?LIND} } } */ +/* { dg-final { scan-assembler {call[ \t]*\.?LIND} } } */ +/* { dg-final { scan-assembler "call\[ \t\]*_?__x86_indirect_thunk_(r|e)ax" } } */ +/* { dg-final { scan-assembler "_?__x86_indirect_thunk_(r|e)ax:" } } */ /* { dg-final { scan-assembler-not "pushq\[ \t\]%rax" } } */ diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-13.c b/gcc/testsuite/gcc.target/i386/ret-thunk-13.c index 55f156c4376..2f8d3a04cde 100644 --- a/gcc/testsuite/gcc.target/i386/ret-thunk-13.c +++ b/gcc/testsuite/gcc.target/i386/ret-thunk-13.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk-inline -fno-pic" } */ +/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk-inline " } */ +/* { dg-additional-options "-fno-pic" { target { ! *-*-darwin* } } } */ extern void (*bar) (void); extern int foo (void) __attribute__ ((function_return("thunk"))); @@ -11,11 +12,11 @@ foo (void) return 0; } -/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_return_thunk" } } */ +/* { dg-final { scan-assembler "jmp\[ \t\]*_?__x86_return_thunk" } } */ /* { dg-final { scan-assembler-times {\tpause} 2 } } */ /* { dg-final { scan-assembler-times {\tlfence} 2 } } */ -/* { dg-final { scan-assembler-times "jmp\[ \t\]*\.LIND" 3 } } */ -/* { dg-final { scan-assembler-times "call\[ \t\]*\.LIND" 3 } } */ -/* { dg-final { scan-assembler-not "jmp\[ \t\]*__x86_indirect_thunk" } } */ -/* { dg-final { scan-assembler-not "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" } } */ +/* { dg-final { scan-assembler-times {jmp[ \t]*\.?LIND} 3 } } */ +/* { dg-final { scan-assembler-times {call[ \t]*\.?LIND} 3 } } */ +/* { dg-final { scan-assembler-not "jmp\[ \t\]*_?__x86_indirect_thunk" } } */ +/* { dg-final { scan-assembler-not "call\[ \t\]*_?__x86_indirect_thunk_(r|e)ax" } } */ /* { dg-final { scan-assembler-not "pushq\[ \t\]%rax" } } */ diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-14.c b/gcc/testsuite/gcc.target/i386/ret-thunk-14.c index 1c790436a53..3eaddee8c34 100644 --- a/gcc/testsuite/gcc.target/i386/ret-thunk-14.c +++ b/gcc/testsuite/gcc.target/i386/ret-thunk-14.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk-extern -fno-pic" } */ +/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk-extern " } */ +/* { dg-additional-options "-fno-pic" { target { ! *-*-darwin* } } } */ extern void (*bar) (void); @@ -13,9 +14,11 @@ foo (void) /* { dg-final { scan-assembler-times {\tpause} 1 } } */ /* { dg-final { scan-assembler-times {\tlfence} 1 } } */ -/* { dg-final { scan-assembler-not "jmp\[ \t\]*__x86_return_thunk" } } */ -/* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */ -/* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */ -/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*_?bar" { target *-*-linux* } } } */ -/* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" } } */ +/* { dg-final { scan-assembler-not "jmp\[ \t\]*_?__x86_return_thunk" } } */ +/* { dg-final { scan-assembler {jmp[ \t]*\.?LIND} } } */ +/* { dg-final { scan-assembler {call[ \t]*\.?LIND} } } */ +/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*bar" { target *-*-linux* } } } */ +/* { dg-final { scan-assembler {movq[ \t]*_bar} { target { lp64 && *-*-darwin* } } } } */ +/* { dg-final { scan-assembler {movl[ \t]*l_bar\$non_lazy_ptr-L[0-9]+\$pb} { target { ia32 && *-*-darwin* } } } } */ +/* { dg-final { scan-assembler "call\[ \t\]*_?__x86_indirect_thunk_(r|e)ax" } } */ /* { dg-final { scan-assembler-not "pushq\[ \t\]%rax" } } */ diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-15.c b/gcc/testsuite/gcc.target/i386/ret-thunk-15.c index bc2bedf5a9c..2793f72cdc1 100644 --- a/gcc/testsuite/gcc.target/i386/ret-thunk-15.c +++ b/gcc/testsuite/gcc.target/i386/ret-thunk-15.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=keep -fno-pic" } */ +/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=keep " } */ +/* { dg-additional-options "-fno-pic" { target { ! *-*-darwin* } } } */ extern void (*bar) (void); @@ -11,11 +12,13 @@ foo (void) return 0; } -/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_return_thunk" } } */ -/* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */ -/* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */ +/* { dg-final { scan-assembler "jmp\[ \t\]*_?__x86_return_thunk" } } */ +/* { dg-final { scan-assembler {jmp[ \t]*\.?LIND} } } */ +/* { dg-final { scan-assembler {call[ \t]*\.?LIND} } } */ /* { dg-final { scan-assembler-times {\tpause} 1 } } */ /* { dg-final { scan-assembler-times {\tlfence} 1 } } */ -/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*_?bar" { target *-*-linux* } } } */ -/* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" } } */ +/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*bar" { target *-*-linux* } } } */ +/* { dg-final { scan-assembler {movq[ \t]*_bar} { target { lp64 && *-*-darwin* } } } } */ +/* { dg-final { scan-assembler {movl[ \t]*l_bar\$non_lazy_ptr-L[0-9]+\$pb} { target { ia32 && *-*-darwin* } } } } */ +/* { dg-final { scan-assembler "call\[ \t\]*_?__x86_indirect_thunk_(r|e)ax" } } */ /* { dg-final { scan-assembler-not "pushq\[ \t\]%rax" } } */ diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-16.c b/gcc/testsuite/gcc.target/i386/ret-thunk-16.c index a16cad16aaa..5f439e4f360 100644 --- a/gcc/testsuite/gcc.target/i386/ret-thunk-16.c +++ b/gcc/testsuite/gcc.target/i386/ret-thunk-16.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -mfunction-return=thunk-inline -mindirect-branch=thunk-extern -fno-pic" } */ +/* { dg-options "-O2 -mfunction-return=thunk-inline -mindirect-branch=thunk-extern " } */ +/* { dg-additional-options "-fno-pic" { target { ! *-*-darwin* } } } */ extern void (*bar) (void); @@ -11,8 +12,8 @@ foo (void) return 0; } -/* { dg-final { scan-assembler-not "__x86_indirect_thunk" } } */ -/* { dg-final { scan-assembler-not "__x86_return_thunk" } } */ +/* { dg-final { scan-assembler-not "_?__x86_indirect_thunk" } } */ +/* { dg-final { scan-assembler-not "_?__x86_return_thunk" } } */ /* { dg-final { scan-assembler-not {\t(lfence|pause)} } } */ -/* { dg-final { scan-assembler-not "jmp\[ \t\]*\.LIND" } } */ -/* { dg-final { scan-assembler-not "call\[ \t\]*\.LIND" } } */ +/* { dg-final { scan-assembler-not {jmp[ \t]*\.?LIND} } } */ +/* { dg-final { scan-assembler-not {call[ \t]*\.?LIND} } } */ diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-2.c b/gcc/testsuite/gcc.target/i386/ret-thunk-2.c index c6659e3ad09..3cb94210746 100644 --- a/gcc/testsuite/gcc.target/i386/ret-thunk-2.c +++ b/gcc/testsuite/gcc.target/i386/ret-thunk-2.c @@ -6,8 +6,8 @@ foo (void) { } -/* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */ -/* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */ +/* { dg-final { scan-assembler {jmp[ \t]*\.?LIND} } } */ +/* { dg-final { scan-assembler {call[ \t]*\.?LIND} } } */ /* { dg-final { scan-assembler {\tpause} } } */ /* { dg-final { scan-assembler {\tlfence} } } */ -/* { dg-final { scan-assembler-not "jmp\[ \t\]*__x86_return_thunk" } } */ +/* { dg-final { scan-assembler-not "jmp\[ \t\]*_?__x86_return_thunk" } } */ diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-22.c b/gcc/testsuite/gcc.target/i386/ret-thunk-22.c index 89e086de97b..9a9f42ea6a1 100644 --- a/gcc/testsuite/gcc.target/i386/ret-thunk-22.c +++ b/gcc/testsuite/gcc.target/i386/ret-thunk-22.c @@ -6,10 +6,12 @@ struct s { _Complex unsigned short x; }; struct s gs = { 100 + 200i }; struct s __attribute__((noinline)) foo (void) { return gs; } -/* { dg-final { scan-assembler-times "popl\[\\t \]*%ecx" 1 } } */ -/* { dg-final { scan-assembler "lea\[l\]?\[\\t \]*4\\(%esp\\), %esp" } } */ -/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_return_thunk_ecx" } } */ -/* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */ -/* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */ +/* { dg-final { scan-assembler-times "popl\[\\t \]*%ecx" 1 { target { ! *-*-darwin* } } } } */ +/* { dg-final { scan-assembler "lea\[l\]?\[\\t \]*4\\(%esp\\), %esp" { target { ! *-*-darwin* } } } } */ +/* { dg-final { scan-assembler "jmp\[ \t\]*_?__x86_return_thunk_ecx" { target { ! *-*-darwin* } } } } */ +/* { dg-final { scan-assembler {call[ \t]*___x86.get_pc_thunk.cx} { target { *-*-darwin* } } } } */ +/* { dg-final { scan-assembler {jmp[ \t]*___x86_return_thunk} { target { *-*-darwin* } } } } */ +/* { dg-final { scan-assembler {jmp[ \t]*\.?LIND} } } */ +/* { dg-final { scan-assembler {call[ \t]*\.?LIND} } } */ /* { dg-final { scan-assembler {\tpause} } } */ /* { dg-final { scan-assembler {\tlfence} } } */ diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-23.c b/gcc/testsuite/gcc.target/i386/ret-thunk-23.c index 43f0ccaa854..69469a43606 100644 --- a/gcc/testsuite/gcc.target/i386/ret-thunk-23.c +++ b/gcc/testsuite/gcc.target/i386/ret-thunk-23.c @@ -6,10 +6,12 @@ struct s { _Complex unsigned short x; }; struct s gs = { 100 + 200i }; struct s __attribute__((noinline)) foo (void) { return gs; } -/* { dg-final { scan-assembler-times "popl\[\\t \]*%ecx" 1 } } */ -/* { dg-final { scan-assembler "lea\[l\]?\[\\t \]*4\\(%esp\\), %esp" } } */ -/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_return_thunk_ecx" } } */ -/* { dg-final { scan-assembler-not "jmp\[ \t\]*\.LIND" } } */ -/* { dg-final { scan-assembler-not "call\[ \t\]*\.LIND" } } */ +/* { dg-final { scan-assembler-times "popl\[\\t \]*%ecx" 1 { target { ! *-*-darwin* } } } } */ +/* { dg-final { scan-assembler "lea\[l\]?\[\\t \]*4\\(%esp\\), %esp" { target { ! *-*-darwin* } } } } */ +/* { dg-final { scan-assembler "jmp\[ \t\]*_?__x86_return_thunk_ecx" { target { ! *-*-darwin* } } } } */ +/* { dg-final { scan-assembler {call[ \t]*___x86.get_pc_thunk.cx} { target { *-*-darwin* } } } } */ +/* { dg-final { scan-assembler {jmp[ \t]*___x86_return_thunk} { target { *-*-darwin* } } } } */ +/* { dg-final { scan-assembler-not {jmp[ \t]*\.?LIND} } } */ +/* { dg-final { scan-assembler-not {call[ \t]*\.?LIND} } } */ /* { dg-final { scan-assembler-not {\tpause} } } */ /* { dg-final { scan-assembler-not {\tlfence} } } */ diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-24.c b/gcc/testsuite/gcc.target/i386/ret-thunk-24.c index 8729e35147e..0e7877970d7 100644 --- a/gcc/testsuite/gcc.target/i386/ret-thunk-24.c +++ b/gcc/testsuite/gcc.target/i386/ret-thunk-24.c @@ -6,10 +6,12 @@ struct s { _Complex unsigned short x; }; struct s gs = { 100 + 200i }; struct s __attribute__((noinline)) foo (void) { return gs; } -/* { dg-final { scan-assembler-times "popl\[\\t \]*%ecx" 1 } } */ -/* { dg-final { scan-assembler "lea\[l\]?\[\\t \]*4\\(%esp\\), %esp" } } */ -/* { dg-final { scan-assembler-not "jmp\[ \t\]*__x86_return_thunk_ecx" } } */ -/* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */ -/* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */ +/* { dg-final { scan-assembler-times "popl\[\\t \]*%ecx" 1 { target { ! *-*-darwin* } } } } */ +/* { dg-final { scan-assembler "lea\[l\]?\[\\t \]*4\\(%esp\\), %esp" { target { ! *-*-darwin* } } } } */ +/* { dg-final { scan-assembler-not "jmp\[ \t\]*_?__x86_return_thunk_ecx" { target { ! *-*-darwin* } } } } */ +/* { dg-final { scan-assembler {call[ \t]*___x86.get_pc_thunk.cx} { target { *-*-darwin* } } } } */ +/* { dg-final { scan-assembler-not {jmp[ \t]*___x86_return_thunk} { target { *-*-darwin* } } } } */ +/* { dg-final { scan-assembler {jmp[ \t]*\.?LIND} } } */ +/* { dg-final { scan-assembler {call[ \t]*\.?LIND} } } */ /* { dg-final { scan-assembler {\tpause} } } */ /* { dg-final { scan-assembler {\tlfence} } } */ diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-3.c b/gcc/testsuite/gcc.target/i386/ret-thunk-3.c index 0f7f388f459..eb585169ae2 100644 --- a/gcc/testsuite/gcc.target/i386/ret-thunk-3.c +++ b/gcc/testsuite/gcc.target/i386/ret-thunk-3.c @@ -6,7 +6,7 @@ foo (void) { } -/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_return_thunk" } } */ +/* { dg-final { scan-assembler "jmp\[ \t\]*_?__x86_return_thunk" } } */ /* { dg-final { scan-assembler-not {\t(lfence|pause)} } } */ -/* { dg-final { scan-assembler-not "jmp\[ \t\]*\.LIND" } } */ -/* { dg-final { scan-assembler-not "call\[ \t\]*\.LIND" } } */ +/* { dg-final { scan-assembler-not {jmp[ \t]*\.?LIND} } } */ +/* { dg-final { scan-assembler-not {call[ \t]*\.?LIND} } } */ diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-4.c b/gcc/testsuite/gcc.target/i386/ret-thunk-4.c index 9ae37e835a0..736f7270ba6 100644 --- a/gcc/testsuite/gcc.target/i386/ret-thunk-4.c +++ b/gcc/testsuite/gcc.target/i386/ret-thunk-4.c @@ -6,7 +6,7 @@ foo (void) { } -/* { dg-final { scan-assembler-not "jmp\[ \t\]*__x86_return_thunk" } } */ +/* { dg-final { scan-assembler-not "jmp\[ \t\]*_?__x86_return_thunk" } } */ /* { dg-final { scan-assembler-not {\t(lfence|pause)} } } */ -/* { dg-final { scan-assembler-not "jmp\[ \t\]*\.LIND" } } */ -/* { dg-final { scan-assembler-not "call\[ \t\]*\.LIND" } } */ +/* { dg-final { scan-assembler-not {jmp[ \t]*\.?LIND} } } */ +/* { dg-final { scan-assembler-not {call[ \t]*\.?LIND} } } */ diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-5.c b/gcc/testsuite/gcc.target/i386/ret-thunk-5.c index 4bd0d2a27bc..862f21da773 100644 --- a/gcc/testsuite/gcc.target/i386/ret-thunk-5.c +++ b/gcc/testsuite/gcc.target/i386/ret-thunk-5.c @@ -8,8 +8,8 @@ foo (void) { } -/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_return_thunk" } } */ -/* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */ -/* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */ +/* { dg-final { scan-assembler "jmp\[ \t\]*_?__x86_return_thunk" } } */ +/* { dg-final { scan-assembler {jmp[ \t]*\.?LIND} } } */ +/* { dg-final { scan-assembler {call[ \t]*\.?LIND} } } */ /* { dg-final { scan-assembler {\tpause} } } */ /* { dg-final { scan-assembler {\tlfence} } } */ diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-6.c b/gcc/testsuite/gcc.target/i386/ret-thunk-6.c index 053841f6f7d..9517c92eade 100644 --- a/gcc/testsuite/gcc.target/i386/ret-thunk-6.c +++ b/gcc/testsuite/gcc.target/i386/ret-thunk-6.c @@ -7,8 +7,8 @@ foo (void) { } -/* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */ -/* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */ +/* { dg-final { scan-assembler {jmp[ \t]*\.?LIND} } } */ +/* { dg-final { scan-assembler {call[ \t]*\.?LIND} } } */ /* { dg-final { scan-assembler {\tpause} } } */ /* { dg-final { scan-assembler {\tlfence} } } */ -/* { dg-final { scan-assembler-not "jmp\[ \t\]*__x86_return_thunk" } } */ +/* { dg-final { scan-assembler-not "jmp\[ \t\]*_?__x86_return_thunk" } } */ diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-7.c b/gcc/testsuite/gcc.target/i386/ret-thunk-7.c index 262e6780112..dd68f8326b1 100644 --- a/gcc/testsuite/gcc.target/i386/ret-thunk-7.c +++ b/gcc/testsuite/gcc.target/i386/ret-thunk-7.c @@ -7,7 +7,7 @@ foo (void) { } -/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_return_thunk" } } */ +/* { dg-final { scan-assembler "jmp\[ \t\]*_?__x86_return_thunk" } } */ /* { dg-final { scan-assembler-not {\t(lfence|pause)} } } */ -/* { dg-final { scan-assembler-not "jmp\[ \t\]*\.LIND" } } */ -/* { dg-final { scan-assembler-not "call\[ \t\]*\.LIND" } } */ +/* { dg-final { scan-assembler-not {jmp[ \t]*\.?LIND} } } */ +/* { dg-final { scan-assembler-not {call[ \t]*\.?LIND} } } */ diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-8.c b/gcc/testsuite/gcc.target/i386/ret-thunk-8.c index c1658e96673..0a611d99f59 100644 --- a/gcc/testsuite/gcc.target/i386/ret-thunk-8.c +++ b/gcc/testsuite/gcc.target/i386/ret-thunk-8.c @@ -8,7 +8,7 @@ foo (void) { } -/* { dg-final { scan-assembler-not "jmp\[ \t\]*__x86_return_thunk" } } */ +/* { dg-final { scan-assembler-not "jmp\[ \t\]*_?__x86_return_thunk" } } */ /* { dg-final { scan-assembler-not {\t(lfence|pause)} } } */ -/* { dg-final { scan-assembler-not "jmp\[ \t\]*\.LIND" } } */ -/* { dg-final { scan-assembler-not "call\[ \t\]*\.LIND" } } */ +/* { dg-final { scan-assembler-not {jmp[ \t]*\.?LIND} } } */ +/* { dg-final { scan-assembler-not {call[ \t]*\.?LIND} } } */ diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-9.c b/gcc/testsuite/gcc.target/i386/ret-thunk-9.c index 819671af933..63af6741e05 100644 --- a/gcc/testsuite/gcc.target/i386/ret-thunk-9.c +++ b/gcc/testsuite/gcc.target/i386/ret-thunk-9.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=thunk -mindirect-branch=thunk -fno-pic" } */ +/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=thunk -mindirect-branch=thunk " } */ +/* { dg-additional-options "-fno-pic" { target { ! *-*-darwin* } } } */ extern void (*bar) (void); @@ -10,12 +11,14 @@ foo (void) return 0; } -/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_return_thunk" } } */ -/* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */ -/* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */ -/* { dg-final { scan-assembler "__x86_return_thunk:" } } */ -/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*_?bar" { target *-*-linux* } } } */ +/* { dg-final { scan-assembler "jmp\[ \t\]*_?__x86_return_thunk" } } */ +/* { dg-final { scan-assembler {jmp[ \t]+\.?LIND} } } */ +/* { dg-final { scan-assembler {call[ \t]+\.?LIND} } } */ +/* { dg-final { scan-assembler "_?__x86_return_thunk:" } } */ +/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*bar" { target *-*-linux* } } } */ +/* { dg-final { scan-assembler {movq[ \t]*_bar} { target { lp64 && *-*-darwin* } } } } */ +/* { dg-final { scan-assembler {movl[ \t]*l_bar\$non_lazy_ptr-L[0-9]+\$pb} { target { ia32 && *-*-darwin* } } } } */ /* { dg-final { scan-assembler-times {\tpause} 2 } } */ /* { dg-final { scan-assembler-times {\tlfence} 2 } } */ -/* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" } } */ +/* { dg-final { scan-assembler "call\[ \t\]*_?__x86_indirect_thunk_(r|e)ax" } } */ /* { dg-final { scan-assembler-not "pushq\[ \t\]%rax" } } */ -- cgit v1.2.3 From 52744319fcb002431734dcda3f549fe04a89bd9f Mon Sep 17 00:00:00 2001 From: Iain Sandoe <iain@sandoe.co.uk> Date: Fri, 7 Jun 2019 07:42:55 +0000 Subject: Darwin, x86, backport fix for PR82920 (part 2 no mx32 for Darwin) gcc/ 2019-06-07 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline. 2019-05-12 Iain Sandoe <iain@sandoe.co.uk> PR target/82920 * config/i386/darwin.h (CC1_SPEC): Report -mx32 as an error for Darwin. gcc/tstsuite/ 2019-06-07 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline. 2019-05-14 Iain Sandoe <iain@sandoe.co.uk> PR target/82920 * gcc.target/i386/cet-sjlj-6b.c: Require effective target x32. * gcc.target/i386/pr52146.c: Likewise. * gcc.target/i386/pr52698.c: Likewise. * gcc.target/i386/pr52857-1.c: Likewise. * gcc.target/i386/pr52857-2.c: Likewise. * gcc.target/i386/pr52876.c: Likewise. * gcc.target/i386/pr53698.c: Likewise. * gcc.target/i386/pr54157.c: Likewise. * gcc.target/i386/pr55049-1.c: Likewise. * gcc.target/i386/pr55093.c: Likewise. * gcc.target/i386/pr55116-1.c: Likewise. * gcc.target/i386/pr55116-2.c: Likewise. * gcc.target/i386/pr55597.c: Likewise. * gcc.target/i386/pr59929.c: Likewise. * gcc.target/i386/pr66470.c: Likewise. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@272033 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 9 +++++++++ gcc/config/i386/darwin.h | 3 ++- gcc/testsuite/ChangeLog | 22 ++++++++++++++++++++++ gcc/testsuite/gcc.target/i386/cet-sjlj-6b.c | 1 + gcc/testsuite/gcc.target/i386/pr52146.c | 1 + gcc/testsuite/gcc.target/i386/pr52698.c | 1 + gcc/testsuite/gcc.target/i386/pr52857-1.c | 1 + gcc/testsuite/gcc.target/i386/pr52857-2.c | 1 + gcc/testsuite/gcc.target/i386/pr52876.c | 1 + gcc/testsuite/gcc.target/i386/pr53698.c | 1 + gcc/testsuite/gcc.target/i386/pr54157.c | 1 + gcc/testsuite/gcc.target/i386/pr55049-1.c | 1 + gcc/testsuite/gcc.target/i386/pr55093.c | 1 + gcc/testsuite/gcc.target/i386/pr55116-1.c | 1 + gcc/testsuite/gcc.target/i386/pr55116-2.c | 1 + gcc/testsuite/gcc.target/i386/pr55597.c | 1 + gcc/testsuite/gcc.target/i386/pr59929.c | 1 + gcc/testsuite/gcc.target/i386/pr66470.c | 1 + 18 files changed, 48 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 0a1495627dc..381310297d3 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2019-06-07 Iain Sandoe <iain@sandoe.co.uk> + + Backport from mainline. + 2019-05-12 Iain Sandoe <iain@sandoe.co.uk> + + PR target/82920 + * config/i386/darwin.h (CC1_SPEC): Report -mx32 as an error for + Darwin. + 2019-06-07 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline. diff --git a/gcc/config/i386/darwin.h b/gcc/config/i386/darwin.h index 53789e7c236..97a0ad8572d 100644 --- a/gcc/config/i386/darwin.h +++ b/gcc/config/i386/darwin.h @@ -130,7 +130,8 @@ extern int darwin_emit_branch_islands; #undef CC1_SPEC #define CC1_SPEC "%(cc1_cpu) \ %{!mkernel:%{!static:%{!mdynamic-no-pic:-fPIC}}} \ - %{g: %{!fno-eliminate-unused-debug-symbols: -feliminate-unused-debug-symbols }} " \ + %{g: %{!fno-eliminate-unused-debug-symbols: -feliminate-unused-debug-symbols }} \ + %{mx32:%eDarwin is not an mx32 platform}" \ DARWIN_CC1_SPEC #undef ASM_SPEC diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b1f8f2b79b0..e1374d75796 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,25 @@ +2019-06-07 Iain Sandoe <iain@sandoe.co.uk> + + Backport from mainline. + 2019-05-14 Iain Sandoe <iain@sandoe.co.uk> + + PR target/82920 + * gcc.target/i386/cet-sjlj-6b.c: Require effective target x32. + * gcc.target/i386/pr52146.c: Likewise. + * gcc.target/i386/pr52698.c: Likewise. + * gcc.target/i386/pr52857-1.c: Likewise. + * gcc.target/i386/pr52857-2.c: Likewise. + * gcc.target/i386/pr52876.c: Likewise. + * gcc.target/i386/pr53698.c: Likewise. + * gcc.target/i386/pr54157.c: Likewise. + * gcc.target/i386/pr55049-1.c: Likewise. + * gcc.target/i386/pr55093.c: Likewise. + * gcc.target/i386/pr55116-1.c: Likewise. + * gcc.target/i386/pr55116-2.c: Likewise. + * gcc.target/i386/pr55597.c: Likewise. + * gcc.target/i386/pr59929.c: Likewise. + * gcc.target/i386/pr66470.c: Likewise. + 2019-06-07 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline. diff --git a/gcc/testsuite/gcc.target/i386/cet-sjlj-6b.c b/gcc/testsuite/gcc.target/i386/cet-sjlj-6b.c index 6ec4b834bfb..b2376e710df 100644 --- a/gcc/testsuite/gcc.target/i386/cet-sjlj-6b.c +++ b/gcc/testsuite/gcc.target/i386/cet-sjlj-6b.c @@ -1,4 +1,5 @@ /* { dg-do compile { target { ! ia32 } } } */ +/* { dg-require-effective-target maybe_x32 } */ /* { dg-options "-O -maddress-mode=long -fcf-protection -mx32" } */ /* { dg-final { scan-assembler-times "endbr64" 2 } } */ /* { dg-final { scan-assembler-times "movq\t.*buf\\+16" 1 } } */ diff --git a/gcc/testsuite/gcc.target/i386/pr52146.c b/gcc/testsuite/gcc.target/i386/pr52146.c index dcc28d007fe..9bd81368bcd 100644 --- a/gcc/testsuite/gcc.target/i386/pr52146.c +++ b/gcc/testsuite/gcc.target/i386/pr52146.c @@ -1,4 +1,5 @@ /* { dg-do compile { target { ! ia32 } } } */ +/* { dg-require-effective-target maybe_x32 } */ /* { dg-options "-O2 -mx32" } */ void diff --git a/gcc/testsuite/gcc.target/i386/pr52698.c b/gcc/testsuite/gcc.target/i386/pr52698.c index d5cfa741112..8d8988fccc3 100644 --- a/gcc/testsuite/gcc.target/i386/pr52698.c +++ b/gcc/testsuite/gcc.target/i386/pr52698.c @@ -1,4 +1,5 @@ /* { dg-do compile { target { ! ia32 } } } */ +/* { dg-require-effective-target maybe_x32 } */ /* { dg-options "-O2 -mx32 -maddress-mode=long" } */ extern void abort (void); diff --git a/gcc/testsuite/gcc.target/i386/pr52857-1.c b/gcc/testsuite/gcc.target/i386/pr52857-1.c index 5c23339b66a..2e8a4afdc10 100644 --- a/gcc/testsuite/gcc.target/i386/pr52857-1.c +++ b/gcc/testsuite/gcc.target/i386/pr52857-1.c @@ -1,4 +1,5 @@ /* { dg-do compile { target { ! ia32 } } } */ +/* { dg-require-effective-target maybe_x32 } */ /* { dg-options "-g -O -mx32 -maddress-mode=long" } */ extern void get_BID128 (int *); diff --git a/gcc/testsuite/gcc.target/i386/pr52857-2.c b/gcc/testsuite/gcc.target/i386/pr52857-2.c index 99acf84347d..62ac5df5eb1 100644 --- a/gcc/testsuite/gcc.target/i386/pr52857-2.c +++ b/gcc/testsuite/gcc.target/i386/pr52857-2.c @@ -1,4 +1,5 @@ /* { dg-do compile { target { ! ia32 } } } */ +/* { dg-require-effective-target maybe_x32 } */ /* { dg-options "-g -O -mx32 -maddress-mode=long" } */ void uw_init_context_1 (void *); diff --git a/gcc/testsuite/gcc.target/i386/pr52876.c b/gcc/testsuite/gcc.target/i386/pr52876.c index 249206c3346..6255b286a78 100644 --- a/gcc/testsuite/gcc.target/i386/pr52876.c +++ b/gcc/testsuite/gcc.target/i386/pr52876.c @@ -1,4 +1,5 @@ /* { dg-do run { target x32 } } */ +/* { dg-require-effective-target maybe_x32 } */ /* { dg-options "-O2 -mx32 -maddress-mode=long" } */ extern void abort (void); diff --git a/gcc/testsuite/gcc.target/i386/pr53698.c b/gcc/testsuite/gcc.target/i386/pr53698.c index e36200af852..9f36707ecf9 100644 --- a/gcc/testsuite/gcc.target/i386/pr53698.c +++ b/gcc/testsuite/gcc.target/i386/pr53698.c @@ -1,4 +1,5 @@ /* { dg-do compile { target { ! ia32 } } } */ +/* { dg-require-effective-target maybe_x32 } */ /* { dg-options "-O -mx32 -maddress-mode=long -fno-tree-dominator-opts" } */ extern char foo[]; diff --git a/gcc/testsuite/gcc.target/i386/pr54157.c b/gcc/testsuite/gcc.target/i386/pr54157.c index 26318677d59..01b02c58a90 100644 --- a/gcc/testsuite/gcc.target/i386/pr54157.c +++ b/gcc/testsuite/gcc.target/i386/pr54157.c @@ -1,4 +1,5 @@ /* { dg-do compile { target { ! ia32 } } } */ +/* { dg-require-effective-target maybe_x32 } */ /* { dg-options "-O2 -mx32 -maddress-mode=long -ftree-vectorize" } */ struct s2{ diff --git a/gcc/testsuite/gcc.target/i386/pr55049-1.c b/gcc/testsuite/gcc.target/i386/pr55049-1.c index 387bbeb81fb..6486ce99a27 100644 --- a/gcc/testsuite/gcc.target/i386/pr55049-1.c +++ b/gcc/testsuite/gcc.target/i386/pr55049-1.c @@ -1,5 +1,6 @@ /* { dg-do compile { target { ! ia32 } } } */ /* { dg-require-effective-target fpic } */ +/* { dg-require-effective-target maybe_x32 } */ /* { dg-options "-O2 -fPIC -mx32" } */ extern void __morestack_fail (const char *msg); diff --git a/gcc/testsuite/gcc.target/i386/pr55093.c b/gcc/testsuite/gcc.target/i386/pr55093.c index bfe2c503d83..190a9423f33 100644 --- a/gcc/testsuite/gcc.target/i386/pr55093.c +++ b/gcc/testsuite/gcc.target/i386/pr55093.c @@ -1,4 +1,5 @@ /* { dg-do compile { target { ! ia32 } } } */ +/* { dg-require-effective-target maybe_x32 } */ /* { dg-options "-O2 -mx32 -maddress-mode=long" } */ /* { dg-skip-if "different ABI" { x86_64-*-mingw* } } */ diff --git a/gcc/testsuite/gcc.target/i386/pr55116-1.c b/gcc/testsuite/gcc.target/i386/pr55116-1.c index a2e2acd858a..a7d17ed014e 100644 --- a/gcc/testsuite/gcc.target/i386/pr55116-1.c +++ b/gcc/testsuite/gcc.target/i386/pr55116-1.c @@ -1,4 +1,5 @@ /* { dg-do compile { target { ! ia32 } } } */ +/* { dg-require-effective-target maybe_x32 } */ /* { dg-options "-O2 -mx32 -maddress-mode=long" } */ int glob_int_arr[100]; diff --git a/gcc/testsuite/gcc.target/i386/pr55116-2.c b/gcc/testsuite/gcc.target/i386/pr55116-2.c index 59bdebe690d..62ac0a1d001 100644 --- a/gcc/testsuite/gcc.target/i386/pr55116-2.c +++ b/gcc/testsuite/gcc.target/i386/pr55116-2.c @@ -1,4 +1,5 @@ /* { dg-do compile { target { ! ia32 } } } */ +/* { dg-require-effective-target maybe_x32 } */ /* { dg-options "-O2 -mx32 -maddress-mode=long" } */ typedef struct rtx_def *rtx; diff --git a/gcc/testsuite/gcc.target/i386/pr55597.c b/gcc/testsuite/gcc.target/i386/pr55597.c index 617c3e5c5ed..b942324892c 100644 --- a/gcc/testsuite/gcc.target/i386/pr55597.c +++ b/gcc/testsuite/gcc.target/i386/pr55597.c @@ -1,5 +1,6 @@ /* { dg-do compile { target { ! ia32 } } } */ /* { dg-require-effective-target fpic } */ +/* { dg-require-effective-target maybe_x32 } */ /* { dg-options "-O2 -fPIC -mx32 -maddress-mode=long" } */ struct initial_sp diff --git a/gcc/testsuite/gcc.target/i386/pr59929.c b/gcc/testsuite/gcc.target/i386/pr59929.c index 53e0b237c27..f770d4b7d1d 100644 --- a/gcc/testsuite/gcc.target/i386/pr59929.c +++ b/gcc/testsuite/gcc.target/i386/pr59929.c @@ -1,5 +1,6 @@ /* { dg-do run } */ /* { dg-options "-O0 -mno-accumulate-outgoing-args" } */ +/* { dg-require-effective-target maybe_x32 } */ /* { dg-additional-options "-mx32 -maddress-mode=short" { target x32 } } */ void diff --git a/gcc/testsuite/gcc.target/i386/pr66470.c b/gcc/testsuite/gcc.target/i386/pr66470.c index 5c068f3d71b..3515b6d2892 100644 --- a/gcc/testsuite/gcc.target/i386/pr66470.c +++ b/gcc/testsuite/gcc.target/i386/pr66470.c @@ -1,5 +1,6 @@ /* PR target/66470 */ /* { dg-do compile { target { ! ia32 } } } */ +/* { dg-require-effective-target maybe_x32 } */ /* { dg-options "-O2 -mx32 -maddress-mode=long" } */ /* { dg-require-effective-target tls } */ -- cgit v1.2.3 From 1f301d9ec2ca8fe3123fa44e87421f0eea662425 Mon Sep 17 00:00:00 2001 From: Iain Sandoe <iain@sandoe.co.uk> Date: Fri, 7 Jun 2019 07:48:32 +0000 Subject: Darwin, x86, backport fix for PR82920 part 3 (testsuite changes) gcc/testsuite/ 2019-06-07 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline. 2019-05-15 Iain Sandoe <iain@sandoe.co.uk> PR target/82920 * g++.dg/cet-notrack-1.C: Adjust scan assembler for Darwin. * gcc.target/i386/cet-notrack-5a.c: Likewise. * gcc.target/i386/cet-notrack-5b.c: Likewise. * gcc.target/i386/cet-notrack-6b.c: Likewise. * gcc.target/i386/cet-notrack-icf-1.c: Likewise. * gcc.target/i386/cet-notrack-icf-2.c: Likewise. * gcc.target/i386/cet-notrack-icf-3.c: Likewise. * gcc.target/i386/cet-notrack-icf-4.c: Likewise. * gcc.target/i386/cet-sjlj-3.c: Likewise. * gcc.target/i386/cet-sjlj-5.c: Likewise. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@272034 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/testsuite/ChangeLog | 17 +++++++++++++++++ gcc/testsuite/g++.dg/cet-notrack-1.C | 2 +- gcc/testsuite/gcc.target/i386/cet-notrack-5a.c | 3 ++- gcc/testsuite/gcc.target/i386/cet-notrack-5b.c | 3 ++- gcc/testsuite/gcc.target/i386/cet-notrack-6b.c | 3 ++- gcc/testsuite/gcc.target/i386/cet-notrack-icf-1.c | 4 ++-- gcc/testsuite/gcc.target/i386/cet-notrack-icf-2.c | 2 +- gcc/testsuite/gcc.target/i386/cet-notrack-icf-3.c | 4 ++-- gcc/testsuite/gcc.target/i386/cet-notrack-icf-4.c | 2 +- gcc/testsuite/gcc.target/i386/cet-sjlj-3.c | 2 +- gcc/testsuite/gcc.target/i386/cet-sjlj-5.c | 2 +- 11 files changed, 32 insertions(+), 12 deletions(-) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e1374d75796..f4f8ff52e14 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,20 @@ +2019-06-07 Iain Sandoe <iain@sandoe.co.uk> + + Backport from mainline. + 2019-05-15 Iain Sandoe <iain@sandoe.co.uk> + + PR target/82920 + * g++.dg/cet-notrack-1.C: Adjust scan assembler for Darwin. + * gcc.target/i386/cet-notrack-5a.c: Likewise. + * gcc.target/i386/cet-notrack-5b.c: Likewise. + * gcc.target/i386/cet-notrack-6b.c: Likewise. + * gcc.target/i386/cet-notrack-icf-1.c: Likewise. + * gcc.target/i386/cet-notrack-icf-2.c: Likewise. + * gcc.target/i386/cet-notrack-icf-3.c: Likewise. + * gcc.target/i386/cet-notrack-icf-4.c: Likewise. + * gcc.target/i386/cet-sjlj-3.c: Likewise. + * gcc.target/i386/cet-sjlj-5.c: Likewise. + 2019-06-07 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline. diff --git a/gcc/testsuite/g++.dg/cet-notrack-1.C b/gcc/testsuite/g++.dg/cet-notrack-1.C index eab0946d477..ee98fd43d58 100644 --- a/gcc/testsuite/g++.dg/cet-notrack-1.C +++ b/gcc/testsuite/g++.dg/cet-notrack-1.C @@ -1,7 +1,7 @@ /* { dg-do compile { target i?86-*-* x86_64-*-* } } */ /* { dg-options "-fcf-protection" } */ /* { dg-final { scan-assembler "endbr32|endbr64" } } */ -/* { dg-final { scan-assembler-times "\tcall\[ \t]+puts" 2 } } */ +/* { dg-final { scan-assembler-times "\tcall\[ \t]+_?puts" 2 } } */ /* { dg-final { scan-assembler-times "notrack call\[ \t]+" 1 } } */ #include <stdio.h> diff --git a/gcc/testsuite/gcc.target/i386/cet-notrack-5a.c b/gcc/testsuite/gcc.target/i386/cet-notrack-5a.c index 50fe0db7d0c..3856507fb71 100644 --- a/gcc/testsuite/gcc.target/i386/cet-notrack-5a.c +++ b/gcc/testsuite/gcc.target/i386/cet-notrack-5a.c @@ -2,7 +2,8 @@ /* { dg-options "-O -fcf-protection" } */ /* { dg-final { scan-assembler-times "endbr32" 1 { target ia32 } } } */ /* { dg-final { scan-assembler-times "endbr64" 1 { target { ! ia32 } } } } */ -/* { dg-final { scan-assembler-not "\tcall\[ \t]+" } } */ +/* { dg-final { scan-assembler-not "\tcall\[ \t]+" { target { { ! ia32 } || { ! *-*-darwin* } } } } } */ +/* { dg-final { scan-assembler-times "\tcall\[ \t]+" 1 { target { ia32 && *-*-darwin* } } } } */ /* { dg-final { scan-assembler-times "notrack call\[ \t]+" 1 } } */ int (*fptr) (int) __attribute__ ((nocf_check)); diff --git a/gcc/testsuite/gcc.target/i386/cet-notrack-5b.c b/gcc/testsuite/gcc.target/i386/cet-notrack-5b.c index 222ff62d670..332737c13ae 100644 --- a/gcc/testsuite/gcc.target/i386/cet-notrack-5b.c +++ b/gcc/testsuite/gcc.target/i386/cet-notrack-5b.c @@ -3,7 +3,8 @@ /* { dg-options "-O -fcf-protection" } */ /* { dg-final { scan-assembler-times "endbr32" 1 { target ia32 } } } */ /* { dg-final { scan-assembler-times "endbr64" 1 { target { ! ia32 } } } } */ -/* { dg-final { scan-assembler-times "\tcall\[ \t]+" 1 } } */ +/* { dg-final { scan-assembler-times "\tcall\[ \t]+" 1 { target { { ! ia32 } || { ! *-*-darwin* } } } } } */ +/* { dg-final { scan-assembler-times "\tcall\[ \t]+" 2 { target { ia32 && *-*-darwin* } } } } */ /* { dg-final { scan-assembler-times "notrack call\[ \t]+" 1 } } */ int (*fptr) (int) __attribute__ ((nocf_check)); diff --git a/gcc/testsuite/gcc.target/i386/cet-notrack-6b.c b/gcc/testsuite/gcc.target/i386/cet-notrack-6b.c index f27088c7283..041ba318d77 100644 --- a/gcc/testsuite/gcc.target/i386/cet-notrack-6b.c +++ b/gcc/testsuite/gcc.target/i386/cet-notrack-6b.c @@ -2,7 +2,8 @@ /* { dg-options "-O0 -fcf-protection" } */ /* { dg-final { scan-assembler-times "endbr32" 1 { target ia32 } } } */ /* { dg-final { scan-assembler-times "endbr64" 1 { target { ! ia32 } } } } */ -/* { dg-final { scan-assembler-not "\tcall\[ \t]+" } } */ +/* { dg-final { scan-assembler-not "\tcall\[ \t]+" { target { { ! ia32 } || { ! *-*-darwin* } } } } } */ +/* { dg-final { scan-assembler-times "\tcall\[ \t]+" 1 { target { ia32 && *-*-darwin* } } } } */ /* { dg-final { scan-assembler-times "notrack call\[ \t]+" 1 } } */ int foo (int arg); diff --git a/gcc/testsuite/gcc.target/i386/cet-notrack-icf-1.c b/gcc/testsuite/gcc.target/i386/cet-notrack-icf-1.c index 0bddf54862a..a601ed3f6c4 100644 --- a/gcc/testsuite/gcc.target/i386/cet-notrack-icf-1.c +++ b/gcc/testsuite/gcc.target/i386/cet-notrack-icf-1.c @@ -3,8 +3,8 @@ /* { dg-options "-O2 -fcf-protection=none" } */ /* { dg-final { scan-assembler-not "endbr" } } */ /* { dg-final { scan-assembler-not "fn3:" } } */ -/* { dg-final { scan-assembler "set\[ \t]+fn2,fn1" } } */ -/* { dg-final { scan-assembler "set\[ \t]+fn3,fn1" } } */ +/* { dg-final { scan-assembler "set\[ \t]+fn2,fn1" { target { ! *-*-darwin* } } } } */ +/* { dg-final { scan-assembler "set\[ \t]+fn3,fn1" { target { ! *-*-darwin* } } } } */ static __attribute__((noinline)) int fn1 (int x) diff --git a/gcc/testsuite/gcc.target/i386/cet-notrack-icf-2.c b/gcc/testsuite/gcc.target/i386/cet-notrack-icf-2.c index 08132a3e7ac..f15594d1f0b 100644 --- a/gcc/testsuite/gcc.target/i386/cet-notrack-icf-2.c +++ b/gcc/testsuite/gcc.target/i386/cet-notrack-icf-2.c @@ -3,7 +3,7 @@ /* { dg-options "-O2 -fcf-protection" } */ /* { dg-final { scan-assembler "endbr" } } */ /* { dg-final { scan-assembler "fn3:" } } */ -/* { dg-final { scan-assembler "set\[ \t]+fn2,fn1" } } */ +/* { dg-final { scan-assembler "set\[ \t]+fn2,fn1" { target { ! *-*-darwin* } } } } */ static __attribute__((noinline)) int fn1 (int x) diff --git a/gcc/testsuite/gcc.target/i386/cet-notrack-icf-3.c b/gcc/testsuite/gcc.target/i386/cet-notrack-icf-3.c index ed2d53ac5ef..a733789aa25 100644 --- a/gcc/testsuite/gcc.target/i386/cet-notrack-icf-3.c +++ b/gcc/testsuite/gcc.target/i386/cet-notrack-icf-3.c @@ -3,8 +3,8 @@ /* { dg-options "-O2 -fcf-protection=none" } */ /* { dg-final { scan-assembler-not "endbr" } } */ /* { dg-final { scan-assembler-not "fn2:" } } */ -/* { dg-final { scan-assembler "set\[ \t]+fn2,fn1" } } */ -/* { dg-final { scan-assembler "set\[ \t]+fn3,fn1" } } */ +/* { dg-final { scan-assembler "set\[ \t]+fn2,fn1" { target { ! *-*-darwin* } } } } */ +/* { dg-final { scan-assembler "set\[ \t]+fn3,fn1" { target { ! *-*-darwin* } } } } */ int (*foo)(int); diff --git a/gcc/testsuite/gcc.target/i386/cet-notrack-icf-4.c b/gcc/testsuite/gcc.target/i386/cet-notrack-icf-4.c index b5f07876b52..7d646662a4e 100644 --- a/gcc/testsuite/gcc.target/i386/cet-notrack-icf-4.c +++ b/gcc/testsuite/gcc.target/i386/cet-notrack-icf-4.c @@ -3,7 +3,7 @@ /* { dg-options "-O2 -fcf-protection" } */ /* { dg-final { scan-assembler "endbr" } } */ /* { dg-final { scan-assembler "fn2:" } } */ -/* { dg-final { scan-assembler "set\[ \t]+fn3,fn1" } } */ +/* { dg-final { scan-assembler "set\[ \t]+fn3,fn1" { target { ! *-*-darwin* } } } } */ int (*foo)(int); diff --git a/gcc/testsuite/gcc.target/i386/cet-sjlj-3.c b/gcc/testsuite/gcc.target/i386/cet-sjlj-3.c index 25117cc0c9f..e2653dbb2c5 100644 --- a/gcc/testsuite/gcc.target/i386/cet-sjlj-3.c +++ b/gcc/testsuite/gcc.target/i386/cet-sjlj-3.c @@ -3,7 +3,7 @@ /* { dg-final { scan-assembler-times "endbr32" 4 { target ia32 } } } */ /* { dg-final { scan-assembler-times "endbr64" 4 { target { ! ia32 } } } } */ /* { dg-final { scan-assembler-times "call _?setjmp" 1 } } */ -/* { dg-final { scan-assembler-times "call longjmp" 1 } } */ +/* { dg-final { scan-assembler-times "call _?longjmp" 1 } } */ #include <stdio.h> #include <setjmp.h> diff --git a/gcc/testsuite/gcc.target/i386/cet-sjlj-5.c b/gcc/testsuite/gcc.target/i386/cet-sjlj-5.c index 1b624327d0f..8470f9cbf88 100644 --- a/gcc/testsuite/gcc.target/i386/cet-sjlj-5.c +++ b/gcc/testsuite/gcc.target/i386/cet-sjlj-5.c @@ -3,7 +3,7 @@ /* { dg-final { scan-assembler-times "endbr32" 2 { target ia32 } } } */ /* { dg-final { scan-assembler-times "endbr64" 2 { target { ! ia32 } } } } */ /* { dg-final { scan-assembler-times "call _?setjmp" 1 } } */ -/* { dg-final { scan-assembler-times "call longjmp" 1 } } */ +/* { dg-final { scan-assembler-times "call _?longjmp" 1 } } */ #include <stdio.h> #include <setjmp.h> -- cgit v1.2.3 From a2f30a044042b3b6e5993f14c7a83e6dc23ed120 Mon Sep 17 00:00:00 2001 From: Iain Sandoe <iain@sandoe.co.uk> Date: Fri, 7 Jun 2019 07:54:20 +0000 Subject: Darwin, x86, fix three testcases for pr82920 only on 8 branch. As part of the backport for pr82920, the following three testcases that are only present on the 8 branch, also needed amendment. gcc/testsuite/ 2019-06-07 Iain Sandoe <iain@sandoe.co.uk> PR target/82920 * gcc.target/i386/indirect-thunk-bnd-1.c: Adjust scan-asms for Darwin, do not use -fno-pic on Darwin. * gcc.target/i386/indirect-thunk-bnd-2.c: Likewise. * gcc.target/i386/ret-thunk-25.c: Skip for Darwin, which has a different ABI for returning this category of complex value. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@272035 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/testsuite/ChangeLog | 9 +++++++++ gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-1.c | 7 ++++--- gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-2.c | 7 ++++--- gcc/testsuite/gcc.target/i386/ret-thunk-25.c | 1 + 4 files changed, 18 insertions(+), 6 deletions(-) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index f4f8ff52e14..689b58dc14e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,12 @@ +2019-06-07 Iain Sandoe <iain@sandoe.co.uk> + + PR target/82920 + * gcc.target/i386/indirect-thunk-bnd-1.c: Adjust scan-asms for Darwin, + do not use -fno-pic on Darwin. + * gcc.target/i386/indirect-thunk-bnd-2.c: Likewise. + * gcc.target/i386/ret-thunk-25.c: Skip for Darwin, which has a + different ABI for returning this category of complex value. + 2019-06-07 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline. diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-1.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-1.c index 73d16baddc7..6dce9045812 100644 --- a/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-1.c +++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-1.c @@ -1,5 +1,6 @@ /* { dg-do compile { target { ! x32 } } } */ -/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk -fcheck-pointer-bounds -mmpx -fno-pic" } */ +/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk -fcheck-pointer-bounds -mmpx" } */ +/* { dg-additional-options "-fno-pic" { target { ! *-*-darwin* } } } */ void (*dispatch) (char *); char buf[10]; @@ -11,8 +12,8 @@ foo (void) } /* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*_?dispatch" { target *-*-linux* } } } */ -/* { dg-final { scan-assembler "bnd jmp\[ \t\]*__x86_indirect_thunk_bnd_rax" { target lp64 } } } */ -/* { dg-final { scan-assembler "bnd call\[ \t\]*__x86_indirect_thunk_bnd_eax" { target ia32 } } } */ +/* { dg-final { scan-assembler "bnd jmp\[ \t\]*_?__x86_indirect_thunk_bnd_rax" { target lp64 } } } */ +/* { dg-final { scan-assembler "bnd call\[ \t\]*_?__x86_indirect_thunk_bnd_eax" { target ia32 } } } */ /* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */ /* { dg-final { scan-assembler "bnd call\[ \t\]*\.LIND" } } */ /* { dg-final { scan-assembler "bnd ret" } } */ diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-2.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-2.c index 856751ac224..20091c852d7 100644 --- a/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-2.c +++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-2.c @@ -1,5 +1,6 @@ /* { dg-do compile { target { ! x32 } } } */ -/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk -fcheck-pointer-bounds -mmpx -fno-pic" } */ +/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk -fcheck-pointer-bounds -mmpx" } */ +/* { dg-additional-options "-fno-pic" { target { ! *-*-darwin* } } } */ void (*dispatch) (char *); char buf[10]; @@ -12,8 +13,8 @@ foo (void) } /* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*_?dispatch" { target *-*-linux* } } } */ -/* { dg-final { scan-assembler "bnd call\[ \t\]*__x86_indirect_thunk_bnd_(r|e)ax" } } */ -/* { dg-final { scan-assembler "bnd call\[ \t\]*\.LIND" } } */ +/* { dg-final { scan-assembler "bnd call\[ \t\]*_?__x86_indirect_thunk_bnd_(r|e)ax" } } */ +/* { dg-final { scan-assembler "bnd call\[ \t\]*\.?LIND" } } */ /* { dg-final { scan-assembler "bnd ret" } } */ /* { dg-final { scan-assembler {\tpause} } } */ /* { dg-final { scan-assembler {\tlfence} } } */ diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-25.c b/gcc/testsuite/gcc.target/i386/ret-thunk-25.c index f73553c9a9f..c0fd9bab257 100644 --- a/gcc/testsuite/gcc.target/i386/ret-thunk-25.c +++ b/gcc/testsuite/gcc.target/i386/ret-thunk-25.c @@ -1,5 +1,6 @@ /* PR target/r84530 */ /* { dg-do compile { target ia32 } } */ +/* { dg-skip-if "ABI differs for return complex value" { *-*-darwin* } } */ /* { dg-options "-O2 -mfunction-return=thunk -fcheck-pointer-bounds -mmpx -fno-pic" } */ struct s { _Complex unsigned short x; }; -- cgit v1.2.3 From bb15d60ec8c9f6592832fab909a357c386e1b911 Mon Sep 17 00:00:00 2001 From: John David Anglin <danglin@gcc.gnu.org> Date: Sat, 8 Jun 2019 00:15:45 +0000 Subject: PR target/90751 * config/pa/pa-linux.h (ASM_DECLARE_FUNCTION_NAME): Update comment. Call pa_output_function_label. (TARGET_ASM_FUNCTION_PROLOGUE): define. * config/pa/pa-protos.h (pa_output_function_label): Declare. * config/pa/pa.c (pa_output_function_prologue): Add ATTRIBUTE_UNUSED to declaration. (pa_linux_output_function_prologue): Declare. (TARGET_ASM_FUNCTION_PROLOGUE): Delete define. (pa_output_function_label): New. (pa_output_function_prologue): Revise to use pa_output_function_label. (pa_linux_output_function_prologue): New. * config/pa/pa.h (TARGET_ASM_FUNCTION_PROLOGUE): Define. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@272063 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 16 ++++++++++++++++ gcc/config/pa/pa-linux.h | 7 ++++++- gcc/config/pa/pa-protos.h | 1 + gcc/config/pa/pa.c | 32 ++++++++++++++++++++------------ gcc/config/pa/pa.h | 3 +++ 5 files changed, 46 insertions(+), 13 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 381310297d3..4fef94cbaf4 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,19 @@ +2019-06-07 John David Anglin <danglin@gcc.gnu.orig> + + PR target/90751 + * config/pa/pa-linux.h (ASM_DECLARE_FUNCTION_NAME): Update comment. + Call pa_output_function_label. + (TARGET_ASM_FUNCTION_PROLOGUE): define. + * config/pa/pa-protos.h (pa_output_function_label): Declare. + * config/pa/pa.c (pa_output_function_prologue): Add ATTRIBUTE_UNUSED + to declaration. + (pa_linux_output_function_prologue): Declare. + (TARGET_ASM_FUNCTION_PROLOGUE): Delete define. + (pa_output_function_label): New. + (pa_output_function_prologue): Revise to use pa_output_function_label. + (pa_linux_output_function_prologue): New. + * config/pa/pa.h (TARGET_ASM_FUNCTION_PROLOGUE): Define. + 2019-06-07 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline. diff --git a/gcc/config/pa/pa-linux.h b/gcc/config/pa/pa-linux.h index a4ad2dda18e..80eae4928dc 100644 --- a/gcc/config/pa/pa-linux.h +++ b/gcc/config/pa/pa-linux.h @@ -101,7 +101,7 @@ along with GCC; see the file COPYING3. If not see /* FIXME: Hacked from the <elfos.h> one so that we avoid multiple labels in a function declaration (since pa.c seems determined to do - it differently) */ + it differently). */ #undef ASM_DECLARE_FUNCTION_NAME #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \ @@ -109,9 +109,14 @@ along with GCC; see the file COPYING3. If not see { \ ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "function"); \ ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL)); \ + pa_output_function_label (FILE); \ } \ while (0) +/* Output function prologue for linux. */ +#undef TARGET_ASM_FUNCTION_PROLOGUE +#define TARGET_ASM_FUNCTION_PROLOGUE pa_linux_output_function_prologue + /* As well as globalizing the label, we need to encode the label to ensure a plabel is generated in an indirect call. */ diff --git a/gcc/config/pa/pa-protos.h b/gcc/config/pa/pa-protos.h index 79685bae93a..3d1329c7cc1 100644 --- a/gcc/config/pa/pa-protos.h +++ b/gcc/config/pa/pa-protos.h @@ -108,5 +108,6 @@ extern void pa_asm_output_aligned_local (FILE *, const char *, extern void pa_hpux_asm_output_external (FILE *, tree, const char *); extern HOST_WIDE_INT pa_initial_elimination_offset (int, int); extern HOST_WIDE_INT pa_function_arg_size (machine_mode, const_tree); +extern void pa_output_function_label (FILE *); extern const int pa_magic_milli[]; diff --git a/gcc/config/pa/pa.c b/gcc/config/pa/pa.c index 6627fd90f6f..65be97def0a 100644 --- a/gcc/config/pa/pa.c +++ b/gcc/config/pa/pa.c @@ -118,7 +118,8 @@ static void set_reg_plus_d (int, int, HOST_WIDE_INT, int); static rtx pa_function_value (const_tree, const_tree, bool); static rtx pa_libcall_value (machine_mode, const_rtx); static bool pa_function_value_regno_p (const unsigned int); -static void pa_output_function_prologue (FILE *); +static void pa_output_function_prologue (FILE *) ATTRIBUTE_UNUSED; +static void pa_linux_output_function_prologue (FILE *) ATTRIBUTE_UNUSED; static void update_total_code_bytes (unsigned int); static void pa_output_function_epilogue (FILE *); static int pa_adjust_cost (rtx_insn *, int, rtx_insn *, int, unsigned int); @@ -263,8 +264,6 @@ static size_t n_deferred_plabels = 0; #undef TARGET_ASM_INTEGER #define TARGET_ASM_INTEGER pa_assemble_integer -#undef TARGET_ASM_FUNCTION_PROLOGUE -#define TARGET_ASM_FUNCTION_PROLOGUE pa_output_function_prologue #undef TARGET_ASM_FUNCTION_EPILOGUE #define TARGET_ASM_FUNCTION_EPILOGUE pa_output_function_epilogue @@ -3842,16 +3841,10 @@ pa_compute_frame_size (poly_int64 size, int *fregs_live) & ~(PREFERRED_STACK_BOUNDARY / BITS_PER_UNIT - 1)); } -/* On HP-PA, move-double insns between fpu and cpu need an 8-byte block - of memory. If any fpu reg is used in the function, we allocate - such a block here, at the bottom of the frame, just in case it's needed. +/* Output function label, and associated .PROC and .CALLINFO statements. */ - If this function is a leaf procedure, then we may choose not - to do a "save" insn. The decision about whether or not - to do this is made in regclass.c. */ - -static void -pa_output_function_prologue (FILE *file) +void +pa_output_function_label (FILE *file) { /* The function's label and associated .PROC must never be separated and must be output *after* any profiling declarations @@ -3897,7 +3890,22 @@ pa_output_function_prologue (FILE *file) fprintf (file, ",ENTRY_FR=%d", fr_saved + 11); fputs ("\n\t.ENTRY\n", file); +} + +/* Output function prologue. */ +static void +pa_output_function_prologue (FILE *file) +{ + pa_output_function_label (file); + remove_useless_addtr_insns (0); +} + +/* The label is output by ASM_DECLARE_FUNCTION_NAME on linux. */ + +static void +pa_linux_output_function_prologue (FILE *file ATTRIBUTE_UNUSED) +{ remove_useless_addtr_insns (0); } diff --git a/gcc/config/pa/pa.h b/gcc/config/pa/pa.h index 2ddd4975f34..01aefdf0aa7 100644 --- a/gcc/config/pa/pa.h +++ b/gcc/config/pa/pa.h @@ -1302,3 +1302,6 @@ do { \ (flag_pic ? (TARGET_HPUX ? 198164 : 221312) : 240000) #define NEED_INDICATE_EXEC_STACK 0 + +/* Output default function prologue for hpux. */ +#define TARGET_ASM_FUNCTION_PROLOGUE pa_output_function_prologue -- cgit v1.2.3 From 74b0739305b5a57cadf5607b00365ec220142174 Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Sat, 8 Jun 2019 00:16:10 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@272065 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index fb321a1d9f9..058a9468394 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190607 +20190608 -- cgit v1.2.3 From ef232da67ad8b6919ee841d9f0199b0185d85e7f Mon Sep 17 00:00:00 2001 From: John David Anglin <danglin@gcc.gnu.org> Date: Sat, 8 Jun 2019 00:17:46 +0000 Subject: * lib/scanasm.exp (dg-function-on-line): Add pattern for hppa*-*-linux*. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@272069 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/lib/scanasm.exp | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 689b58dc14e..9a4537643d5 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2019-06-07 John David Anglin <danglin@gcc.gnu.org> + + * lib/scanasm.exp (dg-function-on-line): Add pattern for hppa*-*-linux*. + 2019-06-07 Iain Sandoe <iain@sandoe.co.uk> PR target/82920 diff --git a/gcc/testsuite/lib/scanasm.exp b/gcc/testsuite/lib/scanasm.exp index 61e0f3f48ae..e653b1e7597 100644 --- a/gcc/testsuite/lib/scanasm.exp +++ b/gcc/testsuite/lib/scanasm.exp @@ -504,7 +504,10 @@ proc dg-function-on-line { args } { } } - if { [istarget hppa*-*-*] } { + if { [istarget hppa*-*-linux*] } { + set pattern [format {%s:\n\t.PROC\n\t.CALLINFO.*\n\t.ENTRY\n.L.*:\n(\t.file[^\t]*)*\t[^:]+:%d(:[0-9]+)?\n} \ + $symbol $line] + } elseif { [istarget hppa*-*-*] } { set pattern [format {\t;[^:]+:%d(:[0-9]+)?\n(\t[^\t]+\n)+%s:\n\t.PROC} \ $line $symbol] } elseif { [istarget mips*-*-*] } { -- cgit v1.2.3 From ebd768ff0fbe261ce72cbb51c67cef1b026cd2f4 Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Sun, 9 Jun 2019 00:16:11 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@272087 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 058a9468394..c52e08a5cb9 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190608 +20190609 -- cgit v1.2.3 From 0aaf1f6e7730cecf7bba37d1598f6f15424b435e Mon Sep 17 00:00:00 2001 From: Paul Thomas <pault@gcc.gnu.org> Date: Sun, 9 Jun 2019 18:26:33 +0000 Subject: 2019-06-09 Paul Thomas <pault@gcc.gnu.org> Backport from trunk PR fortran/57284 * resolve.c (find_array_spec): If this is a class expression and the symbol and component array specs are the same, this is not an error. *trans-intrinsic.c (gfc_conv_intrinsic_size): If a class symbol argument, has no namespace, it has come from the interface mapping and the _data component must be accessed directly. * trans-array.c (gfc_trans_create_temp_array): Compute elemsize in all cases and use to set span field. (gfc_is_reallocatable_lhs): Pick up class allocatable exprs that do not have a _data component ref before the array ref. 2019-06-09 Paul Thomas <pault@gcc.gnu.org> Backport from trunk PR fortran/57284 * gfortran.dg/class_70.f03 git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@272093 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fortran/ChangeLog | 11 ++++++++++ gcc/fortran/resolve.c | 8 +++++-- gcc/fortran/trans-array.c | 29 ++++++++++++++++++-------- gcc/fortran/trans-intrinsic.c | 25 ++++++++++++++++++++-- gcc/testsuite/ChangeLog | 6 ++++++ gcc/testsuite/gfortran.dg/class_70.f03 | 38 ++++++++++++++++++++++++++++++++++ 6 files changed, 104 insertions(+), 13 deletions(-) create mode 100644 gcc/testsuite/gfortran.dg/class_70.f03 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 426da2e8c26..d83dc6be883 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,14 @@ +2019-06-09 Paul Thomas <pault@gcc.gnu.org> + + Backport from trunk + PR fortran/57284 + * resolve.c (find_array_spec): If this is a class expression + and the symbol and component array specs are the same, this is + not an error. + *trans-intrinsic.c (gfc_conv_intrinsic_size): If a class symbol + argument, has no namespace, it has come from the interface + mapping and the _data component must be accessed directly. + 2019-05-30 Marek Polacek <polacek@redhat.com> * lang.opt (ftail-call-workaround): Fix a typo. diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index 4c67b57614f..ad9090ef48c 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -4632,9 +4632,13 @@ find_array_spec (gfc_expr *e) gfc_array_spec *as; gfc_component *c; gfc_ref *ref; + bool class_as = false; if (e->symtree->n.sym->ts.type == BT_CLASS) - as = CLASS_DATA (e->symtree->n.sym)->as; + { + as = CLASS_DATA (e->symtree->n.sym)->as; + class_as = true; + } else as = e->symtree->n.sym->as; @@ -4653,7 +4657,7 @@ find_array_spec (gfc_expr *e) c = ref->u.c.component; if (c->attr.dimension) { - if (as != NULL) + if (as != NULL && !(class_as && as == c->as)) gfc_internal_error ("find_array_spec(): unused as(1)"); as = c->as; } diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c index 6a4dcaffbd8..47d1b96164c 100644 --- a/gcc/fortran/trans-array.c +++ b/gcc/fortran/trans-array.c @@ -1164,6 +1164,7 @@ gfc_trans_create_temp_array (stmtblock_t * pre, stmtblock_t * post, gfc_ss * ss, tree nelem; tree cond; tree or_expr; + tree elemsize; tree class_expr = NULL_TREE; int n, dim, tmp_dim; int total_dim = 0; @@ -1329,21 +1330,21 @@ gfc_trans_create_temp_array (stmtblock_t * pre, stmtblock_t * post, gfc_ss * ss, } } + if (class_expr == NULL_TREE) + elemsize = fold_convert (gfc_array_index_type, + TYPE_SIZE_UNIT (gfc_get_element_type (type))); + else + elemsize = gfc_class_vtab_size_get (class_expr); + /* Get the size of the array. */ if (size && !callee_alloc) { - tree elemsize; /* If or_expr is true, then the extent in at least one dimension is zero and the size is set to zero. */ size = fold_build3_loc (input_location, COND_EXPR, gfc_array_index_type, or_expr, gfc_index_zero_node, size); nelem = size; - if (class_expr == NULL_TREE) - elemsize = fold_convert (gfc_array_index_type, - TYPE_SIZE_UNIT (gfc_get_element_type (type))); - else - elemsize = gfc_class_vtab_size_get (class_expr); size = fold_build2_loc (input_location, MULT_EXPR, gfc_array_index_type, size, elemsize); @@ -1354,6 +1355,10 @@ gfc_trans_create_temp_array (stmtblock_t * pre, stmtblock_t * post, gfc_ss * ss, size = NULL_TREE; } + /* Set the span. */ + tmp = fold_convert (gfc_array_index_type, elemsize); + gfc_conv_descriptor_span_set (pre, desc, tmp); + gfc_trans_allocate_array_storage (pre, post, info, size, nelem, initial, dynamic, dealloc); @@ -9530,9 +9535,15 @@ gfc_is_reallocatable_lhs (gfc_expr *expr) if (sym->ts.type == BT_CLASS && !sym->attr.associate_var && CLASS_DATA (sym)->attr.allocatable - && expr->ref && expr->ref->type == REF_COMPONENT - && strcmp (expr->ref->u.c.component->name, "_data") == 0 - && expr->ref->next == NULL) + && expr->ref + && ((expr->ref->type == REF_ARRAY && expr->ref->u.ar.type == AR_FULL + && expr->ref->next == NULL) + || (expr->ref->type == REF_COMPONENT + && strcmp (expr->ref->u.c.component->name, "_data") == 0 + && (expr->ref->next == NULL + || (expr->ref->next->type == REF_ARRAY + && expr->ref->next->u.ar.type == AR_FULL + && expr->ref->next->next == NULL))))) return true; /* An allocatable variable. */ diff --git a/gcc/fortran/trans-intrinsic.c b/gcc/fortran/trans-intrinsic.c index dcb055ea38d..24c261d012d 100644 --- a/gcc/fortran/trans-intrinsic.c +++ b/gcc/fortran/trans-intrinsic.c @@ -6820,6 +6820,8 @@ gfc_conv_intrinsic_size (gfc_se * se, gfc_expr * expr) tree fncall0; tree fncall1; gfc_se argse; + gfc_expr *e; + gfc_symbol *sym = NULL; gfc_init_se (&argse, NULL); actual = expr->value.function.actual; @@ -6827,12 +6829,31 @@ gfc_conv_intrinsic_size (gfc_se * se, gfc_expr * expr) if (actual->expr->ts.type == BT_CLASS) gfc_add_class_array_ref (actual->expr); + e = actual->expr; + + /* These are emerging from the interface mapping, when a class valued + function appears as the rhs in a realloc on assign statement, where + the size of the result is that of one of the actual arguments. */ + if (e->expr_type == EXPR_VARIABLE + && e->symtree->n.sym->ns == NULL /* This is distinctive! */ + && e->symtree->n.sym->ts.type == BT_CLASS + && e->ref && e->ref->type == REF_COMPONENT + && strcmp (e->ref->u.c.component->name, "_data") == 0) + sym = e->symtree->n.sym; + argse.data_not_needed = 1; - if (gfc_is_class_array_function (actual->expr)) + if (gfc_is_class_array_function (e)) { /* For functions that return a class array conv_expr_descriptor is not able to get the descriptor right. Therefore this special case. */ - gfc_conv_expr_reference (&argse, actual->expr); + gfc_conv_expr_reference (&argse, e); + argse.expr = gfc_build_addr_expr (NULL_TREE, + gfc_class_data_get (argse.expr)); + } + else if (sym && sym->backend_decl) + { + gcc_assert (GFC_CLASS_TYPE_P (TREE_TYPE (sym->backend_decl))); + argse.expr = sym->backend_decl; argse.expr = gfc_build_addr_expr (NULL_TREE, gfc_class_data_get (argse.expr)); } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 9a4537643d5..96ff4a92421 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2019-06-09 Paul Thomas <pault@gcc.gnu.org> + + Backport from trunk + PR fortran/57284 + * gfortran.dg/class_70.f03 + 2019-06-07 John David Anglin <danglin@gcc.gnu.org> * lib/scanasm.exp (dg-function-on-line): Add pattern for hppa*-*-linux*. diff --git a/gcc/testsuite/gfortran.dg/class_70.f03 b/gcc/testsuite/gfortran.dg/class_70.f03 new file mode 100644 index 00000000000..b689563916d --- /dev/null +++ b/gcc/testsuite/gfortran.dg/class_70.f03 @@ -0,0 +1,38 @@ +! { dg-do run } +! +! Test the fix for PR57284 - [OOP] ICE with find_array_spec for polymorphic +! arrays. Once thw ICE was fixed, work was needed to fix a segfault while +! determining the size of 'z'. +! +! Contributed by Lorenz Huedepohl <bugs@stellardeath.org> +! +module testmod + type type_t + integer :: idx + end type type_t + type type_u + type(type_t), allocatable :: cmp(:) + end type +contains + function foo(a, b) result(add) + class(type_t), intent(in) :: a(:), b(size(a)) + type(type_t) :: add(size(a)) + add%idx = a%idx + b%idx + end function +end module testmod +program p + use testmod + class(type_t), allocatable, dimension(:) :: x, y, z + class(type_u), allocatable :: w + allocate (x, y, source = [type_t (1), type_t(2)]) + z = foo (x, y) + if (any (z%idx .ne. [2, 4])) stop 1 + +! Try something a bit more complicated than the original. + + allocate (w) + allocate (w%cmp, source = [type_t (2), type_t(3)]) + z = foo (w%cmp, y) + if (any (z%idx .ne. [3, 5])) stop 2 + deallocate (w, x, y, z) +end program -- cgit v1.2.3 From 6b8aff384c7f5d048414d6c36f0f29f3277ee574 Mon Sep 17 00:00:00 2001 From: Paul Thomas <pault@gcc.gnu.org> Date: Sun, 9 Jun 2019 18:31:11 +0000 Subject: 2019-06-09 Paul Thomas <pault@gcc.gnu.org> Backport from trunk PR fortran/57284 * resolve.c (find_array_spec): If this is a class expression and the symbol and component array specs are the same, this is not an error. *trans-intrinsic.c (gfc_conv_intrinsic_size): If a class symbol argument, has no namespace, it has come from the interface mapping and the _data component must be accessed directly. * trans-array.c (gfc_trans_create_temp_array): Compute elemsize in all cases and use to set span field. (gfc_is_reallocatable_lhs): Pick up class allocatable exprs that do not have a _data component ref before the array ref. 2019-06-09 Paul Thomas <pault@gcc.gnu.org> Backport from trunk PR fortran/57284 * gfortran.dg/class_70.f03: New test * gfortran.dg/assign_10.f90: Bump up counts of "atmp". * gfortran.dg/transpose_optimization_2.f90: Ditto git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@272094 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/testsuite/ChangeLog | 7 +++++++ gcc/testsuite/gfortran.dg/transpose_optimization_2.f90 | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 96ff4a92421..07657caac3e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2019-06-09 Paul Thomas <pault@gcc.gnu.org> + + Backport from trunk + PR fortran/57284 + * gfortran.dg/assign_10.f90: Bump up counts of "atmp". + * gfortran.dg/transpose_optimization_2.f90: Ditto + 2019-06-09 Paul Thomas <pault@gcc.gnu.org> Backport from trunk diff --git a/gcc/testsuite/gfortran.dg/transpose_optimization_2.f90 b/gcc/testsuite/gfortran.dg/transpose_optimization_2.f90 index 4748da19547..c49cd421058 100644 --- a/gcc/testsuite/gfortran.dg/transpose_optimization_2.f90 +++ b/gcc/testsuite/gfortran.dg/transpose_optimization_2.f90 @@ -61,4 +61,4 @@ end ! The check below for temporaries gave 14 and 33 for "parm" and "atmp". ! ! { dg-final { scan-tree-dump-times "parm" 72 "original" } } -! { dg-final { scan-tree-dump-times "atmp" 12 "original" } } +! { dg-final { scan-tree-dump-times "atmp" 13 "original" } } -- cgit v1.2.3 From 3ec71de88f365b2380f8257864a3109ac61cb8a4 Mon Sep 17 00:00:00 2001 From: Paul Thomas <pault@gcc.gnu.org> Date: Sun, 9 Jun 2019 18:31:58 +0000 Subject: 2019-06-09 Paul Thomas <pault@gcc.gnu.org> Backport from trunk PR fortran/57284 * resolve.c (find_array_spec): If this is a class expression and the symbol and component array specs are the same, this is not an error. *trans-intrinsic.c (gfc_conv_intrinsic_size): If a class symbol argument, has no namespace, it has come from the interface mapping and the _data component must be accessed directly. * trans-array.c (gfc_trans_create_temp_array): Compute elemsize in all cases and use to set span field. (gfc_is_reallocatable_lhs): Pick up class allocatable exprs that do not have a _data component ref before the array ref. 2019-06-09 Paul Thomas <pault@gcc.gnu.org> Backport from trunk PR fortran/57284 * gfortran.dg/class_70.f03: New test * gfortran.dg/assign_10.f90: Bump up counts of "atmp". * gfortran.dg/transpose_optimization_2.f90: Ditto git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@272095 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/testsuite/gfortran.dg/assign_10.f90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/testsuite/gfortran.dg/assign_10.f90 b/gcc/testsuite/gfortran.dg/assign_10.f90 index 6e57bef1650..c207f9e5e2b 100644 --- a/gcc/testsuite/gfortran.dg/assign_10.f90 +++ b/gcc/testsuite/gfortran.dg/assign_10.f90 @@ -24,4 +24,4 @@ end ! Note that it is the kind conversion that generates the temp. ! ! { dg-final { scan-tree-dump-times "parm" 20 "original" } } -! { dg-final { scan-tree-dump-times "atmp" 18 "original" } } +! { dg-final { scan-tree-dump-times "atmp" 20 "original" } } -- cgit v1.2.3 From 58b1d0ae1cf8c4030799b182a4bf98b09858c52d Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Mon, 10 Jun 2019 00:16:14 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@272100 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index c52e08a5cb9..9be8b59bc3d 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190609 +20190610 -- cgit v1.2.3 From 4197b437e88ea873f4f5b2432ebc588aea06adb7 Mon Sep 17 00:00:00 2001 From: Paul Thomas <pault@gcc.gnu.org> Date: Mon, 10 Jun 2019 05:48:44 +0000 Subject: 2019-06-10 Paul Thomas <pault@gcc.gnu.org> Backport from trunk PR fortran/90498 * trans-stmt.c (trans_associate_var) Do not use the saved descriptor if the expression is a COMPONENT_REF. 2019-06-10 Paul Thomas <pault@gcc.gnu.org> Backport from trunk PR fortran/90498 * gfortran.dg/associate_48.f90 : New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@272103 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fortran/ChangeLog | 7 +++++ gcc/fortran/trans-stmt.c | 3 ++- gcc/testsuite/ChangeLog | 6 +++++ gcc/testsuite/gfortran.dg/associate_48.f90 | 41 ++++++++++++++++++++++++++++++ 4 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gfortran.dg/associate_48.f90 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index d83dc6be883..5cd180dcd7d 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,10 @@ +2019-06-10 Paul Thomas <pault@gcc.gnu.org> + + Backport from trunk + PR fortran/90498 + * trans-stmt.c (trans_associate_var) Do not use the saved + descriptor if the expression is a COMPONENT_REF. + 2019-06-09 Paul Thomas <pault@gcc.gnu.org> Backport from trunk diff --git a/gcc/fortran/trans-stmt.c b/gcc/fortran/trans-stmt.c index eb976c70a3a..32eb25dce79 100644 --- a/gcc/fortran/trans-stmt.c +++ b/gcc/fortran/trans-stmt.c @@ -1842,7 +1842,8 @@ trans_associate_var (gfc_symbol *sym, gfc_wrapped_block *block) { if (e->symtree && DECL_LANG_SPECIFIC (e->symtree->n.sym->backend_decl) - && GFC_DECL_SAVED_DESCRIPTOR (e->symtree->n.sym->backend_decl)) + && GFC_DECL_SAVED_DESCRIPTOR (e->symtree->n.sym->backend_decl) + && TREE_CODE (target_expr) != COMPONENT_REF) /* Use the original class descriptor stored in the saved descriptor to get the target_expr. */ target_expr = diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 07657caac3e..1b828d22b9c 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2019-06-10 Paul Thomas <pault@gcc.gnu.org> + + Backport from trunk + PR fortran/90498 + * gfortran.dg/associate_48.f90 : New test. + 2019-06-09 Paul Thomas <pault@gcc.gnu.org> Backport from trunk diff --git a/gcc/testsuite/gfortran.dg/associate_48.f90 b/gcc/testsuite/gfortran.dg/associate_48.f90 new file mode 100644 index 00000000000..5ce3a496d14 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/associate_48.f90 @@ -0,0 +1,41 @@ +! { dg=do run } +! +! Test the fix for PR90498. +! +! Contributed by Vladimir Fuka <vladimir.fuka@gmail.com> +! + type field_names_a + class(*), pointer :: var(:) =>null() + end type + + type(field_names_a),pointer :: a(:) + allocate (a(2)) + + allocate (a(1)%var(2), source = ["hello"," vlad"]) + allocate (a(2)%var(2), source = ["HELLO"," VLAD"]) + call s(a) + deallocate (a(1)%var) + deallocate (a(2)%var) + deallocate (a) +contains + subroutine s(a) + + type(field_names_a) :: a(:) + + select type (var => a(1)%var) + type is (character(*)) + if (any (var .ne. ["hello"," vlad"])) stop 1 + class default + stop + end select + + associate (var => a(2)%var) + select type (var) + type is (character(*)) + if (any (var .ne. ["HELLO"," VLAD"])) stop 2 + class default + stop + end select + end associate + end +end -- cgit v1.2.3 From 16a5f3dd171e57fdae864b1d5d504ec237730952 Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Tue, 11 Jun 2019 00:16:09 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@272139 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 9be8b59bc3d..66b9d76b2f5 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190610 +20190611 -- cgit v1.2.3 From 8c353ae4a99f2d993a8b578e9c1afddb6a39f91d Mon Sep 17 00:00:00 2001 From: Jakub Jelinek <jakub@redhat.com> Date: Tue, 11 Jun 2019 13:42:07 +0000 Subject: PR c++/90810 * init.c (constant_value_1): Handle VECTOR_CST DECL_INITIAL for !DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P decls like CONSTRUCTOR. * g++.dg/ext/vector37.C: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@272155 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/init.c | 7 +++++-- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/ext/vector37.C | 29 +++++++++++++++++++++++++++++ 4 files changed, 45 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/g++.dg/ext/vector37.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index f945e61e0af..6b6a5c32052 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2019-06-11 Jakub Jelinek <jakub@redhat.com> + + PR c++/90810 + * init.c (constant_value_1): Handle VECTOR_CST DECL_INITIAL for + !DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P decls like CONSTRUCTOR. + 2019-05-22 Eric Botcazou <ebotcazou@adacore.com> Backport from mainline diff --git a/gcc/cp/init.c b/gcc/cp/init.c index 3d44b03abfe..1a2a1f58819 100644 --- a/gcc/cp/init.c +++ b/gcc/cp/init.c @@ -2278,8 +2278,11 @@ constant_value_1 (tree decl, bool strict_p, bool return_aggregate_cst_ok_p) || TREE_CODE (init) == STRING_CST))) break; /* Don't return a CONSTRUCTOR for a variable with partial run-time - initialization, since it doesn't represent the entire value. */ - if (TREE_CODE (init) == CONSTRUCTOR + initialization, since it doesn't represent the entire value. + Similarly for VECTOR_CSTs created by cp_folding those + CONSTRUCTORs. */ + if ((TREE_CODE (init) == CONSTRUCTOR + || TREE_CODE (init) == VECTOR_CST) && !DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P (decl)) break; /* If the variable has a dynamic initializer, don't use its diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 1b828d22b9c..f3622f9f193 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-06-11 Jakub Jelinek <jakub@redhat.com> + + PR c++/90810 + * g++.dg/ext/vector37.C: New test. + 2019-06-10 Paul Thomas <pault@gcc.gnu.org> Backport from trunk diff --git a/gcc/testsuite/g++.dg/ext/vector37.C b/gcc/testsuite/g++.dg/ext/vector37.C new file mode 100644 index 00000000000..a7baf8d33f9 --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/vector37.C @@ -0,0 +1,29 @@ +// PR c++/90810 +// { dg-do run } + +void +foo (float x, float y) +{ + typedef float __attribute__ ((__vector_size__ (4 * sizeof (float)), __may_alias__)) V; + const V a = { x, x, x, x }, b = { y, y, y, y }; + const V c = a / b; + if (c[0] != 6.0f || c[1] != 6.0f || c[2] != 6.0f || c[3] != 6.0f) + __builtin_abort (); +} + +void +bar (float y) +{ + typedef float __attribute__ ((__vector_size__ (4 * sizeof (float)), __may_alias__)) V; + const V a = { 7.0f, 8.0f, 9.0f, 10.0f }, b = { 1.0f, 2.0f, 3.0f, y }; + const V c = a / b; + if (c[0] != 7.0f || c[1] != 4.0f || c[2] != 3.0f || c[3] != 5.0f) + __builtin_abort (); +} + +int +main () +{ + foo (12.0f, 2.0f); + bar (2.0f); +} -- cgit v1.2.3 From 19fa9830375d2fb0db9fe241b20054e10d128741 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek <jakub@redhat.com> Date: Tue, 11 Jun 2019 16:44:41 +0000 Subject: PR target/90811 * config/nvptx/nvptx.c (nvptx_output_softstack_switch): Use and.b%d instead of and.u%d. * testsuite/libgomp.c/pr90811.c: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@272163 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 6 ++++++ gcc/config/nvptx/nvptx.c | 2 +- libgomp/ChangeLog | 5 +++++ libgomp/testsuite/libgomp.c/pr90811.c | 29 +++++++++++++++++++++++++++++ 4 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 libgomp/testsuite/libgomp.c/pr90811.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4fef94cbaf4..8c7ec6e5e8f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2019-06-11 Jakub Jelinek <jakub@redhat.com> + + PR target/90811 + * config/nvptx/nvptx.c (nvptx_output_softstack_switch): Use and.b%d + instead of and.u%d. + 2019-06-07 John David Anglin <danglin@gcc.gnu.orig> PR target/90751 diff --git a/gcc/config/nvptx/nvptx.c b/gcc/config/nvptx/nvptx.c index ca3fea3002d..07ff1df4bb8 100644 --- a/gcc/config/nvptx/nvptx.c +++ b/gcc/config/nvptx/nvptx.c @@ -1377,7 +1377,7 @@ nvptx_output_softstack_switch (FILE *file, bool entering, fputs (";\n", file); if (!CONST_INT_P (size) || UINTVAL (align) > GET_MODE_SIZE (DImode)) fprintf (file, - "\t\tand.u%d %%r%d, %%r%d, -" HOST_WIDE_INT_PRINT_DEC ";\n", + "\t\tand.b%d %%r%d, %%r%d, -" HOST_WIDE_INT_PRINT_DEC ";\n", bits, regno, regno, UINTVAL (align)); } if (cfun->machine->has_softstack) diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog index ed401650a5f..5e4c94f87a9 100644 --- a/libgomp/ChangeLog +++ b/libgomp/ChangeLog @@ -1,3 +1,8 @@ +2019-06-11 Jakub Jelinek <jakub@redhat.com> + + PR target/90811 + * testsuite/libgomp.c/pr90811.c: New test. + 2019-02-22 Release Manager * GCC 8.3.0 released. diff --git a/libgomp/testsuite/libgomp.c/pr90811.c b/libgomp/testsuite/libgomp.c/pr90811.c new file mode 100644 index 00000000000..25b7d78c0ea --- /dev/null +++ b/libgomp/testsuite/libgomp.c/pr90811.c @@ -0,0 +1,29 @@ +/* PR target/90811 */ + +int +main () +{ + long long a[100], b[100]; + int i; + for (i = 0; i < 100; i++) + { + a[i] = i; + b[i] = i % 10; + } + #pragma omp target teams distribute parallel for simd map(tofrom: a[:100], b[:100]) + for (i = 0; i < 100; i++) + { + long long c = 0; + const long long d[] = { 1, 3, 5, 7, 9 }; + for (int j = 4; j >= 0; j--) + c = d[j] + b[i] * c; + a[i] += c; + } + for (i = 0; i < 100; i++) + { + const long long r[] = { 1, 26, 229, 976, 2849, 6646, 13381, 24284, 40801, 64594 }; + if (a[i] != r[i % 10] + (i / 10 * 10)) + __builtin_abort (); + } + return 0; +} -- cgit v1.2.3 From ee4aba0e7db0eaec1785208be6a170c9fdd29c00 Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Wed, 12 Jun 2019 00:16:08 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@272175 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 66b9d76b2f5..57b639034b6 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190611 +20190612 -- cgit v1.2.3 From f1985a2c6d7ea199519ad290b92e014f50a41d7c Mon Sep 17 00:00:00 2001 From: Thomas Koenig <tkoenig@gcc.gnu.org> Date: Wed, 12 Jun 2019 19:54:34 +0000 Subject: =?UTF-8?q?2019-06-12=20=20Thomas=20Koenig=20=20<tkoenig@gcc.gnu.o?= =?UTF-8?q?rg>=20=20=20=20=20Tom=C3=A1=C5=A1=20Trnka=20=20<trnka@scm.com>?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Backport from trunk PR fortran/90744 * trans-types.c (get_formal_from_actual_arglist): Unset typespec flags which make no sense for procedures without explicit interface. 2019-06-12 Thomas Koenig <tkoenig@gcc.gnu.org> Tomáš Trnka <trnka@scm.com> Backport from trunk PR fortran/90744 * gfortran.dg/deferred_character_33.f90: New test. * gfortran.dg/deferred_character_33a.f90: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@272213 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fortran/ChangeLog | 9 ++++++ gcc/fortran/trans-types.c | 3 ++ gcc/testsuite/ChangeLog | 8 +++++ .../gfortran.dg/deferred_character_33.f90 | 35 ++++++++++++++++++++++ .../gfortran.dg/deferred_character_33a.f90 | 9 ++++++ 5 files changed, 64 insertions(+) create mode 100644 gcc/testsuite/gfortran.dg/deferred_character_33.f90 create mode 100644 gcc/testsuite/gfortran.dg/deferred_character_33a.f90 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 5cd180dcd7d..af9306dac57 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,12 @@ +2019-06-12 Thomas Koenig <tkoenig@gcc.gnu.org> + Tomáš Trnka <trnka@scm.com> + + Backport from trunk + PR fortran/90744 + * trans-types.c (get_formal_from_actual_arglist): Unset typespec + flags which make no sense for procedures without explicit + interface. + 2019-06-10 Paul Thomas <pault@gcc.gnu.org> Backport from trunk diff --git a/gcc/fortran/trans-types.c b/gcc/fortran/trans-types.c index b4daf4b61b1..1125ae46f54 100644 --- a/gcc/fortran/trans-types.c +++ b/gcc/fortran/trans-types.c @@ -3026,6 +3026,9 @@ get_formal_from_actual_arglist (gfc_symbol *sym, gfc_actual_arglist *actual_args else { s->ts = a->expr->ts; + s->ts.deferred = 0; + s->ts.is_iso_c = 0; + s->ts.is_c_interop = 0; s->attr.flavor = FL_VARIABLE; if (a->expr->rank > 0) { diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index f3622f9f193..b265c87e886 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2019-06-12 Thomas Koenig <tkoenig@gcc.gnu.org> + Tomáš Trnka <trnka@scm.com> + + Backport from trunk + PR fortran/90744 + * gfortran.dg/deferred_character_33.f90: New test. + * gfortran.dg/deferred_character_33a.f90: New test. + 2019-06-11 Jakub Jelinek <jakub@redhat.com> PR c++/90810 diff --git a/gcc/testsuite/gfortran.dg/deferred_character_33.f90 b/gcc/testsuite/gfortran.dg/deferred_character_33.f90 new file mode 100644 index 00000000000..ec864d83c31 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/deferred_character_33.f90 @@ -0,0 +1,35 @@ +! { dg-do run } +! { dg-additional-sources deferred_character_33a.f90 } +! PR fortran/90744 - this used to pass a wrong length +! to an external function without a prototype. +! Original test case by Tomáš Trnka. +module StringModule + implicit none + +contains + function getstr() + character(:), allocatable :: getstr + + getstr = 'OK' + end function +end module +module TestModule + use StringModule + implicit none + +contains + subroutine DoTest() + if (.false.) then + call convrs('A',getstr()) + else + call convrs('B',getstr()) + end if + end subroutine +end module +program external_char_length + use TestModule + + implicit none + + call DoTest() +end program diff --git a/gcc/testsuite/gfortran.dg/deferred_character_33a.f90 b/gcc/testsuite/gfortran.dg/deferred_character_33a.f90 new file mode 100644 index 00000000000..db117cc0b38 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/deferred_character_33a.f90 @@ -0,0 +1,9 @@ +! { dg-do compile } +subroutine convrs(quanty,fromto) + implicit none + + character(*), intent(in) :: quanty,fromto + + if (len(fromto) /= 2) stop 1 + if (fromto /= 'OK') stop 2 +end subroutine -- cgit v1.2.3 From 80d7c0990b43e0c6f606e0d893d828b5044244de Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Thu, 13 Jun 2019 00:16:08 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@272226 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 57b639034b6..cf29403db86 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190612 +20190613 -- cgit v1.2.3 From 7d801298b98f55c44e7ae3951edd5a952a98f8e0 Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Fri, 14 Jun 2019 00:16:09 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@272278 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index cf29403db86..a767c27aa64 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190613 +20190614 -- cgit v1.2.3 From 89d81a1e83bb21bdfcb7a1ff52b6b04826d24e52 Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Sat, 15 Jun 2019 00:16:09 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@272316 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index a767c27aa64..c48233902d7 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190614 +20190615 -- cgit v1.2.3 From 50466b9e8e7b91bdb0e7bcc02333e1aa3cc18257 Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Sun, 16 Jun 2019 00:16:08 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@272335 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index c48233902d7..2b028733aa5 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190615 +20190616 -- cgit v1.2.3 From 5967116857e8cbcd2656ea253a3d459ad7a70cfc Mon Sep 17 00:00:00 2001 From: John David Anglin <danglin@gcc.gnu.org> Date: Sun, 16 Jun 2019 21:46:47 +0000 Subject: PR middle-end/64242 * config/pa/pa.md (nonlocal_goto): Restore frame pointer last. Add frame clobbers and schedule block. (builtin_longjmp): Likewise. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@272363 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 7 +++++++ gcc/config/pa/pa.md | 48 +++++++++++++++++++++++++++--------------------- 2 files changed, 34 insertions(+), 21 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 8c7ec6e5e8f..d18ffe6b6dc 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2019-06-16 John David Anglin <danglin@gcc.gnu.org> + + PR middle-end/64242 + * config/pa/pa.md (nonlocal_goto): Restore frame pointer last. Add + frame clobbers and schedule block. + (builtin_longjmp): Likewise. + 2019-06-11 Jakub Jelinek <jakub@redhat.com> PR target/90811 diff --git a/gcc/config/pa/pa.md b/gcc/config/pa/pa.md index 4b78c4455a5..b39eb35d97c 100644 --- a/gcc/config/pa/pa.md +++ b/gcc/config/pa/pa.md @@ -6904,21 +6904,24 @@ rtx stack = operands[2]; rtx fp = operands[3]; - lab = copy_to_reg (lab); - emit_clobber (gen_rtx_MEM (BLKmode, gen_rtx_SCRATCH (VOIDmode))); emit_clobber (gen_rtx_MEM (BLKmode, hard_frame_pointer_rtx)); - /* Restore the frame pointer. The virtual_stack_vars_rtx is saved - instead of the hard_frame_pointer_rtx in the save area. As a - result, an extra instruction is needed to adjust for the offset - of the virtual stack variables and the hard frame pointer. */ - if (GET_CODE (fp) != REG) - fp = force_reg (Pmode, fp); - emit_move_insn (hard_frame_pointer_rtx, plus_constant (Pmode, fp, -8)); + lab = copy_to_reg (lab); + /* Restore the stack and frame pointers. The virtual_stack_vars_rtx + is saved instead of the hard_frame_pointer_rtx in the save area. + As a result, an extra instruction is needed to adjust for the offset + of the virtual stack variables and the hard frame pointer. */ + fp = copy_to_reg (fp); emit_stack_restore (SAVE_NONLOCAL, stack); + /* Ensure the frame pointer move is not optimized. */ + emit_insn (gen_blockage ()); + emit_clobber (hard_frame_pointer_rtx); + emit_clobber (frame_pointer_rtx); + emit_move_insn (hard_frame_pointer_rtx, plus_constant (Pmode, fp, -8)); + emit_use (hard_frame_pointer_rtx); emit_use (stack_pointer_rtx); @@ -8695,23 +8698,26 @@ add,l %2,%3,%3\;bv,n %%r0(%3)" emit_clobber (gen_rtx_MEM (BLKmode, gen_rtx_SCRATCH (VOIDmode))); emit_clobber (gen_rtx_MEM (BLKmode, hard_frame_pointer_rtx)); - /* Restore the frame pointer. The virtual_stack_vars_rtx is saved - instead of the hard_frame_pointer_rtx in the save area. We need - to adjust for the offset between these two values. */ - if (GET_CODE (fp) != REG) - fp = force_reg (Pmode, fp); - emit_move_insn (hard_frame_pointer_rtx, plus_constant (Pmode, fp, -8)); - - /* This bit is the same as expand_builtin_longjmp. */ - emit_stack_restore (SAVE_NONLOCAL, stack); - emit_use (hard_frame_pointer_rtx); - emit_use (stack_pointer_rtx); - /* Load the label we are jumping through into r1 so that we know where to look for it when we get back to setjmp's function for restoring the gp. */ emit_move_insn (pv, lab); + /* Restore the stack and frame pointers. The virtual_stack_vars_rtx + is saved instead of the hard_frame_pointer_rtx in the save area. + We need to adjust for the offset between these two values. */ + fp = copy_to_reg (fp); + emit_stack_restore (SAVE_NONLOCAL, stack); + + /* Ensure the frame pointer move is not optimized. */ + emit_insn (gen_blockage ()); + emit_clobber (hard_frame_pointer_rtx); + emit_clobber (frame_pointer_rtx); + emit_move_insn (hard_frame_pointer_rtx, plus_constant (Pmode, fp, -8)); + + emit_use (hard_frame_pointer_rtx); + emit_use (stack_pointer_rtx); + /* Prevent the insns above from being scheduled into the delay slot of the interspace jump because the space register could change. */ emit_insn (gen_blockage ()); -- cgit v1.2.3 From fb4156dbc66132e1539995f41ef258fa79bb859c Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Mon, 17 Jun 2019 00:16:16 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@272368 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 2b028733aa5..17c628b73f4 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190616 +20190617 -- cgit v1.2.3 From bb16d127a0aa13905195026f59d734f7432c65ae Mon Sep 17 00:00:00 2001 From: Arnaud Charlet <charlet@adacore.com> Date: Mon, 17 Jun 2019 07:34:04 +0000 Subject: PR ada/80590 * exp_ch9.adb (Expand_N_Delay_Relative_Statement): Swap the two conditions to avoid a unnecessary exception propagation in the default case. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@272373 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ada/ChangeLog | 8 ++++++++ gcc/ada/exp_ch9.adb | 15 +++++++-------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 81136dcb251..312b46bb07f 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,11 @@ +2019-06-17 Arnaud Charlet <charlet@adacore.com> + +PR ada/80590 + + * exp_ch9.adb (Expand_N_Delay_Relative_Statement): Swap the two + conditions to avoid a unnecessary exception propagation in the default + case. + 2019-05-28 Eric Botcazou <ebotcazou@adacore.com> * gcc-interface/trans.c (walk_nesting_tree): New static function. diff --git a/gcc/ada/exp_ch9.adb b/gcc/ada/exp_ch9.adb index a3234fbb94a..627a9d5e86a 100644 --- a/gcc/ada/exp_ch9.adb +++ b/gcc/ada/exp_ch9.adb @@ -8144,18 +8144,17 @@ package body Exp_Ch9 is Proc : Entity_Id; begin - -- Try to use System.Relative_Delays.Delay_For only if available. This - -- is the implementation used on restricted platforms when Ada.Calendar - -- is not available. + -- Try to use Ada.Calendar.Delays.Delay_For if available. - if RTE_Available (RO_RD_Delay_For) then - Proc := RTE (RO_RD_Delay_For); + if RTE_Available (RO_CA_Delay_For) then + Proc := RTE (RO_CA_Delay_For); - -- Otherwise, use Ada.Calendar.Delays.Delay_For and emit an error - -- message if not available. + -- Otherwise, use System.Relative_Delays.Delay_For and emit an error + -- message if not available. This is the implementation used on + -- restricted platforms when Ada.Calendar is not available. else - Proc := RTE (RO_CA_Delay_For); + Proc := RTE (RO_RD_Delay_For); end if; Rewrite (N, -- cgit v1.2.3 From 7eb0f70490aa810669273197041ab5beff81fd35 Mon Sep 17 00:00:00 2001 From: Jeff Law <law@redhat.com> Date: Mon, 17 Jun 2019 17:29:22 +0000 Subject: * config/mips/mips.c (mips_expand_builtin_insn): Swap the 1st and 3rd operands of the fmadd/fmsub/maddv builtin. * gcc.target/mips/msa-fmadd.c: New. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@272393 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 8 +++ gcc/config/mips/mips.c | 13 ++++ gcc/testsuite/ChangeLog | 6 ++ gcc/testsuite/gcc.target/mips/msa-fmadd.c | 101 ++++++++++++++++++++++++++++++ 4 files changed, 128 insertions(+) create mode 100644 gcc/testsuite/gcc.target/mips/msa-fmadd.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d18ffe6b6dc..98b617f02f2 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2019-06-16 Jeff Law <law@redhat.com> + + Backport from mainline + 2019-06-16 Prachi Godbole <prachi.godbole@imgtec.com> + Robert Suchanek <robert.suchanek@mips.com> + * config/mips/mips.c (mips_expand_builtin_insn): Swap the 1st + and 3rd operands of the fmadd/fmsub/maddv builtin. + 2019-06-16 John David Anglin <danglin@gcc.gnu.org> PR middle-end/64242 diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c index 3981bcf2ea3..e7d65ad7af0 100644 --- a/gcc/config/mips/mips.c +++ b/gcc/config/mips/mips.c @@ -16788,6 +16788,19 @@ mips_expand_builtin_insn (enum insn_code icode, unsigned int nops, std::swap (ops[1], ops[2]); break; + case CODE_FOR_msa_maddv_b: + case CODE_FOR_msa_maddv_h: + case CODE_FOR_msa_maddv_w: + case CODE_FOR_msa_maddv_d: + case CODE_FOR_msa_fmadd_w: + case CODE_FOR_msa_fmadd_d: + case CODE_FOR_msa_fmsub_w: + case CODE_FOR_msa_fmsub_d: + /* fma(a, b, c) results into (a * b + c), however builtin_msa_fmadd expects + it to be (a + b * c). Swap the 1st and 3rd operands. */ + std::swap (ops[1], ops[3]); + break; + case CODE_FOR_msa_slli_b: case CODE_FOR_msa_slli_h: case CODE_FOR_msa_slli_w: diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b265c87e886..025d14a1790 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2019-06-16 Jeff Law <law@redhat.com> + + Backported from mainline + 2019-05-31 Dragan Mladjenovic <dmladjenovic@wavecomp.com> + * gcc.target/mips/msa-fmadd.c: New. + 2019-06-12 Thomas Koenig <tkoenig@gcc.gnu.org> Tomáš Trnka <trnka@scm.com> diff --git a/gcc/testsuite/gcc.target/mips/msa-fmadd.c b/gcc/testsuite/gcc.target/mips/msa-fmadd.c new file mode 100644 index 00000000000..9265c04ff9c --- /dev/null +++ b/gcc/testsuite/gcc.target/mips/msa-fmadd.c @@ -0,0 +1,101 @@ +/* { dg-do compile } */ +/* { dg-options "-mfp64 -mhard-float -mmsa -EL -flax-vector-conversions" } */ +/* { dg-skip-if "uses global registers" { *-*-* } { "-O0" } { "" } } */ + +typedef int v4i32 __attribute__ ((vector_size(16))); +typedef float v4f32 __attribute__ ((vector_size(16))); +typedef double v2f64 __attribute__ ((vector_size(16))); + +/* Test that MSA FMADD-like intrinsics do not use first operand for multiplication. */ + +register v4i32 a __asm__("$f20"); +register v4i32 b __asm__("$f22"); +register v4f32 c __asm__("$f24"); +register v4f32 d __asm__("$f26"); +register v2f64 e __asm__("$f28"); +register v2f64 f __asm__("$f30"); + +void +maddv_b_msa (void) +{ + a = __builtin_msa_maddv_b (a, b, b); +} +/* { dg-final { scan-assembler "maddv\\\.b\t\\\$w20,\\\$w22,\\\$w22" } } */ + +void +maddv_h_msa (void) +{ + a = __builtin_msa_maddv_h (a, b, b); +} +/* { dg-final { scan-assembler "maddv\\\.h\t\\\$w20,\\\$w22,\\\$w22" } } */ + +void +maddv_w_msa (void) +{ + a = __builtin_msa_maddv_w (a, b, b); +} +/* { dg-final { scan-assembler "maddv\\\.w\t\\\$w20,\\\$w22,\\\$w22" } } */ + +void +maddv_d_msa (void) +{ + a = __builtin_msa_maddv_d (a, b, b); +} +/* { dg-final { scan-assembler "maddv\\\.d\t\\\$w20,\\\$w22,\\\$w22" } } */ + +void +msubv_b_msa (void) +{ + a = __builtin_msa_msubv_b (a, b, b); +} +/* { dg-final { scan-assembler "msubv\\\.b\t\\\$w20,\\\$w22,\\\$w22" } } */ + +void +msubv_h_msa (void) +{ + a = __builtin_msa_msubv_h (a, b, b); +} +/* { dg-final { scan-assembler "msubv\\\.h\t\\\$w20,\\\$w22,\\\$w22" } } */ + +void +msubv_w_msa (void) +{ + a = __builtin_msa_msubv_w (a, b, b); +} +/* { dg-final { scan-assembler "msubv\\\.w\t\\\$w20,\\\$w22,\\\$w22" } } */ + +void +msubv_d_msa (void) +{ + a = __builtin_msa_msubv_d (a, b, b); +} +/* { dg-final { scan-assembler "msubv\\\.d\t\\\$w20,\\\$w22,\\\$w22" } } */ + +void +fmadd_w_msa (void) +{ + c = __builtin_msa_fmadd_w (c, d, d); +} +/* { dg-final { scan-assembler "fmadd\\\.w\t\\\$w24,\\\$w26,\\\$w26" } } */ + +void +fmadd_d_msa (void) +{ + e = __builtin_msa_fmadd_d (e, f, f); +} +/* { dg-final { scan-assembler "fmadd\\\.d\t\\\$w28,\\\$w30,\\\$w30" } } */ + +void +fmsub_w_msa (void) +{ + c = __builtin_msa_fmsub_w (c, d, d); +} +/* { dg-final { scan-assembler "fmsub\\\.w\t\\\$w24,\\\$w26,\\\$w26" } } */ + +void +fmsub_d_msa (void) +{ + e = __builtin_msa_fmsub_d (e, f, f); +} +/* { dg-final { scan-assembler "fmsub\\\.d\t\\\$w28,\\\$w30,\\\$w30" } } */ + -- cgit v1.2.3 From 6e442b0a8ef9bc20ef463dfa2a3ced7a46a12fb7 Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Tue, 18 Jun 2019 00:16:08 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@272402 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 17c628b73f4..a0f76a07726 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190617 +20190618 -- cgit v1.2.3 From 077cf1aa8d97792b121aa0feeb000741059125d8 Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Wed, 19 Jun 2019 00:16:31 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@272462 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index a0f76a07726..12dd2e7e8db 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190618 +20190619 -- cgit v1.2.3 From 539e38fbb498b0ef97504af2efd7872a9a709329 Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Thu, 20 Jun 2019 00:16:07 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@272493 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 12dd2e7e8db..33a8458fc7d 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190619 +20190620 -- cgit v1.2.3 From eb39cc062e0c089218480ccb86e0c04ad76f0ba8 Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Fri, 21 Jun 2019 00:16:13 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@272536 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 33a8458fc7d..8bc7d7fe877 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190620 +20190621 -- cgit v1.2.3 From f8a6daa559f081fc51a3cc70a0bc97999933491a Mon Sep 17 00:00:00 2001 From: Thomas Koenig <tkoenig@gcc.gnu.org> Date: Fri, 21 Jun 2019 19:30:51 +0000 Subject: 2019-06-21 Thomas Koenig <tkoenig@gcc.gnu.org> Backport from trunk PR fortran/90937 * trans-types.c (get_formal_from_actual_arglist): Get symbol from current namespace so it will be freed later. If symbol is of type character, get an empty character length. 2019-06-21 Thomas Koenig <tkoenig@gcc.gnu.org> Backport from trunk PR fortran/90937 * gfortran.dg/external_procedure_4.f90: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@272565 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fortran/ChangeLog | 8 ++++++++ gcc/fortran/trans-types.c | 6 +++++- gcc/testsuite/ChangeLog | 6 ++++++ gcc/testsuite/gfortran.dg/external_procedure_4.f90 | 19 +++++++++++++++++++ 4 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gfortran.dg/external_procedure_4.f90 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index af9306dac57..5feccf19d3e 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,11 @@ +2019-06-21 Thomas Koenig <tkoenig@gcc.gnu.org> + + Backport from trunk + PR fortran/90937 + * trans-types.c (get_formal_from_actual_arglist): Get symbol from + current namespace so it will be freed later. If symbol is of type + character, get an empty character length. + 2019-06-12 Thomas Koenig <tkoenig@gcc.gnu.org> Tomáš Trnka <trnka@scm.com> diff --git a/gcc/fortran/trans-types.c b/gcc/fortran/trans-types.c index 1125ae46f54..502a383c393 100644 --- a/gcc/fortran/trans-types.c +++ b/gcc/fortran/trans-types.c @@ -3018,7 +3018,7 @@ get_formal_from_actual_arglist (gfc_symbol *sym, gfc_actual_arglist *actual_args if (a->expr) { snprintf (name, GFC_MAX_SYMBOL_LEN, "_formal_%d", var_num ++); - gfc_get_symbol (name, NULL, &s); + gfc_get_symbol (name, gfc_current_ns, &s); if (a->expr->ts.type == BT_PROCEDURE) { s->attr.flavor = FL_PROCEDURE; @@ -3026,6 +3026,10 @@ get_formal_from_actual_arglist (gfc_symbol *sym, gfc_actual_arglist *actual_args else { s->ts = a->expr->ts; + + if (s->ts.type == BT_CHARACTER) + s->ts.u.cl = gfc_get_charlen (); + s->ts.deferred = 0; s->ts.is_iso_c = 0; s->ts.is_c_interop = 0; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 025d14a1790..de4a8962224 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2019-06-21 Thomas Koenig <tkoenig@gcc.gnu.org> + + Backport from trunk + PR fortran/90937 + * gfortran.dg/external_procedure_4.f90: New test. + 2019-06-16 Jeff Law <law@redhat.com> Backported from mainline diff --git a/gcc/testsuite/gfortran.dg/external_procedure_4.f90 b/gcc/testsuite/gfortran.dg/external_procedure_4.f90 new file mode 100644 index 00000000000..403f1732e26 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/external_procedure_4.f90 @@ -0,0 +1,19 @@ +! { dg-do compile } +! PR fortran/90937 - this used to cause an ICE. +! Original test case by Toon Moene. +subroutine lfidiff + + implicit none + + contains + + subroutine grlfi(cdnom) + + character(len=*) cdnom(:) + character(len=len(cdnom)) clnoma + + call lficas(clnoma) + + end subroutine grlfi + +end subroutine lfidiff -- cgit v1.2.3 From 00eaf9ab8046c3be5c8afe0fa2fda550590cd50a Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Sat, 22 Jun 2019 00:16:10 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@272581 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 8bc7d7fe877..fa26eaf9f8a 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190621 +20190622 -- cgit v1.2.3 From 333c7c7f4d66e13c90482a7cf4c70952ff7b307b Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Sun, 23 Jun 2019 00:16:08 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@272597 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index fa26eaf9f8a..9c7f7453d6c 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190622 +20190623 -- cgit v1.2.3 From 2946a21197d84011ccaf4aa1a953afaede7930e7 Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Mon, 24 Jun 2019 00:16:09 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@272611 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 9c7f7453d6c..46c804b39c8 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190623 +20190624 -- cgit v1.2.3 From bb242f24f7272c4ad6442cd8b0a88bb15dc16a2d Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Tue, 25 Jun 2019 00:16:09 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@272630 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 46c804b39c8..9c4b1c67235 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190624 +20190625 -- cgit v1.2.3 From a846d4b6d3b6ddacee08af34348664e3520a2b18 Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Wed, 26 Jun 2019 00:16:14 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@272663 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 9c4b1c67235..220d10293ef 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190625 +20190626 -- cgit v1.2.3 From 69541f24090efd964968e32c9c9a265cd3c2a1c3 Mon Sep 17 00:00:00 2001 From: Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> Date: Wed, 26 Jun 2019 09:21:02 +0000 Subject: Remove support for alternative Solaris 11.4 ld -V output Backport from mainline 2019-06-17 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> * configure.ac (ld_vers) <*-*-solaris2*>: Remove support for alternative Solaris 11.4 format. * configure: Regenerate. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@272677 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 9 +++++++++ gcc/configure | 8 ++------ gcc/configure.ac | 8 ++------ 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 98b617f02f2..432e343abdb 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2019-06-26 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> + + Backport from mainline + 2019-06-17 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> + + * configure.ac (ld_vers) <*-*-solaris2*>: Remove support for + alternative Solaris 11.4 format. + * configure: Regenerate. + 2019-06-16 Jeff Law <law@redhat.com> Backport from mainline diff --git a/gcc/configure b/gcc/configure index 6121e163259..6d2f088c266 100755 --- a/gcc/configure +++ b/gcc/configure @@ -22799,17 +22799,13 @@ if test $in_tree_ld != yes ; then # # ld: Software Generation Utilities - Solaris Link Editors: 5.11-1.1701:onnv-ab196087-6931056-03/25/10 # - # In Solaris 11.4, this was changed to - # - # ld: Solaris ELF Utilities: 11.4-1.3123 - # # ld and ld.so.1 are guaranteed to be updated in lockstep, so ld version # numbers can be used in ld.so.1 feature checks even if a different # linker is configured. ld_ver=`$gcc_cv_ld -V 2>&1` - if echo "$ld_ver" | $EGREP 'Solaris Link Editors|Solaris ELF Utilities' > /dev/null; then + if echo "$ld_ver" | grep 'Solaris Link Editors' > /dev/null; then ld_vers=`echo $ld_ver | sed -n \ - -e 's,^.*: \(5\|1[0-9]\)\.[0-9][0-9]*-\([0-9]\.[0-9][0-9]*\).*$,\2,p'` + -e 's,^.*: 5\.[0-9][0-9]*-\([0-9]\.[0-9][0-9]*\).*$,\1,p'` ld_vers_major=`expr "$ld_vers" : '\([0-9]*\)'` ld_vers_minor=`expr "$ld_vers" : '[0-9]*\.\([0-9]*\)'` fi diff --git a/gcc/configure.ac b/gcc/configure.ac index b066cc609e1..2d5e9aca63a 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -2595,17 +2595,13 @@ if test $in_tree_ld != yes ; then # # ld: Software Generation Utilities - Solaris Link Editors: 5.11-1.1701:onnv-ab196087-6931056-03/25/10 # - # In Solaris 11.4, this was changed to - # - # ld: Solaris ELF Utilities: 11.4-1.3123 - # # ld and ld.so.1 are guaranteed to be updated in lockstep, so ld version # numbers can be used in ld.so.1 feature checks even if a different # linker is configured. ld_ver=`$gcc_cv_ld -V 2>&1` - if echo "$ld_ver" | $EGREP 'Solaris Link Editors|Solaris ELF Utilities' > /dev/null; then + if echo "$ld_ver" | grep 'Solaris Link Editors' > /dev/null; then ld_vers=`echo $ld_ver | sed -n \ - -e 's,^.*: \(5\|1[0-9]\)\.[0-9][0-9]*-\([0-9]\.[0-9][0-9]*\).*$,\2,p'` + -e 's,^.*: 5\.[0-9][0-9]*-\([0-9]\.[0-9][0-9]*\).*$,\1,p'` ld_vers_major=`expr "$ld_vers" : '\([0-9]*\)'` ld_vers_minor=`expr "$ld_vers" : '[0-9]*\.\([0-9]*\)'` fi -- cgit v1.2.3 From 703cc7283ee085bbe1e7635b9fd33b3599a4f982 Mon Sep 17 00:00:00 2001 From: Martin Jambor <mjambor@suse.cz> Date: Wed, 26 Jun 2019 16:30:23 +0000 Subject: [PR 90939] Remove outdated assert in ipcp_bits_lattice::meet_with 2019-06-26 Martin Jambor <mjambor@suse.cz> PR ipa/90939 * ipa-cp.c (ipcp_bits_lattice::meet_with): Remove assert. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@272700 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 8 ++++++++ gcc/ipa-cp.c | 1 - 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 432e343abdb..b23f3dfdcc3 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2019-06-26 Martin Jambor <mjambor@suse.cz> + + Backport from mainline + 2019-06-25 Martin Jambor <mjambor@suse.cz> + + PR ipa/90939 + * ipa-cp.c (ipcp_bits_lattice::meet_with): Remove assert. + 2019-06-26 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> Backport from mainline diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c index 84d49074bc8..c96ba106283 100644 --- a/gcc/ipa-cp.c +++ b/gcc/ipa-cp.c @@ -1082,7 +1082,6 @@ ipcp_bits_lattice::meet_with (ipcp_bits_lattice& other, unsigned precision, if (TREE_CODE_CLASS (code) == tcc_binary) { tree type = TREE_TYPE (operand); - gcc_assert (INTEGRAL_TYPE_P (type)); widest_int o_value, o_mask; get_value_and_mask (operand, &o_value, &o_mask); -- cgit v1.2.3 From ebe9d7a0ed3f5df1dec634f4cf7bb94741a7c796 Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Thu, 27 Jun 2019 00:16:15 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@272721 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 220d10293ef..edadf54571c 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190626 +20190627 -- cgit v1.2.3 From 6c2277a141cd1906b5a07adef2ce2973343b72e3 Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Fri, 28 Jun 2019 00:16:08 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@272772 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index edadf54571c..34a5687af9c 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190627 +20190628 -- cgit v1.2.3 From 68481dce6c60635c5a01f5e7ee81d52a4e13967b Mon Sep 17 00:00:00 2001 From: Jeff Law <law@redhat.com> Date: Fri, 28 Jun 2019 20:58:42 +0000 Subject: PR tree-optimization/90949 * tree-ssa-copy.c (fini_copy_prop): Use reset_flow_sensitive_info. * tree-ssanames.c (reset_flow_sensitive_info): Reset non-null state. * gcc.c-torture/execute/pr90949.c: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@272797 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 9 ++++++ gcc/testsuite/ChangeLog | 8 +++++ gcc/testsuite/gcc.c-torture/execute/pr90949.c | 42 +++++++++++++++++++++++++++ gcc/tree-ssa-copy.c | 11 ++++--- gcc/tree-ssanames.c | 7 ++++- 5 files changed, 70 insertions(+), 7 deletions(-) create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr90949.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b23f3dfdcc3..638756431fc 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2019-06-28 Jeff Law <law@redhat.com> + + Backport from mainline + 2019-06-21 Jeff Law <law@redhat.com> + + PR tree-optimization/90949 + * tree-ssa-copy.c (fini_copy_prop): Use reset_flow_sensitive_info. + * tree-ssanames.c (reset_flow_sensitive_info): Reset non-null state. + 2019-06-26 Martin Jambor <mjambor@suse.cz> Backport from mainline diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index de4a8962224..aed61b5d3fa 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2019-06-21 Jeff Law <law@redhat.com> + + Backport fom mainline + 2019-06-21 Jeff Law <law@redhat.com> + + PR tree-optimization/90949 + * gcc.c-torture/execute/pr90949.c: New test. + 2019-06-21 Thomas Koenig <tkoenig@gcc.gnu.org> Backport from trunk diff --git a/gcc/testsuite/gcc.c-torture/execute/pr90949.c b/gcc/testsuite/gcc.c-torture/execute/pr90949.c new file mode 100644 index 00000000000..8c2ae3972d4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr90949.c @@ -0,0 +1,42 @@ +void __attribute__ ((noipa, noinline)) my_puts (const char *str) { } + +void __attribute__ ((noipa, noinline)) my_free (void *p) { } + + +struct Node +{ + struct Node *child; +}; + +struct Node space[2] = { }; + +struct Node * __attribute__ ((noipa, noinline)) my_malloc (int bytes) +{ + return &space[0]; +} + +void +walk (struct Node *module, int cleanup) +{ + if (module == 0) + { + return; + } + if (!cleanup) + { + my_puts ("No cleanup"); + } + walk (module->child, cleanup); + if (cleanup) + { + my_free (module); + } +} + +int +main () +{ + struct Node *node = my_malloc (sizeof (struct Node)); + node->child = 0; + walk (node, 1); +} diff --git a/gcc/tree-ssa-copy.c b/gcc/tree-ssa-copy.c index b526758701c..f52a33d491c 100644 --- a/gcc/tree-ssa-copy.c +++ b/gcc/tree-ssa-copy.c @@ -545,13 +545,12 @@ fini_copy_prop (void) duplicate_ssa_name_ptr_info (copy_of[i].value, SSA_NAME_PTR_INFO (var)); /* Points-to information is cfg insensitive, - but alignment info might be cfg sensitive, if it - e.g. is derived from VRP derived non-zero bits. - So, do not copy alignment info if the two SSA_NAMEs - aren't defined in the same basic block. */ + but [E]VRP might record context sensitive alignment + info, non-nullness, etc. So reset context sensitive + info if the two SSA_NAMEs aren't defined in the same + basic block. */ if (var_bb != copy_of_bb) - mark_ptr_info_alignment_unknown - (SSA_NAME_PTR_INFO (copy_of[i].value)); + reset_flow_sensitive_info (copy_of[i].value); } else if (!POINTER_TYPE_P (TREE_TYPE (var)) && SSA_NAME_RANGE_INFO (var) diff --git a/gcc/tree-ssanames.c b/gcc/tree-ssanames.c index 6cce43be593..eddd873fcf5 100644 --- a/gcc/tree-ssanames.c +++ b/gcc/tree-ssanames.c @@ -788,7 +788,12 @@ reset_flow_sensitive_info (tree name) { /* points-to info is not flow-sensitive. */ if (SSA_NAME_PTR_INFO (name)) - mark_ptr_info_alignment_unknown (SSA_NAME_PTR_INFO (name)); + { + /* [E]VRP can derive context sensitive alignment info and + non-nullness properties. We must reset both. */ + mark_ptr_info_alignment_unknown (SSA_NAME_PTR_INFO (name)); + SSA_NAME_PTR_INFO (name)->pt.null = 1; + } } else SSA_NAME_RANGE_INFO (name) = NULL; -- cgit v1.2.3 From ac95ac9ebdfb323fc82861da685cef4656d89a65 Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Sat, 29 Jun 2019 00:16:09 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@272806 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 34a5687af9c..8cd7b881eb2 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190628 +20190629 -- cgit v1.2.3 From 653e54a799a6f3d84df67906ae51eb87f9e67cc9 Mon Sep 17 00:00:00 2001 From: Eric Botcazou <ebotcazou@adacore.com> Date: Sat, 29 Jun 2019 07:31:43 +0000 Subject: * gcc-interface/decl.c (set_nonaliased_component_on_array_type): Add missing guard for the presence of TYPE_CANONICAL. (set_reverse_storage_order_on_array_type): Likewise. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@272813 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ada/ChangeLog | 9 +++++++-- gcc/ada/gcc-interface/decl.c | 6 ++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 312b46bb07f..d32afa31bb2 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,7 +1,12 @@ -2019-06-17 Arnaud Charlet <charlet@adacore.com> +2019-06-29 Eric Botcazou <ebotcazou@adacore.com> + + * gcc-interface/decl.c (set_nonaliased_component_on_array_type): Add + missing guard for the presence of TYPE_CANONICAL. + (set_reverse_storage_order_on_array_type): Likewise. -PR ada/80590 +2019-06-17 Arnaud Charlet <charlet@adacore.com> + PR ada/80590 * exp_ch9.adb (Expand_N_Delay_Relative_Statement): Swap the two conditions to avoid a unnecessary exception propagation in the default case. diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c index 224e4918db0..6a425900186 100644 --- a/gcc/ada/gcc-interface/decl.c +++ b/gcc/ada/gcc-interface/decl.c @@ -6065,7 +6065,8 @@ static void set_nonaliased_component_on_array_type (tree type) { TYPE_NONALIASED_COMPONENT (type) = 1; - TYPE_NONALIASED_COMPONENT (TYPE_CANONICAL (type)) = 1; + if (TYPE_CANONICAL (type)) + TYPE_NONALIASED_COMPONENT (TYPE_CANONICAL (type)) = 1; } /* Set TYPE_REVERSE_STORAGE_ORDER on an array type built by means of @@ -6075,7 +6076,8 @@ static void set_reverse_storage_order_on_array_type (tree type) { TYPE_REVERSE_STORAGE_ORDER (type) = 1; - TYPE_REVERSE_STORAGE_ORDER (TYPE_CANONICAL (type)) = 1; + if (TYPE_CANONICAL (type)) + TYPE_REVERSE_STORAGE_ORDER (TYPE_CANONICAL (type)) = 1; } /* Return true if DISCR1 and DISCR2 represent the same discriminant. */ -- cgit v1.2.3 From 268017e9434d80f1579f260159c66bcaacccf738 Mon Sep 17 00:00:00 2001 From: Eric Botcazou <ebotcazou@adacore.com> Date: Sat, 29 Jun 2019 07:38:40 +0000 Subject: * gcc-interface/trans.c (mark_visited_r): Set TYPE_SIZES_GIMPLIFIED on the main variant of a type, if any. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@272817 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ada/ChangeLog | 5 +++++ gcc/ada/gcc-interface/trans.c | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index d32afa31bb2..85badb50ad6 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,8 @@ +2019-06-29 Eric Botcazou <ebotcazou@adacore.com> + + * gcc-interface/trans.c (mark_visited_r): Set TYPE_SIZES_GIMPLIFIED on + the main variant of a type, if any. + 2019-06-29 Eric Botcazou <ebotcazou@adacore.com> * gcc-interface/decl.c (set_nonaliased_component_on_array_type): Add diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c index 6e830bd4b2d..1dc427082f8 100644 --- a/gcc/ada/gcc-interface/trans.c +++ b/gcc/ada/gcc-interface/trans.c @@ -8177,8 +8177,9 @@ mark_visited_r (tree *tp, int *walk_subtrees, void *data ATTRIBUTE_UNUSED) else if (!TYPE_IS_DUMMY_P (t)) TREE_VISITED (t) = 1; + /* The test in gimplify_type_sizes is on the main variant. */ if (TYPE_P (t)) - TYPE_SIZES_GIMPLIFIED (t) = 1; + TYPE_SIZES_GIMPLIFIED (TYPE_MAIN_VARIANT (t)) = 1; return NULL_TREE; } -- cgit v1.2.3 From 10139226e528cbb1f583c90a1557de6833983458 Mon Sep 17 00:00:00 2001 From: Eric Botcazou <ebotcazou@adacore.com> Date: Sat, 29 Jun 2019 09:08:05 +0000 Subject: * gcc-interface/decl.c (gnat_to_gnu_entity): Beep up comment on SAVED, and tweak comment on the assertion about the scopes of Itypes. Do not skip the regular processing for Itypes that are E_Record_Subtype with a Cloned_Subtype. Get the Cloned_Subtype for every E_Record_Subtype if the type is dummy and hasn't got its own freeze node. <E_Record_Subtype>: Save again the DECL of the Cloned_Subtype, if any. <E_Access_Subtype>: Save again the DECL of the equivalent type. (Gigi_Equivalent_Type) <E_Access_Subtype>: New case. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@272824 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ada/ChangeLog | 11 ++++++ gcc/ada/gcc-interface/decl.c | 48 +++++++++++++++++++-------- gcc/testsuite/ChangeLog | 7 ++++ gcc/testsuite/gnat.dg/specs/array5.ads | 9 +++++ gcc/testsuite/gnat.dg/specs/array5_pkg1.ads | 14 ++++++++ gcc/testsuite/gnat.dg/specs/array5_pkg2-g.ads | 13 ++++++++ gcc/testsuite/gnat.dg/specs/array5_pkg2.ads | 5 +++ 7 files changed, 94 insertions(+), 13 deletions(-) create mode 100644 gcc/testsuite/gnat.dg/specs/array5.ads create mode 100644 gcc/testsuite/gnat.dg/specs/array5_pkg1.ads create mode 100644 gcc/testsuite/gnat.dg/specs/array5_pkg2-g.ads create mode 100644 gcc/testsuite/gnat.dg/specs/array5_pkg2.ads diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 85badb50ad6..e77b0a82f84 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,14 @@ +2019-06-29 Eric Botcazou <ebotcazou@adacore.com> + + * gcc-interface/decl.c (gnat_to_gnu_entity): Beep up comment on SAVED, + and tweak comment on the assertion about the scopes of Itypes. Do not + skip the regular processing for Itypes that are E_Record_Subtype with + a Cloned_Subtype. Get the Cloned_Subtype for every E_Record_Subtype + if the type is dummy and hasn't got its own freeze node. + <E_Record_Subtype>: Save again the DECL of the Cloned_Subtype, if any. + <E_Access_Subtype>: Save again the DECL of the equivalent type. + (Gigi_Equivalent_Type) <E_Access_Subtype>: New case. + 2019-06-29 Eric Botcazou <ebotcazou@adacore.com> * gcc-interface/trans.c (mark_visited_r): Set TYPE_SIZES_GIMPLIFIED on diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c index 6a425900186..9f499e0ad59 100644 --- a/gcc/ada/gcc-interface/decl.c +++ b/gcc/ada/gcc-interface/decl.c @@ -295,7 +295,10 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition) tree gnu_size = NULL_TREE; /* Contains the GCC name to be used for the GCC node. */ tree gnu_entity_name; - /* True if we have already saved gnu_decl as a GNAT association. */ + /* True if we have already saved gnu_decl as a GNAT association. This can + also be used to purposely avoid making such an association but this use + case ought not to be applied to types because it can break the deferral + mechanism implemented for access types. */ bool saved = false; /* True if we incremented defer_incomplete_level. */ bool this_deferred = false; @@ -312,14 +315,11 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition) /* Since a use of an Itype is a definition, process it as such if it is in the main unit, except for E_Access_Subtype because it's actually a use - of its base type, and for E_Record_Subtype with cloned subtype because - it's actually a use of the cloned subtype, see below. */ + of its base type, see below. */ if (!definition && is_type && Is_Itype (gnat_entity) - && !(kind == E_Access_Subtype - || (kind == E_Record_Subtype - && Present (Cloned_Subtype (gnat_entity)))) + && Ekind (gnat_entity) != E_Access_Subtype && !present_gnu_tree (gnat_entity) && In_Extended_Main_Code_Unit (gnat_entity)) { @@ -362,7 +362,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition) } /* This abort means the Itype has an incorrect scope, i.e. that its - scope does not correspond to the subprogram it is declared in. */ + scope does not correspond to the subprogram it is first used in. */ gcc_unreachable (); } @@ -371,7 +371,9 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition) In that case, we will abort below when we try to save a new GCC tree for this object. We also need to handle the case of getting a dummy type when a Full_View exists but be careful so as not to trigger its - premature elaboration. */ + premature elaboration. Likewise for a cloned subtype without its own + freeze node, which typically happens when a generic gets instantiated + on an incomplete or private type. */ if ((!definition || (is_type && imported_p)) && present_gnu_tree (gnat_entity)) { @@ -385,7 +387,23 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition) || No (Freeze_Node (Full_View (gnat_entity))))) { gnu_decl - = gnat_to_gnu_entity (Full_View (gnat_entity), NULL_TREE, false); + = gnat_to_gnu_entity (Full_View (gnat_entity), NULL_TREE, + false); + save_gnu_tree (gnat_entity, NULL_TREE, false); + save_gnu_tree (gnat_entity, gnu_decl, false); + } + + if (TREE_CODE (gnu_decl) == TYPE_DECL + && TYPE_IS_DUMMY_P (TREE_TYPE (gnu_decl)) + && Ekind (gnat_entity) == E_Record_Subtype + && No (Freeze_Node (gnat_entity)) + && Present (Cloned_Subtype (gnat_entity)) + && (present_gnu_tree (Cloned_Subtype (gnat_entity)) + || No (Freeze_Node (Cloned_Subtype (gnat_entity))))) + { + gnu_decl + = gnat_to_gnu_entity (Cloned_Subtype (gnat_entity), NULL_TREE, + false); save_gnu_tree (gnat_entity, NULL_TREE, false); save_gnu_tree (gnat_entity, gnu_decl, false); } @@ -3367,13 +3385,13 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition) case E_Record_Subtype: /* If Cloned_Subtype is Present it means this record subtype has identical layout to that type or subtype and we should use - that GCC type for this one. The front end guarantees that + that GCC type for this one. The front-end guarantees that the component list is shared. */ if (Present (Cloned_Subtype (gnat_entity))) { gnu_decl = gnat_to_gnu_entity (Cloned_Subtype (gnat_entity), NULL_TREE, false); - saved = true; + maybe_present = true; break; } @@ -3787,8 +3805,8 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition) case E_Access_Subtype: /* We treat this as identical to its base type; any constraint is meaningful only to the front-end. */ - gnu_decl = gnat_to_gnu_entity (Etype (gnat_entity), NULL_TREE, false); - saved = true; + gnu_decl = gnat_to_gnu_entity (gnat_equiv_type, NULL_TREE, false); + maybe_present = true; /* The designated subtype must be elaborated as well, if it does not have its own freeze node. But designated subtypes created @@ -4974,6 +4992,10 @@ Gigi_Equivalent_Type (Entity_Id gnat_entity) gnat_equiv = Equivalent_Type (gnat_entity); break; + case E_Access_Subtype: + gnat_equiv = Etype (gnat_entity); + break; + case E_Class_Wide_Type: gnat_equiv = Root_Type (gnat_entity); break; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index aed61b5d3fa..9b17e330c2f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2019-06-29 Eric Botcazou <ebotcazou@adacore.com> + + * gnat.dg/specs/array5.ads: New test. + * gnat.dg/specs/array5_pkg1.ads: New helper. + * gnat.dg/specs/array5_pkg2.ads: Likewise. + * gnat.dg/specs/array5_pkg2-g.ads: Likewise. + 2019-06-21 Jeff Law <law@redhat.com> Backport fom mainline diff --git a/gcc/testsuite/gnat.dg/specs/array5.ads b/gcc/testsuite/gnat.dg/specs/array5.ads new file mode 100644 index 00000000000..b0c2d2b56da --- /dev/null +++ b/gcc/testsuite/gnat.dg/specs/array5.ads @@ -0,0 +1,9 @@ +-- { dg-do compile } + +with Array5_Pkg1; use Array5_Pkg1; + +package Array5 is + + C : constant Integer := Arr'Last; + +end Array5; diff --git a/gcc/testsuite/gnat.dg/specs/array5_pkg1.ads b/gcc/testsuite/gnat.dg/specs/array5_pkg1.ads new file mode 100644 index 00000000000..885d6a44ac6 --- /dev/null +++ b/gcc/testsuite/gnat.dg/specs/array5_pkg1.ads @@ -0,0 +1,14 @@ +with Array5_Pkg2; use Array5_Pkg2; +with Array5_Pkg2.G; + +package Array5_Pkg1 is + + type Derived is new Root with record + N : Integer; + end record; + + package My_G is new Array5_Pkg2.G (Derived); + + type Arr is array (1 .. My_G.Data.N) of Integer; + +end Array5_Pkg1; diff --git a/gcc/testsuite/gnat.dg/specs/array5_pkg2-g.ads b/gcc/testsuite/gnat.dg/specs/array5_pkg2-g.ads new file mode 100644 index 00000000000..1bb93960333 --- /dev/null +++ b/gcc/testsuite/gnat.dg/specs/array5_pkg2-g.ads @@ -0,0 +1,13 @@ +with System.Address_To_Access_Conversions; + +generic + + type T is new Root with private; + +package Array5_Pkg2.G is + + package Ptr is new System.Address_To_Access_Conversions (T); + + Data : Ptr.Object_Pointer; + +end Array5_Pkg2.G; diff --git a/gcc/testsuite/gnat.dg/specs/array5_pkg2.ads b/gcc/testsuite/gnat.dg/specs/array5_pkg2.ads new file mode 100644 index 00000000000..6c83460aeb3 --- /dev/null +++ b/gcc/testsuite/gnat.dg/specs/array5_pkg2.ads @@ -0,0 +1,5 @@ +package Array5_Pkg2 is + + type Root is tagged null record; + +end Array5_Pkg2; -- cgit v1.2.3 From f80c0f95044c2da2d35cd7d243f9057e6bc88cfc Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Sun, 30 Jun 2019 00:16:18 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@272829 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 8cd7b881eb2..84eceaed92b 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190629 +20190630 -- cgit v1.2.3 From e95c6526d978f529a7ae2a83090128034b4770c3 Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Mon, 1 Jul 2019 00:16:10 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@272837 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 84eceaed92b..f664d276b87 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190630 +20190701 -- cgit v1.2.3 From 09b91db502a71f5f9d2946be0b2482b70c6ec0c8 Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Tue, 2 Jul 2019 00:16:13 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@272914 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index f664d276b87..087279da522 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190701 +20190702 -- cgit v1.2.3 From 3cf64014fd3b1966a94151c8cd65296d3927e767 Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Wed, 3 Jul 2019 00:16:08 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@272951 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 087279da522..905e21df2a2 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190702 +20190703 -- cgit v1.2.3 From adfe5897076663d0b3f7797c7186aa956a8fce80 Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Thu, 4 Jul 2019 00:16:13 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@273029 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 905e21df2a2..c881b7bdca0 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190703 +20190704 -- cgit v1.2.3 From 0a877b2e3a470831be40c2bec6aef4540889bb89 Mon Sep 17 00:00:00 2001 From: Martin Liska <mliska@suse.cz> Date: Thu, 4 Jul 2019 09:24:32 +0000 Subject: Backport r272992 2019-07-04 Martin Liska <mliska@suse.cz> Backport from mainline 2019-07-03 Martin Liska <mliska@suse.cz> PR middle-end/90899 * multiple_target.c (create_dispatcher_calls): Add to comdat group only if set for ifunc. 2019-07-04 Martin Liska <mliska@suse.cz> Backport from mainline 2019-07-03 Martin Liska <mliska@suse.cz> PR middle-end/90899 * gcc.target/i386/pr90899.c: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@273075 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 9 +++++++++ gcc/multiple_target.c | 3 ++- gcc/testsuite/ChangeLog | 8 ++++++++ gcc/testsuite/gcc.target/i386/pr90899.c | 6 ++++++ 4 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.target/i386/pr90899.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 638756431fc..adee519368a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2019-07-04 Martin Liska <mliska@suse.cz> + + Backport from mainline + 2019-07-03 Martin Liska <mliska@suse.cz> + + PR middle-end/90899 + * multiple_target.c (create_dispatcher_calls): Add to comdat + group only if set for ifunc. + 2019-06-28 Jeff Law <law@redhat.com> Backport from mainline diff --git a/gcc/multiple_target.c b/gcc/multiple_target.c index 87000dba214..97d2268663f 100644 --- a/gcc/multiple_target.c +++ b/gcc/multiple_target.c @@ -158,7 +158,8 @@ create_dispatcher_calls (struct cgraph_node *node) { symtab_node *source = ref->referring; source->create_reference (inode, IPA_REF_ALIAS); - source->add_to_same_comdat_group (inode); + if (inode->get_comdat_group ()) + source->add_to_same_comdat_group (inode); } else gcc_unreachable (); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 9b17e330c2f..79de73631a8 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2019-07-04 Martin Liska <mliska@suse.cz> + + Backport from mainline + 2019-07-03 Martin Liska <mliska@suse.cz> + + PR middle-end/90899 + * gcc.target/i386/pr90899.c: New test. + 2019-06-29 Eric Botcazou <ebotcazou@adacore.com> * gnat.dg/specs/array5.ads: New test. diff --git a/gcc/testsuite/gcc.target/i386/pr90899.c b/gcc/testsuite/gcc.target/i386/pr90899.c new file mode 100644 index 00000000000..e0e2d5ac6bb --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr90899.c @@ -0,0 +1,6 @@ +/* PR middle-end/90899 */ +/* { dg-do compile } */ +/* { dg-require-ifunc "" } */ + +__attribute__ ((target_clones ("default", "arch=slm"))) static int f () { return 0; } +__attribute__ ((alias ("f"))) __typeof (f) g; -- cgit v1.2.3 From b797390e15248c25a25f1db7f26841a956a16358 Mon Sep 17 00:00:00 2001 From: Chenghua Xu <paul.hua.gm@gmail.com> Date: Thu, 4 Jul 2019 09:29:17 +0000 Subject: [MIPS][Testsuite] Specify msa-fmadd.c abis. gcc/testsuite/ Backported from mainline. * gcc.target/mips/mips-fmadd.c: Rename to ... * gcc.target/mips/mips-fmadd-o32.c: ... Here; add abi=32. * gcc.target/mips/mips-fmadd-n64.c: New. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@273076 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/testsuite/ChangeLog | 7 ++ gcc/testsuite/gcc.target/mips/msa-fmadd-n64.c | 101 ++++++++++++++++++++++++++ gcc/testsuite/gcc.target/mips/msa-fmadd-o32.c | 101 ++++++++++++++++++++++++++ gcc/testsuite/gcc.target/mips/msa-fmadd.c | 101 -------------------------- 4 files changed, 209 insertions(+), 101 deletions(-) create mode 100644 gcc/testsuite/gcc.target/mips/msa-fmadd-n64.c create mode 100644 gcc/testsuite/gcc.target/mips/msa-fmadd-o32.c delete mode 100644 gcc/testsuite/gcc.target/mips/msa-fmadd.c diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 79de73631a8..b335d342088 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2019-07-04 Chenghua Xu <paul.hua.gm@gmail.com> + + Backported from mainline. + * gcc.target/mips/mips-fmadd.c: Rename to ... + * gcc.target/mips/mips-fmadd-o32.c: ... Here; add abi=32. + * gcc.target/mips/mips-fmadd-n64.c: New. + 2019-07-04 Martin Liska <mliska@suse.cz> Backport from mainline diff --git a/gcc/testsuite/gcc.target/mips/msa-fmadd-n64.c b/gcc/testsuite/gcc.target/mips/msa-fmadd-n64.c new file mode 100644 index 00000000000..199b366512c --- /dev/null +++ b/gcc/testsuite/gcc.target/mips/msa-fmadd-n64.c @@ -0,0 +1,101 @@ +/* { dg-do compile } */ +/* { dg-options "-mabi=64 -mfp64 -mhard-float -mmsa -EL -flax-vector-conversions" } */ +/* { dg-skip-if "uses global registers" { *-*-* } { "-O0" } { "" } } */ + +typedef int v4i32 __attribute__ ((vector_size(16))); +typedef float v4f32 __attribute__ ((vector_size(16))); +typedef double v2f64 __attribute__ ((vector_size(16))); + +/* Test that MSA FMADD-like intrinsics do not use first operand for multiplication. */ + +register v4i32 a __asm__("$f24"); +register v4i32 b __asm__("$f25"); +register v4f32 c __asm__("$f26"); +register v4f32 d __asm__("$f27"); +register v2f64 e __asm__("$f28"); +register v2f64 f __asm__("$f29"); + +void +maddv_b_msa (void) +{ + a = __builtin_msa_maddv_b (a, b, b); +} +/* { dg-final { scan-assembler "maddv\\\.b\t\\\$w24,\\\$w25,\\\$w25" } } */ + +void +maddv_h_msa (void) +{ + a = __builtin_msa_maddv_h (a, b, b); +} +/* { dg-final { scan-assembler "maddv\\\.h\t\\\$w24,\\\$w25,\\\$w25" } } */ + +void +maddv_w_msa (void) +{ + a = __builtin_msa_maddv_w (a, b, b); +} +/* { dg-final { scan-assembler "maddv\\\.w\t\\\$w24,\\\$w25,\\\$w25" } } */ + +void +maddv_d_msa (void) +{ + a = __builtin_msa_maddv_d (a, b, b); +} +/* { dg-final { scan-assembler "maddv\\\.d\t\\\$w24,\\\$w25,\\\$w25" } } */ + +void +msubv_b_msa (void) +{ + a = __builtin_msa_msubv_b (a, b, b); +} +/* { dg-final { scan-assembler "msubv\\\.b\t\\\$w24,\\\$w25,\\\$w25" } } */ + +void +msubv_h_msa (void) +{ + a = __builtin_msa_msubv_h (a, b, b); +} +/* { dg-final { scan-assembler "msubv\\\.h\t\\\$w24,\\\$w25,\\\$w25" } } */ + +void +msubv_w_msa (void) +{ + a = __builtin_msa_msubv_w (a, b, b); +} +/* { dg-final { scan-assembler "msubv\\\.w\t\\\$w24,\\\$w25,\\\$w25" } } */ + +void +msubv_d_msa (void) +{ + a = __builtin_msa_msubv_d (a, b, b); +} +/* { dg-final { scan-assembler "msubv\\\.d\t\\\$w24,\\\$w25,\\\$w25" } } */ + +void +fmadd_w_msa (void) +{ + c = __builtin_msa_fmadd_w (c, d, d); +} +/* { dg-final { scan-assembler "fmadd\\\.w\t\\\$w26,\\\$w27,\\\$w27" } } */ + +void +fmadd_d_msa (void) +{ + e = __builtin_msa_fmadd_d (e, f, f); +} +/* { dg-final { scan-assembler "fmadd\\\.d\t\\\$w28,\\\$w29,\\\$w29" } } */ + +void +fmsub_w_msa (void) +{ + c = __builtin_msa_fmsub_w (c, d, d); +} +/* { dg-final { scan-assembler "fmsub\\\.w\t\\\$w26,\\\$w27,\\\$w27" } } */ + +void +fmsub_d_msa (void) +{ + e = __builtin_msa_fmsub_d (e, f, f); +} +/* { dg-final { scan-assembler "fmsub\\\.d\t\\\$w28,\\\$w29,\\\$w29" } } */ + diff --git a/gcc/testsuite/gcc.target/mips/msa-fmadd-o32.c b/gcc/testsuite/gcc.target/mips/msa-fmadd-o32.c new file mode 100644 index 00000000000..843336990e4 --- /dev/null +++ b/gcc/testsuite/gcc.target/mips/msa-fmadd-o32.c @@ -0,0 +1,101 @@ +/* { dg-do compile } */ +/* { dg-options "-mabi=32 -mfp64 -mhard-float -mmsa -EL -flax-vector-conversions" } */ +/* { dg-skip-if "uses global registers" { *-*-* } { "-O0" } { "" } } */ + +typedef int v4i32 __attribute__ ((vector_size(16))); +typedef float v4f32 __attribute__ ((vector_size(16))); +typedef double v2f64 __attribute__ ((vector_size(16))); + +/* Test that MSA FMADD-like intrinsics do not use first operand for multiplication. */ + +register v4i32 a __asm__("$f20"); +register v4i32 b __asm__("$f22"); +register v4f32 c __asm__("$f24"); +register v4f32 d __asm__("$f26"); +register v2f64 e __asm__("$f28"); +register v2f64 f __asm__("$f30"); + +void +maddv_b_msa (void) +{ + a = __builtin_msa_maddv_b (a, b, b); +} +/* { dg-final { scan-assembler "maddv\\\.b\t\\\$w20,\\\$w22,\\\$w22" } } */ + +void +maddv_h_msa (void) +{ + a = __builtin_msa_maddv_h (a, b, b); +} +/* { dg-final { scan-assembler "maddv\\\.h\t\\\$w20,\\\$w22,\\\$w22" } } */ + +void +maddv_w_msa (void) +{ + a = __builtin_msa_maddv_w (a, b, b); +} +/* { dg-final { scan-assembler "maddv\\\.w\t\\\$w20,\\\$w22,\\\$w22" } } */ + +void +maddv_d_msa (void) +{ + a = __builtin_msa_maddv_d (a, b, b); +} +/* { dg-final { scan-assembler "maddv\\\.d\t\\\$w20,\\\$w22,\\\$w22" } } */ + +void +msubv_b_msa (void) +{ + a = __builtin_msa_msubv_b (a, b, b); +} +/* { dg-final { scan-assembler "msubv\\\.b\t\\\$w20,\\\$w22,\\\$w22" } } */ + +void +msubv_h_msa (void) +{ + a = __builtin_msa_msubv_h (a, b, b); +} +/* { dg-final { scan-assembler "msubv\\\.h\t\\\$w20,\\\$w22,\\\$w22" } } */ + +void +msubv_w_msa (void) +{ + a = __builtin_msa_msubv_w (a, b, b); +} +/* { dg-final { scan-assembler "msubv\\\.w\t\\\$w20,\\\$w22,\\\$w22" } } */ + +void +msubv_d_msa (void) +{ + a = __builtin_msa_msubv_d (a, b, b); +} +/* { dg-final { scan-assembler "msubv\\\.d\t\\\$w20,\\\$w22,\\\$w22" } } */ + +void +fmadd_w_msa (void) +{ + c = __builtin_msa_fmadd_w (c, d, d); +} +/* { dg-final { scan-assembler "fmadd\\\.w\t\\\$w24,\\\$w26,\\\$w26" } } */ + +void +fmadd_d_msa (void) +{ + e = __builtin_msa_fmadd_d (e, f, f); +} +/* { dg-final { scan-assembler "fmadd\\\.d\t\\\$w28,\\\$w30,\\\$w30" } } */ + +void +fmsub_w_msa (void) +{ + c = __builtin_msa_fmsub_w (c, d, d); +} +/* { dg-final { scan-assembler "fmsub\\\.w\t\\\$w24,\\\$w26,\\\$w26" } } */ + +void +fmsub_d_msa (void) +{ + e = __builtin_msa_fmsub_d (e, f, f); +} +/* { dg-final { scan-assembler "fmsub\\\.d\t\\\$w28,\\\$w30,\\\$w30" } } */ + diff --git a/gcc/testsuite/gcc.target/mips/msa-fmadd.c b/gcc/testsuite/gcc.target/mips/msa-fmadd.c deleted file mode 100644 index 9265c04ff9c..00000000000 --- a/gcc/testsuite/gcc.target/mips/msa-fmadd.c +++ /dev/null @@ -1,101 +0,0 @@ -/* { dg-do compile } */ -/* { dg-options "-mfp64 -mhard-float -mmsa -EL -flax-vector-conversions" } */ -/* { dg-skip-if "uses global registers" { *-*-* } { "-O0" } { "" } } */ - -typedef int v4i32 __attribute__ ((vector_size(16))); -typedef float v4f32 __attribute__ ((vector_size(16))); -typedef double v2f64 __attribute__ ((vector_size(16))); - -/* Test that MSA FMADD-like intrinsics do not use first operand for multiplication. */ - -register v4i32 a __asm__("$f20"); -register v4i32 b __asm__("$f22"); -register v4f32 c __asm__("$f24"); -register v4f32 d __asm__("$f26"); -register v2f64 e __asm__("$f28"); -register v2f64 f __asm__("$f30"); - -void -maddv_b_msa (void) -{ - a = __builtin_msa_maddv_b (a, b, b); -} -/* { dg-final { scan-assembler "maddv\\\.b\t\\\$w20,\\\$w22,\\\$w22" } } */ - -void -maddv_h_msa (void) -{ - a = __builtin_msa_maddv_h (a, b, b); -} -/* { dg-final { scan-assembler "maddv\\\.h\t\\\$w20,\\\$w22,\\\$w22" } } */ - -void -maddv_w_msa (void) -{ - a = __builtin_msa_maddv_w (a, b, b); -} -/* { dg-final { scan-assembler "maddv\\\.w\t\\\$w20,\\\$w22,\\\$w22" } } */ - -void -maddv_d_msa (void) -{ - a = __builtin_msa_maddv_d (a, b, b); -} -/* { dg-final { scan-assembler "maddv\\\.d\t\\\$w20,\\\$w22,\\\$w22" } } */ - -void -msubv_b_msa (void) -{ - a = __builtin_msa_msubv_b (a, b, b); -} -/* { dg-final { scan-assembler "msubv\\\.b\t\\\$w20,\\\$w22,\\\$w22" } } */ - -void -msubv_h_msa (void) -{ - a = __builtin_msa_msubv_h (a, b, b); -} -/* { dg-final { scan-assembler "msubv\\\.h\t\\\$w20,\\\$w22,\\\$w22" } } */ - -void -msubv_w_msa (void) -{ - a = __builtin_msa_msubv_w (a, b, b); -} -/* { dg-final { scan-assembler "msubv\\\.w\t\\\$w20,\\\$w22,\\\$w22" } } */ - -void -msubv_d_msa (void) -{ - a = __builtin_msa_msubv_d (a, b, b); -} -/* { dg-final { scan-assembler "msubv\\\.d\t\\\$w20,\\\$w22,\\\$w22" } } */ - -void -fmadd_w_msa (void) -{ - c = __builtin_msa_fmadd_w (c, d, d); -} -/* { dg-final { scan-assembler "fmadd\\\.w\t\\\$w24,\\\$w26,\\\$w26" } } */ - -void -fmadd_d_msa (void) -{ - e = __builtin_msa_fmadd_d (e, f, f); -} -/* { dg-final { scan-assembler "fmadd\\\.d\t\\\$w28,\\\$w30,\\\$w30" } } */ - -void -fmsub_w_msa (void) -{ - c = __builtin_msa_fmsub_w (c, d, d); -} -/* { dg-final { scan-assembler "fmsub\\\.w\t\\\$w24,\\\$w26,\\\$w26" } } */ - -void -fmsub_d_msa (void) -{ - e = __builtin_msa_fmsub_d (e, f, f); -} -/* { dg-final { scan-assembler "fmsub\\\.d\t\\\$w28,\\\$w30,\\\$w30" } } */ - -- cgit v1.2.3 From af849b10fbbc097ec89907b732f021758ba5c172 Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Fri, 5 Jul 2019 00:16:09 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@273098 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index c881b7bdca0..3b646d6dfeb 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190704 +20190705 -- cgit v1.2.3 From b031480eaf1e13f8ed0697dce1bba3ee431bc4a0 Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Sat, 6 Jul 2019 00:16:14 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@273152 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 3b646d6dfeb..739e0eaf099 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190705 +20190706 -- cgit v1.2.3 From 2cb4971cea8894161fcf12e80dfadef949358f49 Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Sun, 7 Jul 2019 00:16:14 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@273171 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 739e0eaf099..d85bcc5495e 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190706 +20190707 -- cgit v1.2.3 From 04fe67779f695700f6745e78c4a62f9ac089d35e Mon Sep 17 00:00:00 2001 From: Paul Thomas <pault@gcc.gnu.org> Date: Sun, 7 Jul 2019 14:50:53 +0000 Subject: 2019-07-07 Paul Thomas <pault@gcc.gnu.org> PR fortran/91077 * trans-array.c (gfc_conv_scalarized_array_ref) Delete code that gave symbol backend decl for subref arrays. 2019-07-07 Paul Thomas <pault@gcc.gnu.org> PR fortran/91077 * gfortran.dg/pointer_array_11.f90 : New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@273178 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fortran/ChangeLog | 7 ++ gcc/fortran/trans-array.c | 6 +- gcc/testsuite/ChangeLog | 6 ++ gcc/testsuite/gfortran.dg/pointer_array_11.f90 | 90 ++++++++++++++++++++++++++ 4 files changed, 105 insertions(+), 4 deletions(-) create mode 100644 gcc/testsuite/gfortran.dg/pointer_array_11.f90 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 5feccf19d3e..a16c46adc74 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,10 @@ +2019-07-07 Paul Thomas <pault@gcc.gnu.org> + + Backport from trunk + PR fortran/91077 + * trans-array.c (gfc_conv_scalarized_array_ref) Delete code + that gave symbol backend decl for subref arrays. + 2019-06-21 Thomas Koenig <tkoenig@gcc.gnu.org> Backport from trunk diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c index 47d1b96164c..9b898888e3d 100644 --- a/gcc/fortran/trans-array.c +++ b/gcc/fortran/trans-array.c @@ -3422,10 +3422,8 @@ gfc_conv_scalarized_array_ref (gfc_se * se, gfc_array_ref * ar) if (build_class_array_ref (se, base, index)) return; - if (expr && ((is_subref_array (expr) - && GFC_DESCRIPTOR_TYPE_P (TREE_TYPE (info->descriptor))) - || (expr->ts.deferred && (expr->expr_type == EXPR_VARIABLE - || expr->expr_type == EXPR_FUNCTION)))) + if (expr && (expr->ts.deferred && (expr->expr_type == EXPR_VARIABLE + || expr->expr_type == EXPR_FUNCTION))) decl = expr->symtree->n.sym->backend_decl; /* A pointer array component can be detected from its field decl. Fix diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b335d342088..6df93435dbc 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2019-07-07 Paul Thomas <pault@gcc.gnu.org> + + Backport from trunk + PR fortran/91077 + * gfortran.dg/pointer_array_11.f90 : New test. + 2019-07-04 Chenghua Xu <paul.hua.gm@gmail.com> Backported from mainline. diff --git a/gcc/testsuite/gfortran.dg/pointer_array_11.f90 b/gcc/testsuite/gfortran.dg/pointer_array_11.f90 new file mode 100644 index 00000000000..11885ae4301 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pointer_array_11.f90 @@ -0,0 +1,90 @@ +! { dg-do run } +! +! Test the fix for PR91077 - both the original test and that in comment #4 of the PR. +! +! Contribute by Ygal Klein <ygalklein@gmail.com> +! +program test + implicit none + call original + call comment_4 +contains + subroutine original + integer, parameter :: length = 9 + real(8), dimension(2) :: a, b + integer :: i + type point + real(8) :: x + end type point + + type stored + type(point), dimension(:), allocatable :: np + end type stored + type(stored), dimension(:), pointer :: std =>null() + allocate(std(1)) + allocate(std(1)%np(length)) + std(1)%np(1)%x = 0.3d0 + std(1)%np(2)%x = 0.3555d0 + std(1)%np(3)%x = 0.26782d0 + std(1)%np(4)%x = 0d0 + std(1)%np(5)%x = 1.555d0 + std(1)%np(6)%x = 7.3d0 + std(1)%np(7)%x = 7.8d0 + std(1)%np(8)%x = 6.3d0 + std(1)%np(9)%x = 5.5d0 +! do i = 1, 2 +! write(*, "('std(1)%np(',i1,')%x = ',1e22.14)") i, std(1)%np(i)%x +! end do +! do i = 1, 2 +! write(*, "('std(1)%np(1:',i1,') = ',9e22.14)") i, std(1)%np(1:i)%x +! end do + a = std(1)%np(1:2)%x + b = [std(1)%np(1)%x, std(1)%np(2)%x] +! print *,a +! print *,b + if (allocated (std(1)%np)) deallocate (std(1)%np) + if (associated (std)) deallocate (std) + if (norm2(a - b) .gt. 1d-3) stop 1 + end subroutine + + subroutine comment_4 + integer, parameter :: length = 2 + real(8), dimension(length) :: a, b + integer :: i + + type point + real(8) :: x + end type point + + type points + type(point), dimension(:), pointer :: np=>null() + end type points + + type stored + integer :: l + type(points), pointer :: nfpoint=>null() + end type stored + + type(stored), dimension(:), pointer :: std=>null() + + + allocate(std(1)) + allocate(std(1)%nfpoint) + allocate(std(1)%nfpoint%np(length)) + std(1)%nfpoint%np(1)%x = 0.3d0 + std(1)%nfpoint%np(2)%x = 0.3555d0 + +! do i = 1, length +! write(*, "('std(1)%nfpoint%np(',i1,')%x = ',1e22.14)") i, std(1)%nfpoint%np(i)%x +! end do +! do i = 1, length +! write(*, "('std(1)%nfpoint%np(1:',i1,')%x = ',2e22.14)") i, std(1)%nfpoint%np(1:i)%x +! end do + a = std(1)%nfpoint%np(1:2)%x + b = [std(1)%nfpoint%np(1)%x, std(1)%nfpoint%np(2)%x] + if (associated (std(1)%nfpoint%np)) deallocate (std(1)%nfpoint%np) + if (associated (std(1)%nfpoint)) deallocate (std(1)%nfpoint) + if (associated (std)) deallocate (std) + if (norm2(a - b) .gt. 1d-3) stop 2 + end subroutine +end program test -- cgit v1.2.3 From 0299085506e6b646a458dab81573bc19bacb88e7 Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Mon, 8 Jul 2019 00:16:15 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@273188 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index d85bcc5495e..fd804b81d1f 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190707 +20190708 -- cgit v1.2.3 From 831104f890b1ce8fad1219f5f24726acb00948ef Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Tue, 9 Jul 2019 00:16:09 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@273258 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index fd804b81d1f..02c3d86f44e 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190708 +20190709 -- cgit v1.2.3 From a351c987156da81da623040b79d5481855d0c027 Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Wed, 10 Jul 2019 00:16:12 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@273319 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 02c3d86f44e..c3e1766912e 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190709 +20190710 -- cgit v1.2.3 From 5630c34b348090421a2f6331a5d86d68854aafb9 Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Thu, 11 Jul 2019 00:16:08 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@273373 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index c3e1766912e..bc314b8d8c6 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190710 +20190711 -- cgit v1.2.3 From c0745eb31eb27266a6041a48536348c22bfaa8da Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Fri, 12 Jul 2019 00:16:09 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@273427 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index bc314b8d8c6..3a2691ba4e9 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190711 +20190712 -- cgit v1.2.3 From c0a6ffa1d75af5ead14542681288f57493d94586 Mon Sep 17 00:00:00 2001 From: Eric Botcazou <ebotcazou@adacore.com> Date: Fri, 12 Jul 2019 10:16:51 +0000 Subject: PR rtl-optimization/91136 * df-core.c (ACCESSING REFS): Fix typos in comment. * resource.c (mark_target_live_reg): Add artificial defs that occur at the beginning of the block to the initial set of live registers. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@273438 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 7 +++++++ gcc/df-core.c | 6 +++--- gcc/resource.c | 4 ++++ 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index adee519368a..9937777c563 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2019-07-12 Eric Botcazou <ebotcazou@adacore.com> + + PR rtl-optimization/91136 + * df-core.c (ACCESSING REFS): Fix typos in comment. + * resource.c (mark_target_live_reg): Add artificial defs that occur at + the beginning of the block to the initial set of live registers. + 2019-07-04 Martin Liska <mliska@suse.cz> Backport from mainline diff --git a/gcc/df-core.c b/gcc/df-core.c index 74ef0a14ac9..2fc7c05ede4 100644 --- a/gcc/df-core.c +++ b/gcc/df-core.c @@ -298,12 +298,12 @@ There are 4 ways to obtain access to refs: Artificial defs and uses occur both at the beginning and ends of blocks. - For blocks that area at the destination of eh edges, the + For blocks that are at the destination of eh edges, the artificial uses and defs occur at the beginning. The defs relate to the registers specified in EH_RETURN_DATA_REGNO and the uses - relate to the registers specified in ED_USES. Logically these + relate to the registers specified in EH_USES. Logically these defs and uses should really occur along the eh edge, but there is - no convenient way to do this. Artificial edges that occur at the + no convenient way to do this. Artificial defs that occur at the beginning of the block have the DF_REF_AT_TOP flag set. Artificial uses occur at the end of all blocks. These arise from diff --git a/gcc/resource.c b/gcc/resource.c index 0822daebde7..caccce512c1 100644 --- a/gcc/resource.c +++ b/gcc/resource.c @@ -969,9 +969,13 @@ mark_target_live_regs (rtx_insn *insns, rtx target_maybe_return, struct resource { regset regs_live = DF_LR_IN (BASIC_BLOCK_FOR_FN (cfun, b)); rtx_insn *start_insn, *stop_insn; + df_ref def; /* Compute hard regs live at start of block. */ REG_SET_TO_HARD_REG_SET (current_live_regs, regs_live); + FOR_EACH_ARTIFICIAL_DEF (def, b) + if (DF_REF_FLAGS (def) & DF_REF_AT_TOP) + SET_HARD_REG_BIT (current_live_regs, DF_REF_REGNO (def)); /* Get starting and ending insn, handling the case where each might be a SEQUENCE. */ -- cgit v1.2.3 From f948c3689c706e4c44b11b3ae009cc85d69aef52 Mon Sep 17 00:00:00 2001 From: Wilco Dijkstra <wdijkstr@arm.com> Date: Fri, 12 Jul 2019 16:41:01 +0000 Subject: Turn off ipa-ra in builtins test (PR91059) The gcc.c-torture/execute/builtins/lib directory contains a reimplementation of many C library string functions, which causes non-trivial register allocation bugs with LTO and static linked libraries. To fix this long-standing test issue, turn off ipa-ra which avoids the register corruption across calls. All builtin torture tests now pass on aarch64-none-elf. Committed as obvious. See PR78529 for more details. testsuite/ PR testsuite/78529 * gcc.c-torture/execute/builtins/builtins.exp: Add -fno-ipa-ra. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@273450 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.c-torture/execute/builtins/builtins.exp | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 6df93435dbc..d2d9c6121f4 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-07-12 Wilco Dijkstra <wdijkstr@arm.com> + + PR testsuite/78529 + * gcc.c-torture/execute/builtins/builtins.exp: Add -fno-ipa-ra. + 2019-07-07 Paul Thomas <pault@gcc.gnu.org> Backport from trunk diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/builtins.exp b/gcc/testsuite/gcc.c-torture/execute/builtins/builtins.exp index 9f0b24ad4ee..e8297e15f18 100644 --- a/gcc/testsuite/gcc.c-torture/execute/builtins/builtins.exp +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/builtins.exp @@ -37,7 +37,7 @@ load_lib c-torture.exp torture-init set-torture-options $C_TORTURE_OPTIONS {{}} $LTO_TORTURE_OPTIONS -set additional_flags "-fno-tree-loop-distribute-patterns -fno-tracer" +set additional_flags "-fno-tree-loop-distribute-patterns -fno-tracer -fno-ipa-ra" if [istarget "powerpc-*-darwin*"] { lappend additional_flags "-Wl,-multiply_defined,suppress" } -- cgit v1.2.3 From 75359d6b4045aa9d7a240fd765008a6fd2650f30 Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Sat, 13 Jul 2019 00:16:16 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@273461 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 3a2691ba4e9..1a8e5511822 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190712 +20190713 -- cgit v1.2.3 From 41d94b142934ff6e5559591f14ed178b5a18f3ea Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Sun, 14 Jul 2019 00:16:10 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@273472 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 1a8e5511822..7c107eaa467 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190713 +20190714 -- cgit v1.2.3 From a2bfe4240aa10e908e5d89408b3c1bf86ad8f8e6 Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Mon, 15 Jul 2019 00:16:09 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@273486 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 7c107eaa467..58603abf082 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190714 +20190715 -- cgit v1.2.3 From f92ce3a59772ae4b499c191cf7db09527e97eb78 Mon Sep 17 00:00:00 2001 From: Wilco Dijkstra <wdijkstr@arm.com> Date: Mon, 15 Jul 2019 11:00:48 +0000 Subject: Backport fix for PR85711 Backport from mainline 2019-01-23 Bin Cheng <bin.cheng@arm.com> Steve Ellcey <sellcey@marvell.com> PR target/85711 * recog.c (address_operand): Return false on wrong mode for address. (constrain_operands): Check for mode with 'p' constraint. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@273491 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 10 ++++++++++ gcc/recog.c | 16 ++++++++++++---- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 9937777c563..902b7870cd6 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +2019-07-15 Wilco Dijkstra <wdijkstr@arm.com> + + Backport from mainline + 2019-01-23 Bin Cheng <bin.cheng@arm.com> + Steve Ellcey <sellcey@marvell.com> + + PR target/85711 + * recog.c (address_operand): Return false on wrong mode for address. + (constrain_operands): Check for mode with 'p' constraint. + 2019-07-12 Eric Botcazou <ebotcazou@adacore.com> PR rtl-optimization/91136 diff --git a/gcc/recog.c b/gcc/recog.c index 0a8fa2ce46c..28dbd09e615 100644 --- a/gcc/recog.c +++ b/gcc/recog.c @@ -1070,6 +1070,11 @@ general_operand (rtx op, machine_mode mode) int address_operand (rtx op, machine_mode mode) { + /* Wrong mode for an address expr. */ + if (GET_MODE (op) != VOIDmode + && ! SCALAR_INT_MODE_P (GET_MODE (op))) + return false; + return memory_address_p (mode, op); } @@ -2695,10 +2700,13 @@ constrain_operands (int strict, alternative_mask alternatives) /* p is used for address_operands. When we are called by gen_reload, no one will have checked that the address is strictly valid, i.e., that all pseudos requiring hard regs - have gotten them. */ - if (strict <= 0 - || (strict_memory_address_p (recog_data.operand_mode[opno], - op))) + have gotten them. We also want to make sure we have a + valid mode. */ + if ((GET_MODE (op) == VOIDmode + || SCALAR_INT_MODE_P (GET_MODE (op))) + && (strict <= 0 + || (strict_memory_address_p + (recog_data.operand_mode[opno], op)))) win = 1; break; -- cgit v1.2.3 From 3c78058d7bed3a1eeac4da905ad80a37481216f4 Mon Sep 17 00:00:00 2001 From: Andreas Krebbel <krebbel@linux.ibm.com> Date: Mon, 15 Jul 2019 14:27:16 +0000 Subject: S/390: Fix vector shift count operand We currently use subst definitions to handle the different variants of shift count operands. Unfortunately, in the vector shift pattern the shift count operand is used directly. Without it being adjusted for the 'subst' variants the displacement value is omitted resulting in a wrong shift count being applied. This patch needs to be applied to older branches as well. gcc/ChangeLog: 2019-07-15 Andreas Krebbel <krebbel@linux.ibm.com> Backport from mainline 2019-07-01 Andreas Krebbel <krebbel@linux.ibm.com> * config/s390/vector.md: Fix shift count operand printing. gcc/testsuite/ChangeLog: 2019-07-15 Andreas Krebbel <krebbel@linux.ibm.com> Backport from mainline 2019-07-01 Andreas Krebbel <krebbel@linux.ibm.com> * gcc.target/s390/vector/vec-shift-2.c: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@273493 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 7 +++++++ gcc/config/s390/vector.md | 2 +- gcc/testsuite/ChangeLog | 7 +++++++ gcc/testsuite/gcc.target/s390/vector/vec-shift-2.c | 24 ++++++++++++++++++++++ 4 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.target/s390/vector/vec-shift-2.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 902b7870cd6..a860a2061c4 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2019-07-15 Andreas Krebbel <krebbel@linux.ibm.com> + + Backport from mainline + 2019-07-01 Andreas Krebbel <krebbel@linux.ibm.com> + + * config/s390/vector.md: Fix shift count operand printing. + 2019-07-15 Wilco Dijkstra <wdijkstr@arm.com> Backport from mainline diff --git a/gcc/config/s390/vector.md b/gcc/config/s390/vector.md index 102313f04a0..8a3f516d91d 100644 --- a/gcc/config/s390/vector.md +++ b/gcc/config/s390/vector.md @@ -944,7 +944,7 @@ (VEC_SHIFTS:VI (match_operand:VI 1 "register_operand" "v") (match_operand:SI 2 "nonmemory_operand" "an")))] "TARGET_VX" - "<vec_shifts_mnem><bhfgq>\t%v0,%v1,%Y2" + "<vec_shifts_mnem><bhfgq>\t%v0,%v1,<addr_style_op_ops>" [(set_attr "op_type" "VRS")]) ; Shift each element by corresponding vector element diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index d2d9c6121f4..820007193cc 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2019-07-15 Andreas Krebbel <krebbel@linux.ibm.com> + + Backport from mainline + 2019-07-01 Andreas Krebbel <krebbel@linux.ibm.com> + + * gcc.target/s390/vector/vec-shift-2.c: New test. + 2019-07-12 Wilco Dijkstra <wdijkstr@arm.com> PR testsuite/78529 diff --git a/gcc/testsuite/gcc.target/s390/vector/vec-shift-2.c b/gcc/testsuite/gcc.target/s390/vector/vec-shift-2.c new file mode 100644 index 00000000000..c7a1d93b817 --- /dev/null +++ b/gcc/testsuite/gcc.target/s390/vector/vec-shift-2.c @@ -0,0 +1,24 @@ +/* { dg-do run } */ +/* { dg-options "-O3 -mzarch -march=z13 --save-temps" } */ + +/* { dg-final { scan-assembler-times "veslf" 1 } } */ + +typedef __attribute__((vector_size(16))) signed int v4si; + +v4si __attribute__((noinline,noclone)) +shift_left_by_scalar (v4si in, int shift_count) +{ + return in << (3 + shift_count); +} + +int +main () +{ + v4si a = { 1, 2, 3, 4 }; + v4si result = shift_left_by_scalar (a, 1); + + if (result[1] != 32) + __builtin_abort (); + + return 0; +} -- cgit v1.2.3 From dc606c661ec2c3e32cdc4d69bf8e9675a5cc9969 Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Tue, 16 Jul 2019 00:16:40 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@273503 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 58603abf082..51bd5650805 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190715 +20190716 -- cgit v1.2.3 From e22f3d7fdb263e36311a282b16cf5ee497ba35bf Mon Sep 17 00:00:00 2001 From: Wilco Dijkstra <wdijkstr@arm.com> Date: Tue, 16 Jul 2019 12:00:42 +0000 Subject: [ARM] Fix Thumb-1 ldm (PR89190) This patch fixes an ICE in the Thumb-1 LDM peepholer. Thumb-1 LDMs always update the base register except if the base is loaded. The current implementation rejects LDMs where the base is not dead, however this doesn't exclude the case where the base is loaded as well as dead. Fix this by explicitly checking whether the base is loaded. Also enable LDMs which load the first register. gcc/ PR target/89190 * config/arm/arm.c (ldm_stm_operation_p) Set addr_reg_in_reglist correctly for first register. (load_multiple_sequence): Remove dead base check. (gen_ldm_seq): Correctly set write_back for Thumb-1. testsuite/ PR target/89190 * gcc.target/arm/pr89190.c: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@273523 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 10 ++++++++++ gcc/config/arm/arm.c | 24 ++++++++++++++---------- gcc/testsuite/ChangeLog | 7 +++++++ gcc/testsuite/gcc.target/arm/pr89190.c | 15 +++++++++++++++ 4 files changed, 46 insertions(+), 10 deletions(-) create mode 100644 gcc/testsuite/gcc.target/arm/pr89190.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a860a2061c4..2c693b4cbc0 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +2019-07-16 Wilco Dijkstra <wdijkstr@arm.com> + + Backport from mainline + 2019-02-13 Wilco Dijkstra <wdijkstr@arm.com> + PR target/89190 + * config/arm/arm.c (ldm_stm_operation_p) Set + addr_reg_in_reglist correctly for first register. + (load_multiple_sequence): Remove dead base check. + (gen_ldm_seq): Correctly set write_back for Thumb-1. + 2019-07-15 Andreas Krebbel <krebbel@linux.ibm.com> Backport from mainline diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index 5e8190ec85a..43cdeb3aa6e 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -13094,6 +13094,9 @@ ldm_stm_operation_p (rtx op, bool load, machine_mode mode, if (load && (REGNO (reg) == SP_REGNUM) && (REGNO (addr) != SP_REGNUM)) return false; + if (regno == REGNO (addr)) + addr_reg_in_reglist = true; + for (; i < count; i++) { elt = XVECEXP (op, 0, i); @@ -13288,7 +13291,6 @@ load_multiple_sequence (rtx *operands, int nops, int *regs, int *saved_order, int unsorted_regs[MAX_LDM_STM_OPS]; HOST_WIDE_INT unsorted_offsets[MAX_LDM_STM_OPS]; int order[MAX_LDM_STM_OPS]; - rtx base_reg_rtx = NULL; int base_reg = -1; int i, ldm_case; @@ -13333,7 +13335,6 @@ load_multiple_sequence (rtx *operands, int nops, int *regs, int *saved_order, if (i == 0) { base_reg = REGNO (reg); - base_reg_rtx = reg; if (TARGET_THUMB1 && base_reg > LAST_LO_REGNUM) return 0; } @@ -13392,10 +13393,6 @@ load_multiple_sequence (rtx *operands, int nops, int *regs, int *saved_order, *load_offset = unsorted_offsets[order[0]]; } - if (TARGET_THUMB1 - && !peep2_reg_dead_p (nops, base_reg_rtx)) - return 0; - if (unsorted_offsets[order[0]] == 0) ldm_case = 1; /* ldmia */ else if (TARGET_ARM && unsorted_offsets[order[0]] == 4) @@ -13771,9 +13768,17 @@ gen_ldm_seq (rtx *operands, int nops, bool sort_regs) if (TARGET_THUMB1) { - gcc_assert (peep2_reg_dead_p (nops, base_reg_rtx)); gcc_assert (ldm_case == 1 || ldm_case == 5); - write_back = TRUE; + + /* Thumb-1 ldm uses writeback except if the base is loaded. */ + write_back = true; + for (i = 0; i < nops; i++) + if (base_reg == regs[i]) + write_back = false; + + /* Ensure the base is dead if it is updated. */ + if (write_back && !peep2_reg_dead_p (nops, base_reg_rtx)) + return false; } if (ldm_case == 5) @@ -13781,8 +13786,7 @@ gen_ldm_seq (rtx *operands, int nops, bool sort_regs) rtx newbase = TARGET_THUMB1 ? base_reg_rtx : gen_rtx_REG (SImode, regs[0]); emit_insn (gen_addsi3 (newbase, base_reg_rtx, GEN_INT (offset))); offset = 0; - if (!TARGET_THUMB1) - base_reg_rtx = newbase; + base_reg_rtx = newbase; } for (i = 0; i < nops; i++) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 820007193cc..0eab85afabb 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2019-07-16 Wilco Dijkstra <wdijkstr@arm.com> + + Backport from mainline + 2019-02-04 Wilco Dijkstra <wdijkstr@arm.com> + PR target/89190 + * gcc.target/arm/pr89190.c: New test. + 2019-07-15 Andreas Krebbel <krebbel@linux.ibm.com> Backport from mainline diff --git a/gcc/testsuite/gcc.target/arm/pr89190.c b/gcc/testsuite/gcc.target/arm/pr89190.c new file mode 100644 index 00000000000..e622d7081ed --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/pr89190.c @@ -0,0 +1,15 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target arm_arch_v8m_base_ok } */ +/* { dg-options "-O2" } */ +/* { dg-add-options arm_arch_v8m_base } */ + +long long a; +int b, c; +int d(int e, int f) { return e << f; } +void g() { + long long h; + char i = d(b >= 7, 2); + c = i == 0 ?: 1 / i; + h = c && a ?: c + a; + b = h; +} -- cgit v1.2.3 From 3a4498a22337cf528836276c254fd4034350ced6 Mon Sep 17 00:00:00 2001 From: Wilco Dijkstra <wdijkstr@arm.com> Date: Tue, 16 Jul 2019 12:37:14 +0000 Subject: [ARM] Fix PR89222 The GCC optimizer can generate symbols with non-zero offset from simple if-statements. Bit zero is used for the Arm/Thumb state bit, so relocations with offsets fail if it changes bit zero and the relocation forces bit zero to true. The fix is to disable offsets on function pointer symbols. gcc/ PR target/89222 * config/arm/arm.md (movsi): Use targetm.cannot_force_const_mem to decide when to split off a non-zero offset from a symbol. * config/arm/arm.c (arm_cannot_force_const_mem): Disallow offsets in function symbols. testsuite/ PR target/89222 * gcc.target/arm/pr89222.c: Add new test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@273526 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 9 ++++++ gcc/config/arm/arm.c | 11 ++++++-- gcc/config/arm/arm.md | 51 ++++++++++------------------------ gcc/testsuite/ChangeLog | 6 ++++ gcc/testsuite/gcc.target/arm/pr89222.c | 32 +++++++++++++++++++++ 5 files changed, 69 insertions(+), 40 deletions(-) create mode 100644 gcc/testsuite/gcc.target/arm/pr89222.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 2c693b4cbc0..cf39ae25594 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2019-07-16 Wilco Dijkstra <wdijkstr@arm.com> + + Backport from mainline + PR target/89222 + * config/arm/arm.md (movsi): Use targetm.cannot_force_const_mem + to decide when to split off a non-zero offset from a symbol. + * config/arm/arm.c (arm_cannot_force_const_mem): Disallow offsets + in function symbols. + 2019-07-16 Wilco Dijkstra <wdijkstr@arm.com> Backport from mainline diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index 43cdeb3aa6e..9dbfd2e39da 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -8879,11 +8879,16 @@ static bool arm_cannot_force_const_mem (machine_mode mode ATTRIBUTE_UNUSED, rtx x) { rtx base, offset; + split_const (x, &base, &offset); - if (ARM_OFFSETS_MUST_BE_WITHIN_SECTIONS_P) + if (SYMBOL_REF_P (base)) { - split_const (x, &base, &offset); - if (GET_CODE (base) == SYMBOL_REF + /* Function symbols cannot have an offset due to the Thumb bit. */ + if ((SYMBOL_REF_FLAGS (base) & SYMBOL_FLAG_FUNCTION) + && INTVAL (offset) != 0) + return true; + + if (ARM_OFFSETS_MUST_BE_WITHIN_SECTIONS_P && !offset_within_block_p (base, INTVAL (offset))) return true; } diff --git a/gcc/config/arm/arm.md b/gcc/config/arm/arm.md index 2d5359e532f..b6782d8009f 100644 --- a/gcc/config/arm/arm.md +++ b/gcc/config/arm/arm.md @@ -5976,52 +5976,29 @@ } } - if (ARM_OFFSETS_MUST_BE_WITHIN_SECTIONS_P) + split_const (operands[1], &base, &offset); + if (INTVAL (offset) != 0 + && targetm.cannot_force_const_mem (SImode, operands[1])) { - split_const (operands[1], &base, &offset); - if (GET_CODE (base) == SYMBOL_REF - && !offset_within_block_p (base, INTVAL (offset))) - { - tmp = can_create_pseudo_p () ? gen_reg_rtx (SImode) : operands[0]; - emit_move_insn (tmp, base); - emit_insn (gen_addsi3 (operands[0], tmp, offset)); - DONE; - } + tmp = can_create_pseudo_p () ? gen_reg_rtx (SImode) : operands[0]; + emit_move_insn (tmp, base); + emit_insn (gen_addsi3 (operands[0], tmp, offset)); + DONE; } + tmp = can_create_pseudo_p () ? NULL_RTX : operands[0]; + /* Recognize the case where operand[1] is a reference to thread-local - data and load its address to a register. */ + data and load its address to a register. Offsets have been split off + already. */ if (arm_tls_referenced_p (operands[1])) - { - rtx tmp = operands[1]; - rtx addend = NULL; - - if (GET_CODE (tmp) == CONST && GET_CODE (XEXP (tmp, 0)) == PLUS) - { - addend = XEXP (XEXP (tmp, 0), 1); - tmp = XEXP (XEXP (tmp, 0), 0); - } - - gcc_assert (GET_CODE (tmp) == SYMBOL_REF); - gcc_assert (SYMBOL_REF_TLS_MODEL (tmp) != 0); - - tmp = legitimize_tls_address (tmp, - !can_create_pseudo_p () ? operands[0] : 0); - if (addend) - { - tmp = gen_rtx_PLUS (SImode, tmp, addend); - tmp = force_operand (tmp, operands[0]); - } - operands[1] = tmp; - } + operands[1] = legitimize_tls_address (operands[1], tmp); else if (flag_pic && (CONSTANT_P (operands[1]) || symbol_mentioned_p (operands[1]) || label_mentioned_p (operands[1]))) - operands[1] = legitimize_pic_address (operands[1], SImode, - (!can_create_pseudo_p () - ? operands[0] - : 0)); + operands[1] = + legitimize_pic_address (operands[1], SImode, tmp); } " ) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 0eab85afabb..495579c1155 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2019-07-16 Wilco Dijkstra <wdijkstr@arm.com> + + Backport from mainline + PR target/89222 + * gcc.target/arm/pr89222.c: Add new test. + 2019-07-16 Wilco Dijkstra <wdijkstr@arm.com> Backport from mainline diff --git a/gcc/testsuite/gcc.target/arm/pr89222.c b/gcc/testsuite/gcc.target/arm/pr89222.c new file mode 100644 index 00000000000..d26d7df1754 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/pr89222.c @@ -0,0 +1,32 @@ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +void g (void); + +void f1 (int x) +{ + if (x != (int) g + 3) + return; + g(); +} + +void (*a2)(void); + +void f2 (void) +{ + a2 = &g + 3; +} + +typedef void (*__sighandler_t)(int); +void handler (int); + +void f3 (int x) +{ + __sighandler_t h = &handler; + if (h != (__sighandler_t) 2 && h != (__sighandler_t) 1) + h (x); +} + +/* { dg-final { scan-assembler-times {add(?:s)?\tr[0-9]+, r[0-9]+, #3} 2 } } */ +/* { dg-final { scan-assembler-not {.word\tg\+3} } } */ +/* { dg-final { scan-assembler-not {.word\thandler-1} } } */ -- cgit v1.2.3 From 2c9df52dfb77317ee83863065fea97f142138bde Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Wed, 17 Jul 2019 00:16:10 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@273539 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 51bd5650805..72cde0bc4e1 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190716 +20190717 -- cgit v1.2.3 From 7929c429e7ca2b4ef51b2d994b0742f0ab0a8e86 Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Thu, 18 Jul 2019 00:16:29 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@273560 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 72cde0bc4e1..861a8222235 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190717 +20190718 -- cgit v1.2.3 From 7fa88d3372bd3b98098aeda0505af7a26f2ee9e8 Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Fri, 19 Jul 2019 00:16:19 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@273588 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 861a8222235..0d6cbf1a188 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190718 +20190719 -- cgit v1.2.3 From cedb5c3a7e827766f27642928cd582705967505a Mon Sep 17 00:00:00 2001 From: Jason Merrill <jason@redhat.com> Date: Fri, 19 Jul 2019 11:53:41 +0000 Subject: PR c++/82081 - tail call optimization breaks noexcept If a noexcept function calls a function that might throw, doing the tail call optimization means that an exception thrown in the called function will propagate out, breaking the noexcept specification. So we need to prevent the optimization in that case. * tree-tailcall.c (find_tail_calls): Don't turn a call from a nothrow function to a might-throw function into a tail call. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@273601 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 6 ++++++ gcc/testsuite/g++.dg/tree-ssa/tail-call-1.C | 11 +++++++++++ gcc/tree-tailcall.c | 7 +++++++ 3 files changed, 24 insertions(+) create mode 100644 gcc/testsuite/g++.dg/tree-ssa/tail-call-1.C diff --git a/gcc/ChangeLog b/gcc/ChangeLog index cf39ae25594..585b3336450 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2019-07-19 Jason Merrill <jason@redhat.com> + + PR c++/82081 - tail call optimization breaks noexcept + * tree-tailcall.c (find_tail_calls): Don't turn a call from a + nothrow function to a might-throw function into a tail call. + 2019-07-16 Wilco Dijkstra <wdijkstr@arm.com> Backport from mainline diff --git a/gcc/testsuite/g++.dg/tree-ssa/tail-call-1.C b/gcc/testsuite/g++.dg/tree-ssa/tail-call-1.C new file mode 100644 index 00000000000..c67af6e41c7 --- /dev/null +++ b/gcc/testsuite/g++.dg/tree-ssa/tail-call-1.C @@ -0,0 +1,11 @@ +// PR c++/82081 +// { dg-do compile { target c++11 } } +// { dg-additional-options "-O2 -fdump-tree-optimized" } +// { dg-final { scan-tree-dump-not "tail call" "optimized" } } + +int g(int) ; + +int f() noexcept { + int i = 42, j = 43; + return g(i+j); +} diff --git a/gcc/tree-tailcall.c b/gcc/tree-tailcall.c index 9ebed9de524..de18f9bcf87 100644 --- a/gcc/tree-tailcall.c +++ b/gcc/tree-tailcall.c @@ -37,6 +37,7 @@ along with GCC; see the file COPYING3. If not see #include "tree-into-ssa.h" #include "tree-dfa.h" #include "except.h" +#include "tree-eh.h" #include "dbgcnt.h" #include "cfgloop.h" #include "common/common-target.h" @@ -472,6 +473,12 @@ find_tail_calls (basic_block bb, struct tailcall **ret) && !auto_var_in_fn_p (ass_var, cfun->decl)) return; + /* If the call might throw an exception that wouldn't propagate out of + cfun, we can't transform to a tail or sibling call (82081). */ + if (stmt_could_throw_p (stmt) + && !stmt_can_throw_external (stmt)) + return; + /* We found the call, check whether it is suitable. */ tail_recursion = false; func = gimple_call_fndecl (call); -- cgit v1.2.3 From 601ec2ab39f831ad132234de817c1350540baf65 Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Sat, 20 Jul 2019 00:16:07 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@273613 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 0d6cbf1a188..5030968ca93 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190719 +20190720 -- cgit v1.2.3 From 62d40ed80439c7b63e1e94b52c587ea367a8d032 Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Sun, 21 Jul 2019 00:16:09 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@273638 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 5030968ca93..6d7642cc723 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190720 +20190721 -- cgit v1.2.3 From b9dc182e95521e0f3f5eb7b004c0447f4432a846 Mon Sep 17 00:00:00 2001 From: Richard Sandiford <richard.sandiford@arm.com> Date: Sun, 21 Jul 2019 09:42:21 +0000 Subject: Fix folding of vector EQ/NE For vector1 != vector2, we returned false if any elements were equal, rather than if all elements were equal. 2019-07-21 Richard Sandiford <richard.sandiford@arm.com> gcc/ Backport from mainline 2019-07-10 Richard Sandiford <richard.sandiford@arm.com> * fold-const.c (fold_relational_const): Fix folding of vector-to-scalar NE_EXPRs. (test_vector_folding): Add more tests. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@273641 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 9 +++++++++ gcc/fold-const.c | 14 +++++++++++--- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 585b3336450..9d5c3699977 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2019-07-21 Richard Sandiford <richard.sandiford@arm.com> + + Backport from mainline + 2019-07-10 Richard Sandiford <richard.sandiford@arm.com> + + * fold-const.c (fold_relational_const): Fix folding of + vector-to-scalar NE_EXPRs. + (test_vector_folding): Add more tests. + 2019-07-19 Jason Merrill <jason@redhat.com> PR c++/82081 - tail call optimization breaks noexcept diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 0e15c01727a..c64c4b10f8d 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -14010,13 +14010,13 @@ fold_relational_const (enum tree_code code, tree type, tree op0, tree op1) { tree elem0 = VECTOR_CST_ELT (op0, i); tree elem1 = VECTOR_CST_ELT (op1, i); - tree tmp = fold_relational_const (code, type, elem0, elem1); + tree tmp = fold_relational_const (EQ_EXPR, type, elem0, elem1); if (tmp == NULL_TREE) return NULL_TREE; if (integer_zerop (tmp)) - return constant_boolean_node (false, type); + return constant_boolean_node (code == NE_EXPR, type); } - return constant_boolean_node (true, type); + return constant_boolean_node (code == EQ_EXPR, type); } tree_vector_builder elts; if (!elts.new_binary_operation (type, op0, op1, false)) @@ -14687,6 +14687,7 @@ test_vector_folding () tree type = build_vector_type (inner_type, 4); tree zero = build_zero_cst (type); tree one = build_one_cst (type); + tree index = build_index_vector (type, 0, 1); /* Verify equality tests that return a scalar boolean result. */ tree res_type = boolean_type_node; @@ -14694,6 +14695,13 @@ test_vector_folding () ASSERT_TRUE (integer_nonzerop (fold_build2 (EQ_EXPR, res_type, zero, zero))); ASSERT_TRUE (integer_nonzerop (fold_build2 (NE_EXPR, res_type, zero, one))); ASSERT_FALSE (integer_nonzerop (fold_build2 (NE_EXPR, res_type, one, one))); + ASSERT_TRUE (integer_nonzerop (fold_build2 (NE_EXPR, res_type, index, one))); + ASSERT_FALSE (integer_nonzerop (fold_build2 (EQ_EXPR, res_type, + index, one))); + ASSERT_FALSE (integer_nonzerop (fold_build2 (NE_EXPR, res_type, + index, index))); + ASSERT_TRUE (integer_nonzerop (fold_build2 (EQ_EXPR, res_type, + index, index))); } /* Verify folding of VEC_DUPLICATE_EXPRs. */ -- cgit v1.2.3 From e8b0ef68b2dfe46647c10ec9e6bc378edcf67f10 Mon Sep 17 00:00:00 2001 From: Richard Sandiford <richard.sandiford@arm.com> Date: Sun, 21 Jul 2019 09:42:41 +0000 Subject: Fix -Wreturn-type for static naked functions in C This patch extends the fix for PR53633 to include static functions, which were giving a bogus -Wreturn-type warning for C but not for C++. 2019-07-21 Richard Sandiford <richard.sandiford@arm.com> gcc/c/ Backport from mainline 2019-07-18 Richard Sandiford <richard.sandiford@arm.com> PR c/53633 * c-decl.c (finish_function): Check targetm.warn_func_return before issuing a -Wreturn-type warning. gcc/testsuite/ Backport from mainline 2019-07-18 Richard Sandiford <richard.sandiford@arm.com> * c-c++-common/pr53633-2.c: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@273642 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/c/ChangeLog | 9 +++++++++ gcc/c/c-decl.c | 3 ++- gcc/testsuite/ChangeLog | 7 +++++++ gcc/testsuite/c-c++-common/pr53633-2.c | 19 +++++++++++++++++++ 4 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/c-c++-common/pr53633-2.c diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index 159abab1866..1c5c3a71b9b 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,12 @@ +2019-07-21 Richard Sandiford <richard.sandiford@arm.com> + + Backport from mainline + 2019-07-18 Richard Sandiford <richard.sandiford@arm.com> + + PR c/53633 + * c-decl.c (finish_function): Check targetm.warn_func_return + before issuing a -Wreturn-type warning. + 2019-04-30 Jakub Jelinek <jakub@redhat.com> Backported from mainline diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c index 7ac69d027b5..ab3a5ed6e9e 100644 --- a/gcc/c/c-decl.c +++ b/gcc/c/c-decl.c @@ -9506,7 +9506,8 @@ finish_function (void) && !C_FUNCTION_IMPLICIT_INT (fndecl) /* Normally, with -Wreturn-type, flow will complain, but we might optimize out static functions. */ - && !TREE_PUBLIC (fndecl)) + && !TREE_PUBLIC (fndecl) + && targetm.warn_func_return (fndecl)) { warning (OPT_Wreturn_type, "no return statement in function returning non-void"); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 495579c1155..618d43b6864 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2019-07-21 Richard Sandiford <richard.sandiford@arm.com> + + Backport from mainline + 2019-07-18 Richard Sandiford <richard.sandiford@arm.com> + + * c-c++-common/pr53633-2.c: New test. + 2019-07-16 Wilco Dijkstra <wdijkstr@arm.com> Backport from mainline diff --git a/gcc/testsuite/c-c++-common/pr53633-2.c b/gcc/testsuite/c-c++-common/pr53633-2.c new file mode 100644 index 00000000000..c26cb10cc83 --- /dev/null +++ b/gcc/testsuite/c-c++-common/pr53633-2.c @@ -0,0 +1,19 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target naked_functions } */ +/* { dg-options "-O2 -Wall" } */ +/* Check that we do not get warnings about missing return statements + or bogus looking noreturn functions. */ +static int __attribute__((naked)) +foo (void) +{ + __asm__ (""); +} + +static int __attribute__((naked,noreturn)) +bar (void) +{ + __asm__ (""); +} + +int foo_caller (void) { return foo (); } +int bar_caller (void) { return bar (); } -- cgit v1.2.3 From bdc798d71c925cface9ab6730fc46a9ed1f8b75b Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Mon, 22 Jul 2019 00:16:15 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@273654 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 6d7642cc723..924bff94750 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190721 +20190722 -- cgit v1.2.3 From 33c549e8d9bbc96c7ecf48712839a6c4d198f8d6 Mon Sep 17 00:00:00 2001 From: Martin Liska <mliska@suse.cz> Date: Mon, 22 Jul 2019 09:38:01 +0000 Subject: Backport r273660 2019-07-22 Martin Liska <mliska@suse.cz> Backport from mainline 2019-07-22 Martin Liska <mliska@suse.cz> PR driver/91172 * opts-common.c (decode_cmdline_option): Decode argument of -Werror and check it for a wrong language. * opts-global.c (complain_wrong_lang): Remove such case. 2019-07-22 Martin Liska <mliska@suse.cz> Backport from mainline 2019-07-22 Martin Liska <mliska@suse.cz> PR driver/91172 * gcc.dg/pr91172.c: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@273665 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 10 ++++++++++ gcc/opts-common.c | 20 +++++++++++++++++++- gcc/opts-global.c | 6 +++++- gcc/testsuite/ChangeLog | 8 ++++++++ 4 files changed, 42 insertions(+), 2 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 9d5c3699977..7acdf08f4b8 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +2019-07-22 Martin Liska <mliska@suse.cz> + + Backport from mainline + 2019-07-22 Martin Liska <mliska@suse.cz> + + PR driver/91172 + * opts-common.c (decode_cmdline_option): Decode + argument of -Werror and check it for a wrong language. + * opts-global.c (complain_wrong_lang): Remove such case. + 2019-07-21 Richard Sandiford <richard.sandiford@arm.com> Backport from mainline diff --git a/gcc/opts-common.c b/gcc/opts-common.c index c6b94188b40..ac3f9f789e6 100644 --- a/gcc/opts-common.c +++ b/gcc/opts-common.c @@ -463,7 +463,8 @@ decode_cmdline_option (const char **argv, unsigned int lang_mask, extra_args = 0; - opt_index = find_opt (argv[0] + 1, lang_mask); + const char *opt_value = argv[0] + 1; + opt_index = find_opt (opt_value, lang_mask); i = 0; while (opt_index == OPT_SPECIAL_unknown && i < ARRAY_SIZE (option_map)) @@ -666,6 +667,23 @@ decode_cmdline_option (const char **argv, unsigned int lang_mask, /* Check if this is a switch for a different front end. */ if (!option_ok_for_language (option, lang_mask)) errors |= CL_ERR_WRONG_LANG; + else if (strcmp (option->opt_text, "-Werror=") == 0 + && strchr (opt_value, ',') == NULL) + { + /* Verify that -Werror argument is a valid warning + for a language. */ + char *werror_arg = xstrdup (opt_value + 6); + werror_arg[0] = 'W'; + + size_t warning_index = find_opt (werror_arg, lang_mask); + if (warning_index != OPT_SPECIAL_unknown) + { + const struct cl_option *warning_option + = &cl_options[warning_index]; + if (!option_ok_for_language (warning_option, lang_mask)) + errors |= CL_ERR_WRONG_LANG; + } + } /* Convert the argument to lowercase if appropriate. */ if (arg && option->cl_tolower) diff --git a/gcc/opts-global.c b/gcc/opts-global.c index f33c9da4c3f..8bb45a26f83 100644 --- a/gcc/opts-global.c +++ b/gcc/opts-global.c @@ -103,10 +103,14 @@ complain_wrong_lang (const struct cl_decoded_option *decoded, text, bad_lang); else if (lang_mask == CL_DRIVER) gcc_unreachable (); - else + else if (ok_langs[0] != '\0') /* Eventually this should become a hard error IMO. */ warning (0, "command line option %qs is valid for %s but not for %s", text, ok_langs, bad_lang); + else + /* Happens for -Werror=warning_name. */ + warning (0, "%<-Werror=%> argument %qs is not valid for %s", + text, bad_lang); free (ok_langs); free (bad_lang); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 618d43b6864..4f6a34d88fd 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2019-07-22 Martin Liska <mliska@suse.cz> + + Backport from mainline + 2019-07-22 Martin Liska <mliska@suse.cz> + + PR driver/91172 + * gcc.dg/pr91172.c: New test. + 2019-07-21 Richard Sandiford <richard.sandiford@arm.com> Backport from mainline -- cgit v1.2.3 From 63eafd371b42d83bcdb303649cb7660fc65dd29d Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Tue, 23 Jul 2019 00:16:10 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@273710 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 924bff94750..0d94c837042 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190722 +20190723 -- cgit v1.2.3 From b20ff773fda41521e42799180f9b983d88da32ba Mon Sep 17 00:00:00 2001 From: Richard Biener <rguenther@suse.de> Date: Tue, 23 Jul 2019 12:14:27 +0000 Subject: 2019-07-23 Richard Biener <rguenther@suse.de> PR debug/91231 * lto-streamer-in.c (input_function): Drop inline-entry markers that ended up with an unknown location block. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@273736 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 6 ++++++ gcc/lto-streamer-in.c | 8 ++++++++ 2 files changed, 14 insertions(+) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 7acdf08f4b8..4bc116bce11 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2019-07-23 Richard Biener <rguenther@suse.de> + + PR debug/91231 + * lto-streamer-in.c (input_function): Drop inline-entry markers + that ended up with an unknown location block. + 2019-07-22 Martin Liska <mliska@suse.cz> Backport from mainline diff --git a/gcc/lto-streamer-in.c b/gcc/lto-streamer-in.c index 8529c82376b..14752d2cc25 100644 --- a/gcc/lto-streamer-in.c +++ b/gcc/lto-streamer-in.c @@ -1131,6 +1131,14 @@ input_function (tree fn_decl, struct data_in *data_in, ? !MAY_HAVE_DEBUG_MARKER_STMTS : !MAY_HAVE_DEBUG_BIND_STMTS)) remove = true; + /* In case the linemap overflows locations can be dropped + to zero. Thus do not keep nonsensical inline entry markers + we'd later ICE on. */ + tree block; + if (gimple_debug_inline_entry_p (stmt) + && (block = gimple_block (stmt)) + && !inlined_function_outer_scope_p (block)) + remove = true; if (is_gimple_call (stmt) && gimple_call_internal_p (stmt)) { -- cgit v1.2.3 From 74124284c71b4d63e80523f3bb911efab793151a Mon Sep 17 00:00:00 2001 From: Matthew Beliveau <mbelivea@redhat.com> Date: Tue, 23 Jul 2019 15:52:48 +0000 Subject: PR rtl-optimization/91173 Backported from mainline 2019-07-16 Jeff Law <law@redhat.com> PR rtl-optimization/91173 * tree-ssa-address.c (addr_for_mem_ref): If the base is an SSA_NAME with a constant value, fold its value into the offset and clear the base before calling gen_addr_rtx. * g++.dg/pr91173.C: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@273740 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 11 +++++++++++ gcc/testsuite/g++.dg/pr91173.C | 45 ++++++++++++++++++++++++++++++++++++++++++ gcc/tree-ssa-address.c | 14 +++++++++++++ 3 files changed, 70 insertions(+) create mode 100644 gcc/testsuite/g++.dg/pr91173.C diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4bc116bce11..78ddae37600 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,14 @@ +2019-07-23 Matthew Beliveau <mbelivea@redhat.com> + + Backported from mainline + 2019-07-16 Jeff Law <law@redhat.com> + + PR rtl-optimization/91173 + * tree-ssa-address.c (addr_for_mem_ref): If the base is an + SSA_NAME with a constant value, fold its value into the offset + and clear the base before calling gen_addr_rtx. + * g++.dg/pr91173.C: New test. + 2019-07-23 Richard Biener <rguenther@suse.de> PR debug/91231 diff --git a/gcc/testsuite/g++.dg/pr91173.C b/gcc/testsuite/g++.dg/pr91173.C new file mode 100644 index 00000000000..b8fb41ba0cd --- /dev/null +++ b/gcc/testsuite/g++.dg/pr91173.C @@ -0,0 +1,45 @@ +class a { + int b; + void *c; + +public: + bool aa(); + int &ab() { + if (aa()) { + void *d(c); + return static_cast<int *>(d)[b]; + } + return *(int *)0; + } +}; +typedef enum {E} e; +class f : public a { + int g; + +public: + int ac() { + if (g) + return 1; + return ac(); + } +}; +int *ad; +struct h { + static int ae(e, int *m) { + f ag; + int *ah; + while (!0) { + ad = &ag.ab(); + ah = ad + ag.ac(); + while (ad < ah) + *m = *ad++; + } + } +}; +template <class, class> +void i(int *, int *, int, int *, e n, int *o) { + h::ae(n, o); +} +int aq, ar, as, at, au; +void aw() { i<int, bool>(&aq, &ar, as, &at, (e)0, &au); } + diff --git a/gcc/tree-ssa-address.c b/gcc/tree-ssa-address.c index c8ff8514529..aa4202d5345 100644 --- a/gcc/tree-ssa-address.c +++ b/gcc/tree-ssa-address.c @@ -259,6 +259,20 @@ addr_for_mem_ref (struct mem_address *addr, addr_space_t as, ? expand_expr (addr->index, NULL_RTX, pointer_mode, EXPAND_NORMAL) : NULL_RTX); + /* addr->base could be an SSA_NAME that was set to a constant value. The + call to expand_expr may expose that constant. If so, fold the value + into OFF and clear BSE. Otherwise we may later try to pull a mode from + BSE to generate a REG, which won't work with constants because they + are modeless. */ + if (bse && GET_CODE (bse) == CONST_INT) + { + if (off) + off = simplify_gen_binary (PLUS, pointer_mode, bse, off); + else + off = bse; + gcc_assert (GET_CODE (off) == CONST_INT); + bse = NULL_RTX; + } gen_addr_rtx (pointer_mode, sym, bse, idx, st, off, &address, NULL, NULL); if (pointer_mode != address_mode) address = convert_memory_address (address_mode, address); -- cgit v1.2.3 From 5a59784d6580e2c286c79e2dcd589548836d56ea Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Wed, 24 Jul 2019 00:16:16 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@273751 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 0d94c837042..23fe32c3102 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190723 +20190724 -- cgit v1.2.3 From 184f6ae14976de626ae21aa385b95102cdad3422 Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Thu, 25 Jul 2019 00:16:09 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@273780 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 23fe32c3102..ff8fbf00694 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190724 +20190725 -- cgit v1.2.3 From e5f23a111b1b76223379279c7e4ba3621996c3e3 Mon Sep 17 00:00:00 2001 From: Richard Biener <rguenther@suse.de> Date: Thu, 25 Jul 2019 10:48:26 +0000 Subject: 2019-07-25 Richard Biener <rguenther@suse.de> PR lto/90924 Backport from mainline 2019-07-12 Ren Kimura <rkx1209dev@gmail.com> * simple-object-elf.c (simple_object_elf_match): Check zero value shstrndx. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@273794 138bc75d-0d04-0410-961f-82ee72b054a4 --- libiberty/ChangeLog | 9 +++++++++ libiberty/simple-object-elf.c | 8 ++++++++ 2 files changed, 17 insertions(+) diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog index 1dd05da95c8..2a9f43014d5 100644 --- a/libiberty/ChangeLog +++ b/libiberty/ChangeLog @@ -1,3 +1,12 @@ +2019-07-25 Richard Biener <rguenther@suse.de> + + PR lto/90924 + Backport from mainline + 2019-07-12 Ren Kimura <rkx1209dev@gmail.com> + + * simple-object-elf.c (simple_object_elf_match): Check zero value + shstrndx. + 2019-02-22 Release Manager * GCC 8.3.0 released. diff --git a/libiberty/simple-object-elf.c b/libiberty/simple-object-elf.c index 021ce488c16..0505c1dc001 100644 --- a/libiberty/simple-object-elf.c +++ b/libiberty/simple-object-elf.c @@ -549,6 +549,14 @@ simple_object_elf_match (unsigned char header[SIMPLE_OBJECT_MATCH_HEADER_LEN], return NULL; } + if (eor->shstrndx == 0) + { + *errmsg = "invalid ELF shstrndx == 0"; + *err = 0; + XDELETE (eor); + return NULL; + } + return (void *) eor; } -- cgit v1.2.3 From 7b21ef4014bc3bc692d01f00b35449ad9e8b7401 Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Fri, 26 Jul 2019 00:16:17 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@273821 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index ff8fbf00694..dd882a3b82d 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190725 +20190726 -- cgit v1.2.3 From 415f24b4c5ec475b8751c19cfe4477fe4893a583 Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Sat, 27 Jul 2019 00:16:22 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@273841 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index dd882a3b82d..5c9c62d658c 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190726 +20190727 -- cgit v1.2.3 From 04e7c63695fdc5007ad42d01f1802153e4259b44 Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Sun, 28 Jul 2019 00:16:50 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@273848 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 5c9c62d658c..a12bd15f11e 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190727 +20190728 -- cgit v1.2.3 From 19c55a66930dbed0b082f9a4204150bcb60aedc6 Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Mon, 29 Jul 2019 00:16:11 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@273862 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index a12bd15f11e..50af05a9649 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190728 +20190729 -- cgit v1.2.3 From 1052c808078c024484a4b8720b62e4e32bad5f45 Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Tue, 30 Jul 2019 00:16:08 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@273894 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 50af05a9649..046ca7d7e44 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190729 +20190730 -- cgit v1.2.3 From a8a4c7ca75c4094abe1234044924f79c45f852c2 Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Wed, 31 Jul 2019 00:16:15 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@273918 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 046ca7d7e44..733558531ba 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190730 +20190731 -- cgit v1.2.3 From c6d70010da0a13de10d024b18422c63861471687 Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Thu, 1 Aug 2019 00:16:11 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@273958 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 733558531ba..e496c36a0c6 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190731 +20190801 -- cgit v1.2.3 From 62459857538a56d004a4d9f9ae85c365e3796ace Mon Sep 17 00:00:00 2001 From: Marek Polacek <polacek@redhat.com> Date: Thu, 1 Aug 2019 14:37:08 +0000 Subject: PR c++/89906 - ICE with template placeholder for TTP. PR c++/86098 - ICE with template placeholder for TTP. * typeck.c (structural_comptypes) [TEMPLATE_TYPE_PARM]: Check CLASS_PLACEHOLDER_TEMPLATE. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@273974 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cp/ChangeLog | 9 +++++++++ gcc/cp/typeck.c | 5 +++++ gcc/testsuite/g++.dg/cpp1z/class-deduction58.C | 16 ++++++++++++++++ 3 files changed, 30 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp1z/class-deduction58.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 6b6a5c32052..c5337e6cd3d 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,12 @@ +2019-08-01 Marek Polacek <polacek@redhat.com> + + Backported from mainline + 2018-06-12 Jason Merrill <jason@redhat.com> + + PR c++/86098 - ICE with template placeholder for TTP. + * typeck.c (structural_comptypes) [TEMPLATE_TYPE_PARM]: Check + CLASS_PLACEHOLDER_TEMPLATE. + 2019-06-11 Jakub Jelinek <jakub@redhat.com> PR c++/90810 diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index 69a206b6d24..62f9ba09bf4 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -1384,6 +1384,11 @@ structural_comptypes (tree t1, tree t2, int strict) template parameters set, they can't be equal. */ if (!comp_template_parms_position (t1, t2)) return false; + /* If T1 and T2 don't represent the same class template deduction, + they aren't equal. */ + if (CLASS_PLACEHOLDER_TEMPLATE (t1) + != CLASS_PLACEHOLDER_TEMPLATE (t2)) + return false; /* Constrained 'auto's are distinct from parms that don't have the same constraints. */ if (!equivalent_placeholder_constraints (t1, t2)) diff --git a/gcc/testsuite/g++.dg/cpp1z/class-deduction58.C b/gcc/testsuite/g++.dg/cpp1z/class-deduction58.C new file mode 100644 index 00000000000..82c3f83710f --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1z/class-deduction58.C @@ -0,0 +1,16 @@ +// PR c++/86098 +// { dg-additional-options -std=c++17 } + +template <class _Res> class future; +template <class T> T&& declval(); + +template<template <class...> class T> +struct construct_deduced { + template <class... AN> + using deduced_t = decltype(T{declval<AN>()...}); + template<class... AN> + deduced_t<AN...> operator()(AN&&... an) const; +}; + +template<class T> +future<T> future_from(T singleSender); -- cgit v1.2.3 From d7066d2b968e0a04c71911539c644b6758cee96c Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Fri, 2 Aug 2019 00:16:08 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@273991 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index e496c36a0c6..19b8b4aa202 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190801 +20190802 -- cgit v1.2.3 From 103e8fdaa9a0d45a69497dd334181275157399e9 Mon Sep 17 00:00:00 2001 From: Thomas Koenig <tkoenig@gcc.gnu.org> Date: Fri, 2 Aug 2019 17:51:45 +0000 Subject: 2019-08-02 Thomas Koenig <tkoenig@gcc.gnu.org> Paul Thomas <pault@gcc.gnu.org> Backport from trunk PR fortran/90786 PR fortran/90813 * trans-expr.c (pointer_assignment_is_proc_pointer) Remove as it is very simple and only called from one place. (gfc_trans_pointer_assignment): Rename non_proc_pointer_assign as non_proc_ptr_assign. Assign to it directly, rather than call to above, deleted function and use gfc_expr_attr instead of only checking the reference chain. * trans-decl.c (sym_identifier): New function. (mangled_identifier): New function, doing most of the work of gfc_sym_mangled_identifier. (gfc_sym_mangled_identifier): Use mangled_identifier. Add mangled identifier to global symbol table. (get_proc_pointer_decl): Use backend decl from global identifier if present. 2019-08-02 Thomas Koenig <tkoenig@gcc.gnu.org> Paul Thomas <pault@gcc.gnu.org> Backport from trunk PR fortran/90786 PR fortran/90813 * gfortran.dg/proc_ptr_51.f90: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@274026 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fortran/ChangeLog | 20 +++++++++ gcc/fortran/trans-decl.c | 75 ++++++++++++++++++++++++------- gcc/fortran/trans-expr.c | 27 +++-------- gcc/testsuite/ChangeLog | 8 ++++ gcc/testsuite/gfortran.dg/proc_ptr_51.f90 | 38 ++++++++++++++++ 5 files changed, 132 insertions(+), 36 deletions(-) create mode 100644 gcc/testsuite/gfortran.dg/proc_ptr_51.f90 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index a16c46adc74..50dbf8020a5 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,23 @@ +2019-08-02 Thomas Koenig <tkoenig@gcc.gnu.org> + Paul Thomas <pault@gcc.gnu.org> + + Backport from trunk + PR fortran/90786 + PR fortran/90813 + * trans-expr.c (pointer_assignment_is_proc_pointer) Remove as + it is very simple and only called from one place. + (gfc_trans_pointer_assignment): Rename non_proc_pointer_assign + as non_proc_ptr_assign. Assign to it directly, rather than call + to above, deleted function and use gfc_expr_attr instead of + only checking the reference chain. + * trans-decl.c (sym_identifier): New function. + (mangled_identifier): New function, doing most of the work + of gfc_sym_mangled_identifier. + (gfc_sym_mangled_identifier): Use mangled_identifier. Add mangled + identifier to global symbol table. + (get_proc_pointer_decl): Use backend decl from global identifier + if present. + 2019-07-07 Paul Thomas <pault@gcc.gnu.org> Backport from trunk diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c index 79e9cc69974..8ccadaf9a17 100644 --- a/gcc/fortran/trans-decl.c +++ b/gcc/fortran/trans-decl.c @@ -342,39 +342,45 @@ gfc_get_label_decl (gfc_st_label * lp) } } +/* Return the name of an identifier. */ -/* Convert a gfc_symbol to an identifier of the same name. */ - -static tree -gfc_sym_identifier (gfc_symbol * sym) +static const char * +sym_identifier (gfc_symbol *sym) { if (sym->attr.is_main_program && strcmp (sym->name, "main") == 0) - return (get_identifier ("MAIN__")); + return "MAIN__"; else - return (get_identifier (sym->name)); + return sym->name; } - -/* Construct mangled name from symbol name. */ +/* Convert a gfc_symbol to an identifier of the same name. */ static tree -gfc_sym_mangled_identifier (gfc_symbol * sym) +gfc_sym_identifier (gfc_symbol * sym) { - char name[GFC_MAX_MANGLED_SYMBOL_LEN + 1]; + return get_identifier (sym_identifier (sym)); +} +/* Construct mangled name from symbol name. */ + +static const char * +mangled_identifier (gfc_symbol *sym) +{ + static char name[GFC_MAX_MANGLED_SYMBOL_LEN + 1]; /* Prevent the mangling of identifiers that have an assigned binding label (mainly those that are bind(c)). */ + if (sym->attr.is_bind_c == 1 && sym->binding_label) - return get_identifier (sym->binding_label); + return sym->binding_label; if (!sym->fn_result_spec) { if (sym->module == NULL) - return gfc_sym_identifier (sym); + return sym_identifier (sym); else { snprintf (name, sizeof name, "__%s_MOD_%s", sym->module, sym->name); - return get_identifier (name); + return name; } } else @@ -389,17 +395,40 @@ gfc_sym_mangled_identifier (gfc_symbol * sym) sym->ns->proc_name->module, sym->ns->proc_name->name, sym->name); - return get_identifier (name); + return name; } else { snprintf (name, sizeof name, "__%s_PROC_%s", sym->ns->proc_name->name, sym->name); - return get_identifier (name); + return name; } } } +/* Get mangled identifier, adding the symbol to the global table if + it is not yet already there. */ + +static tree +gfc_sym_mangled_identifier (gfc_symbol * sym) +{ + tree result; + gfc_gsymbol *gsym; + const char *name; + + name = mangled_identifier (sym); + result = get_identifier (name); + + gsym = gfc_find_gsymbol (gfc_gsym_root, name); + if (gsym == NULL) + { + gsym = gfc_get_gsymbol (name, false); + gsym->ns = sym->ns; + gsym->sym_name = sym->name; + } + + return result; +} /* Construct mangled function name from symbol name. */ @@ -1905,6 +1934,22 @@ get_proc_pointer_decl (gfc_symbol *sym) tree decl; tree attributes; + if (sym->module || sym->fn_result_spec) + { + const char *name; + gfc_gsymbol *gsym; + + name = mangled_identifier (sym); + gsym = gfc_find_gsymbol (gfc_gsym_root, name); + if (gsym != NULL) + { + gfc_symbol *s; + gfc_find_symbol (sym->name, gsym->ns, 0, &s); + if (s && s->backend_decl) + return s->backend_decl; + } + } + decl = sym->backend_decl; if (decl) return decl; diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c index b95cf8ddc4f..dd0cd86ebba 100644 --- a/gcc/fortran/trans-expr.c +++ b/gcc/fortran/trans-expr.c @@ -8389,23 +8389,6 @@ trans_caf_token_assign (gfc_se *lse, gfc_se *rse, gfc_expr *expr1, } } -/* Indentify class valued proc_pointer assignments. */ - -static bool -pointer_assignment_is_proc_pointer (gfc_expr * expr1, gfc_expr * expr2) -{ - gfc_ref * ref; - - ref = expr1->ref; - while (ref && ref->next) - ref = ref->next; - - return ref && ref->type == REF_COMPONENT - && ref->u.c.component->attr.proc_pointer - && expr2->expr_type == EXPR_VARIABLE - && expr2->symtree->n.sym->attr.flavor == FL_PROCEDURE; -} - /* Do everything that is needed for a CLASS function expr2. */ @@ -8458,7 +8441,7 @@ gfc_trans_pointer_assignment (gfc_expr * expr1, gfc_expr * expr2) tree desc; tree tmp; tree expr1_vptr = NULL_TREE; - bool scalar, non_proc_pointer_assign; + bool scalar, non_proc_ptr_assign; gfc_ss *ss; gfc_start_block (&block); @@ -8466,7 +8449,9 @@ gfc_trans_pointer_assignment (gfc_expr * expr1, gfc_expr * expr2) gfc_init_se (&lse, NULL); /* Usually testing whether this is not a proc pointer assignment. */ - non_proc_pointer_assign = !pointer_assignment_is_proc_pointer (expr1, expr2); + non_proc_ptr_assign = !(gfc_expr_attr (expr1).proc_pointer + && expr2->expr_type == EXPR_VARIABLE + && expr2->symtree->n.sym->attr.flavor == FL_PROCEDURE); /* Check whether the expression is a scalar or not; we cannot use expr1->rank as it can be nonzero for proc pointers. */ @@ -8476,7 +8461,7 @@ gfc_trans_pointer_assignment (gfc_expr * expr1, gfc_expr * expr2) gfc_free_ss_chain (ss); if (expr1->ts.type == BT_DERIVED && expr2->ts.type == BT_CLASS - && expr2->expr_type != EXPR_FUNCTION && non_proc_pointer_assign) + && expr2->expr_type != EXPR_FUNCTION && non_proc_ptr_assign) { gfc_add_data_component (expr2); /* The following is required as gfc_add_data_component doesn't @@ -8496,7 +8481,7 @@ gfc_trans_pointer_assignment (gfc_expr * expr1, gfc_expr * expr2) else gfc_conv_expr (&rse, expr2); - if (non_proc_pointer_assign && expr1->ts.type == BT_CLASS) + if (non_proc_ptr_assign && expr1->ts.type == BT_CLASS) { trans_class_vptr_len_assignment (&block, expr1, expr2, &rse, NULL, NULL); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 4f6a34d88fd..55c108866f2 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2019-08-02 Thomas Koenig <tkoenig@gcc.gnu.org> + Paul Thomas <pault@gcc.gnu.org> + + Backport from trunk + PR fortran/90786 + PR fortran/90813 + * gfortran.dg/proc_ptr_51.f90: New test. + 2019-07-22 Martin Liska <mliska@suse.cz> Backport from mainline diff --git a/gcc/testsuite/gfortran.dg/proc_ptr_51.f90 b/gcc/testsuite/gfortran.dg/proc_ptr_51.f90 new file mode 100644 index 00000000000..62b5d71e30b --- /dev/null +++ b/gcc/testsuite/gfortran.dg/proc_ptr_51.f90 @@ -0,0 +1,38 @@ +! { dg-do run } +! +! Test the fix for PR90786. +! +! Contributed by Andrew benson <abensonca@gmail.com> +! +module f +procedure(c), pointer :: c_ + + type :: s + integer :: i = 42 + end type s + class(s), pointer :: res, tgt + +contains + + function c() + implicit none + class(s), pointer :: c + c => tgt + return + end function c + + subroutine fs() + implicit none + c_ => c ! This used to ICE + return + end subroutine fs + +end module f + + use f + allocate (tgt, source = s(99)) + call fs() + res => c_() + if (res%i .ne. 99) stop 1 + deallocate (tgt) +end -- cgit v1.2.3 From bd0ecdc80d77e56391137e48e77e7aa55031622b Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Sat, 3 Aug 2019 00:16:08 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@274035 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 19b8b4aa202..a2066bab3b9 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190802 +20190803 -- cgit v1.2.3 From 4931841dd33e95a3a084840006c23538bde40e93 Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Sun, 4 Aug 2019 00:16:08 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@274052 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index a2066bab3b9..cdfb964ad78 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190803 +20190804 -- cgit v1.2.3 From b6a65084252f8fc73ade89035c6c7664b1977f4d Mon Sep 17 00:00:00 2001 From: Segher Boessenkool <segher@kernel.crashing.org> Date: Sun, 4 Aug 2019 19:25:47 +0000 Subject: Backport from trunk 2019-05-02 Segher Boessenkool <segher@kernel.crashing.org> * config/rs6000/rs6000.c (rs6000_dbx_register_number): Return the correct numbers for TFHAR, TFIAR, TEXASR. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@274098 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 8 ++++++++ gcc/config/rs6000/rs6000.c | 22 +++++++++++++++++++--- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 78ddae37600..f0cc7f1c692 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2019-08-04 Segher Boessenkool <segher@kernel.crashing.org> + + Backport from trunk + 2019-05-02 Segher Boessenkool <segher@kernel.crashing.org> + + * config/rs6000/rs6000.c (rs6000_dbx_register_number): Return the + correct numbers for TFHAR, TFIAR, TEXASR. + 2019-07-23 Matthew Beliveau <mbelivea@redhat.com> Backported from mainline diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 79dc864ffa1..bca3ad7bb94 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -36637,10 +36637,20 @@ rs6000_init_dwarf_reg_sizes_extra (tree address) unsigned int rs6000_dbx_register_number (unsigned int regno, unsigned int format) { - /* Except for the above, we use the internal number for non-DWARF - debug information, and also for .eh_frame. */ + /* We use the GCC 7 (and before) internal number for non-DWARF debug + information, and also for .eh_frame. */ if ((format == 0 && write_symbols != DWARF2_DEBUG) || format == 2) - return regno; + { + /* Translate the regnos to their numbers in GCC 7 (and before). */ + if (regno == TFHAR_REGNO) + regno = 114; + else if (regno == TFIAR_REGNO) + regno = 115; + else if (regno == TEXASR_REGNO) + regno = 116; + + return regno; + } /* On some platforms, we use the standard DWARF register numbering for .debug_info and .debug_frame. */ @@ -36667,6 +36677,12 @@ rs6000_dbx_register_number (unsigned int regno, unsigned int format) return 356; if (regno == VSCR_REGNO) return 67; + if (regno == TFHAR_REGNO) + return 228; + if (regno == TFIAR_REGNO) + return 229; + if (regno == TEXASR_REGNO) + return 230; #endif return regno; } -- cgit v1.2.3 From 66b02be8aa8c9c687aca05604c599200a565da7c Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Mon, 5 Aug 2019 00:16:15 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@274101 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index cdfb964ad78..a5958f35c3f 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190804 +20190805 -- cgit v1.2.3 From c173202544206f5817e0df093beaed78ed5a9cf8 Mon Sep 17 00:00:00 2001 From: Kito Cheng <kito.cheng@sifive.com> Date: Mon, 5 Aug 2019 10:44:19 +0000 Subject: RISC-V: Promote type correctly for libcalls - argument and return value for libcall won't promote at default_promote_function_mode_always_promote, however we expect it should sign-extend as normal function. - Witout this patch, this test case will fail at -march=rv64i -mabi=lp64. - The implementation of riscv_promote_function_mode is borrowed from MIPS. gcc/ChangeLog * config/riscv/riscv.c (riscv_promote_function_mode): New. (TARGET_PROMOTE_FUNCTION_MODE): Use riscv_promote_function_mode. gcc/testsuite/ChangeLog * gcc.target/riscv/promote-type-for-libcall.c: New. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@274113 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 8 +++++ gcc/config/riscv/riscv.c | 28 +++++++++++++++- gcc/testsuite/ChangeLog | 7 ++++ .../gcc.target/riscv/promote-type-for-libcall.c | 37 ++++++++++++++++++++++ 4 files changed, 79 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.target/riscv/promote-type-for-libcall.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f0cc7f1c692..bfee2ed78c0 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2019-08-05 Kito Cheng <kito.cheng@sifive.com> + + Backport from mainline + 2019-08-05 Kito Cheng <kito.cheng@sifive.com> + + * config/riscv/riscv.c (riscv_promote_function_mode): New. + (TARGET_PROMOTE_FUNCTION_MODE): Use riscv_promote_function_mode. + 2019-08-04 Segher Boessenkool <segher@kernel.crashing.org> Backport from trunk diff --git a/gcc/config/riscv/riscv.c b/gcc/config/riscv/riscv.c index 2a8f87d1e94..606d9aa7441 100644 --- a/gcc/config/riscv/riscv.c +++ b/gcc/config/riscv/riscv.c @@ -4389,6 +4389,32 @@ riscv_constant_alignment (const_tree exp, HOST_WIDE_INT align) return align; } +/* Implement TARGET_PROMOTE_FUNCTION_MODE. */ + +/* This function is equivalent to default_promote_function_mode_always_promote + except that it returns a promoted mode even if type is NULL_TREE. This is + needed by libcalls which have no type (only a mode) such as fixed conversion + routines that take a signed or unsigned char/short/int argument and convert + it to a fixed type. */ + +static machine_mode +riscv_promote_function_mode (const_tree type ATTRIBUTE_UNUSED, + machine_mode mode, + int *punsignedp ATTRIBUTE_UNUSED, + const_tree fntype ATTRIBUTE_UNUSED, + int for_return ATTRIBUTE_UNUSED) +{ + int unsignedp; + + if (type != NULL_TREE) + return promote_mode (type, mode, punsignedp); + + unsignedp = *punsignedp; + PROMOTE_MODE (mode, unsignedp, type); + *punsignedp = unsignedp; + return mode; +} + /* Initialize the GCC target structure. */ #undef TARGET_ASM_ALIGNED_HI_OP #define TARGET_ASM_ALIGNED_HI_OP "\t.half\t" @@ -4430,7 +4456,7 @@ riscv_constant_alignment (const_tree exp, HOST_WIDE_INT align) #define TARGET_EXPAND_BUILTIN_VA_START riscv_va_start #undef TARGET_PROMOTE_FUNCTION_MODE -#define TARGET_PROMOTE_FUNCTION_MODE default_promote_function_mode_always_promote +#define TARGET_PROMOTE_FUNCTION_MODE riscv_promote_function_mode #undef TARGET_RETURN_IN_MEMORY #define TARGET_RETURN_IN_MEMORY riscv_return_in_memory diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 55c108866f2..ad70fb1207b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2019-08-05 Kito Cheng <kito.cheng@sifive.com> + + Backport from mainline + 2019-08-05 Kito Cheng <kito.cheng@sifive.com> + + * gcc.target/riscv/promote-type-for-libcall.c: New. + 2019-08-02 Thomas Koenig <tkoenig@gcc.gnu.org> Paul Thomas <pault@gcc.gnu.org> diff --git a/gcc/testsuite/gcc.target/riscv/promote-type-for-libcall.c b/gcc/testsuite/gcc.target/riscv/promote-type-for-libcall.c new file mode 100644 index 00000000000..bdbcbc0316a --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/promote-type-for-libcall.c @@ -0,0 +1,37 @@ +/* { dg-do run } */ +/* { dg-options "-O1 -ftree-slp-vectorize -funroll-loops" } */ + +#include <stdio.h> +#include <stdlib.h> +#define N 4 +volatile float f[N]; +int x[N] __attribute__((aligned(8))); +int main() { + int i; + x[0] = -1; + x[1] = 2; + x[2] = -2; + x[3] = 2; + + for (i=0;i<N;++i){ + f[i] = x[i]; + } + + if (f[0] != -1.0f) { + abort(); + } + + if (f[1] != 2.0f) { + abort(); + } + + if (f[2] != -2.0f) { + abort(); + } + + if (f[3] != 2.0f) { + abort(); + } + + return 0; +} -- cgit v1.2.3 From ed27503204cf5450b8c4ee7051c08404f9d66985 Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Tue, 6 Aug 2019 00:16:10 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@274132 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index a5958f35c3f..ea3614c5ea3 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190805 +20190806 -- cgit v1.2.3 From 26755e7a3fbf80c9cb3443862ad93bbae8d0fd1c Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Wed, 7 Aug 2019 00:16:17 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@274153 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index ea3614c5ea3..4172572edbb 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190806 +20190807 -- cgit v1.2.3 From b37e51540a5a7b3271c136f1116eb2265f81bf01 Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Thu, 8 Aug 2019 00:16:09 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@274203 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 4172572edbb..230187918a4 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190807 +20190808 -- cgit v1.2.3 From c5385429d14c2750bae641ff36fded1eba82086a Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Fri, 9 Aug 2019 00:16:08 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@274222 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 230187918a4..cf7723000e8 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190808 +20190809 -- cgit v1.2.3 From e7d770094559ce422d8907725e5c188f24d839c9 Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Sat, 10 Aug 2019 00:16:12 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@274246 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index cf7723000e8..e9ef7cee499 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190809 +20190810 -- cgit v1.2.3 From b2d5e2fadfafec125de509ab8c3e04882ab5d88d Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Sun, 11 Aug 2019 00:16:17 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@274259 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index e9ef7cee499..8507a47b702 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190810 +20190811 -- cgit v1.2.3 From 7f2b4db9d6290e464c735f01b4777bbd7e2dc408 Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Mon, 12 Aug 2019 00:16:17 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@274270 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 8507a47b702..29561a58420 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190811 +20190812 -- cgit v1.2.3 From 6d492acea24ce361f77e9c44fb3c57ce2826fb49 Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Tue, 13 Aug 2019 00:16:08 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@274325 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 29561a58420..ee7c0ee9303 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190812 +20190813 -- cgit v1.2.3 From 7b31bc34c2950f5761a2d71b61017899e70ba1a1 Mon Sep 17 00:00:00 2001 From: Janne Blomqvist <jb@gcc.gnu.org> Date: Tue, 13 Aug 2019 09:00:46 +0000 Subject: PR fortran/91414 Improve initialization of PRNG As part of PR 91414 an improved PRNG was contributed to trunk. This is a partial backport of some related changes to the PRNG. Namely when seeding the PRNG, it needs only 8 bytes of randomness from the OS, and uses a simple splitmix64 PRNG to fill in the rest of the state, instead of getting all the state from the OS. This can be useful for operating systems that can run out of entropy. libgfortran/ChangeLog: 2019-08-13 Janne Blomqvist <jb@gcc.gnu.org> Partial backport from trunk PR fortran/91414 * intrinsics/random.c (lcg_parkmiller): Replace with splitmix64. (splitmix64): New function. (getosrandom): Fix return value, simplify. (init_rand_state): Use getosrandom only to get 8 bytes, splitmix64 to fill rest of state. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@274363 138bc75d-0d04-0410-961f-82ee72b054a4 --- libgfortran/ChangeLog | 10 +++++++++ libgfortran/intrinsics/random.c | 49 +++++++++++++++++------------------------ 2 files changed, 30 insertions(+), 29 deletions(-) diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index a763d351508..813f53d3d50 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,13 @@ +2019-08-13 Janne Blomqvist <jb@gcc.gnu.org> + + Partial backport from trunk + PR fortran/91414 + * intrinsics/random.c (lcg_parkmiller): Replace with splitmix64. + (splitmix64): New function. + (getosrandom): Simplify. + (init_rand_state): Use getosrandom only to get 8 bytes, splitmix64 + to fill rest of state. + 2019-04-16 John David Anglin <danglin@gcc.gnu.org> Backport from mainline diff --git a/libgfortran/intrinsics/random.c b/libgfortran/intrinsics/random.c index 234c5ff95fd..4a40ce454ed 100644 --- a/libgfortran/intrinsics/random.c +++ b/libgfortran/intrinsics/random.c @@ -272,30 +272,19 @@ jump (xorshift1024star_state* rs) } -/* Super-simple LCG generator used in getosrandom () if /dev/urandom - doesn't exist. */ +/* Splitmix64 recommended by xorshift author for initializing. After + getting one uint64_t value from the OS, this is used to fill in the + rest of the state. */ -#define M 2147483647 /* 2^31 - 1 (A large prime number) */ -#define A 16807 /* Prime root of M, passes statistical tests and produces a full cycle */ -#define Q 127773 /* M / A (To avoid overflow on A * seed) */ -#define R 2836 /* M % A (To avoid overflow on A * seed) */ - -__attribute__((unused)) static uint32_t -lcg_parkmiller(uint32_t seed) +static uint64_t +splitmix64 (uint64_t x) { - uint32_t hi = seed / Q; - uint32_t lo = seed % Q; - int32_t test = A * lo - R * hi; - if (test <= 0) - test += M; - return test; + uint64_t z = (x += 0x9e3779b97f4a7c15); + z = (z ^ (z >> 30)) * 0xbf58476d1ce4e5b9; + z = (z ^ (z >> 27)) * 0x94d049bb133111eb; + return z ^ (z >> 31); } -#undef M -#undef A -#undef Q -#undef R - /* Get some random bytes from the operating system in order to seed the PRNG. */ @@ -326,7 +315,7 @@ getosrandom (void *buf, size_t buflen) close (fd); return res; } - uint32_t seed = 1234567890; + uint64_t seed = 0x047f7684e9fc949dULL; time_t secs; long usecs; if (gf_gettime (&secs, &usecs) == 0) @@ -338,13 +327,9 @@ getosrandom (void *buf, size_t buflen) pid_t pid = getpid(); seed ^= pid; #endif - uint32_t* ub = buf; - for (size_t i = 0; i < buflen / sizeof (uint32_t); i++) - { - ub[i] = seed; - seed = lcg_parkmiller (seed); - } - return buflen; + size_t size = buflen < sizeof (uint64_t) ? buflen : sizeof (uint64_t); + memcpy (buf, &seed, size); + return size; #endif /* __MINGW64_VERSION_MAJOR */ } @@ -359,7 +344,13 @@ init_rand_state (xorshift1024star_state* rs, const bool locked) __gthread_mutex_lock (&random_lock); if (!master_init) { - getosrandom (master_state, sizeof (master_state)); + uint64_t os_seed; + getosrandom (&os_seed, sizeof (os_seed)); + for (uint64_t i = 0; i < sizeof (master_state) / sizeof (uint64_t); i++) + { + os_seed = splitmix64 (os_seed); + master_state[i] = os_seed; + } njumps = 0; master_init = true; } -- cgit v1.2.3 From a60063ef0fadc1e359768fab54d81ff79b37cf74 Mon Sep 17 00:00:00 2001 From: Thomas Koenig <tkoenig@gcc.gnu.org> Date: Tue, 13 Aug 2019 22:57:31 +0000 Subject: 2013-08-13 Thomas Koenig <tkoenig@gcc.gnu.org> Backport from trunk PR fortran/90563 * frontend-passes.c (insert_index): Suppress errors while simplifying the resulting expression. 2013-08-13 Thomas Koenig <tkoenig@gcc.gnu.org> Backport from trunk PR fortran/90563 * gfortran.dg/do_subscript_5.f90: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@274406 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fortran/ChangeLog | 7 +++++++ gcc/fortran/frontend-passes.c | 5 +++++ gcc/testsuite/ChangeLog | 6 ++++++ gcc/testsuite/gfortran.dg/do_subscript_5.f90 | 20 ++++++++++++++++++++ 4 files changed, 38 insertions(+) create mode 100644 gcc/testsuite/gfortran.dg/do_subscript_5.f90 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 50dbf8020a5..7e530bfd832 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,10 @@ +2013-08-13 Thomas Koenig <tkoenig@gcc.gnu.org> + + Backport from trunk + PR fortran/90563 + * frontend-passes.c (insert_index): Suppress errors while + simplifying the resulting expression. + 2019-08-02 Thomas Koenig <tkoenig@gcc.gnu.org> Paul Thomas <pault@gcc.gnu.org> diff --git a/gcc/fortran/frontend-passes.c b/gcc/fortran/frontend-passes.c index 1394fbcdf58..69bf1365479 100644 --- a/gcc/fortran/frontend-passes.c +++ b/gcc/fortran/frontend-passes.c @@ -2461,7 +2461,12 @@ insert_index (gfc_expr *e, gfc_symbol *sym, mpz_t val, mpz_t ret) data.sym = sym; mpz_init_set (data.val, val); gfc_expr_walker (&n, callback_insert_index, (void *) &data); + + /* Suppress errors here - we could get errors here such as an + out of bounds access for arrays, see PR 90563. */ + gfc_push_suppress_errors (); gfc_simplify_expr (n, 0); + gfc_pop_suppress_errors (); if (n->expr_type == EXPR_CONSTANT) { diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ad70fb1207b..b5fc4702dca 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2013-08-13 Thomas Koenig <tkoenig@gcc.gnu.org> + + Backport from trunk + PR fortran/90563 + * gfortran.dg/do_subscript_5.f90: New test. + 2019-08-05 Kito Cheng <kito.cheng@sifive.com> Backport from mainline diff --git a/gcc/testsuite/gfortran.dg/do_subscript_5.f90 b/gcc/testsuite/gfortran.dg/do_subscript_5.f90 new file mode 100644 index 00000000000..54a4f1ba51a --- /dev/null +++ b/gcc/testsuite/gfortran.dg/do_subscript_5.f90 @@ -0,0 +1,20 @@ +! { dg-do compile } +! { dg-additional-options "-Wdo-subscript" } +! PR 90563 - this used to be rejected, wrongly +! Original test case by Tobias Neumann +program test + implicit none + integer, parameter :: swap(4) = [2,1,3,4] + real :: p(20) + integer :: j + + p = 0.0 + + ! The following warnings are actually bogus, but we are not yet + ! clever enough to suppress them. + do j=1,6 ! { dg-warning "out of bounds" } + if (j<5) then + p(j) = p(swap(j)) ! { dg-warning "out of bounds" } + endif + enddo +end program -- cgit v1.2.3 From 493f62cf1ddf37ce17f4dab08a320ab882bce288 Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Wed, 14 Aug 2019 00:16:12 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@274408 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index ee7c0ee9303..7e53e843343 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190813 +20190814 -- cgit v1.2.3 From 252992cccd283e2909fd5a5f1ca4c1d501ac9ced Mon Sep 17 00:00:00 2001 From: Iain Sandoe <iain@sandoe.co.uk> Date: Wed, 14 Aug 2019 16:08:29 +0000 Subject: [Darwin, testsuite] Fix instantiate2 fail. The instantiate2.C test started to fail since Darwin's impl. of this part of the ABI was fixed. It now emits the same output as other platforms (and clang). 2019-08-14 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline. 2019-05-02 Iain Sandoe <iain@sandoe.co.uk> * g++.dg/ext/instantiate2.C: Remove special-casing for Darwin. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@274484 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/testsuite/ChangeLog | 7 +++++++ gcc/testsuite/g++.dg/ext/instantiate2.C | 3 +-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b5fc4702dca..196f8da374c 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2019-08-14 Iain Sandoe <iain@sandoe.co.uk> + + Backport from mainline. + 2019-05-02 Iain Sandoe <iain@sandoe.co.uk> + + * g++.dg/ext/instantiate2.C: Remove special-casing for Darwin. + 2013-08-13 Thomas Koenig <tkoenig@gcc.gnu.org> Backport from trunk diff --git a/gcc/testsuite/g++.dg/ext/instantiate2.C b/gcc/testsuite/g++.dg/ext/instantiate2.C index a6292892b38..97ef45c874d 100644 --- a/gcc/testsuite/g++.dg/ext/instantiate2.C +++ b/gcc/testsuite/g++.dg/ext/instantiate2.C @@ -8,8 +8,7 @@ template <class T> struct A { template <class T> T A<T>::t = 0; static template struct A<int>; -// { dg-final { scan-assembler "\n_?_ZN1AIiE1tE(:|\n|\t)" { target { ! *-*-darwin* } } } } -// { dg-final { scan-assembler ".zerofill __DATA,__pu_bss2,__ZN1AIiE1tE" { target *-*-darwin* } } } +// { dg-final { scan-assembler "\n_?_ZN1AIiE1tE(:|\n|\t)" } } void test_int() { A<int>::t = 42; } // { dg-final { scan-assembler-not "\n_?_ZN1AIcE1tE(:|\n|\t)" } } -- cgit v1.2.3 From 8cbbec642bf98e68c2ae1c4bb6fd6bde0421611f Mon Sep 17 00:00:00 2001 From: Iain Sandoe <iain@sandoe.co.uk> Date: Wed, 14 Aug 2019 16:19:24 +0000 Subject: [Darwin] Fix lto options. These had been changed in gcc/gcc.c without being synchronised to config/darwin.h leading to some fails. 2019-08-14 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline 2018-08-22 Iain Sandoe <iain@sandoe.co.uk> * config/darwin.h (LINK_COMMAND_SPEC_A): Update lto options to match gcc/gcc.c. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@274485 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 8 ++++++++ gcc/config/darwin.h | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index bfee2ed78c0..82fa3a3ec32 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2019-08-14 Iain Sandoe <iain@sandoe.co.uk> + + Backport from mainline + 2018-08-22 Iain Sandoe <iain@sandoe.co.uk> + + * config/darwin.h (LINK_COMMAND_SPEC_A): Update lto options + to match gcc/gcc.c. + 2019-08-05 Kito Cheng <kito.cheng@sifive.com> Backport from mainline diff --git a/gcc/config/darwin.h b/gcc/config/darwin.h index c18659f2c9c..a04f35d8231 100644 --- a/gcc/config/darwin.h +++ b/gcc/config/darwin.h @@ -178,7 +178,7 @@ extern GTY(()) int darwin_ms_struct; %(linker)" \ LINK_PLUGIN_SPEC \ "%{flto*:%<fcompare-debug*} \ - %{flto*} \ + %{flto} %{fno-lto} %{flto=*} \ %l " LINK_COMPRESS_DEBUG_SPEC \ "%X %{s} %{t} %{Z} %{u*} \ %{e*} %{r} \ -- cgit v1.2.3 From dcaca99aca1e90e3b2412d4cac3a1ead7ac1854a Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Thu, 15 Aug 2019 00:16:18 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@274499 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 7e53e843343..c4f3d5bb6af 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190814 +20190815 -- cgit v1.2.3 From fe44d56924c5fcb72beefb434f1b3485075c4b31 Mon Sep 17 00:00:00 2001 From: Jonathan Wakely <jwakely@redhat.com> Date: Thu, 15 Aug 2019 11:35:58 +0000 Subject: PR c++/91436 fix C++ dialect for std::make_unique fix-it hint The std::make_unique function wasn't added until C++14, and neither was the std::complex_literals namespace. Backport from mainline. 2019-08-14 Jonathan Wakely <jwakely@redhat.com> gcc/cp: PR c++/91436 * name-lookup.c (get_std_name_hint): Fix min_dialect field for complex_literals and make_unique entries. gcc/testsuite: PR c++/91436 * g++.dg/lookup/missing-std-include-5.C: Limit test to C++14 and up. * g++.dg/lookup/missing-std-include-6.C: Don't check make_unique in test that runs for C++11. * g++.dg/lookup/missing-std-include-8.C: Check make_unique here. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@274530 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cp/ChangeLog | 9 +++++++++ gcc/cp/name-lookup.c | 4 ++-- gcc/testsuite/ChangeLog | 11 +++++++++++ gcc/testsuite/g++.dg/lookup/missing-std-include-5.C | 1 + gcc/testsuite/g++.dg/lookup/missing-std-include-6.C | 9 --------- gcc/testsuite/g++.dg/lookup/missing-std-include-8.C | 9 +++++++++ 6 files changed, 32 insertions(+), 11 deletions(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index c5337e6cd3d..2ca84ed9f1e 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,12 @@ +2019-08-15 Jonathan Wakely <jwakely@redhat.com> + + Backport from mainline. + 2019-08-14 Jonathan Wakely <jwakely@redhat.com> + + PR c++/91436 + * name-lookup.c (get_std_name_hint): Fix min_dialect field for + complex_literals and make_unique entries. + 2019-08-01 Marek Polacek <polacek@redhat.com> Backported from mainline diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c index 4e8263b2f6e..2deaa1c1991 100644 --- a/gcc/cp/name-lookup.c +++ b/gcc/cp/name-lookup.c @@ -5509,7 +5509,7 @@ get_std_name_hint (const char *name) {"bitset", "<bitset>", cxx11}, /* <complex>. */ {"complex", "<complex>", cxx98}, - {"complex_literals", "<complex>", cxx98}, + {"complex_literals", "<complex>", cxx14}, /* <condition_variable>. */ {"condition_variable", "<condition_variable>", cxx11}, {"condition_variable_any", "<condition_variable>", cxx11}, @@ -5571,7 +5571,7 @@ get_std_name_hint (const char *name) {"multimap", "<map>", cxx98}, /* <memory>. */ {"make_shared", "<memory>", cxx11}, - {"make_unique", "<memory>", cxx11}, + {"make_unique", "<memory>", cxx14}, {"shared_ptr", "<memory>", cxx11}, {"unique_ptr", "<memory>", cxx11}, {"weak_ptr", "<memory>", cxx11}, diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 196f8da374c..ccee8391365 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,14 @@ +2019-08-15 Jonathan Wakely <jwakely@redhat.com> + + Backport from mainline. + 2019-08-14 Jonathan Wakely <jwakely@redhat.com> + + PR c++/91436 + * g++.dg/lookup/missing-std-include-5.C: Limit test to C++14 and up. + * g++.dg/lookup/missing-std-include-6.C: Don't check make_unique in + test that runs for C++11. + * g++.dg/lookup/missing-std-include-8.C: Check make_unique here. + 2019-08-14 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline. diff --git a/gcc/testsuite/g++.dg/lookup/missing-std-include-5.C b/gcc/testsuite/g++.dg/lookup/missing-std-include-5.C index fe880a6263b..3ec9abd9316 100644 --- a/gcc/testsuite/g++.dg/lookup/missing-std-include-5.C +++ b/gcc/testsuite/g++.dg/lookup/missing-std-include-5.C @@ -1,2 +1,3 @@ +// { dg-do compile { target c++14 } } using namespace std::complex_literals; // { dg-error "" } // { dg-message "#include <complex>" "" { target *-*-* } .-1 } diff --git a/gcc/testsuite/g++.dg/lookup/missing-std-include-6.C b/gcc/testsuite/g++.dg/lookup/missing-std-include-6.C index d9eeb4284e8..a8f27473e6d 100644 --- a/gcc/testsuite/g++.dg/lookup/missing-std-include-6.C +++ b/gcc/testsuite/g++.dg/lookup/missing-std-include-6.C @@ -11,15 +11,6 @@ void test_make_shared () // { dg-error "expected primary-expression before '\\)' token" "" { target *-*-* } .-3 } } -template<class T> -void test_make_unique () -{ - auto p = std::make_unique<T>(); // { dg-error "'make_unique' is not a member of 'std'" } - // { dg-message "'#include <memory>'" "" { target *-*-* } .-1 } - // { dg-error "expected primary-expression before '>' token" "" { target *-*-* } .-2 } - // { dg-error "expected primary-expression before '\\)' token" "" { target *-*-* } .-3 } -} - std::shared_ptr<int> test_shared_ptr; // { dg-error "'shared_ptr' in namespace 'std' does not name a template type" } // { dg-message "'#include <memory>'" "" { target *-*-* } .-1 } diff --git a/gcc/testsuite/g++.dg/lookup/missing-std-include-8.C b/gcc/testsuite/g++.dg/lookup/missing-std-include-8.C index 68b208299f2..73532c82968 100644 --- a/gcc/testsuite/g++.dg/lookup/missing-std-include-8.C +++ b/gcc/testsuite/g++.dg/lookup/missing-std-include-8.C @@ -13,6 +13,15 @@ void test_make_shared () // { dg-error "expected primary-expression before '\\)' token" "" { target *-*-* } .-3 } } +template<class T> +void test_make_unique () +{ + std::make_unique<T>(); // { dg-error "'make_unique' is not a member of 'std'" } + // { dg-message "'std::make_unique' is only available from C\\+\\+14 onwards" "" { target *-*-* } .-1 } + // { dg-error "expected primary-expression before '>' token" "" { target *-*-* } .-2 } + // { dg-error "expected primary-expression before '\\)' token" "" { target *-*-* } .-3 } +} + void test_array () { std::array a; // { dg-error "'array' is not a member of 'std'" } -- cgit v1.2.3 From fe3d3f37d0c74c9d7a377c113daaafa6c248b6f9 Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Fri, 16 Aug 2019 00:16:09 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@274553 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index c4f3d5bb6af..ea5373c0222 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190815 +20190816 -- cgit v1.2.3 From 25a121ef6e640a3277678d8c053d3ef1f89bd376 Mon Sep 17 00:00:00 2001 From: Uros Bizjak <ubizjak@gmail.com> Date: Fri, 16 Aug 2019 12:06:28 +0000 Subject: * test_summary: Do not escape "=". git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@274567 138bc75d-0d04-0410-961f-82ee72b054a4 --- contrib/ChangeLog | 4 ++++ contrib/test_summary | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/contrib/ChangeLog b/contrib/ChangeLog index 4fa93d51b9b..039dc251ebb 100644 --- a/contrib/ChangeLog +++ b/contrib/ChangeLog @@ -1,3 +1,7 @@ +2019-08-16 Uros Bizjak <ubizjak@gmail.com> + + * test_summary: Do not escape "=". + 2019-02-22 Release Manager * GCC 8.3.0 released. diff --git a/contrib/test_summary b/contrib/test_summary index 3560a64c4f1..5760b053ec2 100755 --- a/contrib/test_summary +++ b/contrib/test_summary @@ -127,7 +127,7 @@ NR == 1 { if (lang == "") lang = " "$2" "; else lang = " "; } $2 == "version" { save = $0; $1 = ""; $2 = ""; version = $0; gsub(/^ */, "", version); gsub(/\r$/, "", version); $0 = save; } -/\===.*Summary/ { print ""; print; blanks=1; } +/===.*Summary/ { print ""; print; blanks=1; } /tests ===/ || /^(Target|Host|Native)/ || $2 == "version" { print; blanks=1; } /^(XPASS|FAIL|UNRESOLVED|WARNING|ERROR|# of )/ { sub ("\r", ""); print; } /^using:/ { print ""; print; print ""; } -- cgit v1.2.3 From d41da4edec53d62a7165598812e532894cae6684 Mon Sep 17 00:00:00 2001 From: Iain Sandoe <iain@sandoe.co.uk> Date: Fri, 16 Aug 2019 19:22:14 +0000 Subject: [darwin, ppc] Backport 270480 fix for speculation barrier insns MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The current implementation of “speculation_barrier” and “group_end_nop” insns emit hard-wired register names which causes tests using them to fail on Darwin, at least, which uses “rNN” instead of “NN”. The patch makes the register names for these insns use the operand output mechanism to substitute the appropriate variant when needed. 2019-08-16 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline 2019-04-21 Iain Sandoe <iain@sandoe.co.uk> * config/rs6000/rs6000.md (group_end_nop): Emit insn register names using operand format, rather than hard-wired. (speculation_barrier): Likewise. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@274583 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 9 +++++++++ gcc/config/rs6000/rs6000.md | 11 +++++++---- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 82fa3a3ec32..d406eb71986 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2019-08-16 Iain Sandoe <iain@sandoe.co.uk> + + Backport from mainline + 2019-04-21 Iain Sandoe <iain@sandoe.co.uk> + + * config/rs6000/rs6000.md (group_end_nop): Emit insn register + names using operand format, rather than hard-wired. + (speculation_barrier): Likewise. + 2019-08-14 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md index fa65b2a8bcc..3c9b7824d8b 100644 --- a/gcc/config/rs6000/rs6000.md +++ b/gcc/config/rs6000/rs6000.md @@ -12594,15 +12594,18 @@ [(unspec [(const_int 0)] UNSPEC_GRP_END_NOP)] "" { - if (rs6000_tune == PROCESSOR_POWER6) - return "ori 1,1,0"; - return "ori 2,2,0"; + operands[0] = gen_rtx_REG (Pmode, + rs6000_tune == PROCESSOR_POWER6 ? 1 : 2); + return "ori %0,%0,0"; }) (define_insn "rs6000_speculation_barrier" [(unspec_volatile:BLK [(const_int 0)] UNSPECV_SPEC_BARRIER)] "" - "ori 31,31,0") +{ + operands[0] = gen_rtx_REG (Pmode, 31); + return "ori %0,%0,0"; +}) ;; Define the subtract-one-and-jump insns, starting with the template ;; so loop.c knows what to generate. -- cgit v1.2.3 From 345bd26c9ac8753da0ddd6b249a3b6137d395459 Mon Sep 17 00:00:00 2001 From: Iain Sandoe <iain@sandoe.co.uk> Date: Fri, 16 Aug 2019 19:26:25 +0000 Subject: [darwin, ppc] backport Fix .machine directive in vecsave asm. The asm file fails to build if we use a modern assembler which checks that the machine is consistent with the filetype. Fixed by adjusting in a similar manner to other assembler. libgcc/ 2019-08-16 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline. 2019-05-12 Iain Sandoe <iain@sandoe.co.uk> * config/rs6000/darwin-vecsave.S: Set .machine appropriately. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@274584 138bc75d-0d04-0410-961f-82ee72b054a4 --- libgcc/ChangeLog | 7 +++++++ libgcc/config/rs6000/darwin-vecsave.S | 8 +++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog index 99d410137a5..3217b811785 100644 --- a/libgcc/ChangeLog +++ b/libgcc/ChangeLog @@ -1,3 +1,10 @@ +2019-08-11 Iain Sandoe <iain@sandoe.co.uk> + + Backport from mainline. + 2019-05-12 Iain Sandoe <iain@sandoe.co.uk> + + * config/rs6000/darwin-vecsave.S: Set .machine appropriately. + 2019-02-22 Release Manager * GCC 8.3.0 released. diff --git a/libgcc/config/rs6000/darwin-vecsave.S b/libgcc/config/rs6000/darwin-vecsave.S index ed384a104fa..f3a72a54469 100644 --- a/libgcc/config/rs6000/darwin-vecsave.S +++ b/libgcc/config/rs6000/darwin-vecsave.S @@ -31,8 +31,14 @@ (4 bytes) to do the operation; for Vector regs, 2 instructions are required (8 bytes.). */ +/* With some assemblers, we need the correct machine directive to get the + right CPU type / subtype in the file header. */ +#if __ppc64__ + .machine ppc64 +#else .machine ppc7400 -.text +#endif + .text .align 2 .private_extern saveVEC -- cgit v1.2.3 From c73112bf9b0792c7e501fa8a34fcba07f0192577 Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Sat, 17 Aug 2019 00:16:09 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@274593 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index ea5373c0222..64bbc50dc57 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190816 +20190817 -- cgit v1.2.3 From f8119be9a7b62cb4566cddf9fa173e2193bea138 Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Sun, 18 Aug 2019 00:16:11 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@274616 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 64bbc50dc57..4a0dff12a11 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190817 +20190818 -- cgit v1.2.3 From 2f4515c05aecd64da3dbf01df4c197c7cdd1e4ae Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Mon, 19 Aug 2019 00:16:09 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@274627 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 4a0dff12a11..11222eb92fe 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190818 +20190819 -- cgit v1.2.3 From 0162e27b9bc1fe34d1af54cc8f530f2180a20bb6 Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Tue, 20 Aug 2019 00:16:14 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@274687 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 11222eb92fe..0a812224e16 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190819 +20190820 -- cgit v1.2.3 From 8ff78d02d042b0171a6756d4d8f8814951a1b2b1 Mon Sep 17 00:00:00 2001 From: Eric Botcazou <ebotcazou@adacore.com> Date: Tue, 20 Aug 2019 09:15:27 +0000 Subject: PR rtl-optimization/91347 * dse.c (scan_insn): Call add_wild_read for non-const/memset tail calls before reload if HARD_FRAME_POINTER_IS_ARG_POINTER. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@274710 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 6 ++ gcc/dse.c | 7 +- gcc/testsuite/ChangeLog | 4 + gcc/testsuite/gcc.c-torture/execute/20190820-1.c | 111 +++++++++++++++++++++++ 4 files changed, 126 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gcc.c-torture/execute/20190820-1.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d406eb71986..36b4e91dd88 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2019-08-20 Eric Botcazou <ebotcazou@adacore.com> + + PR rtl-optimization/91347 + * dse.c (scan_insn): Call add_wild_read for non-const/memset tail calls + before reload if HARD_FRAME_POINTER_IS_ARG_POINTER. + 2019-08-16 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline diff --git a/gcc/dse.c b/gcc/dse.c index 26c6007b9ed..1938e745bf3 100644 --- a/gcc/dse.c +++ b/gcc/dse.c @@ -2515,10 +2515,13 @@ scan_insn (bb_info_t bb_info, rtx_insn *insn) clear_rhs_from_active_local_stores (); } } - else if (SIBLING_CALL_P (insn) && reload_completed) + else if (SIBLING_CALL_P (insn) + && (reload_completed || HARD_FRAME_POINTER_IS_ARG_POINTER)) /* Arguments for a sibling call that are pushed to memory are passed using the incoming argument pointer of the current function. After - reload that might be (and likely is) frame pointer based. */ + reload that might be (and likely is) frame pointer based. And, if + it is a frame pointer on the target, even before reload we need to + kill frame pointer based stores. */ add_wild_read (bb_info); else /* Every other call, including pure functions, may read any memory diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ccee8391365..bd7876d34be 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2019-08-20 Eric Botcazou <ebotcazou@adacore.com> + + * gcc.c-torture/execute/20190820-1.c: New test. + 2019-08-15 Jonathan Wakely <jwakely@redhat.com> Backport from mainline. diff --git a/gcc/testsuite/gcc.c-torture/execute/20190820-1.c b/gcc/testsuite/gcc.c-torture/execute/20190820-1.c new file mode 100644 index 00000000000..6a06eff7571 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20190820-1.c @@ -0,0 +1,111 @@ +/* PR rtl-optimization/91347 */ +/* Reported by John David Anglin <danglin@gcc.gnu.org> */ + +typedef unsigned short __u16; +typedef __signed__ int __s32; +typedef unsigned int __u32; +typedef __signed__ long long __s64; +typedef unsigned long long __u64; +typedef __u16 u16; +typedef __s32 s32; +typedef __u32 u32; +typedef __u64 u64; +typedef _Bool bool; +typedef s32 int32_t; +typedef u32 uint32_t; +typedef u64 uint64_t; + +char hex_asc_upper[16]; +u16 decpair[100]; + +static __attribute__ ((noipa)) void +put_dec_full4 (char *buf, unsigned r) +{ + unsigned q; + q = (r * 0x147b) >> 19; + *((u16 *)buf) = decpair[r - 100*q]; + buf += 2; + *((u16 *)buf) = decpair[q]; +} + +static __attribute__ ((noipa)) unsigned +put_dec_helper4 (char *buf, unsigned x) +{ + uint32_t q = (x * (uint64_t)0x346DC5D7) >> 43; + put_dec_full4(buf, x - q * 10000); + return q; +} + +static __attribute__ ((noipa)) char * +put_dec (char *buf, unsigned long long n) +{ + uint32_t d3, d2, d1, q, h; + d1 = ((uint32_t)n >> 16); + h = (n >> 32); + d2 = (h ) & 0xffff; + d3 = (h >> 16); + q = 656 * d3 + 7296 * d2 + 5536 * d1 + ((uint32_t)n & 0xffff); + q = put_dec_helper4(buf, q); + q += 7671 * d3 + 9496 * d2 + 6 * d1; + q = put_dec_helper4(buf+4, q); + q += 4749 * d3 + 42 * d2; + q = put_dec_helper4(buf+8, q); + return buf; +} + +struct printf_spec { + unsigned int type:8; + signed int field_width:24; + unsigned int flags:8; + unsigned int base:8; + signed int precision:16; +} __attribute__((__packed__)); + +static __attribute__ ((noipa)) char * +number (char *buf, char *end, unsigned long long num, struct printf_spec spec) +{ + + char tmp[3 * sizeof(num)] __attribute__((__aligned__(2))); + char sign; + char locase; + int need_pfx = ((spec.flags & 64) && spec.base != 10); + int i; + bool is_zero = num == 0LL; + int field_width = spec.field_width; + int precision = spec.precision; + + i = 0; + if (num < spec.base) + tmp[i++] = hex_asc_upper[num] | locase; + else if (spec.base != 10) { + int mask = spec.base - 1; + int shift = 3; + if (spec.base == 16) + shift = 4; + else + __builtin_abort (); + do { + tmp[i++] = (hex_asc_upper[((unsigned char)num) & mask] | locase); + num >>= shift; + } while (num); + } else { + i = put_dec(tmp, num) - tmp; + } + return buf; +} + +static __attribute__ ((noipa)) char * +pointer_string (char *buf, char *end, const void *ptr, struct printf_spec spec) +{ + spec.base = 16; + spec.flags = 0; + return number(buf, end, 100, spec); +} + +int +main (void) +{ + struct printf_spec spec; + char *s = pointer_string (0, 0, 0, spec); + return 0; +} -- cgit v1.2.3 From a404662395879d9c497e4433c6e851805d0128b1 Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Wed, 21 Aug 2019 00:16:09 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@274761 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 0a812224e16..8810ce1a5f6 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190820 +20190821 -- cgit v1.2.3 From 6e37ebe773a9320778cbf599f6ccdedafe9e1251 Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Thu, 22 Aug 2019 00:16:09 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@274814 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 8810ce1a5f6..63ca37060d4 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190821 +20190822 -- cgit v1.2.3 From c32cd93a3c45b17a7ed63c0d5193df1e0de8fb70 Mon Sep 17 00:00:00 2001 From: Iain Sandoe <iain@sandoe.co.uk> Date: Thu, 22 Aug 2019 18:26:14 +0000 Subject: [Darwin, Objective-C] Backport, switch Objective-C meta-data sections properly. We were emitting the directives to switch, but not recording the change in varasm. This means that subsequent switches might be omitted (since varasm incorrectly concludes that the wrong section is current). 2019-08-22 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline 2019-05-18 Iain Sandoe <iain@sandoe.co.uk> * config/darwin.c (darwin_file_end): Use switch_to_section () instead of direct output of the asm. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@274829 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 8 ++++++++ gcc/config/darwin.c | 6 ++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 36b4e91dd88..0c0a136d940 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2019-08-22 Iain Sandoe <iain@sandoe.co.uk> + + Backport from mainline + 2019-05-18 Iain Sandoe <iain@sandoe.co.uk> + + * config/darwin.c (darwin_file_end): Use switch_to_section () + instead of direct output of the asm. + 2019-08-20 Eric Botcazou <ebotcazou@adacore.com> PR rtl-optimization/91347 diff --git a/gcc/config/darwin.c b/gcc/config/darwin.c index 233076a3b77..87d14a94433 100644 --- a/gcc/config/darwin.c +++ b/gcc/config/darwin.c @@ -2945,12 +2945,10 @@ darwin_file_end (void) if (flag_objc_abi >= 2) { flags = 16; - output_section_asm_op - (darwin_sections[objc2_image_info_section]->unnamed.data); + switch_to_section (darwin_sections[objc2_image_info_section]); } else - output_section_asm_op - (darwin_sections[objc_image_info_section]->unnamed.data); + switch_to_section (darwin_sections[objc_image_info_section]); ASM_OUTPUT_ALIGN (asm_out_file, 2); fputs ("L_OBJC_ImageInfo:\n", asm_out_file); -- cgit v1.2.3 From 6bd7310b3a39698449a14106318256acb6c5c0b4 Mon Sep 17 00:00:00 2001 From: Iain Sandoe <iain@sandoe.co.uk> Date: Thu, 22 Aug 2019 18:32:18 +0000 Subject: [Darwin, Objective-C] Don't prepend a sysroot for the gnu-objc headers. Darwin is able to use two runtimes for objective-c; the default is its native NeXT runtime, but also it can build code using the gnu-runtime. In order to do this, we have to be able to find the gnu-runtime headers (which are installed into the compiler's tree). The process to do this was erroneously prepending the sysroot to this when a sysroot is in force. The gnu-runtime headers have never been installed in a Darwin (macOS) SDK so we must make sure that they are found local to the compiler. 2019-08-22 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline 2019-05-18 Iain Sandoe <iain@sandoe.co.uk> * config/darwin-c.c (darwin_register_objc_includes): Do not prepend the sysroot when building gnu-runtime header search paths. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@274830 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 9 +++++++++ gcc/config/darwin-c.c | 39 +++++++++++++++------------------------ 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 0c0a136d940..a558acb7204 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2019-08-22 Iain Sandoe <iain@sandoe.co.uk> + + Backport from mainline + 2019-05-18 Iain Sandoe <iain@sandoe.co.uk> + + * config/darwin-c.c (darwin_register_objc_includes): Do not + prepend the sysroot when building gnu-runtime header search + paths. + 2019-08-22 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline diff --git a/gcc/config/darwin-c.c b/gcc/config/darwin-c.c index 6d9d00435de..8fe02338bb1 100644 --- a/gcc/config/darwin-c.c +++ b/gcc/config/darwin-c.c @@ -463,41 +463,32 @@ static const char *framework_defaults [] = /* Register the GNU objective-C runtime include path if STDINC. */ void -darwin_register_objc_includes (const char *sysroot, const char *iprefix, - int stdinc) +darwin_register_objc_includes (const char *sysroot ATTRIBUTE_UNUSED, + const char *iprefix, int stdinc) { - const char *fname; - size_t len; - /* We do not do anything if we do not want the standard includes. */ - if (!stdinc) - return; - - fname = GCC_INCLUDE_DIR "-gnu-runtime"; - - /* Register the GNU OBJC runtime include path if we are compiling OBJC - with GNU-runtime. */ + /* If we want standard includes; Register the GNU OBJC runtime include + path if we are compiling OBJC with GNU-runtime. + This path is compiler-relative, we don't want to prepend the sysroot + since it's not expected to find the headers there. */ - if (c_dialect_objc () && !flag_next_runtime) + if (stdinc && c_dialect_objc () && !flag_next_runtime) { + const char *fname = GCC_INCLUDE_DIR "-gnu-runtime"; char *str; - /* See if our directory starts with the standard prefix. + size_t len; + + /* See if our directory starts with the standard prefix. "Translate" them, i.e. replace /usr/local/lib/gcc... with IPREFIX and search them first. */ - if (iprefix && (len = cpp_GCC_INCLUDE_DIR_len) != 0 && !sysroot + if (iprefix && (len = cpp_GCC_INCLUDE_DIR_len) != 0 && !strncmp (fname, cpp_GCC_INCLUDE_DIR, len)) { str = concat (iprefix, fname + len, NULL); - /* FIXME: wrap the headers for C++awareness. */ - add_path (str, INC_SYSTEM, /*c++aware=*/false, false); + add_path (str, INC_SYSTEM, /*c++aware=*/true, false); } - /* Should this directory start with the sysroot? */ - if (sysroot) - str = concat (sysroot, fname, NULL); - else - str = update_path (fname, ""); - - add_path (str, INC_SYSTEM, /*c++aware=*/false, false); + str = update_path (fname, ""); + add_path (str, INC_SYSTEM, /*c++aware=*/true, false); } } -- cgit v1.2.3 From ed181cab5b746b4f78c5131444d71af1f235b8f7 Mon Sep 17 00:00:00 2001 From: Iain Sandoe <iain@sandoe.co.uk> Date: Thu, 22 Aug 2019 18:37:27 +0000 Subject: [Darwin, X86] Backport fix for tests using .p2align. This fixes a number of testcases that expect use of .p2align, which was somehow omitted from the darwin X86 port (but is available in all assemblers used with it). 2019-08-22 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline 2019-05-31 Iain Sandoe <iain@sandoe.co.uk> * config/i386/darwin.h (ASM_OUTPUT_MAX_SKIP_ALIGN): New. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@274831 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 7 +++++++ gcc/config/i386/darwin.h | 12 ++++++++++++ 2 files changed, 19 insertions(+) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a558acb7204..e1e53b4dd23 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2019-08-22 Iain Sandoe <iain@sandoe.co.uk> + + Backport from mainline + 2019-05-31 Iain Sandoe <iain@sandoe.co.uk> + + * config/i386/darwin.h (ASM_OUTPUT_MAX_SKIP_ALIGN): New. + 2019-08-22 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline diff --git a/gcc/config/i386/darwin.h b/gcc/config/i386/darwin.h index 97a0ad8572d..054b884df28 100644 --- a/gcc/config/i386/darwin.h +++ b/gcc/config/i386/darwin.h @@ -220,6 +220,18 @@ extern int darwin_emit_branch_islands; } \ } while (0) +#ifdef HAVE_GAS_MAX_SKIP_P2ALIGN +#define ASM_OUTPUT_MAX_SKIP_ALIGN(FILE,LOG,MAX_SKIP) \ + do { \ + if ((LOG) != 0) { \ + if ((MAX_SKIP) == 0 || (MAX_SKIP) >= (1 << (LOG)) - 1) \ + fprintf ((FILE), "\t.p2align %d\n", (LOG)); \ + else \ + fprintf ((FILE), "\t.p2align %d,,%d\n", (LOG), (MAX_SKIP)); \ + } \ + } while (0) +#endif + /* Darwin profiling -- call mcount. */ #undef FUNCTION_PROFILER #define FUNCTION_PROFILER(FILE, LABELNO) \ -- cgit v1.2.3 From 4213262453094621d52cf3b938a26a957d9f57de Mon Sep 17 00:00:00 2001 From: Iain Sandoe <iain@sandoe.co.uk> Date: Thu, 22 Aug 2019 18:52:53 +0000 Subject: [Darwin, X86] Backport fix for .ident tests. The c-c++-common tests fail (or XPASS depending on which) on Darwin because if doesn't emit a.ident marker. For X86 Darwin, this is a trivial oversight; the assembler supports the directive. We can therefore use the default target hook there. 2019-08-22 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline 2018-12-23 Iain Sandoe <iain@sandoe.co.uk> * config/i386/darwin.h (TARGET_ASM_OUTPUT_IDENT): New. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@274833 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 7 +++++++ gcc/config/i386/darwin.h | 5 +++++ 2 files changed, 12 insertions(+) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e1e53b4dd23..76c40ca200c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2019-08-22 Iain Sandoe <iain@sandoe.co.uk> + + Backport from mainline + 2018-12-23 Iain Sandoe <iain@sandoe.co.uk> + + * config/i386/darwin.h (TARGET_ASM_OUTPUT_IDENT): New. + 2019-08-22 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline diff --git a/gcc/config/i386/darwin.h b/gcc/config/i386/darwin.h index 054b884df28..a4ca89153b9 100644 --- a/gcc/config/i386/darwin.h +++ b/gcc/config/i386/darwin.h @@ -232,6 +232,11 @@ extern int darwin_emit_branch_islands; } while (0) #endif +/* Darwin x86 assemblers support the .ident directive. */ + +#undef TARGET_ASM_OUTPUT_IDENT +#define TARGET_ASM_OUTPUT_IDENT default_asm_output_ident_directive + /* Darwin profiling -- call mcount. */ #undef FUNCTION_PROFILER #define FUNCTION_PROFILER(FILE, LABELNO) \ -- cgit v1.2.3 From 4fccd0bbd1b22464c03e75aaf7855a1c7c3b952b Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Fri, 23 Aug 2019 00:16:45 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@274841 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 63ca37060d4..c2ad92781e4 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190822 +20190823 -- cgit v1.2.3 From 321fea03841f12c9d57e69705fce13ca5f7aa434 Mon Sep 17 00:00:00 2001 From: Mihailo Stojanovic <mistojanovic@wavecomp.com> Date: Fri, 23 Aug 2019 19:10:58 +0000 Subject: * config/mips/mips.md (mips_get_fcsr, *mips_get_fcsr): Use SI machine mode for unspec_volatile operand. * gcc.target/mips/get-fcsr-3.c: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@274866 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 8 ++++++++ gcc/config/mips/mips.md | 4 ++-- gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/gcc.target/mips/get-fcsr-3.c | 9 +++++++++ 4 files changed, 23 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gcc.target/mips/get-fcsr-3.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 76c40ca200c..2a1911ee98c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2019-08-23 Mihailo Stojanovic <mistojanovic@wavecomp.com> + + Backport from mainline + 2019-08-23 Mihailo Stojanovic <mistojanovic@wavecomp.com> + + * config/mips/mips.md (mips_get_fcsr, *mips_get_fcsr): Use SI + machine mode for unspec_volatile operand. + 2019-08-22 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline diff --git a/gcc/config/mips/mips.md b/gcc/config/mips/mips.md index 061e57db533..d7fdbb093ab 100644 --- a/gcc/config/mips/mips.md +++ b/gcc/config/mips/mips.md @@ -7502,7 +7502,7 @@ ;; __builtin_mips_get_fcsr: move the FCSR into operand 0. (define_expand "mips_get_fcsr" [(set (match_operand:SI 0 "register_operand") - (unspec_volatile [(const_int 0)] UNSPEC_GET_FCSR))] + (unspec_volatile:SI [(const_int 0)] UNSPEC_GET_FCSR))] "TARGET_HARD_FLOAT_ABI" { if (TARGET_MIPS16) @@ -7514,7 +7514,7 @@ (define_insn "*mips_get_fcsr" [(set (match_operand:SI 0 "register_operand" "=d") - (unspec_volatile [(const_int 0)] UNSPEC_GET_FCSR))] + (unspec_volatile:SI [(const_int 0)] UNSPEC_GET_FCSR))] "TARGET_HARD_FLOAT" "cfc1\t%0,$31") diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index bd7876d34be..ba72d5f2385 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2019-08-23 Mihailo Stojanovic <mistojanovic@wavecomp.com> + + * gcc.target/mips/get-fcsr-3.c: New test. + 2019-08-20 Eric Botcazou <ebotcazou@adacore.com> * gcc.c-torture/execute/20190820-1.c: New test. diff --git a/gcc/testsuite/gcc.target/mips/get-fcsr-3.c b/gcc/testsuite/gcc.target/mips/get-fcsr-3.c new file mode 100644 index 00000000000..7bb97b6fbcd --- /dev/null +++ b/gcc/testsuite/gcc.target/mips/get-fcsr-3.c @@ -0,0 +1,9 @@ +/* { dg-options "-mabi=64 -mhard-float" } */ + +NOMIPS16 unsigned int +foo (void) +{ + return __builtin_mips_get_fcsr () & 0x1; +} + +/* { dg-final { scan-assembler "cfc1" } } */ -- cgit v1.2.3 From 438d02db26f783e123a33a9e403860cc999426db Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Sat, 24 Aug 2019 00:16:29 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@274896 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index c2ad92781e4..77db4832184 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190823 +20190824 -- cgit v1.2.3 From ace4b98c6b9354f636ec0507f4216f6922484eef Mon Sep 17 00:00:00 2001 From: Iain Sandoe <iain@sandoe.co.uk> Date: Sat, 24 Aug 2019 14:41:25 +0000 Subject: [Darwin, fixincludes] Backport fixes Darwin14 header issues. There are two issues with the Darwin14 (SDK) headers in which unguarded advanced syntax elements causes any code including these headers to fail. This fixes build fails on Darwin14 systems. 2019-08-24 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline. 2019-06-21 Iain Sandoe <iain@sandoe.co.uk> * inclhack.def: Guard __has_attribute and __has_extension in os/base.h. Guard Apple blocks syntax in dispatch/object.h. * fixincl.x: Regenerate. * tests/base/dispatch/object.h: New file. * tests/base/os/base.h: New file. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@274899 138bc75d-0d04-0410-961f-82ee72b054a4 --- fixincludes/ChangeLog | 12 ++++ fixincludes/fixincl.x | 102 +++++++++++++++++++++++++++++-- fixincludes/inclhack.def | 43 +++++++++++++ fixincludes/tests/base/dispatch/object.h | 18 ++++++ fixincludes/tests/base/os/base.h | 20 ++++++ 5 files changed, 190 insertions(+), 5 deletions(-) create mode 100644 fixincludes/tests/base/dispatch/object.h create mode 100644 fixincludes/tests/base/os/base.h diff --git a/fixincludes/ChangeLog b/fixincludes/ChangeLog index fdd328bcfde..2c7c0b2a26f 100644 --- a/fixincludes/ChangeLog +++ b/fixincludes/ChangeLog @@ -1,3 +1,15 @@ +2019-08-24 Iain Sandoe <iain@sandoe.co.uk> + + Backport from mainline. + 2019-06-21 Iain Sandoe <iain@sandoe.co.uk> + + * inclhack.def: Guard __has_attribute and __has_extension in + os/base.h. + Guard Apple blocks syntax in dispatch/object.h. + * fixincl.x: Regenerate. + * tests/base/dispatch/object.h: New file. + * tests/base/os/base.h: New file. + 2019-06-01 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline. diff --git a/fixincludes/fixincl.x b/fixincludes/fixincl.x index 1a1b05f47b9..e2431e2c000 100644 --- a/fixincludes/fixincl.x +++ b/fixincludes/fixincl.x @@ -2,11 +2,11 @@ * * DO NOT EDIT THIS FILE (fixincl.x) * - * It has been AutoGen-ed May 30, 2019 at 01:23:39 AM by AutoGen 5.17.4 + * It has been AutoGen-ed August 11, 2019 at 03:50:08 PM by AutoGen 5.17.4 * From the definitions inclhack.def * and the template file fixincl */ -/* DO NOT SVN-MERGE THIS FILE, EITHER Thu May 30 01:23:39 BST 2019 +/* DO NOT SVN-MERGE THIS FILE, EITHER Sun Aug 11 15:50:09 BST 2019 * * You must regenerate it. Use the ./genfixes script. * @@ -15,7 +15,7 @@ * certain ANSI-incompatible system header files which are fixed to work * correctly with ANSI C and placed in a directory that GNU C will search. * - * This file contains 250 fixup descriptions. + * This file contains 252 fixup descriptions. * * See README for more information. * @@ -2864,6 +2864,86 @@ static const char* apzDarwin_Os_Trace_3Patch[] = { #endif", (char*)NULL }; +/* * * * * * * * * * * * * * * * * * * * * * * * * * + * + * Description of Darwin_Os_Base_1 fix + */ +tSCC zDarwin_Os_Base_1Name[] = + "darwin_os_base_1"; + +/* + * File name selection pattern + */ +tSCC zDarwin_Os_Base_1List[] = + "os/base.h\0"; +/* + * Machine/OS name selection pattern + */ +tSCC* apzDarwin_Os_Base_1Machs[] = { + "*-*-darwin*", + (const char*)NULL }; + +/* + * content selection pattern - do fix if pattern found + */ +tSCC zDarwin_Os_Base_1Select0[] = + "#define __has_attribute.*\n\ +#endif"; + +#define DARWIN_OS_BASE_1_TEST_CT 1 +static tTestDesc aDarwin_Os_Base_1Tests[] = { + { TT_EGREP, zDarwin_Os_Base_1Select0, (regex_t*)NULL }, }; + +/* + * Fix Command Arguments for Darwin_Os_Base_1 + */ +static const char* apzDarwin_Os_Base_1Patch[] = { + "format", + "%0\n\ +#ifndef __has_extension\n\ +#define __has_extension(x) 0\n\ +#endif", + (char*)NULL }; + +/* * * * * * * * * * * * * * * * * * * * * * * * * * + * + * Description of Darwin_Dispatch_Object_1 fix + */ +tSCC zDarwin_Dispatch_Object_1Name[] = + "darwin_dispatch_object_1"; + +/* + * File name selection pattern + */ +tSCC zDarwin_Dispatch_Object_1List[] = + "dispatch/object.h\0"; +/* + * Machine/OS name selection pattern + */ +tSCC* apzDarwin_Dispatch_Object_1Machs[] = { + "*-*-darwin*", + (const char*)NULL }; + +/* + * content selection pattern - do fix if pattern found + */ +tSCC zDarwin_Dispatch_Object_1Select0[] = + "typedef void.*\\^dispatch_block_t.*"; + +#define DARWIN_DISPATCH_OBJECT_1_TEST_CT 1 +static tTestDesc aDarwin_Dispatch_Object_1Tests[] = { + { TT_EGREP, zDarwin_Dispatch_Object_1Select0, (regex_t*)NULL }, }; + +/* + * Fix Command Arguments for Darwin_Dispatch_Object_1 + */ +static const char* apzDarwin_Dispatch_Object_1Patch[] = { + "format", + "#if __BLOCKS__\n\ +%0\n\ +#endif", + (char*)NULL }; + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * Description of Darwin_Private_Extern fix @@ -10141,9 +10221,9 @@ static const char* apzX11_SprintfPatch[] = { * * List of all fixes */ -#define REGEX_COUNT 288 +#define REGEX_COUNT 290 #define MACH_LIST_SIZE_LIMIT 187 -#define FIX_COUNT 250 +#define FIX_COUNT 252 /* * Enumerate the fixes @@ -10217,6 +10297,8 @@ typedef enum { DARWIN_OS_TRACE_1_FIXIDX, DARWIN_OS_TRACE_2_FIXIDX, DARWIN_OS_TRACE_3_FIXIDX, + DARWIN_OS_BASE_1_FIXIDX, + DARWIN_DISPATCH_OBJECT_1_FIXIDX, DARWIN_PRIVATE_EXTERN_FIXIDX, DARWIN_STDINT_1_FIXIDX, DARWIN_STDINT_2_FIXIDX, @@ -10742,6 +10824,16 @@ tFixDesc fixDescList[ FIX_COUNT ] = { DARWIN_OS_TRACE_3_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, aDarwin_Os_Trace_3Tests, apzDarwin_Os_Trace_3Patch, 0 }, + { zDarwin_Os_Base_1Name, zDarwin_Os_Base_1List, + apzDarwin_Os_Base_1Machs, + DARWIN_OS_BASE_1_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, + aDarwin_Os_Base_1Tests, apzDarwin_Os_Base_1Patch, 0 }, + + { zDarwin_Dispatch_Object_1Name, zDarwin_Dispatch_Object_1List, + apzDarwin_Dispatch_Object_1Machs, + DARWIN_DISPATCH_OBJECT_1_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, + aDarwin_Dispatch_Object_1Tests, apzDarwin_Dispatch_Object_1Patch, 0 }, + { zDarwin_Private_ExternName, zDarwin_Private_ExternList, apzDarwin_Private_ExternMachs, DARWIN_PRIVATE_EXTERN_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, diff --git a/fixincludes/inclhack.def b/fixincludes/inclhack.def index c3687f73351..c3267162cd9 100644 --- a/fixincludes/inclhack.def +++ b/fixincludes/inclhack.def @@ -1395,6 +1395,49 @@ fix = { _EOText_; }; +/* + * In macOS 10.10 <os/base.h>, doesn't have __has_extension guarded. + */ +fix = { + hackname = darwin_os_base_1; + mach = "*-*-darwin*"; + files = os/base.h; + select = <<- OS_BASE_1_SEL +#define __has_attribute.* +#endif +OS_BASE_1_SEL; + c_fix = format; + c_fix_arg = <<- OS_BASE_1_FIX +%0 +#ifndef __has_extension +#define __has_extension(x) 0 +#endif +OS_BASE_1_FIX; + test_text = <<- OS_BASE_1_TEST +#define __has_attribute(x) 0 +#endif + +#if __GNUC__ +OS_BASE_1_TEST; +}; + +/* + * In macOS 10.10 <dispatch/object.h>, has unguarded block syntax. + */ +fix = { + hackname = darwin_dispatch_object_1; + mach = "*-*-darwin*"; + files = dispatch/object.h; + select = "typedef void.*\\^dispatch_block_t.*"; + c_fix = format; + c_fix_arg = "#if __BLOCKS__\n%0\n#endif"; + test_text = <<- DISPATCH_OBJECT_1_TEST +typedef void (^dispatch_block_t)(void); + +__BEGIN_DECLS +DISPATCH_OBJECT_1_TEST; +}; + /* * __private_extern__ doesn't exist in FSF GCC. Even if it did, * why would you ever put it in a system header file? diff --git a/fixincludes/tests/base/dispatch/object.h b/fixincludes/tests/base/dispatch/object.h new file mode 100644 index 00000000000..36722f4b9dc --- /dev/null +++ b/fixincludes/tests/base/dispatch/object.h @@ -0,0 +1,18 @@ +/* DO NOT EDIT THIS FILE. + + It has been auto-edited by fixincludes from: + + "fixinc/tests/inc/dispatch/object.h" + + This had to be done to correct non-standard usages in the + original, manufacturer supplied header file. */ + + + +#if defined( DARWIN_DISPATCH_OBJECT_1_CHECK ) +#if __BLOCKS__ +typedef void (^dispatch_block_t)(void); +#endif + +__BEGIN_DECLS +#endif /* DARWIN_DISPATCH_OBJECT_1_CHECK */ diff --git a/fixincludes/tests/base/os/base.h b/fixincludes/tests/base/os/base.h new file mode 100644 index 00000000000..44aa3932cfa --- /dev/null +++ b/fixincludes/tests/base/os/base.h @@ -0,0 +1,20 @@ +/* DO NOT EDIT THIS FILE. + + It has been auto-edited by fixincludes from: + + "fixinc/tests/inc/os/base.h" + + This had to be done to correct non-standard usages in the + original, manufacturer supplied header file. */ + + + +#if defined( DARWIN_OS_BASE_1_CHECK ) +#define __has_attribute(x) 0 +#endif +#ifndef __has_extension +#define __has_extension(x) 0 +#endif + +#if __GNUC__ +#endif /* DARWIN_OS_BASE_1_CHECK */ -- cgit v1.2.3 From a3bb077252e02bf74e7fa401d16256268636e9da Mon Sep 17 00:00:00 2001 From: Iain Sandoe <iain@sandoe.co.uk> Date: Sat, 24 Aug 2019 14:51:26 +0000 Subject: [Darwin, fixincludes] Backport fix for Darwin9/10 TR1 test fails. Darwin has had long long functions for some considerable time and these are exposed in Darwin8 and Darwin11+ headers. However, for some reason it was elected to hide them behind __STRICT_ANSI__ and __STDC_VERSION__ on Darwin9 and Darwin10. This is a problem for G++/libstdc++ that expects the functions to be available for strict ansi (-std=c++14, for example) and without defining __STDC_VERSION__. The fix here follows the pattern used in Darwin11+ headers where the functions may be explicitly hidden by defining __DARWIN_NO_LONG_LONG. 2019-08-24 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline. 2019-06-21 Iain Sandoe <iain@sandoe.co.uk> * inclhack.def: Replace the complex test using __STRICT_ANSI__ and __STDC_VERSION__ with a test using __DARWIN_NO_LONG_LONG. Ensure that the top level math.h uses <> to wrap included headers rather than "". * fixincl.x: Regenerated. * tests/base/architecture/ppc/math.h: Update test to include the __DARWIN_NO_LONG_LONG case. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@274900 138bc75d-0d04-0410-961f-82ee72b054a4 --- fixincludes/ChangeLog | 13 +++++++ fixincludes/fixincl.x | 54 +++++++++++++++++++++++--- fixincludes/inclhack.def | 24 ++++++++++-- fixincludes/tests/base/architecture/ppc/math.h | 5 +++ 4 files changed, 86 insertions(+), 10 deletions(-) diff --git a/fixincludes/ChangeLog b/fixincludes/ChangeLog index 2c7c0b2a26f..274810ed6e7 100644 --- a/fixincludes/ChangeLog +++ b/fixincludes/ChangeLog @@ -1,3 +1,16 @@ +2019-08-24 Iain Sandoe <iain@sandoe.co.uk> + + Backport from mainline. + 2019-06-21 Iain Sandoe <iain@sandoe.co.uk> + + * inclhack.def: Replace the complex test using __STRICT_ANSI__ and + __STDC_VERSION__ with a test using __DARWIN_NO_LONG_LONG. + Ensure that the top level math.h uses <> to wrap included headers + rather than "". + * fixincl.x: Regenerated. + * tests/base/architecture/ppc/math.h: Update test to include the + __DARWIN_NO_LONG_LONG case. + 2019-08-24 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline. diff --git a/fixincludes/fixincl.x b/fixincludes/fixincl.x index e2431e2c000..a59c1e2eba1 100644 --- a/fixincludes/fixincl.x +++ b/fixincludes/fixincl.x @@ -2,11 +2,11 @@ * * DO NOT EDIT THIS FILE (fixincl.x) * - * It has been AutoGen-ed August 11, 2019 at 03:50:08 PM by AutoGen 5.17.4 + * It has been AutoGen-ed August 11, 2019 at 03:59:41 PM by AutoGen 5.17.4 * From the definitions inclhack.def * and the template file fixincl */ -/* DO NOT SVN-MERGE THIS FILE, EITHER Sun Aug 11 15:50:09 BST 2019 +/* DO NOT SVN-MERGE THIS FILE, EITHER Sun Aug 11 15:59:41 BST 2019 * * You must regenerate it. Use the ./genfixes script. * @@ -15,7 +15,7 @@ * certain ANSI-incompatible system header files which are fixed to work * correctly with ANSI C and placed in a directory that GNU C will search. * - * This file contains 252 fixup descriptions. + * This file contains 253 fixup descriptions. * * See README for more information. * @@ -2598,7 +2598,7 @@ tSCC zDarwin_9_Long_Double_Funcs_2List[] = * Machine/OS name selection pattern */ tSCC* apzDarwin_9_Long_Double_Funcs_2Machs[] = { - "*-*-darwin7.9*", + "*-*-darwin*", (const char*)NULL }; /* @@ -2702,6 +2702,42 @@ static const char* apzDarwin_Gcc4_BreakagePatch[] = { "((__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))", (char*)NULL }; +/* * * * * * * * * * * * * * * * * * * * * * * * * * + * + * Description of Darwin_Ll_Funcs_Avail fix + */ +tSCC zDarwin_Ll_Funcs_AvailName[] = + "darwin_ll_funcs_avail"; + +/* + * File name selection pattern + */ +tSCC zDarwin_Ll_Funcs_AvailList[] = + "architecture/ppc/math.h\0architecture/i386/math.h\0"; +/* + * Machine/OS name selection pattern + */ +tSCC* apzDarwin_Ll_Funcs_AvailMachs[] = { + "*-*-darwin*", + (const char*)NULL }; + +/* + * content selection pattern - do fix if pattern found + */ +tSCC zDarwin_Ll_Funcs_AvailSelect0[] = + "#if[^_]*__STDC_VERSION__[^_]*__STDC_VERSION__[^1]*199901L[^_]*__STRICT_ANSI__[^_]*__GNUC__[^)]*"; + +#define DARWIN_LL_FUNCS_AVAIL_TEST_CT 1 +static tTestDesc aDarwin_Ll_Funcs_AvailTests[] = { + { TT_EGREP, zDarwin_Ll_Funcs_AvailSelect0, (regex_t*)NULL }, }; + +/* + * Fix Command Arguments for Darwin_Ll_Funcs_Avail + */ +static const char* apzDarwin_Ll_Funcs_AvailPatch[] = { sed_cmd_z, + "-e", "s/#if[^_]*__STDC_VERSION__[^_]*__STDC_VERSION__[^_]*199901L[^_]*__STRICT_ANSI__[^_]*__GNUC__[^\\)]*)/#if !(__DARWIN_NO_LONG_LONG)/", + (char*)NULL }; + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * Description of Darwin_Longjmp_Noreturn fix @@ -10221,9 +10257,9 @@ static const char* apzX11_SprintfPatch[] = { * * List of all fixes */ -#define REGEX_COUNT 290 +#define REGEX_COUNT 291 #define MACH_LIST_SIZE_LIMIT 187 -#define FIX_COUNT 252 +#define FIX_COUNT 253 /* * Enumerate the fixes @@ -10293,6 +10329,7 @@ typedef enum { DARWIN_9_LONG_DOUBLE_FUNCS_2_FIXIDX, DARWIN_EXTERNC_FIXIDX, DARWIN_GCC4_BREAKAGE_FIXIDX, + DARWIN_LL_FUNCS_AVAIL_FIXIDX, DARWIN_LONGJMP_NORETURN_FIXIDX, DARWIN_OS_TRACE_1_FIXIDX, DARWIN_OS_TRACE_2_FIXIDX, @@ -10804,6 +10841,11 @@ tFixDesc fixDescList[ FIX_COUNT ] = { DARWIN_GCC4_BREAKAGE_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, aDarwin_Gcc4_BreakageTests, apzDarwin_Gcc4_BreakagePatch, 0 }, + { zDarwin_Ll_Funcs_AvailName, zDarwin_Ll_Funcs_AvailList, + apzDarwin_Ll_Funcs_AvailMachs, + DARWIN_LL_FUNCS_AVAIL_TEST_CT, FD_MACH_ONLY, + aDarwin_Ll_Funcs_AvailTests, apzDarwin_Ll_Funcs_AvailPatch, 0 }, + { zDarwin_Longjmp_NoreturnName, zDarwin_Longjmp_NoreturnList, apzDarwin_Longjmp_NoreturnMachs, DARWIN_LONGJMP_NORETURN_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, diff --git a/fixincludes/inclhack.def b/fixincludes/inclhack.def index c3267162cd9..530057d88d3 100644 --- a/fixincludes/inclhack.def +++ b/fixincludes/inclhack.def @@ -1268,12 +1268,12 @@ fix = { }; /* - * For the AAB_darwin7_9_long_double_funcs fix to be useful, - * you have to not use "" includes. + * For the AAB_darwin7_9_long_double_funcs fix (and later fixes for long long) + * to be useful, the main math.h must use <> and not "" includes. */ fix = { hackname = darwin_9_long_double_funcs_2; - mach = "*-*-darwin7.9*"; + mach = "*-*-darwin*"; files = math.h; select = '#include[ \t]+\"'; c_fix = format; @@ -1281,7 +1281,7 @@ fix = { c_fix_arg = '([ \t]*#[ \t]*include[ \t]+)"([a-z0-9/]+)\.h"'; - test_text = '#include "architecture/ppc/math.h"'; + test_text = '#include <architecture/ppc/math.h>'; }; /* @@ -1324,6 +1324,22 @@ fix = { "(__GNUC_MINOR__ >= 1)\n"; }; +/* + * math.h hides the long long functions that are available on the system for + * 10.5 and 10.6 SDKs, we expect to use them in G++ without specifying a value + * for __STDC_VERSION__, or switching __STRICT_ANSI__ off. + */ +fix = { + hackname = darwin_ll_funcs_avail; + mach = "*-*-darwin*"; + files = architecture/ppc/math.h, architecture/i386/math.h; + select = "#if[^_]*__STDC_VERSION__[^_]*__STDC_VERSION__[^1]*199901L[^_]*" + "__STRICT_ANSI__[^_]*__GNUC__[^\)]*"; + sed = "s/#if[^_]*__STDC_VERSION__[^_]*__STDC_VERSION__[^_]*199901L[^_]*" + "__STRICT_ANSI__[^_]*__GNUC__[^\\)]*\)/#if\ !\(__DARWIN_NO_LONG_LONG\)/"; + test_text = "#if\ !(__DARWIN_NO_LONG_LONG)"; +}; + /* * Before Mac OS X 10.8 <i386/setjmp.h> doesn't mark longjump noreturn. */ diff --git a/fixincludes/tests/base/architecture/ppc/math.h b/fixincludes/tests/base/architecture/ppc/math.h index 4af7808fcc2..e7db705f5f9 100644 --- a/fixincludes/tests/base/architecture/ppc/math.h +++ b/fixincludes/tests/base/architecture/ppc/math.h @@ -12,3 +12,8 @@ #if defined( BROKEN_NAN_CHECK ) #if 1 #endif /* BROKEN_NAN_CHECK */ + + +#if defined( DARWIN_LL_FUNCS_AVAIL_CHECK ) +#if !(__DARWIN_NO_LONG_LONG) +#endif /* DARWIN_LL_FUNCS_AVAIL_CHECK */ -- cgit v1.2.3 From 897d821732c28c9b3d4f0a9b35b971c21b04009f Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Sun, 25 Aug 2019 00:16:39 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@274905 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 77db4832184..6ed2a6ca8a1 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190824 +20190825 -- cgit v1.2.3 From 770337fc219b7e219b49a03451893aa795234e08 Mon Sep 17 00:00:00 2001 From: Uros Bizjak <ubizjak@gmail.com> Date: Sun, 25 Aug 2019 18:24:01 +0000 Subject: =?UTF-8?q?=09PR=20target/91533=20=09Backport=20from=20mainline=20?= =?UTF-8?q?=092019-06-30=20=20Uro=C5=A1=20Bizjak=20=20<ubizjak@gmail.com>?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * config/i386/sse.md (ssse3_abs<mode>2): Rename from abs<mode>2. * config/i386/i386-builtin.def (__builtin_ia32_pabsb): Use CODE_FOR_ssse3_absv8qi2. (__builtin_ia32_pabsw): Use CODE_FOR_ssse3_absv4hi2. (__builtin_ia32_pabsd): Use CODE_FOR_ssse3_absv2si2. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@274911 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 20 ++++++++++++++++---- gcc/config/i386/i386-builtin.def | 6 +++--- gcc/config/i386/sse.md | 2 +- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 2a1911ee98c..4dd00c4a9b1 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,15 @@ +2019-08-25 Uroš Bizjak <ubizjak@gmail.com> + + PR target/91533 + Backport from mainline + 2019-06-30 Uroš Bizjak <ubizjak@gmail.com> + + * config/i386/sse.md (ssse3_abs<mode>2): Rename from abs<mode>2. + * config/i386/i386-builtin.def (__builtin_ia32_pabsb): + Use CODE_FOR_ssse3_absv8qi2. + (__builtin_ia32_pabsw): Use CODE_FOR_ssse3_absv4hi2. + (__builtin_ia32_pabsd): Use CODE_FOR_ssse3_absv2si2. + 2019-08-23 Mihailo Stojanovic <mistojanovic@wavecomp.com> Backport from mainline @@ -77,10 +89,10 @@ correct numbers for TFHAR, TFIAR, TEXASR. 2019-07-23 Matthew Beliveau <mbelivea@redhat.com> - + Backported from mainline 2019-07-16 Jeff Law <law@redhat.com> - + PR rtl-optimization/91173 * tree-ssa-address.c (addr_for_mem_ref): If the base is an SSA_NAME with a constant value, fold its value into the offset @@ -309,7 +321,7 @@ 2019-05-23 Uroš Bizjak <ubizjak@gmail.com> - Backported from mainline + Backport from mainline 2019-05-21 Uroš Bizjak <ubizjak@gmail.com> * config/i386/cpuid.h (__cpuid): For 32bit targets, zero @@ -519,7 +531,7 @@ in cfglayout mode, use emit_barrier_after_bb. 2019-04-11 Jakub Jelinek <jakub@redhat.com> - + PR rtl-optimization/89965 * dce.c (sp_based_mem_offset): New function. (find_call_stack_args): Use sp_based_mem_offset. diff --git a/gcc/config/i386/i386-builtin.def b/gcc/config/i386/i386-builtin.def index c14f7ef3ce2..fe23ab0b829 100644 --- a/gcc/config/i386/i386-builtin.def +++ b/gcc/config/i386/i386-builtin.def @@ -806,11 +806,11 @@ BDESC (OPTION_MASK_ISA_SSE3, CODE_FOR_sse3_hsubv2df3, "__builtin_ia32_hsubpd", I /* SSSE3 */ BDESC (OPTION_MASK_ISA_SSSE3, CODE_FOR_absv16qi2, "__builtin_ia32_pabsb128", IX86_BUILTIN_PABSB128, UNKNOWN, (int) V16QI_FTYPE_V16QI) -BDESC (OPTION_MASK_ISA_SSSE3 | OPTION_MASK_ISA_MMX, CODE_FOR_absv8qi2, "__builtin_ia32_pabsb", IX86_BUILTIN_PABSB, UNKNOWN, (int) V8QI_FTYPE_V8QI) +BDESC (OPTION_MASK_ISA_SSSE3 | OPTION_MASK_ISA_MMX, CODE_FOR_ssse3_absv8qi2, "__builtin_ia32_pabsb", IX86_BUILTIN_PABSB, UNKNOWN, (int) V8QI_FTYPE_V8QI) BDESC (OPTION_MASK_ISA_SSSE3, CODE_FOR_absv8hi2, "__builtin_ia32_pabsw128", IX86_BUILTIN_PABSW128, UNKNOWN, (int) V8HI_FTYPE_V8HI) -BDESC (OPTION_MASK_ISA_SSSE3 | OPTION_MASK_ISA_MMX, CODE_FOR_absv4hi2, "__builtin_ia32_pabsw", IX86_BUILTIN_PABSW, UNKNOWN, (int) V4HI_FTYPE_V4HI) +BDESC (OPTION_MASK_ISA_SSSE3 | OPTION_MASK_ISA_MMX, CODE_FOR_ssse3_absv4hi2, "__builtin_ia32_pabsw", IX86_BUILTIN_PABSW, UNKNOWN, (int) V4HI_FTYPE_V4HI) BDESC (OPTION_MASK_ISA_SSSE3, CODE_FOR_absv4si2, "__builtin_ia32_pabsd128", IX86_BUILTIN_PABSD128, UNKNOWN, (int) V4SI_FTYPE_V4SI) -BDESC (OPTION_MASK_ISA_SSSE3 | OPTION_MASK_ISA_MMX, CODE_FOR_absv2si2, "__builtin_ia32_pabsd", IX86_BUILTIN_PABSD, UNKNOWN, (int) V2SI_FTYPE_V2SI) +BDESC (OPTION_MASK_ISA_SSSE3 | OPTION_MASK_ISA_MMX, CODE_FOR_ssse3_absv2si2, "__builtin_ia32_pabsd", IX86_BUILTIN_PABSD, UNKNOWN, (int) V2SI_FTYPE_V2SI) BDESC (OPTION_MASK_ISA_SSSE3, CODE_FOR_ssse3_phaddwv8hi3, "__builtin_ia32_phaddw128", IX86_BUILTIN_PHADDW128, UNKNOWN, (int) V8HI_FTYPE_V8HI_V8HI) BDESC (OPTION_MASK_ISA_SSSE3 | OPTION_MASK_ISA_MMX, CODE_FOR_ssse3_phaddwv4hi3, "__builtin_ia32_phaddw", IX86_BUILTIN_PHADDW, UNKNOWN, (int) V4HI_FTYPE_V4HI_V4HI) diff --git a/gcc/config/i386/sse.md b/gcc/config/i386/sse.md index b42292e7702..5c6d2948d65 100644 --- a/gcc/config/i386/sse.md +++ b/gcc/config/i386/sse.md @@ -15172,7 +15172,7 @@ } }) -(define_insn "abs<mode>2" +(define_insn "ssse3_abs<mode>2" [(set (match_operand:MMXMODEI 0 "register_operand" "=y") (abs:MMXMODEI (match_operand:MMXMODEI 1 "nonimmediate_operand" "ym")))] -- cgit v1.2.3 From 798e372dca96faff28d687c3059ee26039c57333 Mon Sep 17 00:00:00 2001 From: Iain Sandoe <iain@sandoe.co.uk> Date: Sun, 25 Aug 2019 19:27:04 +0000 Subject: [Darwin, Driver] Fix driver crashes with valid command line input. Backport Improve processing of macosx-version-min= For PR target/63810 some improvements were made in the parsing of the version string at the point it's used to define the built-in __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__. This is fine, but the specs processing also uses the version, and specs version-compare doesn't like leading zeros on components. This means that while we succeed in processing -mmacosx-version-min=010.00002.000099 on compile lines, it fails for any other line that uses the value as part of a spec (in particular, link lines fail). To fix this, we need to apply a bit of clean-up to the version that's presented to the driver, and push that back into the command line opts. The value can come from four places: 1. User-entered on the command line 2. User-entered as MACOSX_DEPLOYMENT_TARGET= environment var. 3. Absent those two 3a For self-hosting systems, look-up from the kernel 3b For cross-compilers, as a default supplied at configure time. We apply the clean-up to all 4 (although it shouldn't really be needed for the cases under 3). We also supply a test-case that adapts to the target-version of the system, so that the link requirements are met by the SDK in use (if you try to link i686-darwin9 on an x86-64-darwin18 SDK, it will fail). gcc/ 2019-08-25 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline 2019-06-19 Iain Sandoe <iain@sandoe.co.uk> * config/darwin-driver.c (darwin_driver_init): Fix off-by-one errors in computing the number of options to be moved. Backport from mainline 2019-06-13 Iain Sandoe <iain@sandoe.co.uk> * config/darwin-driver.c (validate_macosx_version_min): New. (darwin_default_min_version): Cleanup and validate supplied version. (darwin_driver_init): Likewise and push cleaned version into opts. gcc/testsuite/ 2019-08-25 Iain Sandoe <iain@sandoe.co.uk> 2019-06-13 Iain Sandoe <iain@sandoe.co.uk> * gcc.dg/darwin-minversion-link.c: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@274912 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 15 +++ gcc/config/darwin-driver.c | 145 ++++++++++++++++++++++---- gcc/testsuite/ChangeLog | 7 ++ gcc/testsuite/gcc.dg/darwin-minversion-link.c | 26 +++++ 4 files changed, 171 insertions(+), 22 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/darwin-minversion-link.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4dd00c4a9b1..17f3ea3be75 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,18 @@ +2019-08-25 Iain Sandoe <iain@sandoe.co.uk> + + Backport from mainline + 2019-06-19 Iain Sandoe <iain@sandoe.co.uk> + + * config/darwin-driver.c (darwin_driver_init): Fix off-by-one errors + in computing the number of options to be moved. + + Backport from mainline + 2019-06-13 Iain Sandoe <iain@sandoe.co.uk> + + * config/darwin-driver.c (validate_macosx_version_min): New. + (darwin_default_min_version): Cleanup and validate supplied version. + (darwin_driver_init): Likewise and push cleaned version into opts. + 2019-08-25 Uroš Bizjak <ubizjak@gmail.com> PR target/91533 diff --git a/gcc/config/darwin-driver.c b/gcc/config/darwin-driver.c index 2b0de1e100d..cf3bd8297db 100644 --- a/gcc/config/darwin-driver.c +++ b/gcc/config/darwin-driver.c @@ -26,6 +26,91 @@ along with GCC; see the file COPYING3. If not see #include "opts.h" #include "diagnostic-core.h" +/* Validate a version string (either given on the command line or, perhaps + as MACOSX_DEPLOYMENT_TARGET). + + The specs %version-compare() function doesn't accept leading '0' on + numbers so strip them out. Do sanity checking here too. + + Return: + * original string means it was OK and we didn't want to change it. + * new string means it was OK but we rewrote it to avoid possible format + problems. + * NULL means we didn't like what we saw. +*/ + +static const char * +validate_macosx_version_min (const char *version_str) +{ + size_t version_len; + unsigned long major, minor, tiny = 0; + char *end; + const char *old_version = version_str; + bool need_rewrite = false; + + version_len = strlen (version_str); + if (version_len < 4) /* The minimum would be 10.x */ + return NULL; + + /* Version string must consist of digits and periods only. */ + if (strspn (version_str, "0123456789.") != version_len) + return NULL; + + if (!ISDIGIT (version_str[0]) || !ISDIGIT (version_str[version_len - 1])) + return NULL; + + if (version_str[0] == '0') + need_rewrite = true; + + major = strtoul (version_str, &end, 10); + version_str = end + ((*end == '.') ? 1 : 0); + + if (major != 10) /* So far .. all MacOS 10 ... */ + return NULL; + + /* Version string components must be present and numeric. */ + if (!ISDIGIT (version_str[0])) + return NULL; + + /* If we have one or more leading zeros on a component, then rewrite the + version string. */ + if (version_str[0] == '0' && version_str[1] != '\0' + && version_str[1] != '.') + need_rewrite = true; + + minor = strtoul (version_str, &end, 10); + version_str = end + ((*end == '.') ? 1 : 0); + if (minor > 99) + return NULL; + + /* If 'tiny' is present it must be numeric. */ + if (*end != '\0' && !ISDIGIT (version_str[0])) + return NULL; + + /* If we have one or more leading zeros on a component, then rewrite the + version string. */ + if (*end != '\0' && version_str[0] == '0' + && version_str[1] != '\0') + need_rewrite = true; + + tiny = strtoul (version_str, &end, 10); + if (tiny > 99) + return NULL; + + /* Version string must contain no more than three tokens. */ + if (*end != '\0') + return NULL; + + if (need_rewrite) + { + char *new_version; + asprintf (&new_version, "10.%lu.%lu", minor, tiny); + return new_version; + } + + return old_version; +} + #ifndef CROSS_DIRECTORY_STRUCTURE #include <sys/sysctl.h> #include "xregex.h" @@ -114,12 +199,13 @@ darwin_default_min_version (void) if (new_flag != NULL) { - size_t len = strlen (new_flag); - if (len > 128) { /* Arbitrary limit, number should be like xx.yy.zz */ - warning (0, "couldn%'t understand version %s\n", new_flag); - return NULL; - } - new_flag = xstrndup (new_flag, len); + const char *checked = validate_macosx_version_min (new_flag); + if (checked == NULL) + { + warning (0, "couldn%'t understand version %s\n", new_flag); + return NULL; + } + new_flag = xstrndup (checked, strlen (checked)); } return new_flag; } @@ -175,7 +261,7 @@ darwin_driver_init (unsigned int *decoded_options_count, if (*decoded_options_count > i) { memmove (*decoded_options + i, *decoded_options + i + 1, - ((*decoded_options_count - i) + ((*decoded_options_count - i - 1) * sizeof (struct cl_decoded_option))); } --i; @@ -209,7 +295,24 @@ darwin_driver_init (unsigned int *decoded_options_count, case OPT_mmacosx_version_min_: seen_version_min = true; - vers_string = xstrndup ((*decoded_options)[i].arg, 32); + vers_string = + validate_macosx_version_min ((*decoded_options)[i].arg); + if (vers_string == NULL) + warning (0, "%qs is not valid for %<mmacosx-version-min%>\n", + (*decoded_options)[i].arg); + else if (vers_string == (*decoded_options)[i].arg) + vers_string = xstrndup ((*decoded_options)[i].arg, 32); + /* Now we've examined it, and verified/re-written, put it to + one side and append later. */ + if (*decoded_options_count > i) { + memmove (*decoded_options + i, + *decoded_options + i + 1, + ((*decoded_options_count - i - 1) + * sizeof (struct cl_decoded_option))); + } + --i; + --*decoded_options_count; + break; default: break; @@ -276,22 +379,20 @@ darwin_driver_init (unsigned int *decoded_options_count, so that we can figure out the mechanism and source for the sysroot to be used. */ if (! seen_version_min && *decoded_options_count > 1) - { - /* Not set by the User, try to figure it out. */ - vers_string = darwin_default_min_version (); - if (vers_string != NULL) - { - ++*decoded_options_count; - *decoded_options = XRESIZEVEC (struct cl_decoded_option, - *decoded_options, - *decoded_options_count); - generate_option (OPT_mmacosx_version_min_, vers_string, 1, CL_DRIVER, - &(*decoded_options)[*decoded_options_count - 1]); - } - } - /* Create and push the major version for assemblers that need it. */ + /* Not set by the User, try to figure it out. */ + vers_string = darwin_default_min_version (); + + /* Create and push a cleaned up version, plus the major version for + assemblers and other cases that need it. */ if (vers_string != NULL) { + ++*decoded_options_count; + *decoded_options = XRESIZEVEC (struct cl_decoded_option, + *decoded_options, + *decoded_options_count); + generate_option (OPT_mmacosx_version_min_, vers_string, 1, CL_DRIVER, + &(*decoded_options)[*decoded_options_count - 1]); + char *asm_major = NULL; const char *first_period = strchr(vers_string, '.'); if (first_period != NULL) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ba72d5f2385..34ab27fd401 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2019-08-25 Iain Sandoe <iain@sandoe.co.uk> + + Backport from mainline. + 2019-06-13 Iain Sandoe <iain@sandoe.co.uk> + + * gcc.dg/darwin-minversion-link.c: New test. + 2019-08-23 Mihailo Stojanovic <mistojanovic@wavecomp.com> * gcc.target/mips/get-fcsr-3.c: New test. diff --git a/gcc/testsuite/gcc.dg/darwin-minversion-link.c b/gcc/testsuite/gcc.dg/darwin-minversion-link.c new file mode 100644 index 00000000000..0a80048ba35 --- /dev/null +++ b/gcc/testsuite/gcc.dg/darwin-minversion-link.c @@ -0,0 +1,26 @@ +/* Test that we can handle leading-zeros on mmacosx-version-min for invocations + including linking (so that spec processing works). To make sure that any + necessary target libs are present we make this specific to the target version + being built. */ +/* { dg-do link { target *-*-darwin* } } */ +/* { dg-additional-options "-mmacosx-version-min=010.04.11 -DCHECK=1049" { target *-*-darwin8* } } */ +/* { dg-additional-options "-mmacosx-version-min=010.05.08 -DCHECK=1058" { target *-*-darwin9* } } */ +/* { dg-additional-options "-mmacosx-version-min=010.06.08 -DCHECK=1068" { target *-*-darwin10* } } */ +/* { dg-additional-options "-mmacosx-version-min=010.07.05 -DCHECK=1075" { target *-*-darwin11* } } */ +/* { dg-additional-options "-mmacosx-version-min=010.08.05 -DCHECK=1085" { target *-*-darwin12* } } */ +/* { dg-additional-options "-mmacosx-version-min=010.09.05 -DCHECK=1095" { target *-*-darwin13* } } */ +/* { dg-additional-options "-mmacosx-version-min=010.010.03 -DCHECK=101003" { target *-*-darwin14* } } */ +/* { dg-additional-options "-mmacosx-version-min=010.011.06 -DCHECK=101106" { target *-*-darwin15* } } */ +/* { dg-additional-options "-mmacosx-version-min=010.012.06 -DCHECK=101206" { target *-*-darwin16* } } */ +/* { dg-additional-options "-mmacosx-version-min=010.013.06 -DCHECK=101306" { target *-*-darwin17* } } */ +/* This next test covers 10.18 and (currently unreleased) 10.19 for now. */ +/* { dg-additional-options "-mmacosx-version-min=010.014.05 -DCHECK=101405" { target *-*-darwin1[89]* } } */ + +int +main () +{ +#if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ != CHECK + fail me; +#endif + return 0; +} -- cgit v1.2.3 From bd987d0941a77b63c3feb3bf2e4ce310d7849afc Mon Sep 17 00:00:00 2001 From: Iain Sandoe <iain@sandoe.co.uk> Date: Sun, 25 Aug 2019 19:31:47 +0000 Subject: [Darwin, fixincludes] Backport fix for PR83531 There is no reasonable chance that the SDKs in question will be re- issued, so the only viable solution is a fixincludes. 2019-08-24 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline. 2019-08-18 C.G. Dogan <gcc+cgdogan.00@gmail.com> Iain Sandoe <iain@sandoe.co.uk> PR target/83531 * inclhack.def (darwin_api_availability): New; strip leading underscores from API_XXXX defines. * fixincl.x: Regenerate. * tests/base/os/availability.h: New file. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@274913 138bc75d-0d04-0410-961f-82ee72b054a4 --- fixincludes/ChangeLog | 12 ++++++ fixincludes/fixincl.x | 66 +++++++++++++++++++++++++++++--- fixincludes/inclhack.def | 27 +++++++++++++ fixincludes/tests/base/os/availability.h | 18 +++++++++ 4 files changed, 118 insertions(+), 5 deletions(-) create mode 100644 fixincludes/tests/base/os/availability.h diff --git a/fixincludes/ChangeLog b/fixincludes/ChangeLog index 274810ed6e7..65c928f817c 100644 --- a/fixincludes/ChangeLog +++ b/fixincludes/ChangeLog @@ -1,3 +1,15 @@ +2019-08-25 Iain Sandoe <iain@sandoe.co.uk> + + Backport from mainline. + 2019-08-18 C.G. Dogan <gcc+cgdogan.00@gmail.com> + Iain Sandoe <iain@sandoe.co.uk> + + PR target/83531 + * inclhack.def (darwin_api_availability): New; strip leading + underscores from API_XXXX defines. + * fixincl.x: Regenerate. + * tests/base/os/availability.h: New file. + 2019-08-24 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline. diff --git a/fixincludes/fixincl.x b/fixincludes/fixincl.x index a59c1e2eba1..3fd470cb965 100644 --- a/fixincludes/fixincl.x +++ b/fixincludes/fixincl.x @@ -2,11 +2,11 @@ * * DO NOT EDIT THIS FILE (fixincl.x) * - * It has been AutoGen-ed August 11, 2019 at 03:59:41 PM by AutoGen 5.17.4 + * It has been AutoGen-ed August 24, 2019 at 04:04:26 PM by AutoGen 5.17.4 * From the definitions inclhack.def * and the template file fixincl */ -/* DO NOT SVN-MERGE THIS FILE, EITHER Sun Aug 11 15:59:41 BST 2019 +/* DO NOT SVN-MERGE THIS FILE, EITHER Sat Aug 24 16:04:26 BST 2019 * * You must regenerate it. Use the ./genfixes script. * @@ -15,7 +15,7 @@ * certain ANSI-incompatible system header files which are fixed to work * correctly with ANSI C and placed in a directory that GNU C will search. * - * This file contains 253 fixup descriptions. + * This file contains 254 fixup descriptions. * * See README for more information. * @@ -267,6 +267,56 @@ static const char* apzAab_Darwin7_9_Long_Double_FuncsPatch[] = { #endif /* __MATH__ */", (char*)NULL }; +/* * * * * * * * * * * * * * * * * * * * * * * * * * + * + * Description of Darwin_Api_Availability fix + */ +tSCC zDarwin_Api_AvailabilityName[] = + "darwin_api_availability"; + +/* + * File name selection pattern + */ +tSCC zDarwin_Api_AvailabilityList[] = + "os/availability.h\0"; +/* + * Machine/OS name selection pattern + */ +tSCC* apzDarwin_Api_AvailabilityMachs[] = { + "*-*-darwin*", + (const char*)NULL }; + +/* + * content selection pattern - do fix if pattern found + */ +tSCC zDarwin_Api_AvailabilitySelect0[] = + " *#define __API_AVAILABLE.*\n\ + *#define __API_DEPRECATED.*\n\ + *#define __API_DEPRECATED_WITH_REPLACEMENT.*\n\ + *#define __API_UNAVAILABLE.*\n"; + +/* + * content bypass pattern - skip fix if pattern found + */ +tSCC zDarwin_Api_AvailabilityBypass0[] = + "__IPHONE_OS_VERSION_MIN_REQUIRED"; + +#define DARWIN_API_AVAILABILITY_TEST_CT 2 +static tTestDesc aDarwin_Api_AvailabilityTests[] = { + { TT_NEGREP, zDarwin_Api_AvailabilityBypass0, (regex_t*)NULL }, + { TT_EGREP, zDarwin_Api_AvailabilitySelect0, (regex_t*)NULL }, }; + +/* + * Fix Command Arguments for Darwin_Api_Availability + */ +static const char* apzDarwin_Api_AvailabilityPatch[] = { + "format", + " #define API_AVAILABLE(...)\n\ + #define API_DEPRECATED(...)\n\ + #define API_DEPRECATED_WITH_REPLACEMENT(...)\n\ + #define API_UNAVAILABLE(...)\n", + (char*)NULL }; + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * Description of Aab_Fd_Zero_Asm_Posix_Types_H fix @@ -10257,9 +10307,9 @@ static const char* apzX11_SprintfPatch[] = { * * List of all fixes */ -#define REGEX_COUNT 291 +#define REGEX_COUNT 293 #define MACH_LIST_SIZE_LIMIT 187 -#define FIX_COUNT 253 +#define FIX_COUNT 254 /* * Enumerate the fixes @@ -10268,6 +10318,7 @@ typedef enum { AAB_AIX_STDIO_FIXIDX, AAB_AIX_FCNTL_FIXIDX, AAB_DARWIN7_9_LONG_DOUBLE_FUNCS_FIXIDX, + DARWIN_API_AVAILABILITY_FIXIDX, AAB_FD_ZERO_ASM_POSIX_TYPES_H_FIXIDX, AAB_FD_ZERO_GNU_TYPES_H_FIXIDX, AAB_FD_ZERO_SELECTBITS_H_FIXIDX, @@ -10536,6 +10587,11 @@ tFixDesc fixDescList[ FIX_COUNT ] = { AAB_DARWIN7_9_LONG_DOUBLE_FUNCS_TEST_CT, FD_MACH_ONLY | FD_REPLACEMENT, aAab_Darwin7_9_Long_Double_FuncsTests, apzAab_Darwin7_9_Long_Double_FuncsPatch, 0 }, + { zDarwin_Api_AvailabilityName, zDarwin_Api_AvailabilityList, + apzDarwin_Api_AvailabilityMachs, + DARWIN_API_AVAILABILITY_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, + aDarwin_Api_AvailabilityTests, apzDarwin_Api_AvailabilityPatch, 0 }, + { zAab_Fd_Zero_Asm_Posix_Types_HName, zAab_Fd_Zero_Asm_Posix_Types_HList, apzAab_Fd_Zero_Asm_Posix_Types_HMachs, AAB_FD_ZERO_ASM_POSIX_TYPES_H_TEST_CT, FD_MACH_ONLY | FD_REPLACEMENT, diff --git a/fixincludes/inclhack.def b/fixincludes/inclhack.def index 530057d88d3..f574029e98e 100644 --- a/fixincludes/inclhack.def +++ b/fixincludes/inclhack.def @@ -194,6 +194,33 @@ fix = { _EndOfHeader_; }; +/* + * SDKs for 10.13 and 10.14 omit the definitions for API_AVAILABLE where + * __attribute__((availability)) is not supported. + */ +fix = { + hackname = darwin_api_availability; + mach = "*-*-darwin*"; + files = os/availability.h; + bypass = "__IPHONE_OS_VERSION_MIN_REQUIRED"; + select = + " *#define __API_AVAILABLE.*\n" + " *#define __API_DEPRECATED.*\n" + " *#define __API_DEPRECATED_WITH_REPLACEMENT.*\n" + " *#define __API_UNAVAILABLE.*\n"; + c_fix = format; + c_fix_arg = + " #define API_AVAILABLE(...)\n" + " #define API_DEPRECATED(...)\n" + " #define API_DEPRECATED_WITH_REPLACEMENT(...)\n" + " #define API_UNAVAILABLE(...)\n"; + test_text = + "#define __API_AVAILABLE(...)\n" + "#define __API_DEPRECATED(...)\n" + "#define __API_DEPRECATED_WITH_REPLACEMENT(...)\n" + "#define __API_UNAVAILABLE(...)\n"; +}; + /* * This fixes __FD_ZERO bug for linux 2.x.y (x <= 2 && y <= some n) */ diff --git a/fixincludes/tests/base/os/availability.h b/fixincludes/tests/base/os/availability.h new file mode 100644 index 00000000000..e8696b14acd --- /dev/null +++ b/fixincludes/tests/base/os/availability.h @@ -0,0 +1,18 @@ +/* DO NOT EDIT THIS FILE. + + It has been auto-edited by fixincludes from: + + "fixinc/tests/inc/os/availability.h" + + This had to be done to correct non-standard usages in the + original, manufacturer supplied header file. */ + + + +#if defined( DARWIN_API_AVAILABILITY_CHECK ) + #define API_AVAILABLE(...) + #define API_DEPRECATED(...) + #define API_DEPRECATED_WITH_REPLACEMENT(...) + #define API_UNAVAILABLE(...) + +#endif /* DARWIN_API_AVAILABILITY_CHECK */ -- cgit v1.2.3 From e2f06c98ae73918bb0429fe6948f1e1a149ad44a Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Mon, 26 Aug 2019 00:16:15 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@274917 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 6ed2a6ca8a1..07f9b348bd0 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190825 +20190826 -- cgit v1.2.3 From 96eb3fdd87a8fa9a8efa000498c125f72d1e87ad Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Tue, 27 Aug 2019 00:16:18 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@274942 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 07f9b348bd0..3f31c4a2b92 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190826 +20190827 -- cgit v1.2.3 From 92baafe3f370100b4b8a19b9cf4962ca39c28cc4 Mon Sep 17 00:00:00 2001 From: Iain Sandoe <iain@sandoe.co.uk> Date: Tue, 27 Aug 2019 19:27:29 +0000 Subject: [Darwin, PPC] Fix fail of cpp/assert4.c This test needs the cpu and machine asserts to be implemented which hadn't been done for PPC Darwin. We also need to emit __PPC__ for 32/64b and __PPC64__, __powerpc64__ (64bit) as per the other members of the PowerPC port. 2019-08-27 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline 2019-08-18 Iain Sandoe <iain@sandoe.co.uk> * config/rs6000/darwin.h (TARGET_OS_CPP_BUILTINS): Add asserts for cpu and machine. Factor 64/32b builtins. Backport from mainline 2019-06-23 Iain Sandoe <iain@sandoe.co.uk> * config/rs6000/darwin.h: (__PPC__, __PPC64__): New. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@274968 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 13 +++++++++++++ gcc/config/rs6000/darwin.h | 18 ++++++++++++++++-- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 17f3ea3be75..59faba5d28f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,16 @@ +2019-08-27 Iain Sandoe <iain@sandoe.co.uk> + + Backport from mainline + 2019-08-18 Iain Sandoe <iain@sandoe.co.uk> + + * config/rs6000/darwin.h (TARGET_OS_CPP_BUILTINS): Add asserts + for cpu and machine. Factor 64/32b builtins. + + Backport from mainline + 2019-06-23 Iain Sandoe <iain@sandoe.co.uk> + + * config/rs6000/darwin.h: (__PPC__, __PPC64__): New. + 2019-08-25 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline diff --git a/gcc/config/rs6000/darwin.h b/gcc/config/rs6000/darwin.h index 5db14aa6220..c2f859abfb2 100644 --- a/gcc/config/rs6000/darwin.h +++ b/gcc/config/rs6000/darwin.h @@ -53,9 +53,23 @@ #define TARGET_OS_CPP_BUILTINS() \ do \ { \ - if (!TARGET_64BIT) builtin_define ("__ppc__"); \ - if (TARGET_64BIT) builtin_define ("__ppc64__"); \ builtin_define ("__POWERPC__"); \ + builtin_define ("__PPC__"); \ + if (TARGET_64BIT) \ + { \ + builtin_define ("__ppc64__"); \ + builtin_define ("__PPC64__"); \ + builtin_define ("__powerpc64__"); \ + builtin_assert ("cpu=powerpc64"); \ + builtin_assert ("machine=powerpc64"); \ + } \ + else \ + { \ + builtin_define ("__ppc__"); \ + builtin_define_std ("PPC"); \ + builtin_assert ("cpu=powerpc"); \ + builtin_assert ("machine=powerpc"); \ + } \ builtin_define ("__NATURAL_ALIGNMENT__"); \ darwin_cpp_builtins (pfile); \ } \ -- cgit v1.2.3 From d2fb69b80752a8f4adcc0aa2d4600d0fbddd547a Mon Sep 17 00:00:00 2001 From: Iain Sandoe <iain@sandoe.co.uk> Date: Tue, 27 Aug 2019 19:33:37 +0000 Subject: [Darwin, PPC, libgcc] Ensure unwinder is built with altivec enabled. Fix bootstrap fail when building for 10.4. When libgcc is built on Darwin, it is usually built for the earliest potential target (Darwin8, 10.4). Build for that revision default to assuming that the processor might be G3 (without vector ops) and there is an outlined function used for save/restore that checks whether the processor is G3 or G4+ at run- time. However, the unwinder itself needs to be built with the assumption of vector usage so that the relevant outlined functions are called. 2019-08-27 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline. 2019-06-06 Iain Sandoe <iain@sandoe.co.uk> * config/rs6000/t-darwin: Ensure that the unwinder is built with altivec enabled. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@274969 138bc75d-0d04-0410-961f-82ee72b054a4 --- libgcc/ChangeLog | 8 ++++++++ libgcc/config/rs6000/t-darwin | 3 +++ 2 files changed, 11 insertions(+) diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog index 3217b811785..2facd005ba5 100644 --- a/libgcc/ChangeLog +++ b/libgcc/ChangeLog @@ -1,3 +1,11 @@ +2019-08-27 Iain Sandoe <iain@sandoe.co.uk> + + Backport from mainline. + 2019-06-06 Iain Sandoe <iain@sandoe.co.uk> + + * config/rs6000/t-darwin: Ensure that the unwinder is built with + altivec enabled. + 2019-08-11 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline. diff --git a/libgcc/config/rs6000/t-darwin b/libgcc/config/rs6000/t-darwin index abb41fc9bce..61da0bdf13a 100644 --- a/libgcc/config/rs6000/t-darwin +++ b/libgcc/config/rs6000/t-darwin @@ -20,4 +20,7 @@ LIB2ADD_ST = \ # earlier OSX versions. HOST_LIBGCC2_CFLAGS += -Wa,-force_cpusubtype_ALL -mmacosx-version-min=10.4 +unwind-dw2_s.o: HOST_LIBGCC2_CFLAGS += -maltivec +unwind-dw2.o: HOST_LIBGCC2_CFLAGS += -maltivec + LIB2ADDEH += $(srcdir)/config/rs6000/darwin-fallback.c -- cgit v1.2.3 From 9bf976dd9be8bc4ee1379b8af30f7d001023555c Mon Sep 17 00:00:00 2001 From: Iain Sandoe <iain@sandoe.co.uk> Date: Tue, 27 Aug 2019 19:41:21 +0000 Subject: [Darwin, PPC] Do not use longcall for 64b code. Fix wrong codegen; the 'native' tools do no emit the longcall in this position. 2019-08-27 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline 2019-06-27 Iain Sandoe <iain@sandoe.co.uk> * config/rs6000/rs6000.c (darwin_rs6000_override_options): Do not use longcall for 64b code. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@274970 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 8 ++++++++ gcc/config/rs6000/rs6000.c | 9 +++++++++ 2 files changed, 17 insertions(+) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 59faba5d28f..8e4e11e755f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2019-08-27 Iain Sandoe <iain@sandoe.co.uk> + + Backport from mainline + 2019-06-27 Iain Sandoe <iain@sandoe.co.uk> + + * config/rs6000/rs6000.c (darwin_rs6000_override_options): Do not + use longcall for 64b code. + 2019-08-27 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index bca3ad7bb94..7f35b02790b 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -3880,6 +3880,15 @@ darwin_rs6000_override_options (void) rs6000_isa_flags |= OPTION_MASK_POWERPC64; warning (0, "%qs requires PowerPC64 architecture, enabling", "-m64"); } + + /* The linkers [ld64] that support 64Bit do not need the JBSR longcall + optimisation, and will not work with the most generic case (where the + symbol is undefined external, but there is no symbl stub). */ + if (TARGET_64BIT) + rs6000_default_long_calls = 0; + + /* ld_classic is (so far) still used for kernel (static) code, and supports + the JBSR longcall / branch islands. */ if (flag_mkernel) { rs6000_default_long_calls = 1; -- cgit v1.2.3 From bce4c1273400606ee44e58eb1c750628a2c99b39 Mon Sep 17 00:00:00 2001 From: Iain Sandoe <iain@sandoe.co.uk> Date: Tue, 27 Aug 2019 19:50:04 +0000 Subject: [Darwin] Don't jam symbol stubs on for kernel code. Fix wrong code. Symbol stubs are needed only for m32 PPC, code and that is handled in rs6000.c. Symbol stubs should never have been generated for any X86 kernel-mode case. 2019-08-27 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline 2019-07-07 Iain Sandoe <iain@sandoe.co.uk> * config/darwin.c (darwin_override_options): Don't jam symbol stubs on for kernel code. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@274971 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 8 ++++++++ gcc/config/darwin.c | 2 -- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 8e4e11e755f..c4739053430 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2019-08-27 Iain Sandoe <iain@sandoe.co.uk> + + Backport from mainline + 2019-07-07 Iain Sandoe <iain@sandoe.co.uk> + + * config/darwin.c (darwin_override_options): Don't jam symbol stubs + on for kernel code. + 2019-08-27 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline diff --git a/gcc/config/darwin.c b/gcc/config/darwin.c index 87d14a94433..a7fbc59f9bd 100644 --- a/gcc/config/darwin.c +++ b/gcc/config/darwin.c @@ -3240,8 +3240,6 @@ darwin_override_options (void) /* so no tables either.. */ flag_unwind_tables = 0; flag_asynchronous_unwind_tables = 0; - /* We still need to emit branch islands for kernel context. */ - darwin_emit_branch_islands = true; } if (flag_var_tracking_uninit == 0 -- cgit v1.2.3 From f064eca40859b8b54fb59e1ee7c5bb9e452c9b04 Mon Sep 17 00:00:00 2001 From: Iain Sandoe <iain@sandoe.co.uk> Date: Tue, 27 Aug 2019 19:54:41 +0000 Subject: [Darwin] Make a final check on PIC options. Final check on PCI options; for Darwin these are not dependent on the PIE ones, although PIE does require PIC to support it. Specifically, for Darwin, "fPIC fno-PIE" should result in the same as "-fno-PIE -fPIC". This is a workaround for the situation in which a 'stock-built' GCC is unable to bootstrap m32 Darwin unless it's done "-mdynamic-no-pic". So this fixes a bootstrap fail in that case. 2019-08-27 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline 2019-07-07 Iain Sandoe <iain@sandoe.co.uk> * config/darwin.c (darwin_override_options): Make a final check on PIC options. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@274972 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 7 +++++++ gcc/config/darwin.c | 8 ++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c4739053430..29e93fb7516 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -3,6 +3,13 @@ Backport from mainline 2019-07-07 Iain Sandoe <iain@sandoe.co.uk> + * config/darwin.c (darwin_override_options): Make a final check on PIC + options. + +2019-08-27 Iain Sandoe <iain@sandoe.co.uk> + + Backport from mainline + 2019-07-07 Iain Sandoe <iain@sandoe.co.uk> * config/darwin.c (darwin_override_options): Don't jam symbol stubs on for kernel code. diff --git a/gcc/config/darwin.c b/gcc/config/darwin.c index a7fbc59f9bd..de5226523a1 100644 --- a/gcc/config/darwin.c +++ b/gcc/config/darwin.c @@ -3249,6 +3249,8 @@ darwin_override_options (void) && write_symbols == DWARF2_DEBUG) flag_var_tracking_uninit = flag_var_tracking; + /* Final check on PCI options; for Darwin these are not dependent on the PIE + ones, although PIE does require PIC to support it. */ if (MACHO_DYNAMIC_NO_PIC_P) { if (flag_pic) @@ -3257,9 +3259,11 @@ darwin_override_options (void) " %<-fpie%> or %<-fPIE%>"); flag_pic = 0; } - else if (flag_pic == 1) + else if (flag_pic == 1 + || (flag_pic == 0 && !(flag_mkernel || flag_apple_kext))) { - /* Darwin's -fpic is -fPIC. */ + /* Darwin's -fpic is -fPIC. + We only support "static" code in the kernel and kernel exts. */ flag_pic = 2; } -- cgit v1.2.3 From d1fbaf259c3c1da3c0364e817d004e0a76cf384e Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Wed, 28 Aug 2019 00:16:14 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@274978 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 3f31c4a2b92..1f39dbb08b7 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190827 +20190828 -- cgit v1.2.3 From 9d2105f5f80f42cca0f1353a65b240fb96735848 Mon Sep 17 00:00:00 2001 From: Iain Sandoe <iain@sandoe.co.uk> Date: Wed, 28 Aug 2019 19:21:33 +0000 Subject: [ObjC] Recognise 'instancetype' as equivalent to 'id'. This is primarily about fixing a number of testsuite fails, it implements the parsing of 'instancetype' but doesn't alter the code gen (relative to using id in the same position). It is part of the work-arounds for PR90709. gcc/objc/ 2019-08-28 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline. 2019-05-18 Iain Sandoe <iain@sandoe.co.uk> * objc/objc-act.h (OCTI_INSTANCE_TYPE, OCTI_INSTANCETYPE_NAME): New. (objc_global_trees): Add instance type and name. (INSTANCE_TYPEDEF_NAME): New. * objc/objc-act.c (synth_module_prologue): Build decls for objc_instancetype_type and objc_instancetype_name. gcc/testsuite/ 2019-08-28 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline. 2019-05-18 Iain Sandoe <iain@sandoe.co.uk> * objc.dg/instancetype-0.m: New. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@275001 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/objc/ChangeLog | 11 +++++++++++ gcc/objc/objc-act.c | 10 +++++++++- gcc/objc/objc-act.h | 7 ++++++- gcc/testsuite/ChangeLog | 7 +++++++ gcc/testsuite/objc.dg/instancetype-0.m | 30 ++++++++++++++++++++++++++++++ 5 files changed, 63 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/objc.dg/instancetype-0.m diff --git a/gcc/objc/ChangeLog b/gcc/objc/ChangeLog index 479216d7a06..8035e2548a4 100644 --- a/gcc/objc/ChangeLog +++ b/gcc/objc/ChangeLog @@ -1,3 +1,14 @@ +2019-08-28 Iain Sandoe <iain@sandoe.co.uk> + + Backport from mainline. + 2019-05-18 Iain Sandoe <iain@sandoe.co.uk> + + * objc/objc-act.h (OCTI_INSTANCE_TYPE, OCTI_INSTANCETYPE_NAME): New. + (objc_global_trees): Add instance type and name. + (INSTANCE_TYPEDEF_NAME): New. + * objc/objc-act.c (synth_module_prologue): Build decls for + objc_instancetype_type and objc_instancetype_name. + 2019-02-22 Release Manager * GCC 8.3.0 released. diff --git a/gcc/objc/objc-act.c b/gcc/objc/objc-act.c index d08693051ea..191d671a681 100644 --- a/gcc/objc/objc-act.c +++ b/gcc/objc/objc-act.c @@ -2944,18 +2944,26 @@ synth_module_prologue (void) objc_class_reference = xref_tag (RECORD_TYPE, objc_class_id); objc_object_type = build_pointer_type (objc_object_reference); + objc_instancetype_type = build_pointer_type (objc_object_reference); objc_class_type = build_pointer_type (objc_class_reference); objc_object_name = get_identifier (OBJECT_TYPEDEF_NAME); + objc_instancetype_name = get_identifier (INSTANCE_TYPEDEF_NAME); objc_class_name = get_identifier (CLASS_TYPEDEF_NAME); - /* Declare the 'id' and 'Class' typedefs. */ + /* Declare the 'id', 'instancetype' and 'Class' typedefs. */ type = lang_hooks.decls.pushdecl (build_decl (input_location, TYPE_DECL, objc_object_name, objc_object_type)); TREE_NO_WARNING (type) = 1; + type = lang_hooks.decls.pushdecl (build_decl (input_location, + TYPE_DECL, + objc_instancetype_name, + objc_instancetype_type)); + TREE_NO_WARNING (type) = 1; + type = lang_hooks.decls.pushdecl (build_decl (input_location, TYPE_DECL, objc_class_name, diff --git a/gcc/objc/objc-act.h b/gcc/objc/objc-act.h index 4bae555e40a..2865485f852 100644 --- a/gcc/objc/objc-act.h +++ b/gcc/objc/objc-act.h @@ -313,6 +313,7 @@ enum objc_tree_index OCTI_SUPER_TYPE, OCTI_SEL_TYPE, OCTI_ID_TYPE, + OCTI_INSTANCE_TYPE, OCTI_CLS_TYPE, OCTI_NST_TYPE, OCTI_PROTO_TYPE, @@ -368,6 +369,7 @@ enum objc_tree_index OCTI_OBJ_ID, OCTI_CLS_ID, OCTI_ID_NAME, + OCTI_INSTANCETYPE_NAME, OCTI_CLASS_NAME, OCTI_CNST_STR_ID, OCTI_CNST_STR_TYPE, @@ -443,6 +445,7 @@ extern GTY(()) tree objc_global_trees[OCTI_MAX]; #define objc_super_type objc_global_trees[OCTI_SUPER_TYPE] #define objc_selector_type objc_global_trees[OCTI_SEL_TYPE] #define objc_object_type objc_global_trees[OCTI_ID_TYPE] +#define objc_instancetype_type objc_global_trees[OCTI_INSTANCE_TYPE] #define objc_class_type objc_global_trees[OCTI_CLS_TYPE] #define objc_instance_type objc_global_trees[OCTI_NST_TYPE] #define objc_protocol_type objc_global_trees[OCTI_PROTO_TYPE] @@ -570,7 +573,8 @@ extern GTY(()) tree objc_global_trees[OCTI_MAX]; #define objc_object_id objc_global_trees[OCTI_OBJ_ID] #define objc_class_id objc_global_trees[OCTI_CLS_ID] -#define objc_object_name objc_global_trees[OCTI_ID_NAME] +#define objc_object_name objc_global_trees[OCTI_ID_NAME] +#define objc_instancetype_name objc_global_trees[OCTI_INSTANCETYPE_NAME] #define objc_class_name objc_global_trees[OCTI_CLASS_NAME] /* Constant string classes. */ @@ -608,6 +612,7 @@ extern GTY(()) tree objc_global_trees[OCTI_MAX]; /* Reserved tag definitions. */ #define OBJECT_TYPEDEF_NAME "id" +#define INSTANCE_TYPEDEF_NAME "instancetype" #define CLASS_TYPEDEF_NAME "Class" #define TAG_OBJECT "objc_object" diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 34ab27fd401..05bad4410a6 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2019-08-28 Iain Sandoe <iain@sandoe.co.uk> + + Backport from mainline. + 2019-05-18 Iain Sandoe <iain@sandoe.co.uk> + + * objc.dg/instancetype-0.m: New. + 2019-08-25 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline. diff --git a/gcc/testsuite/objc.dg/instancetype-0.m b/gcc/testsuite/objc.dg/instancetype-0.m new file mode 100644 index 00000000000..32cafdf314c --- /dev/null +++ b/gcc/testsuite/objc.dg/instancetype-0.m @@ -0,0 +1,30 @@ +/* Contributed by Iain Sandoe <iain@sandoe.co.uk>, May 2019. */ +/* { dg-do compile } */ + +/* Basic check of parsing instancetype. */ + +extern id class_createInstance (id, int); +extern id class_getSuperclass (id); + +@interface MyObject +{ + Class isa; +} ++ (instancetype)alloc; +- (instancetype)init; ++ (instancetype)initialize; ++ (instancetype)factoryMethodA; ++ (id)factoryMethodB; ++ (Class) class; ++ (Class) superclass; +@end + +@implementation MyObject ++ (instancetype)alloc { return class_createInstance (self, 0); } +- (instancetype)init { return self; } ++ (instancetype)initialize { return self; } ++ (instancetype)factoryMethodA { return [[[self class] alloc] init]; } ++ (id)factoryMethodB { return [[[self class] alloc] init]; } ++ (Class) class { return self; } ++ (Class) superclass { return class_getSuperclass (self); } +@end -- cgit v1.2.3 From 657ff0e61b3263b5469c4fca3b64522ebee0e717 Mon Sep 17 00:00:00 2001 From: Iain Sandoe <iain@sandoe.co.uk> Date: Wed, 28 Aug 2019 19:27:06 +0000 Subject: [Darwin, testsuite ] Backport fix for PR58321. gcc/testsuite/ 2019-08-28 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline. 2019-05-20 Iain Sandoe <iain@sandoe.co.uk> PR testsuite/58321 * gcc.target/i386/memcpy-strategy-3.c: Adjust count for Darwin and add a comment as to the reason for the difference. * gcc.target/i386/memset-strategy-1.c: Likewise. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@275002 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/testsuite/ChangeLog | 10 ++++++++++ gcc/testsuite/gcc.target/i386/memcpy-strategy-3.c | 5 ++++- gcc/testsuite/gcc.target/i386/memset-strategy-1.c | 6 ++++-- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 05bad4410a6..c960994c652 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,13 @@ +2019-08-28 Iain Sandoe <iain@sandoe.co.uk> + + Backport from mainline. + 2019-05-20 Iain Sandoe <iain@sandoe.co.uk> + + PR testsuite/58321 + * gcc.target/i386/memcpy-strategy-3.c: Adjust count for Darwin and + add a comment as to the reason for the difference. + * gcc.target/i386/memset-strategy-1.c: Likewise. + 2019-08-28 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline. diff --git a/gcc/testsuite/gcc.target/i386/memcpy-strategy-3.c b/gcc/testsuite/gcc.target/i386/memcpy-strategy-3.c index ddd1ef7c0b2..11687e8c9b5 100644 --- a/gcc/testsuite/gcc.target/i386/memcpy-strategy-3.c +++ b/gcc/testsuite/gcc.target/i386/memcpy-strategy-3.c @@ -1,6 +1,9 @@ /* { dg-do compile } */ /* { dg-options "-O2 -march=atom -mmemcpy-strategy=vector_loop:2000:align,libcall:-1:align" } */ -/* { dg-final { scan-assembler-times "memcpy" 2 } } */ +/* On ELF platforms, one hit comes from the .file directive. */ +/* { dg-final { scan-assembler-times "memcpy" 2 { target { ! *-*-darwin* } } } } */ +/* But not on Darwin, which doesn't have a .file directive by default. */ +/* { dg-final { scan-assembler-times "_memcpy" 1 { target *-*-darwin* } } } */ char a[2048]; char b[2048]; diff --git a/gcc/testsuite/gcc.target/i386/memset-strategy-1.c b/gcc/testsuite/gcc.target/i386/memset-strategy-1.c index d1b97c5df10..b4b8e2cfa6f 100644 --- a/gcc/testsuite/gcc.target/i386/memset-strategy-1.c +++ b/gcc/testsuite/gcc.target/i386/memset-strategy-1.c @@ -1,10 +1,12 @@ /* { dg-do compile } */ /* { dg-options "-O2 -march=atom -mmemset-strategy=libcall:-1:align" } */ -/* { dg-final { scan-assembler-times "memset" 2 } } */ +/* On ELF platforms, one hit comes from the .file directive. */ +/* { dg-final { scan-assembler-times "memset" 2 { target { ! *-*-darwin* } } } } */ +/* But not on Darwin, which doesn't have a .file directive by default. */ +/* { dg-final { scan-assembler-times "_memset" 1 { target *-*-darwin* } } } */ char a[2048]; void t (void) { __builtin_memset (a, 1, 2048); } - -- cgit v1.2.3 From 04d218c439d7a0219ea8400690ed5ef424597af6 Mon Sep 17 00:00:00 2001 From: Iain Sandoe <iain@sandoe.co.uk> Date: Wed, 28 Aug 2019 19:32:18 +0000 Subject: [Darwin, testsuite] BAckport fix PR83891 (darwin-weakimport-3). gcc/testsuite/ 2019-08-28 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline. 2019-05-21 Iain Sandoe <iain@sandoe.co.uk> PR target/63891 * gcc.dg/darwin-weakimport-3.c: Adjust options and explain the reasons. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@275003 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/testsuite/ChangeLog | 9 +++++++++ gcc/testsuite/gcc.dg/darwin-weakimport-3.c | 17 ++++++++++++++++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c960994c652..0508a0f17d7 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,12 @@ +2019-08-28 Iain Sandoe <iain@sandoe.co.uk> + + Backport from mainline. + 2019-05-21 Iain Sandoe <iain@sandoe.co.uk> + + PR target/63891 + * gcc.dg/darwin-weakimport-3.c: Adjust options and explain + the reasons. + 2019-08-28 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline. diff --git a/gcc/testsuite/gcc.dg/darwin-weakimport-3.c b/gcc/testsuite/gcc.dg/darwin-weakimport-3.c index 77ab980b12d..a15b5b0e7cb 100644 --- a/gcc/testsuite/gcc.dg/darwin-weakimport-3.c +++ b/gcc/testsuite/gcc.dg/darwin-weakimport-3.c @@ -1,5 +1,20 @@ /* { dg-do compile { target *-*-darwin* } } */ -/* { dg-options "-fno-asynchronous-unwind-tables" } */ + +/* Here we want to test if "foo" gets placed into a coalesced + section (it should not). + + However, for i386, and PIC code we have a "get_pc thunk" that + is (correctly) placed in a coalesced section when using an older + linker - also unwind tables are emitted into coalesced. + + With modern linkers this is moot, since even weak symbols + are emitted into the regular sections. + + To avoid the unwind tables -fno-asynchronous-unwind-tables. + To ensure that we emit code for an older linker -mtarget-linker + To avoid the get_pc thunk optimise at least O1. */ + +/* { dg-options "-fno-asynchronous-unwind-tables -O1 -mtarget-linker 85.2" } */ /* { dg-require-weak "" } */ /* { dg-final { scan-assembler-not "coalesced" } } */ -- cgit v1.2.3 From b2eff2759ac9e1506145651bf82f9c3bfcc632b7 Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Thu, 29 Aug 2019 00:16:09 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@275019 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 1f39dbb08b7..b37e6486229 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190828 +20190829 -- cgit v1.2.3 From d62a0a403c15a6c66d780204e6a7b0b7b98790d0 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek <jakub@redhat.com> Date: Thu, 29 Aug 2019 14:57:18 +0000 Subject: Backported from mainline 2019-04-19 Jakub Jelinek <jakub@redhat.com> PR middle-end/90139 * tree-outof-ssa.c (get_temp_reg): If reg_mode is BLKmode, return assign_temp instead of gen_reg_rtx. * gcc.c-torture/compile/pr90139.c: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@275035 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 9 +++++++++ gcc/testsuite/ChangeLog | 8 ++++++++ gcc/testsuite/gcc.c-torture/compile/pr90139.c | 20 ++++++++++++++++++++ gcc/tree-outof-ssa.c | 2 ++ 4 files changed, 39 insertions(+) create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr90139.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 29e93fb7516..8b527667bf8 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2019-08-29 Jakub Jelinek <jakub@redhat.com> + + Backported from mainline + 2019-04-19 Jakub Jelinek <jakub@redhat.com> + + PR middle-end/90139 + * tree-outof-ssa.c (get_temp_reg): If reg_mode is BLKmode, return + assign_temp instead of gen_reg_rtx. + 2019-08-27 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 0508a0f17d7..f538b529931 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2019-08-29 Jakub Jelinek <jakub@redhat.com> + + Backported from mainline + 2019-04-19 Jakub Jelinek <jakub@redhat.com> + + PR middle-end/90139 + * gcc.c-torture/compile/pr90139.c: New test. + 2019-08-28 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline. diff --git a/gcc/testsuite/gcc.c-torture/compile/pr90139.c b/gcc/testsuite/gcc.c-torture/compile/pr90139.c new file mode 100644 index 00000000000..f3d99f04c86 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr90139.c @@ -0,0 +1,20 @@ +/* PR middle-end/90139 */ + +typedef float __attribute__((vector_size (sizeof (float)))) V; +void bar (int, V *); +int l; + +void +foo (void) +{ + V n, b, o; + while (1) + switch (l) + { + case 0: + o = n; + n = b; + b = o; + bar (1, &o); + } +} diff --git a/gcc/tree-outof-ssa.c b/gcc/tree-outof-ssa.c index 59bdcd6fadd..a5e5566b74a 100644 --- a/gcc/tree-outof-ssa.c +++ b/gcc/tree-outof-ssa.c @@ -651,6 +651,8 @@ get_temp_reg (tree name) tree type = TREE_TYPE (name); int unsignedp; machine_mode reg_mode = promote_ssa_mode (name, &unsignedp); + if (reg_mode == BLKmode) + return assign_temp (type, 0, 0); rtx x = gen_reg_rtx (reg_mode); if (POINTER_TYPE_P (type)) mark_reg_pointer (x, TYPE_ALIGN (TREE_TYPE (type))); -- cgit v1.2.3 From 7fb45ffdd6f1c739204ba9d97fb6180c9000e90c Mon Sep 17 00:00:00 2001 From: Jakub Jelinek <jakub@redhat.com> Date: Thu, 29 Aug 2019 14:57:56 +0000 Subject: Backported from mainline 2019-04-26 Jakub Jelinek <jakub@redhat.com> PR debug/90197 * c-tree.h (c_finish_loop): Add 2 further location_t arguments. * c-parser.c (c_parser_while_statement): Adjust c_finish_loop caller. (c_parser_do_statement): Likewise. (c_parser_for_statement): Likewise. Formatting fixes. * c-typeck.c (c_finish_loop): Add COND_LOCUS and INCR_LOCUS arguments, emit DEBUG_BEGIN_STMTs if needed. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@275036 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/c/ChangeLog | 13 +++++++++++++ gcc/c/c-parser.c | 53 +++++++++++++++++++++++++++++++++++------------------ gcc/c/c-tree.h | 3 ++- gcc/c/c-typeck.c | 33 +++++++++++++++++++++++---------- 4 files changed, 73 insertions(+), 29 deletions(-) diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index 1c5c3a71b9b..c0b7ed17bcf 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,16 @@ +2019-08-29 Jakub Jelinek <jakub@redhat.com> + + Backported from mainline + 2019-04-26 Jakub Jelinek <jakub@redhat.com> + + PR debug/90197 + * c-tree.h (c_finish_loop): Add 2 further location_t arguments. + * c-parser.c (c_parser_while_statement): Adjust c_finish_loop caller. + (c_parser_do_statement): Likewise. + (c_parser_for_statement): Likewise. Formatting fixes. + * c-typeck.c (c_finish_loop): Add COND_LOCUS and INCR_LOCUS arguments, + emit DEBUG_BEGIN_STMTs if needed. + 2019-07-21 Richard Sandiford <richard.sandiford@arm.com> Backport from mainline diff --git a/gcc/c/c-parser.c b/gcc/c/c-parser.c index ece6b920245..06c0d5648c4 100644 --- a/gcc/c/c-parser.c +++ b/gcc/c/c-parser.c @@ -5933,7 +5933,8 @@ c_parser_while_statement (c_parser *parser, bool ivdep, unsigned short unroll, location_t loc_after_labels; bool open_brace = c_parser_next_token_is (parser, CPP_OPEN_BRACE); body = c_parser_c99_block_statement (parser, if_p, &loc_after_labels); - c_finish_loop (loc, cond, NULL, body, c_break_label, c_cont_label, true); + c_finish_loop (loc, loc, cond, UNKNOWN_LOCATION, NULL, body, + c_break_label, c_cont_label, true); add_stmt (c_end_compound_stmt (loc, block, flag_isoc99)); c_parser_maybe_reclassify_token (parser); @@ -5978,6 +5979,7 @@ c_parser_do_statement (c_parser *parser, bool ivdep, unsigned short unroll) c_break_label = save_break; new_cont = c_cont_label; c_cont_label = save_cont; + location_t cond_loc = c_parser_peek_token (parser)->location; cond = c_parser_paren_condition (parser); if (ivdep && cond != error_mark_node) cond = build3 (ANNOTATE_EXPR, TREE_TYPE (cond), cond, @@ -5991,7 +5993,8 @@ c_parser_do_statement (c_parser *parser, bool ivdep, unsigned short unroll) build_int_cst (integer_type_node, unroll)); if (!c_parser_require (parser, CPP_SEMICOLON, "expected %<;%>")) c_parser_skip_to_end_of_block_or_statement (parser); - c_finish_loop (loc, cond, NULL, body, new_break, new_cont, false); + c_finish_loop (loc, cond_loc, cond, UNKNOWN_LOCATION, NULL, body, + new_break, new_cont, false); add_stmt (c_end_compound_stmt (loc, block, flag_isoc99)); } @@ -6064,7 +6067,9 @@ c_parser_for_statement (c_parser *parser, bool ivdep, unsigned short unroll, /* Silence the bogus uninitialized warning. */ tree collection_expression = NULL; location_t loc = c_parser_peek_token (parser)->location; - location_t for_loc = c_parser_peek_token (parser)->location; + location_t for_loc = loc; + location_t cond_loc = UNKNOWN_LOCATION; + location_t incr_loc = UNKNOWN_LOCATION; bool is_foreach_statement = false; gcc_assert (c_parser_next_token_is_keyword (parser, RID_FOR)); token_indent_info for_tinfo @@ -6098,7 +6103,8 @@ c_parser_for_statement (c_parser *parser, bool ivdep, unsigned short unroll, c_parser_consume_token (parser); is_foreach_statement = true; if (check_for_loop_decls (for_loc, true) == NULL_TREE) - c_parser_error (parser, "multiple iterating variables in fast enumeration"); + c_parser_error (parser, "multiple iterating variables in " + "fast enumeration"); } else check_for_loop_decls (for_loc, flag_isoc99); @@ -6128,7 +6134,8 @@ c_parser_for_statement (c_parser *parser, bool ivdep, unsigned short unroll, c_parser_consume_token (parser); is_foreach_statement = true; if (check_for_loop_decls (for_loc, true) == NULL_TREE) - c_parser_error (parser, "multiple iterating variables in fast enumeration"); + c_parser_error (parser, "multiple iterating variables in " + "fast enumeration"); } else check_for_loop_decls (for_loc, flag_isoc99); @@ -6150,15 +6157,18 @@ c_parser_for_statement (c_parser *parser, bool ivdep, unsigned short unroll, c_parser_consume_token (parser); is_foreach_statement = true; if (! lvalue_p (init_expression)) - c_parser_error (parser, "invalid iterating variable in fast enumeration"); - object_expression = c_fully_fold (init_expression, false, NULL); + c_parser_error (parser, "invalid iterating variable in " + "fast enumeration"); + object_expression + = c_fully_fold (init_expression, false, NULL); } else { ce = convert_lvalue_to_rvalue (loc, ce, true, false); init_expression = ce.value; c_finish_expr_stmt (loc, init_expression); - c_parser_skip_until_found (parser, CPP_SEMICOLON, "expected %<;%>"); + c_parser_skip_until_found (parser, CPP_SEMICOLON, + "expected %<;%>"); } } } @@ -6167,18 +6177,19 @@ c_parser_for_statement (c_parser *parser, bool ivdep, unsigned short unroll, gcc_assert (!parser->objc_could_be_foreach_context); if (!is_foreach_statement) { + cond_loc = c_parser_peek_token (parser)->location; if (c_parser_next_token_is (parser, CPP_SEMICOLON)) { if (ivdep) { - c_parser_error (parser, "missing loop condition in loop with " - "%<GCC ivdep%> pragma"); + c_parser_error (parser, "missing loop condition in loop " + "with %<GCC ivdep%> pragma"); cond = error_mark_node; } else if (unroll) { - c_parser_error (parser, "missing loop condition in loop with " - "%<GCC unroll%> pragma"); + c_parser_error (parser, "missing loop condition in loop " + "with %<GCC unroll%> pragma"); cond = error_mark_node; } else @@ -6207,11 +6218,13 @@ c_parser_for_statement (c_parser *parser, bool ivdep, unsigned short unroll, /* Parse the increment expression (the third expression in a for-statement). In the case of a foreach-statement, this is the expression that follows the 'in'. */ + loc = incr_loc = c_parser_peek_token (parser)->location; if (c_parser_next_token_is (parser, CPP_CLOSE_PAREN)) { if (is_foreach_statement) { - c_parser_error (parser, "missing collection in fast enumeration"); + c_parser_error (parser, + "missing collection in fast enumeration"); collection_expression = error_mark_node; } else @@ -6220,8 +6233,8 @@ c_parser_for_statement (c_parser *parser, bool ivdep, unsigned short unroll, else { if (is_foreach_statement) - collection_expression = c_fully_fold (c_parser_expression (parser).value, - false, NULL); + collection_expression + = c_fully_fold (c_parser_expression (parser).value, false, NULL); else { struct c_expr ce = c_parser_expression (parser); @@ -6244,10 +6257,14 @@ c_parser_for_statement (c_parser *parser, bool ivdep, unsigned short unroll, body = c_parser_c99_block_statement (parser, if_p, &loc_after_labels); if (is_foreach_statement) - objc_finish_foreach_loop (loc, object_expression, collection_expression, body, c_break_label, c_cont_label); + objc_finish_foreach_loop (for_loc, object_expression, + collection_expression, body, c_break_label, + c_cont_label); else - c_finish_loop (loc, cond, incr, body, c_break_label, c_cont_label, true); - add_stmt (c_end_compound_stmt (loc, block, flag_isoc99 || c_dialect_objc ())); + c_finish_loop (for_loc, cond_loc, cond, incr_loc, incr, body, + c_break_label, c_cont_label, true); + add_stmt (c_end_compound_stmt (for_loc, block, + flag_isoc99 || c_dialect_objc ())); c_parser_maybe_reclassify_token (parser); token_indent_info next_tinfo diff --git a/gcc/c/c-tree.h b/gcc/c/c-tree.h index aa66aa27b39..bd7d396c67d 100644 --- a/gcc/c/c-tree.h +++ b/gcc/c/c-tree.h @@ -684,7 +684,8 @@ extern int c_types_compatible_p (tree, tree); extern tree c_begin_compound_stmt (bool); extern tree c_end_compound_stmt (location_t, tree, bool); extern void c_finish_if_stmt (location_t, tree, tree, tree); -extern void c_finish_loop (location_t, tree, tree, tree, tree, tree, bool); +extern void c_finish_loop (location_t, location_t, tree, location_t, tree, + tree, tree, tree, bool); extern tree c_begin_stmt_expr (void); extern tree c_finish_stmt_expr (location_t, tree); extern tree c_process_expr_stmt (location_t, tree); diff --git a/gcc/c/c-typeck.c b/gcc/c/c-typeck.c index 7b90b5cd2f0..19fb73f840b 100644 --- a/gcc/c/c-typeck.c +++ b/gcc/c/c-typeck.c @@ -10528,11 +10528,14 @@ c_finish_if_stmt (location_t if_locus, tree cond, tree then_block, the beginning of the loop. COND is the loop condition. COND_IS_FIRST is false for DO loops. INCR is the FOR increment expression. BODY is the statement controlled by the loop. BLAB is the break label. CLAB is - the continue label. Everything is allowed to be NULL. */ + the continue label. Everything is allowed to be NULL. + COND_LOCUS is the location of the loop condition, INCR_LOCUS is the + location of the FOR increment expression. */ void -c_finish_loop (location_t start_locus, tree cond, tree incr, tree body, - tree blab, tree clab, bool cond_is_first) +c_finish_loop (location_t start_locus, location_t cond_locus, tree cond, + location_t incr_locus, tree incr, tree body, tree blab, + tree clab, bool cond_is_first) { tree entry = NULL, exit = NULL, t; @@ -10574,12 +10577,8 @@ c_finish_loop (location_t start_locus, tree cond, tree incr, tree body, } t = build_and_jump (&blab); - if (cond_is_first) - exit = fold_build3_loc (start_locus, - COND_EXPR, void_type_node, cond, exit, t); - else - exit = fold_build3_loc (input_location, - COND_EXPR, void_type_node, cond, exit, t); + exit = fold_build3_loc (cond_is_first ? start_locus : input_location, + COND_EXPR, void_type_node, cond, exit, t); } else { @@ -10600,9 +10599,23 @@ c_finish_loop (location_t start_locus, tree cond, tree incr, tree body, if (clab) add_stmt (build1 (LABEL_EXPR, void_type_node, clab)); if (incr) - add_stmt (incr); + { + if (MAY_HAVE_DEBUG_MARKER_STMTS && incr_locus != UNKNOWN_LOCATION) + { + t = build0 (DEBUG_BEGIN_STMT, void_type_node); + SET_EXPR_LOCATION (t, incr_locus); + add_stmt (t); + } + add_stmt (incr); + } if (entry) add_stmt (entry); + if (MAY_HAVE_DEBUG_MARKER_STMTS && cond_locus != UNKNOWN_LOCATION) + { + t = build0 (DEBUG_BEGIN_STMT, void_type_node); + SET_EXPR_LOCATION (t, cond_locus); + add_stmt (t); + } if (exit) add_stmt (exit); if (blab) -- cgit v1.2.3 From 83228d1815e897dceae99ab6add487055e464016 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek <jakub@redhat.com> Date: Thu, 29 Aug 2019 14:59:18 +0000 Subject: Backported from mainline 2019-05-10 Jakub Jelinek <jakub@redhat.com> PR pch/90326 cp/ * config-lang.in (gtfiles): Remove c-family/c-lex.c, add c-family/c-cppbuiltin.c. objc/ * config-lang.in (gtfiles): Add c-family/c-format.c. objcp/ * config-lang.in (gtfiles): Don't add c-family/c-cppbuiltin.c. testsuite/ * g++.dg/pch/pr90326.C: New test. * g++.dg/pch/pr90326.Hs: New file. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@275037 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cp/ChangeLog | 9 +++++++++ gcc/cp/config-lang.in | 2 +- gcc/objc/ChangeLog | 8 ++++++++ gcc/objc/config-lang.in | 2 +- gcc/objcp/ChangeLog | 8 ++++++++ gcc/objcp/config-lang.in | 1 - gcc/testsuite/ChangeLog | 6 ++++++ gcc/testsuite/g++.dg/pch/pr90326.C | 9 +++++++++ gcc/testsuite/g++.dg/pch/pr90326.Hs | 1 + 9 files changed, 43 insertions(+), 3 deletions(-) create mode 100644 gcc/testsuite/g++.dg/pch/pr90326.C create mode 100644 gcc/testsuite/g++.dg/pch/pr90326.Hs diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 2ca84ed9f1e..b0fc5073317 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,12 @@ +2019-08-29 Jakub Jelinek <jakub@redhat.com> + + Backported from mainline + 2019-05-10 Jakub Jelinek <jakub@redhat.com> + + PR pch/90326 + * config-lang.in (gtfiles): Remove c-family/c-lex.c, add + c-family/c-cppbuiltin.c. + 2019-08-15 Jonathan Wakely <jwakely@redhat.com> Backport from mainline. diff --git a/gcc/cp/config-lang.in b/gcc/cp/config-lang.in index 546572693fd..8e33f138136 100644 --- a/gcc/cp/config-lang.in +++ b/gcc/cp/config-lang.in @@ -37,7 +37,7 @@ gtfiles="\ \$(srcdir)/c-family/c-pragma.h \$(srcdir)/cp/decl.h \ \$(srcdir)/cp/parser.h \ \$(srcdir)/c-family/c-common.c \$(srcdir)/c-family/c-format.c \ -\$(srcdir)/c-family/c-lex.c \$(srcdir)/c-family/c-pragma.c \ +\$(srcdir)/c-family/c-cppbuiltin.c \$(srcdir)/c-family/c-pragma.c \ \$(srcdir)/cp/call.c \$(srcdir)/cp/class.c \$(srcdir)/cp/constexpr.c \ \$(srcdir)/cp/cp-gimplify.c \ \$(srcdir)/cp/cp-lang.c \$(srcdir)/cp/cp-objcp-common.c \ diff --git a/gcc/objc/ChangeLog b/gcc/objc/ChangeLog index 8035e2548a4..336539c8768 100644 --- a/gcc/objc/ChangeLog +++ b/gcc/objc/ChangeLog @@ -1,3 +1,11 @@ +2019-08-29 Jakub Jelinek <jakub@redhat.com> + + Backported from mainline + 2019-05-10 Jakub Jelinek <jakub@redhat.com> + + PR pch/90326 + * config-lang.in (gtfiles): Add c-family/c-format.c. + 2019-08-28 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline. diff --git a/gcc/objc/config-lang.in b/gcc/objc/config-lang.in index e38424584ad..e87e96bb0fd 100644 --- a/gcc/objc/config-lang.in +++ b/gcc/objc/config-lang.in @@ -35,4 +35,4 @@ lang_requires="c" # Order is important. If you change this list, make sure you test # building without C++ as well; that is, remove the gcc/cp directory, # and build with --enable-languages=c,objc. -gtfiles="\$(srcdir)/objc/objc-map.h \$(srcdir)/c-family/c-objc.h \$(srcdir)/objc/objc-act.h \$(srcdir)/objc/objc-act.c \$(srcdir)/objc/objc-runtime-shared-support.c \$(srcdir)/objc/objc-gnu-runtime-abi-01.c \$(srcdir)/objc/objc-next-runtime-abi-01.c \$(srcdir)/objc/objc-next-runtime-abi-02.c \$(srcdir)/c/c-parser.h \$(srcdir)/c/c-parser.c \$(srcdir)/c/c-tree.h \$(srcdir)/c/c-decl.c \$(srcdir)/c/c-lang.h \$(srcdir)/c/c-objc-common.c \$(srcdir)/c-family/c-common.c \$(srcdir)/c-family/c-common.h \$(srcdir)/c-family/c-cppbuiltin.c \$(srcdir)/c-family/c-pragma.h \$(srcdir)/c-family/c-pragma.c" +gtfiles="\$(srcdir)/objc/objc-map.h \$(srcdir)/c-family/c-objc.h \$(srcdir)/objc/objc-act.h \$(srcdir)/objc/objc-act.c \$(srcdir)/objc/objc-runtime-shared-support.c \$(srcdir)/objc/objc-gnu-runtime-abi-01.c \$(srcdir)/objc/objc-next-runtime-abi-01.c \$(srcdir)/objc/objc-next-runtime-abi-02.c \$(srcdir)/c/c-parser.h \$(srcdir)/c/c-parser.c \$(srcdir)/c/c-tree.h \$(srcdir)/c/c-decl.c \$(srcdir)/c/c-lang.h \$(srcdir)/c/c-objc-common.c \$(srcdir)/c-family/c-common.c \$(srcdir)/c-family/c-common.h \$(srcdir)/c-family/c-cppbuiltin.c \$(srcdir)/c-family/c-pragma.h \$(srcdir)/c-family/c-pragma.c \$(srcdir)/c-family/c-format.c" diff --git a/gcc/objcp/ChangeLog b/gcc/objcp/ChangeLog index d0469773073..deb9a22c6b2 100644 --- a/gcc/objcp/ChangeLog +++ b/gcc/objcp/ChangeLog @@ -1,3 +1,11 @@ +2019-08-29 Jakub Jelinek <jakub@redhat.com> + + Backported from mainline + 2019-05-10 Jakub Jelinek <jakub@redhat.com> + + PR pch/90326 + * config-lang.in (gtfiles): Don't add c-family/c-cppbuiltin.c. + 2019-02-22 Release Manager * GCC 8.3.0 released. diff --git a/gcc/objcp/config-lang.in b/gcc/objcp/config-lang.in index 46dea14c7ae..b4e1c7005fd 100644 --- a/gcc/objcp/config-lang.in +++ b/gcc/objcp/config-lang.in @@ -52,7 +52,6 @@ gtfiles="$(. $srcdir/cp/config-lang.in ; \ gtfiles="$gtfiles \ \$(srcdir)/objc/objc-act.h \ \$(srcdir)/objc/objc-map.h \ -\$(srcdir)/c-family/c-cppbuiltin.c \ \$(srcdir)/objc/objc-act.c \ \$(srcdir)/objc/objc-gnu-runtime-abi-01.c \ \$(srcdir)/objc/objc-next-runtime-abi-01.c \ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index f538b529931..c374582bae6 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,6 +1,12 @@ 2019-08-29 Jakub Jelinek <jakub@redhat.com> Backported from mainline + 2019-05-10 Jakub Jelinek <jakub@redhat.com> + + PR pch/90326 + * g++.dg/pch/pr90326.C: New test. + * g++.dg/pch/pr90326.Hs: New file. + 2019-04-19 Jakub Jelinek <jakub@redhat.com> PR middle-end/90139 diff --git a/gcc/testsuite/g++.dg/pch/pr90326.C b/gcc/testsuite/g++.dg/pch/pr90326.C new file mode 100644 index 00000000000..6b4c5e1c730 --- /dev/null +++ b/gcc/testsuite/g++.dg/pch/pr90326.C @@ -0,0 +1,9 @@ +#include "pr90326.H" + +int main() +{ + float f = __FLT_MAX__; + if (f == 0.0) + __builtin_abort (); + return 0; +} diff --git a/gcc/testsuite/g++.dg/pch/pr90326.Hs b/gcc/testsuite/g++.dg/pch/pr90326.Hs new file mode 100644 index 00000000000..8b1a393741c --- /dev/null +++ b/gcc/testsuite/g++.dg/pch/pr90326.Hs @@ -0,0 +1 @@ +// empty -- cgit v1.2.3 From 589c7554acf30a2d8cede4881f4b3a5b38abea34 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek <jakub@redhat.com> Date: Thu, 29 Aug 2019 14:59:48 +0000 Subject: Backported from mainline 2019-05-15 Jakub Jelinek <jakub@redhat.com> PR debug/90197 * cp-gimplify.c (genericize_cp_loop): Emit a DEBUG_BEGIN_STMT before the condition (or if missing or constant non-zero at the end of the loop. Emit a DEBUG_BEGIN_STMT before the increment expression if any. Don't call protected_set_expr_location on incr if it already has a location. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@275038 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cp/ChangeLog | 9 +++++++++ gcc/cp/cp-gimplify.c | 29 ++++++++++++++++++++++++++--- 2 files changed, 35 insertions(+), 3 deletions(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index b0fc5073317..6ad02ccce91 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,6 +1,15 @@ 2019-08-29 Jakub Jelinek <jakub@redhat.com> Backported from mainline + 2019-05-15 Jakub Jelinek <jakub@redhat.com> + + PR debug/90197 + * cp-gimplify.c (genericize_cp_loop): Emit a DEBUG_BEGIN_STMT + before the condition (or if missing or constant non-zero at the end + of the loop. Emit a DEBUG_BEGIN_STMT before the increment expression + if any. Don't call protected_set_expr_location on incr if it already + has a location. + 2019-05-10 Jakub Jelinek <jakub@redhat.com> PR pch/90326 diff --git a/gcc/cp/cp-gimplify.c b/gcc/cp/cp-gimplify.c index 93bf3c33145..564a0d38d95 100644 --- a/gcc/cp/cp-gimplify.c +++ b/gcc/cp/cp-gimplify.c @@ -202,17 +202,26 @@ genericize_cp_loop (tree *stmt_p, location_t start_locus, tree cond, tree body, tree blab, clab; tree exit = NULL; tree stmt_list = NULL; + tree debug_begin = NULL; blab = begin_bc_block (bc_break, start_locus); clab = begin_bc_block (bc_continue, start_locus); - protected_set_expr_location (incr, start_locus); + if (EXPR_LOCATION (incr) == UNKNOWN_LOCATION) + protected_set_expr_location (incr, start_locus); cp_walk_tree (&cond, cp_genericize_r, data, NULL); cp_walk_tree (&body, cp_genericize_r, data, NULL); cp_walk_tree (&incr, cp_genericize_r, data, NULL); *walk_subtrees = 0; + if (MAY_HAVE_DEBUG_MARKER_STMTS + && (!cond || !integer_zerop (cond))) + { + debug_begin = build0 (DEBUG_BEGIN_STMT, void_type_node); + SET_EXPR_LOCATION (debug_begin, EXPR_LOC_OR_LOC (cond, start_locus)); + } + if (cond && TREE_CODE (cond) != INTEGER_CST) { /* If COND is constant, don't bother building an exit. If it's false, @@ -225,10 +234,24 @@ genericize_cp_loop (tree *stmt_p, location_t start_locus, tree cond, tree body, } if (exit && cond_is_first) - append_to_statement_list (exit, &stmt_list); + { + append_to_statement_list (debug_begin, &stmt_list); + debug_begin = NULL_TREE; + append_to_statement_list (exit, &stmt_list); + } append_to_statement_list (body, &stmt_list); finish_bc_block (&stmt_list, bc_continue, clab); - append_to_statement_list (incr, &stmt_list); + if (incr) + { + if (MAY_HAVE_DEBUG_MARKER_STMTS) + { + tree d = build0 (DEBUG_BEGIN_STMT, void_type_node); + SET_EXPR_LOCATION (d, EXPR_LOC_OR_LOC (incr, start_locus)); + append_to_statement_list (d, &stmt_list); + } + append_to_statement_list (incr, &stmt_list); + } + append_to_statement_list (debug_begin, &stmt_list); if (exit && !cond_is_first) append_to_statement_list (exit, &stmt_list); -- cgit v1.2.3 From 90babb50d4679a6a4cc9a0379c38874351318b7f Mon Sep 17 00:00:00 2001 From: Jakub Jelinek <jakub@redhat.com> Date: Thu, 29 Aug 2019 15:00:20 +0000 Subject: Backported from mainline 2019-05-24 Jakub Jelinek <jakub@redhat.com> PR libgomp/90585 * plugin/plugin-hsa.c (print_kernel_dispatch, run_kernel): Use PRIu64 macro instead of "lu". (release_kernel_dispatch): Likewise. Cast shadow->debug to uintptr_t before casting to void *. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@275039 138bc75d-0d04-0410-961f-82ee72b054a4 --- libgomp/ChangeLog | 11 +++++++++++ libgomp/plugin/plugin-hsa.c | 13 +++++++------ 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog index 5e4c94f87a9..c525e892d4c 100644 --- a/libgomp/ChangeLog +++ b/libgomp/ChangeLog @@ -1,3 +1,14 @@ +2019-08-29 Jakub Jelinek <jakub@redhat.com> + + Backported from mainline + 2019-05-24 Jakub Jelinek <jakub@redhat.com> + + PR libgomp/90585 + * plugin/plugin-hsa.c (print_kernel_dispatch, run_kernel): Use PRIu64 + macro instead of "lu". + (release_kernel_dispatch): Likewise. Cast shadow->debug to uintptr_t + before casting to void *. + 2019-06-11 Jakub Jelinek <jakub@redhat.com> PR target/90811 diff --git a/libgomp/plugin/plugin-hsa.c b/libgomp/plugin/plugin-hsa.c index 1fd47694846..7d279151e2a 100644 --- a/libgomp/plugin/plugin-hsa.c +++ b/libgomp/plugin/plugin-hsa.c @@ -1154,8 +1154,9 @@ create_single_kernel_dispatch (struct kernel_info *kernel, static void release_kernel_dispatch (struct GOMP_hsa_kernel_dispatch *shadow) { - HSA_DEBUG ("Released kernel dispatch: %p has value: %lu (%p)\n", shadow, - shadow->debug, (void *) shadow->debug); + HSA_DEBUG ("Released kernel dispatch: %p has value: %" PRIu64 " (%p)\n", + shadow, shadow->debug, + (void *) (uintptr_t) shadow->debug); hsa_fns.hsa_memory_free_fn (shadow->kernarg_address); @@ -1276,9 +1277,9 @@ print_kernel_dispatch (struct GOMP_hsa_kernel_dispatch *dispatch, unsigned inden indent_stream (stderr, indent); fprintf (stderr, "kernarg_address: %p\n", dispatch->kernarg_address); indent_stream (stderr, indent); - fprintf (stderr, "object: %lu\n", dispatch->object); + fprintf (stderr, "object: %" PRIu64 "\n", dispatch->object); indent_stream (stderr, indent); - fprintf (stderr, "signal: %lu\n", dispatch->signal); + fprintf (stderr, "signal: %" PRIu64 "\n", dispatch->signal); indent_stream (stderr, indent); fprintf (stderr, "private_segment_size: %u\n", dispatch->private_segment_size); @@ -1286,7 +1287,7 @@ print_kernel_dispatch (struct GOMP_hsa_kernel_dispatch *dispatch, unsigned inden fprintf (stderr, "group_segment_size: %u\n", dispatch->group_segment_size); indent_stream (stderr, indent); - fprintf (stderr, "children dispatches: %lu\n", + fprintf (stderr, "children dispatches: %" PRIu64 "\n", dispatch->kernel_dispatch_count); indent_stream (stderr, indent); fprintf (stderr, "omp_num_threads: %u\n", @@ -1594,7 +1595,7 @@ run_kernel (struct kernel_info *kernel, void *vars, hsa_signal_t child_s; child_s.handle = shadow->children_dispatches[i]->signal; - HSA_DEBUG ("Waiting for children completion signal: %lu\n", + HSA_DEBUG ("Waiting for children completion signal: %" PRIu64 "\n", shadow->children_dispatches[i]->signal); hsa_fns.hsa_signal_load_acquire_fn (child_s); } -- cgit v1.2.3 From 5f73b6bbbfb6a85f7dfd43a4e25e659ae6c2eb1c Mon Sep 17 00:00:00 2001 From: Jakub Jelinek <jakub@redhat.com> Date: Thu, 29 Aug 2019 15:01:10 +0000 Subject: Backported from mainline 2019-06-05 Jakub Jelinek <jakub@redhat.com> PR debug/90733 * var-tracking.c (vt_expand_loc_callback): Don't create raw subregs with VOIDmode inner operands. * gcc.dg/pr90733.c: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@275040 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 6 ++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/pr90733.c | 22 ++++++++++++++++++++++ gcc/var-tracking.c | 2 +- 4 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.dg/pr90733.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 8b527667bf8..320c9bd2d26 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,6 +1,12 @@ 2019-08-29 Jakub Jelinek <jakub@redhat.com> Backported from mainline + 2019-06-05 Jakub Jelinek <jakub@redhat.com> + + PR debug/90733 + * var-tracking.c (vt_expand_loc_callback): Don't create raw subregs + with VOIDmode inner operands. + 2019-04-19 Jakub Jelinek <jakub@redhat.com> PR middle-end/90139 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c374582bae6..51d3b6b06eb 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,6 +1,11 @@ 2019-08-29 Jakub Jelinek <jakub@redhat.com> Backported from mainline + 2019-06-05 Jakub Jelinek <jakub@redhat.com> + + PR debug/90733 + * gcc.dg/pr90733.c: New test. + 2019-05-10 Jakub Jelinek <jakub@redhat.com> PR pch/90326 diff --git a/gcc/testsuite/gcc.dg/pr90733.c b/gcc/testsuite/gcc.dg/pr90733.c new file mode 100644 index 00000000000..7d2a7fb559a --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr90733.c @@ -0,0 +1,22 @@ +/* PR debug/90733 */ +/* { dg-do compile } */ +/* { dg-options "-g -O2 -w" } */ + +struct S { unsigned a : 1; }; +union U { struct S b; _Complex unsigned c; }; + +union U +foo (union U d) +{ + union U e = d; + return e; +} + +int +bar (void) +{ + union U x, y; + x.c = x.b.a; + y = foo (x); + return x.c != y.c; +} diff --git a/gcc/var-tracking.c b/gcc/var-tracking.c index 80014e437dd..7fdbab098d9 100644 --- a/gcc/var-tracking.c +++ b/gcc/var-tracking.c @@ -8491,7 +8491,7 @@ vt_expand_loc_callback (rtx x, bitmap regs, /* Invalid SUBREGs are ok in debug info. ??? We could try alternate expansions for the VALUE as well. */ - if (!result) + if (!result && GET_MODE (subreg) != VOIDmode) result = gen_rtx_raw_SUBREG (GET_MODE (x), subreg, SUBREG_BYTE (x)); return result; -- cgit v1.2.3 From 034377d0a7a6d92160f73d0ac6d7f12ba1032f4b Mon Sep 17 00:00:00 2001 From: Jakub Jelinek <jakub@redhat.com> Date: Thu, 29 Aug 2019 15:01:54 +0000 Subject: Backported from mainline 2019-06-12 Jakub Jelinek <jakub@redhat.com> PR c/90760 * symtab.c (symtab_node::set_section): Allow being called on aliases as long as they aren't analyzed yet. * gcc.dg/pr90760.c: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@275041 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 6 ++++++ gcc/symtab.c | 2 +- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/pr90760.c | 8 ++++++++ 4 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.dg/pr90760.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 320c9bd2d26..b3720ed7c0f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,6 +1,12 @@ 2019-08-29 Jakub Jelinek <jakub@redhat.com> Backported from mainline + 2019-06-12 Jakub Jelinek <jakub@redhat.com> + + PR c/90760 + * symtab.c (symtab_node::set_section): Allow being called on aliases + as long as they aren't analyzed yet. + 2019-06-05 Jakub Jelinek <jakub@redhat.com> PR debug/90733 diff --git a/gcc/symtab.c b/gcc/symtab.c index 67e14d76b11..2e1ca27bae2 100644 --- a/gcc/symtab.c +++ b/gcc/symtab.c @@ -1546,7 +1546,7 @@ symtab_node::set_section (symtab_node *n, void *s) void symtab_node::set_section (const char *section) { - gcc_assert (!this->alias); + gcc_assert (!this->alias || !this->analyzed); call_for_symbol_and_aliases (symtab_node::set_section, const_cast<char *>(section), true); } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 51d3b6b06eb..e9b488112f1 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,6 +1,11 @@ 2019-08-29 Jakub Jelinek <jakub@redhat.com> Backported from mainline + 2019-06-12 Jakub Jelinek <jakub@redhat.com> + + PR c/90760 + * gcc.dg/pr90760.c: New test. + 2019-06-05 Jakub Jelinek <jakub@redhat.com> PR debug/90733 diff --git a/gcc/testsuite/gcc.dg/pr90760.c b/gcc/testsuite/gcc.dg/pr90760.c new file mode 100644 index 00000000000..525a21a732f --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr90760.c @@ -0,0 +1,8 @@ +/* PR c/90760 */ +/* { dg-do compile } */ +/* { dg-require-named-sections "" } */ + +void bar (void) {} +void foo (void) __attribute__ ((alias ("bar"))); /* { dg-error "section of alias 'foo' must match section of its target" } */ +void foo (void) __attribute__ ((section ("baz"))); +void qux (void) __attribute__ ((alias ("bar"), section ("baz"))); /* { dg-error "section of alias 'qux' must match section of its target" } */ -- cgit v1.2.3 From b9b55be0629d72f4bc3b3c04f5f2d6855b35a994 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek <jakub@redhat.com> Date: Thu, 29 Aug 2019 15:02:44 +0000 Subject: Backported from mainline 2019-06-21 Jakub Jelinek <jakub@redhat.com> PR c++/90950 * semantics.c (finish_omp_clauses): Don't reject references to incomplete types if processing_template_decl. * g++.dg/gomp/lastprivate-1.C: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@275042 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/semantics.c | 3 ++- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/gomp/lastprivate-1.C | 16 ++++++++++++++++ 4 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/gomp/lastprivate-1.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 6ad02ccce91..1eb49423c5d 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,6 +1,12 @@ 2019-08-29 Jakub Jelinek <jakub@redhat.com> Backported from mainline + 2019-06-21 Jakub Jelinek <jakub@redhat.com> + + PR c++/90950 + * semantics.c (finish_omp_clauses): Don't reject references to + incomplete types if processing_template_decl. + 2019-05-15 Jakub Jelinek <jakub@redhat.com> PR debug/90197 diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 2b803249904..797fb309902 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -7315,7 +7315,8 @@ finish_omp_clauses (tree clauses, enum c_omp_region_type ort) t = require_complete_type (t); if (t == error_mark_node) remove = true; - else if (TREE_CODE (TREE_TYPE (t)) == REFERENCE_TYPE + else if (!processing_template_decl + && TREE_CODE (TREE_TYPE (t)) == REFERENCE_TYPE && !complete_type_or_else (TREE_TYPE (TREE_TYPE (t)), t)) remove = true; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e9b488112f1..bdfd8291988 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,6 +1,11 @@ 2019-08-29 Jakub Jelinek <jakub@redhat.com> Backported from mainline + 2019-06-21 Jakub Jelinek <jakub@redhat.com> + + PR c++/90950 + * g++.dg/gomp/lastprivate-1.C: New test. + 2019-06-12 Jakub Jelinek <jakub@redhat.com> PR c/90760 diff --git a/gcc/testsuite/g++.dg/gomp/lastprivate-1.C b/gcc/testsuite/g++.dg/gomp/lastprivate-1.C new file mode 100644 index 00000000000..ce25e1a6b90 --- /dev/null +++ b/gcc/testsuite/g++.dg/gomp/lastprivate-1.C @@ -0,0 +1,16 @@ +// PR c++/90950 +// { dg-do compile } + +template <typename T> +T +foo (void) +{ + T y = 0; + T &x = y; + #pragma omp parallel for lastprivate (x) + for (int i = 0; i < 8; ++i) + x = i; + return x; +} + +int a = foo<int> (); -- cgit v1.2.3 From 861846d3a96a980e53a407344f26d78f87a4ecef Mon Sep 17 00:00:00 2001 From: Jakub Jelinek <jakub@redhat.com> Date: Thu, 29 Aug 2019 15:03:31 +0000 Subject: Backported from mainline 2019-06-25 Jakub Jelinek <jakub@redhat.com> PR sanitizer/90954 * c-omp.c (c_finish_omp_atomic): Allow tree_invariant_p in addition to SAVE_EXPR in first operand of a COMPOUND_EXPR. * c-c++-common/gomp/pr90954.c: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@275043 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/c-family/ChangeLog | 9 +++++++++ gcc/c-family/c-omp.c | 2 +- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/c-c++-common/gomp/pr90954.c | 27 +++++++++++++++++++++++++++ 4 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/c-c++-common/gomp/pr90954.c diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index aaa2b88e810..eb58110dbd8 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,12 @@ +2019-08-29 Jakub Jelinek <jakub@redhat.com> + + Backported from mainline + 2019-06-25 Jakub Jelinek <jakub@redhat.com> + + PR sanitizer/90954 + * c-omp.c (c_finish_omp_atomic): Allow tree_invariant_p in addition + to SAVE_EXPR in first operand of a COMPOUND_EXPR. + 2019-05-22 Eric Botcazou <ebotcazou@adacore.com> Backport from mainline diff --git a/gcc/c-family/c-omp.c b/gcc/c-family/c-omp.c index 8922759124d..f26d31b0147 100644 --- a/gcc/c-family/c-omp.c +++ b/gcc/c-family/c-omp.c @@ -300,7 +300,7 @@ c_finish_omp_atomic (location_t loc, enum tree_code code, if (TREE_CODE (x) == COMPOUND_EXPR) { pre = TREE_OPERAND (x, 0); - gcc_assert (TREE_CODE (pre) == SAVE_EXPR); + gcc_assert (TREE_CODE (pre) == SAVE_EXPR || tree_invariant_p (pre)); x = TREE_OPERAND (x, 1); } gcc_assert (TREE_CODE (x) == MODIFY_EXPR); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index bdfd8291988..ab8cdc9955d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,6 +1,11 @@ 2019-08-29 Jakub Jelinek <jakub@redhat.com> Backported from mainline + 2019-06-25 Jakub Jelinek <jakub@redhat.com> + + PR sanitizer/90954 + * c-c++-common/gomp/pr90954.c: New test. + 2019-06-21 Jakub Jelinek <jakub@redhat.com> PR c++/90950 diff --git a/gcc/testsuite/c-c++-common/gomp/pr90954.c b/gcc/testsuite/c-c++-common/gomp/pr90954.c new file mode 100644 index 00000000000..cc3a6e9e52a --- /dev/null +++ b/gcc/testsuite/c-c++-common/gomp/pr90954.c @@ -0,0 +1,27 @@ +/* PR sanitizer/90954 */ +/* { dg-do compile } */ +/* { dg-options "-fopenmp -fsanitize=undefined" } */ + +float v; +int i; + +void +foo (float x, float y) +{ + #pragma omp atomic + v += x / y; +} + +void +bar (int x, int y) +{ + #pragma omp atomic + i += x / y; +} + +void +baz (int x, int y) +{ + #pragma omp atomic + i *= (x << y); +} -- cgit v1.2.3 From faa40c403b7896c787c3867be87e050f9039c0eb Mon Sep 17 00:00:00 2001 From: Jakub Jelinek <jakub@redhat.com> Date: Thu, 29 Aug 2019 15:04:19 +0000 Subject: Backported from mainline 2019-07-04 Jakub Jelinek <jakub@redhat.com> PR rtl-optimization/90756 * explow.c (promote_ssa_mode): Always use TYPE_MODE, don't bypass it for VECTOR_TYPE_P. * gcc.dg/pr90756.c: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@275044 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 6 ++++++ gcc/explow.c | 11 +---------- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/pr90756.c | 26 ++++++++++++++++++++++++++ 4 files changed, 38 insertions(+), 10 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/pr90756.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b3720ed7c0f..4d1f93911cd 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,6 +1,12 @@ 2019-08-29 Jakub Jelinek <jakub@redhat.com> Backported from mainline + 2019-07-04 Jakub Jelinek <jakub@redhat.com> + + PR rtl-optimization/90756 + * explow.c (promote_ssa_mode): Always use TYPE_MODE, don't bypass it + for VECTOR_TYPE_P. + 2019-06-12 Jakub Jelinek <jakub@redhat.com> PR c/90760 diff --git a/gcc/explow.c b/gcc/explow.c index fb2b7ff9f95..72e52703c48 100644 --- a/gcc/explow.c +++ b/gcc/explow.c @@ -893,16 +893,7 @@ promote_ssa_mode (const_tree name, int *punsignedp) tree type = TREE_TYPE (name); int unsignedp = TYPE_UNSIGNED (type); - machine_mode mode = TYPE_MODE (type); - - /* Bypass TYPE_MODE when it maps vector modes to BLKmode. */ - if (mode == BLKmode) - { - gcc_assert (VECTOR_TYPE_P (type)); - mode = type->type_common.mode; - } - - machine_mode pmode = promote_mode (type, mode, &unsignedp); + machine_mode pmode = promote_mode (type, TYPE_MODE (type), &unsignedp); if (punsignedp) *punsignedp = unsignedp; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ab8cdc9955d..60191dcb1f6 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,6 +1,11 @@ 2019-08-29 Jakub Jelinek <jakub@redhat.com> Backported from mainline + 2019-07-04 Jakub Jelinek <jakub@redhat.com> + + PR rtl-optimization/90756 + * gcc.dg/pr90756.c: New test. + 2019-06-25 Jakub Jelinek <jakub@redhat.com> PR sanitizer/90954 diff --git a/gcc/testsuite/gcc.dg/pr90756.c b/gcc/testsuite/gcc.dg/pr90756.c new file mode 100644 index 00000000000..3507aa29e70 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr90756.c @@ -0,0 +1,26 @@ +/* PR rtl-optimization/90756 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -Wno-psabi" } */ +/* { dg-additional-options "-mno-sse" { target ia32 } } */ + +typedef float B __attribute__((vector_size(4 * sizeof (float)))); +typedef unsigned long long C __attribute__((vector_size(4 * sizeof (long long)))); +typedef short D __attribute__((vector_size(4 * sizeof (short)))); +B z; +void foo (C); +C bar (D); +B baz (); +D qux (B); + +void +quux (int x) +{ + B n = z, b = z; + while (1) + switch (x) + { + case 0: n = baz (); /* FALLTHRU */ + case 1: { B o = n; n = b; b = o; } /* FALLTHRU */ + case 2: { D u = qux (b); C v = bar (u); foo (v); } + } +} -- cgit v1.2.3 From 85b4282884e9115b57f45e79c83dc07583838524 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek <jakub@redhat.com> Date: Thu, 29 Aug 2019 15:05:01 +0000 Subject: Backported from mainline 2019-07-04 Jakub Jelinek <jakub@redhat.com> PR middle-end/78884 * gimplify.c (struct gimplify_omp_ctx): Add add_safelen1 member. (gimplify_bind_expr): If seeing TREE_ADDRESSABLE VLA inside of simd loop body, set ctx->add_safelen1 instead of making it GOVD_PRIVATE. (gimplify_adjust_omp_clauses): Add safelen (1) clause if ctx->add_safelen1 is set. * gcc.dg/gomp/pr78884.c: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@275045 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 7 +++++++ gcc/gimplify.c | 25 ++++++++++++++++++++++--- gcc/testsuite/ChangeLog | 3 +++ gcc/testsuite/gcc.dg/gomp/pr78884.c | 16 ++++++++++++++++ 4 files changed, 48 insertions(+), 3 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/gomp/pr78884.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4d1f93911cd..10ca77accd9 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -3,6 +3,13 @@ Backported from mainline 2019-07-04 Jakub Jelinek <jakub@redhat.com> + PR middle-end/78884 + * gimplify.c (struct gimplify_omp_ctx): Add add_safelen1 member. + (gimplify_bind_expr): If seeing TREE_ADDRESSABLE VLA inside of simd + loop body, set ctx->add_safelen1 instead of making it GOVD_PRIVATE. + (gimplify_adjust_omp_clauses): Add safelen (1) clause if + ctx->add_safelen1 is set. + PR rtl-optimization/90756 * explow.c (promote_ssa_mode): Always use TYPE_MODE, don't bypass it for VECTOR_TYPE_P. diff --git a/gcc/gimplify.c b/gcc/gimplify.c index 2971293a720..4d97c999f6a 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -191,6 +191,7 @@ struct gimplify_omp_ctx bool target_map_scalars_firstprivate; bool target_map_pointers_as_0len_arrays; bool target_firstprivatize_array_bases; + bool add_safelen1; }; static struct gimplify_ctx *gimplify_ctxp; @@ -1294,12 +1295,17 @@ gimplify_bind_expr (tree *expr_p, gimple_seq *pre_p) || splay_tree_lookup (ctx->variables, (splay_tree_key) t) == NULL)) { + int flag = GOVD_LOCAL; if (ctx->region_type == ORT_SIMD && TREE_ADDRESSABLE (t) && !TREE_STATIC (t)) - omp_add_variable (ctx, t, GOVD_PRIVATE | GOVD_SEEN); - else - omp_add_variable (ctx, t, GOVD_LOCAL | GOVD_SEEN); + { + if (TREE_CODE (DECL_SIZE_UNIT (t)) != INTEGER_CST) + ctx->add_safelen1 = true; + else + flag = GOVD_PRIVATE; + } + omp_add_variable (ctx, t, flag | GOVD_SEEN); } DECL_SEEN_IN_BIND_EXPR_P (t) = 1; @@ -9026,6 +9032,19 @@ gimplify_adjust_omp_clauses (gimple_seq *pre_p, gimple_seq body, tree *list_p, omp_find_stores_op, &wi); } } + + if (ctx->add_safelen1) + { + /* If there are VLAs in the body of simd loop, prevent + vectorization. */ + gcc_assert (ctx->region_type == ORT_SIMD); + c = build_omp_clause (UNKNOWN_LOCATION, OMP_CLAUSE_SAFELEN); + OMP_CLAUSE_SAFELEN_EXPR (c) = integer_one_node; + OMP_CLAUSE_CHAIN (c) = *list_p; + *list_p = c; + list_p = &OMP_CLAUSE_CHAIN (c); + } + while ((c = *list_p) != NULL) { splay_tree_node n; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 60191dcb1f6..bcff1e792dc 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -3,6 +3,9 @@ Backported from mainline 2019-07-04 Jakub Jelinek <jakub@redhat.com> + PR middle-end/78884 + * gcc.dg/gomp/pr78884.c: New test. + PR rtl-optimization/90756 * gcc.dg/pr90756.c: New test. diff --git a/gcc/testsuite/gcc.dg/gomp/pr78884.c b/gcc/testsuite/gcc.dg/gomp/pr78884.c new file mode 100644 index 00000000000..3e03df55867 --- /dev/null +++ b/gcc/testsuite/gcc.dg/gomp/pr78884.c @@ -0,0 +1,16 @@ +/* PR middle-end/78884 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -fopenmp" } */ + +void bar (int *); + +void +foo (int n) +{ +#pragma omp simd + for (int i = 0; i < 1024; i++) + { + int vla[n]; + bar (vla); + } +} -- cgit v1.2.3 From 3c0f386abf41bde9e78dab0294749d0658e363a2 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek <jakub@redhat.com> Date: Thu, 29 Aug 2019 15:05:47 +0000 Subject: Backported from mainline 2019-07-30 Jakub Jelinek <jakub@redhat.com> PR target/91150 * config/i386/i386.c (expand_vec_perm_blend): Change mask type from unsigned to unsigned HOST_WIDE_INT. For E_V64QImode cast comparison to unsigned HOST_WIDE_INT before shifting it left. * gcc.target/i386/avx512bw-pr91150.c: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@275046 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 7 +++++ gcc/config/i386/i386.c | 5 ++-- gcc/testsuite/ChangeLog | 5 ++++ gcc/testsuite/gcc.target/i386/avx512bw-pr91150.c | 37 ++++++++++++++++++++++++ 4 files changed, 52 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gcc.target/i386/avx512bw-pr91150.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 10ca77accd9..76370aaecf9 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,6 +1,13 @@ 2019-08-29 Jakub Jelinek <jakub@redhat.com> Backported from mainline + 2019-07-30 Jakub Jelinek <jakub@redhat.com> + + PR target/91150 + * config/i386/i386.c (expand_vec_perm_blend): Change mask type + from unsigned to unsigned HOST_WIDE_INT. For E_V64QImode cast + comparison to unsigned HOST_WIDE_INT before shifting it left. + 2019-07-04 Jakub Jelinek <jakub@redhat.com> PR middle-end/78884 diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 29272850ae6..7c92e698505 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -46293,7 +46293,8 @@ static bool expand_vec_perm_blend (struct expand_vec_perm_d *d) { machine_mode mmode, vmode = d->vmode; - unsigned i, mask, nelt = d->nelt; + unsigned i, nelt = d->nelt; + unsigned HOST_WIDE_INT mask; rtx target, op0, op1, maskop, x; rtx rperm[32], vperm; @@ -46347,7 +46348,7 @@ expand_vec_perm_blend (struct expand_vec_perm_d *d) case E_V16SImode: case E_V8DImode: for (i = 0; i < nelt; ++i) - mask |= (d->perm[i] >= nelt) << i; + mask |= ((unsigned HOST_WIDE_INT) (d->perm[i] >= nelt)) << i; break; case E_V2DImode: diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index bcff1e792dc..5decb77c2c7 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,6 +1,11 @@ 2019-08-29 Jakub Jelinek <jakub@redhat.com> Backported from mainline + 2019-07-30 Jakub Jelinek <jakub@redhat.com> + + PR target/91150 + * gcc.target/i386/avx512bw-pr91150.c: New test. + 2019-07-04 Jakub Jelinek <jakub@redhat.com> PR middle-end/78884 diff --git a/gcc/testsuite/gcc.target/i386/avx512bw-pr91150.c b/gcc/testsuite/gcc.target/i386/avx512bw-pr91150.c new file mode 100644 index 00000000000..8c6862265cb --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/avx512bw-pr91150.c @@ -0,0 +1,37 @@ +/* PR target/91150 */ +/* { dg-do run } */ +/* { dg-options "-O2 -mavx512bw" } */ +/* { dg-require-effective-target avx512bw } */ + +#include "avx512bw-check.h" + +typedef unsigned char V __attribute__((vector_size (64))); + +__attribute__((noipa)) void +foo (V *x, V *y, V *z) +{ + *x = __builtin_shuffle (*y, *z, (V) { 0, 1, 2, 3, 4, 5, 6, 7, 8, + 9, 10, 11, 12, 13, 14, 15, + 80, 81, 82, 83, 84, 85, 86, 87, + 88, 89, 90, 91, 92, 93, 94, 95, + 96, 97, 98, 99, 100, 101, 102, 103, + 104, 105, 106, 107, 108, 109, 110, 111, + 112, 113, 114, 115, 116, 117, 118, 119, + 120, 121, 122, 123, 124, 125, 126, 127 }); +} + +static void +avx512bw_test (void) +{ + union U { unsigned char a[64]; V v; } a, b, c; + int i; + for (i = 0; i < 64; i++) + { + b.a[i] = i + 1; + c.a[i] = i + 65; + } + foo (&a.v, &b.v, &c.v); + for (i = 0; i < 64; i++) + if (a.a[i] != (i < 16 ? i + 1 : i + 65)) + __builtin_abort (); +} -- cgit v1.2.3 From a12704e65cf76f7ec1394e8307d67d32f20b2fc6 Mon Sep 17 00:00:00 2001 From: Iain Sandoe <iain@sandoe.co.uk> Date: Thu, 29 Aug 2019 19:26:45 +0000 Subject: [Darwin] Fix PR87030 and tidy config fragments. This is about 32/64b host and multilib support across the range of Darwin systems. Prior to Darwin8 (OS X 10.4), the toolchains support only PowerPC and only 32b. On Darwin8 it is possible to target a 64b multilib, but with support limited to a few of the main libraries on the system (not a recommended configuration). From Darwin9 to Darwin17 (OSX 10.5 to 10.13) it is possible to have either 32 or 64b hosted toolchains, with support for a 64 or 32b multilib respectively. On Darwin9 the kernel is 32b, but with support for 64b executables, so it's conventional to build a 32b host toolchain supporting a 64b multilib. However this is not enforced (merely a convention). There is also some platform hardware supporting Darwin10/11 which is only 32b and for which the same situation applies. However, from Darwin10 to Darwin17, the majority of platform hardware supports a 64b kernel and it's conventional to build a 64b host toolchain with support for a 32b multilib. On/from Darwin18 (OS X 10.14), the development headers (in the SDK) no longer expose the interfaces for the 32b multilib support (although sufficient runtime support remains installed that the testsuite can be run for a 32b multilib). The PR is raised against this latter situation since the absence of exposed interfaces causes a 'default' bootstrap fail regardless of the availability of the runtimes. Given the number of permutations, I felt it warranted a general solution, especially since the current scheme of target headers and t-make fragments has become somewhat messy. The changes here enforce the single 32b PowerPC multilib for Darwin < 8 and the single X86 64b multilib for Darwin >= 18. This means that there is no longer any need to configure Darwin18+ '--disable-multilib', but also that if you want to use the ability to continue to test the compiler's 32b multilib there, you need to make a configuration targeting an earlier OS version (and using the SDK from that). 2019-08-29 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline 2019-07-24 Iain Sandoe <iain@sandoe.co.uk> PR bootstrap/87030 * config/i386/darwin.h (REAL_LIBGCC_SPEC): Revert change from r273749. PR bootstrap/87030 * config/i386/darwin.h (REAL_LIBGCC_SPEC): Move from here... * config/i386/darwin32-biarch.h .. to here. * config/i386/darwin64-biarch.h: Adjust comments. * config/rs6000/darwin32-biarch.h: Likewise. * config/rs6000/darwin64-biarch.h: Likewise. * config.gcc: Missed commit from r273746 (*-*-darwin*): Don't include CPU t-darwin here. (i[34567]86-*-darwin*): Adjust to use biarch files. Produce an error message if i686-darwin configuration is attempted for Darwin >= 18. Backport from mainline 2019-07-23 Iain Sandoe <iain@sandoe.co.uk> PR bootstrap/87030 * config.gcc (*-*-darwin*): Don't include CPU t-darwin here. (i[34567]86-*-darwin*): Adjust to use biarch files. Produce an error message if i686-darwin configuration is attempted for Darwin >= 18. (x86_64-*-darwin*): Switch to single multilib for Darwin >= 18. (powerpc-*-darwin*): Use biarch files where needed. (powerpc64-*-darwin*): Likewise. * config/i386/darwin.h (REAL_LIBGCC_SPEC): Move to new biarch file. (DARWIN_ARCH_SPEC, DARWIN_SUBARCH_SPEC): Revise for default single arch case. * config/i386/darwin32-biarch.h: New. * config/i386/darwin64.h: Rename. * gcc/config/i386/darwin64-biarch.h: To this. * config/i386/t-darwin: Rename. * gcc/config/i386/t-darwin32-biarch: To this. * config/i386/t-darwin64: Rename. * gcc/config/i386/t-darwin64-biarch: To this. * config/rs6000/darwin32-biarch.h: New. * config/rs6000/darwin64.h: Rename. * config/rs6000/darwin64-biarch.h: To this. (DARWIN_ARCH_SPEC, DARWIN_SUBARCH_SPEC): Revise for default single arch case. * config/rs6000/t-darwin8: Rename. * config/rs6000/t-darwin32-biarch: To this. * config/rs6000/t-darwin64 Rename. * config/rs6000/t-darwin64-biarch: To this. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@275052 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 51 ++++++++++++++++++++++++++++++++ gcc/config.gcc | 38 +++++++++++++++++------- gcc/config/i386/darwin.h | 17 ++++++----- gcc/config/i386/darwin32-biarch.h | 58 ++++++++++++++++++++++++++++++++++++ gcc/config/i386/darwin64-biarch.h | 59 +++++++++++++++++++++++++++++++++++++ gcc/config/i386/darwin64.h | 58 ------------------------------------ gcc/config/i386/t-darwin | 2 -- gcc/config/i386/t-darwin32-biarch | 2 ++ gcc/config/i386/t-darwin64 | 2 -- gcc/config/i386/t-darwin64-biarch | 2 ++ gcc/config/rs6000/darwin.h | 7 ++--- gcc/config/rs6000/darwin32-biarch.h | 49 ++++++++++++++++++++++++++++++ gcc/config/rs6000/darwin64-biarch.h | 38 ++++++++++++++++++++++++ gcc/config/rs6000/darwin64.h | 32 -------------------- gcc/config/rs6000/t-darwin32-biarch | 3 ++ gcc/config/rs6000/t-darwin64 | 2 -- gcc/config/rs6000/t-darwin64-biarch | 2 ++ gcc/config/rs6000/t-darwin8 | 3 -- 18 files changed, 303 insertions(+), 122 deletions(-) create mode 100644 gcc/config/i386/darwin32-biarch.h create mode 100644 gcc/config/i386/darwin64-biarch.h delete mode 100644 gcc/config/i386/darwin64.h delete mode 100644 gcc/config/i386/t-darwin create mode 100644 gcc/config/i386/t-darwin32-biarch delete mode 100644 gcc/config/i386/t-darwin64 create mode 100644 gcc/config/i386/t-darwin64-biarch create mode 100644 gcc/config/rs6000/darwin32-biarch.h create mode 100644 gcc/config/rs6000/darwin64-biarch.h delete mode 100644 gcc/config/rs6000/darwin64.h create mode 100644 gcc/config/rs6000/t-darwin32-biarch delete mode 100644 gcc/config/rs6000/t-darwin64 create mode 100644 gcc/config/rs6000/t-darwin64-biarch delete mode 100644 gcc/config/rs6000/t-darwin8 diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 76370aaecf9..afc43c4de6f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,54 @@ +2019-08-29 Iain Sandoe <iain@sandoe.co.uk> + + Backport from mainline + 2019-07-24 Iain Sandoe <iain@sandoe.co.uk> + + PR bootstrap/87030 + * config/i386/darwin.h (REAL_LIBGCC_SPEC): Revert change from r273749. + + PR bootstrap/87030 + * config/i386/darwin.h (REAL_LIBGCC_SPEC): Move from here... + * config/i386/darwin32-biarch.h .. to here. + * config/i386/darwin64-biarch.h: Adjust comments. + * config/rs6000/darwin32-biarch.h: Likewise. + * config/rs6000/darwin64-biarch.h: Likewise. + * config.gcc: Missed commit from r273746 + (*-*-darwin*): Don't include CPU t-darwin here. + (i[34567]86-*-darwin*): Adjust to use biarch files. Produce + an error message if i686-darwin configuration is attempted for + Darwin >= 18. + + Backport from mainline + 2019-07-23 Iain Sandoe <iain@sandoe.co.uk> + + PR bootstrap/87030 + * config.gcc (*-*-darwin*): Don't include CPU t-darwin here. + (i[34567]86-*-darwin*): Adjust to use biarch files. Produce + an error message if i686-darwin configuration is attempted for + Darwin >= 18. + (x86_64-*-darwin*): Switch to single multilib for Darwin >= 18. + (powerpc-*-darwin*): Use biarch files where needed. + (powerpc64-*-darwin*): Likewise. + * config/i386/darwin.h (REAL_LIBGCC_SPEC): Move to new biarch file. + (DARWIN_ARCH_SPEC, DARWIN_SUBARCH_SPEC): Revise for default single + arch case. + * config/i386/darwin32-biarch.h: New. + * config/i386/darwin64.h: Rename. + * gcc/config/i386/darwin64-biarch.h: To this. + * config/i386/t-darwin: Rename. + * gcc/config/i386/t-darwin32-biarch: To this. + * config/i386/t-darwin64: Rename. + * gcc/config/i386/t-darwin64-biarch: To this. + * config/rs6000/darwin32-biarch.h: New. + * config/rs6000/darwin64.h: Rename. + * config/rs6000/darwin64-biarch.h: To this. + (DARWIN_ARCH_SPEC, DARWIN_SUBARCH_SPEC): Revise for default single + arch case. + * config/rs6000/t-darwin8: Rename. + * config/rs6000/t-darwin32-biarch: To this. + * config/rs6000/t-darwin64 Rename. + * config/rs6000/t-darwin64-biarch: To this. + 2019-08-29 Jakub Jelinek <jakub@redhat.com> Backported from mainline diff --git a/gcc/config.gcc b/gcc/config.gcc index 6349300c863..33a21fafe48 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -647,7 +647,7 @@ x86_cpus="generic intel" # Common parts for widely ported systems. case ${target} in *-*-darwin*) - tmake_file="t-darwin ${cpu_type}/t-darwin" + tmake_file="t-darwin " tm_file="${tm_file} darwin.h" case ${target} in *-*-darwin9*) @@ -1479,16 +1479,25 @@ hppa[12]*-*-hpux11*) dwarf2=no fi ;; +i[34567]86-*-darwin1[89]*) + echo "Error: 32bit target is not supported after Darwin17" 1>&2 + ;; i[34567]86-*-darwin*) need_64bit_isa=yes # Baseline choice for a machine that allows m64 support. with_cpu=${with_cpu:-core2} + tmake_file="${tmake_file} ${cpu_type}/t-darwin32-biarch t-slibgcc" + tm_file="${tm_file} ${cpu_type}/darwin32-biarch.h" + ;; +x86_64-*-darwin1[89]* | x86_64-*-darwin2[01]*) + # Only 64b from now + with_cpu=${with_cpu:-core2} tmake_file="${tmake_file} t-slibgcc" ;; x86_64-*-darwin*) with_cpu=${with_cpu:-core2} - tmake_file="${tmake_file} ${cpu_type}/t-darwin64 t-slibgcc" - tm_file="${tm_file} ${cpu_type}/darwin64.h" + tmake_file="${tmake_file} ${cpu_type}/t-darwin64-biarch t-slibgcc" + tm_file="${tm_file} ${cpu_type}/darwin64-biarch.h" ;; i[34567]86-*-elfiamcu) tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h newlib-stdint.h i386/iamcu.h" @@ -2386,16 +2395,23 @@ pdp11-*-*) # extra_headers= # ;; powerpc-*-darwin*) - extra_options="${extra_options} rs6000/darwin.opt" + extra_options="${extra_options} ${cpu_type}/darwin.opt" case ${target} in - *-darwin1[0-9]* | *-darwin[8-9]*) - tmake_file="${tmake_file} rs6000/t-darwin8" - tm_file="${tm_file} rs6000/darwin8.h" + *-darwin1[0-9]* | *-darwin9*) + tmake_file="${tmake_file} ${cpu_type}/t-darwin32-biarch" + tm_file="${tm_file} ${cpu_type}/darwin32-biarch.h" + ;; + *-darwin8*) + tmake_file="${tmake_file} ${cpu_type}/t-darwin32-biarch" + tm_file="${tm_file} ${cpu_type}/darwin32-biarch.h" + tm_file="${tm_file} ${cpu_type}/darwin8.h" ;; *-darwin7*) - tm_file="${tm_file} rs6000/darwin7.h" + tm_file="${tm_file} ${cpu_type}/darwin7.h" ;; - *-darwin[0-6]*) + *-darwin[456]*) + # Earlier - ingle arch, with 32b only + # OS X 10.0, the first edition is Darwin4 ;; esac tmake_file="${tmake_file} t-slibgcc" @@ -2403,8 +2419,8 @@ powerpc-*-darwin*) ;; powerpc64-*-darwin*) extra_options="${extra_options} ${cpu_type}/darwin.opt" - tmake_file="${tmake_file} ${cpu_type}/t-darwin64 t-slibgcc" - tm_file="${tm_file} ${cpu_type}/darwin8.h ${cpu_type}/darwin64.h" + tmake_file="${tmake_file} ${cpu_type}/t-darwin64-biarch t-slibgcc" + tm_file="${tm_file} ${cpu_type}/darwin64-biarch.h" extra_headers=altivec.h ;; powerpc*-*-freebsd*) diff --git a/gcc/config/i386/darwin.h b/gcc/config/i386/darwin.h index a4ca89153b9..0603951d936 100644 --- a/gcc/config/i386/darwin.h +++ b/gcc/config/i386/darwin.h @@ -47,12 +47,13 @@ along with GCC; see the file COPYING3. If not see image. Therefore, for 64b exes at least, we must use the libunwind implementation, even when static-libgcc is specified. We put libSystem first so that - unwinder symbols are satisfied from there. */ + unwinder symbols are satisfied from there. + We default to 64b for single-arch builds, so apply this unconditionally. */ #undef REAL_LIBGCC_SPEC #define REAL_LIBGCC_SPEC \ "%{static-libgcc|static: \ - %{m64:%:version-compare(>= 10.6 mmacosx-version-min= -lSystem)} \ - -lgcc_eh -lgcc; \ + %:version-compare(>= 10.6 mmacosx-version-min= -lSystem) \ + -lgcc_eh -lgcc; \ shared-libgcc|fexceptions|fgnu-runtime: \ %:version-compare(!> 10.5 mmacosx-version-min= -lgcc_s.10.4) \ %:version-compare(>< 10.5 10.6 mmacosx-version-min= -lgcc_s.10.5) \ @@ -139,9 +140,6 @@ extern int darwin_emit_branch_islands; " ASM_OPTIONS " -force_cpusubtype_ALL \ %{static}" ASM_MMACOSX_VERSION_MIN_SPEC -#define DARWIN_ARCH_SPEC "%{m64:x86_64;:i386}" -#define DARWIN_SUBARCH_SPEC DARWIN_ARCH_SPEC - #undef ENDFILE_SPEC #define ENDFILE_SPEC \ "%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \ @@ -149,12 +147,15 @@ extern int darwin_emit_branch_islands; %{mpc64:crtprec64.o%s} \ %{mpc80:crtprec80.o%s}" TM_DESTRUCTOR +/* We default to x86_64 for single-arch builds, bi-arch overrides. */ +#define DARWIN_ARCH_SPEC "x86_64" + #undef SUBTARGET_EXTRA_SPECS #define SUBTARGET_EXTRA_SPECS \ DARWIN_EXTRA_SPECS \ - { "darwin_arch", DARWIN_ARCH_SPEC }, \ + { "darwin_arch", DARWIN_ARCH_SPEC }, \ { "darwin_crt2", "" }, \ - { "darwin_subarch", DARWIN_SUBARCH_SPEC }, + { "darwin_subarch", DARWIN_ARCH_SPEC }, /* The Darwin assembler mostly follows AT&T syntax. */ #undef ASSEMBLER_DIALECT diff --git a/gcc/config/i386/darwin32-biarch.h b/gcc/config/i386/darwin32-biarch.h new file mode 100644 index 00000000000..8dcc4a3b0b3 --- /dev/null +++ b/gcc/config/i386/darwin32-biarch.h @@ -0,0 +1,58 @@ +/* Target definitions for i386 running Darwin with a 32b host and supporting + a 64b multilib. + Copyright (C) 2019 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GCC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +<http://www.gnu.org/licenses/>. */ + +#undef DARWIN_ARCH_SPEC +#define DARWIN_ARCH_SPEC "%{m64:x86_64;:i386}" + +/* WORKAROUND pr80556: + For x86_64 Darwin10 and later, the unwinder is in libunwind (redirected + from libSystem). This doesn't use the keymgr (see keymgr.c) and therefore + the calls that libgcc makes to obtain the KEYMGR_GCC3_DW2_OBJ_LIST are not + updated to include new images, and might not even be valid for a single + image. + Therefore, for 64b exes at least, we must use the libunwind implementation, + even when static-libgcc is specified. We put libSystem first so that + unwinder symbols are satisfied from there. */ +#undef REAL_LIBGCC_SPEC +#define REAL_LIBGCC_SPEC \ + "%{static-libgcc|static: \ + %{m64:%:version-compare(>= 10.6 mmacosx-version-min= -lSystem)} \ + -lgcc_eh -lgcc; \ + shared-libgcc|fexceptions|fgnu-runtime: \ + %:version-compare(!> 10.5 mmacosx-version-min= -lgcc_s.10.4) \ + %:version-compare(>< 10.5 10.6 mmacosx-version-min= -lgcc_s.10.5) \ + %:version-compare(!> 10.5 mmacosx-version-min= -lgcc_ext.10.4) \ + %:version-compare(>= 10.5 mmacosx-version-min= -lgcc_ext.10.5) \ + -lgcc ; \ + :%:version-compare(>< 10.3.9 10.5 mmacosx-version-min= -lgcc_s.10.4) \ + %:version-compare(>< 10.5 10.6 mmacosx-version-min= -lgcc_s.10.5) \ + %:version-compare(!> 10.5 mmacosx-version-min= -lgcc_ext.10.4) \ + %:version-compare(>= 10.5 mmacosx-version-min= -lgcc_ext.10.5) \ + -lgcc }" + +#undef DARWIN_SUBARCH_SPEC +#define DARWIN_SUBARCH_SPEC DARWIN_ARCH_SPEC + +#undef SUBTARGET_EXTRA_SPECS +#define SUBTARGET_EXTRA_SPECS \ + DARWIN_EXTRA_SPECS \ + { "darwin_arch", DARWIN_ARCH_SPEC }, \ + { "darwin_crt2", "" }, \ + { "darwin_subarch", DARWIN_SUBARCH_SPEC }, diff --git a/gcc/config/i386/darwin64-biarch.h b/gcc/config/i386/darwin64-biarch.h new file mode 100644 index 00000000000..5af7665c2a7 --- /dev/null +++ b/gcc/config/i386/darwin64-biarch.h @@ -0,0 +1,59 @@ +/* Target definitions for x86_64 running Darwin with a 64b host supporting a + 32b multilib. + Copyright (C) 2006-2019 Free Software Foundation, Inc. + Contributed by Apple Computer Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GCC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +<http://www.gnu.org/licenses/>. */ + +#undef DARWIN_ARCH_SPEC +#define DARWIN_ARCH_SPEC "%{m32:i386;:x86_64}" + +/* WORKAROUND pr80556: + For x86_64 Darwin10 and later, the unwinder is in libunwind (redirected + from libSystem). This doesn't use the keymgr (see keymgr.c) and therefore + the calls that libgcc makes to obtain the KEYMGR_GCC3_DW2_OBJ_LIST are not + updated to include new images, and might not even be valid for a single + image. + Therefore, for 64b exes at least, we must use the libunwind implementation, + even when static-libgcc is specified. We put libSystem first so that + unwinder symbols are satisfied from there. */ +#undef REAL_LIBGCC_SPEC +#define REAL_LIBGCC_SPEC \ + "%{static-libgcc|static: \ + %{!m32:%:version-compare(>= 10.6 mmacosx-version-min= -lSystem)} \ + -lgcc_eh -lgcc; \ + shared-libgcc|fexceptions|fgnu-runtime: \ + %:version-compare(!> 10.5 mmacosx-version-min= -lgcc_s.10.4) \ + %:version-compare(>< 10.5 10.6 mmacosx-version-min= -lgcc_s.10.5) \ + %:version-compare(!> 10.5 mmacosx-version-min= -lgcc_ext.10.4) \ + %:version-compare(>= 10.5 mmacosx-version-min= -lgcc_ext.10.5) \ + -lgcc ; \ + :%:version-compare(>< 10.3.9 10.5 mmacosx-version-min= -lgcc_s.10.4) \ + %:version-compare(>< 10.5 10.6 mmacosx-version-min= -lgcc_s.10.5) \ + %:version-compare(!> 10.5 mmacosx-version-min= -lgcc_ext.10.4) \ + %:version-compare(>= 10.5 mmacosx-version-min= -lgcc_ext.10.5) \ + -lgcc }" + +#undef DARWIN_SUBARCH_SPEC +#define DARWIN_SUBARCH_SPEC DARWIN_ARCH_SPEC + +#undef SUBTARGET_EXTRA_SPECS +#define SUBTARGET_EXTRA_SPECS \ + DARWIN_EXTRA_SPECS \ + { "darwin_arch", DARWIN_ARCH_SPEC }, \ + { "darwin_crt2", "" }, \ + { "darwin_subarch", DARWIN_SUBARCH_SPEC }, diff --git a/gcc/config/i386/darwin64.h b/gcc/config/i386/darwin64.h deleted file mode 100644 index 87c4b8c14d3..00000000000 --- a/gcc/config/i386/darwin64.h +++ /dev/null @@ -1,58 +0,0 @@ -/* Target definitions for x86_64 running Darwin. - Copyright (C) 2006-2018 Free Software Foundation, Inc. - Contributed by Apple Computer Inc. - -This file is part of GCC. - -GCC is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 3, or (at your option) -any later version. - -GCC is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GCC; see the file COPYING3. If not see -<http://www.gnu.org/licenses/>. */ - -#undef DARWIN_ARCH_SPEC -#define DARWIN_ARCH_SPEC "%{m32:i386;:x86_64}" - -/* WORKAROUND pr80556: - For x86_64 Darwin10 and later, the unwinder is in libunwind (redirected - from libSystem). This doesn't use the keymgr (see keymgr.c) and therefore - the calls that libgcc makes to obtain the KEYMGR_GCC3_DW2_OBJ_LIST are not - updated to include new images, and might not even be valid for a single - image. - Therefore, for 64b exes at least, we must use the libunwind implementation, - even when static-libgcc is specified. We put libSystem first so that - unwinder symbols are satisfied from there. */ -#undef REAL_LIBGCC_SPEC -#define REAL_LIBGCC_SPEC \ - "%{static-libgcc|static: \ - %{!m32:%:version-compare(>= 10.6 mmacosx-version-min= -lSystem)} \ - -lgcc_eh -lgcc; \ - shared-libgcc|fexceptions|fgnu-runtime: \ - %:version-compare(!> 10.5 mmacosx-version-min= -lgcc_s.10.4) \ - %:version-compare(>< 10.5 10.6 mmacosx-version-min= -lgcc_s.10.5) \ - %:version-compare(!> 10.5 mmacosx-version-min= -lgcc_ext.10.4) \ - %:version-compare(>= 10.5 mmacosx-version-min= -lgcc_ext.10.5) \ - -lgcc ; \ - :%:version-compare(>< 10.3.9 10.5 mmacosx-version-min= -lgcc_s.10.4) \ - %:version-compare(>< 10.5 10.6 mmacosx-version-min= -lgcc_s.10.5) \ - %:version-compare(!> 10.5 mmacosx-version-min= -lgcc_ext.10.4) \ - %:version-compare(>= 10.5 mmacosx-version-min= -lgcc_ext.10.5) \ - -lgcc }" - -#undef DARWIN_SUBARCH_SPEC -#define DARWIN_SUBARCH_SPEC DARWIN_ARCH_SPEC - -#undef SUBTARGET_EXTRA_SPECS -#define SUBTARGET_EXTRA_SPECS \ - DARWIN_EXTRA_SPECS \ - { "darwin_arch", DARWIN_ARCH_SPEC }, \ - { "darwin_crt2", "" }, \ - { "darwin_subarch", DARWIN_SUBARCH_SPEC }, diff --git a/gcc/config/i386/t-darwin b/gcc/config/i386/t-darwin deleted file mode 100644 index bf44504d4fd..00000000000 --- a/gcc/config/i386/t-darwin +++ /dev/null @@ -1,2 +0,0 @@ -MULTILIB_OPTIONS = m64 -MULTILIB_DIRNAMES = x86_64 diff --git a/gcc/config/i386/t-darwin32-biarch b/gcc/config/i386/t-darwin32-biarch new file mode 100644 index 00000000000..bf44504d4fd --- /dev/null +++ b/gcc/config/i386/t-darwin32-biarch @@ -0,0 +1,2 @@ +MULTILIB_OPTIONS = m64 +MULTILIB_DIRNAMES = x86_64 diff --git a/gcc/config/i386/t-darwin64 b/gcc/config/i386/t-darwin64 deleted file mode 100644 index 6a6b22f1ee5..00000000000 --- a/gcc/config/i386/t-darwin64 +++ /dev/null @@ -1,2 +0,0 @@ -MULTILIB_OPTIONS = m32 -MULTILIB_DIRNAMES = i386 diff --git a/gcc/config/i386/t-darwin64-biarch b/gcc/config/i386/t-darwin64-biarch new file mode 100644 index 00000000000..6a6b22f1ee5 --- /dev/null +++ b/gcc/config/i386/t-darwin64-biarch @@ -0,0 +1,2 @@ +MULTILIB_OPTIONS = m32 +MULTILIB_DIRNAMES = i386 diff --git a/gcc/config/rs6000/darwin.h b/gcc/config/rs6000/darwin.h index c2f859abfb2..2e7a94aee2a 100644 --- a/gcc/config/rs6000/darwin.h +++ b/gcc/config/rs6000/darwin.h @@ -112,11 +112,10 @@ extern int darwin_emit_branch_islands; %<faltivec %<fno-altivec " \ DARWIN_CC1_SPEC -#define DARWIN_ARCH_SPEC "%{m64:ppc64;:ppc}" +/* Default to PPC for single arch builds. */ +#define DARWIN_ARCH_SPEC "ppc" #define DARWIN_SUBARCH_SPEC " \ - %{m64: ppc64} \ - %{!m64: \ %{mcpu=601:ppc601; \ mcpu=603:ppc603; \ mcpu=603e:ppc603; \ @@ -131,7 +130,7 @@ extern int darwin_emit_branch_islands; mcpu=970:ppc970; \ mcpu=power4:ppc970; \ mcpu=G5:ppc970; \ - :ppc}}" + :ppc}" /* crt2.o is at least partially required for 10.3.x and earlier. */ #define DARWIN_CRT2_SPEC \ diff --git a/gcc/config/rs6000/darwin32-biarch.h b/gcc/config/rs6000/darwin32-biarch.h new file mode 100644 index 00000000000..743aabfcea2 --- /dev/null +++ b/gcc/config/rs6000/darwin32-biarch.h @@ -0,0 +1,49 @@ +/* Target definitions for PowerPC running Darwin (Mac OS X) for a 32b host + with a 64b miultilib. + Copyright (C) 2019 Free Software Foundation, Inc. + + This file is part of GCC. + + GCC is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published + by the Free Software Foundation; either version 3, or (at your + option) any later version. + + GCC is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + License for more details. + + You should have received a copy of the GNU General Public License + along with GCC; see the file COPYING3. If not see + <http://www.gnu.org/licenses/>. */ + +#undef DARWIN_ARCH_SPEC +#define DARWIN_ARCH_SPEC "%{m64:ppc64;:ppc}" + +#undef DARWIN_SUBARCH_SPEC +#define DARWIN_SUBARCH_SPEC " \ + %{m64: ppc64} \ + %{!m64: \ + %{mcpu=601:ppc601; \ + mcpu=603:ppc603; \ + mcpu=603e:ppc603; \ + mcpu=604:ppc604; \ + mcpu=604e:ppc604e; \ + mcpu=740:ppc750; \ + mcpu=750:ppc750; \ + mcpu=G3:ppc750; \ + mcpu=7400:ppc7400; \ + mcpu=G4:ppc7400; \ + mcpu=7450:ppc7450; \ + mcpu=970:ppc970; \ + mcpu=power4:ppc970; \ + mcpu=G5:ppc970; \ + :ppc}}" + +#undef SUBTARGET_EXTRA_SPECS +#define SUBTARGET_EXTRA_SPECS \ + DARWIN_EXTRA_SPECS \ + { "darwin_arch", DARWIN_ARCH_SPEC }, \ + { "darwin_crt2", DARWIN_CRT2_SPEC }, \ + { "darwin_subarch", DARWIN_SUBARCH_SPEC }, diff --git a/gcc/config/rs6000/darwin64-biarch.h b/gcc/config/rs6000/darwin64-biarch.h new file mode 100644 index 00000000000..4f789544b9e --- /dev/null +++ b/gcc/config/rs6000/darwin64-biarch.h @@ -0,0 +1,38 @@ +/* Target definitions for PowerPC64 running Darwin (Mac OS X) for a 64b host + supporting a 32b multilib. + Copyright (C) 2006-2019 Free Software Foundation, Inc. + Contributed by Apple Computer Inc. + + This file is part of GCC. + + GCC is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published + by the Free Software Foundation; either version 3, or (at your + option) any later version. + + GCC is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + License for more details. + + You should have received a copy of the GNU General Public License + along with GCC; see the file COPYING3. If not see + <http://www.gnu.org/licenses/>. */ + +#undef TARGET_DEFAULT +#define TARGET_DEFAULT (MASK_POWERPC64 | MASK_64BIT \ + | MASK_MULTIPLE | MASK_PPC_GFXOPT) + +#undef DARWIN_ARCH_SPEC +#define DARWIN_ARCH_SPEC "%{m32:ppc;:ppc64}" + +/* Actually, there's really only 970 as an active option. */ +#undef DARWIN_SUBARCH_SPEC +#define DARWIN_SUBARCH_SPEC DARWIN_ARCH_SPEC + +#undef SUBTARGET_EXTRA_SPECS +#define SUBTARGET_EXTRA_SPECS \ + DARWIN_EXTRA_SPECS \ + { "darwin_arch", DARWIN_ARCH_SPEC }, \ + { "darwin_crt2", "" }, \ + { "darwin_subarch", DARWIN_SUBARCH_SPEC }, diff --git a/gcc/config/rs6000/darwin64.h b/gcc/config/rs6000/darwin64.h deleted file mode 100644 index 11c77b8dfee..00000000000 --- a/gcc/config/rs6000/darwin64.h +++ /dev/null @@ -1,32 +0,0 @@ -/* Target definitions for PowerPC running Darwin (Mac OS X). - Copyright (C) 2006-2018 Free Software Foundation, Inc. - Contributed by Apple Computer Inc. - - This file is part of GCC. - - GCC is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published - by the Free Software Foundation; either version 3, or (at your - option) any later version. - - GCC is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public - License for more details. - - You should have received a copy of the GNU General Public License - along with GCC; see the file COPYING3. If not see - <http://www.gnu.org/licenses/>. */ - -#undef TARGET_DEFAULT -#define TARGET_DEFAULT (MASK_POWERPC64 | MASK_64BIT \ - | MASK_MULTIPLE | MASK_PPC_GFXOPT) - -#undef DARWIN_ARCH_SPEC -#define DARWIN_ARCH_SPEC "%{m32:ppc;:ppc64}" - -#undef DARWIN_SUBARCH_SPEC -#define DARWIN_SUBARCH_SPEC DARWIN_ARCH_SPEC - -#undef DARWIN_CRT2_SPEC -#define DARWIN_CRT2_SPEC "" diff --git a/gcc/config/rs6000/t-darwin32-biarch b/gcc/config/rs6000/t-darwin32-biarch new file mode 100644 index 00000000000..2f3bb32f821 --- /dev/null +++ b/gcc/config/rs6000/t-darwin32-biarch @@ -0,0 +1,3 @@ +# 64-bit libraries can only be built in Darwin 8.x or later. +MULTILIB_OPTIONS = m64 +MULTILIB_DIRNAMES = ppc64 diff --git a/gcc/config/rs6000/t-darwin64 b/gcc/config/rs6000/t-darwin64 deleted file mode 100644 index b0a04c7d89d..00000000000 --- a/gcc/config/rs6000/t-darwin64 +++ /dev/null @@ -1,2 +0,0 @@ -MULTILIB_OPTIONS = m32 -MULTILIB_DIRNAMES = ppc diff --git a/gcc/config/rs6000/t-darwin64-biarch b/gcc/config/rs6000/t-darwin64-biarch new file mode 100644 index 00000000000..b0a04c7d89d --- /dev/null +++ b/gcc/config/rs6000/t-darwin64-biarch @@ -0,0 +1,2 @@ +MULTILIB_OPTIONS = m32 +MULTILIB_DIRNAMES = ppc diff --git a/gcc/config/rs6000/t-darwin8 b/gcc/config/rs6000/t-darwin8 deleted file mode 100644 index 2f3bb32f821..00000000000 --- a/gcc/config/rs6000/t-darwin8 +++ /dev/null @@ -1,3 +0,0 @@ -# 64-bit libraries can only be built in Darwin 8.x or later. -MULTILIB_OPTIONS = m64 -MULTILIB_DIRNAMES = ppc64 -- cgit v1.2.3 From 877c141c0d90858ff4b82211949ccdee107389ab Mon Sep 17 00:00:00 2001 From: Iain Sandoe <iain@sandoe.co.uk> Date: Thu, 29 Aug 2019 19:32:25 +0000 Subject: [Darwin, testsuite] Backport fix for PR67958. 2019-08-29 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline. 2019-05-21 Iain Sandoe <iain@sandoe.co.uk> PR testsuite/67958 * gcc.target/i386/pr32219-1.c: Adjust scan-asms for Darwin, comment the differences. * gcc.target/i386/pr32219-2.c: Likewise. * gcc.target/i386/pr32219-3.c: Likewise. * gcc.target/i386/pr32219-4.c: Likewise. * gcc.target/i386/pr32219-5.c: Likewise. * gcc.target/i386/pr32219-6.c: Likewise. * gcc.target/i386/pr32219-7.c: Likewise. * gcc.target/i386/pr32219-8.c: Likewise. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@275053 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/testsuite/ChangeLog | 16 ++++++++++++++++ gcc/testsuite/gcc.target/i386/pr32219-1.c | 12 ++++++++---- gcc/testsuite/gcc.target/i386/pr32219-2.c | 11 +++++++++-- gcc/testsuite/gcc.target/i386/pr32219-3.c | 17 +++++++++++++---- gcc/testsuite/gcc.target/i386/pr32219-4.c | 10 ++++++++-- gcc/testsuite/gcc.target/i386/pr32219-5.c | 10 +++++++--- gcc/testsuite/gcc.target/i386/pr32219-6.c | 15 +++++++++++---- gcc/testsuite/gcc.target/i386/pr32219-7.c | 16 ++++++++++++---- gcc/testsuite/gcc.target/i386/pr32219-8.c | 12 +++++++++--- 9 files changed, 93 insertions(+), 26 deletions(-) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 5decb77c2c7..9581b0787b5 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,19 @@ +2019-08-29 Iain Sandoe <iain@sandoe.co.uk> + + Backport from mainline. + 2019-05-21 Iain Sandoe <iain@sandoe.co.uk> + + PR testsuite/67958 + * gcc.target/i386/pr32219-1.c: Adjust scan-asms for Darwin, comment + the differences. + * gcc.target/i386/pr32219-2.c: Likewise. + * gcc.target/i386/pr32219-3.c: Likewise. + * gcc.target/i386/pr32219-4.c: Likewise. + * gcc.target/i386/pr32219-5.c: Likewise. + * gcc.target/i386/pr32219-6.c: Likewise. + * gcc.target/i386/pr32219-7.c: Likewise. + * gcc.target/i386/pr32219-8.c: Likewise. + 2019-08-29 Jakub Jelinek <jakub@redhat.com> Backported from mainline diff --git a/gcc/testsuite/gcc.target/i386/pr32219-1.c b/gcc/testsuite/gcc.target/i386/pr32219-1.c index bb28f9f0f58..0fcb138695b 100644 --- a/gcc/testsuite/gcc.target/i386/pr32219-1.c +++ b/gcc/testsuite/gcc.target/i386/pr32219-1.c @@ -12,7 +12,11 @@ foo () return xxx; } -/* { dg-final { scan-assembler "movl\[ \t\]xxx\\(%rip\\), %eax" { target { ! ia32 } } } } */ -/* { dg-final { scan-assembler-not "xxx@GOTPCREL" { target { ! ia32 } } } } */ -/* { dg-final { scan-assembler "movl\[ \t\]xxx@GOTOFF\\(%\[^,\]*\\), %eax" { target ia32 } } } */ -/* { dg-final { scan-assembler-not "movl\[ \t\]xxx@GOT\\(%\[^,\]*\\), %eax" { target ia32 } } } */ +/* { dg-final { scan-assembler {movl[ \t]_?xxx\(%rip\),[ \t]%eax} { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-not "_?xxx@GOTPCREL" { target { ! ia32 } } } } */ + +/* { dg-final { scan-assembler "movl\[ \t\]xxx@GOTOFF\\(%\[^,\]*\\), %eax" { target { ia32 && { ! *-*-darwin* } } } } } */ +/* { dg-final { scan-assembler-not "movl\[ \t\]_?xxx@GOT\\(%\[^,\]*\\), %eax" { target { ia32 && { ! *-*-darwin* } } } } } */ + +/* For Darwin, we default to PIC - but that's needed for Darwin's PIE. */ +/* { dg-final { scan-assembler {movl[ \t]_xxx-L1\$pb\(%eax\),[ \t]%eax} { target { ia32 && *-*-darwin* } } } } */ diff --git a/gcc/testsuite/gcc.target/i386/pr32219-2.c b/gcc/testsuite/gcc.target/i386/pr32219-2.c index b30862d2488..cb587db47aa 100644 --- a/gcc/testsuite/gcc.target/i386/pr32219-2.c +++ b/gcc/testsuite/gcc.target/i386/pr32219-2.c @@ -12,6 +12,13 @@ foo () } /* { dg-final { scan-assembler-not "movl\[ \t\]xxx\\(%rip\\), %" { target { ! ia32 } } } } */ +/* For Darwin m64 we are always PIC, but common symbols are indirected, which happens to + match the general "ELF" case. */ /* { dg-final { scan-assembler "xxx@GOTPCREL" { target { ! ia32 } } } } */ -/* { dg-final { scan-assembler-not "movl\[ \t\]xxx@GOTOFF\\(%\[^,\]*\\), %" { target ia32 } } } */ -/* { dg-final { scan-assembler "movl\[ \t\]xxx@GOT\\(%\[^,\]*\\), %" { target ia32 } } } */ + +/* { dg-final { scan-assembler-not "movl\[ \t\]xxx@GOTOFF\\(%\[^,\]*\\), %" { target { ia32 && { ! *-*-darwin* } } } } } */ +/* { dg-final { scan-assembler "movl\[ \t\]xxx@GOT\\(%\[^,\]*\\), %" { target { ia32 && { ! *-*-darwin* } } } } } */ + +/* Darwin m32 defaults to PIC but common symbols need to be indirected. */ +/* { dg-final { scan-assembler {movl[ \t]l_xxx\$non_lazy_ptr-L1\$pb\(%eax\),[ \t]%eax} { target { ia32 && *-*-darwin* } } } } */ + diff --git a/gcc/testsuite/gcc.target/i386/pr32219-3.c b/gcc/testsuite/gcc.target/i386/pr32219-3.c index 657fb7831f0..f9cfca7d72c 100644 --- a/gcc/testsuite/gcc.target/i386/pr32219-3.c +++ b/gcc/testsuite/gcc.target/i386/pr32219-3.c @@ -12,7 +12,16 @@ foo () return xxx; } -/* { dg-final { scan-assembler "movl\[ \t\]xxx\\(%rip\\), %eax" { target { ! ia32 } } } } */ -/* { dg-final { scan-assembler-not "xxx@GOTPCREL" { target { ! ia32 } } } } */ -/* { dg-final { scan-assembler "movl\[ \t\]xxx@GOTOFF\\(%\[^,\]*\\), %eax" { target ia32 } } } */ -/* { dg-final { scan-assembler-not "movl\[ \t\]xxx@GOT\\(%\[^,\]*\\), %eax" { target ia32 } } } */ +/* { dg-final { scan-assembler {movl[ \t]xxx\(%rip\),[ \t]%eax} { target { { ! ia32 } && { ! *-*-darwin* } } } } } */ +/* { dg-final { scan-assembler-not "xxx@GOTPCREL" { target { { ! ia32 } && { ! *-*-darwin* } } } } } */ + +/* For Darwin m64, code is always PIC and we need to indirect through the GOT to allow + weak symbols to be interposed. The dynamic loader knows how to apply PIE to this. */ +/* { dg-final { scan-assembler {movq[ \t]_xxx@GOTPCREL\(%rip\),[ \t]%rax} { target { { ! ia32 } && *-*-darwin* } } } } */ + +/* { dg-final { scan-assembler "movl\[ \t\]xxx@GOTOFF\\(%\[^,\]*\\), %eax" { target { ia32 && { ! *-*-darwin* } } } } } */ +/* { dg-final { scan-assembler-not "movl\[ \t\]xxx@GOT\\(%\[^,\]*\\), %eax" { target { ia32 && { ! *-*-darwin* } } } } } */ + +/* For Darwin, we need PIC to allow PIE, but also we must indirect weak symbols so that + they can be indirected. Again, dyld knows how to deal with this. */ +/* { dg-final { scan-assembler {movl[ \t]l_xxx\$non_lazy_ptr-L1\$pb\(%eax\),[ \t]%eax} { target { ia32 && *-*-darwin* } } } } */ diff --git a/gcc/testsuite/gcc.target/i386/pr32219-4.c b/gcc/testsuite/gcc.target/i386/pr32219-4.c index ff62fa4c051..0ac0674ae17 100644 --- a/gcc/testsuite/gcc.target/i386/pr32219-4.c +++ b/gcc/testsuite/gcc.target/i386/pr32219-4.c @@ -13,6 +13,12 @@ foo () } /* { dg-final { scan-assembler-not "movl\[ \t\]xxx\\(%rip\\), %" { target { ! ia32 } } } } */ +/* Darwin is always PIC for PIE so no change, weak symbols need to be indirect and this + happens to match the ELF case. */ /* { dg-final { scan-assembler "xxx@GOTPCREL" { target { ! ia32 } } } } */ -/* { dg-final { scan-assembler-not "movl\[ \t\]xxx@GOTOFF\\(%\[^,\]*\\), %" { target ia32 } } } */ -/* { dg-final { scan-assembler "movl\[ \t\]xxx@GOT\\(%\[^,\]*\\), %" { target ia32 } } } */ + +/* { dg-final { scan-assembler-not "movl\[ \t\]xxx@GOTOFF\\(%\[^,\]*\\), %" { target { ia32 && { ! *-*-darwin* } } } } } */ +/* { dg-final { scan-assembler "movl\[ \t\]xxx@GOT\\(%\[^,\]*\\), %" { target { ia32 && { ! *-*-darwin* } } } } } */ + +/* Darwin m32 equivalent (indirect and PIC). */ +/* { dg-final { scan-assembler {movl[ \t]l_xxx\$non_lazy_ptr-L1\$pb\(%eax\),[ \t]%eax} { target { ia32 && *-*-darwin* } } } } */ diff --git a/gcc/testsuite/gcc.target/i386/pr32219-5.c b/gcc/testsuite/gcc.target/i386/pr32219-5.c index e8844c85ff0..11496dc8608 100644 --- a/gcc/testsuite/gcc.target/i386/pr32219-5.c +++ b/gcc/testsuite/gcc.target/i386/pr32219-5.c @@ -11,7 +11,11 @@ foo () return xxx; } -/* { dg-final { scan-assembler "movl\[ \t\]xxx\\(%rip\\), %eax" { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler "movl\[ \t\]_?xxx\\(%rip\\), %eax" { target { ! ia32 } } } } */ /* { dg-final { scan-assembler-not "xxx@GOTPCREL" { target { ! ia32 } } } } */ -/* { dg-final { scan-assembler "movl\[ \t\]xxx@GOTOFF\\(%\[^,\]*\\), %eax" { target ia32 } } } */ -/* { dg-final { scan-assembler-not "movl\[ \t\]xxx@GOT\\(%\[^,\]*\\), %eax" { target ia32 } } } */ + +/* { dg-final { scan-assembler "movl\[ \t\]xxx@GOTOFF\\(%\[^,\]*\\), %eax" { target { ia32 && { ! *-*-darwin* } } } } } */ +/* { dg-final { scan-assembler-not "movl\[ \t\]xxx@GOT\\(%\[^,\]*\\), %eax" { target { ia32 && { ! *-*-darwin* } } } } } */ + +/* For Darwin m32, we need PIC (the default) to allow PIE. */ +/* { dg-final { scan-assembler {movl[ \t]_xxx-L1\$pb\(%eax\),[ \t]%eax} { target { ia32 && *-*-darwin* } } } } */ diff --git a/gcc/testsuite/gcc.target/i386/pr32219-6.c b/gcc/testsuite/gcc.target/i386/pr32219-6.c index 24e55ae0146..ff41ebd399e 100644 --- a/gcc/testsuite/gcc.target/i386/pr32219-6.c +++ b/gcc/testsuite/gcc.target/i386/pr32219-6.c @@ -11,7 +11,14 @@ foo () return xxx; } -/* { dg-final { scan-assembler-not "movl\[ \t\]xxx\\(%rip\\), %" { target { ! ia32 } } } } */ -/* { dg-final { scan-assembler "xxx@GOTPCREL" { target { ! ia32 } } } } */ -/* { dg-final { scan-assembler-not "movl\[ \t\]xxx@GOTOFF\\(%\[^,\]*\\), %" { target ia32 } } } */ -/* { dg-final { scan-assembler "movl\[ \t\]xxx@GOT\\(%\[^,\]*\\), %" { target ia32 } } } */ +/* { dg-final { scan-assembler-not "movl\[ \t\]xxx\\(%rip\\), %" { target { { ! ia32 } && { ! *-*-darwin* } } } } } */ +/* { dg-final { scan-assembler "xxx@GOTPCREL" { target { { ! ia32 } && { ! *-*-darwin* } } } } } */ + +/* Darwin m64 is always PIC, and the dynamic linker doesn't need an indirection. */ +/* { dg-final { scan-assembler {movl[ \t]_xxx\(%rip\),[ \t]%eax} { target { { ! ia32 } && *-*-darwin* } } } } */ + +/* { dg-final { scan-assembler-not "movl\[ \t\]xxx@GOTOFF\\(%\[^,\]*\\), %" { target { ia32 && { ! *-*-darwin* } } } } } */ +/* { dg-final { scan-assembler "movl\[ \t\]xxx@GOT\\(%\[^,\]*\\), %" { target { ia32 && { ! *-*-darwin* } } } } } */ + +/* Darwin m32 defaults to PIC, so no change. */ +/* { dg-final { scan-assembler {movl[ \t]_xxx-L1\$pb\(%eax\),[ \t]%eax} { target { ia32 && *-*-darwin* } } } } */ diff --git a/gcc/testsuite/gcc.target/i386/pr32219-7.c b/gcc/testsuite/gcc.target/i386/pr32219-7.c index 9273d3ed9bb..469e9e38b07 100644 --- a/gcc/testsuite/gcc.target/i386/pr32219-7.c +++ b/gcc/testsuite/gcc.target/i386/pr32219-7.c @@ -12,7 +12,15 @@ foo () return xxx; } -/* { dg-final { scan-assembler "movl\[ \t\]xxx\\(%rip\\), %eax" { target { ! ia32 } } } } */ -/* { dg-final { scan-assembler-not "xxx@GOTPCREL" { target { ! ia32 } } } } */ -/* { dg-final { scan-assembler "movl\[ \t\]xxx@GOTOFF\\(%\[^,\]*\\), %eax" { target ia32 } } } */ -/* { dg-final { scan-assembler-not "movl\[ \t\]xxx@GOT\\(%\[^,\]*\\), %eax" { target ia32 } } } */ +/* { dg-final { scan-assembler "movl\[ \t\]xxx\\(%rip\\), %eax" { target { { ! ia32 } && { ! *-*-darwin* } } } } } */ +/* { dg-final { scan-assembler-not "xxx@GOTPCREL" { target { { ! ia32 } && { ! *-*-darwin* } } } } } */ + +/* For Darwin m64, code is always PIC but we need to indirect through the GOT to allow + weak symbols to be interposed. The dynamic loader knows how to apply PIE to this. */ +/* { dg-final { scan-assembler {movq[ \t]_xxx@GOTPCREL\(%rip\),[ \t]%rax} { target { { ! ia32 } && *-*-darwin* } } } } */ + +/* { dg-final { scan-assembler "movl\[ \t\]xxx@GOTOFF\\(%\[^,\]*\\), %eax" { target { ia32 && { ! *-*-darwin* } } } } } */ +/* { dg-final { scan-assembler-not "movl\[ \t\]xxx@GOT\\(%\[^,\]*\\), %eax" { target { ia32 && { ! *-*-darwin* } } } } } */ + +/* Darwin m32 equivalent (indirect and PIC). */ +/* { dg-final { scan-assembler {movl[ \t]l_xxx\$non_lazy_ptr-L1\$pb\(%eax\),[ \t]%eax} { target { ia32 && *-*-darwin* } } } } */ diff --git a/gcc/testsuite/gcc.target/i386/pr32219-8.c b/gcc/testsuite/gcc.target/i386/pr32219-8.c index c44919509de..75eb287fc59 100644 --- a/gcc/testsuite/gcc.target/i386/pr32219-8.c +++ b/gcc/testsuite/gcc.target/i386/pr32219-8.c @@ -13,6 +13,12 @@ foo () } /* { dg-final { scan-assembler-not "movl\[ \t\]xxx\\(%rip\\), %" { target { ! ia32 } } } } */ -/* { dg-final { scan-assembler "xxx@GOTPCREL" { target { ! ia32 } } } } */ -/* { dg-final { scan-assembler-not "movl\[ \t\]xxx@GOTOFF\\(%\[^,\]*\\), %" { target ia32 } } } */ -/* { dg-final { scan-assembler "movl\[ \t\]xxx@GOT\\(%\[^,\]*\\), %" { target ia32 } } } */ +/* Darwin is always PIC so no change, weak symbols needs to be indirect and this + happens to match the ELF case. */ +/* { dg-final { scan-assembler "_?xxx@GOTPCREL" { target { ! ia32 } } } } */ + +/* { dg-final { scan-assembler-not "movl\[ \t\]xxx@GOTOFF\\(%\[^,\]*\\), %" { target { ia32 && { ! *-*-darwin* } } } } } */ +/* { dg-final { scan-assembler "movl\[ \t\]xxx@GOT\\(%\[^,\]*\\), %" { target { ia32 && { ! *-*-darwin* } } } } } */ + +/* Darwin m32 default to PIC but needs indirection for the weak symbol. */ +/* { dg-final { scan-assembler {movl[ \t]l_xxx\$non_lazy_ptr-L1\$pb\(%eax\),[ \t]%eax} { target { ia32 && *-*-darwin* } } } } */ -- cgit v1.2.3 From 8110289d8ce856106c4daa4e4e5a2f16f02fd22c Mon Sep 17 00:00:00 2001 From: Iain Sandoe <iain@sandoe.co.uk> Date: Thu, 29 Aug 2019 19:36:50 +0000 Subject: [Darwin, testsuite] Backport fix for PR27221. 2019-08-29 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline. 2019-05-22 Iain Sandoe <iain@sandoe.co.uk> PR testsuite/27221 * g++.dg/ext/alignof2.C: XFAIL for 32bit Darwin. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@275054 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/testsuite/ChangeLog | 8 ++++++++ gcc/testsuite/g++.dg/ext/alignof2.C | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 9581b0787b5..70e2210bea8 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2019-08-29 Iain Sandoe <iain@sandoe.co.uk> + + Backport from mainline. + 2019-05-22 Iain Sandoe <iain@sandoe.co.uk> + + PR testsuite/27221 + * g++.dg/ext/alignof2.C: XFAIL for 32bit Darwin. + 2019-08-29 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline. diff --git a/gcc/testsuite/g++.dg/ext/alignof2.C b/gcc/testsuite/g++.dg/ext/alignof2.C index 22175902f83..bd56cf627a4 100644 --- a/gcc/testsuite/g++.dg/ext/alignof2.C +++ b/gcc/testsuite/g++.dg/ext/alignof2.C @@ -3,7 +3,7 @@ // wrong for some fields. // { dg-do run } -// { dg-xfail-run-if "AIX ABI increases struct alignment for first member double" { powerpc-ibm-aix* } } +// { dg-xfail-run-if "AIX/Darwin ABI increases struct alignment for first member double" { powerpc-ibm-aix* || { ilp32 && powerpc-*-darwin* } } } extern "C" void abort(); -- cgit v1.2.3 From 0d7ee88e44f3f0f6a9b4aac9ba5f9bf599625d25 Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Fri, 30 Aug 2019 00:16:09 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@275057 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index b37e6486229..53042e90b9a 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190829 +20190830 -- cgit v1.2.3 From 0d6e0b2a1d153f64384a57234c760ef776f0ded7 Mon Sep 17 00:00:00 2001 From: Richard Biener <rguenther@suse.de> Date: Fri, 30 Aug 2019 07:57:47 +0000 Subject: 2019-08-30 Richard Biener <rguenther@suse.de> Backport from mainline 2019-04-24 Richard Biener <rguenther@suse.de> PR middle-end/90213 * gimple-fold.c (fold_const_aggregate_ref_1): Do multiplication by size and BITS_PER_UNIT on poly-wide-ints. 2019-04-11 Richard Biener <rguenther@suse.de> PR tree-optimization/90020 * tree-ssa-sccvn.c (vn_reference_may_trap): New function. * tree-ssa-sccvn.h (vn_reference_may_trap): Declare. * tree-ssa-pre.c (compute_avail): Use it to not put possibly trapping references after a call that might not return into EXP_GEN. * gcse.c (compute_hash_table_work): Do not elide marking a block containing a call if the call might not return. * gcc.dg/torture/pr90020.c: New testcase. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@275060 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 21 ++++++++++++++ gcc/gcse.c | 3 +- gcc/gimple-fold.c | 8 ++---- gcc/testsuite/ChangeLog | 8 ++++++ gcc/testsuite/gcc.dg/torture/pr90020.c | 27 ++++++++++++++++++ gcc/tree-ssa-pre.c | 7 +++++ gcc/tree-ssa-sccvn.c | 51 ++++++++++++++++++++++++++++++++++ gcc/tree-ssa-sccvn.h | 1 + 8 files changed, 119 insertions(+), 7 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/torture/pr90020.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index afc43c4de6f..6da3ab6efb3 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,24 @@ +2019-08-30 Richard Biener <rguenther@suse.de> + + Backport from mainline + 2019-04-24 Richard Biener <rguenther@suse.de> + + PR middle-end/90213 + * gimple-fold.c (fold_const_aggregate_ref_1): Do multiplication + by size and BITS_PER_UNIT on poly-wide-ints. + + 2019-04-11 Richard Biener <rguenther@suse.de> + + PR tree-optimization/90020 + * tree-ssa-sccvn.c (vn_reference_may_trap): New function. + * tree-ssa-sccvn.h (vn_reference_may_trap): Declare. + * tree-ssa-pre.c (compute_avail): Use it to not put + possibly trapping references after a call that might not + return into EXP_GEN. + * gcse.c (compute_hash_table_work): Do not elide + marking a block containing a call if the call might not + return. + 2019-08-29 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline diff --git a/gcc/gcse.c b/gcc/gcse.c index 79d612dfa56..36420b9b52e 100644 --- a/gcc/gcse.c +++ b/gcc/gcse.c @@ -1532,7 +1532,8 @@ compute_hash_table_work (struct gcse_hash_table_d *table) 0, regno, hrsi) record_last_reg_set_info (insn, regno); - if (! RTL_CONST_OR_PURE_CALL_P (insn)) + if (! RTL_CONST_OR_PURE_CALL_P (insn) + || RTL_LOOPING_CONST_OR_PURE_CALL_P (insn)) record_last_mem_set_info (insn); } diff --git a/gcc/gimple-fold.c b/gcc/gimple-fold.c index 1117c9d6b44..7f2a0a526fe 100644 --- a/gcc/gimple-fold.c +++ b/gcc/gimple-fold.c @@ -6720,14 +6720,10 @@ fold_const_aggregate_ref_1 (tree t, tree (*valueize) (tree)) = wi::sext (wi::to_poly_offset (idx) - wi::to_poly_offset (low_bound), TYPE_PRECISION (TREE_TYPE (idx))); - + woffset *= tree_to_uhwi (unit_size); + woffset *= BITS_PER_UNIT; if (woffset.to_shwi (&offset)) { - /* TODO: This code seems wrong, multiply then check - to see if it fits. */ - offset *= tree_to_uhwi (unit_size); - offset *= BITS_PER_UNIT; - base = TREE_OPERAND (t, 0); ctor = get_base_constructor (base, &offset, valueize); /* Empty constructor. Always fold to 0. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 70e2210bea8..2398a7e3719 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2019-08-30 Richard Biener <rguenther@suse.de> + + Backport from mainline + 2019-04-11 Richard Biener <rguenther@suse.de> + + PR tree-optimization/90020 + * gcc.dg/torture/pr90020.c: New testcase. + 2019-08-29 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline. diff --git a/gcc/testsuite/gcc.dg/torture/pr90020.c b/gcc/testsuite/gcc.dg/torture/pr90020.c new file mode 100644 index 00000000000..2aa8aa0e4a4 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr90020.c @@ -0,0 +1,27 @@ +/* { dg-do run } */ +/* { dg-require-weak "" } */ + +void __attribute__((noinline,noclone)) +check (int i) +{ + if (i == 0) + __builtin_exit (0); +} + +int i; +extern int x __attribute__((weak)); + +int main(int argc, char **argv) +{ + if (argc) + { + check (i); + return x; + } + else + { + check (i); + return x-1; + } + return 0; +} diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c index 11b1938216e..5f9dc50eef6 100644 --- a/gcc/tree-ssa-pre.c +++ b/gcc/tree-ssa-pre.c @@ -3919,6 +3919,13 @@ compute_avail (void) continue; } + /* If the REFERENCE traps and there was a preceding + point in the block that might not return avoid + adding the reference to EXP_GEN. */ + if (BB_MAY_NOTRETURN (block) + && vn_reference_may_trap (ref)) + continue; + /* If the value of the reference is not invalidated in this block until it is computed, add the expression to EXP_GEN. */ diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c index 6766fc58bf8..6de33ae38ac 100644 --- a/gcc/tree-ssa-sccvn.c +++ b/gcc/tree-ssa-sccvn.c @@ -5207,6 +5207,57 @@ public: auto_vec<tree> avail_stack; }; +/* Return true if the reference operation REF may trap. */ + +bool +vn_reference_may_trap (vn_reference_t ref) +{ + switch (ref->operands[0].opcode) + { + case MODIFY_EXPR: + case CALL_EXPR: + /* We do not handle calls. */ + case ADDR_EXPR: + /* And toplevel address computations never trap. */ + return false; + default:; + } + + vn_reference_op_t op; + unsigned i; + FOR_EACH_VEC_ELT (ref->operands, i, op) + { + switch (op->opcode) + { + case WITH_SIZE_EXPR: + case TARGET_MEM_REF: + /* Always variable. */ + return true; + case COMPONENT_REF: + if (op->op1 && TREE_CODE (op->op1) == SSA_NAME) + return true; + break; + case ARRAY_RANGE_REF: + case ARRAY_REF: + if (TREE_CODE (op->op0) == SSA_NAME) + return true; + break; + case MEM_REF: + /* Nothing interesting in itself, the base is separate. */ + break; + /* The following are the address bases. */ + case SSA_NAME: + return true; + case ADDR_EXPR: + if (op->op0) + return tree_could_trap_p (TREE_OPERAND (op->op0, 0)); + return false; + default:; + } + } + return false; +} + eliminate_dom_walker::eliminate_dom_walker (cdi_direction direction, bitmap inserted_exprs_) : dom_walker (direction), do_pre (inserted_exprs_ != NULL), diff --git a/gcc/tree-ssa-sccvn.h b/gcc/tree-ssa-sccvn.h index 9356520cbe5..f6c9f59be22 100644 --- a/gcc/tree-ssa-sccvn.h +++ b/gcc/tree-ssa-sccvn.h @@ -239,6 +239,7 @@ vn_reference_t vn_reference_insert_pieces (tree, alias_set_type, tree, bool vn_nary_op_eq (const_vn_nary_op_t const vno1, const_vn_nary_op_t const vno2); bool vn_nary_may_trap (vn_nary_op_t); +bool vn_reference_may_trap (vn_reference_t); bool vn_reference_eq (const_vn_reference_t const, const_vn_reference_t const); unsigned int get_max_value_id (void); unsigned int get_next_value_id (void); -- cgit v1.2.3 From 37c1a25268f7cb4de917a926b5164c0029664c72 Mon Sep 17 00:00:00 2001 From: Richard Biener <rguenther@suse.de> Date: Fri, 30 Aug 2019 08:02:02 +0000 Subject: 2019-08-30 Richard Biener <rguenther@suse.de> Backport from mainline 2019-04-09 Richard Sandiford <richard.sandiford@arm.com> * tree-vect-data-refs.c (vect_get_smallest_scalar_type): Always use gimple_expr_type for load and store calls. Skip over the condition argument in a conditional internal function. Protect use of TREE_INT_CST_LOW. 2019-04-08 Richard Biener <rguenther@suse.de> PR tree-optimization/90006 * tree-vect-data-refs.c (vect_get_smallest_scalar_type): Handle calls like lrint. * gcc.dg/vect/bb-slp-pr90006.c: New testcase. 2019-04-01 Bin Cheng <bin.cheng@linux.alibaba.com> PR tree-optimization/89725 * tree-chrec.c (chrec_contains_symbols): New parameter. Handle outer loop's chrec as invariant symbol. * tree-chrec.h (chrec_contains_symbols): New parameter. * tree-data-ref.c (analyze_miv_subscript): Pass new argument. (build_classic_dist_vector_1, add_other_self_distances): Bypass access function of loops not in DDR's loop_nest. * gcc.dg/tree-ssa/pr89725.c: New test. 2019-03-26 Bin Cheng <bin.cheng@linux.alibaba.com> PR tree-optimization/81740 * tree-vect-data-refs.c (vect_analyze_data_ref_dependence): In case of outer loop vectorization, check for backward dependence at the inner loop if outer loop dependence is reversed. * gcc.dg/vect/pr81740-1.c: New testcase. * gcc.dg/vect/pr81740-2.c: Likewise. 2019-02-21 Richard Biener <rguenther@suse.de> PR middle-end/89392 cp/ * vtable-class-hierarchy.c (vtv_generate_init_routine): Do not make symtab process new functions here. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@275061 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 33 +++++++++++++++++++++++++ gcc/cp/ChangeLog | 9 +++++++ gcc/cp/vtable-class-hierarchy.c | 2 -- gcc/testsuite/ChangeLog | 19 +++++++++++++++ gcc/testsuite/gcc.dg/tree-ssa/pr89725.c | 28 +++++++++++++++++++++ gcc/testsuite/gcc.dg/vect/bb-slp-pr90006.c | 31 ++++++++++++++++++++++++ gcc/testsuite/gcc.dg/vect/pr81740-1.c | 22 +++++++++++++++++ gcc/testsuite/gcc.dg/vect/pr81740-2.c | 24 ++++++++++++++++++ gcc/tree-chrec.c | 12 ++++++--- gcc/tree-chrec.h | 2 +- gcc/tree-data-ref.c | 25 +++++++++++++++++-- gcc/tree-vect-data-refs.c | 39 ++++++++++++++++++++++++++++-- 12 files changed, 236 insertions(+), 10 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/pr89725.c create mode 100644 gcc/testsuite/gcc.dg/vect/bb-slp-pr90006.c create mode 100644 gcc/testsuite/gcc.dg/vect/pr81740-1.c create mode 100644 gcc/testsuite/gcc.dg/vect/pr81740-2.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6da3ab6efb3..ebc607e81bc 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,36 @@ +2019-08-30 Richard Biener <rguenther@suse.de> + + Backport from mainline + 2019-04-09 Richard Sandiford <richard.sandiford@arm.com> + + * tree-vect-data-refs.c (vect_get_smallest_scalar_type): Always + use gimple_expr_type for load and store calls. Skip over the + condition argument in a conditional internal function. + Protect use of TREE_INT_CST_LOW. + + 2019-04-08 Richard Biener <rguenther@suse.de> + + PR tree-optimization/90006 + * tree-vect-data-refs.c (vect_get_smallest_scalar_type): Handle + calls like lrint. + + 2019-04-01 Bin Cheng <bin.cheng@linux.alibaba.com> + + PR tree-optimization/89725 + * tree-chrec.c (chrec_contains_symbols): New parameter. Handle outer + loop's chrec as invariant symbol. + * tree-chrec.h (chrec_contains_symbols): New parameter. + * tree-data-ref.c (analyze_miv_subscript): Pass new argument. + (build_classic_dist_vector_1, add_other_self_distances): Bypass access + function of loops not in DDR's loop_nest. + + 2019-03-26 Bin Cheng <bin.cheng@linux.alibaba.com> + + PR tree-optimization/81740 + * tree-vect-data-refs.c (vect_analyze_data_ref_dependence): + In case of outer loop vectorization, check for backward dependence + at the inner loop if outer loop dependence is reversed. + 2019-08-30 Richard Biener <rguenther@suse.de> Backport from mainline diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 1eb49423c5d..64edbab6816 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,12 @@ +2019-08-30 Richard Biener <rguenther@suse.de> + + Backport from mainline + 2019-02-21 Richard Biener <rguenther@suse.de> + + PR middle-end/89392 + * vtable-class-hierarchy.c (vtv_generate_init_routine): Do not + make symtab process new functions here. + 2019-08-29 Jakub Jelinek <jakub@redhat.com> Backported from mainline diff --git a/gcc/cp/vtable-class-hierarchy.c b/gcc/cp/vtable-class-hierarchy.c index 7a9a5f2c595..7256bb4d448 100644 --- a/gcc/cp/vtable-class-hierarchy.c +++ b/gcc/cp/vtable-class-hierarchy.c @@ -1191,8 +1191,6 @@ vtv_generate_init_routine (void) gimplify_function_tree (vtv_fndecl); cgraph_node::add_new_function (vtv_fndecl, false); - symtab->process_new_functions (); - if (flag_vtable_verify == VTV_PREINIT_PRIORITY && !TARGET_PECOFF) assemble_vtv_preinit_initializer (vtv_fndecl); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 2398a7e3719..84648cc69ec 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,22 @@ +2019-08-30 Richard Biener <rguenther@suse.de> + + Backport from mainline + 2019-04-08 Richard Biener <rguenther@suse.de> + + PR tree-optimization/90006 + * gcc.dg/vect/bb-slp-pr90006.c: New testcase. + + 2019-04-01 Bin Cheng <bin.cheng@linux.alibaba.com> + + PR tree-optimization/89725 + * gcc.dg/tree-ssa/pr89725.c: New test. + + 2019-03-26 Bin Cheng <bin.cheng@linux.alibaba.com> + + PR tree-optimization/81740 + * gcc.dg/vect/pr81740-1.c: New testcase. + * gcc.dg/vect/pr81740-2.c: Likewise. + 2019-08-30 Richard Biener <rguenther@suse.de> Backport from mainline diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr89725.c b/gcc/testsuite/gcc.dg/tree-ssa/pr89725.c new file mode 100644 index 00000000000..ad826d90b86 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr89725.c @@ -0,0 +1,28 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -floop-interchange -fno-tree-dce" } */ +int abs (int); +int find_sad_16x16(int *intra_mode) +{ + int current_intra_sad_2,best_intra_sad2; + int M1[16][16],M0[4][4][4][4],M3[4],M4[4][4]; + int i,j,k; + int ii,jj; + int up_avail, left_avail, left_up_avail; + for (i=0;i<17;i++) + if (left_up_avail) + { + for (jj=0;jj<4;jj++) + for (ii=0;ii<4;ii++) + for (j=0;j<4;j++) + for (i=0;i<4;i++) + { + M0[i][ii][2][jj]=M3[0]-M3[1]; + M0[i][ii][1][jj]=M3[2]+M3[3]; + current_intra_sad_2 += abs(M0[i][ii][j][jj]); + } + + if(current_intra_sad_2 < best_intra_sad2) + best_intra_sad2=current_intra_sad_2; + } + return 0; +} diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-pr90006.c b/gcc/testsuite/gcc.dg/vect/bb-slp-pr90006.c new file mode 100644 index 00000000000..104d3fb89b0 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/bb-slp-pr90006.c @@ -0,0 +1,31 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-fno-math-errno" } */ +/* { dg-additional-options "-march=x86-64" { target x86_64-*-* i?86-*-* } } */ + +long int lrint(double x); + +int a, b; +union c { + int d; +}; + +int e() +{ + int f, g, h; + long i, j, k; + double l, m = b = lrint(0.3127); + a = b >> 16 >> 8 & 255; + ((union c *)e)->d = a; + k = m; + h = k >> 16 >> 8 & 255; + ((union c *)(e + 4))->d = h; + j = lrint(l); + g = j >> 16 >> 8 & 255; + ((union c *)(e + 8))->d = g; + i = lrint(0.292); + f = i >> 16 >> 8 & 255; + ((union c *)(e + 12))->d = f; + return 0; +} + +/* { dg-final { scan-tree-dump "basic block vectorized" "slp2" { target { { x86_64-*-* i?86-*-* } && ilp32 } } } } */ diff --git a/gcc/testsuite/gcc.dg/vect/pr81740-1.c b/gcc/testsuite/gcc.dg/vect/pr81740-1.c new file mode 100644 index 00000000000..d2226fcdbee --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/pr81740-1.c @@ -0,0 +1,22 @@ +/* { dg-do run } */ +/* { dg-require-effective-target vect_int } */ + +#include "tree-vect.h" + +int a[8][10] = { [2][5] = 4 }, c; + +int +main () +{ + short b; + int i, d; + check_vect (); + for (b = 4; b >= 0; b--) + for (c = 0; c <= 6; c++) + a[c + 1][b + 2] = a[c][b + 1]; + for (i = 0; i < 8; i++) + for (d = 0; d < 10; d++) + if (a[i][d] != (i == 3 && d == 6) * 4) + __builtin_abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/vect/pr81740-2.c b/gcc/testsuite/gcc.dg/vect/pr81740-2.c new file mode 100644 index 00000000000..76637ad0f81 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/pr81740-2.c @@ -0,0 +1,24 @@ +/* { dg-do run } */ +/* { dg-require-effective-target vect_int } */ + +#include "tree-vect.h" + +int a[8][10] = { [2][5] = 4 }, c; + +int +main () +{ + short b; + int i, d; + check_vect (); + for (b = 4; b >= 0; b--) + for (c = 6; c >= 0; c--) + a[c + 1][b + 2] = a[c][b + 1]; + for (i = 0; i < 8; i++) + for (d = 0; d < 10; d++) + if (a[i][d] != (i == 3 && d == 6) * 4) + __builtin_abort (); + return 0; +} + +/* { dg-final { scan-tree-dump "OUTER LOOP VECTORIZED" "vect" } } */ diff --git a/gcc/tree-chrec.c b/gcc/tree-chrec.c index 896ff357842..19be8c071b3 100644 --- a/gcc/tree-chrec.c +++ b/gcc/tree-chrec.c @@ -979,10 +979,11 @@ is_multivariate_chrec (const_tree chrec) return false; } -/* Determines whether the chrec contains symbolic names or not. */ +/* Determines whether the chrec contains symbolic names or not. If LOOP isn't + NULL, we also consider chrec wrto outer loops of LOOP as symbol. */ bool -chrec_contains_symbols (const_tree chrec) +chrec_contains_symbols (const_tree chrec, struct loop *loop) { int i, n; @@ -999,9 +1000,14 @@ chrec_contains_symbols (const_tree chrec) || TREE_CODE (chrec) == FIELD_DECL) return true; + if (loop != NULL + && TREE_CODE (chrec) == POLYNOMIAL_CHREC + && flow_loop_nested_p (get_chrec_loop (chrec), loop)) + return true; + n = TREE_OPERAND_LENGTH (chrec); for (i = 0; i < n; i++) - if (chrec_contains_symbols (TREE_OPERAND (chrec, i))) + if (chrec_contains_symbols (TREE_OPERAND (chrec, i), loop)) return true; return false; } diff --git a/gcc/tree-chrec.h b/gcc/tree-chrec.h index b2efa339af5..18dad1c2f5b 100644 --- a/gcc/tree-chrec.h +++ b/gcc/tree-chrec.h @@ -80,7 +80,7 @@ extern bool convert_affine_scev (struct loop *, tree, tree *, tree *, gimple *, /* Observers. */ extern bool eq_evolutions_p (const_tree, const_tree); extern bool is_multivariate_chrec (const_tree); -extern bool chrec_contains_symbols (const_tree); +extern bool chrec_contains_symbols (const_tree, struct loop * = NULL); extern bool chrec_contains_symbols_defined_in_loop (const_tree, unsigned); extern bool chrec_contains_undetermined (const_tree); extern bool tree_contains_chrecs (const_tree, int *); diff --git a/gcc/tree-data-ref.c b/gcc/tree-data-ref.c index 670d0de4465..2f7caf7e1ea 100644 --- a/gcc/tree-data-ref.c +++ b/gcc/tree-data-ref.c @@ -4048,9 +4048,9 @@ analyze_miv_subscript (tree chrec_a, } else if (evolution_function_is_affine_multivariate_p (chrec_a, loop_nest->num) - && !chrec_contains_symbols (chrec_a) + && !chrec_contains_symbols (chrec_a, loop_nest) && evolution_function_is_affine_multivariate_p (chrec_b, loop_nest->num) - && !chrec_contains_symbols (chrec_b)) + && !chrec_contains_symbols (chrec_b, loop_nest)) { /* testsuite/.../ssa-chrec-35.c {0, +, 1}_2 vs. {0, +, 1}_3 @@ -4260,6 +4260,7 @@ build_classic_dist_vector_1 (struct data_dependence_relation *ddr, { unsigned i; lambda_vector init_v = lambda_vector_new (DDR_NB_LOOPS (ddr)); + struct loop *loop = DDR_LOOP_NEST (ddr)[0]; for (i = 0; i < DDR_NUM_SUBSCRIPTS (ddr); i++) { @@ -4290,6 +4291,15 @@ build_classic_dist_vector_1 (struct data_dependence_relation *ddr, return false; } + /* When data references are collected in a loop while data + dependences are analyzed in loop nest nested in the loop, we + would have more number of access functions than number of + loops. Skip access functions of loops not in the loop nest. + + See PR89725 for more information. */ + if (flow_loop_nested_p (get_loop (cfun, var_a), loop)) + continue; + dist = int_cst_value (SUB_DISTANCE (subscript)); index = index_in_loop_nest (var_a, DDR_LOOP_NEST (ddr)); *index_carry = MIN (index, *index_carry); @@ -4401,6 +4411,7 @@ add_other_self_distances (struct data_dependence_relation *ddr) unsigned i; int index_carry = DDR_NB_LOOPS (ddr); subscript *sub; + struct loop *loop = DDR_LOOP_NEST (ddr)[0]; FOR_EACH_VEC_ELT (DDR_SUBSCRIPTS (ddr), i, sub) { @@ -4430,6 +4441,16 @@ add_other_self_distances (struct data_dependence_relation *ddr) return; } + /* When data references are collected in a loop while data + dependences are analyzed in loop nest nested in the loop, we + would have more number of access functions than number of + loops. Skip access functions of loops not in the loop nest. + + See PR89725 for more information. */ + if (flow_loop_nested_p (get_loop (cfun, CHREC_VARIABLE (access_fun)), + loop)) + continue; + index_carry = MIN (index_carry, index_in_loop_nest (CHREC_VARIABLE (access_fun), DDR_LOOP_NEST (ddr))); diff --git a/gcc/tree-vect-data-refs.c b/gcc/tree-vect-data-refs.c index 0c04ff1bbb9..b7a82986a45 100644 --- a/gcc/tree-vect-data-refs.c +++ b/gcc/tree-vect-data-refs.c @@ -144,6 +144,30 @@ vect_get_smallest_scalar_type (gimple *stmt, HOST_WIDE_INT *lhs_size_unit, if (rhs < lhs) scalar_type = rhs_type; } + else if (gcall *call = dyn_cast <gcall *> (stmt)) + { + unsigned int i = 0; + if (gimple_call_internal_p (call)) + { + internal_fn ifn = gimple_call_internal_fn (call); + if (internal_load_fn_p (ifn) || internal_store_fn_p (ifn)) + /* gimple_expr_type already picked the type of the loaded + or stored data. */ + i = ~0U; + else if (internal_fn_mask_index (ifn) == 0) + i = 1; + } + if (i < gimple_call_num_args (call)) + { + tree rhs_type = TREE_TYPE (gimple_call_arg (call, i)); + if (tree_fits_uhwi_p (TYPE_SIZE_UNIT (rhs_type))) + { + rhs = TREE_INT_CST_LOW (TYPE_SIZE_UNIT (rhs_type)); + if (rhs < lhs) + scalar_type = rhs_type; + } + } + } *lhs_size_unit = lhs; *rhs_size_unit = rhs; @@ -538,8 +562,19 @@ vect_analyze_data_ref_dependence (struct data_dependence_relation *ddr, reversed (to make distance vector positive), and the actual distance is negative. */ if (dump_enabled_p ()) - dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + dump_printf_loc (MSG_NOTE, vect_location, "dependence distance negative.\n"); + /* When doing outer loop vectorization, we need to check if there is + a backward dependence at the inner loop level if the dependence + at the outer loop is reversed. See PR81740. */ + if (nested_in_vect_loop_p (loop, DR_STMT (dra)) + || nested_in_vect_loop_p (loop, DR_STMT (drb))) + { + unsigned inner_depth = index_in_loop_nest (loop->inner->num, + DDR_LOOP_NEST (ddr)); + if (dist_v[inner_depth] < 0) + return true; + } /* Record a negative dependence distance to later limit the amount of stmt copying / unrolling we can perform. Only need to handle read-after-write dependence. */ @@ -555,7 +590,7 @@ vect_analyze_data_ref_dependence (struct data_dependence_relation *ddr, { /* The dependence distance requires reduction of the maximal vectorization factor. */ - *max_vf = abs (dist); + *max_vf = abs_dist; if (dump_enabled_p ()) dump_printf_loc (MSG_NOTE, vect_location, "adjusting maximal vectorization factor to %i\n", -- cgit v1.2.3 From 8aeeef9f19069f633fb038e655262d3cd170d2ef Mon Sep 17 00:00:00 2001 From: Bin Cheng <bin.linux@linux.alibaba.com> Date: Fri, 30 Aug 2019 11:02:48 +0000 Subject: Backport from mainline 2019-07-18 Bin Cheng <bin.linux@linux.alibaba.com> PR tree-optimization/91137 * tree-ssa-loop-ivopts.c (struct ivopts_data): New field. (tree_ssa_iv_optimize_init, alloc_iv, tree_ssa_iv_optimize_finalize): Init, use and fini the above new field. (determine_base_object_1): New function. (determine_base_object): Reimplement using walk_tree. 2019-07-18 Bin Cheng <bin.linux@linux.alibaba.com> PR tree-optimization/91137 * gcc.c-torture/execute/pr91137.c: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@275064 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 12 ++++ gcc/testsuite/ChangeLog | 8 +++ gcc/testsuite/gcc.c-torture/execute/pr91137.c | 34 ++++++++++ gcc/tree-ssa-loop-ivopts.c | 92 +++++++++++++++------------ 4 files changed, 106 insertions(+), 40 deletions(-) create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr91137.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ebc607e81bc..13a1c98b682 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,15 @@ +2019-08-30 Bin Cheng <bin.linux@linux.alibaba.com> + + Backport from mainline + 2019-07-18 Bin Cheng <bin.linux@linux.alibaba.com> + + PR tree-optimization/91137 + * tree-ssa-loop-ivopts.c (struct ivopts_data): New field. + (tree_ssa_iv_optimize_init, alloc_iv, tree_ssa_iv_optimize_finalize): + Init, use and fini the above new field. + (determine_base_object_1): New function. + (determine_base_object): Reimplement using walk_tree. + 2019-08-30 Richard Biener <rguenther@suse.de> Backport from mainline diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 84648cc69ec..2553c69f15a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2019-08-30 Bin Cheng <bin.linux@linux.alibaba.com> + + Backport from mainline + 2019-07-18 Bin Cheng <bin.linux@linux.alibaba.com> + + PR tree-optimization/91137 + * gcc.c-torture/execute/pr91137.c: New test. + 2019-08-30 Richard Biener <rguenther@suse.de> Backport from mainline diff --git a/gcc/testsuite/gcc.c-torture/execute/pr91137.c b/gcc/testsuite/gcc.c-torture/execute/pr91137.c new file mode 100644 index 00000000000..aa6bb6ca021 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr91137.c @@ -0,0 +1,34 @@ +long long a; +unsigned b; +int c[70]; +int d[70][70]; +int e; + +__attribute__ ((noinline)) void f(long long *g, int p2) { + *g = p2; +} + +__attribute__ ((noinline)) void fn2() { + for (int j = 0; j < 70; j++) { + for (int i = 0; i < 70; i++) { + if (b) + c[i] = 0; + for (int l = 0; l < 70; l++) + d[i][1] = d[l][i]; + } + for (int k = 0; k < 70; k++) + e = c[0]; + } +} + +int main() { + b = 5; + for (int j = 0; j < 70; ++j) + c[j] = 2075593088; + fn2(); + f(&a, e); + if (a) + __builtin_abort(); + return 0; +} + diff --git a/gcc/tree-ssa-loop-ivopts.c b/gcc/tree-ssa-loop-ivopts.c index b3135717f22..a61e5f3b43e 100644 --- a/gcc/tree-ssa-loop-ivopts.c +++ b/gcc/tree-ssa-loop-ivopts.c @@ -582,6 +582,9 @@ struct ivopts_data /* The common candidates. */ vec<iv_common_cand *> iv_common_cands; + /* Hash map recording base object information of tree exp. */ + hash_map<tree, tree> *base_object_map; + /* The maximum invariant variable id. */ unsigned max_inv_var_id; @@ -1093,61 +1096,68 @@ tree_ssa_iv_optimize_init (struct ivopts_data *data) data->vcands.create (20); data->inv_expr_tab = new hash_table<iv_inv_expr_hasher> (10); data->name_expansion_cache = NULL; + data->base_object_map = NULL; data->iv_common_cand_tab = new hash_table<iv_common_cand_hasher> (10); data->iv_common_cands.create (20); decl_rtl_to_reset.create (20); gcc_obstack_init (&data->iv_obstack); } -/* Returns a memory object to that EXPR points. In case we are able to - determine that it does not point to any such object, NULL is returned. */ +/* walk_tree callback for determine_base_object. */ static tree -determine_base_object (tree expr) +determine_base_object_1 (tree *tp, int *walk_subtrees, void *wdata) { - enum tree_code code = TREE_CODE (expr); - tree base, obj; - - /* If this is a pointer casted to any type, we need to determine - the base object for the pointer; so handle conversions before - throwing away non-pointer expressions. */ - if (CONVERT_EXPR_P (expr)) - return determine_base_object (TREE_OPERAND (expr, 0)); - - if (!POINTER_TYPE_P (TREE_TYPE (expr))) - return NULL_TREE; - - switch (code) + tree_code code = TREE_CODE (*tp); + tree obj = NULL_TREE; + if (code == ADDR_EXPR) { - case INTEGER_CST: - return NULL_TREE; - - case ADDR_EXPR: - obj = TREE_OPERAND (expr, 0); - base = get_base_address (obj); - + tree base = get_base_address (TREE_OPERAND (*tp, 0)); if (!base) - return expr; - - if (TREE_CODE (base) == MEM_REF) - return determine_base_object (TREE_OPERAND (base, 0)); + obj = *tp; + else if (TREE_CODE (base) != MEM_REF) + obj = fold_convert (ptr_type_node, build_fold_addr_expr (base)); + } + else if (code == SSA_NAME && POINTER_TYPE_P (TREE_TYPE (*tp))) + obj = fold_convert (ptr_type_node, *tp); - return fold_convert (ptr_type_node, - build_fold_addr_expr (base)); + if (!obj) + { + if (!EXPR_P (*tp)) + *walk_subtrees = 0; - case POINTER_PLUS_EXPR: - return determine_base_object (TREE_OPERAND (expr, 0)); + return NULL_TREE; + } + /* Record special node for multiple base objects and stop. */ + if (*static_cast<tree *> (wdata)) + { + *static_cast<tree *> (wdata) = integer_zero_node; + return integer_zero_node; + } + /* Record the base object and continue looking. */ + *static_cast<tree *> (wdata) = obj; + return NULL_TREE; +} - case PLUS_EXPR: - case MINUS_EXPR: - /* Pointer addition is done solely using POINTER_PLUS_EXPR. */ - gcc_unreachable (); +/* Returns a memory object to that EXPR points with caching. Return NULL if we + are able to determine that it does not point to any such object; specially + return integer_zero_node if EXPR contains multiple base objects. */ - default: - if (POLY_INT_CST_P (expr)) - return NULL_TREE; - return fold_convert (ptr_type_node, expr); +static tree +determine_base_object (struct ivopts_data *data, tree expr) +{ + tree *slot, obj = NULL_TREE; + if (data->base_object_map) + { + if ((slot = data->base_object_map->get(expr)) != NULL) + return *slot; } + else + data->base_object_map = new hash_map<tree, tree>; + + (void) walk_tree_without_duplicates (&expr, determine_base_object_1, &obj); + data->base_object_map->put (expr, obj); + return obj; } /* Return true if address expression with non-DECL_P operand appears @@ -1205,7 +1215,7 @@ alloc_iv (struct ivopts_data *data, tree base, tree step, } iv->base = base; - iv->base_object = determine_base_object (base); + iv->base_object = determine_base_object (data, base); iv->step = step; iv->biv_p = false; iv->nonlin_use = NULL; @@ -7487,6 +7497,8 @@ tree_ssa_iv_optimize_finalize (struct ivopts_data *data) delete data->inv_expr_tab; data->inv_expr_tab = NULL; free_affine_expand_cache (&data->name_expansion_cache); + if (data->base_object_map) + delete data->base_object_map; delete data->iv_common_cand_tab; data->iv_common_cand_tab = NULL; data->iv_common_cands.release (); -- cgit v1.2.3 From bcf4014f1db8f8a80aa064d908cb09016fedb76b Mon Sep 17 00:00:00 2001 From: Richard Biener <rguenther@suse.de> Date: Fri, 30 Aug 2019 11:11:01 +0000 Subject: 2019-08-30 Richard Biener <rguenther@suse.de> * lto-streamer.h (LTO_minor_version): Bump. Backport from mainline 2019-05-06 Richard Biener <rguenther@suse.de> PR tree-optimization/90328 * tree-data-ref.h (dr_may_alias_p): Pass in the actual loop nest. * tree-data-ref.c (dr_may_alias_p): Check whether the clique is valid in the loop nest before using it. (initialize_data_dependence_relation): Adjust. * graphite-scop-detection.c (build_alias_set): Pass the SCOP enclosing loop as loop-nest to dr_may_alias_p. * gcc.dg/torture/pr90328.c: New testcase. 2019-03-08 Richard Biener <rguenther@suse.de> PR middle-end/89578 * cfgloop.h (struct loop): Add owned_clique field. * cfgloopmanip.c (copy_loop_info): Copy it. * tree-cfg.c (gimple_duplicate_bb): Do not remap owned_clique cliques. * tree-inline.c (copy_loops): Remap owned_clique. * lto-streamer-in.c (input_cfg): Stream owned_clique. * lto-streamer-out.c (output_cfg): Likewise. 2019-02-22 Richard Biener <rguenther@suse.de> PR tree-optimization/87609 * tree-cfg.c (gimple_duplicate_bb): Only remap inlined cliques. 2019-02-22 Richard Biener <rguenther@suse.de> PR middle-end/87609 * cfghooks.h (dependence_hash): New typedef. (struct copy_bb_data): New type. (cfg_hooks::duplicate_block): Adjust to take a copy_bb_data argument. (duplicate_block): Likewise. * cfghooks.c (duplicate_block): Pass down copy_bb_data. (copy_bbs): Create and pass down copy_bb_data. * cfgrtl.c (cfg_layout_duplicate_bb): Adjust. (rtl_duplicate_bb): Likewise. * tree-cfg.c (gimple_duplicate_bb): If the copy_bb_data arg is not NULL remap dependence info. * gcc.dg/torture/restrict-7.c: New testcase. 2019-02-22 Richard Biener <rguenther@suse.de> PR tree-optimization/87609 * tree-core.h (tree_base): Document special clique values. * tree-inline.c (remap_dependence_clique): Do not use the special clique value of one. (maybe_set_dependence_info): Use clique one. (clear_dependence_clique): New callback. (compute_dependence_clique): Clear clique one from all refs before assigning it (again). git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@275069 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 56 +++++++++++++++++++++++++++++++ gcc/cfghooks.c | 7 ++-- gcc/cfghooks.h | 18 ++++++++-- gcc/cfgloop.h | 4 +++ gcc/cfgloopmanip.c | 1 + gcc/cfgrtl.c | 6 ++-- gcc/graphite-scop-detection.c | 6 +++- gcc/lto-streamer-in.c | 1 + gcc/lto-streamer-out.c | 1 + gcc/lto-streamer.h | 2 +- gcc/testsuite/ChangeLog | 13 +++++++ gcc/testsuite/gcc.dg/torture/pr90328.c | 24 +++++++++++++ gcc/testsuite/gcc.dg/torture/restrict-7.c | 27 +++++++++++++++ gcc/tree-cfg.c | 35 ++++++++++++++++++- gcc/tree-core.h | 4 ++- gcc/tree-data-ref.c | 9 +++-- gcc/tree-data-ref.h | 2 +- gcc/tree-inline.c | 13 +++++-- gcc/tree-ssa-structalias.c | 36 +++++++++++++++++++- 19 files changed, 247 insertions(+), 18 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/torture/pr90328.c create mode 100644 gcc/testsuite/gcc.dg/torture/restrict-7.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 13a1c98b682..24ab0081d92 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,59 @@ +2019-08-30 Richard Biener <rguenther@suse.de> + + * lto-streamer.h (LTO_minor_version): Bump. + + Backport from mainline + 2019-05-06 Richard Biener <rguenther@suse.de> + + PR tree-optimization/90328 + * tree-data-ref.h (dr_may_alias_p): Pass in the actual loop nest. + * tree-data-ref.c (dr_may_alias_p): Check whether the clique + is valid in the loop nest before using it. + (initialize_data_dependence_relation): Adjust. + * graphite-scop-detection.c (build_alias_set): Pass the SCOP enclosing + loop as loop-nest to dr_may_alias_p. + + 2019-03-08 Richard Biener <rguenther@suse.de> + + PR middle-end/89578 + * cfgloop.h (struct loop): Add owned_clique field. + * cfgloopmanip.c (copy_loop_info): Copy it. + * tree-cfg.c (gimple_duplicate_bb): Do not remap owned_clique + cliques. + * tree-inline.c (copy_loops): Remap owned_clique. + * lto-streamer-in.c (input_cfg): Stream owned_clique. + * lto-streamer-out.c (output_cfg): Likewise. + + 2019-02-22 Richard Biener <rguenther@suse.de> + + PR tree-optimization/87609 + * tree-cfg.c (gimple_duplicate_bb): Only remap inlined cliques. + + 2019-02-22 Richard Biener <rguenther@suse.de> + + PR middle-end/87609 + * cfghooks.h (dependence_hash): New typedef. + (struct copy_bb_data): New type. + (cfg_hooks::duplicate_block): Adjust to take a copy_bb_data argument. + (duplicate_block): Likewise. + * cfghooks.c (duplicate_block): Pass down copy_bb_data. + (copy_bbs): Create and pass down copy_bb_data. + * cfgrtl.c (cfg_layout_duplicate_bb): Adjust. + (rtl_duplicate_bb): Likewise. + * tree-cfg.c (gimple_duplicate_bb): If the copy_bb_data arg is not NULL + remap dependence info. + + 2019-02-22 Richard Biener <rguenther@suse.de> + + PR tree-optimization/87609 + * tree-core.h (tree_base): Document special clique values. + * tree-inline.c (remap_dependence_clique): Do not use the + special clique value of one. + (maybe_set_dependence_info): Use clique one. + (clear_dependence_clique): New callback. + (compute_dependence_clique): Clear clique one from all refs + before assigning it (again). + 2019-08-30 Bin Cheng <bin.linux@linux.alibaba.com> Backport from mainline diff --git a/gcc/cfghooks.c b/gcc/cfghooks.c index 87d864c6022..5e5b5aa7a74 100644 --- a/gcc/cfghooks.c +++ b/gcc/cfghooks.c @@ -1066,7 +1066,7 @@ can_duplicate_block_p (const_basic_block bb) AFTER. */ basic_block -duplicate_block (basic_block bb, edge e, basic_block after) +duplicate_block (basic_block bb, edge e, basic_block after, copy_bb_data *id) { edge s, n; basic_block new_bb; @@ -1082,7 +1082,7 @@ duplicate_block (basic_block bb, edge e, basic_block after) gcc_checking_assert (can_duplicate_block_p (bb)); - new_bb = cfg_hooks->duplicate_block (bb); + new_bb = cfg_hooks->duplicate_block (bb, id); if (after) move_block_after (new_bb, after); @@ -1337,6 +1337,7 @@ copy_bbs (basic_block *bbs, unsigned n, basic_block *new_bbs, unsigned i, j; basic_block bb, new_bb, dom_bb; edge e; + copy_bb_data id; /* Mark the blocks to be copied. This is used by edge creation hooks to decide whether to reallocate PHI nodes capacity to avoid reallocating @@ -1349,7 +1350,7 @@ copy_bbs (basic_block *bbs, unsigned n, basic_block *new_bbs, { /* Duplicate. */ bb = bbs[i]; - new_bb = new_bbs[i] = duplicate_block (bb, NULL, after); + new_bb = new_bbs[i] = duplicate_block (bb, NULL, after, &id); after = new_bb; if (bb->loop_father) { diff --git a/gcc/cfghooks.h b/gcc/cfghooks.h index b5981da4a05..fa2092a51c5 100644 --- a/gcc/cfghooks.h +++ b/gcc/cfghooks.h @@ -54,6 +54,19 @@ struct profile_record bool run; }; +typedef int_hash <unsigned short, 0> dependence_hash; + +/* Optional data for duplicate_block. */ + +struct copy_bb_data +{ + copy_bb_data() : dependence_map (NULL) {} + ~copy_bb_data () { delete dependence_map; } + + /* A map from the copied BBs dependence info cliques to + equivalents in the BBs duplicated to. */ + hash_map<dependence_hash, unsigned short> *dependence_map; +}; struct cfg_hooks { @@ -112,7 +125,7 @@ struct cfg_hooks bool (*can_duplicate_block_p) (const_basic_block a); /* Duplicate block A. */ - basic_block (*duplicate_block) (basic_block a); + basic_block (*duplicate_block) (basic_block a, copy_bb_data *); /* Higher level functions representable by primitive operations above if we didn't have some oddities in RTL and Tree representations. */ @@ -227,7 +240,8 @@ extern void tidy_fallthru_edges (void); extern void predict_edge (edge e, enum br_predictor predictor, int probability); extern bool predicted_by_p (const_basic_block bb, enum br_predictor predictor); extern bool can_duplicate_block_p (const_basic_block); -extern basic_block duplicate_block (basic_block, edge, basic_block); +extern basic_block duplicate_block (basic_block, edge, basic_block, + copy_bb_data * = NULL); extern bool block_ends_with_call_p (basic_block bb); extern bool empty_block_p (basic_block); extern basic_block split_block_before_cond_jump (basic_block); diff --git a/gcc/cfgloop.h b/gcc/cfgloop.h index af9bfabe094..cb39a3fa5f0 100644 --- a/gcc/cfgloop.h +++ b/gcc/cfgloop.h @@ -227,6 +227,10 @@ struct GTY ((chain_next ("%h.next"))) loop { Other values means unroll with the given unrolling factor. */ unsigned short unroll; + /* If this loop was inlined the main clique of the callee which does + not need remapping when copying the loop body. */ + unsigned short owned_clique; + /* For SIMD loops, this is a unique identifier of the loop, referenced by IFN_GOMP_SIMD_VF, IFN_GOMP_SIMD_LANE and IFN_GOMP_SIMD_LAST_LANE builtins. */ diff --git a/gcc/cfgloopmanip.c b/gcc/cfgloopmanip.c index 74c39dbe8fa..4b300f20428 100644 --- a/gcc/cfgloopmanip.c +++ b/gcc/cfgloopmanip.c @@ -1019,6 +1019,7 @@ copy_loop_info (struct loop *loop, struct loop *target) target->warned_aggressive_loop_optimizations |= loop->warned_aggressive_loop_optimizations; target->in_oacc_kernels_region = loop->in_oacc_kernels_region; + target->owned_clique = loop->owned_clique; } /* Copies copy of LOOP as subloop of TARGET loop, placing newly diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c index f6e4fecd647..bf1504d082f 100644 --- a/gcc/cfgrtl.c +++ b/gcc/cfgrtl.c @@ -4233,7 +4233,7 @@ duplicate_insn_chain (rtx_insn *from, rtx_insn *to) /* Create a duplicate of the basic block BB. */ static basic_block -cfg_layout_duplicate_bb (basic_block bb) +cfg_layout_duplicate_bb (basic_block bb, copy_bb_data *) { rtx_insn *insn; basic_block new_bb; @@ -5059,9 +5059,9 @@ rtl_can_remove_branch_p (const_edge e) } static basic_block -rtl_duplicate_bb (basic_block bb) +rtl_duplicate_bb (basic_block bb, copy_bb_data *id) { - bb = cfg_layout_duplicate_bb (bb); + bb = cfg_layout_duplicate_bb (bb, id); bb->aux = NULL; return bb; } diff --git a/gcc/graphite-scop-detection.c b/gcc/graphite-scop-detection.c index 4024030b952..fc717c5b242 100644 --- a/gcc/graphite-scop-detection.c +++ b/gcc/graphite-scop-detection.c @@ -1414,9 +1414,13 @@ build_alias_set (scop_p scop) int i, j; int *all_vertices; + struct loop *nest + = find_common_loop (scop->scop_info->region.entry->dest->loop_father, + scop->scop_info->region.exit->src->loop_father); + FOR_EACH_VEC_ELT (scop->drs, i, dr1) for (j = i+1; scop->drs.iterate (j, &dr2); j++) - if (dr_may_alias_p (dr1->dr, dr2->dr, true)) + if (dr_may_alias_p (dr1->dr, dr2->dr, nest)) { /* Dependences in the same alias set need to be handled by just looking at DR_ACCESS_FNs. */ diff --git a/gcc/lto-streamer-in.c b/gcc/lto-streamer-in.c index 14752d2cc25..aa024ddfc3d 100644 --- a/gcc/lto-streamer-in.c +++ b/gcc/lto-streamer-in.c @@ -826,6 +826,7 @@ input_cfg (struct lto_input_block *ib, struct data_in *data_in, /* Read OMP SIMD related info. */ loop->safelen = streamer_read_hwi (ib); loop->unroll = streamer_read_hwi (ib); + loop->owned_clique = streamer_read_hwi (ib); loop->dont_vectorize = streamer_read_hwi (ib); loop->force_vectorize = streamer_read_hwi (ib); loop->simduid = stream_read_tree (ib, data_in); diff --git a/gcc/lto-streamer-out.c b/gcc/lto-streamer-out.c index 6962e9e25d0..b60707b2ae6 100644 --- a/gcc/lto-streamer-out.c +++ b/gcc/lto-streamer-out.c @@ -1945,6 +1945,7 @@ output_cfg (struct output_block *ob, struct function *fn) /* Write OMP SIMD related info. */ streamer_write_hwi (ob, loop->safelen); streamer_write_hwi (ob, loop->unroll); + streamer_write_hwi (ob, loop->owned_clique); streamer_write_hwi (ob, loop->dont_vectorize); streamer_write_hwi (ob, loop->force_vectorize); stream_write_tree (ob, loop->simduid, true); diff --git a/gcc/lto-streamer.h b/gcc/lto-streamer.h index 8337dcb602d..078320bf082 100644 --- a/gcc/lto-streamer.h +++ b/gcc/lto-streamer.h @@ -121,7 +121,7 @@ along with GCC; see the file COPYING3. If not see form followed by the data for the string. */ #define LTO_major_version 7 -#define LTO_minor_version 2 +#define LTO_minor_version 3 typedef unsigned char lto_decl_flags_t; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 2553c69f15a..547af10f63e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,16 @@ +2019-08-30 Richard Biener <rguenther@suse.de> + + Backport from mainline + 2019-05-06 Richard Biener <rguenther@suse.de> + + PR tree-optimization/90328 + * gcc.dg/torture/pr90328.c: New testcase. + + 2019-02-22 Richard Biener <rguenther@suse.de> + + PR middle-end/87609 + * gcc.dg/torture/restrict-7.c: New testcase. + 2019-08-30 Bin Cheng <bin.linux@linux.alibaba.com> Backport from mainline diff --git a/gcc/testsuite/gcc.dg/torture/pr90328.c b/gcc/testsuite/gcc.dg/torture/pr90328.c new file mode 100644 index 00000000000..a70f3dd425e --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr90328.c @@ -0,0 +1,24 @@ +/* { dg-do run } */ + +void g(int*__restrict x, int*y) +{ + *x = *y; +} + +void __attribute__((noipa)) f(int* a,int* b) +{ + for(int i=0;i<1024;++i) + g(a+i,b+i); +} + +int main() +{ + int x[1025]; + for (int i = 0; i < 1025; ++i) + x[i] = i+1; + f(x+1, x); + for (int i = 0; i < 1025; ++i) + if (x[i] != 1) + __builtin_abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/torture/restrict-7.c b/gcc/testsuite/gcc.dg/torture/restrict-7.c new file mode 100644 index 00000000000..107371098b3 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/restrict-7.c @@ -0,0 +1,27 @@ +/* { dg-do run } */ + +extern void abort (void); + +static inline __attribute__((always_inline)) void +copy(int *restrict a, int *restrict b) +{ + *b = *a; + *a = 7; +} + +void __attribute__((noinline)) +floppy(int mat[static 2], unsigned idxs[static 3]) +{ + for (int i = 0; i < 3; i++) + copy(&mat[i%2], &mat[idxs[i]]); +} + +int main() +{ + int mat[2] = {10, 20}; + unsigned idxs[3] = {1, 0, 1}; + floppy(mat, idxs); + if (mat[0] != 7 || mat[1] != 10) + abort (); + return 0; +} diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c index a52a1a16246..f0c7e5d2ed0 100644 --- a/gcc/tree-cfg.c +++ b/gcc/tree-cfg.c @@ -6308,7 +6308,7 @@ gimple_can_duplicate_bb_p (const_basic_block bb ATTRIBUTE_UNUSED) preserve SSA form. */ static basic_block -gimple_duplicate_bb (basic_block bb) +gimple_duplicate_bb (basic_block bb, copy_bb_data *id) { basic_block new_bb; gimple_stmt_iterator gsi_tgt; @@ -6372,6 +6372,39 @@ gimple_duplicate_bb (basic_block bb) && (!VAR_P (base) || !DECL_HAS_VALUE_EXPR_P (base))) DECL_NONSHAREABLE (base) = 1; } + + /* If requested remap dependence info of cliques brought in + via inlining. */ + if (id) + for (unsigned i = 0; i < gimple_num_ops (copy); ++i) + { + tree op = gimple_op (copy, i); + if (!op) + continue; + if (TREE_CODE (op) == ADDR_EXPR + || TREE_CODE (op) == WITH_SIZE_EXPR) + op = TREE_OPERAND (op, 0); + while (handled_component_p (op)) + op = TREE_OPERAND (op, 0); + if ((TREE_CODE (op) == MEM_REF + || TREE_CODE (op) == TARGET_MEM_REF) + && MR_DEPENDENCE_CLIQUE (op) > 1 + && MR_DEPENDENCE_CLIQUE (op) != bb->loop_father->owned_clique) + { + if (!id->dependence_map) + id->dependence_map = new hash_map<dependence_hash, + unsigned short>; + bool existed; + unsigned short &newc = id->dependence_map->get_or_insert + (MR_DEPENDENCE_CLIQUE (op), &existed); + if (!existed) + { + gcc_assert (MR_DEPENDENCE_CLIQUE (op) <= cfun->last_clique); + newc = ++cfun->last_clique; + } + MR_DEPENDENCE_CLIQUE (op) = newc; + } + } /* Create new names for all the definitions created by COPY and add replacement mappings for each new name. */ diff --git a/gcc/tree-core.h b/gcc/tree-core.h index 04a1f0c6bae..4f72861ad64 100644 --- a/gcc/tree-core.h +++ b/gcc/tree-core.h @@ -997,7 +997,9 @@ struct GTY(()) tree_base { expression trees and specify known data non-dependences. For two memory references in a function they are known to not alias if dependence_info.clique are equal and dependence_info.base - are distinct. */ + are distinct. Clique number zero means there is no information, + clique number one is populated from function global information + and thus needs no remapping on transforms like loop unrolling. */ struct { unsigned short clique; unsigned short base; diff --git a/gcc/tree-data-ref.c b/gcc/tree-data-ref.c index 2f7caf7e1ea..fc86bc25951 100644 --- a/gcc/tree-data-ref.c +++ b/gcc/tree-data-ref.c @@ -2230,7 +2230,7 @@ object_address_invariant_in_loop_p (const struct loop *loop, const_tree obj) bool dr_may_alias_p (const struct data_reference *a, const struct data_reference *b, - bool loop_nest) + struct loop *loop_nest) { tree addr_a = DR_BASE_OBJECT (a); tree addr_b = DR_BASE_OBJECT (b); @@ -2254,6 +2254,11 @@ dr_may_alias_p (const struct data_reference *a, const struct data_reference *b, if ((TREE_CODE (addr_a) == MEM_REF || TREE_CODE (addr_a) == TARGET_MEM_REF) && (TREE_CODE (addr_b) == MEM_REF || TREE_CODE (addr_b) == TARGET_MEM_REF) + /* For cross-iteration dependences the cliques must be valid for the + whole loop, not just individual iterations. */ + && (!loop_nest + || MR_DEPENDENCE_CLIQUE (addr_a) == 1 + || MR_DEPENDENCE_CLIQUE (addr_a) == loop_nest->owned_clique) && MR_DEPENDENCE_CLIQUE (addr_a) == MR_DEPENDENCE_CLIQUE (addr_b) && MR_DEPENDENCE_BASE (addr_a) != MR_DEPENDENCE_BASE (addr_b)) return false; @@ -2365,7 +2370,7 @@ initialize_data_dependence_relation (struct data_reference *a, } /* If the data references do not alias, then they are independent. */ - if (!dr_may_alias_p (a, b, loop_nest.exists ())) + if (!dr_may_alias_p (a, b, loop_nest.exists () ? loop_nest[0] : NULL)) { DDR_ARE_DEPENDENT (res) = chrec_known; return res; diff --git a/gcc/tree-data-ref.h b/gcc/tree-data-ref.h index 8739853336a..a5c699cf809 100644 --- a/gcc/tree-data-ref.h +++ b/gcc/tree-data-ref.h @@ -475,7 +475,7 @@ dr_alignment (data_reference *dr) } extern bool dr_may_alias_p (const struct data_reference *, - const struct data_reference *, bool); + const struct data_reference *, struct loop *); extern bool dr_equal_offsets_p (struct data_reference *, struct data_reference *); diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c index c9ff5a2afc2..befd7c396fc 100644 --- a/gcc/tree-inline.c +++ b/gcc/tree-inline.c @@ -957,7 +957,12 @@ remap_dependence_clique (copy_body_data *id, unsigned short clique) bool existed; unsigned short &newc = id->dependence_map->get_or_insert (clique, &existed); if (!existed) - newc = ++cfun->last_clique; + { + /* Clique 1 is reserved for local ones set by PTA. */ + if (cfun->last_clique == 0) + cfun->last_clique = 1; + newc = ++cfun->last_clique; + } return newc; } @@ -2740,7 +2745,11 @@ copy_loops (copy_body_data *id, dest_loop->simduid = remap_decl (src_loop->simduid, id); cfun->has_simduid_loops = true; } - + if (id->src_cfun->last_clique != 0) + dest_loop->owned_clique + = remap_dependence_clique (id, + src_loop->owned_clique + ? src_loop->owned_clique : 1); /* Recurse. */ copy_loops (id, dest_loop, src_loop); } diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c index 0e69629f879..59d56fe525f 100644 --- a/gcc/tree-ssa-structalias.c +++ b/gcc/tree-ssa-structalias.c @@ -7461,7 +7461,11 @@ maybe_set_dependence_info (tree ref, tree ptr, if (MR_DEPENDENCE_CLIQUE (ref) == 0) { if (clique == 0) - clique = ++cfun->last_clique; + { + if (cfun->last_clique == 0) + cfun->last_clique = 1; + clique = 1; + } if (restrict_var->ruid == 0) restrict_var->ruid = ++last_ruid; MR_DEPENDENCE_CLIQUE (ref) = clique; @@ -7472,12 +7476,42 @@ maybe_set_dependence_info (tree ref, tree ptr, return false; } +/* Clear dependence info for the clique DATA. */ + +static bool +clear_dependence_clique (gimple *, tree base, tree, void *data) +{ + unsigned short clique = (uintptr_t)data; + if ((TREE_CODE (base) == MEM_REF + || TREE_CODE (base) == TARGET_MEM_REF) + && MR_DEPENDENCE_CLIQUE (base) == clique) + { + MR_DEPENDENCE_CLIQUE (base) = 0; + MR_DEPENDENCE_BASE (base) = 0; + } + + return false; +} + /* Compute the set of independend memory references based on restrict tags and their conservative propagation to the points-to sets. */ static void compute_dependence_clique (void) { + /* First clear the special "local" clique. */ + basic_block bb; + if (cfun->last_clique != 0) + FOR_EACH_BB_FN (bb, cfun) + for (gimple_stmt_iterator gsi = gsi_start_bb (bb); + !gsi_end_p (gsi); gsi_next (&gsi)) + { + gimple *stmt = gsi_stmt (gsi); + walk_stmt_load_store_ops (stmt, (void *)(uintptr_t) 1, + clear_dependence_clique, + clear_dependence_clique); + } + unsigned short clique = 0; unsigned short last_ruid = 0; bitmap rvars = BITMAP_ALLOC (NULL); -- cgit v1.2.3 From b9f3eef97a8dd1c80fbfcb03c11d7675ca948f68 Mon Sep 17 00:00:00 2001 From: Richard Biener <rguenther@suse.de> Date: Fri, 30 Aug 2019 11:39:19 +0000 Subject: 2019-08-30 Richard Biener <rguenther@suse.de> Backport from mainline 2019-08-12 Richard Biener <rguenther@suse.de> PR lto/91375 * tree.c (free_lang_data_in_type): Do not free TYPE_BINFO dependent on flag_devirtualize. 2019-07-31 Richard Biener <rguenther@suse.de> PR tree-optimization/91293 * tree-vect-slp.c (vect_build_slp_tree_2): Do not swap operands of reduction stmts. * gcc.dg/vect/pr91293-1.c: New testcase. * gcc.dg/vect/pr91293-2.c: Likewise. * gcc.dg/vect/pr91293-3.c: Likewise. 2019-07-31 Richard Biener <rguenther@suse.de> PR tree-optimization/91280 * tree-ssa-structalias.c (get_constraint_for_component_ref): Decompose MEM_REF manually for offset handling. * g++.dg/torture/pr91280.C: New testcase. 2019-07-19 Richard Biener <rguenther@suse.de> PR tree-optimization/91200 * tree-ssa-phiopt.c (cond_store_replacement): Check we have no PHI nodes in middle-bb. * gcc.dg/torture/pr91200.c: New testcase. 2019-07-15 Richard Biener <rguenther@suse.de> PR middle-end/91162 * tree-cfg.c (move_block_to_fn): When releasing a virtual PHI node make sure to replace all uses with something valid. * gcc.dg/autopar/pr91162.c: New testcase. 2019-07-11 Richard Biener <rguenther@suse.de> PR middle-end/91131 * gimplify.c (gimplify_compound_literal_expr): Force a temporary when the object is volatile and we have not cleared it even though there are no nonzero elements. * gcc.target/i386/pr91131.c: New testcase. 2019-07-10 Richard Biener <rguenther@suse.de> PR tree-optimization/91126 * tree-ssa-sccvn.c (vn_reference_lookup_3): Adjust native encoding offset for BYTES_BIG_ENDIAN. * gcc.dg/torture/pr91126.c: New testcase. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@275100 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 46 +++++++ gcc/gimplify.c | 2 +- gcc/testsuite/ChangeLog | 35 +++++ gcc/testsuite/g++.dg/torture/pr91280.C | 223 ++++++++++++++++++++++++++++++++ gcc/testsuite/gcc.dg/autopar/pr91162.c | 25 ++++ gcc/testsuite/gcc.dg/torture/pr91126.c | 28 ++++ gcc/testsuite/gcc.dg/torture/pr91200.c | 32 +++++ gcc/testsuite/gcc.dg/vect/pr91293-1.c | 19 +++ gcc/testsuite/gcc.dg/vect/pr91293-2.c | 19 +++ gcc/testsuite/gcc.dg/vect/pr91293-3.c | 20 +++ gcc/testsuite/gcc.target/i386/pr91131.c | 19 +++ gcc/tree-cfg.c | 9 +- gcc/tree-ssa-phiopt.c | 5 + gcc/tree-ssa-sccvn.c | 15 ++- gcc/tree-ssa-structalias.c | 26 +++- gcc/tree-vect-slp.c | 3 + gcc/tree.c | 3 +- 17 files changed, 520 insertions(+), 9 deletions(-) create mode 100644 gcc/testsuite/g++.dg/torture/pr91280.C create mode 100644 gcc/testsuite/gcc.dg/autopar/pr91162.c create mode 100644 gcc/testsuite/gcc.dg/torture/pr91126.c create mode 100644 gcc/testsuite/gcc.dg/torture/pr91200.c create mode 100644 gcc/testsuite/gcc.dg/vect/pr91293-1.c create mode 100644 gcc/testsuite/gcc.dg/vect/pr91293-2.c create mode 100644 gcc/testsuite/gcc.dg/vect/pr91293-3.c create mode 100644 gcc/testsuite/gcc.target/i386/pr91131.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 24ab0081d92..5ec646f81b2 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,49 @@ +2019-08-30 Richard Biener <rguenther@suse.de> + + Backport from mainline + 2019-08-12 Richard Biener <rguenther@suse.de> + + PR lto/91375 + * tree.c (free_lang_data_in_type): Do not free TYPE_BINFO dependent on + flag_devirtualize. + + 2019-07-31 Richard Biener <rguenther@suse.de> + + PR tree-optimization/91293 + * tree-vect-slp.c (vect_build_slp_tree_2): Do not swap operands + of reduction stmts. + + 2019-07-31 Richard Biener <rguenther@suse.de> + + PR tree-optimization/91280 + * tree-ssa-structalias.c (get_constraint_for_component_ref): + Decompose MEM_REF manually for offset handling. + + 2019-07-19 Richard Biener <rguenther@suse.de> + + PR tree-optimization/91200 + * tree-ssa-phiopt.c (cond_store_replacement): Check we have + no PHI nodes in middle-bb. + + 2019-07-15 Richard Biener <rguenther@suse.de> + + PR middle-end/91162 + * tree-cfg.c (move_block_to_fn): When releasing a virtual PHI + node make sure to replace all uses with something valid. + + 2019-07-11 Richard Biener <rguenther@suse.de> + + PR middle-end/91131 + * gimplify.c (gimplify_compound_literal_expr): Force a temporary + when the object is volatile and we have not cleared it even though + there are no nonzero elements. + + 2019-07-10 Richard Biener <rguenther@suse.de> + + PR tree-optimization/91126 + * tree-ssa-sccvn.c (vn_reference_lookup_3): Adjust + native encoding offset for BYTES_BIG_ENDIAN. + 2019-08-30 Richard Biener <rguenther@suse.de> * lto-streamer.h (LTO_minor_version): Bump. diff --git a/gcc/gimplify.c b/gcc/gimplify.c index 4d97c999f6a..fcb50c8e047 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -4953,7 +4953,7 @@ gimplify_init_constructor (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p, one field to assign, initialize the target from a temporary. */ if (TREE_THIS_VOLATILE (object) && !TREE_ADDRESSABLE (type) - && num_nonzero_elements > 0 + && (num_nonzero_elements > 0 || !cleared) && vec_safe_length (elts) > 1) { tree temp = create_tmp_var (TYPE_MAIN_VARIANT (type)); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 547af10f63e..49592d84ee9 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,38 @@ +2019-08-30 Richard Biener <rguenther@suse.de> + + Backport from mainline + 2019-07-31 Richard Biener <rguenther@suse.de> + + PR tree-optimization/91293 + * gcc.dg/vect/pr91293-1.c: New testcase. + * gcc.dg/vect/pr91293-2.c: Likewise. + * gcc.dg/vect/pr91293-3.c: Likewise. + + 2019-07-31 Richard Biener <rguenther@suse.de> + + PR tree-optimization/91280 + * g++.dg/torture/pr91280.C: New testcase. + + 2019-07-19 Richard Biener <rguenther@suse.de> + + PR tree-optimization/91200 + * gcc.dg/torture/pr91200.c: New testcase. + + 2019-07-15 Richard Biener <rguenther@suse.de> + + PR middle-end/91162 + * gcc.dg/autopar/pr91162.c: New testcase. + + 2019-07-11 Richard Biener <rguenther@suse.de> + + PR middle-end/91131 + * gcc.target/i386/pr91131.c: New testcase. + + 2019-07-10 Richard Biener <rguenther@suse.de> + + PR tree-optimization/91126 + * gcc.dg/torture/pr91126.c: New testcase. + 2019-08-30 Richard Biener <rguenther@suse.de> Backport from mainline diff --git a/gcc/testsuite/g++.dg/torture/pr91280.C b/gcc/testsuite/g++.dg/torture/pr91280.C new file mode 100644 index 00000000000..063bef836f9 --- /dev/null +++ b/gcc/testsuite/g++.dg/torture/pr91280.C @@ -0,0 +1,223 @@ +// { dg-do compile } + +enum { Aligned, RowMajor }; +enum { ReadOnlyAccessors }; +template <typename> struct K { + enum { value }; +}; +template <typename> struct traits; +template <typename T> struct traits<const T> : traits<T> {}; +struct A { + enum { has_write_access, value }; +}; +template <typename, int n> class array { +public: + int operator[](unsigned long p1) { return values[p1]; } + int values[n]; +}; +template <typename> struct I; +template <typename, int, template <class> class = I> class M; +template <typename, int, int, typename> class J; +template <typename, int> class N; +template <typename, typename> class D; +template <typename, typename, typename, typename> class TensorContractionOp; +template <long, typename> class TensorChippingOp; +class C; +template <typename DenseIndex, int NumDims> +struct K<array<DenseIndex, NumDims>> { + static const long value = NumDims; +}; +template <typename Scalar_, int NumIndices_, int Options_, typename IndexType_> +struct traits<J<Scalar_, NumIndices_, Options_, IndexType_>> { + typedef IndexType_ Index; +}; +template <typename PlainObjectType, int Options_, + template <class> class MakePointer_> +struct traits<M<PlainObjectType, Options_, MakePointer_>> + : traits<PlainObjectType> {}; +template <typename T> struct B { typedef T type; }; +template <typename Derived> class N<Derived, ReadOnlyAccessors> { +public: + typedef typename traits<Derived>::Index Index; + D<int, Derived> m_fn1(); + template <typename OtherDerived, typename Dimensions> + TensorContractionOp<Dimensions, Derived, const OtherDerived, int> + m_fn2(OtherDerived, Dimensions); + template <Index> TensorChippingOp<1, Derived> m_fn3(Index); +}; +template <typename Derived, int = A::value> +class N : public N<Derived, ReadOnlyAccessors> { +public: + template <typename DeviceType> C m_fn4(DeviceType); +}; +template <typename, typename> struct TensorEvaluator; +template <typename UnaryOp, typename ArgType, typename Device> +struct TensorEvaluator<const D<UnaryOp, ArgType>, Device> { + TensorEvaluator(D<UnaryOp, ArgType>, Device); +}; +template <typename, typename> class D { +public: + typedef typename B<D>::type Nested; +}; +template <typename Indices_, typename LeftArgType_, typename RightArgType_, + typename OutputKernelType_, typename Device_> +struct traits< + TensorEvaluator<const TensorContractionOp<Indices_, LeftArgType_, + RightArgType_, OutputKernelType_>, + Device_>> { + typedef Indices_ Indices; + typedef LeftArgType_ LeftArgType; + typedef RightArgType_ RightArgType; + typedef OutputKernelType_ OutputKernelType; + typedef Device_ Device; +}; +template <typename, typename LhsXprType, typename RhsXprType, typename> +class TensorContractionOp { +public: + typedef typename B<TensorContractionOp>::type Nested; + typename LhsXprType::Nested m_fn5(); + typename RhsXprType::Nested m_fn6(); +}; +template <typename Derived> struct TensorContractionEvaluatorBase { + typedef typename traits<Derived>::LeftArgType LeftArgType; + typedef typename traits<Derived>::RightArgType RightArgType; + typedef typename traits<Derived>::Device Device; + TensorContractionEvaluatorBase( + TensorContractionOp<typename traits<Derived>::Indices, LeftArgType, + RightArgType, + typename traits<Derived>::OutputKernelType> + p1, + Device p2) + : m_leftImpl(p1.m_fn6(), p2), m_rightImpl(p1.m_fn5(), p2) { + long nocontract_idx; + for (int i;; i++) { + bool contracting; + if (contracting) { + if (nocontract_idx < K<int>::value) + m_j_size = m_j_strides[nocontract_idx]; + nocontract_idx++; + } + } + } + array<long, 1> m_j_strides; + long m_j_size; + TensorEvaluator<RightArgType, Device> m_leftImpl; + TensorEvaluator<LeftArgType, Device> m_rightImpl; +}; +template <typename Indices, typename LeftArgType, typename RightArgType, + typename OutputKernelType, typename Device> +struct TensorEvaluator< + const TensorContractionOp<Indices, LeftArgType, RightArgType, + OutputKernelType>, + Device> + : TensorContractionEvaluatorBase<TensorEvaluator< + const TensorContractionOp<Indices, LeftArgType, RightArgType, + OutputKernelType>, + Device>> { + typedef TensorEvaluator Self; + typedef TensorContractionEvaluatorBase<Self> Base; + TensorEvaluator( + TensorContractionOp<Indices, LeftArgType, RightArgType, OutputKernelType> + p1, + Device p2) + : Base(p1, p2) {} +}; +template <long DimId, typename XprType> +struct traits<TensorChippingOp<DimId, XprType>> : traits<XprType> {}; +template <long, typename XprType> +class TensorChippingOp : public N<TensorChippingOp<1, XprType>> { +public: + typedef typename B<TensorChippingOp>::type Nested; +}; +template <long DimId, typename ArgType, typename Device> +struct TensorEvaluator<const TensorChippingOp<DimId, ArgType>, Device> { + static const int NumInputDims = K<typename ArgType::Dimensions>::value; + array<long, NumInputDims> m_dimensions; +}; +template <long DimId, typename ArgType, typename Device> +struct TensorEvaluator<TensorChippingOp<DimId, ArgType>, Device> + : TensorEvaluator<const TensorChippingOp<1, ArgType>, Device> { + TensorEvaluator(TensorChippingOp<DimId, ArgType>, Device); +}; +template <typename, typename RhsXprType> class TensorAssignOp { +public: + TensorAssignOp(TensorChippingOp<0, const M<J<int, 3, 1, int>, 1>>, + RhsXprType); + TensorChippingOp<0, const M<J<int, 3, 1, int>, 1>> m_fn7(); + typename RhsXprType::Nested m_fn8(); +}; +template <typename LeftArgType, typename RightArgType, typename Device> +struct TensorEvaluator<const TensorAssignOp<LeftArgType, RightArgType>, + Device> { + TensorEvaluator(TensorAssignOp<LeftArgType, RightArgType> p1, Device p2) + : m_leftImpl(p1.m_fn7(), p2), m_rightImpl(p1.m_fn8(), p2) {} + TensorEvaluator<LeftArgType, Device> m_leftImpl; + TensorEvaluator<RightArgType, Device> m_rightImpl; +}; +template <typename Expression> class F { +public: + static void m_fn9(Expression p1) { + int device; + TensorEvaluator<Expression, int>(p1, device); + } +}; +class C { +public: + void + operator=(TensorContractionOp<array<int, 1>, + TensorChippingOp<1, M<J<float, 3, 1, int>, 0>>, + const D<int, M<J<float, 3, 1, int>, 0>>, int> + p1) { + TensorAssignOp< + TensorChippingOp<0, const M<J<int, 3, 1, int>, 1>>, + const TensorContractionOp< + array<int, 1>, TensorChippingOp<1, M<J<float, 3, 1, int>, 0>>, + const D<int, M<J<float, 3, 1, int>, 0>>, int>> + assign(m_expression, p1); + F<const TensorAssignOp< + TensorChippingOp<0, const M<J<int, 3, 1, int>, 1>>, + const TensorContractionOp< + array<int, 1>, TensorChippingOp<1, M<J<float, 3, 1, int>, 0>>, + const D<int, M<J<float, 3, 1, int>, 0>>, int>>>::m_fn9(assign); + } + TensorChippingOp<0, const M<J<int, 3, 1, int>, 1>> m_expression; +}; +template <typename, int NumIndices_, int, typename> class J { +public: + typedef array<long, NumIndices_> Dimensions; +}; +template <typename PlainObjectType, int Options_, template <class> class> +class M : public N<M<PlainObjectType, Options_>> { +public: + typedef typename PlainObjectType::Dimensions Dimensions; +}; +template <int NDIMS> struct TTypes { + typedef M<J<float, NDIMS, RowMajor, int>, Aligned> ConstTensor; +}; +class L { +public: + template <typename, long NDIMS> typename TTypes<NDIMS>::ConstTensor m_fn10(); +}; +class H { +public: + H(int *); +}; +class G { +public: + G(H *(int *)); +}; +int Run_d; +class O : H { +public: + int BatchMatMul_context; + O() : H(&BatchMatMul_context) { + L out, in_y, in_x; + auto Tx = in_x.m_fn10<float, 3>(), Ty = in_y.m_fn10<float, 3>(), + Tz = out.m_fn10<float, 3>(), z = Tz; + array<int, 1> contract_pairs; + auto x = Tx.m_fn3<0>(0); + auto y = Ty.m_fn1(); + z.m_fn4(Run_d) = x.m_fn2(y, contract_pairs); + } +}; +G registrar__body__0__object([](int *) -> H * { O(); return 0; }); diff --git a/gcc/testsuite/gcc.dg/autopar/pr91162.c b/gcc/testsuite/gcc.dg/autopar/pr91162.c new file mode 100644 index 00000000000..ff243e4c1c0 --- /dev/null +++ b/gcc/testsuite/gcc.dg/autopar/pr91162.c @@ -0,0 +1,25 @@ +/* { dg-do compile { target int128 } } */ +/* { dg-options "-O -ftree-parallelize-loops=2 -fno-tree-dominator-opts --param parloops-min-per-thread=30" } */ + +void +zf (__int128 ct) +{ + __int128 *rk = &ct; + + if (0) + { + int jj; + +t9: + for (jj = 0; jj < 60; ++jj) + { + } + + __builtin_unreachable (); + } + + while (*rk < 1) + ++*rk; + + goto t9; +} diff --git a/gcc/testsuite/gcc.dg/torture/pr91126.c b/gcc/testsuite/gcc.dg/torture/pr91126.c new file mode 100644 index 00000000000..8e34815b9a7 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr91126.c @@ -0,0 +1,28 @@ +/* { dg-do run } */ + +struct S +{ + __INT32_TYPE__ a : 24; + __INT32_TYPE__ b : 8; +} s; + +int +main() +{ + s.a = 0xfefefe; + s.b = 0xfe; + unsigned char c; + c = ((unsigned char *)&s)[0]; + if (c != 0xfe) + __builtin_abort (); + c = ((unsigned char *)&s)[1]; + if (c != 0xfe) + __builtin_abort (); + c = ((unsigned char *)&s)[2]; + if (c != 0xfe) + __builtin_abort (); + c = ((unsigned char *)&s)[3]; + if (c != 0xfe) + __builtin_abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/torture/pr91200.c b/gcc/testsuite/gcc.dg/torture/pr91200.c new file mode 100644 index 00000000000..09db9e142c7 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr91200.c @@ -0,0 +1,32 @@ +/* { dg-do compile } */ + +int printf (const char *, ...); + +char a; +int b, c, **d; + +int main () +{ + int f = -128, *g, *h[2] = {0, 0}, i; + printf("0"); + if (a) + { + while (f > a) { + int *j = &i; + *j |= 0; + } + h[i] = &c; + } + if (h[1]) + { + int **k = &g; + *k = &f; + while (i) + { + int **l[] = {&g}; + } + int **m = &g; + *d = *m = &b; + } + return 0; +} diff --git a/gcc/testsuite/gcc.dg/vect/pr91293-1.c b/gcc/testsuite/gcc.dg/vect/pr91293-1.c new file mode 100644 index 00000000000..dc321f5726f --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/pr91293-1.c @@ -0,0 +1,19 @@ +/* { dg-do run } */ +/* { dg-additional-options "-msse4.1" { target { sse4_runtime } } } */ + +long long a; +unsigned b, c; +int d = 62; +void e(long long *f, int p2) { *f = p2; } +int main() +{ + for (int g = 2; g <= d; g++) + { + b += g + 4; + c += 5 - g; + } + e(&a, b); + if (a != 2196) + __builtin_abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/vect/pr91293-2.c b/gcc/testsuite/gcc.dg/vect/pr91293-2.c new file mode 100644 index 00000000000..b9354bbd5e8 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/pr91293-2.c @@ -0,0 +1,19 @@ +/* { dg-do run } */ +/* { dg-additional-options "-msse4.1" { target { sse4_runtime } } } */ + +long long a; +unsigned b, c; +int d = 62; +void e(long long *f, int p2) { *f = p2; } +int main() +{ + for (int g = 2; g <= d; g++) + { + c += 5 - g; + b += g + 4; + } + e(&a, b); + if (a != 2196) + __builtin_abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/vect/pr91293-3.c b/gcc/testsuite/gcc.dg/vect/pr91293-3.c new file mode 100644 index 00000000000..c35bc3481cb --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/pr91293-3.c @@ -0,0 +1,20 @@ +/* { dg-do run } */ +/* { dg-additional-options "-msse4.1" { target { sse4_runtime } } } */ + +long long a; +unsigned b, c; +int d = 62; +void e(long long *f, int p2) { *f = p2; } +int xx = 5, yy = 4; +int main() +{ + for (int g = 2; g <= d; g++) + { + c += xx - g; + b += yy + g; + } + e(&a, b); + if (a != 2196) + __builtin_abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/pr91131.c b/gcc/testsuite/gcc.target/i386/pr91131.c new file mode 100644 index 00000000000..85008ff8a8b --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr91131.c @@ -0,0 +1,19 @@ +/* { dg-do compile } */ +/* { dg-options "-O" } */ + +struct Reg_T { + unsigned int a : 3; + unsigned int b : 1; + unsigned int c : 4; +}; + +volatile struct Reg_T Reg_A; + +int +main () +{ + Reg_A = (struct Reg_T){ .a = 0, .b = 0, .c = 0 }; + return 0; +} + +/* { dg-final { scan-assembler-times "mov\[^\r\n\]*Reg_A" 1 } } */ diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c index f0c7e5d2ed0..baaf0b0eece 100644 --- a/gcc/tree-cfg.c +++ b/gcc/tree-cfg.c @@ -7232,7 +7232,14 @@ move_block_to_fn (struct function *dest_cfun, basic_block bb, if (virtual_operand_p (op)) { /* Remove the phi nodes for virtual operands (alias analysis will be - run for the new function, anyway). */ + run for the new function, anyway). But replace all uses that + might be outside of the region we move. */ + use_operand_p use_p; + imm_use_iterator iter; + gimple *use_stmt; + FOR_EACH_IMM_USE_STMT (use_stmt, iter, op) + FOR_EACH_IMM_USE_ON_STMT (use_p, iter) + SET_USE (use_p, SSA_NAME_VAR (op)); remove_phi_node (&psi, true); continue; } diff --git a/gcc/tree-ssa-phiopt.c b/gcc/tree-ssa-phiopt.c index 8e94f6a999a..53f46dc0350 100644 --- a/gcc/tree-ssa-phiopt.c +++ b/gcc/tree-ssa-phiopt.c @@ -1894,6 +1894,11 @@ cond_store_replacement (basic_block middle_bb, basic_block join_bb, || gimple_has_volatile_ops (assign)) return false; + /* And no PHI nodes so all uses in the single stmt are also + available where we insert to. */ + if (!gimple_seq_empty_p (phi_nodes (middle_bb))) + return false; + locus = gimple_location (assign); lhs = gimple_assign_lhs (assign); rhs = gimple_assign_rhs1 (assign); diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c index 6de33ae38ac..654127cfbc3 100644 --- a/gcc/tree-ssa-sccvn.c +++ b/gcc/tree-ssa-sccvn.c @@ -2031,9 +2031,20 @@ vn_reference_lookup_3 (ao_ref *ref, tree vuse, void *vr_, tree rhs = gimple_assign_rhs1 (def_stmt); if (TREE_CODE (rhs) == SSA_NAME) rhs = SSA_VAL (rhs); - len = native_encode_expr (gimple_assign_rhs1 (def_stmt), + unsigned pad = 0; + if (BYTES_BIG_ENDIAN + && is_a <scalar_mode> (TYPE_MODE (TREE_TYPE (rhs)))) + { + /* On big-endian the padding is at the 'front' so + just skip the initial bytes. */ + fixed_size_mode mode + = as_a <fixed_size_mode> (TYPE_MODE (TREE_TYPE (rhs))); + pad = GET_MODE_SIZE (mode) - size2 / BITS_PER_UNIT; + } + len = native_encode_expr (rhs, buffer, sizeof (buffer), - (offseti - offset2) / BITS_PER_UNIT); + ((offseti - offset2) / BITS_PER_UNIT + + pad)); if (len > 0 && len * BITS_PER_UNIT >= maxsizei) { tree type = vr->type; diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c index 59d56fe525f..dcc97e07ff8 100644 --- a/gcc/tree-ssa-structalias.c +++ b/gcc/tree-ssa-structalias.c @@ -3232,9 +3232,29 @@ get_constraint_for_component_ref (tree t, vec<ce_s> *results, return; } - /* Pretend to take the address of the base, we'll take care of - adding the required subset of sub-fields below. */ - get_constraint_for_1 (t, results, true, lhs_p); + /* Avoid creating pointer-offset constraints, so handle MEM_REF + offsets directly. Pretend to take the address of the base, + we'll take care of adding the required subset of sub-fields below. */ + if (TREE_CODE (t) == MEM_REF + && !integer_zerop (TREE_OPERAND (t, 0))) + { + poly_offset_int off = mem_ref_offset (t); + off <<= LOG2_BITS_PER_UNIT; + off += bitpos; + poly_int64 off_hwi; + if (off.to_shwi (&off_hwi)) + bitpos = off_hwi; + else + { + bitpos = 0; + bitmaxsize = -1; + } + get_constraint_for_1 (TREE_OPERAND (t, 0), results, false, lhs_p); + do_deref (results); + } + else + get_constraint_for_1 (t, results, true, lhs_p); + /* Strip off nothing_id. */ if (results->length () == 2) { diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c index 625e99a7872..d0ba014ed92 100644 --- a/gcc/tree-vect-slp.c +++ b/gcc/tree-vect-slp.c @@ -1308,6 +1308,9 @@ vect_build_slp_tree_2 (vec_info *vinfo, && nops == 2 && oprnds_info[1]->first_dt == vect_internal_def && is_gimple_assign (stmt) + /* Swapping operands for reductions breaks assumptions later on. */ + && STMT_VINFO_DEF_TYPE (vinfo_for_stmt (stmt)) != vect_reduction_def + && STMT_VINFO_DEF_TYPE (vinfo_for_stmt (stmt)) != vect_double_reduction_def /* Do so only if the number of not successful permutes was nor more than a cut-ff as re-trying the recursive match on possibly each level of the tree would expose exponential diff --git a/gcc/tree.c b/gcc/tree.c index 091a63a1a8d..d3291a169de 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -5133,8 +5133,7 @@ free_lang_data_in_type (tree type) free_lang_data_in_binfo (TYPE_BINFO (type)); /* We need to preserve link to bases and virtual table for all polymorphic types to make devirtualization machinery working. */ - if (!BINFO_VTABLE (TYPE_BINFO (type)) - || !flag_devirtualize) + if (!BINFO_VTABLE (TYPE_BINFO (type))) TYPE_BINFO (type) = NULL; } } -- cgit v1.2.3 From afd0c807017d5fd809ee5367c17518539dbff693 Mon Sep 17 00:00:00 2001 From: Richard Biener <rguenther@suse.de> Date: Fri, 30 Aug 2019 11:43:33 +0000 Subject: 2019-08-30 Richard Biener <rguenther@suse.de> Backport from mainline 2019-06-18 Richard Biener <rguenther@suse.de> PR debug/90900 * cfgexpand.c (expand_debug_expr): Treat NOTE_P DECL_RTL as if optimized away. * gcc.dg/gomp/pr90900.c: New testcase. 2019-05-15 Richard Biener <rguenther@suse.de> PR c/90474 * c-common.c (c_common_mark_addressable_vec): Also mark a COMPOUND_LITERAL_EXPR_DECL addressable similar to c_mark_addressable. 2019-04-29 Richard Biener <rguenther@suse.de> PR tree-optimization/90278 * tree-ssa-forwprop.c (pass_forwprop::execute): Transfer/clean EH on comparison simplification. * gcc.dg/torture/pr90278.c: New testcase. 2019-04-25 Richard Biener <rguenther@suse.de> PR middle-end/90194 * match.pd: Add pattern to simplify view-conversion of an empty constructor. * g++.dg/torture/pr90194.C: New testcase. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@275103 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 21 +++++++++++++++++++++ gcc/c-family/ChangeLog | 10 ++++++++++ gcc/c-family/c-common.c | 2 ++ gcc/cfgexpand.c | 6 +++++- gcc/match.pd | 7 +++++++ gcc/testsuite/ChangeLog | 18 ++++++++++++++++++ gcc/testsuite/g++.dg/torture/pr90194.C | 18 ++++++++++++++++++ gcc/testsuite/gcc.dg/gomp/pr90900.c | 11 +++++++++++ gcc/testsuite/gcc.dg/torture/pr90278.c | 13 +++++++++++++ gcc/tree-ssa-forwprop.c | 2 ++ 10 files changed, 107 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/torture/pr90194.C create mode 100644 gcc/testsuite/gcc.dg/gomp/pr90900.c create mode 100644 gcc/testsuite/gcc.dg/torture/pr90278.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 5ec646f81b2..f2cd00c663b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,24 @@ +2019-08-30 Richard Biener <rguenther@suse.de> + + Backport from mainline + 2019-06-18 Richard Biener <rguenther@suse.de> + + PR debug/90900 + * cfgexpand.c (expand_debug_expr): Treat NOTE_P DECL_RTL + as if optimized away. + + 2019-04-29 Richard Biener <rguenther@suse.de> + + PR tree-optimization/90278 + * tree-ssa-forwprop.c (pass_forwprop::execute): Transfer/clean + EH on comparison simplification. + + 2019-04-25 Richard Biener <rguenther@suse.de> + + PR middle-end/90194 + * match.pd: Add pattern to simplify view-conversion of an + empty constructor. + 2019-08-30 Richard Biener <rguenther@suse.de> Backport from mainline diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index eb58110dbd8..14952a8e1e5 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,13 @@ +2019-08-30 Richard Biener <rguenther@suse.de> + + Backport from mainline + 2019-05-15 Richard Biener <rguenther@suse.de> + + PR c/90474 + * c-common.c (c_common_mark_addressable_vec): Also mark + a COMPOUND_LITERAL_EXPR_DECL addressable similar to + c_mark_addressable. + 2019-08-29 Jakub Jelinek <jakub@redhat.com> Backported from mainline diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c index dbbaa81956b..655c3bf10a7 100644 --- a/gcc/c-family/c-common.c +++ b/gcc/c-family/c-common.c @@ -6440,6 +6440,8 @@ c_common_mark_addressable_vec (tree t) return; if (!VAR_P (t) || !DECL_HARD_REGISTER (t)) TREE_ADDRESSABLE (t) = 1; + if (TREE_CODE (t) == COMPOUND_LITERAL_EXPR) + TREE_ADDRESSABLE (COMPOUND_LITERAL_EXPR_DECL (t)) = 1; } diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c index 018cf257126..18565bf1dab 100644 --- a/gcc/cfgexpand.c +++ b/gcc/cfgexpand.c @@ -4323,7 +4323,11 @@ expand_debug_expr (tree exp) op0 = DECL_RTL_IF_SET (exp); /* This decl was probably optimized away. */ - if (!op0) + if (!op0 + /* At least label RTXen are sometimes replaced by + NOTE_INSN_DELETED_LABEL. Any notes here are not + handled by copy_rtx. */ + || NOTE_P (op0)) { if (!VAR_P (exp) || DECL_EXTERNAL (exp) diff --git a/gcc/match.pd b/gcc/match.pd index d6ac4389ee5..8e0265b2b33 100644 --- a/gcc/match.pd +++ b/gcc/match.pd @@ -2406,6 +2406,13 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) && TYPE_UNSIGNED (TREE_TYPE (@1))))) (view_convert @1))) +/* Simplify a view-converted empty constructor. */ +(simplify + (view_convert CONSTRUCTOR@0) + (if (TREE_CODE (@0) != SSA_NAME + && CONSTRUCTOR_NELTS (@0) == 0) + { build_zero_cst (type); })) + /* Re-association barriers around constants and other re-association barriers can be removed. */ (simplify diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 49592d84ee9..6a765d3c5d7 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,21 @@ +2019-08-30 Richard Biener <rguenther@suse.de> + + Backport from mainline + 2019-06-18 Richard Biener <rguenther@suse.de> + + PR debug/90900 + * gcc.dg/gomp/pr90900.c: New testcase. + + 2019-04-29 Richard Biener <rguenther@suse.de> + + PR tree-optimization/90278 + * gcc.dg/torture/pr90278.c: New testcase. + + 2019-04-25 Richard Biener <rguenther@suse.de> + + PR middle-end/90194 + * g++.dg/torture/pr90194.C: New testcase. + 2019-08-30 Richard Biener <rguenther@suse.de> Backport from mainline diff --git a/gcc/testsuite/g++.dg/torture/pr90194.C b/gcc/testsuite/g++.dg/torture/pr90194.C new file mode 100644 index 00000000000..f0c3a77db8a --- /dev/null +++ b/gcc/testsuite/g++.dg/torture/pr90194.C @@ -0,0 +1,18 @@ +// { dg-do compile } +// { dg-additional-options "-g" } + +struct cb { + int yr; +}; + +void * +operator new (__SIZE_TYPE__, void *nq) +{ + return nq; +} + +void +af (int xn) +{ + new (&xn) cb { }; +} diff --git a/gcc/testsuite/gcc.dg/gomp/pr90900.c b/gcc/testsuite/gcc.dg/gomp/pr90900.c new file mode 100644 index 00000000000..d4c5d7d5bef --- /dev/null +++ b/gcc/testsuite/gcc.dg/gomp/pr90900.c @@ -0,0 +1,11 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fopenmp -g" } */ + +void f (int a) +{ + void *x = &&lab; +#pragma omp parallel + if (a) + { lab: __builtin_unreachable(); } + x; +} diff --git a/gcc/testsuite/gcc.dg/torture/pr90278.c b/gcc/testsuite/gcc.dg/torture/pr90278.c new file mode 100644 index 00000000000..617246a6d4c --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr90278.c @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-fexceptions -fnon-call-exceptions" } */ + +double +hc (void) +{ + double dp = 0.0; + double ek[1]; + + ek[0] = 1.0 / dp < 0.0; + + return ek[0]; +} diff --git a/gcc/tree-ssa-forwprop.c b/gcc/tree-ssa-forwprop.c index 58ec6b47a5b..91741894aec 100644 --- a/gcc/tree-ssa-forwprop.c +++ b/gcc/tree-ssa-forwprop.c @@ -2481,6 +2481,8 @@ pass_forwprop::execute (function *fun) { int did_something; did_something = forward_propagate_into_comparison (&gsi); + if (maybe_clean_or_replace_eh_stmt (stmt, gsi_stmt (gsi))) + bitmap_set_bit (to_purge, bb->index); if (did_something == 2) cfg_changed = true; changed = did_something != 0; -- cgit v1.2.3 From b07c61ff764d47253d453e2657b308405ea70116 Mon Sep 17 00:00:00 2001 From: Jonathan Wakely <jwakely@redhat.com> Date: Fri, 30 Aug 2019 13:09:36 +0000 Subject: Fix vector::_Temporary_value::_M_ptr The pointer argument to allocator_traits::construct and allocator_traits::destroy should be a raw pointer, not the allocator's pointer type. _Temporary_value::_M_ptr was returning the wrong type. Backport from mainline 2018-09-03 Jonathan Wakely <jwakely@redhat.com> * include/bits/stl_vector.h (vector::_Temporary_value::_M_ptr): Return raw pointer not allocator's pointer type. (vector::_Temporary_value::_M_val): Use _M_ptr. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@275165 138bc75d-0d04-0410-961f-82ee72b054a4 --- libstdc++-v3/ChangeLog | 9 +++++++++ libstdc++-v3/include/bits/stl_vector.h | 6 +++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index f7f7bff6835..12038dfbc01 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,12 @@ +2019-08-30 Jonathan Wakely <jwakely@redhat.com> + + Backport from mainline + 2018-09-03 Jonathan Wakely <jwakely@redhat.com> + + * include/bits/stl_vector.h (vector::_Temporary_value::_M_ptr): + Return raw pointer not allocator's pointer type. + (vector::_Temporary_value::_M_val): Use _M_ptr. + 2019-06-01 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline diff --git a/libstdc++-v3/include/bits/stl_vector.h b/libstdc++-v3/include/bits/stl_vector.h index 129d45cd34b..298b38fe9cd 100644 --- a/libstdc++-v3/include/bits/stl_vector.h +++ b/libstdc++-v3/include/bits/stl_vector.h @@ -1600,11 +1600,11 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER { _Alloc_traits::destroy(_M_this->_M_impl, _M_ptr()); } value_type& - _M_val() { return *reinterpret_cast<_Tp*>(&__buf); } + _M_val() { return *_M_ptr(); } private: - pointer - _M_ptr() { return pointer_traits<pointer>::pointer_to(_M_val()); } + _Tp* + _M_ptr() { return reinterpret_cast<_Tp*>(&__buf); } vector* _M_this; typename aligned_storage<sizeof(_Tp), alignof(_Tp)>::type __buf; -- cgit v1.2.3 From 29e6d017a696ee5d44d0409b89c9b044333c9444 Mon Sep 17 00:00:00 2001 From: Jonathan Wakely <jwakely@redhat.com> Date: Fri, 30 Aug 2019 13:09:42 +0000 Subject: PR libstdc++/85965 move is_invocable assertions again This is another attempt to reduce how often the assertions are evaluated, so that code which doesn't try to use the function objects doesn't need them to be invocable. For _Rb_tree we access the _M_key_compare object directly, so can't put the assertions in an accessor function for it. However, every invocation of _M_key_compare is accompanied by a use of _S_key, so the assertions can be put in there. For _Hashtable there are member functions that are consistently used to obtain a hash code or test for equality, so the assertions can go in those members. Backport from mainline 2019-05-17 Jonathan Wakely <jwakely@redhat.com> PR libstdc++/85965 * include/bits/hashtable.h (_Hashtable::~_Hashtable()): Remove static assertions from the destructor. * include/bits/hashtable_policy.h (_Hash_code_base::_M_hash_code): Move static_assert for hash function to here. (_Hash_table_base::_M_equals): Move static_assert for equality predicate to here. * include/bits/stl_tree.h (_Rb_tree::_S_key(_Const_Link_type)): Move assertions here. Access the value directly instead of calling _S_value. (_Rb_tree::_S_key(_Const_Base_ptr)): Do downcast and forward to _S_key(_Const_Link_type). * testsuite/23_containers/set/85965.cc: Check construction, destruction, assignment and size() do not trigger the assertions. * testsuite/23_containers/unordered_set/85965.cc: Likewise. * testsuite/23_containers/map/48101_neg.cc: Call find and adjust expected errors. * testsuite/23_containers/multimap/48101_neg.cc: Likewise. * testsuite/23_containers/multiset/48101_neg.cc: Likewise. * testsuite/23_containers/set/48101_neg.cc: Likewise. * testsuite/23_containers/unordered_map/48101_neg.cc: Likewise. * testsuite/23_containers/unordered_multimap/48101_neg.cc: Likewise. * testsuite/23_containers/unordered_multiset/48101_neg.cc: Likewise. * testsuite/23_containers/unordered_set/48101_neg.cc: Likewise. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@275166 138bc75d-0d04-0410-961f-82ee72b054a4 --- libstdc++-v3/ChangeLog | 29 +++++++++++++++++ libstdc++-v3/include/bits/hashtable.h | 6 ---- libstdc++-v3/include/bits/hashtable_policy.h | 15 +++++++-- libstdc++-v3/include/bits/stl_tree.h | 38 ++++++++++++---------- .../testsuite/23_containers/map/48101_neg.cc | 4 +++ .../testsuite/23_containers/multimap/48101_neg.cc | 4 +++ .../testsuite/23_containers/multiset/48101_neg.cc | 3 ++ .../testsuite/23_containers/set/48101_neg.cc | 3 ++ libstdc++-v3/testsuite/23_containers/set/85965.cc | 9 +++++ .../23_containers/unordered_map/48101_neg.cc | 2 ++ .../23_containers/unordered_multimap/48101_neg.cc | 2 ++ .../23_containers/unordered_multiset/48101_neg.cc | 2 ++ .../23_containers/unordered_set/48101_neg.cc | 2 ++ .../testsuite/23_containers/unordered_set/85965.cc | 9 +++++ 14 files changed, 103 insertions(+), 25 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 12038dfbc01..94893a0c08c 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,32 @@ +2019-08-30 Jonathan Wakely <jwakely@redhat.com> + + Backport from mainline + 2019-05-17 Jonathan Wakely <jwakely@redhat.com> + + PR libstdc++/85965 + * include/bits/hashtable.h (_Hashtable::~_Hashtable()): Remove static + assertions from the destructor. + * include/bits/hashtable_policy.h (_Hash_code_base::_M_hash_code): + Move static_assert for hash function to here. + (_Hash_table_base::_M_equals): Move static_assert for equality + predicate to here. + * include/bits/stl_tree.h (_Rb_tree::_S_key(_Const_Link_type)): Move + assertions here. Access the value directly instead of calling _S_value. + (_Rb_tree::_S_key(_Const_Base_ptr)): Do downcast and forward to + _S_key(_Const_Link_type). + * testsuite/23_containers/set/85965.cc: Check construction, + destruction, assignment and size() do not trigger the assertions. + * testsuite/23_containers/unordered_set/85965.cc: Likewise. + * testsuite/23_containers/map/48101_neg.cc: Call find and adjust + expected errors. + * testsuite/23_containers/multimap/48101_neg.cc: Likewise. + * testsuite/23_containers/multiset/48101_neg.cc: Likewise. + * testsuite/23_containers/set/48101_neg.cc: Likewise. + * testsuite/23_containers/unordered_map/48101_neg.cc: Likewise. + * testsuite/23_containers/unordered_multimap/48101_neg.cc: Likewise. + * testsuite/23_containers/unordered_multiset/48101_neg.cc: Likewise. + * testsuite/23_containers/unordered_set/48101_neg.cc: Likewise. + 2019-08-30 Jonathan Wakely <jwakely@redhat.com> Backport from mainline diff --git a/libstdc++-v3/include/bits/hashtable.h b/libstdc++-v3/include/bits/hashtable.h index 475cda6cac5..0d19f1cf155 100644 --- a/libstdc++-v3/include/bits/hashtable.h +++ b/libstdc++-v3/include/bits/hashtable.h @@ -1368,12 +1368,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { clear(); _M_deallocate_buckets(); - - static_assert(__is_invocable<const _H1&, const _Key&>{}, - "hash function must be invocable with an argument of key type"); - static_assert(__is_invocable<const _Equal&, const _Key&, const _Key&>{}, - "key equality predicate must be invocable with two arguments of " - "key type"); } template<typename _Key, typename _Value, diff --git a/libstdc++-v3/include/bits/hashtable_policy.h b/libstdc++-v3/include/bits/hashtable_policy.h index 3ff6b14a90f..aa192a9656d 100644 --- a/libstdc++-v3/include/bits/hashtable_policy.h +++ b/libstdc++-v3/include/bits/hashtable_policy.h @@ -1296,7 +1296,11 @@ namespace __detail __hash_code _M_hash_code(const _Key& __k) const - { return _M_h1()(__k); } + { + static_assert(__is_invocable<const _H1&, const _Key&>{}, + "hash function must be invocable with an argument of key type"); + return _M_h1()(__k); + } std::size_t _M_bucket_index(const _Key&, __hash_code __c, std::size_t __n) const @@ -1384,7 +1388,11 @@ namespace __detail __hash_code _M_hash_code(const _Key& __k) const - { return _M_h1()(__k); } + { + static_assert(__is_invocable<const _H1&, const _Key&>{}, + "hash function must be invocable with an argument of key type"); + return _M_h1()(__k); + } std::size_t _M_bucket_index(const _Key&, __hash_code __c, @@ -1830,6 +1838,9 @@ namespace __detail bool _M_equals(const _Key& __k, __hash_code __c, __node_type* __n) const { + static_assert(__is_invocable<const _Equal&, const _Key&, const _Key&>{}, + "key equality predicate must be invocable with two arguments of " + "key type"); return _EqualHelper::_S_equals(_M_eq(), this->_M_extract(), __k, __c, __n); } diff --git a/libstdc++-v3/include/bits/stl_tree.h b/libstdc++-v3/include/bits/stl_tree.h index fd96a63593a..3d4c090886b 100644 --- a/libstdc++-v3/include/bits/stl_tree.h +++ b/libstdc++-v3/include/bits/stl_tree.h @@ -762,7 +762,25 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION static const _Key& _S_key(_Const_Link_type __x) - { return _KeyOfValue()(_S_value(__x)); } + { +#if __cplusplus >= 201103L + // If we're asking for the key we're presumably using the comparison + // object, and so this is a good place to sanity check it. + static_assert(__is_invocable<_Compare&, const _Key&, const _Key&>{}, + "comparison object must be invocable " + "with two arguments of key type"); +# if __cplusplus >= 201703L + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2542. Missing const requirements for associative containers + if constexpr (__is_invocable<_Compare&, const _Key&, const _Key&>{}) + static_assert( + is_invocable_v<const _Compare&, const _Key&, const _Key&>, + "comparison object must be invocable as const"); +# endif // C++17 +#endif // C++11 + + return _KeyOfValue()(*__x->_M_valptr()); + } static _Link_type _S_left(_Base_ptr __x) _GLIBCXX_NOEXCEPT @@ -786,7 +804,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION static const _Key& _S_key(_Const_Base_ptr __x) - { return _KeyOfValue()(_S_value(__x)); } + { return _S_key(static_cast<_Const_Link_type>(__x)); } static _Base_ptr _S_minimum(_Base_ptr __x) _GLIBCXX_NOEXCEPT @@ -951,21 +969,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION #endif ~_Rb_tree() _GLIBCXX_NOEXCEPT - { - _M_erase(_M_begin()); - -#if __cplusplus >= 201103L - static_assert(__is_invocable<_Compare&, const _Key&, const _Key&>{}, - "comparison object must be invocable " - "with two arguments of key type"); -# if __cplusplus >= 201703L - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 2542. Missing const requirements for associative containers - static_assert(is_invocable_v<const _Compare&, const _Key&, const _Key&>, - "comparison object must be invocable as const"); -# endif // C++17 -#endif // C++11 - } + { _M_erase(_M_begin()); } _Rb_tree& operator=(const _Rb_tree& __x); diff --git a/libstdc++-v3/testsuite/23_containers/map/48101_neg.cc b/libstdc++-v3/testsuite/23_containers/map/48101_neg.cc index 9a63a0aa3c7..7e8c800c79e 100644 --- a/libstdc++-v3/testsuite/23_containers/map/48101_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/map/48101_neg.cc @@ -24,9 +24,13 @@ void test01() { std::map<int, int, std::less<int*>> c; + c.find(1); // { dg-error "here" } std::map<int, int, std::allocator<int>> c2; + c2.find(2); // { dg-error "here" } } // { dg-error "_Compare = std::less<int.>" "" { target *-*-* } 0 } // { dg-error "_Compare = std::allocator<int>" "" { target *-*-* } 0 } // { dg-error "comparison object must be invocable" "" { target *-*-* } 0 } +// { dg-prune-output "no match for call" } +// { dg-prune-output "invalid conversion" } diff --git a/libstdc++-v3/testsuite/23_containers/multimap/48101_neg.cc b/libstdc++-v3/testsuite/23_containers/multimap/48101_neg.cc index 5b5f75d6d8c..100cd18927a 100644 --- a/libstdc++-v3/testsuite/23_containers/multimap/48101_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/multimap/48101_neg.cc @@ -24,9 +24,13 @@ void test01() { std::multimap<int, int, std::less<int*>> c; + c.find(1); // { dg-error "here" } std::multimap<int, int, std::allocator<int>> c2; + c2.find(2); // { dg-error "here" } } // { dg-error "_Compare = std::less<int.>" "" { target *-*-* } 0 } // { dg-error "_Compare = std::allocator<int>" "" { target *-*-* } 0 } // { dg-error "comparison object must be invocable" "" { target *-*-* } 0 } +// { dg-prune-output "no match for call" } +// { dg-prune-output "invalid conversion" } diff --git a/libstdc++-v3/testsuite/23_containers/multiset/48101_neg.cc b/libstdc++-v3/testsuite/23_containers/multiset/48101_neg.cc index b8f92b89bc0..a6e271f2ab0 100644 --- a/libstdc++-v3/testsuite/23_containers/multiset/48101_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/multiset/48101_neg.cc @@ -24,8 +24,11 @@ test01() { std::multiset<const int> c; // { dg-error "here" } std::multiset<int, std::less<long*>> c2; + c2.find(2); // { dg-error "here" } } // { dg-error "non-const, non-volatile value_type" "" { target *-*-* } 0 } // { dg-error "comparison object must be invocable" "" { target *-*-* } 0 } // { dg-prune-output "std::allocator<.* has no member named " } +// { dg-prune-output "no match for call" } +// { dg-prune-output "invalid conversion" } diff --git a/libstdc++-v3/testsuite/23_containers/set/48101_neg.cc b/libstdc++-v3/testsuite/23_containers/set/48101_neg.cc index c70c1779a76..21a7dc07703 100644 --- a/libstdc++-v3/testsuite/23_containers/set/48101_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/set/48101_neg.cc @@ -24,8 +24,11 @@ test01() { std::set<const int> c; // { dg-error "here" } std::set<int, std::less<long*>> c2; + c2.find(2); // { dg-error "here" } } // { dg-error "non-const, non-volatile value_type" "" { target *-*-* } 0 } // { dg-error "comparison object must be invocable" "" { target *-*-* } 0 } // { dg-prune-output "std::allocator<.* has no member named " } +// { dg-prune-output "no match for call" } +// { dg-prune-output "invalid conversion" } diff --git a/libstdc++-v3/testsuite/23_containers/set/85965.cc b/libstdc++-v3/testsuite/23_containers/set/85965.cc index 54d501f6c4f..7d8f2167519 100644 --- a/libstdc++-v3/testsuite/23_containers/set/85965.cc +++ b/libstdc++-v3/testsuite/23_containers/set/85965.cc @@ -27,3 +27,12 @@ struct Foo // PR libstdc++/85965 std::set<Derived*, std::less<Base*>> s; }; + +std::size_t +test01(std::set<Derived*, std::less<Base*>> s) +{ + // these operations should not require the comparison object + auto copy = s; + copy = s; + return s.size(); +} diff --git a/libstdc++-v3/testsuite/23_containers/unordered_map/48101_neg.cc b/libstdc++-v3/testsuite/23_containers/unordered_map/48101_neg.cc index 17a7c88cddf..e49be995cb9 100644 --- a/libstdc++-v3/testsuite/23_containers/unordered_map/48101_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/unordered_map/48101_neg.cc @@ -24,8 +24,10 @@ test01() { using namespace std; unordered_map<int, int, equal_to<int>, hash<int>> c2; + c2.find(2); // { dg-error "here" } } // { dg-error "hash function must be invocable" "" { target *-*-* } 0 } // { dg-error "key equality predicate must be invocable" "" { target *-*-* } 0 } // { dg-prune-output "use of deleted function" } +// { dg-prune-output "no match for call" } diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multimap/48101_neg.cc b/libstdc++-v3/testsuite/23_containers/unordered_multimap/48101_neg.cc index 309e43f71d6..85252f2b724 100644 --- a/libstdc++-v3/testsuite/23_containers/unordered_multimap/48101_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/unordered_multimap/48101_neg.cc @@ -24,8 +24,10 @@ test01() { using namespace std; unordered_multimap<int, int, equal_to<int>, hash<int>> c2; + c2.find(2); // { dg-error "here" } } // { dg-error "hash function must be invocable" "" { target *-*-* } 0 } // { dg-error "key equality predicate must be invocable" "" { target *-*-* } 0 } // { dg-prune-output "use of deleted function" } +// { dg-prune-output "no match for call" } diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multiset/48101_neg.cc b/libstdc++-v3/testsuite/23_containers/unordered_multiset/48101_neg.cc index 223a8ebbf61..305a38999f0 100644 --- a/libstdc++-v3/testsuite/23_containers/unordered_multiset/48101_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/unordered_multiset/48101_neg.cc @@ -25,9 +25,11 @@ test01() using namespace std; unordered_multiset<const int, hash<int>> c; // { dg-error "here" } unordered_multiset<int, equal_to<int>, hash<int>> c2; + c2.find(2); // { dg-error "here" } } // { dg-error "non-const, non-volatile value_type" "" { target *-*-* } 0 } // { dg-error "hash function must be invocable" "" { target *-*-* } 0 } // { dg-error "key equality predicate must be invocable" "" { target *-*-* } 0 } // { dg-prune-output "use of deleted function" } +// { dg-prune-output "no match for call" } diff --git a/libstdc++-v3/testsuite/23_containers/unordered_set/48101_neg.cc b/libstdc++-v3/testsuite/23_containers/unordered_set/48101_neg.cc index 1a10286bb2b..9b0016c5adc 100644 --- a/libstdc++-v3/testsuite/23_containers/unordered_set/48101_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/unordered_set/48101_neg.cc @@ -25,9 +25,11 @@ test01() using namespace std; unordered_set<const int, hash<int>> c; // { dg-error "here" } unordered_set<int, equal_to<int>, hash<int>> c2; + c2.find(2); // { dg-error "here" } } // { dg-error "non-const, non-volatile value_type" "" { target *-*-* } 0 } // { dg-error "hash function must be invocable" "" { target *-*-* } 0 } // { dg-error "key equality predicate must be invocable" "" { target *-*-* } 0 } // { dg-prune-output "use of deleted function" } +// { dg-prune-output "no match for call" } diff --git a/libstdc++-v3/testsuite/23_containers/unordered_set/85965.cc b/libstdc++-v3/testsuite/23_containers/unordered_set/85965.cc index 8b90b369901..8c48fa2a978 100644 --- a/libstdc++-v3/testsuite/23_containers/unordered_set/85965.cc +++ b/libstdc++-v3/testsuite/23_containers/unordered_set/85965.cc @@ -27,3 +27,12 @@ struct Foo // PR libstdc++/85965 std::unordered_set<Derived*, std::equal_to<Base*>, std::hash<Base*>> u; }; + +std::size_t +test01(std::unordered_set<Derived*, std::equal_to<Base*>, std::hash<Base*>> s) +{ + // these operations should not require the comparison object + auto copy = s; + copy = s; + return s.size(); +} -- cgit v1.2.3 From f6d32fc80ec578503f81f24a4d90a3e8884ec737 Mon Sep 17 00:00:00 2001 From: Richard Biener <rguenther@suse.de> Date: Fri, 30 Aug 2019 13:19:23 +0000 Subject: 2019-08-30 Richard Biener <rguenther@suse.de> Backport from mainline 2019-01-07 Richard Sandiford <richard.sandiford@arm.com> PR middle-end/88567 * tree-vect-loop.c (get_initial_defs_for_reduction): Pass the output vector directly to duplicate_and_interleave instead of going through a temporary. Postpone insertion of ctor_seq to the end of the loop. 2018-12-04 Richard Biener <rguenther@suse.de> PR tree-optimization/88315 * tree-vect-loop.c (get_initial_defs_for_reduction): Simplify and fix initialization vector for SAD and DOT_PROD SLP reductions. * gcc.dg/vect/slp-reduc-sad.c: Adjust to provide non-trivial initial value. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@275168 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 17 +++ gcc/testsuite/ChangeLog | 9 ++ gcc/testsuite/gcc.dg/vect/slp-reduc-sad.c | 4 +- gcc/tree-vect-loop.c | 171 +++++++++++------------------- 4 files changed, 91 insertions(+), 110 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f2cd00c663b..19ed92d4951 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,20 @@ +2019-08-30 Richard Biener <rguenther@suse.de> + + Backport from mainline + 2019-01-07 Richard Sandiford <richard.sandiford@arm.com> + + PR middle-end/88567 + * tree-vect-loop.c (get_initial_defs_for_reduction): Pass the + output vector directly to duplicate_and_interleave instead of + going through a temporary. Postpone insertion of ctor_seq to + the end of the loop. + + 2018-12-04 Richard Biener <rguenther@suse.de> + + PR tree-optimization/88315 + * tree-vect-loop.c (get_initial_defs_for_reduction): Simplify + and fix initialization vector for SAD and DOT_PROD SLP reductions. + 2019-08-30 Richard Biener <rguenther@suse.de> Backport from mainline diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 6a765d3c5d7..2fc926e1204 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,12 @@ +2019-08-30 Richard Biener <rguenther@suse.de> + + Backport from mainline + 2018-12-04 Richard Biener <rguenther@suse.de> + + PR tree-optimization/88315 + * gcc.dg/vect/slp-reduc-sad.c: Adjust to provide non-trivial + initial value. + 2019-08-30 Richard Biener <rguenther@suse.de> Backport from mainline diff --git a/gcc/testsuite/gcc.dg/vect/slp-reduc-sad.c b/gcc/testsuite/gcc.dg/vect/slp-reduc-sad.c index d921c7cd65d..5f7a3e09f60 100644 --- a/gcc/testsuite/gcc.dg/vect/slp-reduc-sad.c +++ b/gcc/testsuite/gcc.dg/vect/slp-reduc-sad.c @@ -12,7 +12,7 @@ extern void abort (void); int __attribute__((noinline,noclone)) foo (uint8_t *pix1, uint8_t *pix2, int i_stride_pix2) { - int i_sum = 0; + int i_sum = 5; for( int y = 0; y < 16; y++ ) { i_sum += abs ( pix1[0] - pix2[0] ); @@ -52,7 +52,7 @@ main () __asm__ volatile (""); } - if (foo (X, Y, 16) != 32512) + if (foo (X, Y, 16) != 32512 + 5) abort (); return 0; diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c index c74a485cc2f..e50dca91b63 100644 --- a/gcc/tree-vect-loop.c +++ b/gcc/tree-vect-loop.c @@ -4551,14 +4551,9 @@ get_initial_defs_for_reduction (slp_tree slp_node, unsigned HOST_WIDE_INT nunits; unsigned j, number_of_places_left_in_vector; tree vector_type; - tree vop; - int group_size = stmts.length (); - unsigned int vec_num, i; - unsigned number_of_copies = 1; - vec<tree> voprnds; - voprnds.create (number_of_vectors); + unsigned int group_size = stmts.length (); + unsigned int i; struct loop *loop; - auto_vec<tree, 16> permute_results; vector_type = STMT_VINFO_VECTYPE (stmt_vinfo); @@ -4589,119 +4584,79 @@ get_initial_defs_for_reduction (slp_tree slp_node, if (!TYPE_VECTOR_SUBPARTS (vector_type).is_constant (&nunits)) nunits = group_size; - number_of_copies = nunits * number_of_vectors / group_size; - number_of_places_left_in_vector = nunits; bool constant_p = true; tree_vector_builder elts (vector_type, nunits, 1); elts.quick_grow (nunits); - for (j = 0; j < number_of_copies; j++) + gimple_seq ctor_seq = NULL; + for (j = 0; j < nunits * number_of_vectors; ++j) { - for (i = group_size - 1; stmts.iterate (i, &stmt); i--) - { - tree op; - /* Get the def before the loop. In reduction chain we have only - one initial value. */ - if ((j != (number_of_copies - 1) - || (reduc_chain && i != 0)) - && neutral_op) - op = neutral_op; - else - op = PHI_ARG_DEF_FROM_EDGE (stmt, pe); + tree op; + i = j % group_size; + stmt_vinfo = vinfo_for_stmt (stmts[i]); - /* Create 'vect_ = {op0,op1,...,opn}'. */ - number_of_places_left_in_vector--; - elts[number_of_places_left_in_vector] = op; - if (!CONSTANT_CLASS_P (op)) - constant_p = false; + /* Get the def before the loop. In reduction chain we have only + one initial value. Else we have as many as PHIs in the group. */ + if (reduc_chain) + op = j != 0 ? neutral_op : PHI_ARG_DEF_FROM_EDGE (stmt_vinfo->stmt, pe); + else if (((vec_oprnds->length () + 1) * nunits + - number_of_places_left_in_vector >= group_size) + && neutral_op) + op = neutral_op; + else + op = PHI_ARG_DEF_FROM_EDGE (stmt_vinfo->stmt, pe); - if (number_of_places_left_in_vector == 0) - { - gimple_seq ctor_seq = NULL; - tree init; - if (constant_p && !neutral_op - ? multiple_p (TYPE_VECTOR_SUBPARTS (vector_type), nunits) - : known_eq (TYPE_VECTOR_SUBPARTS (vector_type), nunits)) - /* Build the vector directly from ELTS. */ - init = gimple_build_vector (&ctor_seq, &elts); - else if (neutral_op) - { - /* Build a vector of the neutral value and shift the - other elements into place. */ - init = gimple_build_vector_from_val (&ctor_seq, vector_type, - neutral_op); - int k = nunits; - while (k > 0 && elts[k - 1] == neutral_op) - k -= 1; - while (k > 0) - { - k -= 1; - gcall *call = gimple_build_call_internal - (IFN_VEC_SHL_INSERT, 2, init, elts[k]); - init = make_ssa_name (vector_type); - gimple_call_set_lhs (call, init); - gimple_seq_add_stmt (&ctor_seq, call); - } - } - else + /* Create 'vect_ = {op0,op1,...,opn}'. */ + number_of_places_left_in_vector--; + elts[nunits - number_of_places_left_in_vector - 1] = op; + if (!CONSTANT_CLASS_P (op)) + constant_p = false; + + if (number_of_places_left_in_vector == 0) + { + tree init; + if (constant_p && !neutral_op + ? multiple_p (TYPE_VECTOR_SUBPARTS (vector_type), nunits) + : known_eq (TYPE_VECTOR_SUBPARTS (vector_type), nunits)) + /* Build the vector directly from ELTS. */ + init = gimple_build_vector (&ctor_seq, &elts); + else if (neutral_op) + { + /* Build a vector of the neutral value and shift the + other elements into place. */ + init = gimple_build_vector_from_val (&ctor_seq, vector_type, + neutral_op); + int k = nunits; + while (k > 0 && elts[k - 1] == neutral_op) + k -= 1; + while (k > 0) { - /* First time round, duplicate ELTS to fill the - required number of vectors, then cherry pick the - appropriate result for each iteration. */ - if (vec_oprnds->is_empty ()) - duplicate_and_interleave (&ctor_seq, vector_type, elts, - number_of_vectors, - permute_results); - init = permute_results[number_of_vectors - j - 1]; + k -= 1; + gcall *call = gimple_build_call_internal + (IFN_VEC_SHL_INSERT, 2, init, elts[k]); + init = make_ssa_name (vector_type); + gimple_call_set_lhs (call, init); + gimple_seq_add_stmt (&ctor_seq, call); } - if (ctor_seq != NULL) - gsi_insert_seq_on_edge_immediate (pe, ctor_seq); - voprnds.quick_push (init); - - number_of_places_left_in_vector = nunits; - elts.new_vector (vector_type, nunits, 1); - elts.quick_grow (nunits); - constant_p = true; - } - } - } - - /* Since the vectors are created in the reverse order, we should invert - them. */ - vec_num = voprnds.length (); - for (j = vec_num; j != 0; j--) - { - vop = voprnds[j - 1]; - vec_oprnds->quick_push (vop); - } - - voprnds.release (); - - /* In case that VF is greater than the unrolling factor needed for the SLP - group of stmts, NUMBER_OF_VECTORS to be created is greater than - NUMBER_OF_SCALARS/NUNITS or NUNITS/NUMBER_OF_SCALARS, and hence we have - to replicate the vectors. */ - tree neutral_vec = NULL; - while (number_of_vectors > vec_oprnds->length ()) - { - if (neutral_op) - { - if (!neutral_vec) + } + else { - gimple_seq ctor_seq = NULL; - neutral_vec = gimple_build_vector_from_val - (&ctor_seq, vector_type, neutral_op); - if (ctor_seq != NULL) - gsi_insert_seq_on_edge_immediate (pe, ctor_seq); + /* First time round, duplicate ELTS to fill the + required number of vectors. */ + duplicate_and_interleave (&ctor_seq, vector_type, elts, + number_of_vectors, *vec_oprnds); + break; } - vec_oprnds->quick_push (neutral_vec); - } - else - { - for (i = 0; vec_oprnds->iterate (i, &vop) && i < vec_num; i++) - vec_oprnds->quick_push (vop); - } + vec_oprnds->quick_push (init); + + number_of_places_left_in_vector = nunits; + elts.new_vector (vector_type, nunits, 1); + elts.quick_grow (nunits); + constant_p = true; + } } + if (ctor_seq != NULL) + gsi_insert_seq_on_edge_immediate (pe, ctor_seq); } -- cgit v1.2.3 From 7d638f103e6c348d824f0a788d6673611f084c9f Mon Sep 17 00:00:00 2001 From: Jonathan Wakely <jwakely@redhat.com> Date: Fri, 30 Aug 2019 13:49:48 +0000 Subject: Fix uses of non-reserved names for template parameters Backport from mainline 2019-05-17 Jonathan Wakely <jwakely@redhat.com> * include/bits/random.h (seed_seq::param): Fix non-reserved name. * include/experimental/type_traits (is_detected_exact) (is_detected_exact_v): Likewise. * include/pstl/execution_defs.h (is_execution_policy) (is_execution_policy_v, __enable_if_execution_policy): Likewise. * include/pstl/execution_impl.h (__policy_traits): Likewise. * testsuite/17_intro/names.cc: Check for more non-reserved names. * testsuite/experimental/names.cc: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@275171 138bc75d-0d04-0410-961f-82ee72b054a4 --- libstdc++-v3/ChangeLog | 11 ++++ libstdc++-v3/include/bits/random.h | 4 +- libstdc++-v3/include/experimental/type_traits | 8 +-- libstdc++-v3/testsuite/17_intro/names.cc | 78 ++++++++++++++++++++++++++- libstdc++-v3/testsuite/experimental/names.cc | 57 ++++++++++++++++++++ 5 files changed, 151 insertions(+), 7 deletions(-) create mode 100644 libstdc++-v3/testsuite/experimental/names.cc diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 94893a0c08c..253c85bf012 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,14 @@ +2019-08-30 Jonathan Wakely <jwakely@redhat.com> + + Backport from mainline + 2019-05-17 Jonathan Wakely <jwakely@redhat.com> + + * include/bits/random.h (seed_seq::param): Fix non-reserved name. + * include/experimental/type_traits (is_detected_exact) + (is_detected_exact_v): Likewise. + * testsuite/17_intro/names.cc: Check for more non-reserved names. + * testsuite/experimental/names.cc: New test. + 2019-08-30 Jonathan Wakely <jwakely@redhat.com> Backport from mainline diff --git a/libstdc++-v3/include/bits/random.h b/libstdc++-v3/include/bits/random.h index f812bbf18b1..c776dc62d21 100644 --- a/libstdc++-v3/include/bits/random.h +++ b/libstdc++-v3/include/bits/random.h @@ -5982,9 +5982,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION size_t size() const noexcept { return _M_v.size(); } - template<typename OutputIterator> + template<typename _OutputIterator> void - param(OutputIterator __dest) const + param(_OutputIterator __dest) const { std::copy(_M_v.begin(), _M_v.end(), __dest); } // no copy functions diff --git a/libstdc++-v3/include/experimental/type_traits b/libstdc++-v3/include/experimental/type_traits index eb5c3c5a7ee..26a7c8d1383 100644 --- a/libstdc++-v3/include/experimental/type_traits +++ b/libstdc++-v3/include/experimental/type_traits @@ -251,12 +251,12 @@ template<typename _Default, template<typename...> class _Op, typename... _Args> template<typename _Default, template<typename...> class _Op, typename... _Args> using detected_or_t = typename detected_or<_Default, _Op, _Args...>::type; -template<typename Expected, template<typename...> class _Op, typename... _Args> - using is_detected_exact = is_same<Expected, detected_t<_Op, _Args...>>; +template<typename _Expected, template<typename...> class _Op, typename... _Args> + using is_detected_exact = is_same<_Expected, detected_t<_Op, _Args...>>; -template<typename Expected, template<typename...> class _Op, typename... _Args> +template<typename _Expected, template<typename...> class _Op, typename... _Args> constexpr bool is_detected_exact_v - = is_detected_exact<Expected, _Op, _Args...>::value; + = is_detected_exact<_Expected, _Op, _Args...>::value; template<typename _To, template<typename...> class _Op, typename... _Args> using is_detected_convertible diff --git a/libstdc++-v3/testsuite/17_intro/names.cc b/libstdc++-v3/testsuite/17_intro/names.cc index 4e6cff1fe37..b29be74b2ed 100644 --- a/libstdc++-v3/testsuite/17_intro/names.cc +++ b/libstdc++-v3/testsuite/17_intro/names.cc @@ -19,7 +19,6 @@ // Define macros for some common variables names that we must not use for // naming variables, parameters etc. in the library. -#define tmp ( #define A ( #define B ( #define C ( @@ -99,6 +98,78 @@ #define y ( #define z ( +#define tmp ( + +#if __cplusplus < 201703L +// <charconv> defines to_chars_result::ptr and to_chars_result::ec +#define ec ( +#define ptr ( +#endif + +// Common template parameter names +#define OutputIterator OutputIterator is not a reserved name +#define InputIterator InputIterator is not a reserved name +#define ForwardIterator ForwardIterator is not a reserved name +#define BidirectionalIterator BidirectionalIterator is not a reserved name +#define RandomAccessIterator RandomAccessIterator is not a reserved name +#define RandomAccessOutputIterator RandomAccessOutputIterator is not a reserved name +#define RAIter RAIter is not a reserved name +#define FwdIter FwdIter is not a reserved name +#define OutIter OutIter is not a reserved name +#define InIter InIter is not a reserved name + +#define Alloc Alloc is not a reserved name +#define BinaryFunction1 BinaryFunction1 is not a reserved name +#define BinaryFunction2 BinaryFunction2 is not a reserved name +#define Char Char is not a reserved name +#define CharT CharT is not a reserved name +#define Cmp Cmp is not a reserved name +#define Compare Compare is not a reserved name +#define Const_Iterator Const_Iterator is not a reserved name +#define Const_Key_Reference Const_Key_Reference is not a reserved name +#define Const_Node_Iter Const_Node_Iter is not a reserved name +#define Const_Pointer Const_Pointer is not a reserved name +#define Const_Reference Const_Reference is not a reserved name +#define Data Data is not a reserved name +#define DiffType DiffType is not a reserved name +#define Eq Eq is not a reserved name +#define ExecPolicy ExecPolicy is not a reserved name +#define Expected Expected is not a reserved name +#define External_Load_Access External_Load_Access is not a reserved name +#define External_Size_Access External_Size_Access is not a reserved name +#define Fn Fn is not a reserved name +#define Function Function is not a reserved name +#define Functor Functor is not a reserved name +#define Hash Hash is not a reserved name +#define H1 H1 is not a reserved name +#define H2 H2 is not a reserved name +#define Head Head is not a reserved name +#define It It is not a reserved name +#define Iter Iter is not a reserved name +#define Iterator Iterator is not a reserved name +#define Key Key is not a reserved name +#define Mapped Mapped is not a reserved name +#define Node Node is not a reserved name +#define Node_iter Node_iter is not a reserved name +#define Node_ptr Node_ptr is not a reserved name +#define Overflow Overflow is not a reserved name +#define Pointer Pointer is not a reserved name +#define Policy Policy is not a reserved name +#define Pred Pred is not a reserved name +#define Ptr Ptr is not a reserved name +#define Reference Reference is not a reserved name +#define Seq Seq is not a reserved name +#define Seq_RAIter Seq_RAIter is not a reserved name +#define Series Series is not a reserved name +#define Set Set is not a reserved name +#define String String is not a reserved name +#define Tp Tp is not a reserved name +#define Traits Traits is not a reserved name +#define Type Type is not a reserved name +#define Value Value is not a reserved name +#define ValueT ValueT is not a reserved name +#define ValueType ValueType is not a reserved name + #ifdef _AIX // See https://gcc.gnu.org/ml/libstdc++/2017-03/msg00015.html #undef f @@ -116,4 +187,9 @@ #undef y #endif +#ifdef __sun__ +// See https://gcc.gnu.org/ml/libstdc++/2019-05/msg00175.html +#undef ptr +#endif + #include <bits/stdc++.h> diff --git a/libstdc++-v3/testsuite/experimental/names.cc b/libstdc++-v3/testsuite/experimental/names.cc new file mode 100644 index 00000000000..1d2e7c0af22 --- /dev/null +++ b/libstdc++-v3/testsuite/experimental/names.cc @@ -0,0 +1,57 @@ +// Copyright (C) 2017-2019 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-do compile } + +// Define macros for some common variables names that we must not use for +// naming variables, parameters etc. in the library. + +#include "../17_intro/names.cc" +// Filesystem +#if __has_include(<experimental/filesystem>) +# include <experimental/filesystem> +#endif +// Library Fundamentals +#include <experimental/algorithm> +#include <experimental/any> +#include <experimental/array> +#include <experimental/chrono> +#include <experimental/deque> +#include <experimental/forward_list> +#include <experimental/functional> +#include <experimental/iterator> +#include <experimental/list> +#include <experimental/map> +#include <experimental/memory> +#include <experimental/memory_resource> +#include <experimental/numeric> +#include <experimental/optional> +#include <experimental/propagate_const> +#include <experimental/random> +#include <experimental/ratio> +#include <experimental/regex> +#include <experimental/set> +#include <experimental/source_location> +#include <experimental/string> +#include <experimental/string_view> +#include <experimental/system_error> +#include <experimental/tuple> +#include <experimental/type_traits> +#include <experimental/unordered_map> +#include <experimental/unordered_set> +#include <experimental/utility> +#include <experimental/vector> -- cgit v1.2.3 From 128c1e7f1a1a8bc85dd5d97421ee298751e95ab4 Mon Sep 17 00:00:00 2001 From: Jonathan Wakely <jwakely@redhat.com> Date: Fri, 30 Aug 2019 13:50:01 +0000 Subject: PR libstdc++/90770 fix missing src/debug/Makefile Backport from mainline 2019-06-07 Jonathan Wakely <jwakely@redhat.com> PR libstdc++/90770 * src/Makefile.am (stamp-debug): Also test for missing makefile. * src/Makefile.in: Regenerate. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@275172 138bc75d-0d04-0410-961f-82ee72b054a4 --- libstdc++-v3/ChangeLog | 9 +++++++++ libstdc++-v3/src/Makefile.am | 2 +- libstdc++-v3/src/Makefile.in | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 253c85bf012..9924bea3edf 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,12 @@ +2019-08-30 Jonathan Wakely <jwakely@redhat.com> + + Backport from mainline + 2019-06-07 Jonathan Wakely <jwakely@redhat.com> + + PR libstdc++/90770 + * src/Makefile.am (stamp-debug): Also test for missing makefile. + * src/Makefile.in: Regenerate. + 2019-08-30 Jonathan Wakely <jwakely@redhat.com> Backport from mainline diff --git a/libstdc++-v3/src/Makefile.am b/libstdc++-v3/src/Makefile.am index ba30dde8fec..f18932c9a6a 100644 --- a/libstdc++-v3/src/Makefile.am +++ b/libstdc++-v3/src/Makefile.am @@ -321,7 +321,7 @@ endif # Take care to fix all possibly-relative paths. debugdir = ${glibcxx_builddir}/src/debug stamp-debug: - if test ! -d ${debugdir}; then \ + if test ! -d ${debugdir} || test ! -f ${debugdir}/Makefile ; then \ mkdir -p ${debugdir}; \ for d in $(SUBDIRS); do mkdir -p ${debugdir}/$$d; done; \ (cd ${debugdir}; \ diff --git a/libstdc++-v3/src/Makefile.in b/libstdc++-v3/src/Makefile.in index 70521750388..92b0704ecc0 100644 --- a/libstdc++-v3/src/Makefile.in +++ b/libstdc++-v3/src/Makefile.in @@ -994,7 +994,7 @@ libstdc++convenience.la: $(toolexeclib_LTLIBRARIES) fi; \ echo `date` > stamp-libstdc++convenience; stamp-debug: - if test ! -d ${debugdir}; then \ + if test ! -d ${debugdir} || test ! -f ${debugdir}/Makefile ; then \ mkdir -p ${debugdir}; \ for d in $(SUBDIRS); do mkdir -p ${debugdir}/$$d; done; \ (cd ${debugdir}; \ -- cgit v1.2.3 From 6efe4b4313193b9a9065d5bde45e075b054323df Mon Sep 17 00:00:00 2001 From: Jonathan Wakely <jwakely@redhat.com> Date: Fri, 30 Aug 2019 13:50:05 +0000 Subject: Avoid -Wconversion warnings when -Wsystem-headers is used Backport from mainline 2019-03-22 Jonathan Wakely <jwakely@redhat.com> * include/bits/stl_algobase.h (__lg): Do arithmetic on type int to avoid -Wconversion warnings. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@275173 138bc75d-0d04-0410-961f-82ee72b054a4 --- libstdc++-v3/ChangeLog | 8 ++++++++ libstdc++-v3/include/bits/stl_algobase.h | 12 ++++++------ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 9924bea3edf..eaa96a68afd 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,11 @@ +2019-08-30 Jonathan Wakely <jwakely@redhat.com> + + Backport from mainline + 2019-03-22 Jonathan Wakely <jwakely@redhat.com> + + * include/bits/stl_algobase.h (__lg): Do arithmetic on type int to + avoid -Wconversion warnings. + 2019-08-30 Jonathan Wakely <jwakely@redhat.com> Backport from mainline diff --git a/libstdc++-v3/include/bits/stl_algobase.h b/libstdc++-v3/include/bits/stl_algobase.h index 1fcd7dba34d..a8ea52cd65b 100644 --- a/libstdc++-v3/include/bits/stl_algobase.h +++ b/libstdc++-v3/include/bits/stl_algobase.h @@ -998,27 +998,27 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION // Precondition: __n > 0. inline _GLIBCXX_CONSTEXPR int __lg(int __n) - { return sizeof(int) * __CHAR_BIT__ - 1 - __builtin_clz(__n); } + { return (int)sizeof(int) * __CHAR_BIT__ - 1 - __builtin_clz(__n); } inline _GLIBCXX_CONSTEXPR unsigned __lg(unsigned __n) - { return sizeof(int) * __CHAR_BIT__ - 1 - __builtin_clz(__n); } + { return (int)sizeof(int) * __CHAR_BIT__ - 1 - __builtin_clz(__n); } inline _GLIBCXX_CONSTEXPR long __lg(long __n) - { return sizeof(long) * __CHAR_BIT__ - 1 - __builtin_clzl(__n); } + { return (int)sizeof(long) * __CHAR_BIT__ - 1 - __builtin_clzl(__n); } inline _GLIBCXX_CONSTEXPR unsigned long __lg(unsigned long __n) - { return sizeof(long) * __CHAR_BIT__ - 1 - __builtin_clzl(__n); } + { return (int)sizeof(long) * __CHAR_BIT__ - 1 - __builtin_clzl(__n); } inline _GLIBCXX_CONSTEXPR long long __lg(long long __n) - { return sizeof(long long) * __CHAR_BIT__ - 1 - __builtin_clzll(__n); } + { return (int)sizeof(long long) * __CHAR_BIT__ - 1 - __builtin_clzll(__n); } inline _GLIBCXX_CONSTEXPR unsigned long long __lg(unsigned long long __n) - { return sizeof(long long) * __CHAR_BIT__ - 1 - __builtin_clzll(__n); } + { return (int)sizeof(long long) * __CHAR_BIT__ - 1 - __builtin_clzll(__n); } _GLIBCXX_BEGIN_NAMESPACE_ALGO -- cgit v1.2.3 From 760e77aa7774540464f8fda43b831a2fe3a75194 Mon Sep 17 00:00:00 2001 From: Segher Boessenkool <segher@kernel.crashing.org> Date: Fri, 30 Aug 2019 14:13:51 +0000 Subject: Backport from trunk 2019-08-22 Segher Boessenkool <segher@kernel.crashing.org> * config/rs6000/altivec.md (unspec): Delete UNSPEC_DARN, UNSPEC_DARN_32, UNSPEC_DARN_RAW, UNSPEC_CMPRB, UNSPEC_CMPRB2, UNSPEC_CMPEQB; move to... * config/rs6000/rs6000.md (unspec): ... here. * config/rs6000/altivec.md (darn_32, darn_raw, darn, cmprb, *cmprb_internal, setb_signed, setb_unsigned, cmprb2, *cmprb2_internal, cmpeqb, *cmpeqb_internal): Delete, move to... * config/rs6000/rs6000.md (darn_32, darn_raw, darn, cmprb, *cmprb_internal, setb_signed, setb_unsigned, cmprb2, *cmprb2_internal, cmpeqb, *cmpeqb_internal): ... here. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@275180 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 15 +++ gcc/config/rs6000/altivec.md | 223 ------------------------------------------ gcc/config/rs6000/rs6000.md | 224 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 239 insertions(+), 223 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 19ed92d4951..ea7da292fb4 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,18 @@ +2019-08-30 Segher Boessenkool <segher@kernel.crashing.org> + + Backport from trunk + 2019-08-22 Segher Boessenkool <segher@kernel.crashing.org> + + * config/rs6000/altivec.md (unspec): Delete UNSPEC_DARN, UNSPEC_DARN_32, + UNSPEC_DARN_RAW, UNSPEC_CMPRB, UNSPEC_CMPRB2, UNSPEC_CMPEQB; move to... + * config/rs6000/rs6000.md (unspec): ... here. + * config/rs6000/altivec.md (darn_32, darn_raw, darn, cmprb, + *cmprb_internal, setb_signed, setb_unsigned, cmprb2, *cmprb2_internal, + cmpeqb, *cmpeqb_internal): Delete, move to... + * config/rs6000/rs6000.md (darn_32, darn_raw, darn, cmprb, + *cmprb_internal, setb_signed, setb_unsigned, cmprb2, *cmprb2_internal, + cmpeqb, *cmpeqb_internal): ... here. + 2019-08-30 Richard Biener <rguenther@suse.de> Backport from mainline diff --git a/gcc/config/rs6000/altivec.md b/gcc/config/rs6000/altivec.md index 13f4654db6a..f55f77e9ef1 100644 --- a/gcc/config/rs6000/altivec.md +++ b/gcc/config/rs6000/altivec.md @@ -80,9 +80,6 @@ UNSPEC_VUPKHPX UNSPEC_VUPKLPX UNSPEC_CONVERT_4F32_8I16 - UNSPEC_DARN - UNSPEC_DARN_32 - UNSPEC_DARN_RAW UNSPEC_DST UNSPEC_DSTT UNSPEC_DSTST @@ -161,9 +158,6 @@ UNSPEC_BCDADD UNSPEC_BCDSUB UNSPEC_BCD_OVERFLOW - UNSPEC_CMPRB - UNSPEC_CMPRB2 - UNSPEC_CMPEQB UNSPEC_VRLMI UNSPEC_VRLNM ]) @@ -4317,223 +4311,6 @@ [(set_attr "length" "4") (set_attr "type" "vecsimple")]) -(define_insn "darn_32" - [(set (match_operand:SI 0 "register_operand" "=r") - (unspec:SI [(const_int 0)] UNSPEC_DARN_32))] - "TARGET_P9_MISC" - "darn %0,0" - [(set_attr "type" "integer")]) - -(define_insn "darn_raw" - [(set (match_operand:DI 0 "register_operand" "=r") - (unspec:DI [(const_int 0)] UNSPEC_DARN_RAW))] - "TARGET_P9_MISC && TARGET_64BIT" - "darn %0,2" - [(set_attr "type" "integer")]) - -(define_insn "darn" - [(set (match_operand:DI 0 "register_operand" "=r") - (unspec:DI [(const_int 0)] UNSPEC_DARN))] - "TARGET_P9_MISC && TARGET_64BIT" - "darn %0,1" - [(set_attr "type" "integer")]) - -;; Test byte within range. -;; -;; The bytes of operand 1 are organized as xx:xx:xx:vv, where xx -;; represents a byte whose value is ignored in this context and -;; vv, the least significant byte, holds the byte value that is to -;; be tested for membership within the range specified by operand 2. -;; The bytes of operand 2 are organized as xx:xx:hi:lo. -;; -;; Return in target register operand 0 a value of 1 if lo <= vv and -;; vv <= hi. Otherwise, set register operand 0 to 0. -;; -;; Though the instructions to which this expansion maps operate on -;; 64-bit registers, the current implementation only operates on -;; SI-mode operands as the high-order bits provide no information -;; that is not already available in the low-order bits. To avoid the -;; costs of data widening operations, future enhancements might allow -;; DI mode for operand 0 and/or might allow operand 1 to be QI mode. -(define_expand "cmprb" - [(set (match_dup 3) - (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r") - (match_operand:SI 2 "gpc_reg_operand" "r")] - UNSPEC_CMPRB)) - (set (match_operand:SI 0 "gpc_reg_operand" "=r") - (if_then_else:SI (lt (match_dup 3) - (const_int 0)) - (const_int -1) - (if_then_else (gt (match_dup 3) - (const_int 0)) - (const_int 1) - (const_int 0))))] - "TARGET_P9_MISC" -{ - operands[3] = gen_reg_rtx (CCmode); -}) - -;; The bytes of operand 1 are organized as xx:xx:xx:vv, where xx -;; represents a byte whose value is ignored in this context and -;; vv, the least significant byte, holds the byte value that is to -;; be tested for membership within the range specified by operand 2. -;; The bytes of operand 2 are organized as xx:xx:hi:lo. -;; -;; Set bit 1 (the GT bit, 0x4) of CR register operand 0 to 1 if -;; lo <= vv and vv <= hi. Otherwise, set the GT bit to 0. The other -;; 3 bits of the target CR register are all set to 0. -(define_insn "*cmprb_internal" - [(set (match_operand:CC 0 "cc_reg_operand" "=y") - (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r") - (match_operand:SI 2 "gpc_reg_operand" "r")] - UNSPEC_CMPRB))] - "TARGET_P9_MISC" - "cmprb %0,0,%1,%2" - [(set_attr "type" "logical")]) - -;; Set operand 0 register to -1 if the LT bit (0x8) of condition -;; register operand 1 is on. Otherwise, set operand 0 register to 1 -;; if the GT bit (0x4) of condition register operand 1 is on. -;; Otherwise, set operand 0 to 0. Note that the result stored into -;; register operand 0 is non-zero iff either the LT or GT bits are on -;; within condition register operand 1. -(define_insn "setb_signed" - [(set (match_operand:SI 0 "gpc_reg_operand" "=r") - (if_then_else:SI (lt (match_operand:CC 1 "cc_reg_operand" "y") - (const_int 0)) - (const_int -1) - (if_then_else (gt (match_dup 1) - (const_int 0)) - (const_int 1) - (const_int 0))))] - "TARGET_P9_MISC" - "setb %0,%1" - [(set_attr "type" "logical")]) - -(define_insn "setb_unsigned" - [(set (match_operand:SI 0 "gpc_reg_operand" "=r") - (if_then_else:SI (ltu (match_operand:CCUNS 1 "cc_reg_operand" "y") - (const_int 0)) - (const_int -1) - (if_then_else (gtu (match_dup 1) - (const_int 0)) - (const_int 1) - (const_int 0))))] - "TARGET_P9_MISC" - "setb %0,%1" - [(set_attr "type" "logical")]) - -;; Test byte within two ranges. -;; -;; The bytes of operand 1 are organized as xx:xx:xx:vv, where xx -;; represents a byte whose value is ignored in this context and -;; vv, the least significant byte, holds the byte value that is to -;; be tested for membership within the range specified by operand 2. -;; The bytes of operand 2 are organized as hi_1:lo_1:hi_2:lo_2. -;; -;; Return in target register operand 0 a value of 1 if (lo_1 <= vv and -;; vv <= hi_1) or if (lo_2 <= vv and vv <= hi_2). Otherwise, set register -;; operand 0 to 0. -;; -;; Though the instructions to which this expansion maps operate on -;; 64-bit registers, the current implementation only operates on -;; SI-mode operands as the high-order bits provide no information -;; that is not already available in the low-order bits. To avoid the -;; costs of data widening operations, future enhancements might allow -;; DI mode for operand 0 and/or might allow operand 1 to be QI mode. -(define_expand "cmprb2" - [(set (match_dup 3) - (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r") - (match_operand:SI 2 "gpc_reg_operand" "r")] - UNSPEC_CMPRB2)) - (set (match_operand:SI 0 "gpc_reg_operand" "=r") - (if_then_else:SI (lt (match_dup 3) - (const_int 0)) - (const_int -1) - (if_then_else (gt (match_dup 3) - (const_int 0)) - (const_int 1) - (const_int 0))))] - "TARGET_P9_MISC" -{ - operands[3] = gen_reg_rtx (CCmode); -}) - -;; The bytes of operand 1 are organized as xx:xx:xx:vv, where xx -;; represents a byte whose value is ignored in this context and -;; vv, the least significant byte, holds the byte value that is to -;; be tested for membership within the ranges specified by operand 2. -;; The bytes of operand 2 are organized as hi_1:lo_1:hi_2:lo_2. -;; -;; Set bit 1 (the GT bit, 0x4) of CR register operand 0 to 1 if -;; (lo_1 <= vv and vv <= hi_1) or if (lo_2 <= vv and vv <= hi_2). -;; Otherwise, set the GT bit to 0. The other 3 bits of the target -;; CR register are all set to 0. -(define_insn "*cmprb2_internal" - [(set (match_operand:CC 0 "cc_reg_operand" "=y") - (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r") - (match_operand:SI 2 "gpc_reg_operand" "r")] - UNSPEC_CMPRB2))] - "TARGET_P9_MISC" - "cmprb %0,1,%1,%2" - [(set_attr "type" "logical")]) - -;; Test byte membership within set of 8 bytes. -;; -;; The bytes of operand 1 are organized as xx:xx:xx:vv, where xx -;; represents a byte whose value is ignored in this context and -;; vv, the least significant byte, holds the byte value that is to -;; be tested for membership within the set specified by operand 2. -;; The bytes of operand 2 are organized as e0:e1:e2:e3:e4:e5:e6:e7. -;; -;; Return in target register operand 0 a value of 1 if vv equals one -;; of the values e0, e1, e2, e3, e4, e5, e6, or e7. Otherwise, set -;; register operand 0 to 0. Note that the 8 byte values held within -;; operand 2 need not be unique. -;; -;; Though the instructions to which this expansion maps operate on -;; 64-bit registers, the current implementation requires that operands -;; 0 and 1 have mode SI as the high-order bits provide no information -;; that is not already available in the low-order bits. To avoid the -;; costs of data widening operations, future enhancements might allow -;; DI mode for operand 0 and/or might allow operand 1 to be QI mode. -(define_expand "cmpeqb" - [(set (match_dup 3) - (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r") - (match_operand:DI 2 "gpc_reg_operand" "r")] - UNSPEC_CMPEQB)) - (set (match_operand:SI 0 "gpc_reg_operand" "=r") - (if_then_else:SI (lt (match_dup 3) - (const_int 0)) - (const_int -1) - (if_then_else (gt (match_dup 3) - (const_int 0)) - (const_int 1) - (const_int 0))))] - "TARGET_P9_MISC && TARGET_64BIT" -{ - operands[3] = gen_reg_rtx (CCmode); -}) - -;; The bytes of operand 1 are organized as xx:xx:xx:vv, where xx -;; represents a byte whose value is ignored in this context and -;; vv, the least significant byte, holds the byte value that is to -;; be tested for membership within the set specified by operand 2. -;; The bytes of operand 2 are organized as e0:e1:e2:e3:e4:e5:e6:e7. -;; -;; Set bit 1 (the GT bit, 0x4) of CR register operand 0 to 1 if vv -;; equals one of the values e0, e1, e2, e3, e4, e5, e6, or e7. Otherwise, -;; set the GT bit to zero. The other 3 bits of the target CR register -;; are all set to 0. -(define_insn "*cmpeqb_internal" - [(set (match_operand:CC 0 "cc_reg_operand" "=y") - (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r") - (match_operand:DI 2 "gpc_reg_operand" "r")] - UNSPEC_CMPEQB))] - "TARGET_P9_MISC && TARGET_64BIT" - "cmpeqb %0,%1,%2" - [(set_attr "type" "logical")]) - (define_expand "bcd<bcd_add_sub>_<code>" [(parallel [(set (reg:CCFP CR6_REGNO) (compare:CCFP diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md index 3c9b7824d8b..999868caac0 100644 --- a/gcc/config/rs6000/rs6000.md +++ b/gcc/config/rs6000/rs6000.md @@ -136,6 +136,12 @@ UNSPEC_LSQ UNSPEC_FUSION_GPR UNSPEC_STACK_CHECK + UNSPEC_DARN + UNSPEC_DARN_32 + UNSPEC_DARN_RAW + UNSPEC_CMPRB + UNSPEC_CMPRB2 + UNSPEC_CMPEQB UNSPEC_FUSION_P9 UNSPEC_FUSION_ADDIS UNSPEC_ADD_ROUND_TO_ODD @@ -14600,7 +14606,225 @@ "xscmpuqp %0,%1,%2" [(set_attr "type" "veccmp") (set_attr "size" "128")]) + +;; Miscellaneous ISA 3.0 (power9) instructions + +(define_insn "darn_32" + [(set (match_operand:SI 0 "register_operand" "=r") + (unspec:SI [(const_int 0)] UNSPEC_DARN_32))] + "TARGET_P9_MISC" + "darn %0,0" + [(set_attr "type" "integer")]) + +(define_insn "darn_raw" + [(set (match_operand:DI 0 "register_operand" "=r") + (unspec:DI [(const_int 0)] UNSPEC_DARN_RAW))] + "TARGET_P9_MISC && TARGET_64BIT" + "darn %0,2" + [(set_attr "type" "integer")]) + +(define_insn "darn" + [(set (match_operand:DI 0 "register_operand" "=r") + (unspec:DI [(const_int 0)] UNSPEC_DARN))] + "TARGET_P9_MISC && TARGET_64BIT" + "darn %0,1" + [(set_attr "type" "integer")]) + +;; Test byte within range. +;; +;; The bytes of operand 1 are organized as xx:xx:xx:vv, where xx +;; represents a byte whose value is ignored in this context and +;; vv, the least significant byte, holds the byte value that is to +;; be tested for membership within the range specified by operand 2. +;; The bytes of operand 2 are organized as xx:xx:hi:lo. +;; +;; Return in target register operand 0 a value of 1 if lo <= vv and +;; vv <= hi. Otherwise, set register operand 0 to 0. +;; +;; Though the instructions to which this expansion maps operate on +;; 64-bit registers, the current implementation only operates on +;; SI-mode operands as the high-order bits provide no information +;; that is not already available in the low-order bits. To avoid the +;; costs of data widening operations, future enhancements might allow +;; DI mode for operand 0 and/or might allow operand 1 to be QI mode. +(define_expand "cmprb" + [(set (match_dup 3) + (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r") + (match_operand:SI 2 "gpc_reg_operand" "r")] + UNSPEC_CMPRB)) + (set (match_operand:SI 0 "gpc_reg_operand" "=r") + (if_then_else:SI (lt (match_dup 3) + (const_int 0)) + (const_int -1) + (if_then_else (gt (match_dup 3) + (const_int 0)) + (const_int 1) + (const_int 0))))] + "TARGET_P9_MISC" +{ + operands[3] = gen_reg_rtx (CCmode); +}) + +;; The bytes of operand 1 are organized as xx:xx:xx:vv, where xx +;; represents a byte whose value is ignored in this context and +;; vv, the least significant byte, holds the byte value that is to +;; be tested for membership within the range specified by operand 2. +;; The bytes of operand 2 are organized as xx:xx:hi:lo. +;; +;; Set bit 1 (the GT bit, 0x4) of CR register operand 0 to 1 if +;; lo <= vv and vv <= hi. Otherwise, set the GT bit to 0. The other +;; 3 bits of the target CR register are all set to 0. +(define_insn "*cmprb_internal" + [(set (match_operand:CC 0 "cc_reg_operand" "=y") + (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r") + (match_operand:SI 2 "gpc_reg_operand" "r")] + UNSPEC_CMPRB))] + "TARGET_P9_MISC" + "cmprb %0,0,%1,%2" + [(set_attr "type" "logical")]) + +;; Set operand 0 register to -1 if the LT bit (0x8) of condition +;; register operand 1 is on. Otherwise, set operand 0 register to 1 +;; if the GT bit (0x4) of condition register operand 1 is on. +;; Otherwise, set operand 0 to 0. Note that the result stored into +;; register operand 0 is non-zero iff either the LT or GT bits are on +;; within condition register operand 1. +(define_insn "setb_signed" + [(set (match_operand:SI 0 "gpc_reg_operand" "=r") + (if_then_else:SI (lt (match_operand:CC 1 "cc_reg_operand" "y") + (const_int 0)) + (const_int -1) + (if_then_else (gt (match_dup 1) + (const_int 0)) + (const_int 1) + (const_int 0))))] + "TARGET_P9_MISC" + "setb %0,%1" + [(set_attr "type" "logical")]) + +(define_insn "setb_unsigned" + [(set (match_operand:SI 0 "gpc_reg_operand" "=r") + (if_then_else:SI (ltu (match_operand:CCUNS 1 "cc_reg_operand" "y") + (const_int 0)) + (const_int -1) + (if_then_else (gtu (match_dup 1) + (const_int 0)) + (const_int 1) + (const_int 0))))] + "TARGET_P9_MISC" + "setb %0,%1" + [(set_attr "type" "logical")]) + +;; Test byte within two ranges. +;; +;; The bytes of operand 1 are organized as xx:xx:xx:vv, where xx +;; represents a byte whose value is ignored in this context and +;; vv, the least significant byte, holds the byte value that is to +;; be tested for membership within the range specified by operand 2. +;; The bytes of operand 2 are organized as hi_1:lo_1:hi_2:lo_2. +;; +;; Return in target register operand 0 a value of 1 if (lo_1 <= vv and +;; vv <= hi_1) or if (lo_2 <= vv and vv <= hi_2). Otherwise, set register +;; operand 0 to 0. +;; +;; Though the instructions to which this expansion maps operate on +;; 64-bit registers, the current implementation only operates on +;; SI-mode operands as the high-order bits provide no information +;; that is not already available in the low-order bits. To avoid the +;; costs of data widening operations, future enhancements might allow +;; DI mode for operand 0 and/or might allow operand 1 to be QI mode. +(define_expand "cmprb2" + [(set (match_dup 3) + (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r") + (match_operand:SI 2 "gpc_reg_operand" "r")] + UNSPEC_CMPRB2)) + (set (match_operand:SI 0 "gpc_reg_operand" "=r") + (if_then_else:SI (lt (match_dup 3) + (const_int 0)) + (const_int -1) + (if_then_else (gt (match_dup 3) + (const_int 0)) + (const_int 1) + (const_int 0))))] + "TARGET_P9_MISC" +{ + operands[3] = gen_reg_rtx (CCmode); +}) + +;; The bytes of operand 1 are organized as xx:xx:xx:vv, where xx +;; represents a byte whose value is ignored in this context and +;; vv, the least significant byte, holds the byte value that is to +;; be tested for membership within the ranges specified by operand 2. +;; The bytes of operand 2 are organized as hi_1:lo_1:hi_2:lo_2. +;; +;; Set bit 1 (the GT bit, 0x4) of CR register operand 0 to 1 if +;; (lo_1 <= vv and vv <= hi_1) or if (lo_2 <= vv and vv <= hi_2). +;; Otherwise, set the GT bit to 0. The other 3 bits of the target +;; CR register are all set to 0. +(define_insn "*cmprb2_internal" + [(set (match_operand:CC 0 "cc_reg_operand" "=y") + (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r") + (match_operand:SI 2 "gpc_reg_operand" "r")] + UNSPEC_CMPRB2))] + "TARGET_P9_MISC" + "cmprb %0,1,%1,%2" + [(set_attr "type" "logical")]) +;; Test byte membership within set of 8 bytes. +;; +;; The bytes of operand 1 are organized as xx:xx:xx:vv, where xx +;; represents a byte whose value is ignored in this context and +;; vv, the least significant byte, holds the byte value that is to +;; be tested for membership within the set specified by operand 2. +;; The bytes of operand 2 are organized as e0:e1:e2:e3:e4:e5:e6:e7. +;; +;; Return in target register operand 0 a value of 1 if vv equals one +;; of the values e0, e1, e2, e3, e4, e5, e6, or e7. Otherwise, set +;; register operand 0 to 0. Note that the 8 byte values held within +;; operand 2 need not be unique. +;; +;; Though the instructions to which this expansion maps operate on +;; 64-bit registers, the current implementation requires that operands +;; 0 and 1 have mode SI as the high-order bits provide no information +;; that is not already available in the low-order bits. To avoid the +;; costs of data widening operations, future enhancements might allow +;; DI mode for operand 0 and/or might allow operand 1 to be QI mode. +(define_expand "cmpeqb" + [(set (match_dup 3) + (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r") + (match_operand:DI 2 "gpc_reg_operand" "r")] + UNSPEC_CMPEQB)) + (set (match_operand:SI 0 "gpc_reg_operand" "=r") + (if_then_else:SI (lt (match_dup 3) + (const_int 0)) + (const_int -1) + (if_then_else (gt (match_dup 3) + (const_int 0)) + (const_int 1) + (const_int 0))))] + "TARGET_P9_MISC && TARGET_64BIT" +{ + operands[3] = gen_reg_rtx (CCmode); +}) + +;; The bytes of operand 1 are organized as xx:xx:xx:vv, where xx +;; represents a byte whose value is ignored in this context and +;; vv, the least significant byte, holds the byte value that is to +;; be tested for membership within the set specified by operand 2. +;; The bytes of operand 2 are organized as e0:e1:e2:e3:e4:e5:e6:e7. +;; +;; Set bit 1 (the GT bit, 0x4) of CR register operand 0 to 1 if vv +;; equals one of the values e0, e1, e2, e3, e4, e5, e6, or e7. Otherwise, +;; set the GT bit to zero. The other 3 bits of the target CR register +;; are all set to 0. +(define_insn "*cmpeqb_internal" + [(set (match_operand:CC 0 "cc_reg_operand" "=y") + (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r") + (match_operand:DI 2 "gpc_reg_operand" "r")] + UNSPEC_CMPEQB))] + "TARGET_P9_MISC && TARGET_64BIT" + "cmpeqb %0,%1,%2" + [(set_attr "type" "logical")]) (include "sync.md") -- cgit v1.2.3 From 4f7a01cdbca29f38cf621d61c0899236d15a5553 Mon Sep 17 00:00:00 2001 From: Segher Boessenkool <segher@kernel.crashing.org> Date: Fri, 30 Aug 2019 14:15:39 +0000 Subject: Backport from trunk 2019-08-22 Segher Boessenkool <segher@kernel.crashing.org> PR target/91481 * config/rs6000/rs6000.md (unspec): Delete UNSPEC_DARN, UNSPEC_DARN_32, and UNSPEC_DARN_RAW. (unspecv): New enumerator values UNSPECV_DARN, UNSPECV_DARN_32, and UNSPECV_DARN_RAW. (darn_32): Use an unspec_volatile, and UNSPECV_DARN_32. (darn_raw): Use an unspec_volatile, and UNSPECV_DARN_RAW. (darn): Use an unspec_volatile, and UNSPECV_DARN. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@275181 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 14 ++++++++++++++ gcc/config/rs6000/rs6000.md | 12 ++++++------ 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ea7da292fb4..74942db4bba 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,17 @@ +2019-08-30 Segher Boessenkool <segher@kernel.crashing.org> + + Backport from trunk + 2019-08-22 Segher Boessenkool <segher@kernel.crashing.org> + + PR target/91481 + * config/rs6000/rs6000.md (unspec): Delete UNSPEC_DARN, UNSPEC_DARN_32, + and UNSPEC_DARN_RAW. + (unspecv): New enumerator values UNSPECV_DARN, UNSPECV_DARN_32, and + UNSPECV_DARN_RAW. + (darn_32): Use an unspec_volatile, and UNSPECV_DARN_32. + (darn_raw): Use an unspec_volatile, and UNSPECV_DARN_RAW. + (darn): Use an unspec_volatile, and UNSPECV_DARN. + 2019-08-30 Segher Boessenkool <segher@kernel.crashing.org> Backport from trunk diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md index 999868caac0..dd68d1b4157 100644 --- a/gcc/config/rs6000/rs6000.md +++ b/gcc/config/rs6000/rs6000.md @@ -136,9 +136,6 @@ UNSPEC_LSQ UNSPEC_FUSION_GPR UNSPEC_STACK_CHECK - UNSPEC_DARN - UNSPEC_DARN_32 - UNSPEC_DARN_RAW UNSPEC_CMPRB UNSPEC_CMPRB2 UNSPEC_CMPEQB @@ -168,6 +165,9 @@ UNSPECV_EH_RR ; eh_reg_restore UNSPECV_ISYNC ; isync instruction UNSPECV_MFTB ; move from time base + UNSPECV_DARN ; darn 1 (deliver a random number) + UNSPECV_DARN_32 ; darn 2 + UNSPECV_DARN_RAW ; darn 0 UNSPECV_NLGR ; non-local goto receiver UNSPECV_MFFS ; Move from FPSCR UNSPECV_MTFSF ; Move to FPSCR Fields @@ -14611,21 +14611,21 @@ (define_insn "darn_32" [(set (match_operand:SI 0 "register_operand" "=r") - (unspec:SI [(const_int 0)] UNSPEC_DARN_32))] + (unspec_volatile:SI [(const_int 0)] UNSPECV_DARN_32))] "TARGET_P9_MISC" "darn %0,0" [(set_attr "type" "integer")]) (define_insn "darn_raw" [(set (match_operand:DI 0 "register_operand" "=r") - (unspec:DI [(const_int 0)] UNSPEC_DARN_RAW))] + (unspec_volatile:DI [(const_int 0)] UNSPECV_DARN_RAW))] "TARGET_P9_MISC && TARGET_64BIT" "darn %0,2" [(set_attr "type" "integer")]) (define_insn "darn" [(set (match_operand:DI 0 "register_operand" "=r") - (unspec:DI [(const_int 0)] UNSPEC_DARN))] + (unspec_volatile:DI [(const_int 0)] UNSPECV_DARN))] "TARGET_P9_MISC && TARGET_64BIT" "darn %0,1" [(set_attr "type" "integer")]) -- cgit v1.2.3 From d56a1a4783dbe79a36da8b563041f301ea531f09 Mon Sep 17 00:00:00 2001 From: Segher Boessenkool <segher@kernel.crashing.org> Date: Fri, 30 Aug 2019 14:17:20 +0000 Subject: Backport from trunk 2019-08-23 Segher Boessenkool <segher@kernel.crashing.org> gcc/testsuite/ PR target/91481 * gcc.target/powerpc/darn-3.c: New testcase. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@275182 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/testsuite/ChangeLog | 9 +++++++++ gcc/testsuite/gcc.target/powerpc/darn-3.c | 16 ++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 gcc/testsuite/gcc.target/powerpc/darn-3.c diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 2fc926e1204..2df4c1477dd 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,12 @@ +2019-08-30 Segher Boessenkool <segher@kernel.crashing.org> + + Backport from trunk + 2019-08-23 Segher Boessenkool <segher@kernel.crashing.org> + +gcc/testsuite/ + PR target/91481 + * gcc.target/powerpc/darn-3.c: New testcase. + 2019-08-30 Richard Biener <rguenther@suse.de> Backport from mainline diff --git a/gcc/testsuite/gcc.target/powerpc/darn-3.c b/gcc/testsuite/gcc.target/powerpc/darn-3.c new file mode 100644 index 00000000000..477901fde70 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/darn-3.c @@ -0,0 +1,16 @@ +/* { dg-do compile { target { powerpc*-*-* } } } */ +/* { dg-skip-if "" { powerpc*-*-aix* } } */ +/* { dg-options "-O2 -mdejagnu-cpu=power9" } */ + +static int darn32(void) { return __builtin_darn_32(); } + +int four(void) +{ + int sum = 0; + int i; + for (i = 0; i < 4; i++) + sum += darn32(); + return sum; +} + +/* { dg-final { scan-assembler-times {(?n)\mdarn .*,0\M} 4 } } */ -- cgit v1.2.3 From b9c9696612742c1e86620670a0811144de6b5fae Mon Sep 17 00:00:00 2001 From: Jonathan Wakely <jwakely@redhat.com> Date: Fri, 30 Aug 2019 14:17:41 +0000 Subject: PR libstdc++/78179 fix std::hypot failures due to excessive tolerance Backport from mainline 2018-09-21 Jonathan Wakely <jwakely@redhat.com> PR libstdc++/78179 * testsuite/26_numerics/headers/cmath/hypot.cc: Use lower tolerance when sizeof(long double) == sizeof(double). git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@275183 138bc75d-0d04-0410-961f-82ee72b054a4 --- libstdc++-v3/ChangeLog | 9 +++++++++ libstdc++-v3/testsuite/26_numerics/headers/cmath/hypot.cc | 8 +++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index eaa96a68afd..9485e35fc88 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,12 @@ +2019-08-30 Jonathan Wakely <jwakely@redhat.com> + + Backport from mainline + 2018-09-21 Jonathan Wakely <jwakely@redhat.com> + + PR libstdc++/78179 + * testsuite/26_numerics/headers/cmath/hypot.cc: Use lower tolerance + when sizeof(long double) == sizeof(double). + 2019-08-30 Jonathan Wakely <jwakely@redhat.com> Backport from mainline diff --git a/libstdc++-v3/testsuite/26_numerics/headers/cmath/hypot.cc b/libstdc++-v3/testsuite/26_numerics/headers/cmath/hypot.cc index 69840c8117a..5e82db24d30 100644 --- a/libstdc++-v3/testsuite/26_numerics/headers/cmath/hypot.cc +++ b/libstdc++-v3/testsuite/26_numerics/headers/cmath/hypot.cc @@ -1,4 +1,4 @@ -// Copyright (C) 2016-2018 Free Software Foundation, Inc. +// Copyright (C) 2016-2019 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 @@ -17,7 +17,6 @@ // { dg-options "-std=gnu++17" } // { dg-do run { target c++17 } } -// { dg-xfail-run-if "AIX long double" { powerpc-ibm-aix* } } #include <cmath> #include <type_traits> @@ -128,7 +127,10 @@ test01() { test(data1, toler1); test(data2, toler2); - test(data3, toler3); + if (sizeof(long double) > sizeof(double)) + test(data3, toler3); + else + test(data3, (long double)toler1); } int -- cgit v1.2.3 From ee43562c8f4e55b15c336dc5065926c6edcca467 Mon Sep 17 00:00:00 2001 From: Jonathan Wakely <jwakely@redhat.com> Date: Fri, 30 Aug 2019 14:39:22 +0000 Subject: Backport documentation fixes Backport from mainline 2019-05-21 Jonathan Wakely <jwakely@redhat.com> * doc/xml/manual/shared_ptr.xml: Fix names of lock policy constants. Backport from mainline 2019-06-20 Jonathan Wakely <jwakely@redhat.com> * doc/xml/manual/status_cxx2017.xml: Fix outdated reference to C++17 working draft. Backport from mainline 2019-05-23 Jonathan Wakely <jwakely@redhat.com> * doc/xml/manual/status_cxx2017.xml: Add feature test macro for P0040R3. * doc/html/*: Regenerate. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@275189 138bc75d-0d04-0410-961f-82ee72b054a4 --- libstdc++-v3/ChangeLog | 20 ++++++++++++++++++++ libstdc++-v3/doc/html/manual/bugs.html | 4 ++++ libstdc++-v3/doc/html/manual/memory.html | 6 +++--- libstdc++-v3/doc/html/manual/status.html | 4 ++-- libstdc++-v3/doc/xml/manual/shared_ptr.xml | 6 +++--- libstdc++-v3/doc/xml/manual/status_cxx2017.xml | 4 ++-- 6 files changed, 34 insertions(+), 10 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 9485e35fc88..5ae49dc5792 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,23 @@ +2019-08-30 Jonathan Wakely <jwakely@redhat.com> + + Backport from mainline + 2019-05-23 Jonathan Wakely <jwakely@redhat.com> + + * doc/xml/manual/status_cxx2017.xml: Add feature test macro for + P0040R3. + * doc/html/*: Regenerate. + + Backport from mainline + 2019-06-20 Jonathan Wakely <jwakely@redhat.com> + + * doc/xml/manual/status_cxx2017.xml: Fix outdated reference to + C++17 working draft. + + Backport from mainline + 2019-05-21 Jonathan Wakely <jwakely@redhat.com> + + * doc/xml/manual/shared_ptr.xml: Fix names of lock policy constants. + 2019-08-30 Jonathan Wakely <jwakely@redhat.com> Backport from mainline diff --git a/libstdc++-v3/doc/html/manual/bugs.html b/libstdc++-v3/doc/html/manual/bugs.html index df69da077a2..2f54867855f 100644 --- a/libstdc++-v3/doc/html/manual/bugs.html +++ b/libstdc++-v3/doc/html/manual/bugs.html @@ -497,6 +497,10 @@ should call <code class="code">make_heap</code> </em></span> </span></dt><dd><p>Call <code class="code">make_heap</code>. + </p></dd><dt><a id="manual.bugs.dr2566"></a><span class="term"><a class="link" href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2566" target="_top">2566</a>: + <span class="emphasis"><em>Requirements on the first template parameter of container adaptors + </em></span> + </span></dt><dd><p>Add static assertions to enforce the requirement. </p></dd><dt><a id="manual.bugs.dr2583"></a><span class="term"><a class="link" href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2583" target="_top">2583</a>: <span class="emphasis"><em>There is no way to supply an allocator for <code class="code">basic_string(str, pos)</code> </em></span> diff --git a/libstdc++-v3/doc/html/manual/memory.html b/libstdc++-v3/doc/html/manual/memory.html index d95202cd100..f79a180613e 100644 --- a/libstdc++-v3/doc/html/manual/memory.html +++ b/libstdc++-v3/doc/html/manual/memory.html @@ -554,7 +554,7 @@ not be conforming for <code class="classname">shared_ptr</code> to have an extra template parameter, even if it had a default value. The available policies are: </p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem"><p> - <code class="constant">_S_Atomic</code> + <code class="constant">_S_atomic</code> </p><p> Selected when GCC supports a builtin atomic compare-and-swap operation on the target processor (see <a class="link" href="http://gcc.gnu.org/onlinedocs/gcc/_005f_005fatomic-Builtins.html" target="_top">Atomic @@ -562,13 +562,13 @@ Builtins</a>.) The reference counts are maintained using a lock-free algorithm and GCC's atomic builtins, which provide the required memory synchronisation. </p></li><li class="listitem"><p> - <code class="constant">_S_Mutex</code> + <code class="constant">_S_mutex</code> </p><p> The _Sp_counted_base specialization for this policy contains a mutex, which is locked in add_ref_lock(). This policy is used when GCC's atomic builtins aren't available so explicit memory barriers are needed in places. </p></li><li class="listitem"><p> - <code class="constant">_S_Single</code> + <code class="constant">_S_single</code> </p><p> This policy uses a non-reentrant add_ref_lock() with no locking. It is used when libstdc++ is built without <code class="literal">--enable-threads</code>. diff --git a/libstdc++-v3/doc/html/manual/status.html b/libstdc++-v3/doc/html/manual/status.html index d4aacc49ed5..0b42518789a 100644 --- a/libstdc++-v3/doc/html/manual/status.html +++ b/libstdc++-v3/doc/html/manual/status.html @@ -526,8 +526,8 @@ presence of the required flag. This section describes the C++17 and library TS support in mainline GCC SVN, not in any particular release. </p><p> -The following table lists new library features that have been accepted into -the C++17 working draft. The "Proposal" column provides a link to the +The following table lists new library features that are included in +the C++17 standard. The "Proposal" column provides a link to the ISO C++ committee proposal that describes the feature, while the "Status" column indicates the first version of GCC that contains an implementation of this feature (if it has been implemented). diff --git a/libstdc++-v3/doc/xml/manual/shared_ptr.xml b/libstdc++-v3/doc/xml/manual/shared_ptr.xml index fcbade6d5bf..24e275e95eb 100644 --- a/libstdc++-v3/doc/xml/manual/shared_ptr.xml +++ b/libstdc++-v3/doc/xml/manual/shared_ptr.xml @@ -239,7 +239,7 @@ available policies are: <orderedlist> <listitem> <para> - <constant>_S_Atomic</constant> + <constant>_S_atomic</constant> </para> <para> Selected when GCC supports a builtin atomic compare-and-swap operation @@ -252,7 +252,7 @@ synchronisation. <listitem> <para> - <constant>_S_Mutex</constant> + <constant>_S_mutex</constant> </para> <para> The _Sp_counted_base specialization for this policy contains a mutex, @@ -263,7 +263,7 @@ builtins aren't available so explicit memory barriers are needed in places. <listitem> <para> - <constant>_S_Single</constant> + <constant>_S_single</constant> </para> <para> This policy uses a non-reentrant add_ref_lock() with no locking. It is diff --git a/libstdc++-v3/doc/xml/manual/status_cxx2017.xml b/libstdc++-v3/doc/xml/manual/status_cxx2017.xml index d5ff74b4e2f..462530cb6dd 100644 --- a/libstdc++-v3/doc/xml/manual/status_cxx2017.xml +++ b/libstdc++-v3/doc/xml/manual/status_cxx2017.xml @@ -25,8 +25,8 @@ not in any particular release. </para> <para> -The following table lists new library features that have been accepted into -the C++17 working draft. The "Proposal" column provides a link to the +The following table lists new library features that are included in +the C++17 standard. The "Proposal" column provides a link to the ISO C++ committee proposal that describes the feature, while the "Status" column indicates the first version of GCC that contains an implementation of this feature (if it has been implemented). -- cgit v1.2.3 From da1da06d7fbe006771704f75e948281b4d747e30 Mon Sep 17 00:00:00 2001 From: Jonathan Wakely <jwakely@redhat.com> Date: Fri, 30 Aug 2019 15:01:10 +0000 Subject: PR libstdc++/51333 Define recursive_init_error constructor non-inline The recursive_init_error class is defined in a header, with an inline constructor, but the definition of the vtable and destructor are not exported from the shared library. With -fkeep-inline-functions the constructor gets emitted in user code, and requires the (non-exported) vtable. This fails to link. As far as I can tell, the recursive_init_error class definition was moved into <cxxabi.h> so it could be documented with Doxygen, not for any technical reason. But now it's there (and documented), somebody could be relying on it, by catching that type and possibly performing derived-to-base conversions to the std::exception base class. So the conservative fix is to leave the class definition in the header but make the constructor non-inline. This still allows the type to be caught and still defines its base class. Backport from mainline 2019-07-29 Jonathan Wakely <jwakely@redhat.com> PR libstdc++/51333 * libsupc++/cxxabi.h (__gnu_cxx::recursive_init_error): Do not define constructor inline. * libsupc++/guard_error.cc (__gnu_cxx::recursive_init_error): Define constructor. * testsuite/18_support/51333.cc: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@275192 138bc75d-0d04-0410-961f-82ee72b054a4 --- libstdc++-v3/ChangeLog | 12 ++++++++++++ libstdc++-v3/libsupc++/cxxabi.h | 9 +++++---- libstdc++-v3/libsupc++/guard_error.cc | 4 ++-- libstdc++-v3/testsuite/18_support/51333.cc | 22 ++++++++++++++++++++++ 4 files changed, 41 insertions(+), 6 deletions(-) create mode 100644 libstdc++-v3/testsuite/18_support/51333.cc diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 5ae49dc5792..5f04dbdc781 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,15 @@ +2019-08-30 Jonathan Wakely <jwakely@redhat.com> + + Backport from mainline + 2019-07-29 Jonathan Wakely <jwakely@redhat.com> + + PR libstdc++/51333 + * libsupc++/cxxabi.h (__gnu_cxx::recursive_init_error): Do not define + constructor inline. + * libsupc++/guard_error.cc (__gnu_cxx::recursive_init_error): Define + constructor. + * testsuite/18_support/51333.cc: New test. + 2019-08-30 Jonathan Wakely <jwakely@redhat.com> Backport from mainline diff --git a/libstdc++-v3/libsupc++/cxxabi.h b/libstdc++-v3/libsupc++/cxxabi.h index 1bcf1282936..5648df61139 100644 --- a/libstdc++-v3/libsupc++/cxxabi.h +++ b/libstdc++-v3/libsupc++/cxxabi.h @@ -683,8 +683,9 @@ namespace __gnu_cxx * @brief Exception thrown by __cxa_guard_acquire. * @ingroup exceptions * - * 6.7[stmt.dcl]/4: If control re-enters the declaration (recursively) - * while the object is being initialized, the behavior is undefined. + * C++ 2011 6.7 [stmt.dcl]/4: If control re-enters the declaration + * recursively while the variable is being initialized, the behavior + * is undefined. * * Since we already have a library function to handle locking, we might * as well check for this situation and throw an exception. @@ -694,8 +695,8 @@ namespace __gnu_cxx class recursive_init_error: public std::exception { public: - recursive_init_error() throw() { } - virtual ~recursive_init_error() throw (); + recursive_init_error() _GLIBCXX_NOTHROW; + virtual ~recursive_init_error() _GLIBCXX_NOTHROW; }; } #endif // __cplusplus diff --git a/libstdc++-v3/libsupc++/guard_error.cc b/libstdc++-v3/libsupc++/guard_error.cc index 5f05022b4cc..f9ff3caed9b 100644 --- a/libstdc++-v3/libsupc++/guard_error.cc +++ b/libstdc++-v3/libsupc++/guard_error.cc @@ -26,6 +26,6 @@ namespace __gnu_cxx { - recursive_init_error::~recursive_init_error() throw() { } + recursive_init_error::recursive_init_error() noexcept { } + recursive_init_error::~recursive_init_error() noexcept { } } - diff --git a/libstdc++-v3/testsuite/18_support/51333.cc b/libstdc++-v3/testsuite/18_support/51333.cc new file mode 100644 index 00000000000..0fb7c338f8b --- /dev/null +++ b/libstdc++-v3/testsuite/18_support/51333.cc @@ -0,0 +1,22 @@ +// Copyright (C) 2019 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 "-fkeep-inline-functions" } +// { dg-do link } + +#include <cxxabi.h> +int main() { } // PR libstdc++/51333 -- cgit v1.2.3 From 2bcc10a707f6c0238028fb1fc706675480815009 Mon Sep 17 00:00:00 2001 From: Jonathan Wakely <jwakely@redhat.com> Date: Fri, 30 Aug 2019 15:01:15 +0000 Subject: PR libstdc++/91308 fix constraints on unique_ptr assignment Backport from mainline 2019-07-31 Jonathan Wakely <jwakely@redhat.com> PR libstdc++/91308 * include/bits/unique_ptr.h (unique_ptr::__safe_conversion_up): Remove constraints on deleter that should only apply to the constructor. (unique_ptr<T[], D>::__safe_conversion_up): Likewise. (unique_ptr<T[], D>::unique_ptr(unique_ptr<U, D>&&)): Restore constraints on deleter here. * testsuite/20_util/unique_ptr/assign/91308.cc: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@275193 138bc75d-0d04-0410-961f-82ee72b054a4 --- libstdc++-v3/ChangeLog | 13 ++++++ libstdc++-v3/include/bits/unique_ptr.h | 30 ++++++-------- .../testsuite/20_util/unique_ptr/assign/91308.cc | 46 ++++++++++++++++++++++ 3 files changed, 72 insertions(+), 17 deletions(-) create mode 100644 libstdc++-v3/testsuite/20_util/unique_ptr/assign/91308.cc diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 5f04dbdc781..a7e7a3506dd 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,16 @@ +2019-08-30 Jonathan Wakely <jwakely@redhat.com> + + Backport from mainline + 2019-07-31 Jonathan Wakely <jwakely@redhat.com> + + PR libstdc++/91308 + * include/bits/unique_ptr.h (unique_ptr::__safe_conversion_up): Remove + constraints on deleter that should only apply to the constructor. + (unique_ptr<T[], D>::__safe_conversion_up): Likewise. + (unique_ptr<T[], D>::unique_ptr(unique_ptr<U, D>&&)): Restore + constraints on deleter here. + * testsuite/20_util/unique_ptr/assign/91308.cc: New test. + 2019-08-30 Jonathan Wakely <jwakely@redhat.com> Backport from mainline diff --git a/libstdc++-v3/include/bits/unique_ptr.h b/libstdc++-v3/include/bits/unique_ptr.h index 8225e3a8290..90adf536cef 100644 --- a/libstdc++-v3/include/bits/unique_ptr.h +++ b/libstdc++-v3/include/bits/unique_ptr.h @@ -174,14 +174,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION // unique_ptr template<typename _Up, typename _Ep> using __safe_conversion_up = __and_< - is_convertible<typename unique_ptr<_Up, _Ep>::pointer, pointer>, - __not_<is_array<_Up>>, - __or_<__and_<is_reference<deleter_type>, - is_same<deleter_type, _Ep>>, - __and_<__not_<is_reference<deleter_type>>, - is_convertible<_Ep, deleter_type>> - > - >; + is_convertible<typename unique_ptr<_Up, _Ep>::pointer, pointer>, + __not_<is_array<_Up>> + >; // Constructors. @@ -425,16 +420,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION // helper template for detecting a safe conversion from another // unique_ptr template<typename _Up, typename _Ep, - typename _Up_up = unique_ptr<_Up, _Ep>, - typename _Up_element_type = typename _Up_up::element_type> + typename _UPtr = unique_ptr<_Up, _Ep>, + typename _UP_pointer = typename _UPtr::pointer, + typename _UP_element_type = typename _UPtr::element_type> using __safe_conversion_up = __and_< is_array<_Up>, is_same<pointer, element_type*>, - is_same<typename _Up_up::pointer, _Up_element_type*>, - is_convertible<_Up_element_type(*)[], element_type(*)[]>, - __or_<__and_<is_reference<deleter_type>, is_same<deleter_type, _Ep>>, - __and_<__not_<is_reference<deleter_type>>, - is_convertible<_Ep, deleter_type>>> + is_same<_UP_pointer, _UP_element_type*>, + is_convertible<_UP_element_type(*)[], element_type(*)[]> >; // helper template for detecting a safe conversion from a raw pointer @@ -519,8 +512,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION typename = _DeleterConstraint<_Up>> constexpr unique_ptr(nullptr_t) noexcept : _M_t() { } - template<typename _Up, typename _Ep, - typename = _Require<__safe_conversion_up<_Up, _Ep>>> + template<typename _Up, typename _Ep, typename = _Require< + __safe_conversion_up<_Up, _Ep>, + typename conditional<is_reference<_Dp>::value, + is_same<_Ep, _Dp>, + is_convertible<_Ep, _Dp>>::type>> unique_ptr(unique_ptr<_Up, _Ep>&& __u) noexcept : _M_t(__u.release(), std::forward<_Ep>(__u.get_deleter())) { } diff --git a/libstdc++-v3/testsuite/20_util/unique_ptr/assign/91308.cc b/libstdc++-v3/testsuite/20_util/unique_ptr/assign/91308.cc new file mode 100644 index 00000000000..6500ea43f02 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/unique_ptr/assign/91308.cc @@ -0,0 +1,46 @@ +// Copyright (C) 2019 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-do compile { target c++11 } } + +#include <memory> + +struct D1 +{ + void operator()(int* p) const noexcept { } +}; + +struct D2 : D1 +{ + D2& operator=(D1&&) noexcept { return *this; } +}; + +void +test01() +{ + std::unique_ptr<int, D1> d1; + std::unique_ptr<int, D2> d2; + d2 = std::move(d1); +} + +void +test02() +{ + std::unique_ptr<int[], D1> d1; + std::unique_ptr<int[], D2> d2; + d2 = std::move(d1); +} -- cgit v1.2.3 From 0e94f4ade616d6539de96f6a90fd7e49a64f2606 Mon Sep 17 00:00:00 2001 From: Jonathan Wakely <jwakely@redhat.com> Date: Fri, 30 Aug 2019 16:12:33 +0000 Subject: Avoid deprecation warning with -Wsystem-headers C++17 says to use std::uncaught_exceptions() here instead of std::uncaught_exception() but since we only care whether the result is non-zero (and we aren't planning to remove the deprecated version) we can just keep using std::uncaught_exception() and suppress the warning. * include/std/ostream (basic_ostream::sentry::~sentry): Suppress deprecation warnings for using uncaught_exception(). git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@275201 138bc75d-0d04-0410-961f-82ee72b054a4 --- libstdc++-v3/ChangeLog | 8 ++++++++ libstdc++-v3/include/std/ostream | 3 +++ 2 files changed, 11 insertions(+) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index a7e7a3506dd..3dc792beb4d 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,11 @@ +2019-08-30 Jonathan Wakely <jwakely@redhat.com> + + Backport from mainline + 2018-08-16 Jonathan Wakely <jwakely@redhat.com> + + * include/std/ostream (basic_ostream::sentry::~sentry): Suppress + deprecation warnings for using uncaught_exception(). + 2019-08-30 Jonathan Wakely <jwakely@redhat.com> Backport from mainline diff --git a/libstdc++-v3/include/std/ostream b/libstdc++-v3/include/std/ostream index 448a9288188..2099294fd92 100644 --- a/libstdc++-v3/include/std/ostream +++ b/libstdc++-v3/include/std/ostream @@ -444,6 +444,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION explicit sentry(basic_ostream<_CharT, _Traits>& __os); +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" /** * @brief Possibly flushes the stream. * @@ -461,6 +463,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _M_os.setstate(ios_base::badbit); } } +#pragma GCC diagnostic pop /** * @brief Quick status checking. -- cgit v1.2.3 From ec07bb345bf7f275b5fc7138af04187afa0f93d1 Mon Sep 17 00:00:00 2001 From: Jonathan Wakely <jwakely@redhat.com> Date: Fri, 30 Aug 2019 16:12:37 +0000 Subject: Avoid redundant runtime checks in std::visit Calling std::get will check some static assertions and also do a runtime check for a valid index before calling __detail::__variant::__get. The std::visit function already handles the case where any variant has an invalid index, so __get can be used directly in __visit_invoke. Backport from mainline 2018-10-02 Jonathan Wakely <jwakely@redhat.com> * include/std/variant (__gen_vtable_impl::__visit_invoke): Call __get directly instead of get, as caller ensures correct index is used. (holds_alternative, get, get_if): Remove redundant inline specifiers. (_VARIANT_RELATION_FUNCTION_TEMPLATE): Likewise. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@275202 138bc75d-0d04-0410-961f-82ee72b054a4 --- libstdc++-v3/ChangeLog | 10 ++++++++++ libstdc++-v3/include/std/variant | 34 ++++++++++++++++------------------ 2 files changed, 26 insertions(+), 18 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 3dc792beb4d..e5e30f8afdd 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,13 @@ +2019-08-30 Jonathan Wakely <jwakely@redhat.com> + + Backport from mainline + 2018-10-02 Jonathan Wakely <jwakely@redhat.com> + + * include/std/variant (__gen_vtable_impl::__visit_invoke): Call __get + directly instead of get, as caller ensures correct index is used. + (holds_alternative, get, get_if): Remove redundant inline specifiers. + (_VARIANT_RELATION_FUNCTION_TEMPLATE): Likewise. + 2019-08-30 Jonathan Wakely <jwakely@redhat.com> Backport from mainline diff --git a/libstdc++-v3/include/std/variant b/libstdc++-v3/include/std/variant index 150d37505bc..3b0099877ab 100644 --- a/libstdc++-v3/include/std/variant +++ b/libstdc++-v3/include/std/variant @@ -809,9 +809,8 @@ namespace __variant { using _Alternative = variant_alternative_t<__index, _Next>; __element = __gen_vtable_impl< - remove_reference_t< - decltype(__element)>, tuple<_Variants...>, - std::index_sequence<__indices..., __index>>::_S_apply(); + remove_reference_t<decltype(__element)>, tuple<_Variants...>, + std::index_sequence<__indices..., __index>>::_S_apply(); } }; @@ -824,11 +823,11 @@ namespace __variant using _Array_type = _Multi_array<_Result_type (*)(_Visitor&&, _Variants...)>; - decltype(auto) - static constexpr __visit_invoke(_Visitor&& __visitor, _Variants... __vars) + static constexpr decltype(auto) + __visit_invoke(_Visitor&& __visitor, _Variants... __vars) { return std::__invoke(std::forward<_Visitor>(__visitor), - std::get<__indices>(std::forward<_Variants>(__vars))...); + __variant::__get<__indices>(std::forward<_Variants>(__vars))...); } static constexpr auto @@ -869,8 +868,8 @@ namespace __variant } // namespace __detail template<typename _Tp, typename... _Types> - inline constexpr bool holds_alternative(const variant<_Types...>& __v) - noexcept + constexpr bool + holds_alternative(const variant<_Types...>& __v) noexcept { static_assert(__detail::__variant::__exactly_once<_Tp, _Types...>, "T should occur for exactly once in alternatives"); @@ -878,7 +877,7 @@ namespace __variant } template<typename _Tp, typename... _Types> - constexpr inline _Tp& get(variant<_Types...>& __v) + constexpr _Tp& get(variant<_Types...>& __v) { static_assert(__detail::__variant::__exactly_once<_Tp, _Types...>, "T should occur for exactly once in alternatives"); @@ -887,7 +886,7 @@ namespace __variant } template<typename _Tp, typename... _Types> - constexpr inline _Tp&& get(variant<_Types...>&& __v) + constexpr _Tp&& get(variant<_Types...>&& __v) { static_assert(__detail::__variant::__exactly_once<_Tp, _Types...>, "T should occur for exactly once in alternatives"); @@ -897,7 +896,7 @@ namespace __variant } template<typename _Tp, typename... _Types> - constexpr inline const _Tp& get(const variant<_Types...>& __v) + constexpr const _Tp& get(const variant<_Types...>& __v) { static_assert(__detail::__variant::__exactly_once<_Tp, _Types...>, "T should occur for exactly once in alternatives"); @@ -906,7 +905,7 @@ namespace __variant } template<typename _Tp, typename... _Types> - constexpr inline const _Tp&& get(const variant<_Types...>&& __v) + constexpr const _Tp&& get(const variant<_Types...>&& __v) { static_assert(__detail::__variant::__exactly_once<_Tp, _Types...>, "T should occur for exactly once in alternatives"); @@ -916,8 +915,7 @@ namespace __variant } template<size_t _Np, typename... _Types> - constexpr inline - add_pointer_t<variant_alternative_t<_Np, variant<_Types...>>> + constexpr add_pointer_t<variant_alternative_t<_Np, variant<_Types...>>> get_if(variant<_Types...>* __ptr) noexcept { using _Alternative_type = variant_alternative_t<_Np, variant<_Types...>>; @@ -930,7 +928,7 @@ namespace __variant } template<size_t _Np, typename... _Types> - constexpr inline + constexpr add_pointer_t<const variant_alternative_t<_Np, variant<_Types...>>> get_if(const variant<_Types...>* __ptr) noexcept { @@ -944,7 +942,7 @@ namespace __variant } template<typename _Tp, typename... _Types> - constexpr inline add_pointer_t<_Tp> + constexpr add_pointer_t<_Tp> get_if(variant<_Types...>* __ptr) noexcept { static_assert(__detail::__variant::__exactly_once<_Tp, _Types...>, @@ -955,7 +953,7 @@ namespace __variant } template<typename _Tp, typename... _Types> - constexpr inline add_pointer_t<const _Tp> + constexpr add_pointer_t<const _Tp> get_if(const variant<_Types...>* __ptr) noexcept { @@ -1287,7 +1285,7 @@ namespace __variant { &__detail::__variant::__erased_##__NAME< \ const variant&, __indices>... }; \ template<size_t... __indices> \ - constexpr inline bool \ + constexpr bool \ _M_##__NAME(const variant& __rhs, \ std::index_sequence<__indices...>) const \ { \ -- cgit v1.2.3 From 8793299eb8e0c629edfabf879e1279d7884d35a0 Mon Sep 17 00:00:00 2001 From: Richard Biener <rguenther@suse.de> Date: Fri, 30 Aug 2019 16:33:05 +0000 Subject: 2019-08-30 Richard Biener <rguenther@suse.de> Backport from mainline 2019-07-08 Richard Biener <rguenther@suse.de> PR tree-optimization/91108 * tree-ssa-sccvn.c: Include builtins.h. (vn_reference_lookup_3): Use only alignment constraints to verify same-valued store disambiguation. * gcc.dg/tree-ssa/pr91091-1.c: New testcase. * gcc.dg/tree-ssa/ssa-fre-78.c: Likewise. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@275206 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 10 ++++++++++ gcc/testsuite/ChangeLog | 10 +++++++++- gcc/testsuite/gcc.dg/tree-ssa/pr91091-1.c | 23 +++++++++++++++++++++++ gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-78.c | 27 +++++++++++++++++++++++++++ gcc/tree-ssa-sccvn.c | 26 +++++++++++--------------- 5 files changed, 80 insertions(+), 16 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/pr91091-1.c create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-78.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 74942db4bba..0dc8dd779f1 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +2019-08-30 Richard Biener <rguenther@suse.de> + + Backport from mainline + 2019-07-08 Richard Biener <rguenther@suse.de> + + PR tree-optimization/91108 + * tree-ssa-sccvn.c: Include builtins.h. + (vn_reference_lookup_3): Use only alignment constraints to + verify same-valued store disambiguation. + 2019-08-30 Segher Boessenkool <segher@kernel.crashing.org> Backport from trunk diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 2df4c1477dd..aa8265c1b8b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,9 +1,17 @@ +2019-08-30 Richard Biener <rguenther@suse.de> + + Backport from mainline + 2019-07-08 Richard Biener <rguenther@suse.de> + + PR tree-optimization/91108 + * gcc.dg/tree-ssa/pr91091-1.c: New testcase. + * gcc.dg/tree-ssa/ssa-fre-78.c: Likewise. + 2019-08-30 Segher Boessenkool <segher@kernel.crashing.org> Backport from trunk 2019-08-23 Segher Boessenkool <segher@kernel.crashing.org> -gcc/testsuite/ PR target/91481 * gcc.target/powerpc/darn-3.c: New testcase. diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr91091-1.c b/gcc/testsuite/gcc.dg/tree-ssa/pr91091-1.c new file mode 100644 index 00000000000..2ee75d9804a --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr91091-1.c @@ -0,0 +1,23 @@ +/* { dg-do run } */ +/* { dg-options "-O3 -fno-strict-aliasing" } */ + +struct s { int x; } __attribute__((packed)); +struct t { int x; }; + +void __attribute__((noinline,noipa)) +swap(struct s* p, struct t* q) +{ + p->x = q->x; + q->x = p->x; +} + +int main() +{ + struct t a[2]; + a[0].x = 0x12345678; + a[1].x = 0x98765432; + swap ((struct s *)((char *)a + 1), a); + if (a[0].x != 0x12345678) + __builtin_abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-78.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-78.c new file mode 100644 index 00000000000..4ad232ea123 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-78.c @@ -0,0 +1,27 @@ +/* { dg-do run } */ +/* { dg-options "-O3 -fstrict-aliasing" } */ + +union U { + struct A { int : 2; int x : 8; } a; + struct B { int : 6; int x : 8; } b; +}; + +int __attribute__((noipa)) +foo (union U *p, union U *q) +{ + p->a.x = 1; + q->b.x = 1; + return p->a.x; +} + +int +main() +{ + union U x; + if (foo (&x, &x) != x.a.x) + __builtin_abort (); + return 0; +} + +/* We support arbitrary punning through unions when it happens through + the union type and thus p == q is valid here. */ diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c index 654127cfbc3..930508deb29 100644 --- a/gcc/tree-ssa-sccvn.c +++ b/gcc/tree-ssa-sccvn.c @@ -69,6 +69,7 @@ along with GCC; see the file COPYING3. If not see #include "tree-cfgcleanup.h" #include "tree-ssa-loop.h" #include "tree-scalar-evolution.h" +#include "builtins.h" #include "tree-ssa-sccvn.h" /* This algorithm is based on the SCC algorithm presented by Keith @@ -1857,23 +1858,11 @@ vn_reference_lookup_3 (ao_ref *ref, tree vuse, void *vr_, /* If we reach a clobbering statement try to skip it and see if we find a VN result with exactly the same value as the possible clobber. In this case we can ignore the clobber - and return the found value. - Note that we don't need to worry about partial overlapping - accesses as we then can use TBAA to disambiguate against the - clobbering statement when looking up a load (thus the - VN_WALKREWRITE guard). */ + and return the found value. */ if (vn_walk_kind == VN_WALKREWRITE && is_gimple_reg_type (TREE_TYPE (lhs)) && types_compatible_p (TREE_TYPE (lhs), vr->type) - /* The overlap restriction breaks down when either access - alias-set is zero. Still for accesses of the size of - an addressable unit there can be no overlaps. Overlaps - between different union members are not an issue since - activation of a union member via a store makes the - values of untouched bytes unspecified. */ - && (known_eq (ref->size, BITS_PER_UNIT) - || (get_alias_set (lhs) != 0 - && ao_ref_alias_set (ref) != 0))) + && ref->ref) { tree *saved_last_vuse_ptr = last_vuse_ptr; /* Do not update last_vuse_ptr in vn_reference_lookup_2. */ @@ -1891,7 +1880,14 @@ vn_reference_lookup_3 (ao_ref *ref, tree vuse, void *vr_, vn_reference_t vnresult = (vn_reference_t) res; if (vnresult->result && operand_equal_p (vnresult->result, - gimple_assign_rhs1 (def_stmt), 0)) + gimple_assign_rhs1 (def_stmt), 0) + /* We have to honor our promise about union type punning + and also support arbitrary overlaps with + -fno-strict-aliasing. So simply resort to alignment to + rule out overlaps. Do this check last because it is + quite expensive compared to the hash-lookup above. */ + && multiple_p (get_object_alignment (ref->ref), ref->size) + && multiple_p (get_object_alignment (lhs), ref->size)) return res; } } -- cgit v1.2.3 From c6faa8d75ae79c7cebc1242b6d0d730a73a04dca Mon Sep 17 00:00:00 2001 From: Richard Biener <rguenther@suse.de> Date: Fri, 30 Aug 2019 16:37:43 +0000 Subject: 2019-08-30 Richard Biener <rguenther@suse.de> Backport from mainline 2019-05-27 Richard Biener <rguenther@suse.de> PR tree-optimization/90637 * tree-ssa-sink.c (statement_sink_location): Honor the computed sink location for single-uses. 2019-06-21 Richard Biener <rguenther@suse.de> PR tree-optimization/90930 * tree-ssa-reassoc.c (rewrite_expr_tree_parallel): Set visited flag on new stmts to avoid re-processing them. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@275207 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 15 +++++++++++++++ gcc/tree-ssa-reassoc.c | 1 + gcc/tree-ssa-sink.c | 5 ++++- 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 0dc8dd779f1..e97edf791f8 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,18 @@ +2019-08-30 Richard Biener <rguenther@suse.de> + + Backport from mainline + 2019-06-21 Richard Biener <rguenther@suse.de> + + PR tree-optimization/90930 + * tree-ssa-reassoc.c (rewrite_expr_tree_parallel): Set visited + flag on new stmts to avoid re-processing them. + + 2019-05-27 Richard Biener <rguenther@suse.de> + + PR tree-optimization/90637 + * tree-ssa-sink.c (statement_sink_location): Honor the + computed sink location for single-uses. + 2019-08-30 Richard Biener <rguenther@suse.de> Backport from mainline diff --git a/gcc/tree-ssa-reassoc.c b/gcc/tree-ssa-reassoc.c index dacb668ff84..9ad3581f85d 100644 --- a/gcc/tree-ssa-reassoc.c +++ b/gcc/tree-ssa-reassoc.c @@ -4769,6 +4769,7 @@ rewrite_expr_tree_parallel (gassign *stmt, int width, else { stmts[i] = build_and_add_sum (TREE_TYPE (last_rhs1), op1, op2, opcode); + gimple_set_visited (stmts[i], true); } if (dump_file && (dump_flags & TDF_DETAILS)) { diff --git a/gcc/tree-ssa-sink.c b/gcc/tree-ssa-sink.c index 0fe8dd0030d..345ed2b0329 100644 --- a/gcc/tree-ssa-sink.c +++ b/gcc/tree-ssa-sink.c @@ -439,7 +439,10 @@ statement_sink_location (gimple *stmt, basic_block frombb, if (sinkbb == frombb) return false; - *togsi = gsi_for_stmt (use); + if (sinkbb == gimple_bb (use)) + *togsi = gsi_for_stmt (use); + else + *togsi = gsi_after_labels (sinkbb); return true; } -- cgit v1.2.3 From ab0a7f13cfe53de32cb7ab773af66f7abb240145 Mon Sep 17 00:00:00 2001 From: Iain Sandoe <iain@sandoe.co.uk> Date: Fri, 30 Aug 2019 19:00:44 +0000 Subject: [Darwin, testsuite] Backport fix for 64895 XPASSes. These tests don't fail on Darwin. 2019-08-30 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline. 2019-05-23 Iain Sandoe <iain@sandoe.co.uk> PR rtl-optimisation/64895 * gcc.target/i386/fuse-caller-save-rec.c: Remove XFAILs. * gcc.target/i386/fuse-caller-save.c: Likewise. * gcc.target/i386/fuse-caller-save-xmm.c: Adjust tests for PIC cases, remove XFAILs. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@275213 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/testsuite/ChangeLog | 11 +++++++++++ gcc/testsuite/gcc.target/i386/fuse-caller-save-rec.c | 8 +++----- gcc/testsuite/gcc.target/i386/fuse-caller-save-xmm.c | 16 +++++++++++----- gcc/testsuite/gcc.target/i386/fuse-caller-save.c | 8 +++----- 4 files changed, 28 insertions(+), 15 deletions(-) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index aa8265c1b8b..b61d11d1fed 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,14 @@ +2019-08-30 Iain Sandoe <iain@sandoe.co.uk> + + Backport from mainline. + 2019-05-23 Iain Sandoe <iain@sandoe.co.uk> + + PR rtl-optimisation/64895 + * gcc.target/i386/fuse-caller-save-rec.c: Remove XFAILs. + * gcc.target/i386/fuse-caller-save.c: Likewise. + * gcc.target/i386/fuse-caller-save-xmm.c: Adjust tests for + PIC cases, remove XFAILs. + 2019-08-30 Richard Biener <rguenther@suse.de> Backport from mainline diff --git a/gcc/testsuite/gcc.target/i386/fuse-caller-save-rec.c b/gcc/testsuite/gcc.target/i386/fuse-caller-save-rec.c index 7abcf91e26d..e8d4efb260e 100644 --- a/gcc/testsuite/gcc.target/i386/fuse-caller-save-rec.c +++ b/gcc/testsuite/gcc.target/i386/fuse-caller-save-rec.c @@ -18,14 +18,12 @@ foo (int y) return y + bar (y); } -/* For !nonpic && ia32 xfails, see PR64895. */ - /* Check that no registers are saved/restored. */ -/* { dg-final { scan-assembler-not "push" { xfail { { ! nonpic } && ia32 } } } } */ -/* { dg-final { scan-assembler-not "pop" { xfail { { ! nonpic } && ia32 } } } } */ +/* { dg-final { scan-assembler-not "push" } } */ +/* { dg-final { scan-assembler-not "pop" } } */ /* Check that addition uses dx. */ -/* { dg-final { scan-assembler-times "addl\t%\[re\]?dx, %\[re\]?ax" 1 { xfail { { ! nonpic } && ia32 } } } } */ +/* { dg-final { scan-assembler-times "addl\t%\[re\]?dx, %\[re\]?ax" 1 } } */ /* Verify that bar is self-recursive. */ /* { dg-final { scan-assembler-times "call\t_?bar" 2 } } */ diff --git a/gcc/testsuite/gcc.target/i386/fuse-caller-save-xmm.c b/gcc/testsuite/gcc.target/i386/fuse-caller-save-xmm.c index c2d0544d665..4deff93c1e8 100644 --- a/gcc/testsuite/gcc.target/i386/fuse-caller-save-xmm.c +++ b/gcc/testsuite/gcc.target/i386/fuse-caller-save-xmm.c @@ -15,13 +15,19 @@ foo (v2df y) return y + bar (y); } -/* For !nonpic && ia32 xfails, see PR64895. */ - /* Check presence of all insns on xmm registers. These checks are expected to pass with both -fipa-ra and -fno-ipa-ra. */ -/* { dg-final { scan-assembler-times "addpd\t\\.?LC0.*, %xmm0" 1 } } */ -/* { dg-final { scan-assembler-times "addpd\t%xmm1, %xmm0" 1 { xfail { { ! nonpic } && ia32 } } } } */ -/* { dg-final { scan-assembler-times "movapd\t%xmm0, %xmm1" 1 { xfail { { ! nonpic } && ia32 } } } } */ + +/* Darwin local constant symbol is "lC0", ELF targets ".LC0" */ +/* { dg-final { scan-assembler-times {addpd\t\.?[Ll]C0.*, %xmm0} 1 { target { { ! ia32 } || nonpic } } } } */ +/* { dg-final { scan-assembler-times {movapd\t\.?[Ll]C0.*, %xmm1} 1 { target { ia32 && { ! nonpic } } } } } */ + +/* We happen to get this for both cases, but in different positions. */ +/* { dg-final { scan-assembler-times "addpd\t%xmm1, %xmm0" 1 } } */ + +/* { dg-final { scan-assembler-times "movapd\t%xmm0, %xmm1" 1 { target { { ! ia32 } || nonpic } } } } */ +/* { dg-final { scan-assembler-times "movapd\t%xmm0, %xmm2" 1 { target { ia32 && { ! nonpic } } } } } */ +/* { dg-final { scan-assembler-times "addpd\t%xmm2, %xmm0" 1 { target { ia32 && { ! nonpic } } } } } */ /* Check absence of save/restore of xmm1 register. */ /* { dg-final { scan-assembler-not "movaps\t%xmm1, \\(%\[re\]?sp\\)" } } */ diff --git a/gcc/testsuite/gcc.target/i386/fuse-caller-save.c b/gcc/testsuite/gcc.target/i386/fuse-caller-save.c index 4b8e68d90f5..c0e8bf443d0 100644 --- a/gcc/testsuite/gcc.target/i386/fuse-caller-save.c +++ b/gcc/testsuite/gcc.target/i386/fuse-caller-save.c @@ -16,11 +16,9 @@ foo (int y) return y + bar (y); } -/* For !nonpic && ia32 xfails, see PR64895. */ - /* Check that no registers are saved/restored. */ -/* { dg-final { scan-assembler-not "push" { xfail { { ! nonpic } && ia32 } } } } */ -/* { dg-final { scan-assembler-not "pop" { xfail { { ! nonpic } && ia32 } } } } */ +/* { dg-final { scan-assembler-not "push" } } */ +/* { dg-final { scan-assembler-not "pop" } } */ /* PR61605. If the first argument register and the return register differ, then bar leaves the first argument register intact. That means in foo that the @@ -31,4 +29,4 @@ foo (int y) /* { dg-final { scan-assembler-not "movl" { target { ! ia32 } } } } */ /* Check that addition uses di (in case of no copy) or dx (in case of copy). */ -/* { dg-final { scan-assembler-times "addl\t%\[re\]?d\[ix\], %\[re\]?ax" 1 { xfail { { ! nonpic } && ia32 } } } } */ +/* { dg-final { scan-assembler-times "addl\t%\[re\]?d\[ix\], %\[re\]?ax" 1 } } */ -- cgit v1.2.3 From 63bab53e325188d84f61d71f9349dd01d57ea410 Mon Sep 17 00:00:00 2001 From: Iain Sandoe <iain@sandoe.co.uk> Date: Fri, 30 Aug 2019 19:07:54 +0000 Subject: [Darwin, X86, testsuite] Disable two tests that cannot pass. Several of the i386.exp target tests cannot pass on Darwin because either the port doesn't support a feature, or the ABI demands sufficiently different codegen that matching the output with scan-asms would require a different test. Disabling those tests here. 2019-08-30 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline. 2019-05-24 Iain Sandoe <iain@sandoe.co.uk> * gcc.target/i386/pr70738-7.c: Likewise. * gcc.target/i386/pr24414.c: Likewise. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@275214 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/testsuite/ChangeLog | 8 ++++++++ gcc/testsuite/gcc.target/i386/pr24414.c | 1 + gcc/testsuite/gcc.target/i386/pr70738-7.c | 2 +- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b61d11d1fed..2db1be76299 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2019-08-30 Iain Sandoe <iain@sandoe.co.uk> + + Backport from mainline. + 2019-05-24 Iain Sandoe <iain@sandoe.co.uk> + + * gcc.target/i386/pr70738-7.c: Likewise. + * gcc.target/i386/pr24414.c: Likewise. + 2019-08-30 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline. diff --git a/gcc/testsuite/gcc.target/i386/pr24414.c b/gcc/testsuite/gcc.target/i386/pr24414.c index bd12f0c8492..0acaa001a5c 100644 --- a/gcc/testsuite/gcc.target/i386/pr24414.c +++ b/gcc/testsuite/gcc.target/i386/pr24414.c @@ -1,5 +1,6 @@ /* { dg-do run } */ /* { dg-options "-O2" } */ +/* { dg-skip-if "asm insert mismatches ABI for Darwin" { *-*-darwin* } } */ int test; int diff --git a/gcc/testsuite/gcc.target/i386/pr70738-7.c b/gcc/testsuite/gcc.target/i386/pr70738-7.c index 2e5b49f619d..ee9dfbfb35f 100644 --- a/gcc/testsuite/gcc.target/i386/pr70738-7.c +++ b/gcc/testsuite/gcc.target/i386/pr70738-7.c @@ -1,4 +1,4 @@ -/* { dg-do compile { target ia32 } } */ +/* { dg-do compile { target { ia32 && { ! *-*-darwin* } } } } */ /* { dg-options "-msse2 -mgeneral-regs-only" } */ extern float a, b, c; -- cgit v1.2.3 From 0d5fb18e154d4fbd7d43ce325aa1a4485d697b16 Mon Sep 17 00:00:00 2001 From: Iain Sandoe <iain@sandoe.co.uk> Date: Fri, 30 Aug 2019 19:12:36 +0000 Subject: [Darwin, X86, testsuite] Adjust test labels. A couple of the i386.exp tests fail because the label spelling used is different between ELF and Mach-O targets. Adjusted here. 2019-08-30 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline. 2019-05-24 Iain Sandoe <iain@sandoe.co.uk> * gcc.target/i386/pr67985-2.c: Adjust label checks for Darwin. * gcc.target/i386/pr77881.c: Likewise. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@275215 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/testsuite/ChangeLog | 9 +++++++++ gcc/testsuite/gcc.target/i386/pr67985-2.c | 2 +- gcc/testsuite/gcc.target/i386/pr77881.c | 4 ++-- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 2db1be76299..ccdbb2bc614 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,12 @@ +2019-08-30 Iain Sandoe <iain@sandoe.co.uk> + + Backport from mainline. + 2019-05-24 Iain Sandoe <iain@sandoe.co.uk> + + * gcc.target/i386/pr67985-2.c: Adjust label checks for + Darwin. + * gcc.target/i386/pr77881.c: Likewise. + 2019-08-30 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline. diff --git a/gcc/testsuite/gcc.target/i386/pr67985-2.c b/gcc/testsuite/gcc.target/i386/pr67985-2.c index 9c7a25ad177..a45815af66e 100644 --- a/gcc/testsuite/gcc.target/i386/pr67985-2.c +++ b/gcc/testsuite/gcc.target/i386/pr67985-2.c @@ -10,4 +10,4 @@ foo (float x, float y) /* { dg-final { scan-assembler-not "mulss" } } */ /* { dg-final { scan-assembler-not "movl\[ \t\].*, %eax" } } */ -/* { dg-final { scan-assembler "call\[ \t\]__mulsf3" } } */ +/* { dg-final { scan-assembler "call\[ \t\]_?__mulsf3" } } */ diff --git a/gcc/testsuite/gcc.target/i386/pr77881.c b/gcc/testsuite/gcc.target/i386/pr77881.c index 80d143f2bc5..6803341568f 100644 --- a/gcc/testsuite/gcc.target/i386/pr77881.c +++ b/gcc/testsuite/gcc.target/i386/pr77881.c @@ -8,5 +8,5 @@ foo (long long int a, long long int a2, int b) if (a < 0 || b) baz (); } -/* { dg-final { scan-assembler "js\[ \t\]\.L" } } */ -/* { dg-final { scan-assembler "jne\[ \t\]\.L" } } */ +/* { dg-final { scan-assembler "js\[ \t\]\.?L" } } */ +/* { dg-final { scan-assembler "jne\[ \t\]\.?L" } } */ -- cgit v1.2.3 From 29ea2f846e4fef4d724a890d98e6d40f44583ed7 Mon Sep 17 00:00:00 2001 From: Iain Sandoe <iain@sandoe.co.uk> Date: Fri, 30 Aug 2019 19:19:59 +0000 Subject: [Darwin/Linux, X86, testsuite] Adjust match strings. Some of the i386.exp tests fail on Darwin (and at least one passes incorrectly on Linux) because their scan-asm match strings are too general. In some cases the strings also match instances in the .file and size directives or in comment output. This patch makes the match strings more specific. 2019-08-30 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline. 2019-05-24 Iain Sandoe <iain@sandoe.co.uk> * gcc.target/i386/pconfig-1.c: Scan for the string in the generated code, not in comments or miscellaneous directives. * gcc.target/i386/wbinvd-1.c: Likewise. * gcc.target/i386/wbnoinvd-1.c: Likewise. * gcc.target/i386/pr66819-3.c: Specifically, check that there is no call to "bar". * gcc.target/i386/pr66819-4.c: Likewise. * gcc.target/i386/pr82662.c git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@275216 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/testsuite/ChangeLog | 14 ++++++++++++++ gcc/testsuite/gcc.target/i386/pconfig-1.c | 2 +- gcc/testsuite/gcc.target/i386/pr66819-3.c | 2 +- gcc/testsuite/gcc.target/i386/pr66819-4.c | 2 +- gcc/testsuite/gcc.target/i386/pr82662.c | 2 +- gcc/testsuite/gcc.target/i386/wbinvd-1.c | 2 +- gcc/testsuite/gcc.target/i386/wbnoinvd-1.c | 2 +- 7 files changed, 20 insertions(+), 6 deletions(-) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ccdbb2bc614..46b1cf24972 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,17 @@ +2019-08-30 Iain Sandoe <iain@sandoe.co.uk> + + Backport from mainline. + 2019-05-24 Iain Sandoe <iain@sandoe.co.uk> + + * gcc.target/i386/pconfig-1.c: Scan for the string in the generated + code, not in comments or miscellaneous directives. + * gcc.target/i386/wbinvd-1.c: Likewise. + * gcc.target/i386/wbnoinvd-1.c: Likewise. + * gcc.target/i386/pr66819-3.c: Specifically, check that there is no + call to "bar". + * gcc.target/i386/pr66819-4.c: Likewise. + * gcc.target/i386/pr82662.c + 2019-08-30 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline. diff --git a/gcc/testsuite/gcc.target/i386/pconfig-1.c b/gcc/testsuite/gcc.target/i386/pconfig-1.c index a3fc4f411fe..40b4c0c1272 100644 --- a/gcc/testsuite/gcc.target/i386/pconfig-1.c +++ b/gcc/testsuite/gcc.target/i386/pconfig-1.c @@ -1,6 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-O2 -mpconfig" } */ -/* { dg-final { scan-assembler-times "pconfig" 5 } } */ +/* { dg-final { scan-assembler-times {\tpconfig} 2 } } */ #include <x86intrin.h> diff --git a/gcc/testsuite/gcc.target/i386/pr66819-3.c b/gcc/testsuite/gcc.target/i386/pr66819-3.c index 3bc5a3471e6..76e3726b38a 100644 --- a/gcc/testsuite/gcc.target/i386/pr66819-3.c +++ b/gcc/testsuite/gcc.target/i386/pr66819-3.c @@ -1,6 +1,6 @@ /* { dg-do compile { target ia32 } } */ /* { dg-options "-O2 -mregparm=3" } */ -/* { dg-final { scan-assembler-not "call" } } */ +/* { dg-final { scan-assembler-not {call[ \t]+_?bar} } } */ void (*bar)(int, int); diff --git a/gcc/testsuite/gcc.target/i386/pr66819-4.c b/gcc/testsuite/gcc.target/i386/pr66819-4.c index 18b2ccf8120..143360d0de3 100644 --- a/gcc/testsuite/gcc.target/i386/pr66819-4.c +++ b/gcc/testsuite/gcc.target/i386/pr66819-4.c @@ -1,6 +1,6 @@ /* { dg-do compile { target ia32 } } */ /* { dg-options "-O2 -mregparm=3" } */ -/* { dg-final { scan-assembler-not "call" } } */ +/* { dg-final { scan-assembler-not {call[ \t]+_?bar} } } */ #include <stdarg.h> diff --git a/gcc/testsuite/gcc.target/i386/pr82662.c b/gcc/testsuite/gcc.target/i386/pr82662.c index 8a9332b5c5b..ec08edc9824 100644 --- a/gcc/testsuite/gcc.target/i386/pr82662.c +++ b/gcc/testsuite/gcc.target/i386/pr82662.c @@ -23,4 +23,4 @@ int f9 (S x, S y) { return x >= y; } int f10 (S x, S y) { return x < y; } int f11 (S x, S y) { return x <= y; } -/* { dg-final { scan-assembler-times {\mset} 12 } } */ +/* { dg-final { scan-assembler-times {\tset} 12 } } */ diff --git a/gcc/testsuite/gcc.target/i386/wbinvd-1.c b/gcc/testsuite/gcc.target/i386/wbinvd-1.c index 7854cc22679..9290d9b1945 100644 --- a/gcc/testsuite/gcc.target/i386/wbinvd-1.c +++ b/gcc/testsuite/gcc.target/i386/wbinvd-1.c @@ -1,6 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-O2" } */ -/* { dg-final { scan-assembler-times "wbinvd" 2 } } */ +/* { dg-final { scan-assembler-times {\twbinvd} 1 } } */ #include "immintrin.h" diff --git a/gcc/testsuite/gcc.target/i386/wbnoinvd-1.c b/gcc/testsuite/gcc.target/i386/wbnoinvd-1.c index bda84cd4c94..697f148b26c 100644 --- a/gcc/testsuite/gcc.target/i386/wbnoinvd-1.c +++ b/gcc/testsuite/gcc.target/i386/wbnoinvd-1.c @@ -1,6 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-O2 -mwbnoinvd" } */ -/* { dg-final { scan-assembler-times "wbnoinvd" 2 } } */ +/* { dg-final { scan-assembler-times {\twbnoinvd} 1 } } */ #include "x86intrin.h" -- cgit v1.2.3 From 214c2e3d282440f77aad0b355f9108a799bbd67b Mon Sep 17 00:00:00 2001 From: Iain Sandoe <iain@sandoe.co.uk> Date: Fri, 30 Aug 2019 19:24:45 +0000 Subject: [Darwin, X86, testsuite] Require alias support on a test. 2019-08-30 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline. 2019-05-25 Iain Sandoe <iain@sandoe.co.uk> * gcc.target/i386/pr82659-3.c: Require alias support. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@275217 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/testsuite/ChangeLog | 7 +++++++ gcc/testsuite/gcc.target/i386/pr82659-3.c | 1 + 2 files changed, 8 insertions(+) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 46b1cf24972..6d9d55983c4 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2019-08-30 Iain Sandoe <iain@sandoe.co.uk> + + Backport from mainline. + 2019-05-25 Iain Sandoe <iain@sandoe.co.uk> + + * gcc.target/i386/pr82659-3.c: Require alias support. + 2019-08-30 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline. diff --git a/gcc/testsuite/gcc.target/i386/pr82659-3.c b/gcc/testsuite/gcc.target/i386/pr82659-3.c index 3bb83e309e7..a2d97d9b70c 100644 --- a/gcc/testsuite/gcc.target/i386/pr82659-3.c +++ b/gcc/testsuite/gcc.target/i386/pr82659-3.c @@ -1,4 +1,5 @@ /* { dg-do compile } */ +/* { dg-require-alias "" } */ /* { dg-options "-O2 -fcf-protection" } */ /* { dg-final { scan-assembler-times {\mendbr} 2 } } */ -- cgit v1.2.3 From 767b2adcc2d31055996aa55ba0505119065a652e Mon Sep 17 00:00:00 2001 From: Iain Sandoe <iain@sandoe.co.uk> Date: Fri, 30 Aug 2019 19:33:08 +0000 Subject: [Darwin, X86, testsuite] Amend popcnt spelling for Darwin. Darwin uses a different spelling for popcnt (popcnt instead of popcntw). Check for this in the test. 2019-08-30 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline. 2019-05-25 Iain Sandoe <iain@sandoe.co.uk> * gcc.target/i386/pr59874-3.c: Use the spelling of popcnt expected for Darwin. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@275218 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/testsuite/ChangeLog | 8 ++++++++ gcc/testsuite/gcc.target/i386/pr59874-3.c | 3 ++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 6d9d55983c4..71f37e7d0d8 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2019-08-30 Iain Sandoe <iain@sandoe.co.uk> + + Backport from mainline. + 2019-05-25 Iain Sandoe <iain@sandoe.co.uk> + + * gcc.target/i386/pr59874-3.c: Use the spelling of popcnt + expected for Darwin. + 2019-08-30 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline. diff --git a/gcc/testsuite/gcc.target/i386/pr59874-3.c b/gcc/testsuite/gcc.target/i386/pr59874-3.c index ec55a12e2a0..0332f04a977 100644 --- a/gcc/testsuite/gcc.target/i386/pr59874-3.c +++ b/gcc/testsuite/gcc.target/i386/pr59874-3.c @@ -1,7 +1,8 @@ /* PR target/59874 */ /* { dg-do compile } */ /* { dg-options "-O2 -mpopcnt -masm=att" } */ -/* { dg-final { scan-assembler "popcntw" } } */ +/* { dg-final { scan-assembler "\tpopcntw" { target { ! *-*-darwin* } } } } */ +/* { dg-final { scan-assembler "\tpopcnt" { target *-*-darwin* } } } */ unsigned int foo (unsigned short x) -- cgit v1.2.3 From 5cd165f3af76801380023175bdf64e173af1eed5 Mon Sep 17 00:00:00 2001 From: Iain Sandoe <iain@sandoe.co.uk> Date: Fri, 30 Aug 2019 19:36:24 +0000 Subject: [Darwin, X86, testsuite] Backport fixes for three PIE tests. Darwin requires PIC code in order to support PIE, amend the test scan-asms to match this. 2019-08-30 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline. 2019-05-26 Iain Sandoe <iain@sandoe.co.uk> * gcc.target/i386/pr39013-1.c: Adjust scan-asms for PIE to account for PIC code on Darwin. * gcc.target/i386/pr39013-2.c: Likewise. * gcc.target/i386/pr64317.c: Likewise. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@275219 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/testsuite/ChangeLog | 10 ++++++++++ gcc/testsuite/gcc.target/i386/pr39013-1.c | 8 ++++++-- gcc/testsuite/gcc.target/i386/pr39013-2.c | 8 ++++++-- gcc/testsuite/gcc.target/i386/pr64317.c | 11 ++++++++--- 4 files changed, 30 insertions(+), 7 deletions(-) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 71f37e7d0d8..baff9a25a27 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,13 @@ +2019-08-30 Iain Sandoe <iain@sandoe.co.uk> + + Backport from mainline. + 2019-05-26 Iain Sandoe <iain@sandoe.co.uk> + + * gcc.target/i386/pr39013-1.c: Adjust scan-asms for PIE to + account for PIC code on Darwin. + * gcc.target/i386/pr39013-2.c: Likewise. + * gcc.target/i386/pr64317.c: Likewise. + 2019-08-30 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline. diff --git a/gcc/testsuite/gcc.target/i386/pr39013-1.c b/gcc/testsuite/gcc.target/i386/pr39013-1.c index ac22746772b..78b17028a11 100644 --- a/gcc/testsuite/gcc.target/i386/pr39013-1.c +++ b/gcc/testsuite/gcc.target/i386/pr39013-1.c @@ -12,5 +12,9 @@ main (void) return foo () + bar (); } -/* { dg-final { scan-assembler "foo@PLT" } } */ -/* { dg-final { scan-assembler "bar@PLT" } } */ +/* { dg-final { scan-assembler "foo@PLT" { target { ! *-*-darwin* } } } } */ +/* { dg-final { scan-assembler "bar@PLT" { target { ! *-*-darwin* } } } } */ + +/* Darwin's dynamic linker does PIE without indirection. */ +/* { dg-final { scan-assembler {call[ \t]_foo} { target *-*-darwin* } } } */ +/* { dg-final { scan-assembler {call[ \t]_bar} { target *-*-darwin* } } } */ diff --git a/gcc/testsuite/gcc.target/i386/pr39013-2.c b/gcc/testsuite/gcc.target/i386/pr39013-2.c index 3040d81a44d..f4412909bfe 100644 --- a/gcc/testsuite/gcc.target/i386/pr39013-2.c +++ b/gcc/testsuite/gcc.target/i386/pr39013-2.c @@ -12,5 +12,9 @@ main (void) return foo () + bar (); } -/* { dg-final { scan-assembler "foo@PLT" } } */ -/* { dg-final { scan-assembler "bar@PLT" } } */ +/* { dg-final { scan-assembler "foo@PLT" { target { ! *-*-darwin* } } } } */ +/* { dg-final { scan-assembler "bar@PLT" { target { ! *-*-darwin* } } } } */ + +/* Darwin's dynamic linker does PIE without indirection. */ +/* { dg-final { scan-assembler {call[ \t]_foo} { target *-*-darwin* } } } */ +/* { dg-final { scan-assembler {call[ \t]_bar} { target *-*-darwin* } } } */ diff --git a/gcc/testsuite/gcc.target/i386/pr64317.c b/gcc/testsuite/gcc.target/i386/pr64317.c index 9e13da63885..3fbdccd36f2 100644 --- a/gcc/testsuite/gcc.target/i386/pr64317.c +++ b/gcc/testsuite/gcc.target/i386/pr64317.c @@ -2,9 +2,14 @@ /* { dg-require-effective-target ia32 } */ /* { dg-require-effective-target pie } */ /* { dg-options "-O2 -fpie" } */ -/* { dg-final { scan-assembler "addl\[ \\t\]+\[$\]_GLOBAL_OFFSET_TABLE_, %ebx" } } */ -/* { dg-final { scan-assembler "movl\[ \\t\]+c@GOTOFF\[(\]%ebx\[)\]" } } */ -/* { dg-final { scan-assembler-not "movl\[ \\t\]+\[0-9]+\[(\]%esp\[)\], %ebx" } } */ +/* { dg-final { scan-assembler "addl\[ \\t\]+\[$\]_GLOBAL_OFFSET_TABLE_, %ebx" { target { ! *-*-darwin* } } } } */ +/* { dg-final { scan-assembler "movl\[ \\t\]+c@GOTOFF\[(\]%ebx\[)\]" { target { ! *-*-darwin* } } } } */ +/* { dg-final { scan-assembler-not "movl\[ \\t\]+\[0-9]+\[(\]%esp\[)\], %ebx" { target { ! *-*-darwin* } } } } */ + +/* Check PIC access to c and t1 on Darwin (PIC is default, needed for PIE). */ +/* { dg-final { scan-assembler {_c-L1\$pb\(%} { target *-*-darwin* } } } */ +/* { dg-final { scan-assembler {_t1.[0-9]+-L1\$pb\(%} { target *-*-darwin* } } } */ + long c = 1; int bar(); -- cgit v1.2.3 From 32a395c177a028a2e76644e8f0930b70863702e6 Mon Sep 17 00:00:00 2001 From: Iain Sandoe <iain@sandoe.co.uk> Date: Fri, 30 Aug 2019 19:48:34 +0000 Subject: [Darwin, X86, testsuite] Arrange to match Linux codegen. For this test, we can match the codegen expected in the scan-asms by avoiding the extra indirection that's mandated by the ABI for common access and by using -mdynamic-no-pic for the 32b case. 2019-08-30 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline. 2019-05-27 Iain Sandoe <iain@sandoe.co.uk> * gcc.target/i386/pr22076.c: Adjust options to match codegen expected by the scan-asms. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@275220 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/testsuite/ChangeLog | 8 ++++++++ gcc/testsuite/gcc.target/i386/pr22076.c | 2 ++ 2 files changed, 10 insertions(+) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index baff9a25a27..3d25a795425 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2019-08-30 Iain Sandoe <iain@sandoe.co.uk> + + Backport from mainline. + 2019-05-27 Iain Sandoe <iain@sandoe.co.uk> + + * gcc.target/i386/pr22076.c: Adjust options to + match codegen expected by the scan-asms. + 2019-08-30 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline. diff --git a/gcc/testsuite/gcc.target/i386/pr22076.c b/gcc/testsuite/gcc.target/i386/pr22076.c index 6c1620b4a3b..d31ffa584b4 100644 --- a/gcc/testsuite/gcc.target/i386/pr22076.c +++ b/gcc/testsuite/gcc.target/i386/pr22076.c @@ -1,6 +1,8 @@ /* { dg-do compile } */ /* { dg-options "-O2 -fomit-frame-pointer -flax-vector-conversions -mmmx" } */ /* { dg-additional-options "-mno-vect8-ret-in-mem" { target *-*-vxworks* } } */ +/* { dg-additional-options "-fno-common" { target *-*-darwin* } } */ +/* { dg-additional-options "-mdynamic-no-pic" { target { ia32 && *-*-darwin* } } } */ #include <mmintrin.h> -- cgit v1.2.3 From 4b28afa6752f20e46b4ee77f0791a50904f0faa7 Mon Sep 17 00:00:00 2001 From: Iain Sandoe <iain@sandoe.co.uk> Date: Fri, 30 Aug 2019 19:53:51 +0000 Subject: [X86, testsuite] Require native TLS where it's used. 2019-08-30 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline. 2019-05-30 Iain Sandoe <iain@sandoe.co.uk> * gcc.target/i386/stack-prot-sym.c: Require native TLS support. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@275221 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/testsuite/ChangeLog | 7 +++++++ gcc/testsuite/gcc.target/i386/stack-prot-sym.c | 1 + 2 files changed, 8 insertions(+) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 3d25a795425..d32c1d776ee 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2019-08-30 Iain Sandoe <iain@sandoe.co.uk> + + Backport from mainline. + 2019-05-30 Iain Sandoe <iain@sandoe.co.uk> + + * gcc.target/i386/stack-prot-sym.c: Require native TLS support. + 2019-08-30 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline. diff --git a/gcc/testsuite/gcc.target/i386/stack-prot-sym.c b/gcc/testsuite/gcc.target/i386/stack-prot-sym.c index 7f63424c55f..dcd7cbd38be 100644 --- a/gcc/testsuite/gcc.target/i386/stack-prot-sym.c +++ b/gcc/testsuite/gcc.target/i386/stack-prot-sym.c @@ -1,4 +1,5 @@ /* { dg-do compile } */ +/* { dg-require-effective-target tls_native } */ /* { dg-options "-O2 -fstack-protector-all -mstack-protector-guard=tls -mstack-protector-guard-reg=gs -mstack-protector-guard-symbol=my_guard" } */ void f(void) { } -- cgit v1.2.3 From 8ffaf3f0e850f3b69a8c833f1a9c8e7be159b936 Mon Sep 17 00:00:00 2001 From: Iain Sandoe <iain@sandoe.co.uk> Date: Fri, 30 Aug 2019 19:57:49 +0000 Subject: [c++, testsuite] Require alias support for a test. The test for pr84497 uses a facility that requires alias support from the target, and therefore fails on targets without. Add a suitable dg-require statement. 2019-08-30 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline. 2019-05-31 Iain Sandoe <iain@sandoe.co.uk> * g++.dg/cpp0x/pr84497.C: Require alias support. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@275222 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/testsuite/ChangeLog | 7 +++++++ gcc/testsuite/g++.dg/cpp0x/pr84497.C | 1 + 2 files changed, 8 insertions(+) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index d32c1d776ee..8a00b7a2be2 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2019-08-30 Iain Sandoe <iain@sandoe.co.uk> + + Backport from mainline. + 2019-05-31 Iain Sandoe <iain@sandoe.co.uk> + + * g++.dg/cpp0x/pr84497.C: Require alias support. + 2019-08-30 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline. diff --git a/gcc/testsuite/g++.dg/cpp0x/pr84497.C b/gcc/testsuite/g++.dg/cpp0x/pr84497.C index cb9d233bf71..ea7cea47a81 100644 --- a/gcc/testsuite/g++.dg/cpp0x/pr84497.C +++ b/gcc/testsuite/g++.dg/cpp0x/pr84497.C @@ -1,6 +1,7 @@ // PR 84497 mismatch with thread constructor fn weakness // { dg-do compile { target c++11 } } // { dg-require-weak "" } +// { dg-require-alias "" } struct Base { -- cgit v1.2.3 From 548ee8ee1a706a2fe42f72502997061e7c6d7a9b Mon Sep 17 00:00:00 2001 From: Iain Sandoe <iain@sandoe.co.uk> Date: Fri, 30 Aug 2019 20:02:13 +0000 Subject: [Darwin, X86, testsuite] Add xfails for PR90698. We don't have support for -mcmodel={medium, large, kernel} so don't expect tests for those things to work. For now mark them as xfail where possible and skip where that isn't. These changes will be logged onto the PR and therefore can be backed out when the facility is implemented. 2019-08-30 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline. 2019-06-01 Iain Sandoe <iain@sandoe.co.uk> PR target/90698 * gcc.target/i386/pr49866.c: XFAIL for Darwin. * gcc.target/i386/pr63538.c: Likewise. * gcc.target/i386/pr61599-1.c: Skip for Darwin. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@275224 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/testsuite/ChangeLog | 10 ++++++++++ gcc/testsuite/gcc.target/i386/pr49866.c | 1 + gcc/testsuite/gcc.target/i386/pr61599-1.c | 1 + gcc/testsuite/gcc.target/i386/pr63538.c | 4 ++-- 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 8a00b7a2be2..b7f91afecf0 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,13 @@ +2019-08-30 Iain Sandoe <iain@sandoe.co.uk> + + Backport from mainline. + 2019-06-01 Iain Sandoe <iain@sandoe.co.uk> + + PR target/90698 + * gcc.target/i386/pr49866.c: XFAIL for Darwin. + * gcc.target/i386/pr63538.c: Likewise. + * gcc.target/i386/pr61599-1.c: Skip for Darwin. + 2019-08-30 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline. diff --git a/gcc/testsuite/gcc.target/i386/pr49866.c b/gcc/testsuite/gcc.target/i386/pr49866.c index 622c8f65625..7c80f13ca3a 100644 --- a/gcc/testsuite/gcc.target/i386/pr49866.c +++ b/gcc/testsuite/gcc.target/i386/pr49866.c @@ -1,5 +1,6 @@ /* PR target/49866 */ /* { dg-do assemble { target lp64 } } */ +/* { dg-xfail-if "PR90698" { *-*-darwin* } } */ /* { dg-options "-O2 -mcmodel=large" } */ void fn (void *, int, int); diff --git a/gcc/testsuite/gcc.target/i386/pr61599-1.c b/gcc/testsuite/gcc.target/i386/pr61599-1.c index 71b1c2f02dd..52fea393d60 100644 --- a/gcc/testsuite/gcc.target/i386/pr61599-1.c +++ b/gcc/testsuite/gcc.target/i386/pr61599-1.c @@ -1,5 +1,6 @@ /* PR target/61599 */ /* { dg-do run { target lp64 } } */ +/* { dg-skip-if "PR90698" { *-*-darwin* } } */ /* { dg-additional-sources pr61599-2.c } */ /* { dg-options "-mcmodel=medium -fdata-sections" } */ diff --git a/gcc/testsuite/gcc.target/i386/pr63538.c b/gcc/testsuite/gcc.target/i386/pr63538.c index 7b979c35d81..87d5d3e040f 100644 --- a/gcc/testsuite/gcc.target/i386/pr63538.c +++ b/gcc/testsuite/gcc.target/i386/pr63538.c @@ -9,5 +9,5 @@ char *foo () { return str; } - -/* { dg-final { scan-assembler "movabs" } } */ +/* See PR90698 re. Darwin xfail. */ +/* { dg-final { scan-assembler "movabs" { xfail { *-*-darwin* } } } } */ -- cgit v1.2.3 From f9ef03c6938251b644120800452e357f9c01d38b Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Sat, 31 Aug 2019 00:16:40 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@275233 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 53042e90b9a..dcfd94e23ba 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190830 +20190831 -- cgit v1.2.3 From 0a0bf04870584915b9b876c845ad0bb870a2b95e Mon Sep 17 00:00:00 2001 From: Segher Boessenkool <segher@kernel.crashing.org> Date: Sat, 31 Aug 2019 18:58:04 +0000 Subject: rs6000: Fix darn-3.c for GCC 8 and GCC 7 Apparently I didn't properly test the testcase backport to GCC 8 and GCC 7. This makes it not fail there. PR target/91481 * gcc.target/powerpc/darn-3.c: Fix testcase. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@275244 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.target/powerpc/darn-3.c | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b7f91afecf0..6b69cab402d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-08-31 Segher Boessenkool <segher@kernel.crashing.org> + + PR target/91481 + * gcc.target/powerpc/darn-3.c: Fix testcase. + 2019-08-30 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline. diff --git a/gcc/testsuite/gcc.target/powerpc/darn-3.c b/gcc/testsuite/gcc.target/powerpc/darn-3.c index 477901fde70..96ac21fc58c 100644 --- a/gcc/testsuite/gcc.target/powerpc/darn-3.c +++ b/gcc/testsuite/gcc.target/powerpc/darn-3.c @@ -1,6 +1,7 @@ /* { dg-do compile { target { powerpc*-*-* } } } */ /* { dg-skip-if "" { powerpc*-*-aix* } } */ -/* { dg-options "-O2 -mdejagnu-cpu=power9" } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */ +/* { dg-options "-O2 -mcpu=power9" } */ static int darn32(void) { return __builtin_darn_32(); } -- cgit v1.2.3 From 7c177fa6e6ddd6e1a03ad35ee0ff8cdec7e38558 Mon Sep 17 00:00:00 2001 From: Iain Sandoe <iain@sandoe.co.uk> Date: Sat, 31 Aug 2019 19:19:45 +0000 Subject: [Darwin, c++, testsuite] Adjust alignas4.C for Darwin's asm syntax. Darwin produces aligned zerofill directives for the objects represented. We can scan for these using lp64 and ilp32 to catch operation on both X86 and PowerPC ports (the test is for the alignment which is the trailing value in the zerofill directive, as a power of two). 2019-08-31 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline. 2019-06-06 Iain Sandoe <iain@sandoe.co.uk> * g++.dg/cpp0x/alignas4.C: Amend test to check for zerofill syntax on Darwin. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@275247 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/testsuite/ChangeLog | 8 ++++++++ gcc/testsuite/g++.dg/cpp0x/alignas4.C | 8 +++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 6b69cab402d..99df0f53d68 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2019-08-31 Iain Sandoe <iain@sandoe.co.uk> + + Backport from mainline. + 2019-06-06 Iain Sandoe <iain@sandoe.co.uk> + + * g++.dg/cpp0x/alignas4.C: Amend test to check for zerofill syntax + on Darwin. + 2019-08-31 Segher Boessenkool <segher@kernel.crashing.org> PR target/91481 diff --git a/gcc/testsuite/g++.dg/cpp0x/alignas4.C b/gcc/testsuite/g++.dg/cpp0x/alignas4.C index b66fa651bc2..1ef48707586 100644 --- a/gcc/testsuite/g++.dg/cpp0x/alignas4.C +++ b/gcc/testsuite/g++.dg/cpp0x/alignas4.C @@ -1,7 +1,13 @@ // PR c++/59012 // { dg-do compile { target c++11 } } // { dg-final { scan-assembler "align 8" { target { { i?86-*-* x86_64-*-* } && { { ! ia32 } && { ! *-*-darwin* } } } } } } -// { dg-final { scan-assembler "align 4" { target ia32 } } } +// { dg-final { scan-assembler "align 4" { target { ia32 && { ! *-*-darwin* } } } } } + +// Darwin produces aligned .zerofill directives for these. +// { dg-final { scan-assembler {zerofill[^\n\r]+_a,4,2} { target { ilp32 && *-*-darwin* } } } } +// { dg-final { scan-assembler {zerofill[^\n\r]+_a,8,3} { target { lp64 && *-*-darwin* } } } } +// { dg-final { scan-assembler {zerofill[^\n\r]+_a2,4,2} { target { ilp32 && *-*-darwin* } } } } +// { dg-final { scan-assembler {zerofill[^\n\r]+_a2,8,3} { target { lp64 && *-*-darwin* } } } } template <class... T> struct A -- cgit v1.2.3 From f65adc6a9b65ca9844421f2562a12ad6711c0cf3 Mon Sep 17 00:00:00 2001 From: Iain Sandoe <iain@sandoe.co.uk> Date: Sat, 31 Aug 2019 19:23:54 +0000 Subject: [Darwin, testsuite] Fix PR 65364 (uninit-19.c). This test currently fails on Darwin, because the port inlines fn2 for both PIC (and non-pic for m32). Fixed by adjusting the target condition. 2019-08-31 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline. 2019-06-11 Iain Sandoe <iain@sandoe.co.uk> PR testsuite/65364 * gcc.dg/uninit-19.c (fn1): Adjust target condition for Darwin. (fn2): Likewise. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@275248 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/testsuite/ChangeLog | 9 +++++++++ gcc/testsuite/gcc.dg/uninit-19.c | 4 ++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 99df0f53d68..150ee9841c7 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,12 @@ +2019-08-31 Iain Sandoe <iain@sandoe.co.uk> + + Backport from mainline. + 2019-06-11 Iain Sandoe <iain@sandoe.co.uk> + + PR testsuite/65364 + * gcc.dg/uninit-19.c (fn1): Adjust target condition for Darwin. + (fn2): Likewise. + 2019-08-31 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline. diff --git a/gcc/testsuite/gcc.dg/uninit-19.c b/gcc/testsuite/gcc.dg/uninit-19.c index 094dc0eb73d..553991e4dd9 100644 --- a/gcc/testsuite/gcc.dg/uninit-19.c +++ b/gcc/testsuite/gcc.dg/uninit-19.c @@ -12,7 +12,7 @@ fn1 (int p1, float *f1, float *f2, float *f3, unsigned char *c1, float *f4, { if (p1 & 8) b[3] = p10[a]; - /* { dg-warning "may be used uninitialized" "" { target { { nonpic } || { hppa*64*-*-* } } } .-1 } */ + /* { dg-warning "may be used uninitialized" "" { target { { nonpic } || { hppa*64*-*-* *-*-darwin* } } } .-1 } */ } void @@ -22,5 +22,5 @@ fn2 () if (l & 6) n = &c + m; fn1 (l, &d, &e, &g, &i, &h, &k, n); - /* { dg-warning "may be used uninitialized" "" { target { ! { { nonpic } || { hppa*64*-*-* } } } } .-1 } */ + /* { dg-warning "may be used uninitialized" "" { target { ! { { nonpic } || { hppa*64*-*-* *-*-darwin* } } } } .-1 } */ } -- cgit v1.2.3 From 568adefd0d165a44497e764f0fae3d98d8f00a40 Mon Sep 17 00:00:00 2001 From: Iain Sandoe <iain@sandoe.co.uk> Date: Sat, 31 Aug 2019 19:35:54 +0000 Subject: [Darwin, testsuite] Adjust two tests for newer OS versions. Newer OS versions (10.14+) do not provide some of the CRTs that are used for older ones (e.g. 10.5), and thus link tests that specify targeting such a revision fail. We retain the testing of the correct defined OS version number but switch to compile-only testing for these two tests. We have already introduced a replacement test for this with the updated processing of -mmacosx-version-min=. 2019-08-31 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline. 2019-06-13 Iain Sandoe <iain@sandoe.co.uk> * gcc.dg/darwin-minversion-1.c: Use compile rather than link/run. * gcc.dg/darwin-minversion-2.c: Likewise. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@275249 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/testsuite/ChangeLog | 8 ++++++++ gcc/testsuite/gcc.dg/darwin-minversion-1.c | 2 +- gcc/testsuite/gcc.dg/darwin-minversion-2.c | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 150ee9841c7..3298424552c 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2019-08-31 Iain Sandoe <iain@sandoe.co.uk> + + Backport from mainline. + 2019-06-13 Iain Sandoe <iain@sandoe.co.uk> + + * gcc.dg/darwin-minversion-1.c: Use compile rather than link/run. + * gcc.dg/darwin-minversion-2.c: Likewise. + 2019-08-31 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline. diff --git a/gcc/testsuite/gcc.dg/darwin-minversion-1.c b/gcc/testsuite/gcc.dg/darwin-minversion-1.c index ee6493a3119..5f8524fbcb8 100644 --- a/gcc/testsuite/gcc.dg/darwin-minversion-1.c +++ b/gcc/testsuite/gcc.dg/darwin-minversion-1.c @@ -1,6 +1,6 @@ /* Basic test for -mmacosx-version-min switch on Darwin. */ /* { dg-options "-mmacosx-version-min=10.5" } */ -/* { dg-do run { target *-*-darwin* } } */ +/* { dg-do compile { target *-*-darwin* } } */ int main () diff --git a/gcc/testsuite/gcc.dg/darwin-minversion-2.c b/gcc/testsuite/gcc.dg/darwin-minversion-2.c index 46fab671b95..3dbbca6f4c5 100644 --- a/gcc/testsuite/gcc.dg/darwin-minversion-2.c +++ b/gcc/testsuite/gcc.dg/darwin-minversion-2.c @@ -1,6 +1,6 @@ /* Basic test for -mmacosx-version-min switch on Darwin. */ /* { dg-options "-mmacosx-version-min=10.1 -mmacosx-version-min=10.5" } */ -/* { dg-do run { target *-*-darwin* } } */ +/* { dg-do compile { target *-*-darwin* } } */ int main () -- cgit v1.2.3 From f878b62062b2860ffac2c63baf8bf67e470f15a9 Mon Sep 17 00:00:00 2001 From: Iain Sandoe <iain@sandoe.co.uk> Date: Sat, 31 Aug 2019 19:39:58 +0000 Subject: [Darwin, testsuite] Fix pr71694 fail for m32. This test fails for Darwin m32 because it's scanning for absence of an instruction that's validly used in PIC code. Fixed, in this case, by using non-PIC codegen. 2019-08-31 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline. 2019-06-13 Iain Sandoe <iain@sandoe.co.uk> * g++.dg/pr71694.C: Use non-PIC codegen for Darwin m32. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@275250 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/testsuite/ChangeLog | 7 +++++++ gcc/testsuite/g++.dg/pr71694.C | 1 + 2 files changed, 8 insertions(+) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 3298424552c..2f3e8967a86 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2019-08-31 Iain Sandoe <iain@sandoe.co.uk> + + Backport from mainline. + 2019-06-13 Iain Sandoe <iain@sandoe.co.uk> + + * g++.dg/pr71694.C: Use non-PIC codegen for Darwin m32. + 2019-08-31 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline. diff --git a/gcc/testsuite/g++.dg/pr71694.C b/gcc/testsuite/g++.dg/pr71694.C index 0a8baf230bf..5b59f879fbf 100644 --- a/gcc/testsuite/g++.dg/pr71694.C +++ b/gcc/testsuite/g++.dg/pr71694.C @@ -1,5 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-O2 -fno-store-merging" } */ +/* { dg-additional-options "-fno-common -mdynamic-no-pic" { target { ia32 && { x86_64-*-darwin* i?86-*-darwin* } } } } */ struct B { B() {} -- cgit v1.2.3 From ba2cc122f5e780eeae66146f97f6dd401cc93947 Mon Sep 17 00:00:00 2001 From: Iain Sandoe <iain@sandoe.co.uk> Date: Sat, 31 Aug 2019 19:43:40 +0000 Subject: [Darwin, PPC, testsuite] Fix darwin-bool-1.c. This test is failing because of a pedantic warning that is unrelated to the purpose of the test. Fixed by suppressing that warning. 2019-08-31 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline. 2019-06-22 Iain Sandoe <iain@sandoe.co.uk> * gcc.target/powerpc/darwin-bool-1.c: Suppress the pedantic warning about _Bool. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@275251 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/testsuite/ChangeLog | 8 ++++++++ gcc/testsuite/gcc.target/powerpc/darwin-bool-1.c | 2 ++ 2 files changed, 10 insertions(+) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 2f3e8967a86..54838f5bd3a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2019-08-31 Iain Sandoe <iain@sandoe.co.uk> + + Backport from mainline. + 2019-06-22 Iain Sandoe <iain@sandoe.co.uk> + + * gcc.target/powerpc/darwin-bool-1.c: Suppress the pedantic + warning about _Bool. + 2019-08-31 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline. diff --git a/gcc/testsuite/gcc.target/powerpc/darwin-bool-1.c b/gcc/testsuite/gcc.target/powerpc/darwin-bool-1.c index 2f147d07381..f444edff295 100644 --- a/gcc/testsuite/gcc.target/powerpc/darwin-bool-1.c +++ b/gcc/testsuite/gcc.target/powerpc/darwin-bool-1.c @@ -1,6 +1,8 @@ /* Check that sizeof(bool) is 4 if we don't use special options. */ /* Matt Austern <austern@apple.com> */ /* { dg-do run { target { powerpc*-*-darwin* && ilp32 } } } */ +/* We do need to suppress the ISO C doesn't support _Bool message tho. */ +/* { dg-options "-Wno-pedantic" } */ int dummy1[sizeof(_Bool) - 3]; int dummy2[5 - sizeof(_Bool)]; -- cgit v1.2.3 From 69acdb3bacadc5f65947c2520d700c21a0b35a85 Mon Sep 17 00:00:00 2001 From: Iain Sandoe <iain@sandoe.co.uk> Date: Sat, 31 Aug 2019 19:48:25 +0000 Subject: [Darwin, PPC, testsuite] Add requires for DFP to two tests. The two tests use decimal floating point, add the relevant dg-requires so that they are unsupported on platforms without DFP. 2019-08-31 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline. 2019-06-22 Iain Sandoe <iain@sandoe.co.uk> * gcc.target/powerpc/pr64205.c: Require effective target dfp. * gcc.target/powerpc/pr79909.c: Likewise. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@275252 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/testsuite/ChangeLog | 8 ++++++++ gcc/testsuite/gcc.target/powerpc/pr64205.c | 1 + gcc/testsuite/gcc.target/powerpc/pr79909.c | 1 + 3 files changed, 10 insertions(+) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 54838f5bd3a..4bc430f048e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2019-08-31 Iain Sandoe <iain@sandoe.co.uk> + + Backport from mainline. + 2019-06-22 Iain Sandoe <iain@sandoe.co.uk> + + * gcc.target/powerpc/pr64205.c: Require effective target dfp. + * gcc.target/powerpc/pr79909.c: Likewise. + 2019-08-31 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline. diff --git a/gcc/testsuite/gcc.target/powerpc/pr64205.c b/gcc/testsuite/gcc.target/powerpc/pr64205.c index 7fa987e6f55..64b39ae804f 100644 --- a/gcc/testsuite/gcc.target/powerpc/pr64205.c +++ b/gcc/testsuite/gcc.target/powerpc/pr64205.c @@ -1,4 +1,5 @@ /* { dg-do compile { target { powerpc*-*-* && ilp32 } } } */ +/* { dg-require-effective-target dfp } */ /* { dg-skip-if "" { powerpc*-*-aix* } } */ /* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=G5" } } */ /* { dg-options "-O2 -mcpu=G5 -maltivec" } */ diff --git a/gcc/testsuite/gcc.target/powerpc/pr79909.c b/gcc/testsuite/gcc.target/powerpc/pr79909.c index d9fb7c332bb..d886c32ff39 100644 --- a/gcc/testsuite/gcc.target/powerpc/pr79909.c +++ b/gcc/testsuite/gcc.target/powerpc/pr79909.c @@ -1,6 +1,7 @@ /* PR rtl-optimization/79909 */ /* { dg-do compile } */ /* { dg-options "-O2 -mxl-compat" } */ +/* { dg-require-effective-target dfp } */ /* { dg-skip-if "DFP" { powerpc*-*-aix* } } */ typedef float T __attribute__ ((mode (TD))); -- cgit v1.2.3 From 1281812c16a8c5d4ea2bef5f42a76f7d31b637c3 Mon Sep 17 00:00:00 2001 From: Iain Sandoe <iain@sandoe.co.uk> Date: Sat, 31 Aug 2019 19:55:44 +0000 Subject: [Darwin, PPC, testsuite] Fix pr71785 testcase for Darwin. Firstly, we adjust the test conditions to use non-PIC code for Darwin. Secondly, we have to account for out-of-line GPR restores which gives a false positive on one of the scan-assembler-not. Lastly, we make the test a bit more specific for Darwin - that it looks for absence of branches to local labels. 2019-08-31 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline. 2019-06-23 Iain Sandoe <iain@sandoe.co.uk> * gcc.target/powerpc/pr71785.c: For Darwin, make test non-PIC, expect the out-of-line GPR restore, and test specifically for absence of branches to local labels. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@275253 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/testsuite/ChangeLog | 9 +++++++++ gcc/testsuite/gcc.target/powerpc/pr71785.c | 7 ++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 4bc430f048e..9c8c32635cb 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,12 @@ +2019-08-31 Iain Sandoe <iain@sandoe.co.uk> + + Backport from mainline. + 2019-06-23 Iain Sandoe <iain@sandoe.co.uk> + + * gcc.target/powerpc/pr71785.c: For Darwin, make test non-PIC, + expect the out-of-line GPR restore, and test specifically for + absence of branches to local labels. + 2019-08-31 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline. diff --git a/gcc/testsuite/gcc.target/powerpc/pr71785.c b/gcc/testsuite/gcc.target/powerpc/pr71785.c index 613dcd1a937..c667ad81aa2 100644 --- a/gcc/testsuite/gcc.target/powerpc/pr71785.c +++ b/gcc/testsuite/gcc.target/powerpc/pr71785.c @@ -1,6 +1,11 @@ /* { dg-do compile { target { powerpc*-*-* } } } */ /* { dg-options "-O2" } */ -/* { dg-final { scan-assembler-not {\mb\M} } } */ +/* We have to lose the default pic codegen on Darwin. */ +/* { dg-additional-options "-mdynamic-no-pic" { target powerpc*-*-darwin* } } */ +/* ... and account for the out-of-line GPR restore. */ +/* { dg-final { scan-assembler-times {\mb[ \t]*restGPR} 1 { target powerpc*-*-darwin* } } } */ +/* { dg-final { scan-assembler-not {\mb[ \t]L} { target powerpc*-*-darwin* } } } */ +/* { dg-final { scan-assembler-not {\mb\M} { target { ! powerpc*-*-darwin* } } } } */ /* Check that all computed gotos in this testcase end up unfactored completely. If some is not there will be a unconditional jump left; if all works fine, -- cgit v1.2.3 From 1a65609563eeae94e4605d7501b950280de4e4c5 Mon Sep 17 00:00:00 2001 From: Iain Sandoe <iain@sandoe.co.uk> Date: Sat, 31 Aug 2019 19:59:46 +0000 Subject: [Darwin, PPC, testsuite] Fix pr80125 testcase for Darwin. Darwin (unlike most of the members of the PowerPC port family) defaults to signed chars, so the test was failing to compile with a "mismatched parameters" error. 2019-08-31 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline. 2019-06-23 Iain Sandoe <iain@sandoe.co.uk> * gcc.target/powerpc/pr80125.c (foo): Use an unsigned char vector explicitly for the vec_perm. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@275254 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/testsuite/ChangeLog | 8 ++++++++ gcc/testsuite/gcc.target/powerpc/pr80125.c | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 9c8c32635cb..c19179bf383 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2019-08-31 Iain Sandoe <iain@sandoe.co.uk> + + Backport from mainline. + 2019-06-23 Iain Sandoe <iain@sandoe.co.uk> + + * gcc.target/powerpc/pr80125.c (foo): Use an unsigned char + vector explicitly for the vec_perm. + 2019-08-31 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline. diff --git a/gcc/testsuite/gcc.target/powerpc/pr80125.c b/gcc/testsuite/gcc.target/powerpc/pr80125.c index 494a6e673b1..366602d9668 100644 --- a/gcc/testsuite/gcc.target/powerpc/pr80125.c +++ b/gcc/testsuite/gcc.target/powerpc/pr80125.c @@ -16,7 +16,7 @@ foo () vector int k = vec_mergel (i, j); vector int l = vec_sl (k, c); vector int m = vec_sl (l, d); - vector char o; + vector unsigned char o; vector int p = vec_perm (m, n, o); e = vec_sra (p, c); vec_st (e, 0, a); -- cgit v1.2.3 From 6bbfc560b34f9f325bbe6357d6058616871c5b6b Mon Sep 17 00:00:00 2001 From: Iain Sandoe <iain@sandoe.co.uk> Date: Sat, 31 Aug 2019 20:05:29 +0000 Subject: [Darwin, PPC, testsuite] Fix builtins-2 Darwin. This cannot pass for current Darwin, since it requires VSX and we don't have any hardware supporting that. Add a dg-requires clause for this. 2019-08-31 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline. 2019-06-23 Iain Sandoe <iain@sandoe.co.uk> * gcc.target/powerpc/builtins-2.c: Require VSX hardware support. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@275255 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/testsuite/ChangeLog | 7 +++++++ gcc/testsuite/gcc.target/powerpc/builtins-2.c | 1 + 2 files changed, 8 insertions(+) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c19179bf383..020ba844c12 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2019-08-31 Iain Sandoe <iain@sandoe.co.uk> + + Backport from mainline. + 2019-06-23 Iain Sandoe <iain@sandoe.co.uk> + + * gcc.target/powerpc/builtins-2.c: Require VSX hardware support. + 2019-08-31 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline. diff --git a/gcc/testsuite/gcc.target/powerpc/builtins-2.c b/gcc/testsuite/gcc.target/powerpc/builtins-2.c index 666e9677673..69ad4b122e7 100644 --- a/gcc/testsuite/gcc.target/powerpc/builtins-2.c +++ b/gcc/testsuite/gcc.target/powerpc/builtins-2.c @@ -1,5 +1,6 @@ /* { dg-do run { target { powerpc*-*-* } } } */ /* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } */ +/* { dg-require-effective-target vsx_hw } */ /* { dg-options "-mcpu=power8 " } */ #include <altivec.h> -- cgit v1.2.3 From c9a0cffe066d79c9dac60587d3494eda0440ea55 Mon Sep 17 00:00:00 2001 From: Iain Sandoe <iain@sandoe.co.uk> Date: Sat, 31 Aug 2019 20:10:28 +0000 Subject: [Darwin, testsuite] Fix isysroot-1.c. For the test to succeed there needs to be some header that is to be found in the 'expected' place i.e. <sysroot>/usr/include/. It's important that it is not the name of a header for which fixincludes have been applied, since such headers will be found in the gcc include-fixed dir and, in general, reference additional headers. The dummy sysroot will prevent the additional headers from being found, resulting in a failed test. The fix is to use a header name that isn't expected to be present in a real sysroot. 2019-08-31 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline. 2019-06-24 Iain Sandoe <iain@sandoe.co.uk> * gcc.dg/cpp/isysroot-1.c: Use <example.h> as the test header. * gcc.dg/cpp/usr/include/stdio.h: Rename... * gcc.dg/cpp/usr/include/example.h: ... to this. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@275256 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/testsuite/ChangeLog | 9 +++++++++ gcc/testsuite/gcc.dg/cpp/isysroot-1.c | 11 +++++++++-- gcc/testsuite/gcc.dg/cpp/usr/include/example.h | 4 ++++ gcc/testsuite/gcc.dg/cpp/usr/include/stdio.h | 4 ---- 4 files changed, 22 insertions(+), 6 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/cpp/usr/include/example.h delete mode 100644 gcc/testsuite/gcc.dg/cpp/usr/include/stdio.h diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 020ba844c12..355255993c3 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,12 @@ +2019-08-31 Iain Sandoe <iain@sandoe.co.uk> + + Backport from mainline. + 2019-06-24 Iain Sandoe <iain@sandoe.co.uk> + + * gcc.dg/cpp/isysroot-1.c: Use <example.h> as the test header. + * gcc.dg/cpp/usr/include/stdio.h: Rename... + * gcc.dg/cpp/usr/include/example.h: ... to this. + 2019-08-31 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline. diff --git a/gcc/testsuite/gcc.dg/cpp/isysroot-1.c b/gcc/testsuite/gcc.dg/cpp/isysroot-1.c index 7263ce41544..4c54f9e218a 100644 --- a/gcc/testsuite/gcc.dg/cpp/isysroot-1.c +++ b/gcc/testsuite/gcc.dg/cpp/isysroot-1.c @@ -1,10 +1,17 @@ /* { dg-options "-isysroot ${srcdir}/gcc.dg/cpp" } */ /* { dg-do compile { target *-*-darwin* } } */ -#include <stdio.h> +/* For the test to succeed there needs to be some header that is to be found + in the 'expected' place i.e. <sysroot>/usr/include/. It's important that + it is not the name of a header for which fixincludes have been applied, + since such headers will be found in the gcc include-fixed dir and, in + general, reference additional headers. The dummy sysroot will prevent the + additional headers from being found, resulting in a failed test. So use + a header name we don't expect to see. */ +#include <example.h> int main() { - /* Special stdio.h supplies function foo. */ + /* Special example.h supplies function foo. */ void (*x)(void) = foo; return 0; } diff --git a/gcc/testsuite/gcc.dg/cpp/usr/include/example.h b/gcc/testsuite/gcc.dg/cpp/usr/include/example.h new file mode 100644 index 00000000000..c674e89f7ef --- /dev/null +++ b/gcc/testsuite/gcc.dg/cpp/usr/include/example.h @@ -0,0 +1,4 @@ +/* Used by gcc.dg/cpp/isysroot-1.c to test isysroot. */ +void foo() +{ +} diff --git a/gcc/testsuite/gcc.dg/cpp/usr/include/stdio.h b/gcc/testsuite/gcc.dg/cpp/usr/include/stdio.h deleted file mode 100644 index c674e89f7ef..00000000000 --- a/gcc/testsuite/gcc.dg/cpp/usr/include/stdio.h +++ /dev/null @@ -1,4 +0,0 @@ -/* Used by gcc.dg/cpp/isysroot-1.c to test isysroot. */ -void foo() -{ -} -- cgit v1.2.3 From 4369202ecb3447e12e0aac1d9ec92b9ce7a48b53 Mon Sep 17 00:00:00 2001 From: Iain Sandoe <iain@sandoe.co.uk> Date: Sat, 31 Aug 2019 20:13:57 +0000 Subject: [Darwin, PPC, testsuite] Fix spec-barr-1.c for Darwin. We just needed to adjust the regex to accept Darwin's register names. 2019-08-31 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline. 2019-06-24 Iain Sandoe <iain@sandoe.co.uk> * gcc.target/powerpc/spec-barr-1.c: Adjust scan assembler regex to recognise Darwin's register names. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@275257 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/testsuite/ChangeLog | 8 ++++++++ gcc/testsuite/gcc.target/powerpc/spec-barr-1.c | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 355255993c3..893a75bb204 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2019-08-31 Iain Sandoe <iain@sandoe.co.uk> + + Backport from mainline. + 2019-06-24 Iain Sandoe <iain@sandoe.co.uk> + + * gcc.target/powerpc/spec-barr-1.c: Adjust scan assembler regex + to recognise Darwin's register names. + 2019-08-31 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline. diff --git a/gcc/testsuite/gcc.target/powerpc/spec-barr-1.c b/gcc/testsuite/gcc.target/powerpc/spec-barr-1.c index 443938cd106..ef51980c51b 100644 --- a/gcc/testsuite/gcc.target/powerpc/spec-barr-1.c +++ b/gcc/testsuite/gcc.target/powerpc/spec-barr-1.c @@ -7,4 +7,4 @@ void foo () __builtin_ppc_speculation_barrier (); } -/* { dg-final { scan-assembler "ori 31,31,0" } } */ +/* { dg-final { scan-assembler {ori\s+r?31,r?31,r?0} } } */ -- cgit v1.2.3 From 349d90e9943f8af99606925c114e1cdb8f07d78a Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Sun, 1 Sep 2019 00:16:35 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@275262 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index dcfd94e23ba..de7aab44512 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190831 +20190901 -- cgit v1.2.3 From e11caa72c376fec4841b49e447d14b1606b78b6b Mon Sep 17 00:00:00 2001 From: Eric Botcazou <ebotcazou@adacore.com> Date: Sun, 1 Sep 2019 12:59:09 +0000 Subject: PR target/91472 * config/sparc/sparc.c (sparc_cannot_force_const_mem): Return true during LRA/reload in PIC mode if the PIC register hasn't been used yet. (sparc_pic_register_p): Test reload_in_progress for consistency's sake. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@275273 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 7 +++++ gcc/config/sparc/sparc.c | 9 +++++- gcc/testsuite/ChangeLog | 4 +++ gcc/testsuite/gcc.c-torture/execute/20190901-1.c | 36 ++++++++++++++++++++++++ 4 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.c-torture/execute/20190901-1.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e97edf791f8..7d303631e76 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2019-09-01 Eric Botcazou <ebotcazou@adacore.com> + + PR target/91472 + * config/sparc/sparc.c (sparc_cannot_force_const_mem): Return true + during LRA/reload in PIC mode if the PIC register hasn't been used yet. + (sparc_pic_register_p): Test reload_in_progress for consistency's sake. + 2019-08-30 Richard Biener <rguenther@suse.de> Backport from mainline diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c index 7d43459f891..10c868239e1 100644 --- a/gcc/config/sparc/sparc.c +++ b/gcc/config/sparc/sparc.c @@ -4203,6 +4203,13 @@ eligible_for_sibcall_delay (rtx_insn *trial) static bool sparc_cannot_force_const_mem (machine_mode mode, rtx x) { + /* After IRA has run in PIC mode, it is too late to put anything into the + constant pool if the PIC register hasn't already been initialized. */ + if ((lra_in_progress || reload_in_progress) + && flag_pic + && !crtl->uses_pic_offset_table) + return true; + switch (GET_CODE (x)) { case CONST_INT: @@ -4452,7 +4459,7 @@ sparc_pic_register_p (rtx x) return true; if (!HARD_REGISTER_P (pic_offset_table_rtx) - && (HARD_REGISTER_P (x) || lra_in_progress) + && (HARD_REGISTER_P (x) || lra_in_progress || reload_in_progress) && ORIGINAL_REGNO (x) == REGNO (pic_offset_table_rtx)) return true; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 893a75bb204..ca6eec83648 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2019-09-01 Eric Botcazou <ebotcazou@adacore.com> + + * gcc.c-torture/execute/20190901-1.c: New test. + 2019-08-31 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline. diff --git a/gcc/testsuite/gcc.c-torture/execute/20190901-1.c b/gcc/testsuite/gcc.c-torture/execute/20190901-1.c new file mode 100644 index 00000000000..c78715ef2c1 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20190901-1.c @@ -0,0 +1,36 @@ +/* PR target/91472 */ +/* Reported by John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de> */ + +typedef unsigned int gmp_uint_least32_t; + +union ieee_double_extract +{ + struct + { + gmp_uint_least32_t sig:1; + gmp_uint_least32_t exp:11; + gmp_uint_least32_t manh:20; + gmp_uint_least32_t manl:32; + } s; + double d; +}; + +double __attribute__((noipa)) +tests_infinity_d (void) +{ + union ieee_double_extract x; + x.s.exp = 2047; + x.s.manl = 0; + x.s.manh = 0; + x.s.sig = 0; + return x.d; +} + +int +main (void) +{ + double x = tests_infinity_d (); + if (x == 0.0) + __builtin_abort (); + return 0; +} -- cgit v1.2.3 From fb48560765680a3a4b2eda5950e24df0dbc1739c Mon Sep 17 00:00:00 2001 From: Iain Sandoe <iain@sandoe.co.uk> Date: Sun, 1 Sep 2019 18:53:13 +0000 Subject: [Darwin, X86, testsuite] Provide an asm shim for AVX512F tests. Allow the tests to run on Darwin 2019-09-01 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline. 2019-05-10 Iain Sandoe <iain@sandoe.co.uk> * gcc.target/x86_64/abi/avx512f/abi-avx512f.exp: Darwin is now tested. * gcc.target/x86_64/abi/avx512f/asm-support-darwin.s: New. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@275275 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/testsuite/ChangeLog | 9 +++ .../gcc.target/x86_64/abi/avx512f/abi-avx512f.exp | 1 - .../x86_64/abi/avx512f/asm-support-darwin.s | 93 ++++++++++++++++++++++ 3 files changed, 102 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.target/x86_64/abi/avx512f/asm-support-darwin.s diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ca6eec83648..50c4fee2139 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,12 @@ +2019-09-01 Iain Sandoe <iain@sandoe.co.uk> + + Backport from mainline. + 2019-05-10 Iain Sandoe <iain@sandoe.co.uk> + + * gcc.target/x86_64/abi/avx512f/abi-avx512f.exp: Darwin is + now tested. + * gcc.target/x86_64/abi/avx512f/asm-support-darwin.s: New. + 2019-09-01 Eric Botcazou <ebotcazou@adacore.com> * gcc.c-torture/execute/20190901-1.c: New test. diff --git a/gcc/testsuite/gcc.target/x86_64/abi/avx512f/abi-avx512f.exp b/gcc/testsuite/gcc.target/x86_64/abi/avx512f/abi-avx512f.exp index d9408d81fbb..a0da7bbe976 100644 --- a/gcc/testsuite/gcc.target/x86_64/abi/avx512f/abi-avx512f.exp +++ b/gcc/testsuite/gcc.target/x86_64/abi/avx512f/abi-avx512f.exp @@ -37,7 +37,6 @@ set additional_flags "-W -Wall -mavx512f" foreach src [lsort [glob -nocomplain $srcdir/$subdir/test_*.c]] { if {[runtest_file_p $runtests $src]} { if { ([istarget *-*-darwin*]) } then { - # FIXME: Darwin isn't tested. c-torture-execute [list $src \ $srcdir/$subdir/asm-support-darwin.s] \ $additional_flags diff --git a/gcc/testsuite/gcc.target/x86_64/abi/avx512f/asm-support-darwin.s b/gcc/testsuite/gcc.target/x86_64/abi/avx512f/asm-support-darwin.s new file mode 100644 index 00000000000..53647262019 --- /dev/null +++ b/gcc/testsuite/gcc.target/x86_64/abi/avx512f/asm-support-darwin.s @@ -0,0 +1,93 @@ + .text + .p2align 4,,15 + .globl _snapshot +_snapshot: +LFB3: + movq %rax, _rax(%rip) + movq %rbx, _rbx(%rip) + movq %rcx, _rcx(%rip) + movq %rdx, _rdx(%rip) + movq %rdi, _rdi(%rip) + movq %rsi, _rsi(%rip) + movq %rbp, _rbp(%rip) + movq %rsp, _rsp(%rip) + movq %r8, _r8(%rip) + movq %r9, _r9(%rip) + movq %r10, _r10(%rip) + movq %r11, _r11(%rip) + movq %r12, _r12(%rip) + movq %r13, _r13(%rip) + movq %r14, _r14(%rip) + movq %r15, _r15(%rip) + vmovdqu32 %zmm0, _zmm_regs+0(%rip) + vmovdqu32 %zmm1, _zmm_regs+64(%rip) + vmovdqu32 %zmm2, _zmm_regs+128(%rip) + vmovdqu32 %zmm3, _zmm_regs+192(%rip) + vmovdqu32 %zmm4, _zmm_regs+256(%rip) + vmovdqu32 %zmm5, _zmm_regs+320(%rip) + vmovdqu32 %zmm6, _zmm_regs+384(%rip) + vmovdqu32 %zmm7, _zmm_regs+448(%rip) + vmovdqu32 %zmm8, _zmm_regs+512(%rip) + vmovdqu32 %zmm9, _zmm_regs+576(%rip) + vmovdqu32 %zmm10, _zmm_regs+640(%rip) + vmovdqu32 %zmm11, _zmm_regs+704(%rip) + vmovdqu32 %zmm12, _zmm_regs+768(%rip) + vmovdqu32 %zmm13, _zmm_regs+832(%rip) + vmovdqu32 %zmm14, _zmm_regs+896(%rip) + vmovdqu32 %zmm15, _zmm_regs+960(%rip) + vmovdqu32 %zmm16, _zmm_regs+1024(%rip) + vmovdqu32 %zmm17, _zmm_regs+1088(%rip) + vmovdqu32 %zmm18, _zmm_regs+1152(%rip) + vmovdqu32 %zmm19, _zmm_regs+1216(%rip) + vmovdqu32 %zmm20, _zmm_regs+1280(%rip) + vmovdqu32 %zmm21, _zmm_regs+1344(%rip) + vmovdqu32 %zmm22, _zmm_regs+1408(%rip) + vmovdqu32 %zmm23, _zmm_regs+1472(%rip) + vmovdqu32 %zmm24, _zmm_regs+1536(%rip) + vmovdqu32 %zmm25, _zmm_regs+1600(%rip) + vmovdqu32 %zmm26, _zmm_regs+1664(%rip) + vmovdqu32 %zmm27, _zmm_regs+1728(%rip) + vmovdqu32 %zmm28, _zmm_regs+1792(%rip) + vmovdqu32 %zmm29, _zmm_regs+1856(%rip) + vmovdqu32 %zmm30, _zmm_regs+1920(%rip) + vmovdqu32 %zmm31, _zmm_regs+1984(%rip) + jmp *_callthis(%rip) +LFE3: + + .p2align 4,,15 + .globl _snapshot_ret +_snapshot_ret: + movq %rdi, _rdi(%rip) + subq $8, %rsp + call *_callthis(%rip) + addq $8, %rsp + movq %rax, _rax(%rip) + movq %rdx, _rdx(%rip) + vmovdqu32 %zmm0, _zmm_regs+0(%rip) + vmovdqu32 %zmm1, _zmm_regs+64(%rip) + fstpt _x87_regs(%rip) + fstpt _x87_regs+16(%rip) + fldt _x87_regs+16(%rip) + fldt _x87_regs(%rip) + ret + + .comm _callthis,8,8 + .comm _rax,8,8 + .comm _rbx,8,8 + .comm _rcx,8,8 + .comm _rdx,8,8 + .comm _rsi,8,8 + .comm _rdi,8,8 + .comm _rsp,8,8 + .comm _rbp,8,8 + .comm _r8,8,8 + .comm _r9,8,8 + .comm _r10,8,8 + .comm _r11,8,8 + .comm _r12,8,8 + .comm _r13,8,8 + .comm _r14,8,8 + .comm _r15,8,8 + .comm _zmm_regs,2048,64 + .comm _x87_regs,128,32 + .comm _volatile_var,8,8 -- cgit v1.2.3 From 707614815ab546d83e0d6485e3e403292478ba92 Mon Sep 17 00:00:00 2001 From: Iain Sandoe <iain@sandoe.co.uk> Date: Sun, 1 Sep 2019 18:57:42 +0000 Subject: [Darwin, testsuite] Backport fix for fails of pr90020.c. To allow weak references to be undefined at link-time, Darwin needs -Wl,-undefined,dynamic_lookup. For them to work at runtime on older, Darwin versions, the lookup needs to use 'flat' namespace (i.e. ignore the two-level library naming). 2019-09-01 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline. 2019-04-15 Dominique d'Humieres <dominiq@gcc.gnu.org> PR tree-optimization/90020 * gcc.dg/torture/pr90020.c: Add linker options for Darwin. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@275276 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/testsuite/ChangeLog | 8 ++++++++ gcc/testsuite/gcc.dg/torture/pr90020.c | 2 ++ 2 files changed, 10 insertions(+) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 50c4fee2139..f5327362871 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2019-09-01 Iain Sandoe <iain@sandoe.co.uk> + + Backport from mainline. + 2019-04-15 Dominique d'Humieres <dominiq@gcc.gnu.org> + + PR tree-optimization/90020 + * gcc.dg/torture/pr90020.c: Add linker options for darwin. + 2019-09-01 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline. diff --git a/gcc/testsuite/gcc.dg/torture/pr90020.c b/gcc/testsuite/gcc.dg/torture/pr90020.c index 2aa8aa0e4a4..1748243852a 100644 --- a/gcc/testsuite/gcc.dg/torture/pr90020.c +++ b/gcc/testsuite/gcc.dg/torture/pr90020.c @@ -1,5 +1,7 @@ /* { dg-do run } */ /* { dg-require-weak "" } */ +/* { dg-additional-options "-Wl,-undefined,dynamic_lookup" { target *-*-darwin* } } */ +/* { dg-additional-options "-Wl,-flat_namespace" { target *-*-darwin[89]* } } */ void __attribute__((noinline,noclone)) check (int i) -- cgit v1.2.3 From d10909d6e3dfec505459da1a5d7b9562e49dd3c3 Mon Sep 17 00:00:00 2001 From: Iain Sandoe <iain@sandoe.co.uk> Date: Sun, 1 Sep 2019 19:09:45 +0000 Subject: [Darwin, PPC, testsuite] Skip tests for unimplemented functionality. The -mno-speculate-indirect-jumps functionality is not implemented for Darwin. 2019-09-01 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline. 2019-06-24 Iain Sandoe <iain@sandoe.co.uk> * gcc.target/powerpc/safe-indirect-jump-1.c: Skip for Darwin. * gcc.target/powerpc/safe-indirect-jump-7.c: Likewise. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@275277 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/testsuite/ChangeLog | 8 ++++++++ gcc/testsuite/gcc.target/powerpc/safe-indirect-jump-1.c | 1 + gcc/testsuite/gcc.target/powerpc/safe-indirect-jump-7.c | 1 + 3 files changed, 10 insertions(+) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index f5327362871..4db07ff44fb 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2019-09-01 Iain Sandoe <iain@sandoe.co.uk> + + Backport from mainline. + 2019-06-24 Iain Sandoe <iain@sandoe.co.uk> + + * gcc.target/powerpc/safe-indirect-jump-1.c: Skip for Darwin. + * gcc.target/powerpc/safe-indirect-jump-7.c: Likewise. + 2019-09-01 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline. diff --git a/gcc/testsuite/gcc.target/powerpc/safe-indirect-jump-1.c b/gcc/testsuite/gcc.target/powerpc/safe-indirect-jump-1.c index 16ccfe471f6..b9ad8c1dd36 100644 --- a/gcc/testsuite/gcc.target/powerpc/safe-indirect-jump-1.c +++ b/gcc/testsuite/gcc.target/powerpc/safe-indirect-jump-1.c @@ -1,4 +1,5 @@ /* { dg-do compile } */ +/* { dg-skip-if "not implemented for Darwin" { powerpc*-*-darwin* } } */ /* { dg-additional-options "-mno-speculate-indirect-jumps" } */ /* { dg-warning "'-mno-speculate-indirect-jumps' is deprecated" "" { target *-*-* } 0 } */ diff --git a/gcc/testsuite/gcc.target/powerpc/safe-indirect-jump-7.c b/gcc/testsuite/gcc.target/powerpc/safe-indirect-jump-7.c index e7d81d40ff0..a316e66204f 100644 --- a/gcc/testsuite/gcc.target/powerpc/safe-indirect-jump-7.c +++ b/gcc/testsuite/gcc.target/powerpc/safe-indirect-jump-7.c @@ -1,4 +1,5 @@ /* { dg-do compile } */ +/* { dg-skip-if "not implemented for Darwin" { powerpc*-*-darwin* } } */ /* { dg-additional-options "-mno-speculate-indirect-jumps" } */ /* { dg-warning "'-mno-speculate-indirect-jumps' is deprecated" "" { target *-*-* } 0 } */ -- cgit v1.2.3 From 40a3657c5487a5cb37f37b90f015566900ff2b6b Mon Sep 17 00:00:00 2001 From: Iain Sandoe <iain@sandoe.co.uk> Date: Sun, 1 Sep 2019 19:13:39 +0000 Subject: [Darwin, PPC, testsuite] Require stabs support for a test. The test fails if the assembler doesn't support stabs. 2019-09-01 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline. 2019-07-13 Iain Sandoe <iain@sandoe.co.uk> * gcc.target/powerpc/stabs-attrib-vect-darwin.c: Require stabs support. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@275278 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/testsuite/ChangeLog | 8 ++++++++ gcc/testsuite/gcc.target/powerpc/stabs-attrib-vect-darwin.c | 1 + 2 files changed, 9 insertions(+) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 4db07ff44fb..de88732287f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2019-09-01 Iain Sandoe <iain@sandoe.co.uk> + + Backport from mainline. + 2019-07-13 Iain Sandoe <iain@sandoe.co.uk> + + * gcc.target/powerpc/stabs-attrib-vect-darwin.c: Require stabs + support. + 2019-09-01 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline. diff --git a/gcc/testsuite/gcc.target/powerpc/stabs-attrib-vect-darwin.c b/gcc/testsuite/gcc.target/powerpc/stabs-attrib-vect-darwin.c index 3c52287b344..5c7acf18a58 100644 --- a/gcc/testsuite/gcc.target/powerpc/stabs-attrib-vect-darwin.c +++ b/gcc/testsuite/gcc.target/powerpc/stabs-attrib-vect-darwin.c @@ -1,5 +1,6 @@ /* Test Attribute Vector associated with vector type stabs. */ /* { dg-do compile { target powerpc*-*-darwin* } } */ +/* { dg-require-effective-target stabs } */ /* { dg-options "-gstabs+ -fno-eliminate-unused-debug-types -faltivec" } */ int main () -- cgit v1.2.3 From 418f301d2eb84bf1887d01e10d9b1cbbc0c07417 Mon Sep 17 00:00:00 2001 From: Iain Sandoe <iain@sandoe.co.uk> Date: Sun, 1 Sep 2019 19:17:16 +0000 Subject: [Darwin, testsuite] Address PR91087 - XFAIL parts of pr16855.C. The testcase is failing to instrument part of the source because of a bug in the ordering of static DTORs. It seems unlikely that this is generically fixable in the toolchain (and given that it's likely to be a dynamic loader change would not be expected to be applied retrospectively to OS versions that are out of support). To avoid the testsuite noise, xfail the count lines that don't match (we can adjust the xfails as/when the upstream bug is fixed). dejagnu xfails do not seem to work when embedded in a line like: ~Test (void) { .... /* count(1) { xfail ... } */ } the closing brace seems to confuse the parser. The solution is to exapnd the text onto three lines. 2019-09-01 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline. 2019-07-25 Iain Sandoe <iain@sandoe.co.uk> PR gcov-profile/91087 * g++.dg/gcov/pr16855.C: Xfail the count lines for the DTORs and the "final" line for the failure summaries. Adjust source layout so that dejagnu xfail expressions work. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@275279 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/testsuite/ChangeLog | 10 ++++++++++ gcc/testsuite/g++.dg/gcov/pr16855.C | 10 +++++++--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index de88732287f..a9c4326388f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,13 @@ +2019-09-01 Iain Sandoe <iain@sandoe.co.uk> + + Backport from mainline. + 2019-07-25 Iain Sandoe <iain@sandoe.co.uk> + + PR gcov-profile/91087 + * g++.dg/gcov/pr16855.C: Xfail the count lines for the DTORs and the + "final" line for the failure summaries. Adjust source layout so that + dejagnu xfail expressions work. + 2019-09-01 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline. diff --git a/gcc/testsuite/g++.dg/gcov/pr16855.C b/gcc/testsuite/g++.dg/gcov/pr16855.C index d7aa8a4f72c..a68b05cb571 100644 --- a/gcc/testsuite/g++.dg/gcov/pr16855.C +++ b/gcc/testsuite/g++.dg/gcov/pr16855.C @@ -1,6 +1,8 @@ /* { dg-options "-fprofile-arcs -ftest-coverage" } */ /* { dg-do run { target native } } */ +/* See PR91087 for information on Darwin xfails. */ + #include <stdlib.h> #include <stdio.h> @@ -18,7 +20,9 @@ class Test { public: Test (void) { fprintf (stderr, "In Test::Test\n"); /* count(1) */ } - ~Test (void) { fprintf (stderr, "In Test::~Test\n"); /* count(1) */ } + ~Test (void) { + fprintf (stderr, "In Test::~Test\n"); /* count(1) { xfail *-*-darwin* } */ + } } T1; void @@ -42,7 +46,7 @@ static void __attribute__ ((constructor)) ctor_default () static void __attribute__ ((destructor)) dtor_default () { - fprintf (stderr, "in destructor(())\n"); /* count(1) */ + fprintf (stderr, "in destructor(())\n"); /* count(1) { xfail *-*-darwin* } */ } -/* { dg-final { run-gcov branches { -b pr16855.C } } } */ +/* { dg-final { run-gcov branches { -b pr16855.C } { xfail *-*-darwin* } } } */ -- cgit v1.2.3 From bcc35ead1fe081b237b0fc228497b0c40024ca33 Mon Sep 17 00:00:00 2001 From: Iain Sandoe <iain@sandoe.co.uk> Date: Sun, 1 Sep 2019 19:21:39 +0000 Subject: [Darwin, PPC, testsuite] Fix fail for bmi2-bzhi64-1a.c This test is failing with older cpus because the included header needs both altivec and vsx to be enabled to succeed in compiling. Without this (if these are not defaults for the cpu) there are errors like: In file included from ... x86intrin.h:41, from ... bmi2-bzhi64-1a.c:6: ... xmmintrin.h: In function '_mm_loadu_ps': ... xmmintrin.h:122:11: error: incompatible types when returning type 'int' but '__m128' {aka '__vector(4) float'} was expected <snip> ... xmmintrin.h: In function '_mm_cvtps_pi32': ... xmmintrin.h:996:3: error: use of 'long long' in AltiVec types is invalid without '-mvsx' <snip> Fixed by adding -maltivec -mvsx to the options. 2019-09-01 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline. 2019-07-27 Iain Sandoe <iain@sandoe.co.uk> * gcc.target/powerpc/bmi2-bzhi64-1a.c: Add options to enable altivec and vsx. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@275280 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/testsuite/ChangeLog | 8 ++++++++ gcc/testsuite/gcc.target/powerpc/bmi2-bzhi64-1a.c | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index a9c4326388f..c1a8032e7af 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2019-09-01 Iain Sandoe <iain@sandoe.co.uk> + + Backport from mainline. + 2019-07-27 Iain Sandoe <iain@sandoe.co.uk> + + * gcc.target/powerpc/bmi2-bzhi64-1a.c: Add options to enable altivec + and vsx. + 2019-09-01 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline. diff --git a/gcc/testsuite/gcc.target/powerpc/bmi2-bzhi64-1a.c b/gcc/testsuite/gcc.target/powerpc/bmi2-bzhi64-1a.c index 149cbc5d416..89bee61f044 100644 --- a/gcc/testsuite/gcc.target/powerpc/bmi2-bzhi64-1a.c +++ b/gcc/testsuite/gcc.target/powerpc/bmi2-bzhi64-1a.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O3" } */ +/* { dg-options "-O3 -maltivec -mvsx" } */ /* { dg-require-effective-target lp64 } */ #define NO_WARN_X86_INTRINSICS 1 -- cgit v1.2.3 From 1b2185f8e20c06e69bc3c853adf9d8e25f9161ac Mon Sep 17 00:00:00 2001 From: Iain Sandoe <iain@sandoe.co.uk> Date: Sun, 1 Sep 2019 19:30:35 +0000 Subject: [objective-c/c++, testsuite] Workaround for PR90709. Since we cannot parse the current NeXT headers, because of PR90709 and its dependents, we have a large amount of testsuite noise for Darwin platforms. In order to restore the usefulness of the testsuite, we are going add headers without the modern syntax elements that trigger the bug, and use these for test runs on newer Darwin. The headers are imported from GNUStep, with some local modifications to make sure that __BLOCKS__ is honoured as a gate for Apple-style blocks closures. CF-CFString.h, F-NS*.h are proxy headers that use the installed CoreFoundation or Foundation headers on systems <= Darwin12 and the GNUStep headers for newer. Use the CF-CFString.h, F-NS*.h proxy headers where needed in the objective-c testsuite. Make minor adjustments to tests as required, providing that those do not alter the test intent. 2019-09-01 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline. 2019-06-15 Iain Sandoe <iain@sandoe.co.uk> PR objc/90709 * obj-c++.dg/proto-lossage-7.mm: Use proxy headers. * obj-c++.dg/strings/const-cfstring-2.mm: Likewise. * obj-c++.dg/strings/const-cfstring-5.mm: Likewise * obj-c++.dg/strings/const-str-12.mm: Likewise. * obj-c++.dg/syntax-error-1.mm: Likewise. * obj-c++.dg/torture/strings/const-cfstring-1.mm: Likewise. * obj-c++.dg/torture/strings/const-str-10.mm: Likewise. * obj-c++.dg/torture/strings/const-str-11.mm: Likewise. * obj-c++.dg/torture/strings/const-str-9.mm: Likewise. * obj-c++.dg/cxx-ivars-3.mm: Skip on later Darwin, where the 10.4 API in no longer supported, also on m64 where there's no meaning to it. * obj-c++.dg/isa-field-1.mm: Suppress unwanted warning, add comment why. * obj-c++.dg/objc-gc-3.mm: Skip for Darwin > 16, the API use is an error there. * obj-c++.dg/qual-types-1.mm: Prune a spurious l64 warning. * obj-c++.dg/stubify-1.mm: Tidy up after better compiler warnings. * obj-c++.dg/stubify-2.mm: Likewise. * obj-c++.dg/try-catch-1.mm: Likewise. * obj-c++.dg/try-catch-3.mm: Likewise. Backport from mainline. 2019-06-15 Iain Sandoe <iain@sandoe.co.uk> PR objc/90709 * objc.dg/encode-7-next-64bit.m: Use proxy headers. * objc.dg/image-info.m: Likewise. * objc.dg/method-6.m: Likewise. * objc.dg/no-extra-load.m: Likewise. * objc.dg/objc-foreach-4.m: Likewise. * objc.dg/objc-foreach-5.m: Likewise. * objc.dg/proto-lossage-7.m: Likewise. * objc.dg/strings/const-cfstring-2.m: Likewise. * objc.dg/strings/const-cfstring-5.m: Likewise. * objc.dg/strings/const-str-12b.m: Likewise. * objc.dg/symtab-1.m: Likewise. * objc.dg/torture/strings/const-cfstring-1.m: Likewise. * objc.dg/torture/strings/const-str-10.m: Likewise. * objc.dg/torture/strings/const-str-11.m: Likewise. * objc.dg/torture/strings/const-str-9.m: Likewise. * objc.dg/zero-link-1.m: Likewise. * objc.dg/zero-link-2.m: Likewise. * objc.dg/zero-link-3.m: Likewise. * objc.dg/isa-field-1.m: Suppress unwanted warning, add comment why. * objc.dg/headers.m: XFAIL for Darwin14-19. * objc.dg/objc-gc-4.m: Skip for Darwin > 16, the API use is an error there. Backport from mainline. 2019-06-15 Iain Sandoe <iain@sandoe.co.uk> PR objc/90709 * objc-obj-c++-shared/CF-CFString.h: New. * objc-obj-c++-shared/F-NSArray.h: New. * objc-obj-c++-shared/F-NSAutoreleasePool.h: New. * objc-obj-c++-shared/F-NSObject.h: New. * objc-obj-c++-shared/F-NSString.h: New. * objc-obj-c++-shared/F-NSValue.h: New. * objc-obj-c++-shared/GNUStep/CoreFoundation/CFArray.h: New. * objc-obj-c++-shared/GNUStep/CoreFoundation/CFAvailability.h: New. * objc-obj-c++-shared/GNUStep/CoreFoundation/CFBase.h: New. * objc-obj-c++-shared/GNUStep/CoreFoundation/CFCharacterSet.h: New. * objc-obj-c++-shared/GNUStep/CoreFoundation/CFData.h: New. * objc-obj-c++-shared/GNUStep/CoreFoundation/CFDictionary.h: New. * objc-obj-c++-shared/GNUStep/CoreFoundation/CFLocale.h: New. * objc-obj-c++-shared/GNUStep/CoreFoundation/CFString.h: New. * objc-obj-c++-shared/GNUStep/Foundation/NSArray.h: New. * objc-obj-c++-shared/GNUStep/Foundation/NSAutoreleasePool.h: New. * objc-obj-c++-shared/GNUStep/Foundation/NSDate.h: New. * objc-obj-c++-shared/GNUStep/Foundation/NSEnumerator.h: New. * objc-obj-c++-shared/GNUStep/Foundation/NSGeometry.h: New. * objc-obj-c++-shared/GNUStep/Foundation/NSObjCRuntime.h: New. * objc-obj-c++-shared/GNUStep/Foundation/NSObject.h: New. * objc-obj-c++-shared/GNUStep/Foundation/NSRange.h: New. * objc-obj-c++-shared/GNUStep/Foundation/NSString.h: New. * objc-obj-c++-shared/GNUStep/Foundation/NSValue.h: New. * objc-obj-c++-shared/GNUStep/Foundation/NSZone.h: New. * objc-obj-c++-shared/GNUStep/GNUstepBase/GNUstep.h: New. * objc-obj-c++-shared/GNUStep/GNUstepBase/GSBlocks.h: New. * objc-obj-c++-shared/GNUStep/GNUstepBase/GSConfig.h: New. * objc-obj-c++-shared/GNUStep/GNUstepBase/GSObjCRuntime.h: New. * objc-obj-c++-shared/GNUStep/GNUstepBase/GSVersionMacros.h: New. * objc-obj-c++-shared/GNUStep/GNUstepBase/NSArray+GNUstepBase.h: New. * objc-obj-c++-shared/GNUStep/GNUstepBase/NSMutableString+GNUstepBase.h: New. * objc-obj-c++-shared/GNUStep/GNUstepBase/NSNumber+GNUstepBase.h: New. * objc-obj-c++-shared/GNUStep/GNUstepBase/NSObject+GNUstepBase.h: New. * objc-obj-c++-shared/GNUStep/GNUstepBase/NSString+GNUstepBase.h: New. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@275281 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/testsuite/ChangeLog | 94 ++ gcc/testsuite/obj-c++.dg/cxx-ivars-3.mm | 5 +- gcc/testsuite/obj-c++.dg/isa-field-1.mm | 2 + gcc/testsuite/obj-c++.dg/objc-gc-3.mm | 1 + gcc/testsuite/obj-c++.dg/proto-lossage-7.mm | 4 +- gcc/testsuite/obj-c++.dg/qual-types-1.mm | 2 + .../obj-c++.dg/strings/const-cfstring-2.mm | 4 +- .../obj-c++.dg/strings/const-cfstring-5.mm | 2 +- gcc/testsuite/obj-c++.dg/strings/const-str-12.mm | 2 +- gcc/testsuite/obj-c++.dg/stubify-1.mm | 8 +- gcc/testsuite/obj-c++.dg/stubify-2.mm | 6 +- gcc/testsuite/obj-c++.dg/syntax-error-1.mm | 4 +- .../obj-c++.dg/torture/strings/const-cfstring-1.mm | 12 +- .../obj-c++.dg/torture/strings/const-str-10.mm | 2 +- .../obj-c++.dg/torture/strings/const-str-11.mm | 2 +- .../obj-c++.dg/torture/strings/const-str-9.mm | 2 +- gcc/testsuite/obj-c++.dg/try-catch-1.mm | 1 + gcc/testsuite/obj-c++.dg/try-catch-3.mm | 1 + gcc/testsuite/objc-obj-c++-shared/CF-CFString.h | 33 + gcc/testsuite/objc-obj-c++-shared/F-NSArray.h | 33 + .../objc-obj-c++-shared/F-NSAutoreleasePool.h | 33 + gcc/testsuite/objc-obj-c++-shared/F-NSObject.h | 33 + gcc/testsuite/objc-obj-c++-shared/F-NSString.h | 33 + gcc/testsuite/objc-obj-c++-shared/F-NSValue.h | 33 + .../GNUStep/CoreFoundation/CFArray.h | 191 ++++ .../GNUStep/CoreFoundation/CFAvailability.h | 52 ++ .../GNUStep/CoreFoundation/CFBase.h | 464 ++++++++++ .../GNUStep/CoreFoundation/CFCharacterSet.h | 173 ++++ .../GNUStep/CoreFoundation/CFData.h | 114 +++ .../GNUStep/CoreFoundation/CFDictionary.h | 174 ++++ .../GNUStep/CoreFoundation/CFLocale.h | 249 ++++++ .../GNUStep/CoreFoundation/CFString.h | 593 +++++++++++++ .../GNUStep/Foundation/NSArray.h | 430 +++++++++ .../GNUStep/Foundation/NSAutoreleasePool.h | 333 +++++++ .../GNUStep/Foundation/NSDate.h | 300 +++++++ .../GNUStep/Foundation/NSEnumerator.h | 63 ++ .../GNUStep/Foundation/NSGeometry.h | 609 +++++++++++++ .../GNUStep/Foundation/NSObjCRuntime.h | 317 +++++++ .../GNUStep/Foundation/NSObject.h | 594 +++++++++++++ .../GNUStep/Foundation/NSRange.h | 235 +++++ .../GNUStep/Foundation/NSString.h | 977 +++++++++++++++++++++ .../GNUStep/Foundation/NSValue.h | 370 ++++++++ .../GNUStep/Foundation/NSZone.h | 335 +++++++ .../GNUStep/GNUstepBase/GNUstep.h | 418 +++++++++ .../GNUStep/GNUstepBase/GSBlocks.h | 145 +++ .../GNUStep/GNUstepBase/GSConfig.h | 462 ++++++++++ .../GNUStep/GNUstepBase/GSObjCRuntime.h | 631 +++++++++++++ .../GNUStep/GNUstepBase/GSVersionMacros.h | 460 ++++++++++ .../GNUStep/GNUstepBase/NSArray+GNUstepBase.h | 78 ++ .../GNUstepBase/NSMutableString+GNUstepBase.h | 57 ++ .../GNUStep/GNUstepBase/NSNumber+GNUstepBase.h | 56 ++ .../GNUStep/GNUstepBase/NSObject+GNUstepBase.h | 242 +++++ .../GNUStep/GNUstepBase/NSString+GNUstepBase.h | 105 +++ gcc/testsuite/objc.dg/encode-7-next-64bit.m | 5 +- gcc/testsuite/objc.dg/headers.m | 1 + gcc/testsuite/objc.dg/image-info.m | 2 +- gcc/testsuite/objc.dg/isa-field-1.m | 2 + gcc/testsuite/objc.dg/method-6.m | 10 +- gcc/testsuite/objc.dg/no-extra-load.m | 2 +- gcc/testsuite/objc.dg/objc-foreach-4.m | 6 +- gcc/testsuite/objc.dg/objc-foreach-5.m | 5 +- gcc/testsuite/objc.dg/objc-gc-4.m | 1 + gcc/testsuite/objc.dg/proto-lossage-7.m | 2 +- gcc/testsuite/objc.dg/strings/const-cfstring-2.m | 4 +- gcc/testsuite/objc.dg/strings/const-cfstring-5.m | 2 +- gcc/testsuite/objc.dg/strings/const-str-12b.m | 8 +- gcc/testsuite/objc.dg/symtab-1.m | 2 +- .../objc.dg/torture/strings/const-cfstring-1.m | 4 +- .../objc.dg/torture/strings/const-str-10.m | 3 +- .../objc.dg/torture/strings/const-str-11.m | 2 +- .../objc.dg/torture/strings/const-str-9.m | 2 +- gcc/testsuite/objc.dg/zero-link-1.m | 2 +- gcc/testsuite/objc.dg/zero-link-2.m | 2 +- gcc/testsuite/objc.dg/zero-link-3.m | 10 +- 74 files changed, 9597 insertions(+), 59 deletions(-) create mode 100644 gcc/testsuite/objc-obj-c++-shared/CF-CFString.h create mode 100644 gcc/testsuite/objc-obj-c++-shared/F-NSArray.h create mode 100644 gcc/testsuite/objc-obj-c++-shared/F-NSAutoreleasePool.h create mode 100644 gcc/testsuite/objc-obj-c++-shared/F-NSObject.h create mode 100644 gcc/testsuite/objc-obj-c++-shared/F-NSString.h create mode 100644 gcc/testsuite/objc-obj-c++-shared/F-NSValue.h create mode 100644 gcc/testsuite/objc-obj-c++-shared/GNUStep/CoreFoundation/CFArray.h create mode 100644 gcc/testsuite/objc-obj-c++-shared/GNUStep/CoreFoundation/CFAvailability.h create mode 100644 gcc/testsuite/objc-obj-c++-shared/GNUStep/CoreFoundation/CFBase.h create mode 100644 gcc/testsuite/objc-obj-c++-shared/GNUStep/CoreFoundation/CFCharacterSet.h create mode 100644 gcc/testsuite/objc-obj-c++-shared/GNUStep/CoreFoundation/CFData.h create mode 100644 gcc/testsuite/objc-obj-c++-shared/GNUStep/CoreFoundation/CFDictionary.h create mode 100644 gcc/testsuite/objc-obj-c++-shared/GNUStep/CoreFoundation/CFLocale.h create mode 100644 gcc/testsuite/objc-obj-c++-shared/GNUStep/CoreFoundation/CFString.h create mode 100644 gcc/testsuite/objc-obj-c++-shared/GNUStep/Foundation/NSArray.h create mode 100644 gcc/testsuite/objc-obj-c++-shared/GNUStep/Foundation/NSAutoreleasePool.h create mode 100644 gcc/testsuite/objc-obj-c++-shared/GNUStep/Foundation/NSDate.h create mode 100644 gcc/testsuite/objc-obj-c++-shared/GNUStep/Foundation/NSEnumerator.h create mode 100644 gcc/testsuite/objc-obj-c++-shared/GNUStep/Foundation/NSGeometry.h create mode 100644 gcc/testsuite/objc-obj-c++-shared/GNUStep/Foundation/NSObjCRuntime.h create mode 100644 gcc/testsuite/objc-obj-c++-shared/GNUStep/Foundation/NSObject.h create mode 100644 gcc/testsuite/objc-obj-c++-shared/GNUStep/Foundation/NSRange.h create mode 100644 gcc/testsuite/objc-obj-c++-shared/GNUStep/Foundation/NSString.h create mode 100644 gcc/testsuite/objc-obj-c++-shared/GNUStep/Foundation/NSValue.h create mode 100644 gcc/testsuite/objc-obj-c++-shared/GNUStep/Foundation/NSZone.h create mode 100644 gcc/testsuite/objc-obj-c++-shared/GNUStep/GNUstepBase/GNUstep.h create mode 100644 gcc/testsuite/objc-obj-c++-shared/GNUStep/GNUstepBase/GSBlocks.h create mode 100644 gcc/testsuite/objc-obj-c++-shared/GNUStep/GNUstepBase/GSConfig.h create mode 100644 gcc/testsuite/objc-obj-c++-shared/GNUStep/GNUstepBase/GSObjCRuntime.h create mode 100644 gcc/testsuite/objc-obj-c++-shared/GNUStep/GNUstepBase/GSVersionMacros.h create mode 100644 gcc/testsuite/objc-obj-c++-shared/GNUStep/GNUstepBase/NSArray+GNUstepBase.h create mode 100644 gcc/testsuite/objc-obj-c++-shared/GNUStep/GNUstepBase/NSMutableString+GNUstepBase.h create mode 100644 gcc/testsuite/objc-obj-c++-shared/GNUStep/GNUstepBase/NSNumber+GNUstepBase.h create mode 100644 gcc/testsuite/objc-obj-c++-shared/GNUStep/GNUstepBase/NSObject+GNUstepBase.h create mode 100644 gcc/testsuite/objc-obj-c++-shared/GNUStep/GNUstepBase/NSString+GNUstepBase.h diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c1a8032e7af..c9503689f57 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,97 @@ +2019-09-01 Iain Sandoe <iain@sandoe.co.uk> + + Backport from mainline. + 2019-06-15 Iain Sandoe <iain@sandoe.co.uk> + + PR objc/90709 + * obj-c++.dg/proto-lossage-7.mm: Use proxy headers. + * obj-c++.dg/strings/const-cfstring-2.mm: Likewise. + * obj-c++.dg/strings/const-cfstring-5.mm: Likewise + * obj-c++.dg/strings/const-str-12.mm: Likewise. + * obj-c++.dg/syntax-error-1.mm: Likewise. + * obj-c++.dg/torture/strings/const-cfstring-1.mm: Likewise. + * obj-c++.dg/torture/strings/const-str-10.mm: Likewise. + * obj-c++.dg/torture/strings/const-str-11.mm: Likewise. + * obj-c++.dg/torture/strings/const-str-9.mm: Likewise. + * obj-c++.dg/cxx-ivars-3.mm: Skip on later Darwin, where the 10.4 API + in no longer supported, also on m64 where there's no meaning to it. + * obj-c++.dg/isa-field-1.mm: Suppress unwanted warning, add comment why. + * obj-c++.dg/objc-gc-3.mm: Skip for Darwin > 16, the API use is an error + there. + * obj-c++.dg/qual-types-1.mm: Prune a spurious l64 warning. + * obj-c++.dg/stubify-1.mm: Tidy up after better compiler warnings. + * obj-c++.dg/stubify-2.mm: Likewise. + * obj-c++.dg/try-catch-1.mm: Likewise. + * obj-c++.dg/try-catch-3.mm: Likewise. + + Backport from mainline. + 2019-06-15 Iain Sandoe <iain@sandoe.co.uk> + + PR objc/90709 + * objc.dg/encode-7-next-64bit.m: Use proxy headers. + * objc.dg/image-info.m: Likewise. + * objc.dg/method-6.m: Likewise. + * objc.dg/no-extra-load.m: Likewise. + * objc.dg/objc-foreach-4.m: Likewise. + * objc.dg/objc-foreach-5.m: Likewise. + * objc.dg/proto-lossage-7.m: Likewise. + * objc.dg/strings/const-cfstring-2.m: Likewise. + * objc.dg/strings/const-cfstring-5.m: Likewise. + * objc.dg/strings/const-str-12b.m: Likewise. + * objc.dg/symtab-1.m: Likewise. + * objc.dg/torture/strings/const-cfstring-1.m: Likewise. + * objc.dg/torture/strings/const-str-10.m: Likewise. + * objc.dg/torture/strings/const-str-11.m: Likewise. + * objc.dg/torture/strings/const-str-9.m: Likewise. + * objc.dg/zero-link-1.m: Likewise. + * objc.dg/zero-link-2.m: Likewise. + * objc.dg/zero-link-3.m: Likewise. + * objc.dg/isa-field-1.m: Suppress unwanted warning, add comment why. + * objc.dg/headers.m: XFAIL for Darwin14-19. + * objc.dg/objc-gc-4.m: Skip for Darwin > 16, the API use is an error + there. + + Backport from mainline. + 2019-06-15 Iain Sandoe <iain@sandoe.co.uk> + + PR objc/90709 + * objc-obj-c++-shared/CF-CFString.h: New. + * objc-obj-c++-shared/F-NSArray.h: New. + * objc-obj-c++-shared/F-NSAutoreleasePool.h: New. + * objc-obj-c++-shared/F-NSObject.h: New. + * objc-obj-c++-shared/F-NSString.h: New. + * objc-obj-c++-shared/F-NSValue.h: New. + * objc-obj-c++-shared/GNUStep/CoreFoundation/CFArray.h: New. + * objc-obj-c++-shared/GNUStep/CoreFoundation/CFAvailability.h: New. + * objc-obj-c++-shared/GNUStep/CoreFoundation/CFBase.h: New. + * objc-obj-c++-shared/GNUStep/CoreFoundation/CFCharacterSet.h: New. + * objc-obj-c++-shared/GNUStep/CoreFoundation/CFData.h: New. + * objc-obj-c++-shared/GNUStep/CoreFoundation/CFDictionary.h: New. + * objc-obj-c++-shared/GNUStep/CoreFoundation/CFLocale.h: New. + * objc-obj-c++-shared/GNUStep/CoreFoundation/CFString.h: New. + * objc-obj-c++-shared/GNUStep/Foundation/NSArray.h: New. + * objc-obj-c++-shared/GNUStep/Foundation/NSAutoreleasePool.h: New. + * objc-obj-c++-shared/GNUStep/Foundation/NSDate.h: New. + * objc-obj-c++-shared/GNUStep/Foundation/NSEnumerator.h: New. + * objc-obj-c++-shared/GNUStep/Foundation/NSGeometry.h: New. + * objc-obj-c++-shared/GNUStep/Foundation/NSObjCRuntime.h: New. + * objc-obj-c++-shared/GNUStep/Foundation/NSObject.h: New. + * objc-obj-c++-shared/GNUStep/Foundation/NSRange.h: New. + * objc-obj-c++-shared/GNUStep/Foundation/NSString.h: New. + * objc-obj-c++-shared/GNUStep/Foundation/NSValue.h: New. + * objc-obj-c++-shared/GNUStep/Foundation/NSZone.h: New. + * objc-obj-c++-shared/GNUStep/GNUstepBase/GNUstep.h: New. + * objc-obj-c++-shared/GNUStep/GNUstepBase/GSBlocks.h: New. + * objc-obj-c++-shared/GNUStep/GNUstepBase/GSConfig.h: New. + * objc-obj-c++-shared/GNUStep/GNUstepBase/GSObjCRuntime.h: New. + * objc-obj-c++-shared/GNUStep/GNUstepBase/GSVersionMacros.h: New. + * objc-obj-c++-shared/GNUStep/GNUstepBase/NSArray+GNUstepBase.h: New. + * objc-obj-c++-shared/GNUStep/GNUstepBase/NSMutableString+GNUstepBase.h: + New. + * objc-obj-c++-shared/GNUStep/GNUstepBase/NSNumber+GNUstepBase.h: New. + * objc-obj-c++-shared/GNUStep/GNUstepBase/NSObject+GNUstepBase.h: New. + * objc-obj-c++-shared/GNUStep/GNUstepBase/NSString+GNUstepBase.h: New. + 2019-09-01 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline. diff --git a/gcc/testsuite/obj-c++.dg/cxx-ivars-3.mm b/gcc/testsuite/obj-c++.dg/cxx-ivars-3.mm index 0098349cbce..18b671d122a 100644 --- a/gcc/testsuite/obj-c++.dg/cxx-ivars-3.mm +++ b/gcc/testsuite/obj-c++.dg/cxx-ivars-3.mm @@ -2,13 +2,14 @@ // { dg-do run { target *-*-darwin* } } // { dg-skip-if "" { *-*-* } { "-fgnu-runtime" } { "" } } +// { dg-skip-if "Headers incompatible with 10.4 APIs" { *-*-darwin1[3-8]* } { "-fnext-runtime" } { "" } } // { dg-additional-options "-fobjc-call-cxx-cdtors -mmacosx-version-min=10.4 -framework Foundation" } // This test has no equivalent or meaning for m64/ABI V2 -// { dg-xfail-run-if "No Test Avail" { *-*-darwin* && lp64 } { "-fnext-runtime" } { "" } } +// { dg-xfail-run-if "No Test Avail" { *-*-darwin* && lp64 } { "-fnext-runtime" } { "" } } #include <objc/objc-runtime.h> #include <stdlib.h> -#include <Foundation/NSObject.h> +#include "../objc-obj-c++-shared/F-NSObject.h" //extern "C" { int printf(const char *,...); } #define CHECK_IF(expr) if(!(expr)) abort() diff --git a/gcc/testsuite/obj-c++.dg/isa-field-1.mm b/gcc/testsuite/obj-c++.dg/isa-field-1.mm index 4501d01a11e..3fb27d5f641 100644 --- a/gcc/testsuite/obj-c++.dg/isa-field-1.mm +++ b/gcc/testsuite/obj-c++.dg/isa-field-1.mm @@ -1,5 +1,7 @@ /* Ensure there are no bizarre difficulties with accessing the 'isa' field of objects. */ /* { dg-do compile } */ +/* The use of isa is deprecated, but we still want to test that is works. */ +/* { dg-additional-options "-Wno-deprecated-declarations" } */ #include "../objc-obj-c++-shared/TestsuiteObject.h" #include "../objc-obj-c++-shared/runtime.h" diff --git a/gcc/testsuite/obj-c++.dg/objc-gc-3.mm b/gcc/testsuite/obj-c++.dg/objc-gc-3.mm index 430e5832eb6..68bebf8fc96 100644 --- a/gcc/testsuite/obj-c++.dg/objc-gc-3.mm +++ b/gcc/testsuite/obj-c++.dg/objc-gc-3.mm @@ -3,6 +3,7 @@ /* Contributed by Ziemowit Laski <zlaski@apple.com> */ /* { dg-do compile } */ +/* { dg-skip-if "GC API is an error from Darwin16." { *-*-darwin1[6-8]* } { "-fnext-runtime" } { "" } } */ /* { dg-options "-fobjc-gc" } */ /* { dg-prune-output "cc1objplus: warning: '-fobjc-gc' is ignored for '-fgnu-runtime'" } */ diff --git a/gcc/testsuite/obj-c++.dg/proto-lossage-7.mm b/gcc/testsuite/obj-c++.dg/proto-lossage-7.mm index b32cfd8a0dd..d136af92d67 100644 --- a/gcc/testsuite/obj-c++.dg/proto-lossage-7.mm +++ b/gcc/testsuite/obj-c++.dg/proto-lossage-7.mm @@ -1,9 +1,11 @@ /* Check that typedefs of ObjC classes preserve any @protocol qualifiers. */ /* { dg-do compile } */ +/* Suppress warnings that the GNUStep headers introduce. */ +/* { dg-additional-options "-std=gnu++11 -Wno-expansion-to-defined -Wno-variadic-macros" { target *-*-darwin* } } */ #ifdef __NEXT_RUNTIME__ -#include <Foundation/NSObject.h> +#include "../objc-obj-c++-shared/F-NSObject.h" #define OBJECT NSObject #else #include <objc/Object.h> diff --git a/gcc/testsuite/obj-c++.dg/qual-types-1.mm b/gcc/testsuite/obj-c++.dg/qual-types-1.mm index dd0eb42bc4f..2fe06e4c80d 100644 --- a/gcc/testsuite/obj-c++.dg/qual-types-1.mm +++ b/gcc/testsuite/obj-c++.dg/qual-types-1.mm @@ -4,6 +4,8 @@ /* { dg-do run } */ /* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */ +/* { dg-prune-output ".*ld: warning: direct access in.*" } */ + #include "../objc-obj-c++-shared/TestsuiteObject.m" #include <stdlib.h> diff --git a/gcc/testsuite/obj-c++.dg/strings/const-cfstring-2.mm b/gcc/testsuite/obj-c++.dg/strings/const-cfstring-2.mm index b4fc9e6ed4f..e81f4713828 100644 --- a/gcc/testsuite/obj-c++.dg/strings/const-cfstring-2.mm +++ b/gcc/testsuite/obj-c++.dg/strings/const-cfstring-2.mm @@ -8,8 +8,8 @@ /* { dg-skip-if "NeXT only" { *-*-* } { "-fgnu-runtime" } { "" } } */ /* { dg-options "-ftrack-macro-expansion=0 -mconstant-cfstrings -Wnonportable-cfstrings" } */ -#import <Foundation/NSString.h> -#import <CoreFoundation/CFString.h> +#include "../../objc-obj-c++-shared/F-NSString.h" +#include "../../objc-obj-c++-shared/CF-CFString.h" #ifndef __CONSTANT_CFSTRINGS__ #error The -fconstant-cfstrings option is not functioning properly diff --git a/gcc/testsuite/obj-c++.dg/strings/const-cfstring-5.mm b/gcc/testsuite/obj-c++.dg/strings/const-cfstring-5.mm index 98bb7c5bddc..762afb6b1ba 100644 --- a/gcc/testsuite/obj-c++.dg/strings/const-cfstring-5.mm +++ b/gcc/testsuite/obj-c++.dg/strings/const-cfstring-5.mm @@ -6,7 +6,7 @@ /* { dg-skip-if "NeXT only" { *-*-* } { "-fgnu-runtime" } { "" } } */ /* { dg-options "-mconstant-cfstrings" } */ -#include <Foundation/NSObject.h> +#include "../../objc-obj-c++-shared/F-NSObject.h" @interface Foo: NSObject { char *cString; diff --git a/gcc/testsuite/obj-c++.dg/strings/const-str-12.mm b/gcc/testsuite/obj-c++.dg/strings/const-str-12.mm index d0dfb668ea9..ade24b3a22c 100644 --- a/gcc/testsuite/obj-c++.dg/strings/const-str-12.mm +++ b/gcc/testsuite/obj-c++.dg/strings/const-str-12.mm @@ -6,7 +6,7 @@ /* { dg-options "-mno-constant-cfstrings -fconstant-string-class=Foo" { target *-*-darwin* } } */ #ifdef __NEXT_RUNTIME__ -#include <Foundation/NSObject.h> +#include "../../objc-obj-c++-shared/F-NSObject.h" #define OBJECT NSObject #else #include <objc/Object.h> diff --git a/gcc/testsuite/obj-c++.dg/stubify-1.mm b/gcc/testsuite/obj-c++.dg/stubify-1.mm index 687739ceccd..c2355437afc 100644 --- a/gcc/testsuite/obj-c++.dg/stubify-1.mm +++ b/gcc/testsuite/obj-c++.dg/stubify-1.mm @@ -10,7 +10,7 @@ typedef struct objc_object { } *id ; int x = 41 ; extern "C" { - extern id objc_msgSend(id self, char * op, ...); + extern id objc_msgSend(id self, objc_selector* op, ...); extern int bogonic (int, int, int); } @@ -20,9 +20,9 @@ extern "C" { - (Document *) close; @end @implementation Document -- (Document *) class { } -- (Document *) close { } -- (Document *) window { } +- (Document *) class { return (Document *)0; } +- (Document *) close { return (Document *)0; } +- (Document *) window { return (Document *)0; } - (void)willEndCloseSheet:(void *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo { [[self window] close]; ((void (*)(id, char *, int))objc_msgSend)([self class], (char *)contextInfo, 1); diff --git a/gcc/testsuite/obj-c++.dg/stubify-2.mm b/gcc/testsuite/obj-c++.dg/stubify-2.mm index 9968672ed34..a9f66cac5d2 100644 --- a/gcc/testsuite/obj-c++.dg/stubify-2.mm +++ b/gcc/testsuite/obj-c++.dg/stubify-2.mm @@ -16,9 +16,9 @@ extern int bogonic (int, int, int) ; - (Document *) close; @end @implementation Document -- (Document *) class { } -- (Document *) close { } -- (Document *) window { } +- (Document *) class { return (Document *)0; } +- (Document *) close { return (Document *)0; } +- (Document *) window { return (Document *)0; } - (void)willEndCloseSheet:(void *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo { [[self window] close]; ((void (*)(id, char *, int))objc_msgSend)([self class], (char *)contextInfo, 1); diff --git a/gcc/testsuite/obj-c++.dg/syntax-error-1.mm b/gcc/testsuite/obj-c++.dg/syntax-error-1.mm index 320d56c5ec1..edbd9efc964 100644 --- a/gcc/testsuite/obj-c++.dg/syntax-error-1.mm +++ b/gcc/testsuite/obj-c++.dg/syntax-error-1.mm @@ -1,8 +1,10 @@ /* Graceful handling of a syntax error. */ /* { dg-do compile } */ +/* Suppress warnings that the GNUStep headers introduce. */ +/* { dg-additional-options "-std=gnu++11 -Wno-expansion-to-defined -Wno-variadic-macros" { target *-*-darwin* } } */ #ifdef __NEXT_RUNTIME__ -#include <Foundation/NSObject.h> +#include "../objc-obj-c++-shared/F-NSObject.h" #define OBJECT NSObject #else #include <objc/Object.h> diff --git a/gcc/testsuite/obj-c++.dg/torture/strings/const-cfstring-1.mm b/gcc/testsuite/obj-c++.dg/torture/strings/const-cfstring-1.mm index 2983c43c445..0f1d92bb5ce 100644 --- a/gcc/testsuite/obj-c++.dg/torture/strings/const-cfstring-1.mm +++ b/gcc/testsuite/obj-c++.dg/torture/strings/const-cfstring-1.mm @@ -13,8 +13,8 @@ well, we don't implement writable ones at this juncture. */ /* { dg-options "-mconstant-cfstrings -framework Cocoa -Wl,-w" { target *-*-darwin[123]* } } */ -#import <Foundation/NSString.h> -#import <CoreFoundation/CFString.h> +#include "../../../objc-obj-c++-shared/F-NSString.h" +#include "../../../objc-obj-c++-shared/CF-CFString.h" #include <stdlib.h> void printOut(NSString *str) { @@ -47,10 +47,10 @@ int main(void) { checkNSRange([@"Hello World" rangeOfString:(id)CFSTR("World")]); checkNSRange([(id)CFSTR("Hello World") rangeOfString:(id)CFSTR("World")]); - checkCFRange(CFStringFind((CFStringRef)@"Hello World", (CFStringRef)@"World", 0)); - checkCFRange(CFStringFind(CFSTR("Hello World"), (CFStringRef)@"World", 0)); - checkCFRange(CFStringFind((CFStringRef)@"Hello World", CFSTR("World"), 0)); - checkCFRange(CFStringFind(CFSTR("Hello World"), CFSTR("World"), 0)); + checkCFRange(CFStringFind((CFStringRef)@"Hello World", (CFStringRef)@"World", (CFStringCompareFlags)0)); + checkCFRange(CFStringFind(CFSTR("Hello World"), (CFStringRef)@"World", (CFStringCompareFlags)0)); + checkCFRange(CFStringFind((CFStringRef)@"Hello World", CFSTR("World"), (CFStringCompareFlags)0)); + checkCFRange(CFStringFind(CFSTR("Hello World"), CFSTR("World"), (CFStringCompareFlags)0)); /* Check for string uniquing. */ if (s0a != s0b || s0a != s2 || s1 != (id)s2) { diff --git a/gcc/testsuite/obj-c++.dg/torture/strings/const-str-10.mm b/gcc/testsuite/obj-c++.dg/torture/strings/const-str-10.mm index f2e912beb0a..e1dad124cd6 100644 --- a/gcc/testsuite/obj-c++.dg/torture/strings/const-str-10.mm +++ b/gcc/testsuite/obj-c++.dg/torture/strings/const-str-10.mm @@ -6,7 +6,7 @@ /* { dg-skip-if "" { *-*-* } { "-fgnu-runtime" } { "" } } */ /* { dg-options "-mno-constant-cfstrings" { target *-*-darwin* } } */ -#include <Foundation/NSObject.h> +#include "../../../objc-obj-c++-shared/F-NSObject.h" #include "../../../objc-obj-c++-shared/runtime.h" /* For NEXT_OBJC_USE_NEW_INTERFACE. */ @interface NSString: NSObject diff --git a/gcc/testsuite/obj-c++.dg/torture/strings/const-str-11.mm b/gcc/testsuite/obj-c++.dg/torture/strings/const-str-11.mm index 7e5d9b61e71..30a9228a64e 100644 --- a/gcc/testsuite/obj-c++.dg/torture/strings/const-str-11.mm +++ b/gcc/testsuite/obj-c++.dg/torture/strings/const-str-11.mm @@ -7,7 +7,7 @@ /* { dg-options "-fconstant-string-class=XStr" } */ /* { dg-options "-mno-constant-cfstrings -fconstant-string-class=XStr" { target *-*-darwin* } } */ -#include <Foundation/NSObject.h> +#include "../../../objc-obj-c++-shared/F-NSObject.h" #include "../../../objc-obj-c++-shared/runtime.h" /* For NEXT_OBJC_USE_NEW_INTERFACE. */ @interface XString: NSObject { diff --git a/gcc/testsuite/obj-c++.dg/torture/strings/const-str-9.mm b/gcc/testsuite/obj-c++.dg/torture/strings/const-str-9.mm index d78dc73f937..a1a14295e90 100644 --- a/gcc/testsuite/obj-c++.dg/torture/strings/const-str-9.mm +++ b/gcc/testsuite/obj-c++.dg/torture/strings/const-str-9.mm @@ -5,7 +5,7 @@ /* { dg-skip-if "" { *-*-* } { "-fgnu-runtime" } { "" } } */ /* { dg-options "-mno-constant-cfstrings" { target *-*-darwin* } } */ -#include <Foundation/NSObject.h> +#include "../../../objc-obj-c++-shared/F-NSObject.h" #include "../../../objc-obj-c++-shared/runtime.h" /* For NEXT_OBJC_USE_NEW_INTERFACE. */ @interface NSConstantString: NSObject { diff --git a/gcc/testsuite/obj-c++.dg/try-catch-1.mm b/gcc/testsuite/obj-c++.dg/try-catch-1.mm index cbdace62d43..1688995a2bf 100644 --- a/gcc/testsuite/obj-c++.dg/try-catch-1.mm +++ b/gcc/testsuite/obj-c++.dg/try-catch-1.mm @@ -39,4 +39,5 @@ int foo() @finally { printf("In @finally block (%d)... ", exc_control); } + return -1; } diff --git a/gcc/testsuite/obj-c++.dg/try-catch-3.mm b/gcc/testsuite/obj-c++.dg/try-catch-3.mm index b0822d3d7c7..e6868a350eb 100644 --- a/gcc/testsuite/obj-c++.dg/try-catch-3.mm +++ b/gcc/testsuite/obj-c++.dg/try-catch-3.mm @@ -15,4 +15,5 @@ const char *foo(void) @catch (TestsuiteObject* theException) { return [theException name]; } + return (const char *)0; } diff --git a/gcc/testsuite/objc-obj-c++-shared/CF-CFString.h b/gcc/testsuite/objc-obj-c++-shared/CF-CFString.h new file mode 100644 index 00000000000..626001bb1fa --- /dev/null +++ b/gcc/testsuite/objc-obj-c++-shared/CF-CFString.h @@ -0,0 +1,33 @@ +/* Copyright (C) 2019 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GCC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +<http://www.gnu.org/licenses/>. */ + +#ifndef _OBJC_CF_CFSTRING_H_ +#define _OBJC_CF_CFSTRING_H_ + +/* This is a workaround to PR90709 for the NeXT runtime. + If we're on a system version that has headers with items we can't + consume, then use the GNUStep header instead. +*/ + +#if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1090 +# import "GNUStep/CoreFoundation/CFString.h" +#else +# import <CoreFoundation/CFString.h> +#endif + +#endif /* _OBJC_CF_CFSTRING_H_ */ diff --git a/gcc/testsuite/objc-obj-c++-shared/F-NSArray.h b/gcc/testsuite/objc-obj-c++-shared/F-NSArray.h new file mode 100644 index 00000000000..99b6189c103 --- /dev/null +++ b/gcc/testsuite/objc-obj-c++-shared/F-NSArray.h @@ -0,0 +1,33 @@ +/* Copyright (C) 2019 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GCC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +<http://www.gnu.org/licenses/>. */ + +#ifndef _OBJC_F_NSARRAY_H_ +#define _OBJC_F_NSARRAY_H_ + +/* This is a workaround to PR90709 for the NeXT runtime. + If we're on a system version that has headers with items we can't + consume, then use the GNUStep header instead. +*/ + +#if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1090 +# import "GNUStep/Foundation/NSArray.h" +#else +# import <Foundation/NSArray.h> +#endif + +#endif /* _OBJC_F_NSARRAY_H_ */ diff --git a/gcc/testsuite/objc-obj-c++-shared/F-NSAutoreleasePool.h b/gcc/testsuite/objc-obj-c++-shared/F-NSAutoreleasePool.h new file mode 100644 index 00000000000..17599e8dfa0 --- /dev/null +++ b/gcc/testsuite/objc-obj-c++-shared/F-NSAutoreleasePool.h @@ -0,0 +1,33 @@ +/* Copyright (C) 2019 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GCC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +<http://www.gnu.org/licenses/>. */ + +#ifndef _OBJC_F_NSAUTORELEASEPOOL_H_ +#define _OBJC_F_NSAUTORELEASEPOOL_H_ + +/* This is a workaround to PR90709 for the NeXT runtime. + If we're on a system version that has headers with items we can't + consume, then use the GNUStep header instead. +*/ + +#if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1090 +# import "GNUStep/Foundation/NSAutoreleasePool.h" +#else +# import <Foundation/NSAutoreleasePool.h> +#endif + +#endif /* _OBJC_F_NSAUTORELEASEPOOL_H_ */ diff --git a/gcc/testsuite/objc-obj-c++-shared/F-NSObject.h b/gcc/testsuite/objc-obj-c++-shared/F-NSObject.h new file mode 100644 index 00000000000..a372d607b1d --- /dev/null +++ b/gcc/testsuite/objc-obj-c++-shared/F-NSObject.h @@ -0,0 +1,33 @@ +/* Copyright (C) 2019 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GCC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +<http://www.gnu.org/licenses/>. */ + +#ifndef _OBJC_F_NSOBJECT_H_ +#define _OBJC_F_NSOBJECT_H_ + +/* This is a workaround to PR90709 for the NeXT runtime. + If we're on a system version that has headers with items we can't + consume, then use the GNUStep header instead. +*/ + +#if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1090 +# import "GNUStep/Foundation/NSObject.h" +#else +# import <Foundation/NSObject.h> +#endif + +#endif /* _OBJC_F_NSOBJECT_H_ */ diff --git a/gcc/testsuite/objc-obj-c++-shared/F-NSString.h b/gcc/testsuite/objc-obj-c++-shared/F-NSString.h new file mode 100644 index 00000000000..5c29398eab7 --- /dev/null +++ b/gcc/testsuite/objc-obj-c++-shared/F-NSString.h @@ -0,0 +1,33 @@ +/* Copyright (C) 2019 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GCC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +<http://www.gnu.org/licenses/>. */ + +#ifndef _OBJC_F_NSSTRING_H_ +#define _OBJC_F_NSSTRING_H_ + +/* This is a workaround to PR90709 for the NeXT runtime. + If we're on a system version that has headers with items we can't + consume, then use the GNUStep header instead. +*/ + +#if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1090 +# import "GNUStep/Foundation/NSString.h" +#else +# import <Foundation/NSString.h> +#endif + +#endif /* _OBJC_F_NSSTRING_H_ */ diff --git a/gcc/testsuite/objc-obj-c++-shared/F-NSValue.h b/gcc/testsuite/objc-obj-c++-shared/F-NSValue.h new file mode 100644 index 00000000000..fbe2ab34592 --- /dev/null +++ b/gcc/testsuite/objc-obj-c++-shared/F-NSValue.h @@ -0,0 +1,33 @@ +/* Copyright (C) 2019 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GCC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +<http://www.gnu.org/licenses/>. */ + +#ifndef _OBJC_F_NSSTRING_H_ +#define _OBJC_F_NSSTRING_H_ + +/* This is a workaround to PR90709 for the NeXT runtime. + If we're on a system version that has headers with items we can't + consume, then use the GNUStep header instead. +*/ + +#if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1090 +# import "GNUStep/Foundation/NSValue.h" +#else +# import <Foundation/NSValue.h> +#endif + +#endif /* _OBJC_F_NSSTRING_H_ */ diff --git a/gcc/testsuite/objc-obj-c++-shared/GNUStep/CoreFoundation/CFArray.h b/gcc/testsuite/objc-obj-c++-shared/GNUStep/CoreFoundation/CFArray.h new file mode 100644 index 00000000000..0145855dbb4 --- /dev/null +++ b/gcc/testsuite/objc-obj-c++-shared/GNUStep/CoreFoundation/CFArray.h @@ -0,0 +1,191 @@ +/* CFArray.h + + Copyright (C) 2010 Free Software Foundation, Inc. + + Written by: Stefan Bidigaray + Date: January, 2010 + + This file is part of CoreBase. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; see the file COPYING.LIB. + If not, see <http://www.gnu.org/licenses/> or write to the + Free Software Foundation, 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + + +#ifndef __COREFOUNDATION_CFARRAY_H__ +#define __COREFOUNDATION_CFARRAY_H__ + +#include "CFBase.h" + +CF_EXTERN_C_BEGIN +/** \ingroup CFArrayRef + \brief Reference to an immutable array object. + */ +typedef const struct __CFArray *CFArrayRef; +/** + \ingroup CFMutableArrayRef + \brief Reference to a mutable array object. + */ +typedef struct __CFArray *CFMutableArrayRef; + +/** \defgroup CFArrayRef CFArray Reference + \brief A CFArray and its mutable type, \ref CFMutableArrayRef + "CFMutableArray", are simple, low overhead, ordered containers for + objects. + \details + <code>\#include <CoreFoundation/CFArray.h></code> + \{ + */ + +/** \name Callbacks + \{ + */ +typedef void (*CFArrayApplierFunction) (const void *value, void *context); +typedef CFStringRef (*CFArrayCopyDescriptionCallBack) (const void *value); +typedef void (*CFArrayReleaseCallBack) (CFAllocatorRef allocator, + const void *value); +typedef const void *(*CFArrayRetainCallBack) (CFAllocatorRef allocator, + const void *value); +typedef Boolean (*CFArrayEqualCallBack) (const void *value1, + const void *value2); +/** \} */ + +/** \brief Structure with CFArray callbacks. + */ +typedef struct _CFArrayCallBacks CFArrayCallBacks; +struct _CFArrayCallBacks +{ + CFIndex version; /**< Structure's version number. Current version is 0. */ + CFArrayRetainCallBack retain; + /**< The callback used to retain values added to the array. If NULL, + values are not retained. */ + CFArrayReleaseCallBack release; + CFArrayCopyDescriptionCallBack copyDescription; + CFArrayEqualCallBack equal; +}; + +/** \name Predefined Callback Structures + \{ + */ +CF_EXPORT const CFArrayCallBacks kCFTypeArrayCallBacks; +/** \} */ + + + +/** \name Creating an Array + \{ + */ +CF_EXPORT CFArrayRef +CFArrayCreate (CFAllocatorRef allocator, const void **values, + CFIndex numValues, const CFArrayCallBacks * callBacks); + +CF_EXPORT CFArrayRef +CFArrayCreateCopy (CFAllocatorRef allocator, CFArrayRef theArray); +/** \} */ + +/** \name Examining an Array + \{ + */ +CF_EXPORT CFIndex +CFArrayBSearchValues (CFArrayRef theArray, CFRange range, const void *value, + CFComparatorFunction comparator, void *context); + +CF_EXPORT Boolean +CFArrayContainsValue (CFArrayRef theArray, CFRange range, const void *value); + +CF_EXPORT CFIndex CFArrayGetCount (CFArrayRef theArray); + +CF_EXPORT CFIndex +CFArrayGetCountOfValue (CFArrayRef theArray, CFRange range, const void *value); + +CF_EXPORT CFIndex +CFArrayGetFirstIndexOfValue (CFArrayRef theArray, CFRange range, + const void *value); + +CF_EXPORT CFIndex +CFArrayGetLastIndexOfValue (CFArrayRef theArray, CFRange range, + const void *value); + +CF_EXPORT void +CFArrayGetValues (CFArrayRef theArray, CFRange range, const void **values); + +CF_EXPORT const void *CFArrayGetValueAtIndex (CFArrayRef theArray, CFIndex idx); +/** \} */ + +/** \name Applying a Function to Elements + \{ + */ +CF_EXPORT void +CFArrayApplyFunction (CFArrayRef theArray, CFRange range, + CFArrayApplierFunction applier, void *context); +/** \} */ + +/** \name Getting the CFArray Type ID + \{ + */ +CF_EXPORT CFTypeID CFArrayGetTypeID (void); +/** \} */ + +/** \} */ + +/** \defgroup CFMutableArrayRef CFMutableArray Reference + \details <code>\#include <CoreFoundation/CFArray.h></code> + \{ + */ +CF_EXPORT void +CFArrayAppendArray (CFMutableArrayRef theArray, CFArrayRef otherArray, + CFRange otherRange); + +CF_EXPORT void +CFArrayAppendValue (CFMutableArrayRef theArray, const void *value); + +CF_EXPORT CFMutableArrayRef +CFArrayCreateMutable (CFAllocatorRef allocator, CFIndex capacity, + const CFArrayCallBacks * callBacks); + +CF_EXPORT CFMutableArrayRef +CFArrayCreateMutableCopy (CFAllocatorRef allocator, CFIndex capacity, + CFArrayRef theArray); + +CF_EXPORT void +CFArrayExchangeValuesAtIndices (CFMutableArrayRef theArray, CFIndex idx1, + CFIndex idx2); + +CF_EXPORT void +CFArrayInsertValueAtIndex (CFMutableArrayRef theArray, CFIndex idx, + const void *value); + +CF_EXPORT void CFArrayRemoveAllValues (CFMutableArrayRef theArray); + +CF_EXPORT void +CFArrayRemoveValueAtIndex (CFMutableArrayRef theArray, CFIndex idx); + +CF_EXPORT void +CFArrayReplaceValues (CFMutableArrayRef theArray, CFRange range, + const void **newValues, CFIndex newCount); + +CF_EXPORT void +CFArraySetValueAtIndex (CFMutableArrayRef theArray, CFIndex idx, + const void *value); + +CF_EXPORT void +CFArraySortValues (CFMutableArrayRef theArray, CFRange range, + CFComparatorFunction comparator, void *context); + +/** \} */ + +CF_EXTERN_C_END +#endif /* __COREFOUNDATION_CFARRAY_H__ */ diff --git a/gcc/testsuite/objc-obj-c++-shared/GNUStep/CoreFoundation/CFAvailability.h b/gcc/testsuite/objc-obj-c++-shared/GNUStep/CoreFoundation/CFAvailability.h new file mode 100644 index 00000000000..855ff5c48a9 --- /dev/null +++ b/gcc/testsuite/objc-obj-c++-shared/GNUStep/CoreFoundation/CFAvailability.h @@ -0,0 +1,52 @@ +/* CFAvailability.h + + Copyright (C) 2017 Free Software Foundation, Inc. + + Written by: Stefan Bidigaray + Date: August, 2017 + + This file is part of the GNUstep CoreBase Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; see the file COPYING.LIB. + If not, see <http://www.gnu.org/licenses/> or write to the + Free Software Foundation, 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + + +#ifndef __COREFOUNDATION_CFAVAILABILITY_H__ +#define __COREFOUNDATION_CFAVAILABILITY_H__ + +/* Compiler features */ +#ifndef __has_feature +#define __has_feature(x) 0 +#endif +#ifndef __has_attribute +#define __has_attribute(x) 0 +#endif +#ifndef __has_extension +#define __has_extension(x) __has_feature +#endif + +/* CFEnum macro for type definitions */ +#if (__cplusplus && __cplusplus >= 201103L) +#define CF_ENUM(_type, _name) _type _name; enum : _type +#define CF_OPTIONS(_type, _name) _type _name; enum : _type +#else +#define CF_ENUM(_type, _name) _type _name; enum +#define CF_OPTIONS(_type, _name) _type _name; enum +#endif + +#endif /* __COREFOUNDATION_CFAVAILABILITY_H__ */ + diff --git a/gcc/testsuite/objc-obj-c++-shared/GNUStep/CoreFoundation/CFBase.h b/gcc/testsuite/objc-obj-c++-shared/GNUStep/CoreFoundation/CFBase.h new file mode 100644 index 00000000000..2df7b2925b2 --- /dev/null +++ b/gcc/testsuite/objc-obj-c++-shared/GNUStep/CoreFoundation/CFBase.h @@ -0,0 +1,464 @@ +/* CFBase.h + + Copyright (C) 2010 Free Software Foundation, Inc. + + Written by: Stefan Bidigaray + Date: January, 2010 + + This file is part of the GNUstep CoreBase Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; see the file COPYING.LIB. + If not, see <http://www.gnu.org/licenses/> or write to the + Free Software Foundation, 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + + +#ifndef __COREFOUNDATION_CFBASE_H__ +#define __COREFOUNDATION_CFBASE_H__ + +/* CoreFoundation defines __LITTLE_ENDIAN__ or __BIG_ENDIAN__ so we'll + * do the same here for compatibility. + */ +#if !defined(__LITTLE_ENDIAN__) && !defined(__BIG_ENDIAN__) +#define __LITTLE_ENDIAN__ 1 +#endif + +#include "CFAvailability.h" +#include "../GNUstepBase/GSVersionMacros.h" + +/* + * CoreFoundation types + */ +typedef unsigned char Boolean; +typedef unsigned char UInt8; +typedef signed char SInt8; +typedef unsigned short UInt16; +typedef signed short SInt16; +typedef unsigned int UInt32; +typedef signed int SInt32; +typedef unsigned long long UInt64; +typedef signed long long SInt64; +typedef SInt32 OSStatus; + +typedef float Float32; +typedef double Float64; +typedef UInt16 UniChar; +typedef UInt8 *StringPtr; +typedef const StringPtr *ConstStringPtr; +typedef UInt8 Str255[256]; +typedef const Str255 *ConstStr255Param; +typedef SInt16 OSErr; +typedef SInt16 RegionCode; +typedef SInt16 LangCode; +typedef SInt16 ScriptCode; +typedef UInt32 FourCharCode; +#ifndef OSTYPE_DECLARED +typedef FourCharCode OSType; +#define OSTYPE_DECLARED +#endif +typedef UInt8 Byte; +typedef SInt8 SignedByte; + +#ifndef UTF32Char /* UTF32Char is also defined in GSConfig.h */ +typedef UInt32 UTF32Char; +#endif +typedef UInt16 UTF16Char; +typedef UInt8 UTF8Char; + +#if !defined(CF_EXTERN_C_BEGIN) +#if defined(__cplusplus) +#define CF_EXTERN_C_BEGIN extern "C" { +#define CF_EXTERN_C_END } +#else +#define CF_EXTERN_C_BEGIN +#define CF_EXTERN_C_END +#endif +#endif + +#if defined(_WIN32) +#if defined(BUILDING_SELF) +#if defined(__cplusplus) +#define CF_EXPORT extern "C" __declspec(dllexport) +#else +#define CF_EXPORT extern __declspec(dllexport) +#endif +#else +#if defined(__cplusplus) +#define CF_EXPORT extern "C" __declspec(dllimport) +#else +#define CF_EXPORT extern __declspec(dllimport) +#endif +#endif +#else +#if defined(__cplusplus) +#define CF_EXPORT extern "C" +#else +#define CF_EXPORT extern +#endif +#endif + +#if !defined(__bool_true_false_are_defined) +#define true 1 +#define false 0 +#endif + +#ifndef TRUE +#define TRUE 1 +#endif +#ifndef FALSE +#define FALSE 0 +#endif + +#if !defined(CF_INLINE) +#if defined(__GNUC__) && (__GNUC__ >= 4) +#define CF_INLINE static __inline__ __attribute__((always_inline)) +#elif defined(__GNUC__) +#define CF_INLINE static __inline__ +#elif defined(__MWERKS__) || defined(__cplusplus) +#define CF_INLINE static inline +#elif defined(_MSC_VER) +#define CF_INLINE static __inline +#elif _WIN32 +#define CF_INLINE static __inline__ +#else +#define CF_INLINE static inline +#endif +#endif + +#if defined(__GNUC__) || defined(__llvm__) +#define GS_PURE_FUNCTION __attribute__((pure)) +#else +#define GS_PURE_FUNCTION +#endif + +CF_EXTERN_C_BEGIN +/** \defgroup CFTypeRef CFType Reference + \{ + */ +typedef unsigned long CFTypeID; +typedef const void *CFTypeRef; +/** @} + */ + +/** \defgroup BaseUtils Base Utilities + \{ + */ +/** An integer value to store a hash code. */ +typedef unsigned long CFHashCode; +/** A bitfield for passing information to functions. Can hold as many bits + as a word. + */ +typedef unsigned long CFOptionFlags; +/** A signed integer representing an index, size, length or count. */ +typedef signed long CFIndex; + +/** A structure that represents a range of items in a container, such as + an array. + */ +typedef struct CFRange CFRange; +struct CFRange +{ + CFIndex location; + /**< An integer representing the start location of the range, inclusive. */ + CFIndex length; + /**< An integer representing the total number of items in the range */ +}; + +/** Creates a CFRange structure. + \param location The starting location. + \param length The length. + \return An initialized CFRange structure. + */ +CF_INLINE CFRange +CFRangeMake (CFIndex location, CFIndex length) +{ + CFRange range; + + range.location = location; + range.length = length; + return range; +} + +/* Returned by comparison functions */ +typedef enum +{ + kCFCompareLessThan = -1, + kCFCompareEqualTo = 0, + kCFCompareGreaterThan = 1 +} CFComparisonResult; + +/* Return when a value is not found */ +enum +{ + kCFNotFound = -1 +}; + +/* Definition for standard comparison function callback. */ +typedef CFComparisonResult (*CFComparatorFunction) (const void *val1, + const void *val2, + void *context); + +/* CoreFoundation version numbers */ +/** \name Library Version Numbers + \{ + */ +CF_EXPORT const double kCFCoreFoundationVersionNumber; +#define kCFCoreFoundationVersionNumber10_0 196.40 +#define kCFCoreFoundationVersionNumber10_0_3 196.50 +#define kCFCoreFoundationVersionNumber10_1 226.00 +#define kCFCoreFoundationVersionNumber10_1_1 226.00 +#define kCFCoreFoundationVersionNumber10_1_2 227.20 +#define kCFCoreFoundationVersionNumber10_1_3 227.20 +#define kCFCoreFoundationVersionNumber10_1_4 227.30 +#define kCFCoreFoundationVersionNumber10_2 263.00 +#define kCFCoreFoundationVersionNumber10_2_1 263.10 +#define kCFCoreFoundationVersionNumber10_2_2 263.10 +#define kCFCoreFoundationVersionNumber10_2_3 263.30 +#define kCFCoreFoundationVersionNumber10_2_4 263.30 +#define kCFCoreFoundationVersionNumber10_2_5 263.50 +#define kCFCoreFoundationVersionNumber10_2_6 263.50 +#define kCFCoreFoundationVersionNumber10_2_7 263.50 +#define kCFCoreFoundationVersionNumber10_2_8 263.50 +#define kCFCoreFoundationVersionNumber10_3 299.00 +#define kCFCoreFoundationVersionNumber10_3_1 299.00 +#define kCFCoreFoundationVersionNumber10_3_2 299.00 +#define kCFCoreFoundationVersionNumber10_3_3 299.30 +#define kCFCoreFoundationVersionNumber10_3_4 299.31 +#define kCFCoreFoundationVersionNumber10_3_5 299.31 +#define kCFCoreFoundationVersionNumber10_3_6 299.32 +#define kCFCoreFoundationVersionNumber10_3_7 299.33 +#define kCFCoreFoundationVersionNumber10_3_8 299.33 +#define kCFCoreFoundationVersionNumber10_3_9 299.35 +#define kCFCoreFoundationVersionNumber10_4 368.00 +#define kCFCoreFoundationVersionNumber10_4_1 368.10 +#define kCFCoreFoundationVersionNumber10_4_2 368.11 +#define kCFCoreFoundationVersionNumber10_4_3 368.18 +#define kCFCoreFoundationVersionNumber10_4_4_Intel 368.26 +#define kCFCoreFoundationVersionNumber10_4_4_PowerPC 368.25 +#define kCFCoreFoundationVersionNumber10_4_5_Intel 368.26 +#define kCFCoreFoundationVersionNumber10_4_5_PowerPC 368.25 +#define kCFCoreFoundationVersionNumber10_4_6_Intel 368.26 +#define kCFCoreFoundationVersionNumber10_4_6_PowerPC 368.25 +#define kCFCoreFoundationVersionNumber10_4_7 368.27 +#define kCFCoreFoundationVersionNumber10_4_8 368.27 +#define kCFCoreFoundationVersionNumber10_4_9 368.28 +#define kCFCoreFoundationVersionNumber10_4_10 368.28 +#define kCFCoreFoundationVersionNumber10_4_11 368.31 +#define kCFCoreFoundationVersionNumber10_5 476.00 +#define kCFCoreFoundationVersionNumber10_5_1 476.00 +#define kCFCoreFoundationVersionNumber10_5_2 476.10 +#define kCFCoreFoundationVersionNumber10_5_3 476.13 +#define kCFCoreFoundationVersionNumber10_5_4 476.14 +#define kCFCoreFoundationVersionNumber10_5_5 476.15 +#define kCFCoreFoundationVersionNumber10_5_6 476.17 +/** \} */ +/** \} */ + +#if __has_feature(attribute_cf_returns_retained) +#define CF_RETURNS_RETAINED __attribute__((cf_returns_retained)) +#else +#define CF_RETURNS_RETAINED +#endif + +#if __has_feature(attribute_cf_returns_not_retained) +#define CF_RETURNS_NOT_RETAINED __attribute__((cf_returns_not_retained)) +#else +#define CF_RETURNS_NOT_RETAINED +#endif + +/** \ingroup CFPropertyListRef + */ +typedef CFTypeRef CFPropertyListRef; + +/** \ingroup CFStringRef + */ +typedef const struct __CFString *CFStringRef; +/** \ingroup CFMutableStringRef + */ +typedef struct __CFString *CFMutableStringRef; + + + +/** \defgroup CFAllocatorRef CFAllocator Reference + \brief CFAllocator is an opaque type used to allocate and deallocate + memory. + \{ + */ +/** \brief A reference to a CFAllocator object. + */ +typedef const struct __CFAllocator *CFAllocatorRef; + +typedef void *(*CFAllocatorAllocateCallBack) (CFIndex allocSize, + CFOptionFlags hint, void *info); +typedef void (*CFAllocatorDeallocateCallBack) (void *ptr, void *info); +typedef void *(*CFAllocatorReallocateCallBack) (void *ptr, + CFIndex newsize, + CFOptionFlags hint, void *info); +typedef CFIndex (*CFAllocatorPreferredSizeCallBack) (CFIndex size, + CFOptionFlags hint, + void *info); +typedef const void *(*CFAllocatorRetainCallBack) (const void *info); +typedef void (*CFAllocatorReleaseCallBack) (const void *info); +typedef CFStringRef (*CFAllocatorCopyDescriptionCallBack) (const void *info); + +struct _CFAllocatorContext +{ + CFIndex version; + void *info; + CFAllocatorRetainCallBack retain; + CFAllocatorReleaseCallBack release; + CFAllocatorCopyDescriptionCallBack copyDescription; + CFAllocatorAllocateCallBack allocate; + CFAllocatorReallocateCallBack reallocate; + CFAllocatorDeallocateCallBack deallocate; + CFAllocatorPreferredSizeCallBack preferredSize; +}; +typedef struct _CFAllocatorContext CFAllocatorContext; + +/** The default allocator and is equivalent to NULL. + \see CFAllocatorGetDefault() + \see CFAllocatorSetDefault() + */ +CF_EXPORT CFAllocatorRef kCFAllocatorDefault; +/** The default system allocator is used internally by GNUstep and is the + default allocator if none is been defined. + \see CFAllocatorSetDefault() + */ +CF_EXPORT CFAllocatorRef kCFAllocatorSystemDefault; +/** An allocator that uses the system's malloc, realloc and free functions. + */ +CF_EXPORT CFAllocatorRef kCFAllocatorMalloc; +#if OS_API_VERSION(MAC_OS_X_VERSION_10_4, GS_API_LATEST) +/** Equivalent to kCFAllocatorSystemDefault + */ +CF_EXPORT CFAllocatorRef kCFAllocatorMallocZone; +#endif +/** The NULL allocator does perform any operations. Can be passed as + a deallocator if you do not want GNUstep to deallocate the data. + */ +CF_EXPORT CFAllocatorRef kCFAllocatorNull; +/** This is a special case allocator directing CFAllocatorCreate() to use + the given CFAllocatorContext structure to allocate the new allocator. + */ +CF_EXPORT CFAllocatorRef kCFAllocatorUseContext; + +/** Create a new CFAllocator. + \param allocator The allocator used to create this allocator or + kCFAllocatorUseContext to use the functions in \b context. + \param context The new allocator's context functions. + \return A new CFAllocator or NULL in case of failure. + \see CFAllocatorContext + */ +CF_EXPORT CFAllocatorRef +CFAllocatorCreate (CFAllocatorRef allocator, CFAllocatorContext * context); + +/** Allocate new memory. + \param allocator The CFAllocator to use. + \param size The number of bytes to allocate. + \param hint Option flags. Currently unused and should be 0. + \return Newly allocated memory of NULL in case of failure. + \see CFAllocatorDeallocate() + */ +CF_EXPORT void *CFAllocatorAllocate (CFAllocatorRef allocator, CFIndex size, + CFOptionFlags hint); + +/** Deallocate the memory pointed to by \b ptr. + \param allocator The CFAllocator to use. + \param ptr A pointer previously allocated by CFAllocatorAllocate(). + \see CFAllocatorAllocate() + */ +CF_EXPORT void CFAllocatorDeallocate (CFAllocatorRef allocator, void *ptr); + +CF_EXPORT CFIndex +CFAllocatorGetPreferredSizeForSize (CFAllocatorRef allocator, CFIndex size, + CFOptionFlags hint); + +CF_EXPORT void *CFAllocatorReallocate (CFAllocatorRef allocator, void *ptr, + CFIndex newsize, CFOptionFlags hint); + +CF_EXPORT CFAllocatorRef CFAllocatorGetDefault (void); + +CF_EXPORT void CFAllocatorSetDefault (CFAllocatorRef allocator); + +CF_EXPORT void +CFAllocatorGetContext (CFAllocatorRef allocator, CFAllocatorContext * context); + +CF_EXPORT CFTypeID CFAllocatorGetTypeID (void); +/** \} */ + + + +/** \ingroup CFTypeRef + \{ + */ +/* These function will be implemented in CFRuntime.c since they + require runtime support. */ +CF_EXPORT CFStringRef CFCopyDescription (CFTypeRef cf); + +CF_EXPORT CFStringRef CFCopyTypeIDDescription (CFTypeID typeID); + +CF_EXPORT Boolean CFEqual (CFTypeRef cf1, CFTypeRef cf2); + +CF_EXPORT CFAllocatorRef CFGetAllocator (CFTypeRef cf); + +CF_EXPORT CFIndex CFGetRetainCount (CFTypeRef cf); + +CF_EXPORT CFTypeID CFGetTypeID (CFTypeRef cf); + +CF_EXPORT CFHashCode CFHash (CFTypeRef cf); + +#if OS_API_VERSION(MAC_OS_X_VERSION_10_4, GS_API_LATEST) +CF_EXPORT CFTypeRef CFMakeCollectable (CFTypeRef cf); +#endif + +CF_EXPORT void CFRelease (CFTypeRef cf); + +CF_EXPORT CFTypeRef CFRetain (CFTypeRef cf); + +CF_EXPORT CFTypeRef CFAutorelease(CFTypeRef arg); + +#if OS_API_VERSION(MAC_OS_X_VERSION_10_7, GS_API_LATEST) +CF_EXPORT void *_CFBridgingRelease (CFTypeRef cf); +CF_EXPORT CFTypeRef _CFBridgingRetain (void *obj); + +#if __has_feature(objc_arc) +#define CFBridgingRetain(x) (__bridge_retained CFTypeRef)(x) +#define CFBridgingRelease(x) (__bridge_transfer id)(x) +#elif __OBJC__ +#define CFBridgingRetain(x) _CFBridgingRetain((void *)(x)) +#define CFBridgingRelease(x) (id)_CFBridgingRelease((x)) +#else +#define CFBridgingRetain(x) _CFBridgingRetain((void *)(x)) +#define CFBridgingRelease(x) _CFBridgingRelease((x)) +#endif +#endif +/** \} */ + + + +/** \defgroup CFNullRef CFNull Reference + \{ + */ +#if OS_API_VERSION(MAC_OS_X_VERSION_10_2, GS_API_LATEST) +typedef struct __CFNull *CFNullRef; + +CF_EXPORT CFNullRef kCFNull; + +CFTypeID CFNullGetTypeID (void); +#endif +/** \} */ + +CF_EXTERN_C_END +#endif /* __COREFOUNDATION_CFBASE_H__ */ diff --git a/gcc/testsuite/objc-obj-c++-shared/GNUStep/CoreFoundation/CFCharacterSet.h b/gcc/testsuite/objc-obj-c++-shared/GNUStep/CoreFoundation/CFCharacterSet.h new file mode 100644 index 00000000000..1cb6c66cac8 --- /dev/null +++ b/gcc/testsuite/objc-obj-c++-shared/GNUStep/CoreFoundation/CFCharacterSet.h @@ -0,0 +1,173 @@ +/* CFCharacterSet.h + + Copyright (C) 2012 Free Software Foundation, Inc. + + Written by: Stefan Bidigaray + Date: January, 2012 + + This file is part of the GNUstep CoreBase Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; see the file COPYING.LIB. + If not, see <http://www.gnu.org/licenses/> or write to the + Free Software Foundation, 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef __COREFOUNDATION_CFCHARACTERSET_H__ +#define __COREFOUNDATION_CFCHARACTERSET_H__ + +#include "CFBase.h" +#include "CFData.h" + +CF_EXTERN_C_BEGIN + +/** \ingroup CFCharacterSetRef */ +typedef const struct __CFCharacterSet * CFCharacterSetRef; +/** \ingroup CFMutableCharacterSetRef */ +typedef struct __CFCharacterSet * CFMutableCharacterSetRef; + +/** \defgroup CFCharacterSetRef CFCharacterSet Reference + \{ + */ +typedef enum +{ + kCFCharacterSetControl = 1, + kCFCharacterSetWhitespace, + kCFCharacterSetWhitespaceAndNewline, + kCFCharacterSetDecimalDigit, + kCFCharacterSetLetter, + kCFCharacterSetLowercaseLetter, + kCFCharacterSetUppercaseLetter, + kCFCharacterSetNonBase, + kCFCharacterSetDecomposable, + kCFCharacterSetAlphaNumeric, + kCFCharacterSetPunctuation, +#if OS_API_VERSION(MAC_OS_X_VERSION_10_2, GS_API_LATEST) + kCFCharacterSetCapitalizedLetter = 13, +#endif +#if OS_API_VERSION(MAC_OS_X_VERSION_10_3, GS_API_LATEST) + kCFCharacterSetSymbol = 14, +#endif +#if OS_API_VERSION(MAC_OS_X_VERSION_10_5, GS_API_LATEST) + kCFCharacterSetNewline = 15, +#endif + kCFCharacterSetIllegal = 12 +} CFCharacterSetPredefinedSet; + + + +/** \name Creating Character Sets + \{ + */ +#if OS_API_VERSION(MAC_OS_X_VERSION_10_3, GS_API_LATEST) +CF_EXPORT CFCharacterSetRef +CFCharacterSetCreateCopy (CFAllocatorRef alloc, CFCharacterSetRef set); +#endif + +#if OS_API_VERSION(MAC_OS_X_VERSION_10_2, GS_API_LATEST) +CF_EXPORT CFCharacterSetRef +CFCharacterSetCreateInvertedSet (CFAllocatorRef alloc, CFCharacterSetRef set); +#endif + +CF_EXPORT CFCharacterSetRef +CFCharacterSetCreateWithCharactersInRange (CFAllocatorRef alloc, + CFRange range); + +CF_EXPORT CFCharacterSetRef +CFCharacterSetCreateWithCharactersInString (CFAllocatorRef alloc, + CFStringRef string); + +CF_EXPORT CFCharacterSetRef +CFCharacterSetCreateWithBitmapRepresentation (CFAllocatorRef alloc, + CFDataRef data); +/** \} */ + +/** \name Getting Predefined Character Sets + \{ + */ +CF_EXPORT CFCharacterSetRef +CFCharacterSetGetPredefined (CFCharacterSetPredefinedSet setIdentifier); +/** \} */ + +/** \name Querying Character Sets + \{ + */ +CF_EXPORT CFDataRef +CFCharacterSetCreateBitmapRepresentation (CFAllocatorRef alloc, + CFCharacterSetRef set); + +CF_EXPORT Boolean +CFCharacterSetIsCharacterMember (CFCharacterSetRef set, UniChar c); + +#if OS_API_VERSION(MAC_OS_X_VERSION_10_2, GS_API_LATEST) +CF_EXPORT Boolean +CFCharacterSetHasMemberInPlane (CFCharacterSetRef set, CFIndex plane); + +CF_EXPORT Boolean +CFCharacterSetIsLongCharacterMember (CFCharacterSetRef set, UTF32Char c); + +CF_EXPORT Boolean +CFCharacterSetIsSupersetOfSet (CFCharacterSetRef set, + CFCharacterSetRef otherSet); +#endif +/** \} */ + +/** \name Getting the Character Set Type Identifier + \{ + */ +CF_EXPORT CFTypeID +CFCharacterSetGetTypeID (void); +/** \} */ +/** \} */ + +/** \defgroup CFMutableCharacterSetRef CFMutableCharacterSet Reference + \{ + */ +CF_EXPORT CFMutableCharacterSetRef +CFCharacterSetCreateMutable (CFAllocatorRef alloc); + +CF_EXPORT CFMutableCharacterSetRef +CFCharacterSetCreateMutableCopy (CFAllocatorRef alloc, CFCharacterSetRef set); + +CF_EXPORT void +CFCharacterSetAddCharactersInRange (CFMutableCharacterSetRef set, + CFRange range); + +CF_EXPORT void +CFCharacterSetAddCharactersInString (CFMutableCharacterSetRef set, + CFStringRef string); + +CF_EXPORT void +CFCharacterSetRemoveCharactersInRange (CFMutableCharacterSetRef set, + CFRange range); + +CF_EXPORT void +CFCharacterSetRemoveCharactersInString (CFMutableCharacterSetRef set, + CFStringRef string); + +CF_EXPORT void +CFCharacterSetIntersect (CFMutableCharacterSetRef set, + CFCharacterSetRef otherSet); + +CF_EXPORT void +CFCharacterSetInvert (CFMutableCharacterSetRef set); + +CF_EXPORT void +CFCharacterSetUnion (CFMutableCharacterSetRef set, CFCharacterSetRef otherSet); +/** \} */ + +CF_EXTERN_C_END + +#endif /* __COREFOUNDATION_CFCHARACTERSET_H__ */ + diff --git a/gcc/testsuite/objc-obj-c++-shared/GNUStep/CoreFoundation/CFData.h b/gcc/testsuite/objc-obj-c++-shared/GNUStep/CoreFoundation/CFData.h new file mode 100644 index 00000000000..9e98a6969cd --- /dev/null +++ b/gcc/testsuite/objc-obj-c++-shared/GNUStep/CoreFoundation/CFData.h @@ -0,0 +1,114 @@ +/* CFData.h + + Copyright (C) 2010 Free Software Foundation, Inc. + + Written by: Stefan Bidigaray + Date: January, 2010 + + This file is part of CoreBase. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; see the file COPYING.LIB. + If not, see <http://www.gnu.org/licenses/> or write to the + Free Software Foundation, 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef __COREFOUNDATION_CFDATA_H__ +#define __COREFOUNDATION_CFDATA_H__ + +#include "CFBase.h" + +CF_EXTERN_C_BEGIN +/** \ingroup CFDataRef */ +typedef const struct __CFData *CFDataRef; +/** \ingroup CFMutableDataRef */ +typedef struct __CFData *CFMutableDataRef; + +/** \defgroup CFDataRef CFData Reference + \{ + */ +/** \name Creating a CFData Object + \{ + */ +CF_EXPORT CFDataRef +CFDataCreate (CFAllocatorRef allocator, const UInt8 * bytes, CFIndex length); + +CF_EXPORT CFDataRef +CFDataCreateCopy (CFAllocatorRef allocator, CFDataRef theData); + +CF_EXPORT CFDataRef +CFDataCreateWithBytesNoCopy (CFAllocatorRef allocator, const UInt8 * bytes, + CFIndex length, CFAllocatorRef bytesDeallocator); +/** \} */ + +/** \name Examining a CFData Object + \{ + */ +CF_EXPORT const UInt8 *CFDataGetBytePtr (CFDataRef theData); + +CF_EXPORT void +CFDataGetBytes (CFDataRef theData, CFRange range, UInt8 * buffer); + +CF_EXPORT CFIndex CFDataGetLength (CFDataRef theData); +/** \} */ + +/** \name Getting the CFData Type ID + \{ + */ +CF_EXPORT CFTypeID CFDataGetTypeID (void); +/** \} */ +/** \} */ + +/** \defgroup CFMutableDataRef CFMutableData Reference + \{ + */ +/** \name Creating a Mutable Data Object + \{ + */ +CF_EXPORT CFMutableDataRef +CFDataCreateMutable (CFAllocatorRef allocator, CFIndex capacity); + +CF_EXPORT CFMutableDataRef +CFDataCreateMutableCopy (CFAllocatorRef allocator, CFIndex capacity, + CFDataRef theData); +/** \} */ + +/** \name Accessing Mutable Data + \{ + */ +CF_EXPORT UInt8 *CFDataGetMutableBytePtr (CFMutableDataRef theData); +/** \} */ + +/** \name Modifying a Mutable Data Object + \{ + */ +CF_EXPORT void +CFDataAppendBytes (CFMutableDataRef theData, const UInt8 * bytes, + CFIndex length); + +CF_EXPORT void CFDataDeleteBytes (CFMutableDataRef theData, CFRange range); + +CF_EXPORT void +CFDataReplaceBytes (CFMutableDataRef theData, CFRange range, + const UInt8 * newBytes, CFIndex newLength); + +CF_EXPORT void +CFDataIncreaseLength (CFMutableDataRef theData, CFIndex extraLength); + +CF_EXPORT void CFDataSetLength (CFMutableDataRef theData, CFIndex length); +/** \} */ +/** \} */ + +CF_EXTERN_C_END +#endif /* __COREFOUNDATION_CFDATA_H__ */ diff --git a/gcc/testsuite/objc-obj-c++-shared/GNUStep/CoreFoundation/CFDictionary.h b/gcc/testsuite/objc-obj-c++-shared/GNUStep/CoreFoundation/CFDictionary.h new file mode 100644 index 00000000000..adc0dd8c4b0 --- /dev/null +++ b/gcc/testsuite/objc-obj-c++-shared/GNUStep/CoreFoundation/CFDictionary.h @@ -0,0 +1,174 @@ +/* CFDictionary.h + + Copyright (C) 2010 Free Software Foundation, Inc. + + Written by: Stefan Bidigaray + Date: January, 2010 + + This file is part of the GNUstep CoreBase Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; see the file COPYING.LIB. + If not, see <http://www.gnu.org/licenses/> or write to the + Free Software Foundation, 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef __COREFOUNDATION_CFDICTIONARY_H__ +#define __COREFOUNDATION_CFDICTIONARY_H__ 1 + +#include "CFBase.h" + +CF_EXTERN_C_BEGIN +/** \ingroup CFDictionaryRef */ +typedef const struct __CFDictionary *CFDictionaryRef; +/** \ingroup CFMutableDictionaryRef */ +typedef struct __CFDictionary *CFMutableDictionaryRef; + +/** \defgroup CFDictionaryRef CFDictionary Reference + \{ + */ +typedef void (*CFDictionaryApplierFunction) (const void *key, + const void *value, void *context); + +typedef CFStringRef (*CFDictionaryCopyDescriptionCallBack) (const void *value); +typedef Boolean (*CFDictionaryEqualCallBack) (const void *value1, + const void *value2); +typedef CFHashCode (*CFDictionaryHashCallBack) (const void *value); +typedef void (*CFDictionaryReleaseCallBack) (CFAllocatorRef allocator, + const void *value); +typedef const void *(*CFDictionaryRetainCallBack) (CFAllocatorRef allocator, + const void *value); + +typedef struct _CFDictionaryKeyCallBacks CFDictionaryKeyCallBacks; +struct _CFDictionaryKeyCallBacks +{ + CFIndex version; + CFDictionaryRetainCallBack retain; + CFDictionaryReleaseCallBack release; + CFDictionaryCopyDescriptionCallBack copyDescription; + CFDictionaryEqualCallBack equal; + CFDictionaryHashCallBack hash; +}; + +typedef struct _CFDictionaryValueCallBacks CFDictionaryValueCallBacks; +struct _CFDictionaryValueCallBacks +{ + CFIndex version; + CFDictionaryRetainCallBack retain; + CFDictionaryReleaseCallBack release; + CFDictionaryCopyDescriptionCallBack copyDescription; + CFDictionaryEqualCallBack equal; +}; + +CF_EXPORT const CFDictionaryKeyCallBacks kCFCopyStringDictionaryKeyCallBacks; +CF_EXPORT const CFDictionaryKeyCallBacks kCFTypeDictionaryKeyCallBacks; +CF_EXPORT const CFDictionaryValueCallBacks kCFTypeDictionaryValueCallBacks; + +/** \name Creating a dictionary + \{ + */ +CF_EXPORT CFDictionaryRef +CFDictionaryCreate (CFAllocatorRef allocator, const void **keys, + const void **values, CFIndex numValues, + const CFDictionaryKeyCallBacks * keyCallBacks, + const CFDictionaryValueCallBacks * valueCallBacks); + +CF_EXPORT CFDictionaryRef +CFDictionaryCreateCopy (CFAllocatorRef allocator, CFDictionaryRef theDict); +/** \} */ + +/** \name Examining a dictionary + \{ + */ +CF_EXPORT Boolean +CFDictionaryContainsKey (CFDictionaryRef theDict, const void *key); + +CF_EXPORT Boolean +CFDictionaryContainsValue (CFDictionaryRef theDict, const void *value); + +CF_EXPORT CFIndex CFDictionaryGetCount (CFDictionaryRef theDict); + +CF_EXPORT CFIndex +CFDictionaryGetCountOfKey (CFDictionaryRef theDict, const void *key); + +CF_EXPORT CFIndex +CFDictionaryGetCountOfValue (CFDictionaryRef theDict, const void *value); + +CF_EXPORT void +CFDictionaryGetKeysAndValues (CFDictionaryRef theDict, const void **keys, + const void **values); + +CF_EXPORT const void *CFDictionaryGetValue (CFDictionaryRef theDict, + const void *key); + +CF_EXPORT Boolean +CFDictionaryGetValueIfPresent (CFDictionaryRef theDict, const void *key, + const void **value); +/** \} */ + +/** \name Applying a funcation to a dictionary + \{ + */ +CF_EXPORT void +CFDictionaryApplyFunction (CFDictionaryRef theDict, + CFDictionaryApplierFunction applier, void *context); +/** \} */ + +/** \name Getting the CFDictionary type ID + \{ + */ +CF_EXPORT CFTypeID CFDictionaryGetTypeID (void); +/** \} */ +/** \} */ + +/** \defgroup CFMutableDictionaryRef CFMutableDictionary Reference + \{ + */ +/** \name Creating a Mutable Dictionary + \{ + */ +CF_EXPORT CFMutableDictionaryRef +CFDictionaryCreateMutable (CFAllocatorRef allocator, CFIndex capacity, + const CFDictionaryKeyCallBacks * keyCallBacks, + const CFDictionaryValueCallBacks * valueCallBacks); + +CF_EXPORT CFMutableDictionaryRef +CFDictionaryCreateMutableCopy (CFAllocatorRef allocator, CFIndex capacity, + CFDictionaryRef theDict); +/** \} */ + +/** \name Modifying a Dictionary + \{ + */ +CF_EXPORT void +CFDictionaryAddValue (CFMutableDictionaryRef theDict, const void *key, + const void *value); + +CF_EXPORT void CFDictionaryRemoveAllValues (CFMutableDictionaryRef theDict); + +CF_EXPORT void +CFDictionaryRemoveValue (CFMutableDictionaryRef theDict, const void *key); + +CF_EXPORT void +CFDictionaryReplaceValue (CFMutableDictionaryRef theDict, const void *key, + const void *value); + +CF_EXPORT void +CFDictionarySetValue (CFMutableDictionaryRef theDict, const void *key, + const void *value); +/** \} */ +/** \} */ + +CF_EXTERN_C_END +#endif /* __COREFOUNDATION_CFDICTIONARY_H__ */ diff --git a/gcc/testsuite/objc-obj-c++-shared/GNUStep/CoreFoundation/CFLocale.h b/gcc/testsuite/objc-obj-c++-shared/GNUStep/CoreFoundation/CFLocale.h new file mode 100644 index 00000000000..7ae082de886 --- /dev/null +++ b/gcc/testsuite/objc-obj-c++-shared/GNUStep/CoreFoundation/CFLocale.h @@ -0,0 +1,249 @@ +/* CFLocale.h + + Copyright (C) 2010 Free Software Foundation, Inc. + + Written by: Stefan Bidigaray + Date: March, 2011 + + This file is part of the GNUstep CoreBase Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; see the file COPYING.LIB. + If not, see <http://www.gnu.org/licenses/> or write to the + Free Software Foundation, 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef __COREFOUNDATION_CFLOCALE__ +#define __COREFOUNDATION_CFLOCALE__ 1 + +#include "CFBase.h" + +#include "CFArray.h" +#include "CFDictionary.h" + +#if OS_API_VERSION(MAC_OS_X_VERSION_10_3, GS_API_LATEST) + +CF_EXTERN_C_BEGIN + +/** \defgroup CFLocaleRef CFLocale Reference + \brief CFLocale provides basic functionality for language and/or region + specific operations. + + Locale-sensitive operations, such as collation, calendars and + capitalization, may use CFLocale objects to provide language and/or region + specific functionality. + + CFLocale is "toll-free bridged" to NSLocale. + + \{ + */ +typedef const struct __CFLocale *CFLocaleRef; + +/** + */ +enum +{ + kCFLocaleLanguageDirectionUnknown = 0, + kCFLocaleLanguageDirectionLeftToRight = 1, + kCFLocaleLanguageDirectionRightToLeft = 2, + kCFLocaleLanguageDirectionTopToBottom = 3, + kCFLocaleLanguageDirectionBottomToTop = 4 +}; +typedef CFIndex CFLocaleLanguageDirection; + +/** \name CFLocale Property Keys + \{ + */ +CF_EXPORT const CFStringRef kCFLocaleMeasurementSystem; /* CFString */ +CF_EXPORT const CFStringRef kCFLocaleDecimalSeparator; /* CFString */ +CF_EXPORT const CFStringRef kCFLocaleGroupingSeparator; /* CFString */ +CF_EXPORT const CFStringRef kCFLocaleCurrencySymbol; /* CFString */ +CF_EXPORT const CFStringRef kCFLocaleCurrencyCode; /* CFString */ +#if OS_API_VERSION(MAC_OS_X_VERSION_10_4, GS_API_LATEST) +CF_EXPORT const CFStringRef kCFLocaleIdentifier; /* CFString */ +CF_EXPORT const CFStringRef kCFLocaleLanguageCode; /* CFString */ +CF_EXPORT const CFStringRef kCFLocaleCountryCode; /* CFString */ +CF_EXPORT const CFStringRef kCFLocaleScriptCode; /* CFString */ +CF_EXPORT const CFStringRef kCFLocaleVariantCode; /* CFString */ +CF_EXPORT const CFStringRef kCFLocaleExemplarCharacterSet; /* CFCharacterSet */ +CF_EXPORT const CFStringRef kCFLocaleCalendarIdentifier; /* CFString */ +CF_EXPORT const CFStringRef kCFLocaleCalendar; /* CFCalendar */ +CF_EXPORT const CFStringRef kCFLocaleCollationIdentifier; /* CFString */ +CF_EXPORT const CFStringRef kCFLocaleUsesMetricSystem; /* CFBoolean */ +#endif +#if OS_API_VERSION(MAC_OS_X_VERSION_10_6, GS_API_LATEST) +CF_EXPORT const CFStringRef kCFLocaleCollatorIdentifier; /* CFString */ +CF_EXPORT const CFStringRef kCFLocaleQuotationBeginDelimiterKey; /* CFString */ +CF_EXPORT const CFStringRef kCFLocaleQuotationEndDelimiterKey; /* CFString */ +CF_EXPORT const CFStringRef kCFLocaleAlternateQuotationBeginDelimiterKey; /* CFString */ +CF_EXPORT const CFStringRef kCFLocaleAlternateQuotationEndDelimiterKey; /* CFString */ +#endif +/** \} */ + +/** \name CFCalendar Identifiers + \{ + */ +CF_EXPORT const CFStringRef kCFGregorianCalendar; +#if OS_API_VERSION(MAC_OS_X_VERSION_10_4, GS_API_LATEST) +CF_EXPORT const CFStringRef kCFBuddhistCalendar; +CF_EXPORT const CFStringRef kCFChineseCalendar; +CF_EXPORT const CFStringRef kCFHebrewCalendar; +CF_EXPORT const CFStringRef kCFIslamicCalendar; +CF_EXPORT const CFStringRef kCFIslamicCivilCalendar; +CF_EXPORT const CFStringRef kCFJapaneseCalendar; +#endif +#if OS_API_VERSION(MAC_OS_X_VERSION_10_6, GS_API_LATEST) +CF_EXPORT const CFStringRef kCFRepublicOfChinaCalendar; +CF_EXPORT const CFStringRef kCFPersianCalendar; +CF_EXPORT const CFStringRef kCFIndianCalendar; +CF_EXPORT const CFStringRef kCFISO8601Calendar; +#endif +/** \} */ + +/** CFLocale Change Notification + */ +CF_EXPORT const CFStringRef kCFLocaleCurrentLocaleDidChangeNotification; + + + +/** \name Creating a Locale + \{ + */ +CF_EXPORT CFLocaleRef +CFLocaleCopyCurrent (void); + +CF_EXPORT CFLocaleRef +CFLocaleCreate (CFAllocatorRef allocator, + CFStringRef localeIdent); + +CF_EXPORT CFLocaleRef +CFLocaleCreateCopy (CFAllocatorRef allocator, + CFLocaleRef locale); + +CF_EXPORT CFLocaleRef +CFLocaleGetSystem (void); +/** \} */ + +/** \name Getting System Locale Information + \{ + */ +#if OS_API_VERSION(MAC_OS_X_VERSION_10_4, GS_API_LATEST) +CF_EXPORT CFArrayRef +CFLocaleCopyAvailableLocaleIdentifiers (void); +#endif +/** \} */ + +/** \name Getting ISO Information + \{ + */ +#if OS_API_VERSION(MAC_OS_X_VERSION_10_4, GS_API_LATEST) +CF_EXPORT CFArrayRef +CFLocaleCopyISOCountryCodes (void); + +CF_EXPORT CFArrayRef +CFLocaleCopyISOLanguageCodes (void); + +CF_EXPORT CFArrayRef +CFLocaleCopyISOCurrencyCodes (void); +#endif + +#if OS_API_VERSION(MAC_OS_X_VERSION_10_5, GS_API_LATEST) +CF_EXPORT CFArrayRef +CFLocaleCopyCommonISOCurrencyCodes (void); +#endif +/** \{ */ + +/** \name Accessing Language Information + \{ + */ +#if OS_API_VERSION(MAC_OS_X_VERSION_10_5, GS_API_LATEST) +CF_EXPORT CFArrayRef +CFLocaleCopyPreferredLanguages (void); +#endif + +#if OS_API_VERSION(MAC_OS_X_VERSION_10_6, GS_API_LATEST) +CF_EXPORT CFLocaleLanguageDirection +CFLocaleGetLanguageCharacterDirection (CFStringRef isoLangCode); + +CF_EXPORT CFLocaleLanguageDirection +CFLocaleGetLanguageLineDirection (CFStringRef isoLangCode); +#endif +/** \} */ + +/** \name Getting Information About a Locale + \{ + */ +CF_EXPORT CFStringRef +CFLocaleCopyDisplayNameForPropertyValue (CFLocaleRef displayLocale, + CFStringRef key, + CFStringRef value); + +CF_EXPORT CFTypeRef +CFLocaleGetValue (CFLocaleRef locale, + CFStringRef key); + +CF_EXPORT CFStringRef +CFLocaleGetIdentifier (CFLocaleRef locale); +/** \} */ + +/** \name Getting and Creating Locale Identifiers + \{ + */ +CF_EXPORT CFStringRef +CFLocaleCreateCanonicalLocaleIdentifierFromString (CFAllocatorRef allocator, + CFStringRef localeIdent); + +#if OS_API_VERSION(MAC_OS_X_VERSION_10_4, GS_API_LATEST) +CF_EXPORT CFStringRef +CFLocaleCreateCanonicalLanguageIdentifierFromString (CFAllocatorRef allocator, + CFStringRef localeIdent); + +CF_EXPORT CFDictionaryRef +CFLocaleCreateComponentsFromLocaleIdentifier (CFAllocatorRef allocator, + CFStringRef localeIdent); + +CF_EXPORT CFStringRef +CFLocaleCreateLocaleIdentifierFromComponents (CFAllocatorRef allocator, + CFDictionaryRef dictionary); +#endif +/** \} */ + +/** \name Windows Locale Codes + \{ + */ +#if OS_API_VERSION(MAC_OS_X_VERSION_10_6, GS_API_LATEST) +CF_EXPORT CFStringRef +CFLocaleCreateLocaleIdentifierFromWindowsLocaleCode (CFAllocatorRef allocator, + UInt32 lcid); + +CF_EXPORT UInt32 +CFLocaleGetWindowsLocaleCodeFromLocaleIdentifier (CFStringRef localeIdent); +#endif +/** \} */ + +/** \name Getting the CFLocale Type ID + \{ + */ +CF_EXPORT CFTypeID +CFLocaleGetTypeID (void); +/** \} */ + +/** \} */ + +CF_EXTERN_C_END + +#endif /* OS_API_VERSION >= MAC_OS_X_VERSION_10_3 */ + +#endif /* __COREFOUNDATION_CFLOCALE__ */ + diff --git a/gcc/testsuite/objc-obj-c++-shared/GNUStep/CoreFoundation/CFString.h b/gcc/testsuite/objc-obj-c++-shared/GNUStep/CoreFoundation/CFString.h new file mode 100644 index 00000000000..42e4967ce90 --- /dev/null +++ b/gcc/testsuite/objc-obj-c++-shared/GNUStep/CoreFoundation/CFString.h @@ -0,0 +1,593 @@ +/* CFString.h + + Copyright (C) 2010 Free Software Foundation, Inc. + + Written by: Stefan Bidigaray + Date: January, 2010 + + This file is part of CoreBase. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; see the file COPYING.LIB. + If not, see <http://www.gnu.org/licenses/> or write to the + Free Software Foundation, 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef __COREFOUNDATION_CFSTRING_H__ +#define __COREFOUNDATION_CFSTRING_H__ + +#include "CFBase.h" +#include "CFArray.h" +#include "CFCharacterSet.h" +#include "CFData.h" +#include "CFDictionary.h" +#include "CFLocale.h" + +#include <stdarg.h> + +CF_EXTERN_C_BEGIN + +/** \defgroup CFStringRef CFString Reference + \brief The CFString type defines opaque objects representing strings. + + CFString is "toll-free bridged" to NSString. + + \{ + */ + +/* + * Data Types + */ +typedef UInt32 CFStringEncoding; + +/* + * Constants + */ +typedef enum +{ + kCFCompareCaseInsensitive = 1, + kCFCompareBackwards = 4, + kCFCompareAnchored = 8, + kCFCompareNonliteral = 16, + kCFCompareLocalized = 32, + kCFCompareNumerically = 64, +#if OS_API_VERSION(MAC_OS_X_VERSION_10_5, GS_API_LATEST) + kCFCompareDiacriticInsensitive = 128, + kCFCompareWidthInsensitive = 256, + kCFCompareForcedOrdering = 512 +#endif +} CFStringCompareFlags; + +enum CFStringBuiltInEncodings +{ + kCFStringEncodingMacRoman = 0, + kCFStringEncodingWindowsLatin1 = 0x0500, + kCFStringEncodingISOLatin1 = 0x0201, + kCFStringEncodingNextStepLatin = 0x0B01, + kCFStringEncodingASCII = 0x0600, + kCFStringEncodingUnicode = 0x0100, + kCFStringEncodingUTF8 = 0x08000100, + kCFStringEncodingNonLossyASCII = 0x0BFF, +#if OS_API_VERSION(MAC_OS_X_VERSION_10_4, GS_API_LATEST) + kCFStringEncodingUTF16 = 0x0100, + kCFStringEncodingUTF16BE = 0x10000100, + kCFStringEncodingUTF16LE = 0x14000100, + kCFStringEncodingUTF32 = 0x0c000100, + kCFStringEncodingUTF32BE = 0x18000100, + kCFStringEncodingUTF32LE = 0x1c000100 +#endif +}; + +#if OS_API_VERSION(MAC_OS_X_VERSION_10_2, GS_API_LATEST) +# define kCFStringEncodingInvalidId (0xffffffffU) +#endif + +/** \def CFSTR(x) + \brief Creates a constant string object. + + \note This macro will create the constant string at runtime. + */ +/* The 'pure' attribute tells the compiler that this function will always + return the same result with the same input. If it has any skill, then + constant propagation passes will magically make sure that this function is + called as few times as possible. */ +CF_EXPORT CFStringRef +__CFStringMakeConstantString (const char *str) GS_PURE_FUNCTION; +//#define CFSTR(x) __CFStringMakeConstantString("" x "") + +#ifdef __CONSTANT_CFSTRINGS__ +#define CFSTR(x) ((CFStringRef) __builtin___CFStringMakeConstantString ("" x "")) +#else +#define CFSTR(x) __CFStringMakeConstantString("" x "") +#endif + +/** \name Creating a CFString + \{ + */ +CF_EXPORT CFArrayRef +CFStringCreateArrayBySeparatingStrings (CFAllocatorRef alloc, + CFStringRef theString, CFStringRef separatorString); + +CF_EXPORT CFStringRef +CFStringCreateByCombiningStrings (CFAllocatorRef alloc, CFArrayRef theArray, + CFStringRef separatorString); + +CF_EXPORT CFStringRef +CFStringCreateCopy (CFAllocatorRef alloc, CFStringRef theString); + +CF_EXPORT CFStringRef +CFStringCreateFromExternalRepresentation (CFAllocatorRef alloc, CFDataRef data, + CFStringEncoding encoding); + +CF_EXPORT CFStringRef +CFStringCreateWithBytes (CFAllocatorRef alloc, const UInt8 *bytes, + CFIndex numBytes, CFStringEncoding encoding, Boolean isExternalRepresentation); + +CF_EXPORT CFStringRef +CFStringCreateWithCharacters (CFAllocatorRef alloc, const UniChar *chars, + CFIndex numChars); + +CF_EXPORT CFStringRef +CFStringCreateWithCharactersNoCopy (CFAllocatorRef alloc, const UniChar *chars, + CFIndex numChars, CFAllocatorRef contentsDeallocator); + +CF_EXPORT CFStringRef +CFStringCreateWithCString (CFAllocatorRef alloc, const char *cStr, + CFStringEncoding encoding); + +CF_EXPORT CFStringRef +CFStringCreateWithCStringNoCopy (CFAllocatorRef alloc, const char *cStr, + CFStringEncoding encoding, CFAllocatorRef contentsDeallocator); + +CF_EXPORT CFStringRef +CFStringCreateWithFormat (CFAllocatorRef alloc, CFDictionaryRef formatOptions, + CFStringRef format, ...); + +CF_EXPORT CFStringRef +CFStringCreateWithFormatAndArguments (CFAllocatorRef alloc, + CFDictionaryRef formatOptions, CFStringRef format, va_list arguments); + +CF_EXPORT CFStringRef +CFStringCreateWithSubstring (CFAllocatorRef alloc, CFStringRef str, + CFRange range); + +#if OS_API_VERSION(MAC_OS_X_VERSION_10_4, GS_API_LATEST) +CF_EXPORT CFStringRef +CFStringCreateWithFileSystemRepresentation (CFAllocatorRef alloc, + const char *buffer); +#endif + +#if OS_API_VERSION(MAC_OS_X_VERSION_10_5, GS_API_LATEST) +CF_EXPORT CFStringRef +CFStringCreateWithBytesNoCopy (CFAllocatorRef alloc, const UInt8 *bytes, + CFIndex numBytes, CFStringEncoding encoding, Boolean isExternalReprentation, + CFAllocatorRef contentsDeallocator); +#endif +/** \} */ + +/** \name Searching CFStrings + \{ + */ +CF_EXPORT CFArrayRef +CFStringCreateArrayWithFindResults (CFAllocatorRef alloc, CFStringRef theString, + CFStringRef stringToFind, CFRange rangeToSearch, + CFStringCompareFlags compareOptions); + +CF_EXPORT CFRange +CFStringFind (CFStringRef theString, CFStringRef stringToFind, + CFStringCompareFlags compareOptions); + +CF_EXPORT Boolean +CFStringFindWithOptions (CFStringRef theString, CFStringRef stringToFind, + CFRange rangeToSearch, CFStringCompareFlags searchOptions, CFRange *result); + +CF_EXPORT Boolean +CFStringFindWithOptionsAndLocale (CFStringRef theString,CFStringRef stringToFind, + CFRange rangeToSearch, CFStringCompareFlags searchOptions, + CFLocaleRef locale, CFRange *result); + +CF_EXPORT void +CFStringGetLineBounds (CFStringRef theString, CFRange range, + CFIndex *lineBeginIndex, CFIndex *lineEndIndex, CFIndex *contentsEndIndex); + +#if OS_API_VERSION(MAC_OS_X_VERSION_10_2, GS_API_LATEST) +CF_EXPORT Boolean +CFStringFindCharacterFromSet (CFStringRef theString, CFCharacterSetRef theSet, + CFRange rangeToSearch, CFStringCompareFlags searchOptions, CFRange *result); +#endif + +#if OS_API_VERSION(MAC_OS_X_VERSION_10_5, GS_API_LATEST) +CF_EXPORT void +CFStringGetParagraphBounds (CFStringRef string, CFRange range, + CFIndex *parBeginIndex, CFIndex *parEndIndex, CFIndex *contentsEndIndex); +#endif +/** \} */ + +/** \name Comparing String + \{ + */ +CF_EXPORT CFComparisonResult +CFStringCompare (CFStringRef theString1, CFStringRef theString2, + CFStringCompareFlags compareOptions); + +CF_EXPORT CFComparisonResult +CFStringCompareWithOptions (CFStringRef theString1, CFStringRef theString2, + CFRange rangeToCOmpare, CFStringCompareFlags compareOptions); + +CF_EXPORT Boolean +CFStringHasPrefix (CFStringRef theString, CFStringRef prefix); + +CF_EXPORT Boolean +CFStringHasSuffix (CFStringRef theString, CFStringRef suffix); + +#if OS_API_VERSION(MAC_OS_X_VERSION_10_5, GS_API_LATEST) +CF_EXPORT CFComparisonResult +CFStringCompareWithOptionsAndLocale (CFStringRef theString1, + CFStringRef theString2, CFRange rangeToCOmpare, + CFStringCompareFlags compareOptions, CFLocaleRef locale); +#endif +/** \} */ + +/** \name Accessing Characters + \{ + */ +CF_EXPORT CFDataRef +CFStringCreateExternalRepresentation (CFAllocatorRef alloc, + CFStringRef theString, CFStringEncoding encoding, UInt8 lossByte); + +CF_EXPORT CFIndex +CFStringGetBytes (CFStringRef theString, CFRange range, + CFStringEncoding encoding, UInt8 lossByte, Boolean isExternalRepresentation, + UInt8 *buffer, CFIndex maxBufLen, CFIndex *usedBufLen); + +CF_EXPORT UniChar +CFStringGetCharacterAtIndex (CFStringRef theString, CFIndex idx); + +CF_EXPORT void +CFStringGetCharacters (CFStringRef theString, CFRange range, UniChar *buffer); + +CF_EXPORT const UniChar * +CFStringGetCharactersPtr (CFStringRef theString); + +CF_EXPORT Boolean +CFStringGetCString (CFStringRef theString, char *buffer, CFIndex bufferSize, + CFStringEncoding encoding); + +CF_EXPORT const char * +CFStringGetCStringPtr (CFStringRef theString, CFStringEncoding encoding); + +CF_EXPORT CFIndex +CFStringGetLength (CFStringRef str); + +CF_EXPORT CFRange +CFStringGetRangeOfComposedCharactersAtIndex (CFStringRef theString, + CFIndex theIndex); + +#if OS_API_VERSION(MAC_OS_X_VERSION_10_6, GS_API_LATEST) +CF_EXPORT UTF32Char +CFStringGetLongCharacterForSurrogatePair (UniChar surrogateHigh, + UniChar surrogateLow); + +CF_EXPORT Boolean +CFStringGetSurrogatePairForLongCharacter (UTF32Char character, + UniChar *surrogates); + +CF_EXPORT Boolean +CFStringIsSurrogateHighCharacter (UniChar character); + +CF_EXPORT Boolean +CFStringIsSurrogateLowCharacter (UniChar character); +#endif +/** \} */ + +/** \name Working with Encodings + \{ + */ +CF_EXPORT CFStringRef +CFStringConvertEncodingToIANACharSetName (CFStringEncoding encoding); + +CF_EXPORT unsigned long +CFStringConvertEncodingToNSStringEncoding (CFStringEncoding encoding); + +UInt32 +CFStringConvertEncodingToWindowsCodepage (CFStringEncoding encoding); + +CF_EXPORT CFStringEncoding +CFStringConvertIANACharSetNameToEncoding (CFStringRef theString); + +CF_EXPORT CFStringEncoding +CFStringConvertNSStringEncodingToEncoding (unsigned long encoding); + +CF_EXPORT CFStringEncoding +CFStringConvertWindowsCodepageToEncoding (UInt32 codepage); + +CF_EXPORT CFStringEncoding +CFStringGetFastestEncoding (CFStringRef theString); + +CF_EXPORT const CFStringEncoding * +CFStringGetListOfAvailableEncodings (void); + +CF_EXPORT CFIndex +CFStringGetMaximumSizeForEncoding (CFIndex length, CFStringEncoding encoding); + +CF_EXPORT CFStringEncoding +CFStringGetMostCompatibleMacStringEncoding (CFStringEncoding encoding); + +CF_EXPORT CFStringRef +CFStringGetNameOfEncoding (CFStringEncoding encoding); + +CF_EXPORT CFStringEncoding +CFStringGetSmallestEncoding (CFStringRef theString); + +CF_EXPORT CFStringEncoding +CFStringGetSystemEncoding (void); + +CF_EXPORT Boolean +CFStringIsEncodingAvailable (CFStringEncoding encoding); + +#if OS_API_VERSION(MAC_OS_X_VERSION_10_4, GS_API_LATEST) +CF_EXPORT Boolean +CFStringGetFileSystemRepresentation (CFStringRef string, char *buffer, + CFIndex maxBufLen); + +CF_EXPORT CFIndex +CFStringGetMaximumSizeOfFileSystemRepresentation (CFStringRef string); +#endif +/** \} */ + +/** \name Getting Numeric Values + \{ + */ +CF_EXPORT double +CFStringGetDoubleValue (CFStringRef str); + +CF_EXPORT SInt32 +CFStringGetIntValue (CFStringRef str); +/** \} */ + +/** \name Getting String Properties + \{ + */ +CF_EXPORT void +CFShow (CFTypeRef obj); + +CF_EXPORT void +CFShowStr (CFStringRef str); + +CF_EXPORT CFTypeID +CFStringGetTypeID (void); +/** \} */ + + + +/** \name Pascal Strings + \{ + */ +CF_EXPORT CFStringRef +CFStringCreateWithPascalString (CFAllocatorRef alloc, ConstStr255Param pStr, + CFStringEncoding encoding); + +CF_EXPORT CFStringRef +CFStringCreateWithPascalStringNoCopy (CFAllocatorRef alloc, + ConstStr255Param pStr, CFStringEncoding encoding, + CFAllocatorRef contentsDeallocate); + +CF_EXPORT Boolean +CFStringGetPascalString (CFStringRef theString, StringPtr buffer, + CFIndex bufferSize, CFStringEncoding encoding); + +CF_EXPORT ConstStringPtr +CFStringGetPascalStringPtr (CFStringRef theString, CFStringEncoding encoding); +/** \} */ +/** \} */ + + + +/** \defgroup CFMutableStringRef CFMutableString Reference + * \{ + */ +#if OS_API_VERSION(MAC_OS_X_VERSION_10_2, GS_API_LATEST) +typedef enum +{ + kCFStringNormalizationFormD = 0, + kCFStringNormalizationFormKD = 1, + kCFStringNormalizationFormC = 2, + kCFStringNormalizationFormKC = 3 +} CFStringNormalizationForm; +#endif + +#if OS_API_VERSION(MAC_OS_X_VERSION_10_4, GS_API_LATEST) +CF_EXPORT const CFStringRef kCFStringTransformStripCombiningMarks; +CF_EXPORT const CFStringRef kCFStringTransformToLatin; +CF_EXPORT const CFStringRef kCFStringTransformFullwidthHalfwidth; +CF_EXPORT const CFStringRef kCFStringTransformLatinKatakana; +CF_EXPORT const CFStringRef kCFStringTransformLatinHiragana; +CF_EXPORT const CFStringRef kCFStringTransformHiraganaKatakana; +CF_EXPORT const CFStringRef kCFStringTransformMandarinLatin; +CF_EXPORT const CFStringRef kCFStringTransformLatinHangul; +CF_EXPORT const CFStringRef kCFStringTransformLatinArabic; +CF_EXPORT const CFStringRef kCFStringTransformLatinHebrew; +CF_EXPORT const CFStringRef kCFStringTransformLatinThai; +CF_EXPORT const CFStringRef kCFStringTransformLatinCyrillic; +CF_EXPORT const CFStringRef kCFStringTransformLatinGreek; +CF_EXPORT const CFStringRef kCFStringTransformToXMLHex; +CF_EXPORT const CFStringRef kCFStringTransformToUnicodeName; +#endif +#if OS_API_VERSION(MAC_OS_X_VERSION_10_5, GS_API_LATEST) +CF_EXPORT const CFStringRef kCFStringTransformStripDiacritics; +#endif + +CF_EXPORT void +CFStringAppend (CFMutableStringRef theString, CFStringRef appendedString); + +CF_EXPORT void +CFStringAppendCharacters (CFMutableStringRef theString, + const UniChar *chars, CFIndex numChars); + +CF_EXPORT void +CFStringAppendCString (CFMutableStringRef theString, const char *cStr, + CFStringEncoding encoding); + +CF_EXPORT void +CFStringAppendFormat (CFMutableStringRef theString, + CFDictionaryRef formatOptions, CFStringRef format, ...); + +CF_EXPORT void +CFStringAppendFormatAndArguments (CFMutableStringRef theString, + CFDictionaryRef formatOptions, CFStringRef format, va_list arguments); + +CF_EXPORT void +CFStringAppendPascalString (CFMutableStringRef theString, + ConstStr255Param pStr, CFStringEncoding encoding); + +CF_EXPORT void +CFStringCapitalize (CFMutableStringRef theString, CFLocaleRef locale); + +CF_EXPORT CFMutableStringRef +CFStringCreateMutable (CFAllocatorRef alloc, CFIndex maxLength); + +CF_EXPORT CFMutableStringRef +CFStringCreateMutableCopy (CFAllocatorRef alloc, CFIndex maxLength, + CFStringRef theString); + +CF_EXPORT CFMutableStringRef +CFStringCreateMutableWithExternalCharactersNoCopy (CFAllocatorRef alloc, + UniChar *chars, CFIndex numChars, CFIndex capacity, + CFAllocatorRef externalCharactersAllocator); + +CF_EXPORT void +CFStringDelete (CFMutableStringRef theString, CFRange range); + +CF_EXPORT void +CFStringInsert (CFMutableStringRef str, CFIndex idx, CFStringRef insertedStr); + +CF_EXPORT void +CFStringLowercase (CFMutableStringRef theString, CFLocaleRef locale); + +CF_EXPORT void +CFStringPad (CFMutableStringRef theString, CFStringRef padString, + CFIndex length, CFIndex indexIntoPad); + +CF_EXPORT void +CFStringReplace (CFMutableStringRef theString, CFRange range, + CFStringRef replacement); + +CF_EXPORT void +CFStringReplaceAll (CFMutableStringRef theString, CFStringRef replacement); + +CF_EXPORT void +CFStringSetExternalCharactersNoCopy (CFMutableStringRef theString, + UniChar *chars, CFIndex length, CFIndex capacity); + +CF_EXPORT void +CFStringTrim (CFMutableStringRef theString, CFStringRef trimString); + +CF_EXPORT void +CFStringTrimWhitespace (CFMutableStringRef theString); + +CF_EXPORT void +CFStringUppercase (CFMutableStringRef theString, CFLocaleRef locale); + +#if OS_API_VERSION(MAC_OS_X_VERSION_10_2, GS_API_LATEST) +CF_EXPORT CFIndex +CFStringFindAndReplace (CFMutableStringRef theString, + CFStringRef stringToFind, CFStringRef replacementString, + CFRange rangeToSearch, CFOptionFlags compareOptions); + +CF_EXPORT void +CFStringNormalize (CFMutableStringRef theString, + CFStringNormalizationForm theForm); +#endif + +#if OS_API_VERSION(MAC_OS_X_VERSION_10_4, GS_API_LATEST) +CF_EXPORT Boolean +CFStringTransform (CFMutableStringRef string, CFRange *range, + CFStringRef transform, Boolean reverse); +#endif + +#if OS_API_VERSION(MAC_OS_X_VERSION_10_5, GS_API_LATEST) +CF_EXPORT void +CFStringFold (CFMutableStringRef theString, CFOptionFlags theFlags, + CFLocaleRef theLocale); +#endif +/** \} */ + + + +/** \ingroup CFStringRef + \name CFStringInlineBuffer + \{ + */ +#define __kCFStringInlineBufferLength 64 +struct CFStringInlineBuffer +{ + UniChar buffer[__kCFStringInlineBufferLength]; + CFStringRef theString; + const UniChar *directBuffer; + CFRange rangeToBuffer; + CFIndex bufferedRangeStart; + CFIndex bufferedRangeEnd; +}; +typedef struct CFStringInlineBuffer CFStringInlineBuffer; + +CF_INLINE void +CFStringInitInlineBuffer (CFStringRef str, CFStringInlineBuffer *buf, + CFRange range) +{ + buf->theString = str; + buf->rangeToBuffer = range; + buf->directBuffer = CFStringGetCharactersPtr (str); + buf->bufferedRangeStart = 0; + buf->bufferedRangeEnd = 0; +} + +CF_INLINE UniChar +CFStringGetCharacterFromInlineBuffer (CFStringInlineBuffer *buf, CFIndex idx) +{ + if (buf->directBuffer) + { + if (idx < 0 || idx >= buf->rangeToBuffer.length) + return 0; + return buf->directBuffer[idx + buf->rangeToBuffer.location]; + } + else if (idx >= buf->bufferedRangeEnd || idx < buf->bufferedRangeStart) + { + CFRange range; + + if (idx < 0 || idx >= buf->rangeToBuffer.length) + return 0; + + /* Use 16 here so it's efficient to go backwards, too */ + buf->bufferedRangeStart = idx - 16; + if (buf->bufferedRangeStart < 0) + buf->bufferedRangeStart = 0; + buf->bufferedRangeEnd = + buf->bufferedRangeStart + __kCFStringInlineBufferLength; + if (buf->bufferedRangeEnd > buf->rangeToBuffer.length) + buf->bufferedRangeEnd = buf->rangeToBuffer.length; + + range = CFRangeMake (buf->rangeToBuffer.location + buf->bufferedRangeStart, + buf->bufferedRangeEnd - buf->bufferedRangeStart); + + CFStringGetCharacters (buf->theString, range, buf->buffer); + } + + return buf->buffer[(idx - buf->bufferedRangeStart)]; +} +/** \} */ + +CF_EXTERN_C_END + +#endif /* __COREFOUNDATION_CFSTRING_H__ */ + diff --git a/gcc/testsuite/objc-obj-c++-shared/GNUStep/Foundation/NSArray.h b/gcc/testsuite/objc-obj-c++-shared/GNUStep/Foundation/NSArray.h new file mode 100644 index 00000000000..661e90faf89 --- /dev/null +++ b/gcc/testsuite/objc-obj-c++-shared/GNUStep/Foundation/NSArray.h @@ -0,0 +1,430 @@ +/* Interface for NSArray for GNUStep + Copyright (C) 1995-2015 Free Software Foundation, Inc. + + Written by: Andrew Kachites McCallum <mccallum@gnu.ai.mit.edu> + Created: 1995 + + This file is part of the GNUstep Base Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, 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 + Library General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02111 USA. + */ + +#ifndef __NSArray_h_GNUSTEP_BASE_INCLUDE +#define __NSArray_h_GNUSTEP_BASE_INCLUDE +#import "../GNUstepBase/GSVersionMacros.h" + +#import "NSObject.h" +#import "NSRange.h" +#import "NSEnumerator.h" +#if __BLOCKS__ +#import "../GNUstepBase/GSBlocks.h" +#endif + +#if defined(__cplusplus) +extern "C" { +#endif + +@class NSString; +@class NSURL; +@class NSIndexSet; + +#if OS_API_VERSION(MAC_OS_X_VERSION_10_6, GS_API_LATEST) +enum +{ + NSBinarySearchingFirstEqual = (1UL << 8), /** Specifies that the binary + * search should find the first object equal in the array. + */ + NSBinarySearchingLastEqual = (1UL << 9), /** Specifies that the binary + * search should find the last object equal in the array. + */ + NSBinarySearchingInsertionIndex = (1UL << 10), /** Specifies that the binary + * search should find the index at which an equal object should be inserted + * in order to keep the array sorted + */ +}; + +typedef NSUInteger NSBinarySearchingOptions; +#endif + +@interface GS_GENERIC_CLASS(NSArray, __covariant ElementT) : NSObject + <NSCoding, NSCopying, NSMutableCopying, NSFastEnumeration> + ++ (instancetype) array; ++ (instancetype) arrayWithArray: (GS_GENERIC_CLASS(NSArray, ElementT) *)array; ++ (instancetype) arrayWithContentsOfFile: (NSString*)file; +#if OS_API_VERSION(GS_API_MACOSX, GS_API_LATEST) ++ (instancetype) arrayWithContentsOfURL: (NSURL*)aURL; +#endif ++ (instancetype) arrayWithObject: (id)anObject; ++ (instancetype) arrayWithObjects: (id)firstObject, ...; ++ (instancetype) arrayWithObjects: (const id[])objects count: (NSUInteger)count; + +- (GS_GENERIC_CLASS(NSArray, ElementT) *) arrayByAddingObject: + (GS_GENERIC_TYPE(ElementT))anObject; +- (GS_GENERIC_CLASS(NSArray, ElementT) *) arrayByAddingObjectsFromArray: + (GS_GENERIC_CLASS(NSArray, ElementT)*)anotherArray; +- (BOOL) containsObject: (GS_GENERIC_TYPE(ElementT))anObject; + +/** <override-subclass /> + * Returns the number of elements contained in the receiver. + */ +- (NSUInteger) count; +- (void) getObjects: (__unsafe_unretained GS_GENERIC_TYPE(ElementT)[])aBuffer; +- (void) getObjects: (__unsafe_unretained GS_GENERIC_TYPE(ElementT)[])aBuffer + range: (NSRange)aRange; +- (NSUInteger) indexOfObject: (GS_GENERIC_TYPE(ElementT))anObject; +- (NSUInteger) indexOfObject: (GS_GENERIC_TYPE(ElementT))anObject + inRange: (NSRange)aRange; +- (NSUInteger) indexOfObjectIdenticalTo: (GS_GENERIC_TYPE(ElementT))anObject; +- (NSUInteger) indexOfObjectIdenticalTo: (GS_GENERIC_TYPE(ElementT))anObject + inRange: (NSRange)aRange; +- (instancetype) init; +- (instancetype) initWithArray: (GS_GENERIC_CLASS(NSArray, ElementT)*)array; +#if OS_API_VERSION(GS_API_MACOSX, GS_API_LATEST) +- (instancetype) initWithArray: (GS_GENERIC_CLASS(NSArray, ElementT)*)array + copyItems: (BOOL)shouldCopy; +#endif +- (instancetype) initWithContentsOfFile: (NSString*)file; +#if OS_API_VERSION(GS_API_MACOSX, GS_API_LATEST) +- (instancetype) initWithContentsOfURL: (NSURL*)aURL; +#endif +- (instancetype) initWithObjects: (GS_GENERIC_TYPE(ElementT)) firstObject, ...; + +/** <init /> <override-subclass /> + * This should initialize the array with count (may be zero) objects.<br /> + * Retains each object placed in the array.<br /> + * Calls -init (which does nothing but maintain MacOS-X compatibility), + * and needs to be re-implemented in subclasses in order to have all + * other initialisers work. + */ +- (instancetype) initWithObjects: (const GS_GENERIC_TYPE(ElementT)[])objects + count: (NSUInteger)count; +- (GS_GENERIC_TYPE(ElementT)) lastObject; +#if OS_API_VERSION(MAC_OS_X_VERSION_10_6, GS_API_LATEST) +- (GS_GENERIC_TYPE(ElementT)) firstObject; +#endif + +/** <override-subclass /> + * Returns the object at the specified index. + * Raises an exception of the index is beyond the array. + */ +- (GS_GENERIC_TYPE(ElementT)) objectAtIndex: (NSUInteger)index; + +#if OS_API_VERSION(MAC_OS_X_VERSION_10_4, GS_API_LATEST) +- (GS_GENERIC_CLASS(NSArray, ElementT) *) objectsAtIndexes: + (NSIndexSet *)indexes; +#endif + +- (GS_GENERIC_TYPE(ElementT)) firstObjectCommonWithArray: + (GS_GENERIC_CLASS(NSArray, ElementT) *)otherArray; +- (BOOL) isEqualToArray: (NSArray*)otherArray; + +#if OS_API_VERSION(GS_API_OPENSTEP, GS_API_MACOSX) +- (void) makeObjectsPerform: (SEL)aSelector; +- (void) makeObjectsPerform: (SEL)aSelector withObject: (id)argument; +#endif +#if OS_API_VERSION(GS_API_MACOSX, GS_API_LATEST) +- (void) makeObjectsPerformSelector: (SEL)aSelector; +- (void) makeObjectsPerformSelector: (SEL)aSelector withObject: (id)arg; +#endif + +- (NSData*) sortedArrayHint; +- (GS_GENERIC_CLASS(NSArray, ElementT)*) sortedArrayUsingFunction: + (NSComparisonResult (*)(id, id, void*))comparator + context: (void*)context; +- (GS_GENERIC_CLASS(NSArray, ElementT)*) sortedArrayUsingFunction: + (NSComparisonResult (*)(id, id, void*))comparator + context: (void*)context + hint: (NSData*)hint; +- (GS_GENERIC_CLASS(NSArray, ElementT)*) sortedArrayUsingSelector: + (SEL)comparator; +- (GS_GENERIC_CLASS(NSArray, ElementT)*) subarrayWithRange: (NSRange)aRange; + +- (NSString*) componentsJoinedByString: (NSString*)separator; +- (GS_GENERIC_CLASS(NSArray, NSString*)*) pathsMatchingExtensions: + (GS_GENERIC_CLASS(NSArray, NSString*)*)extensions; + +- (GS_GENERIC_CLASS(NSEnumerator, ElementT)*) objectEnumerator; +- (GS_GENERIC_CLASS(NSEnumerator, ElementT)*) reverseObjectEnumerator; + +- (NSString*) description; +- (NSString*) descriptionWithLocale: (id)locale; +- (NSString*) descriptionWithLocale: (id)locale + indent: (NSUInteger)level; + +- (BOOL) writeToFile: (NSString*)path atomically: (BOOL)useAuxiliaryFile; +#if OS_API_VERSION(GS_API_MACOSX, GS_API_LATEST) +- (BOOL) writeToURL: (NSURL*)url atomically: (BOOL)useAuxiliaryFile; +- (GS_GENERIC_TYPE(ElementT)) valueForKey: (NSString*)key; +- (void) setValue: (GS_GENERIC_TYPE(ElementT))value forKey: (NSString*)key; +#endif + +#if OS_API_VERSION(MAC_OS_X_VERSION_10_6, GS_API_LATEST) + +#if __BLOCKS__ +DEFINE_BLOCK_TYPE(GSEnumeratorBlock, void, GS_GENERIC_TYPE(ElementT), + NSUInteger, BOOL*); +DEFINE_BLOCK_TYPE(GSPredicateBlock, BOOL, GS_GENERIC_TYPE(ElementT), + NSUInteger, BOOL*); +/** + * Enumerate over the collection using the given block. The first argument is + * the object and the second is the index in the array. The final argument is + * a pointer to a BOOL indicating whether the enumeration should stop. Setting + * this to YES will interrupt the enumeration. + */ +- (void) enumerateObjectsUsingBlock: (GSEnumeratorBlock)aBlock; + +/** + * Enumerate over the collection using the given block. The first argument is + * the object and the second is the index in the array. The final argument is + * a pointer to a BOOL indicating whether the enumeration should stop. Setting + * this to YES will interrupt the enumeration. + * + * The opts argument is a bitfield. Setting the NSNSEnumerationConcurrent flag + * specifies that it is thread-safe. The NSEnumerationReverse bit specifies + * that it should be enumerated in reverse order. + */ +- (void) enumerateObjectsWithOptions: (NSEnumerationOptions)opts + usingBlock: (GSEnumeratorBlock)aBlock; +/** + * Enumerate over the specified indexes in the collection using the given + * block. The first argument is the object and the second is the index in the + * array. The final argument is a pointer to a BOOL indicating whether the + * enumeration should stop. Setting this to YES will interrupt the + * enumeration. + * + * The opts argument is a bitfield. Setting the NSNSEnumerationConcurrent flag + * specifies that it is thread-safe. The NSEnumerationReverse bit specifies + * that it should be enumerated in reverse order. + */ +- (void) enumerateObjectsAtIndexes: (NSIndexSet*)indexSet + options: (NSEnumerationOptions)opts + usingBlock: (GSEnumeratorBlock)block; +/** + * Returns the indexes of the objects in a collection that match the condition + * specified by the block. + * + * The opts argument is a bitfield. Setting the NSNSEnumerationConcurrent flag + * specifies that it is thread-safe. The NSEnumerationReverse bit specifies + * that it should be enumerated in reverse order. + */ +- (NSIndexSet *) indexesOfObjectsWithOptions: (NSEnumerationOptions)opts + passingTest: (GSPredicateBlock)predicate; + +/** + * Returns the indexes of the objects in a collection that match the condition + * specified by the block. + */ +- (NSIndexSet*) indexesOfObjectsPassingTest: (GSPredicateBlock)predicate; + +/** + * Returns the indexes of the objects in a collection that match the condition + * specified by the block and are in the range specified by the index set. + * + * The opts argument is a bitfield. Setting the NSNSEnumerationConcurrent flag + * specifies that it is thread-safe. The NSEnumerationReverse bit specifies + * that it should be enumerated in reverse order. + */ +- (NSIndexSet*) indexesOfObjectsAtIndexes: (NSIndexSet*)indexSet + options: (NSEnumerationOptions)opts + passingTest: (GSPredicateBlock)predicate; + +/** + * Returns the index of the first object in the array that matches the + * condition specified by the block. + * + * The opts argument is a bitfield. Setting the NSNSEnumerationConcurrent flag + * specifies that it is thread-safe. The NSEnumerationReverse bit specifies + * that it should be enumerated in reverse order. + */ +- (NSUInteger) indexOfObjectWithOptions: (NSEnumerationOptions)opts + passingTest: (GSPredicateBlock)predicate; + +/** + * Returns the index of the first object in the array that matches the + * condition specified by the block. + */ +- (NSUInteger) indexOfObjectPassingTest: (GSPredicateBlock)predicate; + +/** + * Returns the index of the first object in the specified range in a collection + * that matches the condition specified by the block. + * + * The opts argument is a bitfield. Setting the NSNSEnumerationConcurrent flag + * specifies that it is thread-safe. The NSEnumerationReverse bit specifies + * that it should be enumerated in reverse order. + */ +- (NSUInteger) indexOfObjectAtIndexes: (NSIndexSet*)indexSet + options: (NSEnumerationOptions)opts + passingTest: (GSPredicateBlock)predicate; + +/** Returns a sorted array using the comparator to determine the + * order of objects. + */ +- (GS_GENERIC_CLASS(NSArray, ElementT) *) sortedArrayUsingComparator: + (NSComparator)comparator; + +/** Returns a sorted array using the block to determine the order of objects. + * + * The opts argument is a bitfield. Setting the NSSortConcurrent flag + * specifies that it is thread-safe. The NSSortStable bit specifies that + * it should keep equal objects in the same order. + */ +- (GS_GENERIC_CLASS(NSArray, ElementT) *) + sortedArrayWithOptions: (NSSortOptions)options + usingComparator: (NSComparator)comparator; + +/** + * Performs a binary search of the array within the specified range for the + * index of an object equal to obj according to cmp. + * If NSBinarySearchingInsertionIndex is specified, searches for the index + * at which such an object should be inserted. + */ +- (NSUInteger) indexOfObject: (id)key + inSortedRange: (NSRange)range + options: (NSBinarySearchingOptions)options + usingComparator: (NSComparator)comparator; +#endif +#endif +/** + * Accessor for subscripting. This is called by the compiler when you write + * code like anArray[12]. It should not be called directly. + */ +- (GS_GENERIC_TYPE(ElementT)) objectAtIndexedSubscript: (NSUInteger)anIndex; +@end + + +@interface GS_GENERIC_CLASS(NSMutableArray, ElementT) : NSArray + ++ (instancetype) arrayWithCapacity: (NSUInteger)numItems; + +/** <override-subclass /> + * Adds anObject at the end of the array, thus increasing the size of + * the array. The object is retained upon addition. + */ +- (void) addObject: (GS_GENERIC_TYPE(ElementT))anObject; +- (void) addObjectsFromArray: (GS_GENERIC_CLASS(NSArray, ElementT)*)otherArray; +#if OS_API_VERSION(GS_API_MACOSX, GS_API_LATEST) +- (void) exchangeObjectAtIndex: (NSUInteger)i1 + withObjectAtIndex: (NSUInteger)i2; +#endif + +/** <init /> <override-subclass /> + * Initialise the array with the specified capacity ... this + * should ensure that the array can have numItems added efficiently.<br /> + * Calls -init (which does nothing but maintain MacOS-X compatibility), + * and needs to be re-implemented in subclasses in order to have all + * other initialisers work. + */ +- (instancetype) initWithCapacity: (NSUInteger)numItems; + +/** <override-subclass /> + * Inserts an object into the receiver at the specified location.<br /> + * Raises an exception if given an array index which is too large.<br /> + * The size of the array increases by one.<br /> + * The object is retained by the array. + */ +- (void) insertObject: (GS_GENERIC_TYPE(ElementT))anObject + atIndex: (NSUInteger)index; +#if OS_API_VERSION(MAC_OS_X_VERSION_10_4, GS_API_LATEST) +- (void) insertObjects: (GS_GENERIC_CLASS(NSArray, ElementT) *)objects + atIndexes: (NSIndexSet *)indexes; +#endif + +/** <override-subclass /> + * Removes an object from the receiver at the specified location.<br /> + * The size of the array decreases by one.<br /> + * Raises an exception if given an array index which is too large.<br /> + */ +- (void) removeObjectAtIndex: (NSUInteger)index; + +- (void) removeObjectsAtIndexes: (NSIndexSet *)indexes; + +/** <override-subclass /> + * Places an object into the receiver at the specified location.<br /> + * Raises an exception if given an array index which is too large.<br /> + * The object is retained by the array. + */ +- (void) replaceObjectAtIndex: (NSUInteger)index + withObject: (GS_GENERIC_TYPE(ElementT))anObject; + +#if OS_API_VERSION(MAC_OS_X_VERSION_10_4, GS_API_LATEST) +- (void) replaceObjectsAtIndexes: (NSIndexSet *)indexes + withObjects: (GS_GENERIC_CLASS(NSArray, ElementT)*)objects; +#endif + +- (void) replaceObjectsInRange: (NSRange)aRange + withObjectsFromArray: (GS_GENERIC_CLASS(NSArray, ElementT)*)anArray; + +- (void) replaceObjectsInRange: (NSRange)aRange + withObjectsFromArray: (GS_GENERIC_CLASS(NSArray, ElementT)*)anArray + range: (NSRange)anotherRange; + +- (void) setArray: (GS_GENERIC_CLASS(NSArray, ElementT) *)otherArray; + +- (void) removeAllObjects; +- (void) removeLastObject; +- (void) removeObject: (GS_GENERIC_TYPE(ElementT))anObject; +- (void) removeObject: (GS_GENERIC_TYPE(ElementT))anObject + inRange: (NSRange)aRange; +- (void) removeObjectIdenticalTo: (GS_GENERIC_TYPE(ElementT))anObject; +- (void) removeObjectIdenticalTo: (GS_GENERIC_TYPE(ElementT))anObject + inRange: (NSRange)aRange; +- (void) removeObjectsInArray: (GS_GENERIC_CLASS(NSArray, ElementT)*)otherArray; +- (void) removeObjectsInRange: (NSRange)aRange; +- (void) removeObjectsFromIndices: (NSUInteger*)indices + numIndices: (NSUInteger)count; + +- (void) sortUsingFunction: + (NSComparisonResult (*)(GS_GENERIC_TYPE(ElementT), + GS_GENERIC_TYPE(ElementT),void*))compare + context: (void*)context; +- (void) sortUsingSelector: (SEL)comparator; + + +#if OS_API_VERSION(MAC_OS_X_VERSION_10_6, GS_API_LATEST) +#if __BLOCKS__ +/** + * Sorts the array using the specified comparator block. + */ +- (void) sortUsingComparator: (NSComparator)comparator; + +/** + * Sorts the array using the specified comparator block and options. + */ +- (void) sortWithOptions: (NSSortOptions)options + usingComparator: (NSComparator)comparator; +#endif +#endif +#if OS_API_VERSION(MAC_OS_X_VERSION_10_8, GS_API_LATEST) +/** Set method called by the compiler with array subscripting.<br /> + * Replaces the object at anIndex or, if anIndex is the length of the array, + * this method appends abObject to the array. + */ +- (void) setObject: (GS_GENERIC_TYPE(ElementT))anObject +atIndexedSubscript: (NSUInteger)anIndex; +#endif +@end + +#if defined(__cplusplus) +} +#endif + +#if !NO_GNUSTEP && !defined(GNUSTEP_BASE_INTERNAL) +#import "../GNUstepBase/NSArray+GNUstepBase.h" +#endif + +#endif /* __NSArray_h_GNUSTEP_BASE_INCLUDE */ diff --git a/gcc/testsuite/objc-obj-c++-shared/GNUStep/Foundation/NSAutoreleasePool.h b/gcc/testsuite/objc-obj-c++-shared/GNUStep/Foundation/NSAutoreleasePool.h new file mode 100644 index 00000000000..c7ec486ddde --- /dev/null +++ b/gcc/testsuite/objc-obj-c++-shared/GNUStep/Foundation/NSAutoreleasePool.h @@ -0,0 +1,333 @@ +/* Interface for NSAutoreleasePool for GNUStep + Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. + + Written by: Andrew Kachites McCallum <mccallum@gnu.ai.mit.edu> + Date: 1995 + + This file is part of the GNUstep Base Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, 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 + Library General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02111 USA. + */ + +#ifndef __NSAutoreleasePool_h_GNUSTEP_BASE_INCLUDE +#define __NSAutoreleasePool_h_GNUSTEP_BASE_INCLUDE +#import "../GNUstepBase/GSVersionMacros.h" + +#import "NSObject.h" + +#if defined(__cplusplus) +extern "C" { +#endif + +@class NSAutoreleasePool; +@class NSThread; + + +/** + * Each thread has its own copy of these variables. + <example> +{ + NSAutoreleasePool *current_pool; // current pool for thread + unsigned total_objects_count; // total #/autoreleased objects over thread's lifetime + id *pool_cache; // cache of previously-allocated pools, + int pool_cache_size; // used internally for recycling + int pool_cache_count; +} + </example> +*/ +typedef struct autorelease_thread_vars +{ + /* The current, default NSAutoreleasePool for the calling thread; + the one that will hold objects that are arguments to + [NSAutoreleasePool +addObject:]. */ + __unsafe_unretained NSAutoreleasePool *current_pool; + + /* The total number of objects autoreleased since the thread was + started, or since -resetTotalAutoreleasedObjects was called + in this thread. (if compiled in) */ + unsigned total_objects_count; + + /* A cache of NSAutoreleasePool's already alloc'ed. Caching old pools + instead of deallocating and re-allocating them will save time. */ + __unsafe_unretained id *pool_cache; + int pool_cache_size; + int pool_cache_count; +} thread_vars_struct; + +/* Initialize an autorelease_thread_vars structure for a new thread. + This function is called in NSThread each time an NSThread is created. + TV should be of type `struct autorelease_thread_vars *' */ +#define init_autorelease_thread_vars(TV) \ +memset (TV, 0, sizeof (__typeof__ (*TV))) + + + +/** + * Each pool holds its objects-to-be-released in a linked-list of + these structures. + <example> +{ + struct autorelease_array_list *next; + unsigned size; + unsigned count; + id objects[0]; +} + </example> + */ +typedef struct autorelease_array_list +{ + struct autorelease_array_list *next; + unsigned size; + unsigned count; + __unsafe_unretained id objects[0]; +} array_list_struct; + + + +/** + * <p> + * The standard OpenStep system of memory management employs retain counts. + * When an object is created, it has a retain count of 1. When an object + * is retained, the retain count is incremented. When it is released the + * retain count is decremented, and when the retain count goes to zero the + * object gets deallocated. + * </p> + * <p> + * A simple retain/release mechanism has problems with passing objects + * from one scope to another, + * so it's augmented with autorelease pools. You can use the + * AUTORELEASE() macro to call the [NSObject-autorelease] + * method, which adds an object to the current autorelease pool by + * calling [NSAutoreleasePool+addObject:].<br /> + * An autorelease pool simply maintains a reference to each object + * added to it, and for each addition, the autorelease pool will + * call the [NSObject-release] method of the object when the pool + * is released. So doing an AUTORELEASE() is just the same as + * doing a RELEASE(), but deferred until the current autorelease + * pool is deallocated. + * </p> + * <p> + * The NSAutoreleasePool class maintains a separate stack of + * autorelease pools objects in each thread. + * </p> + * <p> + * When an autorelease pool is created, it is automatically + * added to the stack of pools in the thread. + * </p> + * <p> + * When a pool is destroyed, it (and any pool later in + * the stack) is removed from the stack. + * </p> + * <p> + * This mechanism provides a simple but controllable and reasonably + * efficient way of managing temporary objects. An object can be + * autoreleased and then passed around and used until the topmost + * pool in the stack is destroyed. + * </p> + * <p> + * Most methods return objects which are either owned by autorelease + * pools or by the receiver of the method, so the lifetime of the + * returned object can be assumed to be the shorter of the lifetime + * of the current autorelease pool, or that of the receiver on which + * the method was called.<br /> + * The exceptions to this are those object returned by - + * </p> + * <deflist> + * <term>[NSObject+alloc], [NSObject+allocWithZone:]</term> + * <desc> + * Methods whose names begin with alloc return an uninitialised + * object, owned by the caller. + * </desc> + * <term>[NSObject-init]</term> + * <desc> + * Methods whose names begin with init return an initialised + * version of the receiving object, owned by the caller.<br /> + * NB. The returned object may not actually be the same as the + * receiver ... sometimes an init method releases the original + * receiver and returns an alternative. + * </desc> + * <term>[NSObject+new]</term> + * <desc> + * Methods whose names begin with new combine the effects of + * allocation and initialisation. + * </desc> + * <term>[NSObject-copy], [(NSCopying)-copyWithZone:]</term> + * <desc> + * Methods whose names begin with copy create a copy of the receiver + * which is owned by the caller. + * </desc> + * <term> + * [NSObject-mutableCopy], [(NSMutableCopying)-mutableCopyWithZone:] + * </term> + * <desc> + * Methods whose names begin with mutableCopy create a copy of the receiver + * which is owned by the caller. + * </desc> + * </deflist> + */ +NS_AUTOMATED_REFCOUNT_UNAVAILABLE +@interface NSAutoreleasePool : NSObject +{ +#if GS_EXPOSE(NSAutoreleasePool) && !__has_feature(objc_arc) + /* For re-setting the current pool when we are dealloc'ed. */ + NSAutoreleasePool *_parent; + /* This pointer to our child pool is necessary for co-existing + with exceptions. */ + NSAutoreleasePool *_child; + /* A collection of the objects to be released. */ + struct autorelease_array_list *_released; + struct autorelease_array_list *_released_head; + /* The total number of objects autoreleased in this pool. */ + unsigned _released_count; + /* The method to add an object to this pool */ + void (*_addImp)(id, SEL, id); +#endif +#if GS_NONFRAGILE +#else + /* Pointer to private additional data used to avoid breaking ABI + * when we don't have the non-fragile ABI available. + * Use this mechanism rather than changing the instance variable + * layout (see Source/GSInternal.h for details). + */ + @private id _internal GS_UNUSED_IVAR; +#endif +} + +/** + * Adds anObj to the current autorelease pool.<br /> + * If there is no autorelease pool in the thread, + * a warning is logged and the object is leaked (ie it will not be released). + */ ++ (void) addObject: (id)anObj; + +/** + * Allocate and return an autorelease pool instance.<br /> + * If there is an already-allocated NSAutoreleasePool available, + * save time by just returning that, rather than allocating a new one.<br /> + * The pool instance becomes the current autorelease pool for this thread. + */ ++ (id) allocWithZone: (NSZone*)zone; + +/** + * Adds anObj to this autorelease pool. + */ +- (void) addObject: (id)anObj; + +/** + * Raises an exception - pools should not be autoreleased. + */ +- (id) autorelease; + +#if OS_API_VERSION(MAC_OS_X_VERSION_10_4, GS_API_LATEST) +/** + * Intended to trigger a garbage collection run (if needed) when called in + * a garbage collected environment.<br /> + * In a non-garbage collected environment, this method implements the + * undocumented MacOS-X behavior, and releases the receiver. + */ +- (void) drain; +#endif + +/** + * Destroys the receiver (calls -dealloc). + */ +- (oneway void) release; + +/** + * Raises an exception ... pools should not be retained. + */ +- (id) retain; + +#if OS_API_VERSION(GS_API_NONE, GS_API_NONE) +/** + * <p> + * Counts the number of times that the specified object occurs + * in autorelease pools in the current thread. + * </p> + * <p> + * This method is <em>slow</em> and should probably only be + * used for debugging purposes. + * </p> + */ ++ (unsigned) autoreleaseCountForObject: (id)anObject; + +/** + * Return the currently active autorelease pool. + */ ++ (id) currentPool; + +/** + * <p> + * Specifies whether objects contained in autorelease pools are to + * be released when the pools are deallocated (by default YES). + * </p> + * <p> + * You can set this to NO for debugging purposes. + * </p> + */ ++ (void) enableRelease: (BOOL)enable; + +/** + * <p> + * When autorelease pools are deallocated, the memory they used + * is retained in a cache for re-use so that new polls can be + * created very quickly. + * </p> + * <p> + * This method may be used to empty that cache, ensuring that + * the minimum memory is used by the application. + * </p> + */ ++ (void) freeCache; + +/** + * <p> + * Specifies a limit to the number of objects that may be added to + * an autorelease pool. When this limit is reached an exception is + * raised. + * </p> + * <p> + * You can set this to a smallish value to catch problems with code + * that autoreleases too many objects to operate efficiently. + * </p> + * <p> + * Default value is maxint. + * </p> + */ ++ (void) setPoolCountThreshold: (unsigned)c; + +/** + * Return the number of objects in this pool. + */ +- (unsigned) autoreleaseCount; + +/** + * Empties the current pool by releasing all the autoreleased objects + * in it. Also destroys any child pools (ones created after + * the receiver in the same thread) causing any objects in those pools + * to be released.<br /> + * This is a low cost (efficient) method which may be used to get rid of + * autoreleased objects in the pool, but carry on using the pool. + */ +- (void) emptyPool; +#endif +@end + +#if defined(__cplusplus) +} +#endif + +#endif /* __NSAutoreleasePool_h_GNUSTEP_BASE_INCLUDE */ diff --git a/gcc/testsuite/objc-obj-c++-shared/GNUStep/Foundation/NSDate.h b/gcc/testsuite/objc-obj-c++-shared/GNUStep/Foundation/NSDate.h new file mode 100644 index 00000000000..dbec39e46e9 --- /dev/null +++ b/gcc/testsuite/objc-obj-c++-shared/GNUStep/Foundation/NSDate.h @@ -0,0 +1,300 @@ +/* Interface for NSDate for GNUStep + Copyright (C) 1994, 1996, 1999 Free Software Foundation, Inc. + + This file is part of the GNUstep Base Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, 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 + Library General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02111 USA. + */ + +#ifndef __NSDate_h_GNUSTEP_BASE_INCLUDE +#define __NSDate_h_GNUSTEP_BASE_INCLUDE +#import "../GNUstepBase/GSVersionMacros.h" + +#import "NSObjCRuntime.h" + +#if defined(__cplusplus) +extern "C" { +#endif + +GS_EXPORT NSString * const NSSystemClockDidChangeNotification; + +/** + * Time interval difference between two dates, in seconds. + */ +typedef double NSTimeInterval; + +/** + * Time interval between the unix standard reference date of 1 January 1970 + * and the OpenStep reference date of 1 January 2001<br /> + * This number comes from:<br /> + * (((31 years * 365 days) + 8 days for leap years) = total number of days<br /> + * 24 hours * 60 minutes * 60 seconds)<br /> + * This ignores leap-seconds. + */ +GS_EXPORT const NSTimeInterval NSTimeIntervalSince1970; + +#import "NSObject.h" + +@class NSArray; +@class NSCalendarDate; +@class NSData; +@class NSDictionary; +@class NSString; +@class NSTimeZone; +@class NSTimeZoneDetail; + +@interface NSDate : NSObject <NSCoding,NSCopying> +{ +} + +/** Returns an autoreleased instance with the current date/time. + */ ++ (id) date; + +#if OS_API_VERSION(GS_API_MACOSX, GS_API_LATEST) +/** Returns an autoreleased instance representing the date and time given + * by string. The value of string may be a 'natural' specification as + * specified by the preferences in the user defaults database, allowing + * phrases like 'last tuesday' + */ ++ (id) dateWithNaturalLanguageString: (NSString*)string; + +/** + * <p>Returns an autoreleased instance representing the date and time given + * by string. The value of string may be a 'natural' specification as + * specified by the preferences in the user defaults database, allowing + * phrases like 'last tuesday' + * </p> + * The locale contains keys such as - + * <deflist> + * <term>NSDateTimeOrdering</term> + * <desc>Controls the use of ambiguous numbers. This is done as a + * sequence of the letters D(ay), M(onth), Y(ear), and H(our). + * YMDH means that the first number encountered is assumed to be a + * year, the second a month, the third a day, and the last an hour. + * </desc> + * <term>NSEarlierTimeDesignations</term> + * <desc>An array of strings for times in the past.<br /> + * Defaults are <em>ago</em>, <em>last</em>, <em>past</em>, <em>prior</em> + * </desc> + * <term>NSHourNameDesignations</term> + * <desc>An array of arrays of strings identifying the time of day. + * Each array has an hour as its first value, and one or more words + * as subsequent values.<br /> + * Defaults are: (0, midnight), (10, morning), (12, noon, lunch), + * (14, afternoon), (19, dinner). + * </desc> + * <term>NSLaterTimeDesignations</term> + * <desc>An array of strings for times in the future.<br /> + * Default is <em>next</em> + * </desc> + * <term>NSNextDayDesignations</term> + * <desc>The day after today. Default is <em>tomorrow.</em> + * </desc> + * <term>NSNextNextDayDesignations</term> + * <desc>The day after tomorrow. Default is <em>nextday.</em> + * </desc> + * <term>NSPriorDayDesignations</term> + * <desc>The day before today. Default is <em>yesterday.</em> + * </desc> + * <term>NSThisDayDesignations</term> + * <desc>Identifies the current day. Default is <em>today.</em> + * </desc> + * <term>NSYearMonthWeekDesignations</term> + * <desc>An array giving the word for year, month, and week.<br /> + * Defaults are <em>year</em>, <em>month</em> and <em>week</em>. + * </desc> + * </deflist> + */ ++ (id) dateWithNaturalLanguageString: (NSString*)string + locale: (NSDictionary*)locale; +#endif + +/** Returns an autoreleased instance with the date and time value given + * by the string using the ISO standard format YYYY-MM-DD HH:MM:SS +/-HHHMM + * (all the fields of which must be present). + */ ++ (id) dateWithString: (NSString*)description; + +#if OS_API_VERSION(MAC_OS_X_VERSION_10_6,GS_API_LATEST) +/** Returns an autoreleased NSDate instance whose value is offset from + * that of the given date by the specified interval in seconds. + */ ++ (id) dateWithTimeInterval: (NSTimeInterval)seconds sinceDate: (NSDate*)date; +#endif + +/** Returns an autoreleased instance with the offset from the unix system + * reference date of 1 January 1970, GMT. + */ ++ (id) dateWithTimeIntervalSince1970: (NSTimeInterval)seconds; + +/** Returns an autoreleased instance with the offset from the current + * date/time given by seconds (which may be fractional). + */ ++ (id) dateWithTimeIntervalSinceNow: (NSTimeInterval)seconds; + +/** Returns an autoreleased instance with the offset from the OpenStep + * reference date of 1 January 2001, GMT. + */ ++ (id) dateWithTimeIntervalSinceReferenceDate: (NSTimeInterval)seconds; + +/** Returns an autoreleased instance with the date/time set in the far + * past. + */ ++ (id) distantPast; + +/** Returns an autoreleased instance with the date/time set in the far + * future. + */ ++ (id) distantFuture; + +/** Returns the time interval between the reference date and the current + * time. + */ ++ (NSTimeInterval) timeIntervalSinceReferenceDate; + +/** Returns an autorelease date instance formed by adding the specified + * time interval in seconds to the receiver's time interval. + */ +- (id) addTimeInterval: (NSTimeInterval)seconds; + +/** Returns the time interval between the receivers value and the + * OpenStep reference date of 1 Jan 2001 GMT. + */ +- (NSComparisonResult) compare: (NSDate*)otherDate; + +#if OS_API_VERSION(MAC_OS_X_VERSION_10_6,GS_API_LATEST) +/** Returns an autoreleased NSDate instance whose value is offset from + * that of the receiver by the specified interval. + */ +- (id) dateByAddingTimeInterval: (NSTimeInterval)ti; +#endif + +/** Returns an autoreleased instance of the [NSCalendarDate] class whose + * date/time value is the same as that of the receiver, and which uses + * the formatString and timeZone specified. + */ +- (NSCalendarDate*) dateWithCalendarFormat: (NSString*)formatString + timeZone: (NSTimeZone*)timeZone; + +/** Returns a string representation of the receiver formatted according + * to the default format string, time zone, and locale. + */ +- (NSString*) description; + +/** Returns a string representation of the receiver formatted according + * to the specified format string, time zone, and locale. + */ +- (NSString*) descriptionWithCalendarFormat: (NSString*)format + timeZone: (NSTimeZone*)aTimeZone + locale: (NSDictionary*)l; + +/** Returns a string representation of the receiver formatted according + * to the default format string and time zone, but using the given locale. + */ +- (NSString*) descriptionWithLocale: (id)locale; + +/** Returns the earlier of the receiver and otherDate.<br /> + * If the two represent identical date/time values, returns the receiver. + */ +- (NSDate*) earlierDate: (NSDate*)otherDate; + +/** Returns an instance initialised with the current date/time. + */ +- (id) init; + +/** Returns an instance with the date and time value given + * by the string using the ISO standard format YYYY-MM-DD HH:MM:SS +/-HHHMM + * (all the fields of which must be present). + */ +- (id) initWithString: (NSString*)description; + +/** Returns an instance with the given offset from anotherDate. + */ +- (id) initWithTimeInterval: (NSTimeInterval)secsToBeAdded + sinceDate: (NSDate*)anotherDate; + +#if OS_API_VERSION(GS_API_MACOSX, GS_API_LATEST) +/** Returns an instance with the offset from the unix system + * reference date of 1 January 1970, GMT. + */ +- (id) initWithTimeIntervalSince1970: (NSTimeInterval)seconds; +#endif + +/** Returns an instance with the offset from the current date/time. + */ +- (id) initWithTimeIntervalSinceNow: (NSTimeInterval)secsToBeAdded; + +/** <init /> + * Returns an instance with the given offset from the OpenStep + * reference date of 1 January 2001, GMT. + */ +- (id) initWithTimeIntervalSinceReferenceDate: (NSTimeInterval)secs; + +/** Returns NO if other is not a date, otherwise returns the result of + * calling the -isEqualtoDate: method. + */ +- (BOOL) isEqual: (id)other; + +/** Returns whether the receiver is exactly equal to other, to the limit + * of the NSTimeInterval precision.<br /> + * This is the behavior of the current MacOS-X system, not that of the + * OpenStep specification (which counted two dates within a second of + * each other as being equal).<br /> + * The old behavior meant that two dates equal to a third date were not + * necessarily equal to each other (confusing), and meant that there was + * no reasonable way to use a date as a dictionary key or store dates + * in a set. + */ +- (BOOL) isEqualToDate: (NSDate*)other; + +/** Returns the earlier of the receiver and otherDate.<br /> + * If the two represent identical date/time values, returns the receiver. + */ +- (NSDate*) laterDate: (NSDate*)otherDate; + +/** Returns the time interval between the receivers value and the + * unix system reference date of 1 January 1970, GMT. + */ +- (NSTimeInterval) timeIntervalSince1970; + +/** Returns the time interval between the receivers value and that of the + * otherDate argument. If otherDate is earlier than the receiver, the + * returned value will be positive, if it is later it will be negative.<br /> + * For current (2011) OSX compatibility, this method returns NaN if otherDate + * is nil ... do not write code depending on that behavior. + */ +- (NSTimeInterval) timeIntervalSinceDate: (NSDate*)otherDate; + +/** Returns the time interval between the receivers value and the + * current date/time. If the receiver represents a date/time in + * the past this will be negative, if it is in the future the + * returned value will be positive. + */ +- (NSTimeInterval) timeIntervalSinceNow; + +/** Returns the time interval between the receivers value and the + * OpenStep reference date of 1 Jan 2001 GMT. + */ +- (NSTimeInterval) timeIntervalSinceReferenceDate; + +@end + +#if defined(__cplusplus) +} +#endif + +#endif /* __NSDate_h_GNUSTEP_BASE_INCLUDE*/ diff --git a/gcc/testsuite/objc-obj-c++-shared/GNUStep/Foundation/NSEnumerator.h b/gcc/testsuite/objc-obj-c++-shared/GNUStep/Foundation/NSEnumerator.h new file mode 100644 index 00000000000..5f31abdf13d --- /dev/null +++ b/gcc/testsuite/objc-obj-c++-shared/GNUStep/Foundation/NSEnumerator.h @@ -0,0 +1,63 @@ +/* + NSEnumerator.h + + Copyright (C) 1998 Free Software Foundation, Inc. + + Author: Scott Christley <scottc@net-community.com> + Date: January 1998 + + This file is part of the GNUstep Base Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, 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 + Library General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02111 USA. +*/ + +#ifndef __NSEnumerator_h_GNUSTEP_BASE_INCLUDE +#define __NSEnumerator_h_GNUSTEP_BASE_INCLUDE +#import "../GNUstepBase/GSVersionMacros.h" + +#import "NSObject.h" + + +#if defined(__cplusplus) +extern "C" { +#endif + +@class GS_GENERIC_CLASS(NSArray, ElementT); + +typedef struct +{ + unsigned long state; + __unsafe_unretained id *itemsPtr; + unsigned long *mutationsPtr; + unsigned long extra[5]; +} NSFastEnumerationState; + +@protocol NSFastEnumeration +- (NSUInteger) countByEnumeratingWithState: (NSFastEnumerationState *)state + objects: (__unsafe_unretained id[])stackbuf + count: (NSUInteger)len; +@end + +@interface GS_GENERIC_CLASS(NSEnumerator, IterT) : NSObject <NSFastEnumeration> +- (GS_GENERIC_CLASS(NSArray, IterT) *) allObjects; +- (GS_GENERIC_TYPE(IterT)) nextObject; +@end + +#if defined(__cplusplus) +} +#endif + +#endif /* __NSEnumerator_h_GNUSTEP_BASE_INCLUDE */ diff --git a/gcc/testsuite/objc-obj-c++-shared/GNUStep/Foundation/NSGeometry.h b/gcc/testsuite/objc-obj-c++-shared/GNUStep/Foundation/NSGeometry.h new file mode 100644 index 00000000000..05888b7d206 --- /dev/null +++ b/gcc/testsuite/objc-obj-c++-shared/GNUStep/Foundation/NSGeometry.h @@ -0,0 +1,609 @@ +/* Interface for NSGeometry routines for GNUStep + * Copyright (C) 1995 Free Software Foundation, Inc. + * + * Written by: Adam Fedor <fedor@boulder.colorado.edu> + * Date: 1995,199 + * + * This file is part of the GNUstep Base Library. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, 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 + * Library General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02111 USA. + */ + +#ifndef __NSGeometry_h_GNUSTEP_BASE_INCLUDE +#define __NSGeometry_h_GNUSTEP_BASE_INCLUDE +#import "../GNUstepBase/GSVersionMacros.h" + +#import <objc/objc.h> + +#import "NSString.h" + +#if defined(__cplusplus) +extern "C" { +#endif + +/**** Type, Constant, and Macro Definitions **********************************/ + +#ifndef MAX +#define MAX(a,b) \ + ({__typeof__(a) _MAX_a = (a); __typeof__(b) _MAX_b = (b); \ + _MAX_a > _MAX_b ? _MAX_a : _MAX_b; }) +#define GS_DEFINED_MAX +#endif + +#ifndef MIN +#define MIN(a,b) \ + ({__typeof__(a) _MIN_a = (a); __typeof__(b) _MIN_b = (b); \ + _MIN_a < _MIN_b ? _MIN_a : _MIN_b; }) +#define GS_DEFINED_MIN +#endif + +/** +<example>{ + CGFloat x; + CGFloat y; +}</example> + <p>Represents a 2-d cartesian position.</p> */ +typedef struct _NSPoint NSPoint; +struct _NSPoint +{ + CGFloat x; + CGFloat y; +}; + +#if OS_API_VERSION(GS_API_MACOSX, GS_API_LATEST) +/** Array of NSPoint structs. */ +typedef NSPoint *NSPointArray; +/** Pointer to NSPoint struct. */ +typedef NSPoint *NSPointPointer; +#endif + +/** +<example>{ + CGFloat width; + CGFloat height; +}</example> + <p>Floating point rectangle size.</p> */ +typedef struct _NSSize NSSize; +struct _NSSize +{ + CGFloat width; + CGFloat height; +}; + +#if OS_API_VERSION(GS_API_MACOSX, GS_API_LATEST) +/** Array of NSSize structs. */ +typedef NSSize *NSSizeArray; +/** Pointer to NSSize struct. */ +typedef NSSize *NSSizePointer; +#endif + +/** +<example>{ + NSPoint origin; + NSSize size; +}</example> + + <p>Rectangle.</p> */ +typedef struct _NSRect NSRect; +struct _NSRect +{ + NSPoint origin; + NSSize size; +}; + +#if OS_API_VERSION(GS_API_MACOSX, GS_API_LATEST) +/** Array of NSRect structs. */ +typedef NSRect *NSRectArray; +/** Pointer to NSRect struct. */ +typedef NSRect *NSRectPointer; +#endif + +enum +{ + NSMinXEdge = 0, + NSMinYEdge = 1, + NSMaxXEdge = 2, + NSMaxYEdge = 3 +}; +/** Sides of a rectangle. +<example> +{ + NSMinXEdge, + NSMinYEdge, + NSMaxXEdge, + NSMaxYEdge +} +</example> + */ +typedef NSUInteger NSRectEdge; + +/** +<example>{ + CGFloat top; + CGFloat left; + CGFloat bottom; + CGFloat right; +}</example> + + <p>A description of the distance between the edges of two rectangles.</p> */ +#if OS_API_VERSION(MAC_OS_X_VERSION_10_7, GS_API_LATEST) +typedef struct NSEdgeInsets { + CGFloat top; + CGFloat left; + CGFloat bottom; + CGFloat right; +} NSEdgeInsets; +#endif + +/** Point at 0,0 */ +static const NSPoint NSZeroPoint __attribute__((unused)) = {0.0,0.0}; +/** Zero-size rectangle at 0,0 */ +static const NSRect NSZeroRect __attribute__((unused)) = {{0.0,0.0},{0.0,0.0}}; +/** Zero size */ +static const NSSize NSZeroSize __attribute__((unused)) = {0.0,0.0}; + +#if OS_API_VERSION(MAC_OS_X_VERSION_10_7, GS_API_LATEST) +/** Zero edge insets **/ +static const NSEdgeInsets NSEdgeInsetsZero __attribute__((unused)) = {0.0,0.0,0.0,0.0}; +#endif + +/**** Function Prototypes ****************************************************/ + +/* + * All but the most complex functions are declared static inline in this + * header file so that they are maximally efficient. In order to provide + * true functions (for code modules that don't have this header) this + * header is included in NSGeometry.m where the functions are no longer + * declared inline. + */ +#ifdef IN_NSGEOMETRY_M +#define GS_GEOM_SCOPE extern +#define GS_GEOM_ATTR +#else +#define GS_GEOM_SCOPE static inline +#define GS_GEOM_ATTR __attribute__((unused)) +#endif + +/** Create Basic Structures... **/ + +GS_GEOM_SCOPE NSPoint +NSMakePoint(CGFloat x, CGFloat y) GS_GEOM_ATTR; + +/** Returns an NSPoint having x-coordinate X and y-coordinate Y. */ +GS_GEOM_SCOPE NSPoint +NSMakePoint(CGFloat x, CGFloat y) +{ + NSPoint point; + + point.x = x; + point.y = y; + return point; +} + +GS_GEOM_SCOPE NSSize +NSMakeSize(CGFloat w, CGFloat h) GS_GEOM_ATTR; + +/** Returns an NSSize having width w and height h. */ +GS_GEOM_SCOPE NSSize +NSMakeSize(CGFloat w, CGFloat h) +{ + NSSize size; + + size.width = w; + size.height = h; + return size; +} + +GS_GEOM_SCOPE NSRect +NSMakeRect(CGFloat x, CGFloat y, CGFloat w, CGFloat h) GS_GEOM_ATTR; + +/** Returns an NSRect having point of origin (x, y) and size {w, h}. */ +GS_GEOM_SCOPE NSRect +NSMakeRect(CGFloat x, CGFloat y, CGFloat w, CGFloat h) +{ + NSRect rect; + + rect.origin.x = x; + rect.origin.y = y; + rect.size.width = w; + rect.size.height = h; + return rect; +} + +/** Constructs NSEdgeInsets. **/ +#if OS_API_VERSION(MAC_OS_X_VERSION_10_7, GS_API_LATEST) +GS_GEOM_SCOPE NSEdgeInsets +NSEdgeInsetsMake(CGFloat top, CGFloat left, + CGFloat bottom, CGFloat right) GS_GEOM_ATTR; + +GS_GEOM_SCOPE NSEdgeInsets +NSEdgeInsetsMake(CGFloat top, CGFloat left, CGFloat bottom, CGFloat right) +{ + NSEdgeInsets edgeInsets; + + edgeInsets.top = top; + edgeInsets.left = left; + edgeInsets.bottom = bottom; + edgeInsets.right = right; + + return edgeInsets; +} + +#if OS_API_VERSION(MAC_OS_X_VERSION_10_10, GS_API_LATEST) +/** Compares two edge insets for equality. **/ +GS_EXPORT BOOL +NSEdgeInsetsEqual(NSEdgeInsets e1, NSEdgeInsets e2); +#endif + +#endif + +/** Get a Rectangle's Coordinates... **/ + +GS_GEOM_SCOPE CGFloat +NSMaxX(NSRect aRect) GS_GEOM_ATTR; + +/** Returns the greatest x-coordinate value still inside aRect. */ +GS_GEOM_SCOPE CGFloat +NSMaxX(NSRect aRect) +{ + return aRect.origin.x + aRect.size.width; +} + +GS_GEOM_SCOPE CGFloat +NSMaxY(NSRect aRect) GS_GEOM_ATTR; + +/** Returns the greatest y-coordinate value still inside aRect. */ +GS_GEOM_SCOPE CGFloat +NSMaxY(NSRect aRect) +{ + return aRect.origin.y + aRect.size.height; +} + +GS_GEOM_SCOPE CGFloat +NSMidX(NSRect aRect) GS_GEOM_ATTR; + +/** Returns the x-coordinate of aRect's middle point. */ +GS_GEOM_SCOPE CGFloat +NSMidX(NSRect aRect) +{ + return aRect.origin.x + (aRect.size.width / 2.0); +} + +GS_GEOM_SCOPE CGFloat +NSMidY(NSRect aRect) GS_GEOM_ATTR; + +/** Returns the y-coordinate of aRect's middle point. */ +GS_GEOM_SCOPE CGFloat +NSMidY(NSRect aRect) +{ + return aRect.origin.y + (aRect.size.height / 2.0); +} + +GS_GEOM_SCOPE CGFloat +NSMinX(NSRect aRect) GS_GEOM_ATTR; + +/** Returns the least x-coordinate value still inside aRect. */ +GS_GEOM_SCOPE CGFloat +NSMinX(NSRect aRect) +{ + return aRect.origin.x; +} + +GS_GEOM_SCOPE CGFloat +NSMinY(NSRect aRect) GS_GEOM_ATTR; + +/** Returns the least y-coordinate value still inside aRect. */ +GS_GEOM_SCOPE CGFloat +NSMinY(NSRect aRect) +{ + return aRect.origin.y; +} + +GS_GEOM_SCOPE CGFloat +NSWidth(NSRect aRect) GS_GEOM_ATTR; + +/** Returns aRect's width. */ +GS_GEOM_SCOPE CGFloat +NSWidth(NSRect aRect) +{ + return aRect.size.width; +} + +GS_GEOM_SCOPE CGFloat +NSHeight(NSRect aRect) GS_GEOM_ATTR; + +/** Returns aRect's height. */ +GS_GEOM_SCOPE CGFloat +NSHeight(NSRect aRect) +{ + return aRect.size.height; +} + +GS_GEOM_SCOPE BOOL +NSIsEmptyRect(NSRect aRect) GS_GEOM_ATTR; + +/** Returns 'YES' iff the area of aRect is zero (i.e., iff either + * of aRect's width or height is negative or zero). */ +GS_GEOM_SCOPE BOOL +NSIsEmptyRect(NSRect aRect) +{ + return ((NSWidth(aRect) > 0) && (NSHeight(aRect) > 0)) ? NO : YES; +} + +/** Modify a Copy of a Rectangle... **/ + +GS_GEOM_SCOPE NSRect +NSOffsetRect(NSRect aRect, CGFloat dx, CGFloat dy) GS_GEOM_ATTR; + +/** Returns the rectangle obtained by translating aRect + * horizontally by dx and vertically by dy. */ +GS_GEOM_SCOPE NSRect +NSOffsetRect(NSRect aRect, CGFloat dx, CGFloat dy) +{ + NSRect rect = aRect; + + rect.origin.x += dx; + rect.origin.y += dy; + return rect; +} + +GS_GEOM_SCOPE NSRect +NSInsetRect(NSRect aRect, CGFloat dX, CGFloat dY) GS_GEOM_ATTR; + +/** Returns the rectangle obtained by moving each of aRect's + * horizontal sides inward by dy and each of aRect's vertical + * sides inward by dx.<br /> + * NB. For MacOS-X compatability, this is permitted to return + * a rectanglew with nagative width or height, strange as that seems. + */ +GS_GEOM_SCOPE NSRect +NSInsetRect(NSRect aRect, CGFloat dX, CGFloat dY) +{ + NSRect rect; + + rect = NSOffsetRect(aRect, dX, dY); + rect.size.width -= (2 * dX); + rect.size.height -= (2 * dY); + return rect; +} + +/** Divides aRect into two rectangles (namely slice and remainder) by + * "cutting" aRect---parallel to, and a distance amount from the given edge + * of aRect. You may pass 0 in as either of slice or + * remainder to avoid obtaining either of the created rectangles. */ +GS_EXPORT void +NSDivideRect(NSRect aRect, + NSRect *slice, + NSRect *remainder, + CGFloat amount, + NSRectEdge edge); + +/** Returns a rectangle obtained by expanding aRect minimally + * so that all four of its defining components are integers. */ +GS_EXPORT NSRect +NSIntegralRect(NSRect aRect); + +/** Compute a Third Rectangle from Two Rectangles... **/ + +GS_GEOM_SCOPE NSRect +NSUnionRect(NSRect aRect, NSRect bRect) GS_GEOM_ATTR; + +/** Returns the smallest rectangle which contains both aRect + * and bRect (modulo a set of measure zero). If either of aRect + * or bRect is an empty rectangle, then the other rectangle is + * returned. If both are empty, then the empty rectangle is returned. */ +GS_GEOM_SCOPE NSRect +NSUnionRect(NSRect aRect, NSRect bRect) +{ + NSRect rect; + + if (NSIsEmptyRect(aRect) && NSIsEmptyRect(bRect)) + return NSMakeRect(0.0,0.0,0.0,0.0); + else if (NSIsEmptyRect(aRect)) + return bRect; + else if (NSIsEmptyRect(bRect)) + return aRect; + + rect = NSMakeRect(MIN(NSMinX(aRect), NSMinX(bRect)), + MIN(NSMinY(aRect), NSMinY(bRect)), 0.0, 0.0); + + rect = NSMakeRect(NSMinX(rect), + NSMinY(rect), + MAX(NSMaxX(aRect), NSMaxX(bRect)) - NSMinX(rect), + MAX(NSMaxY(aRect), NSMaxY(bRect)) - NSMinY(rect)); + + return rect; +} + +GS_GEOM_SCOPE NSRect +NSIntersectionRect(NSRect aRect, NSRect bRect) GS_GEOM_ATTR; + +/** Returns the largest rectangle which lies in both aRect and + * bRect. If aRect and bRect have empty intersection (or, rather, + * intersection of measure zero, since this includes having their + * intersection be only a point or a line), then the empty + * rectangle is returned. */ +GS_GEOM_SCOPE NSRect +NSIntersectionRect (NSRect aRect, NSRect bRect) +{ + if (NSMaxX(aRect) <= NSMinX(bRect) || NSMaxX(bRect) <= NSMinX(aRect) + || NSMaxY(aRect) <= NSMinY(bRect) || NSMaxY(bRect) <= NSMinY(aRect)) + { + return NSMakeRect(0.0, 0.0, 0.0, 0.0); + } + else + { + NSRect rect; + + if (NSMinX(aRect) <= NSMinX(bRect)) + rect.origin.x = bRect.origin.x; + else + rect.origin.x = aRect.origin.x; + + if (NSMinY(aRect) <= NSMinY(bRect)) + rect.origin.y = bRect.origin.y; + else + rect.origin.y = aRect.origin.y; + + if (NSMaxX(aRect) >= NSMaxX(bRect)) + rect.size.width = NSMaxX(bRect) - rect.origin.x; + else + rect.size.width = NSMaxX(aRect) - rect.origin.x; + + if (NSMaxY(aRect) >= NSMaxY(bRect)) + rect.size.height = NSMaxY(bRect) - rect.origin.y; + else + rect.size.height = NSMaxY(aRect) - rect.origin.y; + + return rect; + } +} + +/** Test geometric relationships... **/ + +/** Returns 'YES' iff aRect's and bRect's origin and size are the same. */ +GS_EXPORT BOOL +NSEqualRects(NSRect aRect, NSRect bRect) GS_GEOM_ATTR; + +/** Returns 'YES' iff aSize's and bSize's width and height are the same. */ +GS_EXPORT BOOL +NSEqualSizes(NSSize aSize, NSSize bSize) GS_GEOM_ATTR; + +/** Returns 'YES' iff aPoint's and bPoint's x- and y-coordinates + * are the same. */ +GS_EXPORT BOOL +NSEqualPoints(NSPoint aPoint, NSPoint bPoint) GS_GEOM_ATTR; + +GS_GEOM_SCOPE BOOL +NSMouseInRect(NSPoint aPoint, NSRect aRect, BOOL flipped) GS_GEOM_ATTR; + +/** Returns 'YES' iff aPoint is inside aRect. */ +GS_GEOM_SCOPE BOOL +NSMouseInRect(NSPoint aPoint, NSRect aRect, BOOL flipped) +{ + if (flipped) + { + return ((aPoint.x >= NSMinX(aRect)) + && (aPoint.y >= NSMinY(aRect)) + && (aPoint.x < NSMaxX(aRect)) + && (aPoint.y < NSMaxY(aRect))) ? YES : NO; + } + else + { + return ((aPoint.x >= NSMinX(aRect)) + && (aPoint.y > NSMinY(aRect)) + && (aPoint.x < NSMaxX(aRect)) + && (aPoint.y <= NSMaxY(aRect))) ? YES : NO; + } +} + +GS_GEOM_SCOPE BOOL +NSPointInRect(NSPoint aPoint, NSRect aRect) GS_GEOM_ATTR; + +/** Just like 'NSMouseInRect(aPoint, aRect, YES)'. */ +GS_GEOM_SCOPE BOOL +NSPointInRect(NSPoint aPoint, NSRect aRect) +{ + return NSMouseInRect(aPoint, aRect, YES); +} + +GS_GEOM_SCOPE BOOL +NSContainsRect(NSRect aRect, NSRect bRect) GS_GEOM_ATTR; + +/** Returns 'YES' iff aRect totally encloses bRect. NOTE: For + * this to be the case, aRect cannot be empty, nor can any side + * of bRect go beyond any side of aRect. Note that this behavior + * is different than the original OpenStep behavior, where the sides + * of bRect could not touch aRect. */ +GS_GEOM_SCOPE BOOL +NSContainsRect(NSRect aRect, NSRect bRect) +{ + return (!NSIsEmptyRect(bRect) + && (NSMinX(aRect) <= NSMinX(bRect)) + && (NSMinY(aRect) <= NSMinY(bRect)) + && (NSMaxX(aRect) >= NSMaxX(bRect)) + && (NSMaxY(aRect) >= NSMaxY(bRect))) ? YES : NO; +} + +#if OS_API_VERSION(GS_API_MACOSX, GS_API_LATEST) +GS_GEOM_SCOPE BOOL +NSIntersectsRect(NSRect aRect, NSRect bRect) GS_GEOM_ATTR; + +/** Returns YES if aRect and bRect have non-zero intersection area + (intersecting at a line or a point doesn't count). */ +GS_GEOM_SCOPE BOOL +NSIntersectsRect(NSRect aRect, NSRect bRect) +{ + /* Note that intersecting at a line or a point doesn't count */ + return (NSMaxX(aRect) <= NSMinX(bRect) + || NSMaxX(bRect) <= NSMinX(aRect) + || NSMaxY(aRect) <= NSMinY(bRect) + || NSMaxY(bRect) <= NSMinY(aRect) + || NSIsEmptyRect(aRect) + || NSIsEmptyRect(bRect)) ? NO : YES; +} +#endif + +/** Get a String Representation... **/ + +#ifdef __OBJC__ +/** Returns an NSString of the form "{x=X; y=Y}", where + * X and Y are the x- and y-coordinates of aPoint, respectively. */ +GS_EXPORT NSString * +NSStringFromPoint(NSPoint aPoint); + +/** Returns an NSString of the form "{x=X; y=Y; width=W; height=H}", + * where X, Y, W, and H are the x-coordinate, y-coordinate, + * width, and height of aRect, respectively. */ +GS_EXPORT NSString * +NSStringFromRect(NSRect aRect); + +/** Returns an NSString of the form "{width=W; height=H}", where + * W and H are the width and height of aSize, respectively. */ +GS_EXPORT NSString * +NSStringFromSize(NSSize aSize); + +/** Parses point from string of form "<code>{x=a; y=b}</code>". (0,0) returned + if parsing fails. */ +GS_EXPORT NSPoint NSPointFromString(NSString* string); + +/** Parses size from string of form "<code>{width=a; height=b}</code>". Size of + 0,0 returned if parsing fails. */ +GS_EXPORT NSSize NSSizeFromString(NSString* string); + +/** Parses point from string of form "<code>{x=a; y=b; width=c; + height=d}</code>". Rectangle of 0 size at origin returned if parsing + fails. +*/ +GS_EXPORT NSRect NSRectFromString(NSString* string); + +#endif /* __OBJC__ */ + +#ifdef GS_DEFINED_MAX +#undef GS_DEFINED_MAX +#undef MAX +#endif + +#ifdef GS_DEFINED_MIN +#undef GS_DEFINED_MIN +#undef MIN +#endif + +#if defined(__cplusplus) +} +#endif + +#endif /* __NSGeometry_h_GNUSTEP_BASE_INCLUDE */ diff --git a/gcc/testsuite/objc-obj-c++-shared/GNUStep/Foundation/NSObjCRuntime.h b/gcc/testsuite/objc-obj-c++-shared/GNUStep/Foundation/NSObjCRuntime.h new file mode 100644 index 00000000000..189af80436a --- /dev/null +++ b/gcc/testsuite/objc-obj-c++-shared/GNUStep/Foundation/NSObjCRuntime.h @@ -0,0 +1,317 @@ +/** Interface to ObjC runtime for GNUStep + Copyright (C) 1995, 1997, 2000 Free Software Foundation, Inc. + + Written by: Andrew Kachites McCallum <mccallum@gnu.ai.mit.edu> + Date: 1995 + + This file is part of the GNUstep Base Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, 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 + Library General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02111 USA. + + AutogsdocSource: NSObjCRuntime.m + AutogsdocSource: NSLog.m + + */ + +#ifndef __NSObjCRuntime_h_GNUSTEP_BASE_INCLUDE +#define __NSObjCRuntime_h_GNUSTEP_BASE_INCLUDE + +#ifdef __cplusplus +#ifndef __STDC_LIMIT_MACROS +#define __STDC_LIMIT_MACROS 1 +#endif +#endif + +#import "../GNUstepBase/GSVersionMacros.h" +#import "../GNUstepBase/GSConfig.h" +#import "../GNUstepBase/GNUstep.h" +#if __BLOCKS__ +#import "../GNUstepBase/GSBlocks.h" +#endif + +#include <stdarg.h> +#include <limits.h> +#include <float.h> + +/* PA HP-UX kludge. */ +#if defined(__hppa__) && defined(__hpux__) && !defined(PRIuPTR) +#define PRIuPTR "lu" +#endif + +/* IRIX kludge. */ +#if defined(__sgi) +/* IRIX 6.5 <inttypes.h> provides all definitions, but only for C99 + compilations. */ +#define PRId8 "hhd" +#define PRIu8 "hhu" +#if (_MIPS_SZLONG == 32) +#define PRId64 "lld" +#define PRIu64 "llu" +#endif +/* This doesn't match <inttypes.h>, which always has "lld" here, but the + arguments are uint64_t, int64_t, which are unsigned long, long for + 64-bit in <sgidefs.h>. */ +#if (_MIPS_SZLONG == 64) +#define PRId64 "ld" +#define PRIu64 "lu" +#endif +/* This doesn't match <inttypes.h>, which has "u" here, but the arguments + are uintptr_t, which is always unsigned long. */ +#define PRIuPTR "lu" +#endif + +/* Solaris < 10 kludge. */ +#if defined(__sun__) && defined(__svr4__) && !defined(PRIuPTR) +#if defined(__arch64__) || defined (__x86_64__) +#define PRIuPTR "lu" +#define PRIdPTR "ld" +#define PRIxPTR "lx" +#else +#define PRIuPTR "u" +#define PRIdPTR "d" +#define PRIxPTR "x" +#endif +#endif + + +/* These typedefs must be in place before GSObjCRuntime.h is imported. + */ + +#if !defined(NSINTEGER_DEFINED) +typedef intptr_t NSInteger; +typedef uintptr_t NSUInteger; +# define NSIntegerMax INTPTR_MAX +# define NSIntegerMin INTPTR_MIN +# define NSUIntegerMax UINTPTR_MAX +#endif /* !defined(NSINTEGER_DEFINED) */ + +#if !defined(CGFLOAT_DEFINED) +#if GS_SIZEOF_VOIDP == 8 +#define CGFLOAT_IS_DBL 1 +typedef double CGFloat; +#define CGFLOAT_MIN DBL_MIN +#define CGFLOAT_MAX DBL_MAX +#else +typedef float CGFloat; +#define CGFLOAT_MIN FLT_MIN +#define CGFLOAT_MAX FLT_MAX +#endif +#endif /* !defined(CGFLOAT_DEFINED) */ + +#define NSINTEGER_DEFINED 1 +#define CGFLOAT_DEFINED 1 +#ifndef NS_AUTOMATED_REFCOUNT_UNAVAILABLE +# if __has_feature(objc_arc) +# define NS_AUTOMATED_REFCOUNT_UNAVAILABLE \ + __attribute__((unavailable("Not available with automatic reference counting"))) +# else +# define NS_AUTOMATED_REFCOUNT_UNAVAILABLE +# endif +#endif + + +#if defined(__cplusplus) +extern "C" { +#endif + + +/* + * We can have strongly typed enums in C++11 mode or when the objc_fixed_enum + * feature is availble. + */ +#if (__has_feature(objc_fixed_enum) || (__cplusplus && (__cplusplus > 199711L) && __has_extension(cxx_strong_enums))) +# define _GS_NAMED_ENUM(ty, name) enum name : ty name; enum name : ty +# define _GS_ANON_ENUM(ty) enum : ty +# if __cplusplus +# define NS_OPTIONS(ty,name) ty name; enum : ty +# else +# define NS_OPTIONS(ty,name) NS_ENUM(ty,name) +# endif +#else // this provides less information, but works with older compilers +# define _GS_NAMED_ENUM(ty, name) ty name; enum +# define _GS_ANON_ENUM(ty) enum +# define NS_OPTIONS(ty, name) NS_ENUM(ty, name) +#endif +// A bit of fairy dust to expand NS_ENUM to the correct variant +#define _GS_GET_ENUM_MACRO(_first,_second,NAME,...) NAME +/* The trick here is that placing the variadic args first will push the name + * that the _GS_GET_ENUM_MACRO expands to into the correct position. + */ +#define NS_ENUM(...) _GS_GET_ENUM_MACRO(__VA_ARGS__,_GS_NAMED_ENUM,_GS_ANON_ENUM)(__VA_ARGS__) + +/* + * If the compiler supports nullability qualifiers, we define the macros for + * non-null sections. + */ +#if __has_feature(nullability) +# define NS_ASSUME_NONNULL_BEGIN _Pragma("clang assume_nonnull begin") +# define NS_ASSUME_NONNULL_END _Pragma("clang assume_nonnull end") +#else +# define NS_ASSUME_NONNULL_BEGIN +# define NS_ASSUME_NONNULL_END +#endif + +/* + * Backwards compatibility macro for instance type. + */ +#if !__has_feature(objc_instancetype) +# define instancetype id +#endif + +/* + * Backwards compatibility macros for Objective-C lightweight generics. + */ +#if __has_feature(objc_generics) +# define GS_GENERIC_CLASS(clz, ...) clz<__VA_ARGS__> +# define GS_GENERIC_TYPE_F(typeRef, fallback) typeRef +#else +# define GS_GENERIC_CLASS(clz, ...) clz +# define GS_GENERIC_TYPE_F(typeRef, fallback) fallback +#endif +#define GS_GENERIC_TYPE(typeRef) GS_GENERIC_TYPE_F(typeRef, id) + +/** + * Backwards compatibility macro for the objc_designated_initializer attribute + */ +#if __has_attribute(objc_designated_initializer) +# define NS_DESIGNATED_INITIALIZER __attribute__((objc_designated_initializer)) +#else +# define NS_DESIGNATED_INITIALIZER +#endif + +/** Bitfield used to specify options to control enumeration over collections. + */ +typedef NS_OPTIONS(NSUInteger, NSEnumerationOptions) +{ + NSEnumerationConcurrent = (1UL << 0), /** Specifies that the enumeration + * is concurrency-safe. Note that this does not mean that it will be + * carried out in a concurrent manner, only that it can be. + */ + + NSEnumerationReverse = (1UL << 1) /** Specifies that the enumeration should + * happen in the opposite of the natural order of the collection. + */ +}; + + +/** Bitfield used to specify options to control the sorting of collections. + */ +typedef NS_OPTIONS(NSUInteger, NSSortOptions) +{ + NSSortConcurrent = (1UL << 0), /** Specifies that the sort + * is concurrency-safe. Note that this does not mean that it will be + * carried out in a concurrent manner, only that it can be. + */ + NSSortStable = (1UL << 4) /** Specifies that the sort should keep + * equal objects in the same order in the collection. + */ +}; + + +#import "../GNUstepBase/GSObjCRuntime.h" + +#if OS_API_VERSION(MAC_OS_X_VERSION_10_5,GS_API_LATEST) +GS_EXPORT NSString *NSStringFromProtocol(Protocol *aProtocol); +GS_EXPORT Protocol *NSProtocolFromString(NSString *aProtocolName); +#endif +GS_EXPORT SEL NSSelectorFromString(NSString *aSelectorName); +GS_EXPORT NSString *NSStringFromSelector(SEL aSelector); +GS_EXPORT SEL NSSelectorFromString(NSString *aSelectorName); +GS_EXPORT Class NSClassFromString(NSString *aClassName); +GS_EXPORT NSString *NSStringFromClass(Class aClass); +GS_EXPORT const char *NSGetSizeAndAlignment(const char *typePtr, + NSUInteger *sizep, NSUInteger *alignp); + +#if OS_API_VERSION(GS_API_NONE, GS_API_NONE) +/* Logging */ +/** + * OpenStep spec states that log messages go to stderr, but just in case + * someone wants them to go somewhere else, they can implement a function + * like this and assign a pointer to it to _NSLog_printf_handler. + */ +typedef void NSLog_printf_handler (NSString* message); +GS_EXPORT NSLog_printf_handler *_NSLog_printf_handler; +GS_EXPORT int _NSLogDescriptor; +@class NSRecursiveLock; +GS_EXPORT NSRecursiveLock *GSLogLock(void); +#endif + +GS_EXPORT void NSLog(NSString *format, ...) NS_FORMAT_FUNCTION(1,2); +GS_EXPORT void NSLogv(NSString *format, va_list args) NS_FORMAT_FUNCTION(1,0); + +#ifndef YES +#define YES 1 +#endif +#ifndef NO +#define NO 0 +#endif +#ifndef nil +#define nil 0 +#endif + +/** + * Contains values <code>NSOrderedSame</code>, <code>NSOrderedAscending</code> + * <code>NSOrderedDescending</code>, for left hand side equals, less than, or + * greater than right hand side. + */ +typedef NS_ENUM(NSInteger, NSComparisonResult) +{ + NSOrderedAscending = (NSInteger)-1, NSOrderedSame, NSOrderedDescending +}; + +enum {NSNotFound = NSIntegerMax}; + +#if __BLOCKS__ +DEFINE_BLOCK_TYPE(NSComparator, NSComparisonResult, id, id); +#endif + +/** + * Declare the foundation export macro as an alias to GS_EXPORT + */ +#define FOUNDATION_EXPORT GS_EXPORT + +#if defined(__cplusplus) +} +#endif + +/** + * Declare Apple availability macros for compatibility purposes as no-ops. + */ +#define NS_CLASS_AVAILABLE(...) +#define NS_AVAILABLE(...) +#define NS_AVAILABLE_MAC(...) +#define NS_DEPRECATED(...) +#define NS_DEPRECATED_MAC(...) +#define NS_ENUM_AVAILABLE(...) +#define NS_ENUM_AVAILABLE_MAC(...) +#define NS_ENUM_DEPRECATED(...) +#define NS_ENUM_DEPRECATED_MAC(...) +#define NS_CLASS_AVAILABLE(...) +#define NS_CLASS_DEPRECATED(...) +#define NS_CLASS_AVAILABLE_MAC(...) +#define NS_CLASS_DEPRECATED_MAC(...) +#define NS_UNAVAILABLE + +/* Define root class NS macro */ +#ifndef NS_ROOT_CLASS +#if __has_attribute(objc_root_class) +#define NS_ROOT_CLASS __attribute__((objc_root_class)) +#else +#define NS_ROOT_CLASS +#endif +#endif + +#endif /* __NSObjCRuntime_h_GNUSTEP_BASE_INCLUDE */ diff --git a/gcc/testsuite/objc-obj-c++-shared/GNUStep/Foundation/NSObject.h b/gcc/testsuite/objc-obj-c++-shared/GNUStep/Foundation/NSObject.h new file mode 100644 index 00000000000..35647eadab6 --- /dev/null +++ b/gcc/testsuite/objc-obj-c++-shared/GNUStep/Foundation/NSObject.h @@ -0,0 +1,594 @@ +/**Interface for NSObject for GNUStep + Copyright (C) 1995, 1996, 1998 Free Software Foundation, Inc. + + Written by: Andrew Kachites McCallum <mccallum@gnu.ai.mit.edu> + Date: 1995 + + This file is part of the GNUstep Base Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, 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 + Library General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02111 USA. + + AutogsdocSource: NSObject.m + */ + +#ifndef __NSObject_h_GNUSTEP_BASE_INCLUDE +#define __NSObject_h_GNUSTEP_BASE_INCLUDE + +#import "NSObjCRuntime.h" +#import <objc/objc.h> +#import "NSZone.h" + +#ifdef GS_WITH_GC +#undef GS_WITH_GC +#endif +#define GS_WITH_GC 0 + +#import "../GNUstepBase/GNUstep.h" + +#if defined(__cplusplus) +extern "C" { +#endif + +@class NSArchiver; +@class NSArray; +@class NSCoder; +@class NSDictionary; +@class NSPortCoder; +@class NSMethodSignature; +@class NSMutableString; +@class NSRecursiveLock; +@class NSString; +@class NSInvocation; +@class Protocol; + +/** + * The NSObject protocol describes a minimal set of methods that all + * objects are expected to support. You should be able to send any + * of the messages listed in this protocol to an object, and be safe + * in assuming that the receiver can handle it. + */ +@protocol NSObject +/** + * Returns the class of the receiver. If the receiver is a proxy, then this + * may return the class of the proxy target. Use -isProxy to determine whether + * the receiver is a proxy. If you wish to find the real class of the + * receiver, ignoring proxies, then use object_getClass(). + */ +- (Class) class; +/** + * Returns the superclass of receiver's class. If the receiver is a proxy, + * then this may return the class of the proxy target. Use -isProxy to + * determine whether the receiver is a proxy. If you wish to find the real + * superclass of the receiver's class, ignoring proxies, then use + * class_getSuperclass(object_getClass()). + */ +- (Class) superclass; +/** + * Returns whether the receiver is equal to the argument. Defining equality is + * complex, so be careful when implementing this method. Collections such as + * NSSet depend on the behaviour of this method. In particular, this method + * must be commutative, so for any objects a and b: + * + * [a isEqual: b] == [b isEqual: a] + * + * This means that you must be very careful when returning YES if the argument + * is of another class. For example, if you define a number class that returns + * YES if the argument is a string representation of the number, then this will + * break because the string will not recognise your object as being equal to + * itself. + * + * If two objects are equal, then they must have the same hash value, however + * equal hash values do not imply equality. + */ +- (BOOL) isEqual: (id)anObject; +/** + * Returns YES if the receiver is an instance of the class, an instance of the + * subclass, or (in the case of proxies), an instance of something that can be + * treated as an instance of the class. + */ +- (BOOL) isKindOfClass: (Class)aClass; +/** + * Returns YES if the receiver is an instance of the class or (in the case of + * proxies), an instance of something that can be treated as an instance of the + * class. + * + * Calling this method is rarely the correct thing to do. In most cases, a + * subclass can be substituted for a superclass, so you should never need to + * check that an object is really an instance of a specific class and not a + * subclass. + */ +- (BOOL) isMemberOfClass: (Class)aClass; +/** + * Returns YES if the receiver is a proxy, NO otherwise. The default + * implementation of this method in NSObject returns NO, while the + * implementation in NSProxy returns YES. + */ +- (BOOL) isProxy; +/** + * Returns a hash value for the object. All objects that are equal *MUST* + * return the same hash value. For efficient storage in sets, or as keys in + * dictionaries, different objects should return hashes spread evenly over the + * range of an integer. + * + * An object may not return different values from this method after being + * stored in a collection. This typically means that ether the hash value must + * be constant after the object's creation, or that the object may not be + * modified while stored in an unordered collection. + */ +- (NSUInteger) hash; +/** + * Returns the receiver. In a proxy, this may (but is not required to) return + * the proxied object. + */ +- (id) self; +/** + * Performs the specified selector. The selector must correspond to a method + * that takes no arguments. + */ +- (id) performSelector: (SEL)aSelector; +/** + * Performs the specified selector, with the object as the argument. This + * method does not perform any automatic unboxing, so the selector must + * correspond to a method that takes one object argument. + */ +- (id) performSelector: (SEL)aSelector + withObject: (id)anObject; +/** + * Performs the specified selector, with the objects as the arguments. This + * method does not perform any automatic unboxing, so the selector must + * correspond to a method that takes two object arguments. + */ +- (id) performSelector: (SEL)aSelector + withObject: (id)object1 + withObject: (id)object2; +/** + * Returns YES if the object can respond to messages with the specified + * selector. The default implementation in NSObject returns YES if the + * receiver has a method corresponding to the method, but other classes may + * return YES if they can respond to a selector using one of the various + * forwarding mechanisms. + */ +- (BOOL) respondsToSelector: (SEL)aSelector; +/** + * Returns YES if the receiver conforms to the specified protocol. + */ +- (BOOL) conformsToProtocol: (Protocol*)aProtocol; +/** + * Increments the reference count of the object and returns the receiver. In + * garbage collected mode, this method does nothing. In automated reference + * counting mode, you may neither implement this method nor call it directly. + */ +- (id) retain NS_AUTOMATED_REFCOUNT_UNAVAILABLE; +/** + * Decrements the reference count of the object and destroys if it there are no + * remaining references. In garbage collected mode, this method does nothing. + * In automated reference counting mode, you may neither implement this method + * nor call it directly. + */ +- (oneway void) release NS_AUTOMATED_REFCOUNT_UNAVAILABLE; +/** + * Performs a deferred -release operation. The object's reference count is + * decremented at the end of the scope of the current autorelease pool, + * identified either by a -drain message sent to the current NSAutoreleasePool + * instance, or in more recent versions of Objective-C by the end of an + * @autorelease_pool scope. + * + * In garbage collected mode, this method does nothing. In automated reference + * counting mode, you may neither implement this method nor call it directly. + */ +- (id) autorelease NS_AUTOMATED_REFCOUNT_UNAVAILABLE; +/** + * Returns the current retain count of an object. This does not include the + * result of any pending autorelease operations. + * + * Code that relies on this method returning a sane value is broken. For + * singletons, it may return NSUIntegerMax. Even when it is tracking a retain + * count, it will not include on-stack pointers in manual retain/release mode, + * pointers marked as __unsafe_unretain or __weak in ARC mode, or pending + * autorelease operations. Its value is therefore largely meaningless. It can + * occasionally be useful for debugging. + */ +- (NSUInteger) retainCount NS_AUTOMATED_REFCOUNT_UNAVAILABLE; +/** + * Returns the description of the object. This is used by the %@ format + * specifier in strings. + */ +- (NSString*) description; +/** + * Returns the zone of the object. + */ +- (NSZone*) zone NS_AUTOMATED_REFCOUNT_UNAVAILABLE; +@end + +/** + * This protocol must be adopted by any class wishing to support copying - + * ie where instances of the class should be able to create new instances + * which are copies of the original and, where a class has mutable and + * immutable versions, where the copies are immutable. + */ +@protocol NSCopying +/** + * Called by [NSObject-copy] passing NSDefaultMallocZone() as zone.<br /> + * This method returns a copy of the receiver and, where the receiver is a + * mutable variant of a class which has an immutable partner class, the + * object returned is an instance of that immutable class.<br /> + * The new object is <em>not</em> autoreleased, and is considered to be + * 'owned' by the calling code ... which is therefore responsible for + * releasing it.<br /> + * In the case where the receiver is an instance of a container class, + * it is undefined whether contained objects are merely retained in the + * new copy, or are themselves copied, or whether some other mechanism + * entirely is used. + */ +- (id) copyWithZone: (NSZone*)zone; +@end + +/** + * This protocol must be adopted by any class wishing to support + * mutable copying - ie where instances of the class should be able + * to create mutable copies of themselves. + */ +@protocol NSMutableCopying +/** + * Called by [NSObject-mutableCopy] passing NSDefaultMallocZone() as zone.<br /> + * This method returns a copy of the receiver and, where the receiver is an + * immutable variant of a class which has a mutable partner class, the + * object returned is an instance of that mutable class. + * The new object is <em>not</em> autoreleased, and is considered to be + * 'owned' by the calling code ... which is therefore responsible for + * releasing it.<br /> + * In the case where the receiver is an instance of a container class, + * it is undefined whether contained objects are merely retained in the + * new copy, or are themselves copied, or whether some other mechanism + * entirely is used. + */ +- (id) mutableCopyWithZone: (NSZone*)zone; +@end + +/** + * This protocol must be adopted by any class wishing to support + * saving and restoring instances to an archive, or copying them + * to remote processes via the Distributed Objects mechanism. + */ +@protocol NSCoding + +/** + * Called when it is time for receiver to be serialized for writing to an + * archive or network connection. Receiver should record all of its instance + * variables using methods on aCoder. See documentation for [NSCoder], + * [NSArchiver], [NSKeyedArchiver], and/or [NSPortCoder] for more information. + */ +- (void) encodeWithCoder: (NSCoder*)aCoder; + +/** + * Called on a freshly allocated receiver when it is time to reconstitute from + * serialized bytes in an archive or from a network connection. Receiver + * should load all of its instance variables using methods on aCoder. See + * documentation for [NSCoder], [NSUnarchiver], [NSKeyedUnarchiver], and/or + * [NSPortCoder] for more information. + */ +- (id) initWithCoder: (NSCoder*)aDecoder; +@end + +@protocol NSSecureCoding <NSCoding> ++ (BOOL)supportsSecureCoding; +@end + + +GS_ROOT_CLASS @interface NSObject <NSObject> +{ + /** + * Points to instance's class. Used by runtime to access method + * implementations, etc.. Set in +alloc, Unlike other instance variables, + * which are cleared there. + */ + Class isa; +} + +#if OS_API_VERSION(MAC_OS_X_VERSION_10_5, GS_API_LATEST) +/** On a system which performs garbage collection, you should implement + * this method to execute code when the receiver is collected.<br /> + * You must not call this method yourself (except when a subclass + * calls the superclass method within its own implementation). + */ +- (void) finalize; +#endif + +#if OS_API_VERSION(GS_API_MACOSX, GS_API_LATEST) +- (NSString*) className; +#endif + ++ (id) allocWithZone: (NSZone*)z; ++ (id) alloc; ++ (Class) class; + +/** + * This method is automatically invoked on any class which implements it + * when the class is loaded into the runtime.<br /> + * It is also invoked on any category where the method is implemented + * when that category is loaded into the runtime.<br /> + * The +load method is called directly by the runtime and you should never + * send a +load message to a class yourself.<br /> + * This method is called <em>before</em> the +initialize message is sent + * to the class, so you cannot depend on class initialisation having been + * performed, or upon other classes existing (apart from superclasses of + * the receiver, since +load is called on superclasses before it is called + * on their subclasses).<br /> + * As a gross generalisation, it is safe to use C code, including + * most ObjectiveC runtime functions within +load, but attempting to send + * messages to ObjectiveC objects is likely to fail.<br /> + * In GNUstep, this method is implemented for NSObject to perform some + * initialisation for the base library.<br /> + * If you implement +load for a class, don't call [super load] in your + * implementation. + */ ++ (void) load; + +/** + * This message is automatically sent to a class by the runtime. It is + * sent once for each class, just before the class is used for the first + * time (excluding any automatic call to +load by the runtime).<br /> + * The message is sent in a thread-safe manner ... other threads may not + * call methods of the class until +initialize has finished executing.<br /> + * If the class has a superclass, its implementation of +initialize is + * called first.<br /> + * If the class does not implement +initialize then the implementation + * in the closest superclass may be called. This means that +initialize may + * be called more than once, and the recommended way to handle this by + * using the + * <code> + * if (self == [classname class]) + * </code> + * conditional to check whether the method is being called for a subclass.<br /> + * You should never call +initialize yourself ... let the runtime do it.<br /> + * You can implement +initialize in your own class if you need to. + * NSObject's implementation handles essential root object and base + * library initialization.<br /> + * It should be safe to call [super initialize] in your implementation + * of +initialize. + */ ++ (void) initialize; ++ (IMP) instanceMethodForSelector: (SEL)aSelector; ++ (NSMethodSignature*) instanceMethodSignatureForSelector: (SEL)aSelector; ++ (BOOL) instancesRespondToSelector: (SEL)aSelector; ++ (BOOL) isSubclassOfClass: (Class)aClass; ++ (id) new; ++ (void) poseAsClass: (Class)aClassObject; ++ (id) setVersion: (NSInteger)aVersion; ++ (NSInteger) version; + +- (id) awakeAfterUsingCoder: (NSCoder*)aDecoder; +- (Class) classForArchiver; +- (Class) classForCoder; +- (id) copy; +- (void) dealloc; +- (void) doesNotRecognizeSelector: (SEL)aSelector; +- (void) forwardInvocation: (NSInvocation*)anInvocation; +- (id) init; +- (IMP) methodForSelector: (SEL)aSelector; +- (NSMethodSignature*) methodSignatureForSelector: (SEL)aSelector; +- (id) mutableCopy; +- (id) replacementObjectForArchiver: (NSArchiver*)anArchiver; +- (id) replacementObjectForCoder: (NSCoder*)anEncoder; +- (Class) superclass; +#if OS_API_VERSION(MAC_OS_X_VERSION_10_5, GS_API_LATEST) +/** + * This method will be called when attempting to send a message a class that + * does not understand it. The class may install a new method for the given + * selector and return YES, otherwise it should return NO. + * + * Note: This method is only reliable when using the GNUstep runtime. If you + * require compatibility with the GCC runtime, you must also implement + * -forwardInvocation: with equivalent semantics. This will be considerably + * slower, but more portable. + */ ++ (BOOL) resolveClassMethod: (SEL)name; + +/** + * This method will be called when attempting to send a message an instance + * that does not understand it. The class may install a new method for the + * given selector and return YES, otherwise it should return NO. + * + * Note: This method is only reliable when using the GNUstep runtime. If you + * require compatibility with the GCC runtime, you must also implement + * -forwardInvocation: with equivalent semantics. This will be considerably + * slower, but more portable. + */ ++ (BOOL) resolveInstanceMethod: (SEL)name; +#endif +#if OS_API_VERSION(MAC_OS_X_VERSION_10_6, GS_API_LATEST) +/** + * Returns an auto-accessing proxy for the given object. This proxy sends a + * -beginContentAccess message to the receiver when it is created and an + * -endContentAccess message when it is destroyed. This prevents an object + * that implements the NSDiscardableContent protocol from having its contents + * discarded for as long as the proxy exists. + * + * On systems using the GNUstep runtime, messages send to the proxy will be + * slightly slower than direct messages. With the GCC runtime, they will be + * approximately two orders of magnitude slower. The GNUstep runtime, + * therefore, is strongly recommended for code calling this method. + */ +- (id) autoContentAccessingProxy; + +/** + * If an object does not understand a message, it may delegate it to another + * object. Returning nil indicates that forwarding should not take place. The + * default implementation of this returns nil, but care should be taken when + * subclassing NSObject subclasses and overriding this method that + * the superclass implementation is called if returning nil. + * + * Note: This method is only reliable when using the GNUstep runtime and code + * compiled with clang. If you require compatibility with GCC and the GCC + * runtime, you must also implement -forwardInvocation: with equivalent + * semantics. This will be considerably slower, but more portable. + */ +- (id) forwardingTargetForSelector: (SEL)aSelector; + +#endif +@end + +/** + * Used to allocate memory to hold an object, and initialise the + * class of the object to be aClass etc. The allocated memory will + * be extraBytes larger than the space actually needed to hold the + * instance variables of the object.<br /> + * This function is used by the [NSObject+allocWithZone:] method. + */ +GS_EXPORT id +NSAllocateObject(Class aClass, NSUInteger extraBytes, NSZone *zone); + +/** + * Used to release the memory used by an object.<br /> + * This function is used by the [NSObject-dealloc] method. + */ +GS_EXPORT void +NSDeallocateObject(id anObject); + +/** + * Used to copy anObject. This makes a bitwise copy of anObject to + * memory allocated from zone. The allocated memory will be extraBytes + * longer than that necessary to actually store the instance variables + * of the copied object.<br /> + */ +GS_EXPORT NSObject * +NSCopyObject(NSObject *anObject, NSUInteger extraBytes, NSZone *zone); + +/** + * Returns a flag to indicate whether anObject should be retained or + * copied in order to make a copy in the specified zone.<br /> + * Basically, this tests to see if anObject was allocated from + * requestedZone and returns YES if it was. + */ +GS_EXPORT BOOL +NSShouldRetainWithZone(NSObject *anObject, NSZone *requestedZone); + +GS_EXPORT BOOL +NSDecrementExtraRefCountWasZero(id anObject); + +GS_EXPORT NSUInteger +NSExtraRefCount(id anObject); + +GS_EXPORT void +NSIncrementExtraRefCount(id anObject); + +#if OS_API_VERSION(GS_API_NONE, GS_API_NONE) + +/** Global lock to be used by classes when operating on any global + data that invoke other methods which also access global; thus, + creating the potential for deadlock. */ +GS_EXPORT NSRecursiveLock *gnustep_global_lock; + +@interface NSObject (NEXTSTEP) +- (id) error:(const char *)aString, ...; +/* - (const char *) name; + Removed because OpenStep has -(NSString*)name; */ +@end + +#if GS_API_VERSION(GS_API_NONE, 011700) +@interface NSObject (GNUstep) ++ (void) enableDoubleReleaseCheck: (BOOL)enable; +@end +#endif + +#endif + +#import "NSDate.h" +/** + * Declares some methods for sending messages to self after a fixed delay. + * (These methods <em>are</em> in OpenStep and OS X.) + */ +@interface NSObject (TimedPerformers) + +/** + * Cancels any perform operations set up for the specified target + * in the current run loop. + */ ++ (void) cancelPreviousPerformRequestsWithTarget: (id)obj; + +/** + * Cancels any perform operations set up for the specified target + * in the current loop, but only if the value of aSelector and argument + * with which the performs were set up match those supplied.<br /> + * Matching of the argument may be either by pointer equality or by + * use of the [NSObject-isEqual:] method. + */ ++ (void) cancelPreviousPerformRequestsWithTarget: (id)obj + selector: (SEL)s + object: (id)arg; +/** + * Sets given message to be sent to this instance after given delay, + * in any run loop mode. See [NSRunLoop]. + */ +- (void) performSelector: (SEL)s + withObject: (id)arg + afterDelay: (NSTimeInterval)seconds; + +/** + * Sets given message to be sent to this instance after given delay, + * in given run loop modes. See [NSRunLoop]. + */ +- (void) performSelector: (SEL)s + withObject: (id)arg + afterDelay: (NSTimeInterval)seconds + inModes: (NSArray*)modes; +@end + +#if OS_API_VERSION(MAC_OS_X_VERSION_10_6, GS_API_LATEST) +/** + * The NSDiscardableContent protocol is used by objects which encapsulate data + * which may be discarded if resource constraints are exceeded. These + * constraints are typically, but not always, related memory. + */ +@protocol NSDiscardableContent + +/** + * This method is called before any access to the object. It returns YES if + * the object's content is still valid. The caller must call -endContentAccess + * once for every call to -beginContentAccess; + */ +- (BOOL) beginContentAccess; + +/** + * Discards the contents of the object if it is not currently being edited. + */ +- (void) discardContentIfPossible; + +/** + * This method indicates that the caller has finished accessing the contents of + * the object adopting this protocol. Every call to -beginContentAccess must + * be be paired with a call to this method after the caller has finished + * accessing the contents. + */ +- (void) endContentAccess; + +/** + * Returns YES if the contents of the object have been discarded, either via a + * call to -discardContentIfPossible while the object is not in use, or by some + * implementation dependent mechanism. + */ +- (BOOL) isContentDiscarded; +@end +#endif +#if defined(__cplusplus) +} +#endif + +#if !NO_GNUSTEP && !defined(GNUSTEP_BASE_INTERNAL) +#import "../GNUstepBase/NSObject+GNUstepBase.h" +#endif + +#endif /* __NSObject_h_GNUSTEP_BASE_INCLUDE */ diff --git a/gcc/testsuite/objc-obj-c++-shared/GNUStep/Foundation/NSRange.h b/gcc/testsuite/objc-obj-c++-shared/GNUStep/Foundation/NSRange.h new file mode 100644 index 00000000000..845d44ac2d5 --- /dev/null +++ b/gcc/testsuite/objc-obj-c++-shared/GNUStep/Foundation/NSRange.h @@ -0,0 +1,235 @@ +/* + * Copyright (C) 1995,1999 Free Software Foundation, Inc. + * + * Written by: Adam Fedor <fedor@boulder.colorado.edu> + * Date: 1995 + * + * This file is part of the GNUstep Base Library. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, 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 + * Library General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02111 USA. + */ + +#ifndef __NSRange_h_GNUSTEP_BASE_INCLUDE +#define __NSRange_h_GNUSTEP_BASE_INCLUDE +#import "../GNUstepBase/GSVersionMacros.h" + +/**** Included Headers *******************************************************/ + +#import "NSObject.h" + +#if defined(__cplusplus) +extern "C" { +#endif + +@class NSException; +@class NXConstantString; + +/**** Type, Constant, and Macro Definitions **********************************/ + +#ifndef MAX +#define MAX(a,b) \ + ({__typeof__(a) _MAX_a = (a); __typeof__(b) _MAX_b = (b); \ + _MAX_a > _MAX_b ? _MAX_a : _MAX_b; }) +#define GS_DEFINED_MAX +#endif + +#ifndef MIN +#define MIN(a,b) \ + ({__typeof__(a) _MIN_a = (a); __typeof__(b) _MIN_b = (b); \ + _MIN_a < _MIN_b ? _MIN_a : _MIN_b; }) +#define GS_DEFINED_MIN +#endif + +/** + * <example> +{ + NSUInteger location; + NSUInteger length; +}</example> + * <p> + * The NSRange type is used to specify ranges of locations, + * typically items in an array, characters in a string, and bytes + * in a data object. + * </p> + * <p> + * As 'boundary' or 'fencepost' errors are a particularly common + * problem in programming, it is important that you understand + * how an NSRange works. + * </p> + * <p> + * An NSRange consists of a <em>location</em> and a <em>length</em>. The + * points that are considered to lie in a range are the integers from + * the location to the location plus the length, so the number + * of points in a range is the length of the range plus one.<br /> + * However, if you consider these points like the marks on a + * ruler, you can only store information <strong>between</strong> + * points. So the number of items that can be stored in a range + * is the length of the range. + * </p> + */ +typedef struct _NSRange NSRange; +struct _NSRange +{ + NSUInteger location; + NSUInteger length; +}; + +#if OS_API_VERSION(GS_API_MACOSX, GS_API_LATEST) +/** Pointer to an NSRange structure. */ +typedef NSRange *NSRangePointer; +#endif + +/**** Function Prototypes ****************************************************/ + +/* + * All but the most complex functions are declared static inline in this + * header file so that they are maximally efficient. In order to provide + * true functions (for code modules that don't have this header) this + * header is included in NSRange.m where the functions are no longer + * declared inline. + */ +#ifdef IN_NSRANGE_M +#define GS_RANGE_SCOPE extern +#define GS_RANGE_ATTR +#else +#define GS_RANGE_SCOPE static inline +#define GS_RANGE_ATTR __attribute__((unused)) +#endif + +GS_RANGE_SCOPE NSUInteger +NSMaxRange(NSRange range) GS_RANGE_ATTR; + +/** Returns top end of range (location + length). */ +GS_RANGE_SCOPE NSUInteger +NSMaxRange(NSRange range) +{ + return range.location + range.length; +} + +GS_RANGE_SCOPE BOOL +NSLocationInRange(NSUInteger location, NSRange range) GS_RANGE_ATTR; + +/** Returns whether location is greater than or equal to range's location + * and less than its max. + */ +GS_RANGE_SCOPE BOOL +NSLocationInRange(NSUInteger location, NSRange range) +{ + return (location >= range.location) && (location < NSMaxRange(range)); +} + +/** Convenience method for raising an NSRangeException. */ +GS_EXPORT void _NSRangeExceptionRaise (void); +/* NB: The implementation of _NSRangeExceptionRaise is: + [NSException raise: NSRangeException + format: @"Range location + length too great"]; + + _NSRangeExceptionRaise is defined in NSRange.m so that this + file (NSRange.h) can be included without problems in the + implementation of the base classes themselves. */ + +GS_RANGE_SCOPE NSRange +NSMakeRange(NSUInteger location, NSUInteger length) GS_RANGE_ATTR; + +/** Creates new range starting at location and of given length. */ +GS_RANGE_SCOPE NSRange +NSMakeRange(NSUInteger location, NSUInteger length) +{ + NSRange range; + NSUInteger end = location + length; + + if (end < location || end < length) + { + _NSRangeExceptionRaise (); + } + range.location = location; + range.length = length; + return range; +} + +GS_RANGE_SCOPE BOOL +NSEqualRanges(NSRange range1, NSRange range2) GS_RANGE_ATTR; + +/** Returns whether range1 and range2 have same location and length. */ +GS_RANGE_SCOPE BOOL +NSEqualRanges(NSRange range1, NSRange range2) +{ + return ((range1.location == range2.location) + && (range1.length == range2.length)); +} + +GS_RANGE_SCOPE NSRange +NSUnionRange(NSRange range1, NSRange range2) GS_RANGE_ATTR; + +/** Returns range going from minimum of aRange's and bRange's locations to + maximum of their two max's. */ +GS_RANGE_SCOPE NSRange +NSUnionRange(NSRange aRange, NSRange bRange) +{ + NSRange range; + + range.location = MIN(aRange.location, bRange.location); + range.length = MAX(NSMaxRange(aRange), NSMaxRange(bRange)) + - range.location; + return range; +} + +GS_RANGE_SCOPE NSRange +NSIntersectionRange(NSRange range1, NSRange range2) GS_RANGE_ATTR; + +/** Returns range containing indices existing in both aRange and bRange. If + * the returned length is 0, the location is undefined and should be ignored. + */ +GS_RANGE_SCOPE NSRange +NSIntersectionRange (NSRange aRange, NSRange bRange) +{ + NSRange range; + + if (NSMaxRange(aRange) < bRange.location + || NSMaxRange(bRange) < aRange.location) + return NSMakeRange(0, 0); + + range.location = MAX(aRange.location, bRange.location); + range.length = MIN(NSMaxRange(aRange), NSMaxRange(bRange)) + - range.location; + return range; +} + + +@class NSString; + +/** Returns string of form {location=a, length=b}. */ +GS_EXPORT NSString *NSStringFromRange(NSRange range); + +/** Parses range from string of form {location=a, length=b}; returns range + with 0 location and length if this fails. */ +GS_EXPORT NSRange NSRangeFromString(NSString *aString); + +#ifdef GS_DEFINED_MAX +#undef GS_DEFINED_MAX +#undef MAX +#endif + +#ifdef GS_DEFINED_MIN +#undef GS_DEFINED_MIN +#undef MIN +#endif + +#if defined(__cplusplus) +} +#endif + +#endif /* __NSRange_h_GNUSTEP_BASE_INCLUDE */ diff --git a/gcc/testsuite/objc-obj-c++-shared/GNUStep/Foundation/NSString.h b/gcc/testsuite/objc-obj-c++-shared/GNUStep/Foundation/NSString.h new file mode 100644 index 00000000000..7863d9404f9 --- /dev/null +++ b/gcc/testsuite/objc-obj-c++-shared/GNUStep/Foundation/NSString.h @@ -0,0 +1,977 @@ +/* Interface for NSString for GNUstep + Copyright (C) 1995, 1996, 1999 Free Software Foundation, Inc. + + Written by: Andrew Kachites McCallum <mccallum@gnu.ai.mit.edu> + Date: 1995 + + This file is part of the GNUstep Base Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, 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 + Library General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02111 USA. + */ + +/** +<chapter> + <heading>Portable path handling</heading> + <p>Portable path handling (across both unix-like and mswindows operating + systems) requires some care. A modern operating system uses the concept + of a single root to the filesystem, but mswindows has multiple filesystems + with no common root, so code must be aware of this. There is also the + more minor issue that windows often uses a backslash as a separator between + the components of a path and unix-like systems always use forward slash.<br /> + On windows there is also the issue that two styles of path are used, + most commonly with a drive letter and a path on that drive + (eg. 'C:\directory\file') but also UNC paths + (eg. '//host/share/directory/file') so path handling functions must deal + with both formats. + </p> + <p>GNUstep has three path handling modes, 'gnustep', 'unix', and 'windows'. + The mode defaults to 'gnustep' but may be set using the GSPathHandling() + function.<br /> + You should probably stick to using the default 'gnustep' mode in which the + path handling methods cope with both 'unix' and 'windows' style paths in + portable and tolerant manner:<br /> + Paths are read in literally so they can be in the native format provided + by the operating system or in a non-native format. See + [NSFileManager-stringWithFileSystemRepresentation:length:].<br /> + Paths are written out using the native format of the system the application + is running on (eg on windows slashes are converted to backslashes). + See [NSFileManager-fileSystemRepresentationWithPath:].<br /> + The path handling methods accept either a forward or backward slash as a + path separator when parsing any path.<br /> + Unless operating in 'unix' mode, a leading letter followed by a colon is + considered the start of a windows style path (the drive specifier), and a + path beginning with something of the form '//host/share/' is considered + the start of a UNC style path.<br /> + The path handling methods add forward slashes when building new paths + internally or when standardising paths, so those path strings provide + a portable representation (as long as they are relative paths, not including + system specific roots).<br /> + An important case to note is that on windows a path which looks at first + glance like an absolute path may actually be a relative one.<br /> + 'C:file' is a relative path because it specifies a file on the C drive + but does not say what directory it is in.<br /> +Similarly, '/dir/file' is a relative path because it specifies the full +location fo a file on a drive, but does not specify which drive it is on. + </p> +<p>As a consequence of this path handling, you are able to work completely +portably using relative paths (adding components, extensions and +relative paths to a pth, or removing components, extensions and relative +paths from a path etc), and when you save paths as strings in files +which may be transferred to another platform, you should save a relative +path.<br /> +When you need to know absolute paths of various points in the filesystem, +you can use various path utility functions to obtain those absolute paths. +For instance, instead of saving an absolute path to a file, you might want +to save a path relative to a user's home directory. You could do that by +calling NSHomeDirectory() to get the home directory, and only saving the +part of the full path after that prefix. +</p> +</chapter> + */ + +#ifndef __NSString_h_GNUSTEP_BASE_INCLUDE +#define __NSString_h_GNUSTEP_BASE_INCLUDE +#import "../GNUstepBase/GSVersionMacros.h" + +#import "NSObject.h" +#import "NSRange.h" + +#if defined(__cplusplus) +extern "C" { +#endif + +/** + * Type for representing unicode characters. (16-bit) + */ +typedef uint16_t unichar; + +#if OS_API_VERSION(MAC_OS_X_VERSION_10_5,GS_API_LATEST) +#define NSMaximumStringLength (INT_MAX-1) +#endif + +@class NSArray; +@class NSCharacterSet; +@class NSData; +@class NSDictionary; +#if OS_API_VERSION(GS_API_MACOSX, GS_API_LATEST) +@class NSError; +@class NSLocale; +@class NSURL; +#endif + +#define NSMaximumStringLength (INT_MAX-1) + +enum +{ + NSCaseInsensitiveSearch = 1, + NSLiteralSearch = 2, + NSBackwardsSearch = 4, + NSAnchoredSearch = 8, + NSNumericSearch = 64 /* MacOS-X 10.2 */ +#if OS_API_VERSION(MAC_OS_X_VERSION_10_5,GS_API_LATEST) + , + NSDiacriticInsensitiveSearch = 128, + NSWidthInsensitiveSearch = 256, + NSForcedOrderingSearch = 512 +#endif +#if OS_API_VERSION(MAC_OS_X_VERSION_10_7,GS_API_LATEST) + , + /** + * Treats the search string as a regular expression. This option may be + * combined with NSCaseInsensitiveSearch and NSAnchoredSearch, but no other + * search options. + * + * This option may only be used with the -rangeOfString: family of methods. + */ + NSRegularExpressionSearch = 1024 +#endif +}; +typedef NSUInteger NSStringCompareOptions; + +/** + * <p>Enumeration of available encodings for converting between bytes and + * characters (in [NSString]s). The ones that are shared with OpenStep and + * Cocoa are: <code>NSASCIIStringEncoding, NSNEXTSTEPStringEncoding, + * NSJapaneseEUCStringEncoding, NSUTF8StringEncoding, + * NSISOLatin1StringEncoding, NSSymbolStringEncoding, + * NSNonLossyASCIIStringEncoding, NSShiftJISStringEncoding, + * NSISOLatin2StringEncoding, NSUnicodeStringEncoding, + * NSWindowsCP1251StringEncoding, NSWindowsCP1252StringEncoding, + * NSWindowsCP1253StringEncoding, NSWindowsCP1254StringEncoding, + * NSWindowsCP1250StringEncoding, NSISO2022JPStringEncoding, + * NSMacOSRomanStringEncoding, NSProprietaryStringEncoding</code>.</p> + * + * <p>Additional encodings available under GNUstep are: + * <code>NSKOI8RStringEncoding, NSISOLatin3StringEncoding, + * NSISOLatin4StringEncoding, NSISOCyrillicStringEncoding, + * NSISOArabicStringEncoding, NSISOGreekStringEncoding, + * NSISOHebrewStringEncoding, NSISOLatin5StringEncoding, + * NSISOLatin6StringEncoding, NSISOThaiStringEncoding, + * NSISOLatin7StringEncoding, NSISOLatin8StringEncoding, + * NSISOLatin9StringEncoding, NSGB2312StringEncoding, NSUTF7StringEncoding, + * NSGSM0338StringEncoding, NSBIG5StringEncoding, + * NSKoreanEUCStringEncoding</code>.</p> + */ +typedef enum _NSStringEncoding +{ +/* NB. Must not have an encoding with value zero - so we can use zero to + tell that a variable that should contain an encoding has not yet been + initialised */ + GSUndefinedEncoding = 0, + NSASCIIStringEncoding = 1, + NSNEXTSTEPStringEncoding = 2, + NSJapaneseEUCStringEncoding = 3, + NSUTF8StringEncoding = 4, + NSISOLatin1StringEncoding = 5, // ISO-8859-1; West European + NSSymbolStringEncoding = 6, + NSNonLossyASCIIStringEncoding = 7, + NSShiftJISStringEncoding = 8, + NSISOLatin2StringEncoding = 9, // ISO-8859-2; East European + NSUnicodeStringEncoding = 10, + NSUTF16StringEncoding = NSUnicodeStringEncoding, // An alias + NSWindowsCP1251StringEncoding = 11, + NSWindowsCP1252StringEncoding = 12, // WinLatin1 + NSWindowsCP1253StringEncoding = 13, // Greek + NSWindowsCP1254StringEncoding = 14, // Turkish + NSWindowsCP1250StringEncoding = 15, // WinLatin2 + NSISO2022JPStringEncoding = 21, + NSMacOSRomanStringEncoding = 30, + NSProprietaryStringEncoding = 31, + + NSKOI8RStringEncoding = 50, // Russian/Cyrillic + NSISOLatin3StringEncoding = 51, // ISO-8859-3; South European + NSISOLatin4StringEncoding = 52, // ISO-8859-4; North European + NSISOCyrillicStringEncoding = 22, // ISO-8859-5 + NSISOArabicStringEncoding = 53, // ISO-8859-6 + NSISOGreekStringEncoding = 54, // ISO-8859-7 + NSISOHebrewStringEncoding = 55, // ISO-8859-8 + NSISOLatin5StringEncoding = 57, // ISO-8859-9; Turkish + NSISOLatin6StringEncoding = 58, // ISO-8859-10; Nordic + NSISOThaiStringEncoding = 59, // ISO-8859-11 +/* Possible future ISO-8859 additions + // ISO-8859-12 +*/ + NSISOLatin7StringEncoding = 61, // ISO-8859-13 + NSISOLatin8StringEncoding = 62, // ISO-8859-14 + NSISOLatin9StringEncoding = 63, // ISO-8859-15; Replaces ISOLatin1 + NSGB2312StringEncoding = 56, + NSUTF7StringEncoding = 64, // RFC 2152 + NSGSM0338StringEncoding, // GSM (mobile phone) default alphabet + NSBIG5StringEncoding, // Traditional chinese + NSKoreanEUCStringEncoding // Korean + +#if OS_API_VERSION(MAC_OS_X_VERSION_10_4,GS_API_LATEST) + , + NSUTF16BigEndianStringEncoding = 0x90000100, + NSUTF16LittleEndianStringEncoding = 0x94000100, + NSUTF32StringEncoding = 0x8c000100, + NSUTF32BigEndianStringEncoding = 0x98000100, + NSUTF32LittleEndianStringEncoding = 0x9c000100 +#endif +} NSStringEncoding; + +enum { + NSOpenStepUnicodeReservedBase = 0xF400 +}; + +#if OS_API_VERSION(MAC_OS_X_VERSION_10_4,GS_API_LATEST) +enum { + NSStringEncodingConversionAllowLossy = 1, + NSStringEncodingConversionExternalRepresentation = 2 +}; +typedef NSUInteger NSStringEncodingConversionOptions; +#endif + +/** + * <p> + * <code>NSString</code> objects represent an immutable string of Unicode 3.0 + * characters. These may be accessed individually as type + * <code>unichar</code>, an unsigned short.<br/> + * The [NSMutableString] subclass represents a modifiable string. Both are + * implemented as part of a class cluster and the instances you receive may + * actually be of unspecified concrete subclasses. + * </p> + * <p> + * A constant <code>NSString</code> can be created using the following syntax: + * <code>@"..."</code>, where the contents of the quotes are the + * string, using only ASCII characters. + * </p> + * <p> + * A variable string can be created using a C printf-like <em>format</em>, + * as in <code>[NSString stringWithFormat: @"Total is %f", t]</code>. + * </p> + * <p> + * To create a concrete subclass of <code>NSString</code>, you must have your + * class inherit from <code>NSString</code> and override at least the two + * primitive methods - -length and -characterAtIndex: + * </p> + * <p> + * In general the rule is that your subclass must override any + * initialiser that you want to use with it. The GNUstep + * implementation relaxes that to say that, you may override + * only the <em>designated initialiser</em> and the other + * initialisation methods should work. + * </p> + * <p> + * Where an NSString instance method returns an NSString object, + * the class of the actual object returned may be any subclass + * of NSString. The actual value returned may be a new + * autoreleased object, an autoreleased copy of the receiver, + * or the receiver itsself. While the abstract base class + * implementations of methods (other than initialisers) will + * avoid returning mutable strings by returning an autoreleased + * copy of a mutable receiver, concrete subclasses may behave + * differently, so code should not rely upon the mutability of + * returned strings nor upon their lifetime being greater than + * that of the receiver which returned them. + * </p> + */ +@interface NSString :NSObject <NSCoding, NSCopying, NSMutableCopying> + ++ (id) string; ++ (id) stringWithCharacters: (const unichar*)chars + length: (NSUInteger)length; +#if OS_API_VERSION(MAC_OS_X_VERSION_10_4,GS_API_LATEST) && GS_API_VERSION( 10200,GS_API_LATEST) ++ (id) stringWithCString: (const char*)byteString + encoding: (NSStringEncoding)encoding; +#endif ++ (id) stringWithCString: (const char*)byteString + length: (NSUInteger)length; ++ (id) stringWithCString: (const char*)byteString; ++ (id) stringWithFormat: (NSString*)format, ... NS_FORMAT_FUNCTION(1,2); ++ (id) stringWithContentsOfFile:(NSString *)path; + +// Initializing Newly Allocated Strings +- (id) init; +#if OS_API_VERSION(MAC_OS_X_VERSION_10_4,GS_API_LATEST) && GS_API_VERSION( 10200,GS_API_LATEST) +- (id) initWithBytes: (const void*)bytes + length: (NSUInteger)length + encoding: (NSStringEncoding)encoding; +- (id) initWithBytesNoCopy: (void*)bytes + length: (NSUInteger)length + encoding: (NSStringEncoding)encoding + freeWhenDone: (BOOL)flag; +#endif +#if OS_API_VERSION(MAC_OS_X_VERSION_10_4,GS_API_LATEST) ++ (id) stringWithContentsOfFile: (NSString*)path + usedEncoding: (NSStringEncoding*)enc + error: (NSError**)error; +- (id) initWithContentsOfFile: (NSString*)path + usedEncoding: (NSStringEncoding*)enc + error: (NSError**)error; ++ (id) stringWithContentsOfFile: (NSString*)path + encoding: (NSStringEncoding)enc + error: (NSError**)error; +- (id) initWithContentsOfFile: (NSString*)path + encoding: (NSStringEncoding)enc + error: (NSError**)error; ++ (id) stringWithContentsOfURL: (NSURL*)url + usedEncoding: (NSStringEncoding*)enc + error: (NSError**)error; +- (id) initWithContentsOfURL: (NSURL*)url + usedEncoding: (NSStringEncoding*)enc + error: (NSError**)error; ++ (id) stringWithContentsOfURL: (NSURL*)url + encoding: (NSStringEncoding)enc + error: (NSError**)error; +- (id) initWithContentsOfURL: (NSURL*)url + encoding: (NSStringEncoding)enc + error: (NSError**)error; +- (BOOL) writeToFile: (NSString*)path + atomically: (BOOL)atomically + encoding: (NSStringEncoding)enc + error: (NSError**)error; +- (BOOL) writeToURL: (NSURL*)url + atomically: (BOOL)atomically + encoding: (NSStringEncoding)enc + error: (NSError**)error; +#endif +#if OS_API_VERSION(MAC_OS_X_VERSION_10_5,GS_API_LATEST) +- (NSString*)stringByReplacingOccurrencesOfString: (NSString*)replace + withString: (NSString*)by + options: (NSStringCompareOptions)opts + range: (NSRange)searchRange; +- (NSString*)stringByReplacingOccurrencesOfString: (NSString*)replace + withString: (NSString*)by; +- (NSString*) stringByReplacingCharactersInRange: (NSRange)aRange + withString: (NSString*)by; +#endif +- (id) initWithCharactersNoCopy: (unichar*)chars + length: (NSUInteger)length + freeWhenDone: (BOOL)flag; +- (id) initWithCharacters: (const unichar*)chars + length: (NSUInteger)length; +- (id) initWithCStringNoCopy: (char*)byteString + length: (NSUInteger)length + freeWhenDone: (BOOL)flag; +- (id) initWithCString: (const char*)byteString + length: (NSUInteger)length; +- (id) initWithCString: (const char*)byteString; +- (id) initWithString: (NSString*)string; +- (id) initWithFormat: (NSString*)format, ... NS_FORMAT_FUNCTION(1,2); +- (id) initWithFormat: (NSString*)format + arguments: (va_list)argList NS_FORMAT_FUNCTION(1,0); +- (id) initWithData: (NSData*)data + encoding: (NSStringEncoding)encoding; +- (id) initWithContentsOfFile: (NSString*)path; + +// Getting a String's Length +- (NSUInteger) length; + +// Accessing Characters +- (unichar) characterAtIndex: (NSUInteger)index; +- (void) getCharacters: (unichar*)buffer; +- (void) getCharacters: (unichar*)buffer + range: (NSRange)aRange; + +// Combining Strings +- (NSString*) stringByAppendingFormat: (NSString*)format, ... + NS_FORMAT_FUNCTION(1,2); +- (NSString*) stringByAppendingString: (NSString*)aString; + +// Dividing Strings into Substrings +- (NSArray*) componentsSeparatedByString: (NSString*)separator; +- (NSString*) substringFromIndex: (NSUInteger)index; +- (NSString*) substringToIndex: (NSUInteger)index; + +// Finding Ranges of Characters and Substrings +- (NSRange) rangeOfCharacterFromSet: (NSCharacterSet*)aSet; +- (NSRange) rangeOfCharacterFromSet: (NSCharacterSet*)aSet + options: (NSUInteger)mask; +- (NSRange) rangeOfCharacterFromSet: (NSCharacterSet*)aSet + options: (NSUInteger)mask + range: (NSRange)aRange; +- (NSRange) rangeOfString: (NSString*)string; +- (NSRange) rangeOfString: (NSString*)string + options: (NSUInteger)mask; +- (NSRange) rangeOfString: (NSString*)aString + options: (NSUInteger)mask + range: (NSRange)aRange; + +// Determining Composed Character Sequences +- (NSRange) rangeOfComposedCharacterSequenceAtIndex: (NSUInteger)anIndex; + +#if OS_API_VERSION(MAC_OS_X_VERSION_10_2,GS_API_LATEST) +/** Returns a copy of the receiver normalised using the KD form. + */ +- (NSString *) decomposedStringWithCompatibilityMapping; + +/** Returns a copy of the receiver normalised using the D form. + */ +- (NSString *) decomposedStringWithCanonicalMapping; + +/** Returns a copy of the receiver normalised using the KC form. + */ +- (NSString *) precomposedStringWithCompatibilityMapping; + +/** Returns a copy of the receiver normalised using the C form. + */ +- (NSString *) precomposedStringWithCanonicalMapping; +#endif + +// Converting String Contents into a Property List +- (id) propertyList; +- (NSDictionary*) propertyListFromStringsFileFormat; + +// Identifying and Comparing Strings +- (NSComparisonResult) compare: (NSString*)aString; +- (NSComparisonResult) compare: (NSString*)aString + options: (NSUInteger)mask; +- (NSComparisonResult) compare: (NSString*)aString + options: (NSUInteger)mask + range: (NSRange)aRange; +- (BOOL) hasPrefix: (NSString*)aString; +- (BOOL) hasSuffix: (NSString*)aString; +- (BOOL) isEqual: (id)anObject; +- (BOOL) isEqualToString: (NSString*)aString; +- (NSUInteger) hash; + +// Getting a Shared Prefix +- (NSString*) commonPrefixWithString: (NSString*)aString + options: (NSUInteger)mask; + +// Changing Case +- (NSString*) capitalizedString; +- (NSString*) lowercaseString; +- (NSString*) uppercaseString; + +// Getting C Strings +- (const char*) cString; +#if OS_API_VERSION(GS_API_MACOSX, GS_API_LATEST) + +#if OS_API_VERSION(MAC_OS_X_VERSION_10_4,GS_API_LATEST) && GS_API_VERSION( 10200,GS_API_LATEST) +- (const char*) cStringUsingEncoding: (NSStringEncoding)encoding; +- (BOOL) getCString: (char*)buffer + maxLength: (NSUInteger)maxLength + encoding: (NSStringEncoding)encoding; +- (id) initWithCString: (const char*)byteString + encoding: (NSStringEncoding)encoding; +- (NSUInteger) lengthOfBytesUsingEncoding: (NSStringEncoding)encoding; +- (NSUInteger) maximumLengthOfBytesUsingEncoding: (NSStringEncoding)encoding; +#endif + +#endif +- (NSUInteger) cStringLength; +- (void) getCString: (char*)buffer; +- (void) getCString: (char*)buffer + maxLength: (NSUInteger)maxLength; +- (void) getCString: (char*)buffer + maxLength: (NSUInteger)maxLength + range: (NSRange)aRange + remainingRange: (NSRange*)leftoverRange; + +// Getting Numeric Values +- (float) floatValue; +- (int) intValue; + +// Working With Encodings +- (BOOL) canBeConvertedToEncoding: (NSStringEncoding)encoding; +- (NSData*) dataUsingEncoding: (NSStringEncoding)encoding; +- (NSData*) dataUsingEncoding: (NSStringEncoding)encoding + allowLossyConversion: (BOOL)flag; ++ (NSStringEncoding) defaultCStringEncoding; +- (NSString*) description; +- (NSStringEncoding) fastestEncoding; +- (NSStringEncoding) smallestEncoding; + +/** + * Attempts to complete this string as a path in the filesystem by finding + * a unique completion if one exists and returning it by reference in + * outputName (which must be a non-nil pointer), or if it finds a set of + * completions they are returned by reference in outputArray, if it is non-nil. + * filterTypes can be an array of strings specifying extensions to consider; + * files without these extensions will be ignored and will not constitute + * completions. Returns 0 if no match found, else a positive number that is + * only accurate if outputArray was non-nil. + */ +- (NSUInteger) completePathIntoString: (NSString**)outputName + caseSensitive: (BOOL)flag + matchesIntoArray: (NSArray**)outputArray + filterTypes: (NSArray*)filterTypes; + +/** + * Converts the receiver to a C string path expressed in the character + * encoding appropriate for the local host file system. This string will be + * automatically freed soon after it is returned, so copy it if you need it + * for long.<br /> + * NB. On mingw32 systems the filesystem representation of a path is a 16-bit + * unicode character string, so you should only pass the value returned by + * this method to functions expecting wide characters.<br /> + * This method uses [NSFileManager-fileSystemRepresentationWithPath:] to + * perform the conversion. + */ +- (const GSNativeChar*) fileSystemRepresentation; + +/** + * Converts the receiver to a C string path using the character encoding + * appropriate to the local file system. This string will be stored + * into buffer if it is shorter (number of characters) than size, + * otherwise NO is returned.<br /> + * NB. On mingw32 systems the filesystem representation of a path is a 16-bit + * unicode character string, so the buffer you pass to this method must be + * twice as many bytes as the size (number of characters) you expect to + * receive.<br /> + * This method uses [NSFileManager-fileSystemRepresentationWithPath:] to + * perform the conversion. + */ +- (BOOL) getFileSystemRepresentation: (GSNativeChar*)buffer + maxLength: (NSUInteger)size; + +/** + * Returns a string containing the last path component of the receiver.<br /> + * The path component is the last non-empty substring delimited by the ends + * of the string, or by path separator characters.<br /> + * If the receiver only contains a root part, this method returns it.<br /> + * If there are no non-empty substrings, this returns an empty string.<br /> + * NB. In a windows UNC path, the host and share specification is treated as + * a single path component, even though it contains separators. + * So a string of the form '//host/share' may be returned.<br /> + * Other special cases are apply when the string is the root. + * <example> + * @"foo/bar" produces @"bar" + * @"foo/bar/" produces @"bar" + * @"/foo/bar" produces @"bar" + * @"/foo" produces @"foo" + * @"/" produces @"/" (root is a special case) + * @"" produces @"" + * @"C:/" produces @"C:/" (root is a special case) + * @"C:" produces @"C:" + * @"//host/share/" produces @"//host/share/" (root is a special case) + * @"//host/share" produces @"//host/share" + * </example> + */ +- (NSString*) lastPathComponent; + +/** + * Returns a new string containing the path extension of the receiver.<br /> + * The path extension is a suffix on the last path component which starts + * with the extension separator (a '.') (for example .tiff is the + * pathExtension for /foo/bar.tiff).<br /> + * Returns an empty string if no such extension exists. + * <example> + * @"a.b" produces @"b" + * @"a.b/" produces @"b" + * @"/path/a.ext" produces @"ext" + * @"/path/a." produces @"" + * @"/path/.a" produces @"" (.a is not an extension to a file) + * @".a" produces @"" (.a is not an extension to a file) + * </example> + */ +- (NSString*) pathExtension; + +/** + * Returns a string where a prefix of the current user's home directory is + * abbreviated by '~', or returns the receiver (or an immutable copy) if + * it was not found to have the home directory as a prefix. + */ +- (NSString*) stringByAbbreviatingWithTildeInPath; + +/** + * Returns a new string with the path component given in aString + * appended to the receiver.<br /> + * This removes trailing path separators from the receiver and the root + * part from aString and replaces them with a single slash as a path + * separator.<br /> + * Also condenses any multiple separator sequences in the result into + * single path separators. + * <example> + * @"" with @"file" produces @"file" + * @"path" with @"file" produces @"path/file" + * @"/" with @"file" produces @"/file" + * @"/" with @"file" produces @"/file" + * @"/" with @"/file" produces @"/file" + * @"path with @"C:/file" produces @"path/file" + * </example> + * NB. Do not use this method to modify strings other than filesystem + * paths as the behavior in such cases is undefined ... for instance + * the string may have repeated slashes or slash-dot-slash sequences + * removed. + */ +- (NSString*) stringByAppendingPathComponent: (NSString*)aString; + +/** + * Returns a new string with the path extension given in aString + * appended to the receiver after an extensionSeparator ('.').<br /> + * If the receiver has trailing path separator characters, they are + * stripped before the extension separator is added.<br /> + * If the receiver contains no components after the root, the extension + * cannot be appended (an extension can only be appended to a file name), + * so a copy of the unmodified receiver is returned.<br /> + * An empty string may be used as an extension ... in which case the extension + * separator is appended.<br /> + * This behavior mirrors that of the -stringByDeletingPathExtension method. + * <example> + * @"Mail" with @"app" produces @"Mail.app" + * @"Mail.app" with @"old" produces @"Mail.app.old" + * @"file" with @"" produces @"file." + * @"/" with @"app" produces @"/" (no file name to append to) + * @"" with @"app" produces @"" (no file name to append to) + * </example> + * NB. Do not use this method to modify strings other than filesystem + * paths as the behavior in such cases is undefined ... for instance + * the string may have repeated slashes or slash-dot-slash sequences + * removed. + */ +- (NSString*) stringByAppendingPathExtension: (NSString*)aString; + +/** + * Returns a new string with the last path component (including any final + * path separators) removed from the receiver.<br /> + * A string without a path component other than the root is returned + * without alteration.<br /> + * See -lastPathComponent for a definition of a path component. + * <example> + * @"hello/there" produces @"hello" (a relative path) + * @"hello" produces @"" (a relative path) + * @"/hello" produces @"/" (an absolute unix path) + * @"/" produces @"/" (an absolute unix path) + * @"C:file" produces @"C:" (a relative windows path) + * @"C:" produces @"C:" (a relative windows path) + * @"C:/file" produces @"C:/" (an absolute windows path) + * @"C:/" produces @"C:/" (an absolute windows path) + * @"//host/share/file" produces @"//host/share/" (a UNC path) + * @"//host/share/" produces @"//host/share/" (a UNC path) + * @"//path/file" produces @"//path" (an absolute Unix path) + * </example> + * NB. Do not use this method to modify strings other than filesystem + * paths as the behavior in such cases is undefined ... for instance + * the string may have repeated slashes or slash-dot-slash sequences + * removed. + */ +- (NSString*) stringByDeletingLastPathComponent; + +/** + * Returns a new string with the path extension removed from the receiver.<br /> + * Strips any trailing path separators before checking for the extension + * separator.<br /> + * NB. This method does not consider a string which contains nothing + * between the root part and the extension separator ('.') to be a path + * extension. This mirrors the behavior of the -stringByAppendingPathExtension: + * method. + * <example> + * @"file.ext" produces @"file" + * @"/file.ext" produces @"/file" + * @"/file.ext/" produces @"/file" (trailing path separators are ignored) + * @"/file..ext" produces @"/file." + * @"/file." produces @"/file" + * @"/.ext" produces @"/.ext" (there is no file to strip from) + * @".ext" produces @".ext" (there is no file to strip from) + * </example> + * NB. Do not use this method to modify strings other than filesystem + * paths as the behavior in such cases is undefined ... for instance + * the string may have repeated slashes or slash-dot-slash sequences + * removed. + */ +- (NSString*) stringByDeletingPathExtension; + +/** + * Returns a string created by expanding the initial tilde ('~') and any + * following username to be the home directory of the current user or the + * named user.<br /> + * Returns the receiver or an immutable copy if it was not possible to + * expand it. + */ +- (NSString*) stringByExpandingTildeInPath; + +/** + * First calls -stringByExpandingTildeInPath if necessary.<br /> + * Replaces path string by one in which path components representing symbolic + * links have been replaced by their referents.<br /> + * Removes a leading '/private' if the result is valid.<br /> + * If links cannot be resolved, returns an unmodified copy of the receiver. + */ +- (NSString*) stringByResolvingSymlinksInPath; + +/** + * Returns a standardised form of the receiver, with unnecessary parts + * removed, tilde characters expanded, and symbolic links resolved + * where possible.<br /> + * NB. Refers to the local filesystem to resolve symbolic links in + * absolute paths, and to expand tildes ... so this can't be used for + * general path manipulation.<br /> + * If the string is an invalid path, the unmodified receiver is returned.<br /> + * <p> + * Uses -stringByExpandingTildeInPath to expand tilde expressions.<br /> + * Simplifies '//' and '/./' sequences and removes trailing '/' or '.'.<br /> + * </p> + * <p> + * For absolute paths, uses -stringByResolvingSymlinksInPath to resolve + * any links, then gets rid of '/../' sequences and removes any '/private' + * prefix. + * </p> + */ +- (NSString*) stringByStandardizingPath; + + +// for methods working with decomposed strings +- (int) _baseLength; + +#if OS_API_VERSION(GS_API_MACOSX, GS_API_LATEST) +/** + * Concatenates the path components in the array and returns the result.<br /> + * This method does not remove empty path components, but does recognize an + * empty initial component as a special case meaning that the string + * returned will begin with a slash. + */ ++ (NSString*) pathWithComponents: (NSArray*)components; + +/** + * Returns YES if the receiver represents an absolute path ...<br /> + * Returns NO otherwise.<br /> + * An absolute path in unix mode is one which begins + * with a slash or tilde.<br /> + * In windows mode a drive specification (eg C:) followed by a slash or + * backslash, is an absolute path, as is any path beginning with a tilde.<br /> + * In any mode a UNC path (//host/share...) is always absolute.<br /> + * In the default gnustep path handling mode, + * the rules are the same as for windows, + * except that a path whose root is a slash denotes an absolute path + * when running on unix and a relative path when running under windows. + */ +- (BOOL) isAbsolutePath; + +/** + * Returns the path components of the receiver separated into an array.<br /> + * If the receiver begins with a root sequence such as the path separator + * character (or a drive specification in windows) then that is used as the + * first element in the array.<br /> + * Empty components are removed.<br /> + * If a trailing path separator (which was not part of the root) was present, + * it is added as the last element in the array. + */ +- (NSArray*) pathComponents; + +/** + * Returns an array of strings made by appending the values in paths + * to the receiver. + */ +- (NSArray*) stringsByAppendingPaths: (NSArray*)paths; + ++ (NSString*) localizedStringWithFormat: (NSString*)format, ... + NS_FORMAT_FUNCTION(1,2); + ++ (id) stringWithString: (NSString*)aString; ++ (id) stringWithContentsOfURL: (NSURL*)url; ++ (id) stringWithUTF8String: (const char*)bytes; +- (id) initWithFormat: (NSString*)format + locale: (NSDictionary*)locale, ... NS_FORMAT_FUNCTION(1,3); +- (id) initWithFormat: (NSString*)format + locale: (NSDictionary*)locale + arguments: (va_list)argList NS_FORMAT_FUNCTION(1,0); +- (id) initWithUTF8String: (const char *)bytes; +- (id) initWithContentsOfURL: (NSURL*)url; +- (NSString*) substringWithRange: (NSRange)aRange; +- (NSComparisonResult) caseInsensitiveCompare: (NSString*)aString; +- (NSComparisonResult) compare: (NSString*)string + options: (NSUInteger)mask + range: (NSRange)compareRange + locale: (id)locale; +- (NSComparisonResult) localizedCompare: (NSString *)string; +- (NSComparisonResult) localizedCaseInsensitiveCompare: (NSString *)string; +- (BOOL) writeToFile: (NSString*)filename + atomically: (BOOL)useAuxiliaryFile; +- (BOOL) writeToURL: (NSURL*)url atomically: (BOOL)atomically; +- (double) doubleValue; ++ (NSStringEncoding*) availableStringEncodings; ++ (NSString*) localizedNameOfStringEncoding: (NSStringEncoding)encoding; +- (void) getLineStart: (NSUInteger *)startIndex + end: (NSUInteger *)lineEndIndex + contentsEnd: (NSUInteger *)contentsEndIndex + forRange: (NSRange)aRange; +- (NSRange) lineRangeForRange: (NSRange)aRange; +- (const char*) lossyCString; +- (NSString*) stringByAddingPercentEscapesUsingEncoding: (NSStringEncoding)e; +- (NSString*) stringByPaddingToLength: (NSUInteger)newLength + withString: (NSString*)padString + startingAtIndex: (NSUInteger)padIndex; +- (NSString*) stringByReplacingPercentEscapesUsingEncoding: (NSStringEncoding)e; +- (NSString*) stringByTrimmingCharactersInSet: (NSCharacterSet*)aSet; +- (const char *)UTF8String; +#endif + +#if OS_API_VERSION(MAC_OS_X_VERSION_10_9,GS_API_LATEST) +- (NSString *) stringByAddingPercentEncodingWithAllowedCharacters: (NSCharacterSet *)aSet; +- (NSString *) stringByRemovingPercentEncoding; +#endif + +#if OS_API_VERSION(MAC_OS_X_VERSION_10_3,GS_API_LATEST) +/** Not implemented */ +- (void) getParagraphStart: (NSUInteger *)startIndex + end: (NSUInteger *)parEndIndex + contentsEnd: (NSUInteger *)contentsEndIndex + forRange: (NSRange)range; +/** Not implemented */ + - (NSRange) paragraphRangeForRange: (NSRange)range; +#endif + +#if OS_API_VERSION(MAC_OS_X_VERSION_10_5,GS_API_LATEST) +/** + * Returns YES when scanning the receiver's text from left to right + * finds an initial digit in the range 1-9 or a letter in the set + * ('Y', 'y', 'T', 't').<br /> + * Any trailing characters are ignored.<br /> + * Any leading whitespace or zeros or signs are also ignored.<br /> + * Returns NO if the above conditions are not met. + */ +- (BOOL) boolValue; +- (NSArray *) componentsSeparatedByCharactersInSet: (NSCharacterSet *)separator; +- (NSInteger) integerValue; +- (long long) longLongValue; +/** Not implemented */ +- (NSRange) rangeOfComposedCharacterSequencesForRange: (NSRange)range; +/** Not implemented */ +- (NSRange) rangeOfString: (NSString *)aString + options: (NSStringCompareOptions)mask + range: (NSRange)searchRange + locale: (NSLocale *)locale; + +#endif + +#if OS_API_VERSION(MAC_OS_X_VERSION_10_10,GS_API_LATEST) + +/** + * Returns YES if the receiver contains string, otherwise, NO. + */ +- (BOOL) containsString: (NSString *)string; + +#endif + +#if OS_API_VERSION(GS_API_NONE, GS_API_NONE) ++ (Class) constantStringClass; +#endif /* GS_API_NONE */ + +@end + +@interface NSMutableString : NSString + +// Creating Temporary Strings ++ (id) string; ++ (id) stringWithCharacters: (const unichar*)characters + length: (NSUInteger)length; ++ (id) stringWithCString: (const char*)byteString + length: (NSUInteger)length; ++ (id) stringWithCString: (const char*)byteString; ++ (id) stringWithFormat: (NSString*)format, ... NS_FORMAT_FUNCTION(1,2); ++ (id) stringWithContentsOfFile: (NSString*)path; ++ (NSMutableString*) stringWithCapacity: (NSUInteger)capacity; + +// Initializing Newly Allocated Strings +- (id) initWithCapacity: (NSUInteger)capacity; + +// Modify A String +- (void) appendFormat: (NSString*)format, ... NS_FORMAT_FUNCTION(1,2); +- (void) appendString: (NSString*)aString; +- (void) deleteCharactersInRange: (NSRange)range; +- (void) insertString: (NSString*)aString atIndex: (NSUInteger)loc; +- (void) replaceCharactersInRange: (NSRange)range + withString: (NSString*)aString; +- (NSUInteger) replaceOccurrencesOfString: (NSString*)replace + withString: (NSString*)by + options: (NSUInteger)opts + range: (NSRange)searchRange; +- (void) setString: (NSString*)aString; + +@end + +#ifdef __OBJC_GNUSTEP_RUNTIME_ABI__ +# if __OBJC_GNUSTEP_RUNTIME_ABI__ >= 20 +# define GNUSTEP_NEW_STRING_ABI +# endif +#endif + +/** + * <p>The NXConstantString class is used to hold constant 8-bit character + * string objects produced by the compiler where it sees @"..." in the + * source. The compiler generates the instances of this class - which + * has three instance variables -</p> + * <list> + * <item>a pointer to the class (this is the sole ivar of NSObject)</item> + * <item>a pointer to the 8-bit data</item> + * <item>the length of the string</item> + * </list> + * <p>In older versions of the compiler, the isa variable is always set to + * the NXConstantString class. In newer versions a compiler option was + * added for GNUstep, to permit the isa variable to be set to another + * class, and GNUstep uses this to avoid conflicts with the default + * implementation of NXConstantString in the ObjC runtime library (the + * preprocessor is used to change all occurrences of NXConstantString + * in the source code to NSConstantString).</p> + * <p>Since GNUstep will generally use the GNUstep extension to the + * compiler, you should never refer to the constant string class by + * name, but should use the [NSString+constantStringClass] method to + * get the actual class being used for constant strings.</p> + * What follows is a dummy declaration of the class to keep the compiler + * happy. + */ +@interface NXConstantString : NSString +{ +@public +#ifdef GNUSTEP_NEW_STRING_ABI + /** + * Flags. The low 16 bits are reserved for the compiler, the top 16 for use + * by the Foundation Framework. Currently only the low 2 bits are used, to + * indicate the encoding of the string, with the following values: + * + * 0. ASCII (UTF-8 using only 7-bit characters) + * 1. UTF-8 + * 2. UTF-16 + * 3. UTF-32 + * + */ + uint32_t flags; + /** + * The number of characters (UTF-16 code units) in the string. + */ + uint32_t nxcslen; + /** + * The number of bytes in the string. For fixed-length encodings, this is a + * fixed multiple of nxcslen, but for UTF-8 it can be different. + */ + uint32_t size; + /** + * Hash value. + */ + uint32_t hash; + /** + * Pointer to the byte data of the string. Note that `char*` is the correct + * type only if the low two bits of the flags indicate that this is an ASCII + * or UTF-8 string, otherwise it is a pointer to 16- or 32-bit characters in + * native byte order. + */ + const char * const nxcsptr; +#else + const char * const nxcsptr; + const unsigned int nxcslen; +#endif +} +@end + +#ifdef NeXT_RUNTIME +/** For internal use with NeXT runtime; + needed, until Apple Radar 2870817 is fixed. */ +extern struct objc_class _NSConstantStringClassReference; +#endif + +#if defined(__cplusplus) +} +#endif + +#if !NO_GNUSTEP && !defined(GNUSTEP_BASE_INTERNAL) +#import "../GNUstepBase/NSString+GNUstepBase.h" +#import "../GNUstepBase/NSMutableString+GNUstepBase.h" +#endif + +#endif /* __NSString_h_GNUSTEP_BASE_INCLUDE */ diff --git a/gcc/testsuite/objc-obj-c++-shared/GNUStep/Foundation/NSValue.h b/gcc/testsuite/objc-obj-c++-shared/GNUStep/Foundation/NSValue.h new file mode 100644 index 00000000000..f194f01a228 --- /dev/null +++ b/gcc/testsuite/objc-obj-c++-shared/GNUStep/Foundation/NSValue.h @@ -0,0 +1,370 @@ +/* Interface for NSValue for GNUStep + Copyright (C) 1995, 1996 Free Software Foundation, Inc. + + Written by: Adam Fedor <fedor@boulder.colorado.edu> + Created: 1995 + + This file is part of the GNUstep Base Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, 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 + Library General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02111 USA. + */ + +#ifndef __NSValue_h_GNUSTEP_BASE_INCLUDE +#define __NSValue_h_GNUSTEP_BASE_INCLUDE +#import "../GNUstepBase/GSVersionMacros.h" + +#import "NSObject.h" +#import "NSGeometry.h" +#import "NSRange.h" + +#if defined(__cplusplus) +extern "C" { +#endif + +@class NSString; + +/** + * The <code>NSValue</code> class can wrap a single primitive value as an + * object so it can be used in the containers and other places where an object + * reference is needed. Once initialized, an <code>NSValue</code> is + * immutable, and there is no <code>NSMutableValue</code> class. You + * initialize it by giving it a pointer to the primitive value, and you should + * be careful this does not get freed until after the <code>NSValue</code> is + * no longer used. + */ +@interface NSValue : NSObject <NSCopying, NSCoding> + +// Allocating and Initializing + +/** + * Create new instance with specified value (a pointer) of given type, which + * is a string code obtainable through the compile-time operator + * <code>@encode(...)</code>. For example: +<example> + NSValue *theValue = [NSValue value: &n withObjCType: @encode(int)]; +</example> + */ ++ (NSValue*) value: (const void*)value withObjCType: (const char*)type; + +/** + * Create new instance holding anObject. This is useful if you want to add + * anObject to a collection such as [NSArray] but don't want it to be retained + * (a weak reference). + */ ++ (NSValue*) valueWithNonretainedObject: (id)anObject; + +/** + * Convenience method to create instance holding an <code>NSPoint</code> + * structure. + */ ++ (NSValue*) valueWithPoint: (NSPoint)point; + +/** + * Convenience method to create instance holding a pointer. Same as + * using <code>@encode(void *)</code> in +value:withObjCType: . + */ ++ (NSValue*) valueWithPointer: (const void*)pointer; + +/** + * Convenience method to create instance holding an <code>NSRange</code> + * structure. + */ ++ (NSValue*) valueWithRange: (NSRange)range; + +/** + * Convenience method to create instance holding an <code>NSRect</code> + * structure. + */ ++ (NSValue*) valueWithRect: (NSRect)rect; + +/** + * Convenience method to create instance holding an <code>NSSize</code> + * structure. + */ ++ (NSValue*) valueWithSize: (NSSize)size; + +#if OS_API_VERSION(GS_API_MACOSX, GS_API_LATEST) +/** + * Synonym for value:withObjCType: . + */ ++ (NSValue*) valueWithBytes: (const void*)value objCType: (const char*)type; + +/** <init/> + * Initialize with value of type, parallel to value:withObjCType: . + */ +- (id) initWithBytes: (const void*)data objCType: (const char*)type; + +/** + * Compares this instance to another <code>NSValue</code>. For equality, + * both contents and declared type of the two values must match. + */ +- (BOOL) isEqualToValue: (NSValue*)other; +#endif /* GS_API_MACOSX */ + +// Accessing Data + +/** + * Copies bytes from the pointer receiver was initialized with into buffer + * pointed to by value. Number of bytes copied is determined by the type. If + * type was a void * pointer or object id, the memory address itself is + * copied. + */ +- (void) getValue: (void*)value; + +/** + * Returns the string <code>@encode(...)</code> compatible type the receiver + * was initialized with. + */ +- (const char*) objCType; + +/** + * If receiver was initialized with an object ID, return it, else raises + * <code>NSInternalInconsistencyException</code>. + */ +- (id) nonretainedObjectValue; + +/** + * If receiver was initialized with a void * pointer, return it, else raises + * <code>NSInternalInconsistencyException</code>. + */ +- (void*) pointerValue; + +/** + * If receiver was initialized with an <code>NSRange</code> value, return it, + * else raises <code>NSInternalInconsistencyException</code>. + */ +- (NSRange) rangeValue; + +/** + * If receiver was initialized with an <code>NSRect</code> value, return it, + * else raises <code>NSInternalInconsistencyException</code>. + */ +- (NSRect) rectValue; + +/** + * If receiver was initialized with an <code>NSSize</code> value, return it, + * else raises <code>NSInternalInconsistencyException</code>. + */ +- (NSSize) sizeValue; + +/** + * If receiver was initialized with an <code>NSPoint</code> value, return it, + * else raises <code>NSInternalInconsistencyException</code>. + */ +- (NSPoint) pointValue; + +@end + +/** + * Subclass of [NSValue] offering convenience methods for initializing from + * and accessing as any C primitive numeric type. On access, the value will + * be type-converted if necessary, using standard C conversion rules. + */ +@interface NSNumber : NSValue <NSCopying,NSCoding> + +// Allocating and Initializing + +/** New instance from boolean value. */ ++ (NSNumber*) numberWithBool: (BOOL)value; +/** New instance from signed char value. */ ++ (NSNumber*) numberWithChar: (signed char)value; +/** New instance from double value. */ ++ (NSNumber*) numberWithDouble: (double)value; +/** New instance from float value. */ ++ (NSNumber*) numberWithFloat: (float)value; +/** New instance from (signed) int value. */ ++ (NSNumber*) numberWithInt: (signed int)value; +/** New instance from (signed) long value. */ ++ (NSNumber*) numberWithLong: (signed long)value; +/** New instance from (signed) long long value. */ ++ (NSNumber*) numberWithLongLong: (signed long long)value; +/** New instance from (signed) short value. */ ++ (NSNumber*) numberWithShort: (signed short)value; +/** New instance from unsigned char value. */ ++ (NSNumber*) numberWithUnsignedChar: (unsigned char)value; +/** New instance from unsigned int value. */ ++ (NSNumber*) numberWithUnsignedInt: (unsigned int)value; +/** New instance from unsigned long value. */ ++ (NSNumber*) numberWithUnsignedLong: (unsigned long)value; +/** New instance from unsigned long long value. */ ++ (NSNumber*) numberWithUnsignedLongLong: (unsigned long long)value; +/** New instance from unsigned short value. */ ++ (NSNumber*) numberWithUnsignedShort: (unsigned short)value; + +/** Initialize from boolean value. */ +- (id) initWithBool: (BOOL)value; +/** Initialize from signed char value. */ +- (id) initWithChar: (signed char)value; +/** Initialize from double value. */ +- (id) initWithDouble: (double)value; +/** Initialize from float value. */ +- (id) initWithFloat: (float)value; +/** Initialize from (signed) int value. */ +- (id) initWithInt: (signed int)value; +/** Initialize from (signed) long value. */ +- (id) initWithLong: (signed long)value; +/** Initialize from (signed) long long value. */ +- (id) initWithLongLong: (signed long long)value; +/** Initialize from (signed) short value. */ +- (id) initWithShort: (signed short)value; +/** Initialize from unsigned char value. */ +- (id) initWithUnsignedChar: (unsigned char)value; +/** Initialize from unsigned int value. */ +- (id) initWithUnsignedInt: (unsigned int)value; +/** Initialize from unsigned long value. */ +- (id) initWithUnsignedLong: (unsigned long)value; +/** Initialize from unsigned long long value. */ +- (id) initWithUnsignedLongLong: (unsigned long long)value; +/** Initialize from unsigned short value. */ +- (id) initWithUnsignedShort: (unsigned short)value; + +// Accessing Data + +/** + * Return value as a BOOL; this will in fact be a char value converted + * if necessary from type initialized with; if you wish to consider anything + * nonzero TRUE do not compare directly to YES, but use <code>'!= NO'</code>. + */ +- (BOOL) boolValue; +/** Returns value as a signed char, converting if necessary. */ +- (signed char) charValue; +/** Returns value as a double, converting if necessary. */ +- (double) doubleValue; +/** Returns value as a float, converting if necessary. */ +- (float) floatValue; +/** Returns value as a (signed) int, converting if necessary. */ +- (signed int) intValue; +/** Returns value as a (signed) long, converting if necessary. */ +- (signed long) longValue; +/** Returns value as a (signed) long long, converting if necessary. */ +- (signed long long) longLongValue; +/** Returns value as a (signed) short, converting if necessary. */ +- (signed short) shortValue; +/** Returns value as an unsigned char, converting if necessary. */ +- (unsigned char) unsignedCharValue; +/** Returns value as an unsigned int, converting if necessary. */ +- (unsigned int) unsignedIntValue; +/** Returns value as an unsigned long, converting if necessary. */ +- (unsigned long) unsignedLongValue; +/** Returns value as an unsigned long long, converting if necessary. */ +- (unsigned long long) unsignedLongLongValue; +/** Returns value as an unsigned short, converting if necessary. */ +- (unsigned short) unsignedShortValue; + +/** Returns -description . */ +- (NSString*) stringValue; + +/** + * Returns the string representation of this number using a non-localised + * conversion (decimal point is '.' irrespective of the locale). + */ +- (NSString*) description; + +/** + * <p> + * Produces a string representation of the number. For a boolean + * this will be either 'true' or 'false'. For other numbers the + * format is produced using the initWithFormat:locale:... method + * of NSString, and the format depends on the type of number as + * follows - + * </p> + * <deflist> + * <term>char</term> + * <desc>%i</desc> + * <term> short</term> + * <desc>%hi</desc> + * <term> int</term> + * <desc>%i</desc> + * <term> long</term> + * <desc>%li</desc> + * <term> long long</term> + * <desc>%lli</desc> + * <term> unsigned char</term> + * <desc>%u</desc> + * <term> unsigned short</term> + * <desc>%hu</desc> + * <term> unsigned int</term> + * <desc>%u</desc> + * <term> unsigned long</term> + * <desc>%lu</desc> + * <term> unsigned long long</term> + * <desc>%llu</desc> + * <term> float</term> + * <desc>%0.7g</desc> + * <term> double</term> + * <desc>%0.16g</desc> + * </deflist> + */ +- (NSString*) descriptionWithLocale: (id)locale; + +/** + * Compares receiver with otherNumber, using C type conversion if necessary, + * and returns <code>NSOrderedAscending</code>, + * <code>NSOrderedDescending</code>, or <code>NSOrderedSame</code> depending + * on whether it is less than, greater than, or equal to otherNumber. + */ +- (NSComparisonResult) compare: (NSNumber*)otherNumber; + +/** + * Returns whether receiver and otherNumber represent the same numerical value. + */ +- (BOOL) isEqualToNumber: (NSNumber*)otherNumber; + + +#if OS_API_VERSION(MAC_OS_X_VERSION_10_5, GS_API_LATEST) +/** Return a number intialised with NSInteger. + */ ++ (NSNumber*) numberWithInteger: (NSInteger)value; +/** Return a number intialised with NSUInteger. + */ ++ (NSNumber*) numberWithUnsignedInteger: (NSUInteger)value; +/** Initialise the receiver with NSInteger content. + */ +- (id) initWithInteger: (NSInteger)value; +/** Initialise the receiver with NSUInteger content. + */ +- (id) initWithUnsignedInteger: (NSUInteger)value; +/** Return the contents of the receiver as NSInteger. + */ +- (NSInteger) integerValue; +/** Return the contents of the receiver as NSUInteger. + */ +- (NSUInteger) unsignedIntegerValue; +#endif + +@end + +#if OS_API_VERSION(GS_API_NONE, GS_API_NONE) + +/** Note: Defines a method that is not in the OpenStep spec, but makes + subclassing easier. */ +@interface NSValue (Subclassing) + +/** Used by value: withObjCType: to determine the concrete subclass to alloc. */ ++ (Class) valueClassWithObjCType: (const char*)type; + +@end +#endif + +#if defined(__cplusplus) +} +#endif + +#if !NO_GNUSTEP && !defined(GNUSTEP_BASE_INTERNAL) +#import "../GNUstepBase/NSNumber+GNUstepBase.h" +#endif + +#endif /* __NSValue_h_GNUSTEP_BASE_INCLUDE */ diff --git a/gcc/testsuite/objc-obj-c++-shared/GNUStep/Foundation/NSZone.h b/gcc/testsuite/objc-obj-c++-shared/GNUStep/Foundation/NSZone.h new file mode 100644 index 00000000000..21776f65c3b --- /dev/null +++ b/gcc/testsuite/objc-obj-c++-shared/GNUStep/Foundation/NSZone.h @@ -0,0 +1,335 @@ +/** Zone memory management. -*- Mode: ObjC -*- + Copyright (C) 1997,1998,1999 Free Software Foundation, Inc. + + Written by: Yoo C. Chung <wacko@laplace.snu.ac.kr> + Date: January 1997 + + This file is part of the GNUstep Base Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, 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 + Library General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02111 USA. + + AutogsdocSource: NSZone.m + AutogsdocSource: NSPage.m + + */ + +#ifndef __NSZone_h_GNUSTEP_BASE_INCLUDE +#define __NSZone_h_GNUSTEP_BASE_INCLUDE +#import "../GNUstepBase/GSVersionMacros.h" + +/** + * Primary structure representing an <code>NSZone</code>. Technically it + * consists of a set of function pointers for zone upkeep functions plus some + * other things- +<example> +{ + // Functions for zone. + void *(*malloc)(struct _NSZone *zone, size_t size); + void *(*realloc)(struct _NSZone *zone, void *ptr, size_t size); + void (*free)(struct _NSZone *zone, void *ptr); + void (*recycle)(struct _NSZone *zone); + BOOL (*check)(struct _NSZone *zone); + BOOL (*lookup)(struct _NSZone *zone, void *ptr); + + // Zone statistics (not always maintained). + struct NSZoneStats (*stats)(struct _NSZone *zone); + + size_t gran; // Zone granularity (passed in on initialization) + NSString *name; // Name of zone (default is 'nil') + NSZone *next; // Pointer used for internal management of multiple zones. +}</example> + */ +typedef struct _NSZone NSZone; + +#import "NSObjCRuntime.h" + +@class NSString; + +#if defined(__cplusplus) +extern "C" { +#endif + +struct _NSZone +{ + /* Functions for zone. */ + void *(*malloc)(struct _NSZone *zone, size_t size); + void *(*realloc)(struct _NSZone *zone, void *ptr, size_t size); + void (*free)(struct _NSZone *zone, void *ptr); + void (*recycle)(struct _NSZone *zone); + BOOL (*check)(struct _NSZone *zone); + BOOL (*lookup)(struct _NSZone *zone, void *ptr); + struct NSZoneStats (*stats)(struct _NSZone *zone); + + size_t gran; // Zone granularity + __unsafe_unretained NSString *name; // Name of zone (default is 'nil') + NSZone *next; +}; + +/** + * Creates a new zone of start bytes, which will grow and shrink by + * granularity bytes. If canFree is 0, memory in zone is allocated but + * never freed, meaning allocation will be very fast. The whole zone can + * still be freed with NSRecycleZone(), and you should still call NSZoneFree + * on memory in the zone that is no longer needed, since a count of allocated + * pointers is kept and must reach zero before freeing the zone.<br /> + * If Garbage Collection is enabled, this function does nothing other than + * log a warning and return the same value as the NSDefaultMallocZone() + * function. + */ +GS_EXPORT NSZone* +NSCreateZone (NSUInteger start, NSUInteger gran, BOOL canFree); + +/** Returns the default zone for memory allocation. Memory created in this + * zone is the same as memory allocates using the system malloc() function. + */ +GS_EXPORT NSZone* +NSDefaultMallocZone (void); + +/** + * Searches and finds the zone ptr was allocated from. The speed depends + * upon the number of zones and their size.<br /> + * If Garbage Collection is enabled, this function always returns the + * same as the NSDefaultMallocZone() function. + */ +GS_EXPORT NSZone* +NSZoneFromPointer (void *ptr); + +/** + * Allocates and returns memory for elems items of size bytes, in the + * given zone. Returns NULL if allocation of size 0 requested. Raises + * <code>NSMallocException</code> if not enough free memory in zone to + * allocate and no more can be obtained from system, unless using the + * default zone, in which case NULL is returned.<br /> + * If Garbage Collection is enabled, this function always allocates + * non-scanned, non-collectable memory in the NSDefaultMallocZone() and + * the zone argument is ignored. + */ +GS_EXPORT void* +NSZoneMalloc (NSZone *zone, NSUInteger size); + +/** + * Allocates and returns cleared memory for elems items of size bytes, in the + * given zone. Returns NULL if allocation of size 0 requested. Raises + * <code>NSMallocException</code> if not enough free memory in zone to + * allocate and no more can be obtained from system, unless using the + * default zone, in which case NULL is returned.<br /> + * If Garbage Collection is enabled, this function always allocates + * non-scanned, non-collectable memory in the NSDefaultMallocZone() and + * the zone argument is ignored. + */ +GS_EXPORT void* +NSZoneCalloc (NSZone *zone, NSUInteger elems, NSUInteger bytes); + +/** + * Reallocates the chunk of memory in zone pointed to by ptr to a new one of + * size bytes. Existing contents in ptr are copied over. Raises an + * <code>NSMallocException</code> if insufficient memory is available in the + * zone and no more memory can be obtained from the system, unless using the + * default zone, in which case NULL is returned.<br /> + * If Garbage Collection is enabled, the zone argument is ignored. + */ +GS_EXPORT void* +NSZoneRealloc (NSZone *zone, void *ptr, NSUInteger size); + +/** + * Return memory for an entire zone to system. In fact, this will not be done + * unless all memory in the zone has been explicitly freed (by calls to + * NSZoneFree()). For "non-freeable" zones, the number of NSZoneFree() calls + * must simply equal the number of allocation calls. The default zone, on the + * other hand, cannot be recycled.<br /> + * If Garbage Collection is enabled, this function has not effect. + */ +GS_EXPORT void +NSRecycleZone (NSZone *zone); + +/** + * Frees memory pointed to by ptr (which should have been allocated by a + * previous call to NSZoneMalloc(), NSZoneCalloc(), or NSZoneRealloc()) and + * returns it to zone. Note, if this is a nonfreeable zone, the memory is + * not actually freed, but the count of number of free()s is updated.<br /> + * If Garbage Collection is enabled, the zone argument is ignored and this + * function causes ptr to be deallocated immediately. + */ +GS_EXPORT void +NSZoneFree (NSZone *zone, void *ptr); + +/** + * Sets name of the given zone (useful for debugging and logging). + */ +GS_EXPORT void +NSSetZoneName (NSZone *zone, NSString *name); + +/** + * Returns the name of the given zone (useful for debugging and logging). + */ +GS_EXPORT NSString* +NSZoneName (NSZone *zone); + +#if OS_API_VERSION(GS_API_NONE, GS_API_NONE) + +/** Deprecated ...<br /> + * Checks integrity of a zone. Not defined by OpenStep or OS X. + */ +BOOL +NSZoneCheck (NSZone *zone); + +/** + * <code>NSZoneStats</code> is the structure returned by the NSZoneStats() + * function that summarizes the current usage of a zone. It is similar to + * the structure <em>mstats</em> in the GNU C library. It has 5 fields of + * type <code>size_t</code>- + * <deflist> + * <term><code>bytes_total</code></term> + * <desc> + * This is the total size of memory managed by the zone, in bytes.</desc> + * <term><code>chunks_used</code></term> + * <desc>This is the number of memory chunks in use in the zone.</desc> + * <term><code>bytes_used</code></term> + * <desc>This is the number of bytes in use.</desc> + * <term><code>chunks_free</code></term> + * <desc>This is the number of memory chunks that are not in use.</desc> + * <term><code>bytes_free</code></term> + * <desc> + * This is the number of bytes managed by the zone that are not in use. + * </desc> + * </deflist> + */ +struct NSZoneStats +{ + size_t bytes_total; + size_t chunks_used; + size_t bytes_used; + size_t chunks_free; + size_t bytes_free; +}; + +/** Deprecated ...<br /> + * Obtain statistics about the zone. Implementation emphasis is on + * correctness, not speed. Not defined by OpenStep or OS X. + */ +struct NSZoneStats +NSZoneStats (NSZone *zone); + +/** + * Try to get more memory - the normal process has failed. + * If we can't do anything, just return a null pointer. + * Try to do some logging if possible. + */ +void* +GSOutOfMemory(NSUInteger size, BOOL retry); + +/** + * Called during +initialize to tell the class that instances created + * in future should have the specified instance variable as a weak + * pointer for garbage collection.<br /> + * NB. making a pointer weak does not mean that it is automatically + * zeroed when the object it points to is garbage collected. To get that + * behavior you must asign values to the pointer using the + * GSAssignZeroingWeakPointer() function.<br /> + * This function has no effect if the system is + * not built for garbage collection. + */ +GS_EXPORT void +GSMakeWeakPointer(Class theClass, const char *iVarName); + +/** + * This function must be used to assign a value to a zeroing weak pointer.<br /> + * A zeroing weak pointer is one where, when the garbage collector collects + * the object pointed to, it also clears the weak pointer.<br /> + * Assigning zero (nil) will always succeed and has the effect of telling the + * garbage collector that it no longer needs to track the previously assigned + * object. Apart from that case, a source needs to be garbage collectable for + * this function to work, and using a non-garbage collectable value will + * cause the function to return NO.<br /> + * If the destination object (the weak pointer watching the source object) + * belongs to a chunk of memory which may be collected before the source + * object is collected, it is important that it is finalised and the + * finalisation code assigns zero to the pointer.<br /> + * If garbage collection is not in use, this function performs a simple + * assignment returning YES, unless destination is null in which case it + * returns NO. + */ +GS_EXPORT BOOL +GSAssignZeroingWeakPointer(void **destination, void *source); + +#endif + +GS_EXPORT NSUInteger +NSPageSize (void) __attribute__ ((const)); + +GS_EXPORT NSUInteger +NSLogPageSize (void) __attribute__ ((const)); + +GS_EXPORT NSUInteger +NSRoundDownToMultipleOfPageSize (NSUInteger bytes) __attribute__ ((const)); + +GS_EXPORT NSUInteger +NSRoundUpToMultipleOfPageSize (NSUInteger bytes) __attribute__ ((const)); + +GS_EXPORT NSUInteger +NSRealMemoryAvailable (void); + +GS_EXPORT void* +NSAllocateMemoryPages (NSUInteger bytes); + +GS_EXPORT void +NSDeallocateMemoryPages (void *ptr, NSUInteger bytes); + +GS_EXPORT void +NSCopyMemoryPages (const void *src, void *dest, NSUInteger bytes); + +#if OS_API_VERSION(MAC_OS_X_VERSION_10_4, OS_API_LATEST) + +enum { + NSScannedOption = (1<<0), + NSCollectorDisabledOption = (1<<1) +}; + +/** Allocate memory. If garbage collection is not enabled this uses the + * default malloc zone and the options are ignored.<br /> + * If garbage collection is enabled, the allocate memory is normally not + * scanned for pointers but is itsself garbage collectable. The options + * argument is a bitmask in which NSScannedOption sets the memory to be + * scanned for pointers by the garbage collector, and + * NSCollectorDisabledOption causes the memory to be excempt from being + * garbage collected itsself.<br /> + * In any case the memory returned is zero'ed. + */ +GS_EXPORT void * +NSAllocateCollectable(NSUInteger size, NSUInteger options); + +/** Reallocate memory to be of a different size and/or to have different + * options settings. The behavior of options is as for + * the NSAllocateCollectable() function. + */ +GS_EXPORT void * +NSReallocateCollectable(void *ptr, NSUInteger size, NSUInteger options); + +#endif + +static inline id NSMakeCollectable(const void *cf) { +#if __has_feature(objc_arc) + return nil; +#else + return (id)cf; // Unimplemented; garbage collection is deprecated. +#endif +} + +#if defined(__cplusplus) +} +#endif + +#endif /* not __NSZone_h_GNUSTEP_BASE_INCLUDE */ diff --git a/gcc/testsuite/objc-obj-c++-shared/GNUStep/GNUstepBase/GNUstep.h b/gcc/testsuite/objc-obj-c++-shared/GNUStep/GNUstepBase/GNUstep.h new file mode 100644 index 00000000000..c3b7f2bd55e --- /dev/null +++ b/gcc/testsuite/objc-obj-c++-shared/GNUStep/GNUstepBase/GNUstep.h @@ -0,0 +1,418 @@ +/* GNUstep.h - macros to make easier to port gnustep apps to macos-x + Copyright (C) 2001 Free Software Foundation, Inc. + + Written by: Nicola Pero <n.pero@mi.flashnet.it> + Date: March, October 2001 + + This file is part of GNUstep. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, 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 + Library General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef __GNUSTEP_GNUSTEP_H_INCLUDED_ +#define __GNUSTEP_GNUSTEP_H_INCLUDED_ + +/* The contents of this file are designed to be usable with either + * GNUstep-base or MacOS-X Foundation. + */ + +#ifndef __has_feature +# define __has_feature(x) 0 +#endif + +/* + * __has_extension has slightly different semantics from __has_feature. + * It evaluates to true if the feature is supported by by clang for the + * current compilation unit (language and -f switches), regardless of + * whether it is part of the language standard or just a (non-standard) + * extension. + */ +#ifndef __has_extension +# define __has_extension(x) __has_feature(x) +#endif + +/* + * __has_attribute is the equivalent to __has_feature and __has_extension + * for GNU-style attributes. + */ +#ifndef __has_attribute +# define __has_attribute(x) 0 +#endif + +#if __has_feature(objc_arc) + +#ifndef RETAIN +#define RETAIN(object) (object) +#endif +#ifndef RELEASE +#define RELEASE(object) +#endif +#ifndef AUTORELEASE +#define AUTORELEASE(object) (object) +#endif + +#ifndef TEST_RETAIN +#define TEST_RETAIN(object) (object) +#endif +#ifndef TEST_RELEASE +#define TEST_RELEASE(object) +#endif +#ifndef TEST_AUTORELEASE +#define TEST_AUTORELEASE(object) (object) +#endif + +#ifndef ASSIGN +#define ASSIGN(object,value) object = (value) +#endif +#ifndef ASSIGNCOPY +#define ASSIGNCOPY(object,value) object = [(value) copy] +#endif +#ifndef DESTROY +#define DESTROY(object) object = nil +#endif + +#define IF_NO_GC(X) + +#ifndef ENTER_POOL +#define ENTER_POOL @autoreleasepool{do{ +#endif + +#ifndef LEAVE_POOL +#define LEAVE_POOL }while(0);} +#endif + +#ifndef DEALLOC +#define DEALLOC +#endif + +#else + +#ifndef RETAIN +/** + * Basic retain operation ... calls [NSObject-retain]<br /> + * Deprecated ... pointless on modern processors. + * Simply call the -retain method. + */ +#define RETAIN(object) [(object) retain] +#endif + +#ifndef RELEASE +/** + * Basic release operation ... calls [NSObject-release]<br /> + * Deprecated ... pointless on modern processors. + * Simply call the -release method. + */ +#define RELEASE(object) [(object) release] +#endif + +#ifndef AUTORELEASE +/** + * Basic autorelease operation ... calls [NSObject-autorelease]<br /> + * Deprecated ... pointless on modern processors. + * Simply call the -autorelease method. + */ +#define AUTORELEASE(object) [(object) autorelease] +#endif + +#ifndef TEST_RETAIN +/** + * Tested retain - only invoke the + * objective-c method if the receiver is not nil.<br /> + * Deprecated ... pointless on modern processors. + * Simply call the -retain method. + */ +#define TEST_RETAIN(object) ({\ +id __object = (object); (__object != nil) ? [__object retain] : nil; }) +#endif + +#ifndef TEST_RELEASE +/** + * Tested release - only invoke the + * objective-c method if the receiver is not nil.<br /> + * Deprecated ... pointless on modern processors. + * Simply call the -release method. + */ +#define TEST_RELEASE(object) ({\ +id __object = (object); if (__object != nil) [__object release]; }) +#endif + +#ifndef TEST_AUTORELEASE +/** + * Tested autorelease - only invoke the + * objective-c method if the receiver is not nil.<br /> + * Deprecated ... pointless on modern processors. + * Simply call the -autorelease method. + */ +#define TEST_AUTORELEASE(object) ({\ +id __object = (object); (__object != nil) ? [__object autorelease] : nil; }) +#endif + +#ifndef ASSIGN +/** + * ASSIGN(object,value) assigns the value to the object with + * appropriate retain and release operations.<br /> + * Use this to avoid retain/release errors. + */ +#define ASSIGN(object,value) ({\ + id __object = object; \ + object = [(value) retain]; \ + [__object release]; \ +}) +#endif + +#ifndef ASSIGNCOPY +/** + * ASSIGNCOPY(object,value) assigns a copy of the value to the object + * with release of the original.<br /> + * Use this to avoid retain/release errors. + */ +#define ASSIGNCOPY(object,value) ({\ + id __object = object; \ + object = [(value) copy];\ + [__object release]; \ +}) +#endif + +#ifndef DESTROY +/** + * DESTROY() is a release operation which also sets the variable to be + * a nil pointer for tidiness - we can't accidentally use a DESTROYED + * object later. It also makes sure to set the variable to nil before + * releasing the object - to avoid side-effects of the release trying + * to reference the object being released through the variable. + */ +#define DESTROY(object) ({ \ + id __o = object; \ + object = nil; \ + [__o release]; \ +}) +#endif + +#define IF_NO_GC(X) X + +#ifndef ENTER_POOL +/** + * ENTER_POOL creates an autorelease pool and places subsequent code + * in a do/while loop (executed only once) which can be broken out of + * to reach the point when the pool is drained.<br /> + * The block must be terminated with a corresponding LEAVE_POOL.<br /> + * You should not return from such a block of code (to do so could + * leak an autorelease pool and give objects a longer lifetime than + * they ought to have. If you wish to leave the block of code early, + * you may do so using a 'break' statement. + */ +#define ENTER_POOL {NSAutoreleasePool *_lARP=[NSAutoreleasePool new];do{ +#endif + +#ifndef LEAVE_POOL +/** + * LEAVE_POOL terminates a block of code started with ENTER_POOL. + */ +#define LEAVE_POOL }while(0);[_lARP drain];} +#endif + +#ifndef DEALLOC +/** + * DEALLOC calls the superclass implementation of dealloc, unless + * ARC is in use (in which case it does nothing). + */ +#define DEALLOC [super dealloc]; +#endif +#endif + +#ifndef CREATE_AUTORELEASE_POOL +/** DEPRECATED ... use ENTER_POOL and LEAVE_POOL + */ +#define CREATE_AUTORELEASE_POOL(X) \ + NSAutoreleasePool *X = [NSAutoreleasePool new] +#endif + +#ifndef RECREATE_AUTORELEASE_POOL +/** DEPRECATED ... use ENTER_POOL and LEAVE_POOL + */ +#define RECREATE_AUTORELEASE_POOL(X) \ + DESTROY(X);\ + X = [NSAutoreleasePool new] +#endif + + +/** + * <p> + * This function (macro) is a GNUstep extension. + * </p> + * <p> + * <code>_(@"My string to translate")</code> + * </p> + * <p> + * is basically equivalent to + * </p> + * <p> + * <code>NSLocalizedString(@"My string to translate", @"")</code> + * </p> + * <p> + * It is useful when you need to translate an application + * very quickly, as you just need to enclose all strings + * inside <code>_()</code>. But please note that when you + * use this macro, you are not taking advantage of comments + * for the translator, so consider using + * <code>NSLocalizedString</code> instead when you need a + * comment. + * </p> + * <p>You may define GS_LOCALISATION_BUNDLE_ID to the bundle identifier + * of the bundle which is to provide the localisation information.<br /> + * This can be used when compiling a single file by specifying something like + * '-D GS_LOCALISATION_BUNDLE_ID=$(FRAMEWORK_NAME)' in your make file.<br /> + * If this is not defined, the localisation is provided by your application's + * main bundle exactly like the NSLocalizedString function. + * </p> + * <p>Alternatively you may define GS_LOCALISATION_BUNDLE to be the bundle + * to be used to prvide the localisation information. + * </p> + */ +# define _(X) \ + [GS_LOCALISATION_BUNDLE localizedStringForKey: (X) value: @"" table: nil] + +#if !defined(GS_LOCALISATION_BUNDLE) +# if defined(GS_LOCALISATION_BUNDLE_ID) +# define GS_LOCALISATION_BUNDLE [NSBundle bundleWithIdentifier: \ + GS_LOCALISATION_BUNDLE_ID] +# else +# define GS_LOCALISATION_BUNDLE [NSBundle mainBundle] +# endif +#endif + + + +/** + * <p> + * This function (macro) is a GNUstep extension. + * </p> + * <p> + * <code>__(@"My string to translate")</code> + * </p> + * <p> + * is exactly the same as + * </p> + * <p> + * <code>GSLocalizedStaticString(@"My string to translate", @"")</code> + * </p> + * <p> + * It is useful when you need to translate an application very + * quickly. You would use it as follows for static strings: + * </p> + * <p> + * <code> + * NSString *message = __(@"Hello there"); + * ... more code ... + * NSLog (_(messages)); + * </code> + * </p> + * <p> + * But please note that when you use this macro, you are not + * taking advantage of comments for the translator, so + * consider using <code>GSLocalizedStaticString</code> + * instead when you need a comment. + * </p> + */ +#define __(X) X + +/* The better way for a static string, with a comment - use as follows - + * + * static NSString *string = GSLocalizedStaticString (@"New Game", + * @"Menu Option"); + * + * NSLog (_(string)); + * + * If you need anything more complicated than this, please initialize + * the static strings manually. + */ + +/** + * <p> + * This function (macro) is a GNUstep extensions, and it is used + * to localize static strings. Here is an example of a static + * string: + * </p> + * <p> + * <code> + * NSString *message = @"Hi there"; + * ... some code ... + * NSLog (message); + * </code> + * </p> + * <p> + * This string can not be localized using the standard + * openstep functions/macros. By using this gnustep extension, + * you can localize it as follows: + * </p> + * <p> + * <code> + * NSString *message = GSLocalizedStaticString (@"Hi there", + * @"Greeting"); + * + * ... some code ... + * + * NSLog (NSLocalizedString (message, @"")); + * </code> + * </p> + * <p> + * When the tools generate the + * <code>Localizable.strings</code> file from the source + * code, they will ignore the <code>NSLocalizedString</code> + * call while they will extract the string (and the comment) + * to localize from the <code>GSLocalizedStaticString</code> + * call. + * </p> + * <p> + * When the code is compiled, instead, the + * <code>GSLocalizedStaticString</code> call is ignored (discarded, + * it is a macro which simply expands to <code>key</code>), while + * the <code>NSLocalizedString</code> will actually look up the + * string for translation in the <code>Localizable.strings</code> + * file. + * </p> + * <p> + * Please note that there is currently no macro/function to + * localize static strings using different tables. If you + * need that functionality, you have either to prepare the + * localization tables by hand, or to rewrite your code in + * such a way as not to use static strings. + * </p> + */ +#define GSLocalizedStaticString(key, comment) key + +/** + * To be used inside a method for making sure that a range does not specify + * anything outside the size of an array/string. Raises exception if range + * extends beyond [0,size]. Size must be an unsigned integer (NSUInteger). + */ +#define GS_RANGE_CHECK(RANGE, SIZE) \ + if (RANGE.location > (NSUInteger)SIZE \ + || RANGE.length > ((NSUInteger)SIZE - RANGE.location)) \ + [NSException raise: NSRangeException format: @"in %s, range { %"\ + PRIuPTR ", %" PRIuPTR " } extends beyond size (%" PRIuPTR ")", \ + GSNameFromSelector(_cmd), RANGE.location, RANGE.length, (NSUInteger)SIZE] + +/** Checks whether INDEX is strictly less than OVER (within C array space). + * INDEX and OVER must be unsigned integers (NSUInteger). + */ +#define CHECK_INDEX_RANGE_ERROR(INDEX, OVER) \ +if ((NSUInteger)INDEX >= (NSUInteger)OVER) \ + [NSException raise: NSRangeException \ + format: @"in %s, index %" PRIuPTR " is out of range", \ + GSNameFromSelector(_cmd), (NSUInteger)INDEX] + +#endif /* __GNUSTEP_GNUSTEP_H_INCLUDED_ */ diff --git a/gcc/testsuite/objc-obj-c++-shared/GNUStep/GNUstepBase/GSBlocks.h b/gcc/testsuite/objc-obj-c++-shared/GNUStep/GNUstepBase/GSBlocks.h new file mode 100644 index 00000000000..ac4e9c92ea6 --- /dev/null +++ b/gcc/testsuite/objc-obj-c++-shared/GNUStep/GNUstepBase/GSBlocks.h @@ -0,0 +1,145 @@ +/** Definitions for block support for GNUStep + Copyright (C) 2011 Free Software Foundation, Inc. + + This file is part of the GNUstep Base Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, 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 + Library General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02111 USA. + + */ + +#ifndef __GSBlocks_h_GNUSTEP_BASE_INCLUDE +#define __GSBlocks_h_GNUSTEP_BASE_INCLUDE + +/* Define the has_feature pseudo-macro for GCC. */ +#ifndef __has_feature +#define __has_feature(x) 0 +#endif + +#ifndef GCC_VERSION +#define GCC_VERSION (__GNUC__ * 1000 + __GNUC_MINOR__) +#endif + +#if __has_feature(blocks) + +#define BLOCK_SCOPE __block +/** + * Defines a block type. Will work whether or not the compiler natively + * supports blocks. + */ +#define DEFINE_BLOCK_TYPE(name, retTy, argTys, ...) \ +typedef retTy(^name)(argTys, ## __VA_ARGS__) + +#define DEFINE_BLOCK_TYPE_NO_ARGS(name, retTy) \ +typedef retTy(^name)() + +/** + * Calls a block. Works irrespective of whether the compiler supports blocks. + */ +#define CALL_BLOCK(block, args, ...) block(args, ## __VA_ARGS__) + +/** + * Calls a block without arguments. + */ +#define CALL_BLOCK_NO_ARGS(block) block() +#else + +/* Fall-back versions for when the compiler doesn't have native blocks support. + */ +#if (GCC_VERSION >= 3000) + +#define DEFINE_BLOCK_TYPE(name, retTy, argTys, ...) \ + typedef struct {\ + void *isa;\ + int flags;\ + int reserved;\ + retTy (*invoke)(void*, argTys, ## __VA_ARGS__);\ + } *name + +#define DEFINE_BLOCK_TYPE_NO_ARGS(name, retTy) \ + typedef struct {\ + void *isa;\ + int flags;\ + int reserved;\ + retTy (*invoke)(void*);\ + } *name + +#define CALL_BLOCK(block, args, ...) block->invoke(block, args, ## __VA_ARGS__) + +#define CALL_BLOCK_NO_ARGS(block) block->invoke(block) +#define BLOCK_SCOPE + +#else /* GCC_VERSION >= 3000 */ + +#define DEFINE_BLOCK_TYPE(name, retTy, argTys...) \ + typedef struct {\ + void *isa;\ + int flags;\ + int reserved;\ + retTy (*invoke)(void*, argTys);\ + } *name + +#define DEFINE_BLOCK_TYPE_NO_ARGS(name, retTy) \ + typedef struct {\ + void *isa;\ + int flags;\ + int reserved;\ + retTy (*invoke)(void*);\ + } *name + + +#define CALL_BLOCK(block, args...) block->invoke(block, args) +#define CALL_BLOCK_NO_ARGS(block) block->invoke(block) +#define BLOCK_SCOPE +#endif /* GCC_VERSION >= 3000 */ + +#endif /* __has_feature(blocks) */ + +#if __has_include(<objc/blocks_runtime.h>) +# include <objc/blocks_runtime.h> +#else + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * _Block_copy and _Block_release are weakly imported, but can be assumed + * to be available whenever a feature using blocks is accessed + * by an application. + */ + +/* weak attributed supported only with ELF, MINGW is COFF */ +#ifndef __MINGW32__ + +void *_Block_copy(const void *) __attribute__((weak)); +void _Block_release(const void *) __attribute__((weak)); + +#endif /* __MINGW32__ */ + +#ifdef __cplusplus +} +#endif + +#ifndef Block_copy +# define Block_copy(x) ((__typeof(x))_Block_copy((const void *)(x))) +#endif +#ifndef Block_release +# define Block_release(x) _Block_release((const void *)(x)) +#endif + +#endif /* __has_include(<objc/blocks_runtime.h>) */ +#endif /* __GSBlocks_h_GNUSTEP_BASE_INCLUDE */ + diff --git a/gcc/testsuite/objc-obj-c++-shared/GNUStep/GNUstepBase/GSConfig.h b/gcc/testsuite/objc-obj-c++-shared/GNUStep/GNUstepBase/GSConfig.h new file mode 100644 index 00000000000..a0e7cc7a409 --- /dev/null +++ b/gcc/testsuite/objc-obj-c++-shared/GNUStep/GNUstepBase/GSConfig.h @@ -0,0 +1,462 @@ +/* Machine/OS specific configuration information for GNUstep + + Please NOTE - GSConfig.h is generated by the configure script from the + file GSConfig.h.in - changes/fixes need to be made to the original file, + not to the GSConfig.h generated from it. + + Copyright (C) 1998-2010 Free Software Foundation, Inc. + + Written by: Richard frith-Macdonald <richard@brainstorm.co.uk> + + This file is part of the GNUstep Base Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, 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 + Library General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02111 USA. + */ + +#ifndef included_GSConfig_h +#define included_GSConfig_h + +/* Check the compiler to see if we are building on/for ms-windows. + * Whatever the compiler uses, we want a standard setting of _WIN64 + * to indicate 64bit AND _WIN32 to indicate ms-windows. + * These are defined by gcc, clang, and microsoft compilers anyway. + */ +#if defined(__WIN32__) \ + || defined(__MS_WIN32__) \ + || defined(__MINGW32__) +# if !defined(_WIN32) +# define _WIN32 +# endif +#endif +#if defined(__WIN64__) \ + || defined(__MS_WIN64__) \ + || defined(__MINGW64__) +# if !defined(__WIN64__) +# define __WIN64__ +# endif +# if !defined(_WIN32) +# define _WIN32 +# endif +#endif + +/* Check to see if this is a MINGW build (all we currently support) + */ +#if defined(__MINGW32__) || defined(__MINGW64__) +# if !defined(__MINGW__) +# define __MINGW__ +# endif +#endif + +// Make sure we expose the constants that we use in ObjC++ mode +#ifndef __STDC_CONSTANT_MACROS +#define __STDC_CONSTANT_MACROS 1 +#endif +#ifndef __STDC_LIMIT_MACROS +#define __STDC_LIMIT_MACROS 1 +#endif + +#if !defined(NeXT_Foundation_LIBRARY) + +/* An alternate to GS_FAKE_MAIN which forces the user to call the + NSProcessInfo initialization in 'main', GS_FAKE_MAIN must also + be undefined. */ +#if 0 +#define GS_PASS_ARGUMENTS 0 +#endif + +#define GS_FAKE_MAIN 0 +#if GS_FAKE_MAIN + +/* + * NOTE - if GS_FAKE_MAIN (above) is set to 1, this hack applies - and you + * must make sure that this file is included in any file that implements + * the 'main()' function and links with the GNUstep base libarary. + * You should NOT include this file in a program that does not link with + * the base library. + * This file is included automatically in NSObject.h and Foundation.h + * + * The Foundation classe NSProcessInfo need access to the argc, argv, + * and env variables of the main() function. The purpose of this (ugly hack) + * definition is to give the gstep-base library the opportunity to implement + * its own main function with private access to the global vars. The private + * main() implementation (in NSProcessInfo.m) will then call the user defined + * gnustep_base_user_main() function. + * + * The original hack was - + ** Written by: Georg Tuparev, EMBL & Academia Naturalis, + ** Heidelberg, Germany + ** Tuparev@EMBL-Heidelberg.de + ** + ** NOTE! This is very dirty and dangerous trick. I spend several hours + ** on thinking and man pages browsing, but couldn't find better solution. + ** I know that I will spend 666 years in the Computer Hell for writing + ** this hack, and the master devil (Bully Boy) will send me to write + ** Windowz software. + ** BTW, for writing this hack I got personal congratulations from Dennis + ** Ritchie and Bjarne Stroustrup sent me a bunch of flowers and asked me + ** to participate in the standardization committee for C-- v.6.0 as + ** responsible for the new Tab-Overriding-Operator and Scope-Sensitive- + ** Comments ... but this makes my situation even worse ;-) + ** - Georg + * + * On some systems, there are other relatively clean workarounds, if this + * applies to the system you are running on, your configuration script + * should have set GS_FAKE_MAIN to zero, so that this define hack will + * not be used. + */ + +#define main gnustep_base_user_main + +#endif /* GS_FAKE_MAIN */ +#endif + +/* + * Definition to specify if your processor stores words with the most + * significant byte first (like Motorola and SPARC, unlike Intel and VAX). + */ +#define GS_WORDS_BIGENDIAN 0 + +/* + * Size definitions for standard types + */ +#define GS_SIZEOF_SHORT 2 +#define GS_SIZEOF_INT 4 +#define GS_SIZEOF_LONG 8 +#define GS_SIZEOF_LONG_LONG 8 +#define GS_SIZEOF_FLOAT 4 +#define GS_SIZEOF_DOUBLE 8 +#define GS_SIZEOF_VOIDP 8 + +/* + * Size information to be places in bits 5 and 6 of type encoding bytes + * in archives (bits 0 to 4 are used for basic type info and bit 7 is + * used to mark cross-references to previously encoded objects). + */ +#define _GSC_S_SHT _GSC_I16 +#define _GSC_S_INT _GSC_I32 +#define _GSC_S_LNG _GSC_I64 +#define _GSC_S_LNG_LNG _GSC_I64 + +/* + * Type definitions for types with known sizes. + */ +typedef signed char gss8; +typedef unsigned char gsu8; +typedef signed short gss16; +typedef unsigned short gsu16; +typedef signed int gss32; +typedef unsigned int gsu32; +typedef signed long gss64; +typedef unsigned long gsu64; +typedef struct { gsu8 a[16]; } gss128; +typedef struct { gsu8 a[16]; } gsu128; +typedef float gsf32; +typedef double gsf64; + +/* + * Integer type with same size as a pointer + */ +typedef unsigned long gsuaddr; +typedef long gssaddr; +typedef gsuaddr gsaddr; + +/* + * Do we have real 64-bit and 128-bit integers or are we just pretending. + */ +#define GS_HAVE_I64 1 +#define GS_HAVE_I128 0 + +/* + * Ensure some standard types are defined. + */ +#include <inttypes.h> + + + + + + + + + + + +/* + * PTR Limit information replacements for buggy headers + */ +#if 0 +#undef INTPTR_MAX +#define INTPTR_MAX +#undef INTPTR_MIN +#define INTPTR_MIN +#undef UINTPTR_MAX +#define UINTPTR_MAX +#endif + + +/* + * Do we have zlib for file handle compression? + */ +#define USE_ZLIB 1 + +/* + * Do we have the GNU Multiple-precision library for NSDecimal? + */ +//#define USE_GMP 1 +#define USE_GMP 0 + +#ifdef GS_WITH_GC +#undef GS_WITH_GC +#endif +#define GS_WITH_GC 0 + +/* + * Define to say if we use NXConstantString or NSConstantString + */ +#define NXConstantString NSConstantString + + +/* + * Wide unicode character type. + */ +#ifndef UTF32Char +#define UTF32Char uint32_t +#endif + +/* + * Native character type for use in systemcalls etc. + */ + +#if defined(__MINGW__) +# define GSNativeChar uint16_t +#else +# define GSNativeChar char +#endif + +/* + * Types used to avoid exposing pthread header in NSLock.h + * NB. These types should *never* be used except to provide enough space + * in a class layout for the type of data actually used by the pthread + * implementation of the current platform. + */ +typedef struct { + uint8_t dummy[48]; +} gs_cond_t __attribute__((aligned (8))); +typedef struct { + uint8_t dummy[40]; +} gs_mutex_t __attribute__((aligned (8))); + +#define OBJC2RUNTIME 1 +#define BASE_NATIVE_OBJC_EXCEPTIONS 1 +#define GS_NONFRAGILE 0 +#define GS_MIXEDABI 0 +#define GS_USE_LIBXML 0 +#define GS_USE_GNUTLS 0 +#define GS_USE_AVAHI 0 +#define GS_USE_MDNS 0 +#define GS_USE_ICU 0 +#define GS_USE_LIBDISPATCH 0 +#define GS_USE_LIBDISPATCH_RUNLOOP 0 +#define GS_HAVE_OBJC_ROOT_CLASS_ATTR 0 + +#ifndef __has_include +# define __has_include(x) 0 +#endif +#ifndef __has_feature +# define __has_feature(x) 0 +#endif +#ifndef __has_builtin +# define __has_builtin(x) 0 +#endif + +/* + * __has_extension has slightly different semantics from __has_feature. + * It evaluates to true if the feature is supported by by clang for the + * current compilation unit (language and -f switches), regardless of + * whether it is part of the language standard or just a (non-standard) + * extension. + */ +#ifndef __has_extension +# define __has_extension(x) __has_feature(x) +#endif + +#if defined(_WIN32) +#define BOOL WinBOOL +#define __OBJC_BOOL 1 +#include <w32api.h> +#ifndef _WIN32_WINNT +#define _WIN32_WINNT Windows2000 +#endif +#if !defined(WINVER) +#define WINVER Windows2000 +#elif (WINVER < Windows2000) +#undef WINVER +#define WINVER Windows2000 +#endif + +#if defined(__WIN64__) +#include <winsock2.h> +#include <windows.h> +#else +#include <windows.h> +#include <winsock2.h> +#endif + +#undef __OBJC_BOOL +#undef BOOL +#endif + +/* Include the blocks runtime header if it's available (It shouldn't matter + * that this doesn't work on compilers that don't support __has_include(), + * because they also don't support blocks). + */ +#if __has_include(<objc/block_runtime.h>) +# include <objc/block_runtime.h> +#endif + +#ifndef _WIN32 +#include <sys/param.h> /* Hack to get rid of warning in GNU libc 2.0.3. */ +#endif + +/* The following group of lines maintained by the gstep-base configure */ +#define GNUSTEP_BASE_VERSION 1.26.0 +#define GNUSTEP_BASE_MAJOR_VERSION 1 +#define GNUSTEP_BASE_MINOR_VERSION 26 +#define GNUSTEP_BASE_SUBMINOR_VERSION 0 +#define GNUSTEP_BASE_GCC_VERSION 4.0.0 + +/* Do not use the following macros! + */ +#define OBJC_DEP(M) \ + ({ static BOOL beenHere = NO; if (beenHere == NO) {\ + beenHere = YES; fprintf(stderr, "%s:%d %s", __FILE__, __LINE__, (M));}}) + +#define OBJC_MALLOC(VAR, TYPE, NUM) \ + (OBJC_DEP("OBJC_MALLOC is deprecated ... use malloc\n"),(VAR) = (TYPE *) malloc ((unsigned)(NUM)*sizeof(TYPE))) +#define OBJC_VALLOC(VAR, TYPE, NUM) \ + (OBJC_DEP("OBJC_VALLOC is deprecated\n"),(VAR) = (TYPE *) valloc ((unsigned)(NUM)*sizeof(TYPE))) +#define OBJC_ATOMIC_MALLOC(VAR, TYPE, NUM) \ + (OBJC_DEP("OBJC_ATOMIC_MALLOC is deprecated\n"),(VAR) = (TYPE *) malloc ((unsigned)(NUM)*sizeof(TYPE))) +#define OBJC_REALLOC(VAR, TYPE, NUM) \ + (OBJC_DEP("OBJC_REALLOC is deprecated ... use realloc\n"),(VAR) = (TYPE *) realloc ((VAR), (unsigned)(NUM)*sizeof(TYPE))) +#define OBJC_CALLOC(VAR, TYPE, NUM) \ + (OBJC_DEP("OBJC_CALLOC is deprecated ... use calloc\n"),(VAR) = (TYPE *) calloc ((unsigned)(NUM), sizeof(TYPE))) +#define OBJC_FREE(PTR) (OBJC_DEP("OBJC_FREE is deprecated ... use free\n"), free (PTR)) + +#ifndef MAX +#define MAX(a,b) \ + ({__typeof__(a) _MAX_a = (a); __typeof__(b) _MAX_b = (b); \ + _MAX_a > _MAX_b ? _MAX_a : _MAX_b; }) +#endif + +#ifndef MIN +#define MIN(a,b) \ + ({__typeof__(a) _MIN_a = (a); __typeof__(b) _MIN_b = (b); \ + _MIN_a < _MIN_b ? _MIN_a : _MIN_b; }) +#endif + +#ifndef ABS +#define ABS(a) \ + ({__typeof__(a) _ABS_a = (a); \ + _ABS_a < 0 ? -_ABS_a : _ABS_a; }) +#endif + +#ifndef STRINGIFY +#define STRINGIFY(s) XSTRINGIFY(s) +#define XSTRINGIFY(s) #s +#endif + +#ifndef OBJC_STRINGIFY +#define OBJC_STRINGIFY(s) OBJC_XSTRINGIFY(s) +#define OBJC_XSTRINGIFY(s) @#s +#endif + +#ifndef PTR2LONG +#define PTR2LONG(P) (((char*)(P))-(char*)0) +#endif +#ifndef LONG2PTR +#define LONG2PTR(L) (((char*)0)+(L)) +#endif + +#if VSPRINTF_RETURNS_LENGTH +#define VSPRINTF_LENGTH(VSPF_CALL) (VSPF_CALL) +#else +#define VSPRINTF_LENGTH(VSPF_CALL) strlen((VSPF_CALL)) +#endif /* VSPRINTF_RETURNS_LENGTH */ + +#if VASPRINTF_RETURNS_LENGTH +#define VASPRINTF_LENGTH(VASPF_CALL) (VASPF_CALL) +#else +#define VASPRINTF_LENGTH(VASPF_CALL) strlen((VASPF_CALL)) +#endif /* VSPRINTF_RETURNS_LENGTH */ + +/* Evil hack to stop gcc-4.1 complaining about a dealloc method which + * does not call the superclass implementation. + */ +#define GSNOSUPERDEALLOC if (0) [super dealloc] + +#ifndef CF_EXCLUDE_CSTD_HEADERS +#include <sys/types.h> +#include <stdarg.h> +#include <assert.h> +#include <ctype.h> +#include <errno.h> +#include <float.h> +#include <limits.h> +#include <locale.h> +#include <math.h> +#include <setjmp.h> +#include <signal.h> +#include <stddef.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <time.h> +#include <stdbool.h> +#endif + +#if !__has_feature(objc_arc) +// NetBSD > 6 defines __weak in cdefs_elf.h +#ifdef __NetBSD__ +#undef __weak +#endif +# if !defined(__weak) +# define __weak +# endif +# if !defined(__strong) +# define __strong +# endif +#endif + +#ifndef __unsafe_unretained +# if !__has_feature(objc_arc) +# define __unsafe_unretained +# endif +#endif +#ifndef __bridge +# if !__has_feature(objc_arc) +# define __bridge +# endif +#endif + +#if __has_builtin(__builtin_unreachable) +# define GS_UNREACHABLE() __builtin_unreachable() +#else +# define GS_UNREACHABLE() abort() +#endif + +#endif /* included_GSConfig_h */ + diff --git a/gcc/testsuite/objc-obj-c++-shared/GNUStep/GNUstepBase/GSObjCRuntime.h b/gcc/testsuite/objc-obj-c++-shared/GNUStep/GNUstepBase/GSObjCRuntime.h new file mode 100644 index 00000000000..2088ee2e886 --- /dev/null +++ b/gcc/testsuite/objc-obj-c++-shared/GNUStep/GNUstepBase/GSObjCRuntime.h @@ -0,0 +1,631 @@ +/** Interface to ObjC runtime for GNUStep + Copyright (C) 1995, 1997, 2000, 2002, 2003 Free Software Foundation, Inc. + + Written by: Andrew Kachites McCallum <mccallum@gnu.ai.mit.edu> + Date: 1995 + Written by: Richard Frith-Macdonald <rfm@gnu.org> + Date: 2002 + + This file is part of the GNUstep Base Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, 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 + Library General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02111 USA. + + AutogsdocSource: Additions/GSObjCRuntime.m + + */ + +#ifndef __GSObjCRuntime_h_GNUSTEP_BASE_INCLUDE +#define __GSObjCRuntime_h_GNUSTEP_BASE_INCLUDE + +#import "GSVersionMacros.h" +#import "GSConfig.h" + +#include <stdio.h> + +#if 1 || NeXT_RUNTIME + #include <objc/objc.h> + #include <objc/objc-class.h> + #include <objc/objc-runtime.h> + #ifndef _C_ATOM + #define _C_ATOM '%' + #endif + #define _F_CONST 0x01 + #define _F_IN 0x01 + #define _F_OUT 0x02 + #define _F_INOUT 0x03 + #define _F_BYCOPY 0x04 + #define _F_ONEWAY 0x08 + #define _C_CONST 'r' + #define _C_IN 'n' + #define _C_INOUT 'N' + #define _C_OUT 'o' + #define _C_BYCOPY 'O' + #define _C_ONEWAY 'V' +#else /* GNU Objective C Runtime */ + #include <objc/objc.h> + #if defined (__GNU_LIBOBJC__) + #include <objc/runtime.h> + #else + #include <objc/objc-api.h> + #include <objc/encoding.h> + #endif +#endif + +/* + * Hack for older compiler versions that don't have all defines + * needed in objc-api.h + */ +#ifndef _C_LNG_LNG +#define _C_LNG_LNG 'q' +#endif +#ifndef _C_ULNG_LNG +#define _C_ULNG_LNG 'Q' +#endif + +#if OBJC2RUNTIME +/* We have a real ObjC2 runtime. + */ +#include <objc/runtime.h> +#else +/* We emulate an ObjC2 runtime. + */ +#include <ObjectiveC2/objc/runtime.h> +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +@class NSArray; +@class NSDictionary; +@class NSObject; +@class NSString; +@class NSValue; + +#ifndef YES +#define YES 1 +#endif +#ifndef NO +#define NO 0 +#endif +#ifndef nil +#define nil 0 +#endif + +#if !defined(_C_CONST) +#define _C_CONST 'r' +#endif +#if !defined(_C_IN) +#define _C_IN 'n' +#endif +#if !defined(_C_INOUT) +#define _C_INOUT 'N' +#endif +#if !defined(_C_OUT) +#define _C_OUT 'o' +#endif +#if !defined(_C_BYCOPY) +#define _C_BYCOPY 'O' +#endif +#if !defined(_C_BYREF) +#define _C_BYREF 'R' +#endif +#if !defined(_C_ONEWAY) +#define _C_ONEWAY 'V' +#endif +#if !defined(_C_GCINVISIBLE) +#define _C_GCINVISIBLE '!' +#endif + +/* + * Functions for accessing instance variables directly - + * We can copy an ivar into arbitrary data, + * Get the type encoding for a named ivar, + * and copy a value into an ivar. + */ +GS_EXPORT BOOL +GSObjCFindVariable(id obj, const char *name, + const char **type, unsigned int *size, int *offset); + +GS_EXPORT void +GSObjCGetVariable(id obj, int offset, unsigned int size, void *data); + +GS_EXPORT void +GSObjCSetVariable(id obj, int offset, unsigned int size, const void *data); + +GS_EXPORT NSArray * +GSObjCMethodNames(id obj, BOOL recurse); + +GS_EXPORT NSArray * +GSObjCVariableNames(id obj, BOOL recurse); + +/** + * <p>A Behavior can be seen as a "Protocol with an implementation" or a + * "Class without any instance variables". A key feature of behaviors + * is that they give a degree of multiple inheritance. + * </p> + * <p>Behavior methods, when added to a class, override the class's + * superclass methods, but not the class's methods. + * </p> + * <p>Whan a behavior class is added to a receiver class, not only are the + * methods defined in the behavior class added, but the methods from the + * behavior's class hierarchy are also added (unless already present). + * </p> + * <p>It's not the case that a class adding behaviors from another class + * must have "no instance vars". The receiver class just has to have the + * same layout as the behavior class (optionally with some additional + * ivars after those of the behavior class). + * </p> + * <p>This function provides Behaviors without adding any new syntax to + * the Objective C language. Simply define a class with the methods you + * want to add, then call this function with that class as the behavior + * argument. + * </p> + * <p>This function should be called in the +initialize method of the receiver. + * </p> + * <p>If you add several behaviors to a class, be aware that the order of + * the additions is significant. + * </p> + */ +GS_EXPORT void +GSObjCAddClassBehavior(Class receiver, Class behavior); + +/** + * <p>An Override can be seen as a "category implemented as a separate class + * and manually added to the receiver class under program control, rather + * than automatically added by the compiler/runtime. + * </p> + * <p>Override methods, when added to a receiver class, replace the class's + * class's methods of the same name (or are added if the class did not define + * methods with that name). + * </p> + * <p>It's not the case that a class adding overrides from another class + * must have "no instance vars". The receiver class just has to have the + * same layout as the override class (optionally with some additional + * ivars after those of the override class). + * </p> + * <p>This function provides overrides without adding any new syntax to + * the Objective C language. Simply define a class with the methods you + * want to add, then call this function with that class as the override + * argument. + * </p> + * <p>This function should usually be called in the +initialize method + * of the receiver. + * </p> + * <p>If you add several overrides to a class, be aware that the order of + * the additions is significant. + * </p> + */ +GS_EXPORT void +GSObjCAddClassOverride(Class receiver, Class override); + +/** Turn on (YES), off (NO) or test (-1) behavior debugging. + */ +GS_EXPORT BOOL GSObjCBehaviorDebug(int setget); + +GS_EXPORT NSValue * +GSObjCMakeClass(NSString *name, NSString *superName, NSDictionary *iVars); + +GS_EXPORT void +GSObjCAddClasses(NSArray *classes); + +/** + * Given a NULL terminated list of methods, add them to the class.<br /> + * If the method already exists in a superclass, the new version overrides + * that one, but if the method already exists in the class itsself, the + * new one is quietly ignored (replace==NO) or replaced with the new + * version (if replace==YES).<br /> + * To add class methods, cls should be the metaclass of the class to + * which the methods are being added. + */ +GS_EXPORT void +GSObjCAddMethods(Class cls, Method *list, BOOL replace); + +/* + * Functions for key-value encoding ... they access values in an object + * either by selector or directly, but do so using NSNumber for the + * scalar types of data. + */ +GS_EXPORT id +GSObjCGetVal(NSObject *self, const char *key, SEL sel, + const char *type, unsigned size, int offset); + +GS_EXPORT void +GSObjCSetVal(NSObject *self, const char *key, id val, SEL sel, + const char *type, unsigned size, int offset); + +/* + * This section includes runtime functions + * to query and manipulate the ObjC runtime structures. + * These functions take care to not use ObjC code so + * that they can safely be used in +(void)load implementations + * where applicable. + */ + +/** + * Deprecated ... use objc_getClassList() + */ +GS_EXPORT unsigned int +GSClassList(Class *buffer, unsigned int max, BOOL clearCache); + +/** + * GSObjCClass() is deprecated ... use object_getClass() + */ +GS_EXPORT Class GSObjCClass(id obj); + +/** + * GSObjCSuper() is deprecated ... use class_getSuperclass() + */ +GS_EXPORT Class GSObjCSuper(Class cls); + +/** + * GSObjCIsInstance() is deprecated ... use object_getClass() + * in conjunction with class_isMetaClass() + */ +GS_EXPORT BOOL GSObjCIsInstance(id obj); + +/** + * GSObjCIsClass() is deprecated ... use object_getClass() + * in conjunction with class_isMetaClass() + */ +GS_EXPORT BOOL GSObjCIsClass(Class cls); + +/** + * Test to see if class inherits from another class + * The argument to this function must NOT be nil. + */ +GS_EXPORT BOOL GSObjCIsKindOf(Class cls, Class other); + +/** + * GSClassFromName() is deprecated ... use objc_lookUpClass() + */ +GS_EXPORT Class GSClassFromName(const char *name); + +/** + * GSNameFromClass() is deprecated ... use class_getName() + */ +GS_EXPORT const char *GSNameFromClass(Class cls); + +/** + * GSClassNameFromObject() is deprecated ... use object_getClass() + * in conjunction with class_getName() + */ +GS_EXPORT const char *GSClassNameFromObject(id obj); + +/** + * GSNameFromSelector() is deprecated ... use sel_getName() + */ +GS_EXPORT const char *GSNameFromSelector(SEL sel); + +/** + * GSSelectorFromName() is deprecated ... use sel_getUid() + */ +GS_EXPORT SEL +GSSelectorFromName(const char *name); + +/** + * Return the selector for the specified name and types.<br /> + * Returns a nul pointer if the name is nul.<br /> + * Creates a new selector if necessary.<br /> + * Code must NOT rely on this providing a selector with type information. + */ +GS_EXPORT SEL +GSSelectorFromNameAndTypes(const char *name, const char *types); + +/** + * Return the type information from the specified selector.<br /> + * May return a nul pointer if the selector was a nul pointer or if it + * was not typed (or if the runtime does not support typed selectors).<br /> + * Code must NOT rely on this providing any type information. + */ +GS_EXPORT const char * +GSTypesFromSelector(SEL sel); + +/** + * Compare only the type information ignoring qualifiers, the frame layout + * and register markers. Unlike sel_types_match, this function also + * handles comparisons of types with and without any layout information. + */ +GS_EXPORT BOOL +GSSelectorTypesMatch(const char *types1, const char *types2); + +/** Takes full type information and skips forward to the actual type + * as specified in the _C_... constants. + */ +GS_EXPORT const char * +GSSkipTypeQualifierAndLayoutInfo(const char *types); + +/** + * Returns a protocol object with the corresponding name. + * This function searches the registered classes for any protocol + * with the supplied name. If one is found, it is cached in + * for future requests. If efficiency is a factor then use + * GSRegisterProtocol() to insert a protocol explicitly into the cache + * used by this function. If no protocol is found this function returns + * nil. + */ +GS_EXPORT Protocol * +GSProtocolFromName(const char *name); + +/** + * Registers proto in the cache used by GSProtocolFromName(). + */ +GS_EXPORT void +GSRegisterProtocol(Protocol *proto); + +/** + * A variant of protocol_getMethodDescription which recursively searches + * parent protocols if the requested selector isn't found in the given + * protocol. + * + * Returns a {NULL, NULL} structure if the requested selector couldn't be + * found. + */ +GS_EXPORT struct objc_method_description +GSProtocolGetMethodDescriptionRecursive(Protocol *aProtocol, SEL aSel, BOOL isRequired, BOOL isInstance); + +/* + * Unfortunately the definition of the symbols + * 'Method(_t)', 'MethodList(_t)' and 'IVar(_t)' + * are incompatible between the GNU and NeXT/Apple runtimes. + * We introduce GSMethod, GSMethodList and GSIVar to allow portability. + */ +typedef Method GSMethod; +typedef Ivar GSIVar; + +/** + * Returns the pointer to the method structure + * for the selector in the specified class. + * Depending on searchInstanceMethods, this function searches + * either instance or class methods. + * Depending on searchSuperClassesm this function searches + * either the specified class only or also its superclasses.<br/> + * To obtain the implementation pointer IMP use returnValue->method_imp + * which should be safe across all runtimes.<br/> + * It should be safe to use this function in +load implementations.<br/> + * This function should currently (June 2004) be considered WIP. + * Please follow potential changes (Name, parameters, ...) closely until + * it stabilizes. + */ +GS_EXPORT GSMethod +GSGetMethod(Class cls, SEL sel, + BOOL searchInstanceMethods, + BOOL searchSuperClasses); + +/** + * Deprecated .. does nothing. + */ +GS_EXPORT void +GSFlushMethodCacheForClass (Class cls); + +/** + * Deprecated .. use class_getInstanceVariable() + */ +GS_EXPORT GSIVar +GSCGetInstanceVariableDefinition(Class cls, const char *name); + +/** + * Deprecated .. use class_getInstanceVariable() + */ +GS_EXPORT GSIVar +GSObjCGetInstanceVariableDefinition(Class cls, NSString *name); + +/** + * GSObjCVersion() is deprecated ... use class_getVersion() + */ +GS_EXPORT int GSObjCVersion(Class cls); + +/** + * Quickly return autoreleased data storage area. + */ +GS_EXPORT void * +GSAutoreleasedBuffer(unsigned size); + +/** + * <p>Prints a message to fptr using the format string provided and any + * additional arguments. The format string is interpreted as by + * the NSString formatted initialisers, and understands the '%@' syntax + * for printing an object. + * </p> + * <p>The data is written to the file pointer in the default CString + * encoding if possible, as a UTF8 string otherwise. + * </p> + * <p>This function is recommended for printing general log messages. + * For debug messages use NSDebugLog() and friends. For error logging + * use NSLog(), and for warnings you might consider NSWarnLog(). + * </p> + */ +GS_EXPORT BOOL +GSPrintf (FILE *fptr, NSString *format, ...); + + + +GS_EXPORT NSArray * +GSObjCAllSubclassesOfClass(Class cls); + +GS_EXPORT NSArray * +GSObjCDirectSubclassesOfClass(Class cls); + +/** Function to change the class of the specified instance to newClass. + * This handles memory debugging issues in GNUstep-base and also + * deals with class finalisation issues in a garbage collecting + * environment, so you should use this function rather than attempting + * to swizzle class pointers directly. + */ +GS_EXPORT void +GSClassSwizzle(id instance, Class newClass); + +#if !defined(GS_GNUSTEP_V) || (GS_GNUSTEP_V >= GS_API_ANY && GS_GNUSTEP_V < 011500) +//GS_API_VERSION(GS_API_ANY,011500) + +GS_EXPORT const char * +GSLastErrorStr(long error_id) GS_DEPRECATED_FUNC; + +#endif + + + +#ifndef GS_MAX_OBJECTS_FROM_STACK +/** + * The number of objects to try to get from varargs into an array on + * the stack ... if there are more than this, use the heap. + * NB. This MUST be a multiple of 2 + */ +#define GS_MAX_OBJECTS_FROM_STACK 128 +#endif + +/** + * <p>This is a macro designed to minimise the use of memory allocation and + * deallocation when you need to work with a vararg list of objects.<br /> + * The objects are unpacked from the vararg list into two 'C' arrays and + * then a code fragment you specify is able to make use of them before + * that 'C' array is destroyed. + * </p> + * <p>The firstObject argument is the name of the formal parameter in your + * method or function which precedes the ', ...' denoting variable args. + * </p> + * <p>The code argument is a piece of objective-c code to be executed to + * make use of the objects stored in the 'C' arrays.<br /> + * When this code is called the unsigned integer '__count' will contain the + * number of objects unpacked, the pointer '__objects' will point to + * the first object in each pair, and the pointer '__pairs' will point + * to an array containing the second halves of the pairs of objects + * whose first halves are in '__objects'.<br /> + * This lets you pack a list of the form 'key, value, key, value, ...' + * into an array of keys and an array of values. + * </p> + */ +#define GS_USEIDPAIRLIST(firstObject, code...) ({\ + va_list __ap; \ + unsigned int __max = GS_MAX_OBJECTS_FROM_STACK; \ + unsigned int __count = 0; \ + id __buf[__max]; \ + id *__objects = __buf; \ + id *__pairs = &__objects[__max/2]; \ + id __obj = firstObject; \ + va_start(__ap, firstObject); \ + while (__obj != nil && __count < __max) \ + { \ + if ((__count % 2) == 0) \ + { \ + __objects[__count/2] = __obj; \ + } \ + else \ + { \ + __pairs[__count/2] = __obj; \ + } \ + __obj = va_arg(__ap, id); \ + if (++__count == __max) \ + { \ + while (__obj != nil) \ + { \ + __count++; \ + __obj = va_arg(__ap, id); \ + } \ + } \ + } \ + if ((__count % 2) == 1) \ + { \ + __pairs[__count/2] = nil; \ + __count++; \ + } \ + va_end(__ap); \ + if (__count > __max) \ + { \ + unsigned int __tmp; \ + __objects = (id*)malloc(__count*sizeof(id)); \ + __pairs = &__objects[__count/2]; \ + __objects[0] = firstObject; \ + va_start(__ap, firstObject); \ + for (__tmp = 1; __tmp < __count; __tmp++) \ + { \ + if ((__tmp % 2) == 0) \ + { \ + __objects[__tmp/2] = va_arg(__ap, id); \ + } \ + else \ + { \ + __pairs[__tmp/2] = va_arg(__ap, id); \ + } \ + } \ + va_end(__ap); \ + } \ + code; \ + if (__objects != __buf) free(__objects); \ +}) + +/** + * <p>This is a macro designed to minimise the use of memory allocation and + * deallocation when you need to work with a vararg list of objects.<br /> + * The objects are unpacked from the vararg list into a 'C' array and + * then a code fragment you specify is able to make use of them before + * that 'C' array is destroyed. + * </p> + * <p>The firstObject argument is the name of the formal parameter in your + * method or function which precedes the ', ...' denoting variable args. + * </p> + * <p>The code argument is a piece of objective-c code to be executed to + * make use of the objects stored in the 'C' array.<br /> + * When this code is called the unsigned integer '__count' will contain the + * number of objects unpacked, and the pointer '__objects' will point to + * the unpacked objects, ie. firstObject followed by the vararg arguments + * up to (but not including) the first nil. + * </p> + */ +#define GS_USEIDLIST(firstObject, code...) ({\ + va_list __ap; \ + unsigned int __max = GS_MAX_OBJECTS_FROM_STACK; \ + unsigned int __count = 0; \ + id __buf[__max]; \ + id *__objects = __buf; \ + id __obj = firstObject; \ + va_start(__ap, firstObject); \ + while (__obj != nil && __count < __max) \ + { \ + __objects[__count] = __obj; \ + __obj = va_arg(__ap, id); \ + if (++__count == __max) \ + { \ + while (__obj != nil) \ + { \ + __count++; \ + __obj = va_arg(__ap, id); \ + } \ + } \ + } \ + va_end(__ap); \ + if (__count > __max) \ + { \ + unsigned int __tmp; \ + __objects = (id*)NSZoneMalloc(NSDefaultMallocZone(),__count*sizeof(id)); \ + va_start(__ap, firstObject); \ + __objects[0] = firstObject; \ + for (__tmp = 1; __tmp < __count; __tmp++) \ + { \ + __objects[__tmp] = va_arg(__ap, id); \ + } \ + va_end(__ap); \ + } \ + code; \ + if (__objects != __buf) NSZoneFree (NSDefaultMallocZone(),__objects); \ +}) + + +#ifdef __cplusplus +} +#endif + +#endif /* __GSObjCRuntime_h_GNUSTEP_BASE_INCLUDE */ diff --git a/gcc/testsuite/objc-obj-c++-shared/GNUStep/GNUstepBase/GSVersionMacros.h b/gcc/testsuite/objc-obj-c++-shared/GNUStep/GNUstepBase/GSVersionMacros.h new file mode 100644 index 00000000000..e7cfb5ea880 --- /dev/null +++ b/gcc/testsuite/objc-obj-c++-shared/GNUStep/GNUstepBase/GSVersionMacros.h @@ -0,0 +1,460 @@ +/* GSVersionMacros.h - macros for managing API versioning and visibility + Copyright (C) 2006-2014 Free Software Foundation, Inc. + + Written by: Richard Frith-Macdonald <rfm@gnu.org> + Date: Oct, October 2006 + + This file is part of GNUstep. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, 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 + Library General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef __GNUSTEP_GSVERSIONMACROS_H_INCLUDED_ +#define __GNUSTEP_GSVERSIONMACROS_H_INCLUDED_ + +/* By default we defined NO_GNUSTEP to 0 so that we will include extensions. + */ +#if !defined(NO_GNUSTEP) +# define NO_GNUSTEP 0 +#endif + +/* Check consistency of definitions for system compatibility. + */ +#if defined(STRICT_OPENSTEP) +# define GS_OPENSTEP_V 10000 +# undef NO_GNUSTEP +# define NO_GNUSTEP 1 +#elif defined(STRICT_MACOS_X) +# define GS_OPENSTEP_V 100600 +# undef NO_GNUSTEP +# define NO_GNUSTEP 1 +#endif + +/* Define the GS_OSX_ADJUST() macro to adjust OSX style version macros + * to GNUstep style version macros. + */ +#define GS_OSX_ADJUST(V) ((V) >= 10000 ? (V) : ((V)/100*10000 + (V)%100*10)) + +/* Define OSX compatibility version macros if necessary. + */ +#if !defined(MAC_OS_X_VERSION_10_0) +#define MAC_OS_X_VERSION_10_0 1000 +#define MAC_OS_X_VERSION_10_1 1010 +#define MAC_OS_X_VERSION_10_2 1020 +#define MAC_OS_X_VERSION_10_3 1030 +#define MAC_OS_X_VERSION_10_4 1040 +#define MAC_OS_X_VERSION_10_5 1050 +#define MAC_OS_X_VERSION_10_6 1060 +#define MAC_OS_X_VERSION_10_7 1070 +#define MAC_OS_X_VERSION_10_8 1080 +#define MAC_OS_X_VERSION_10_9 1090 +#define MAC_OS_X_VERSION_10_10 1100 +#define MAC_OS_X_VERSION_10_11 1110 +#define MAC_OS_X_VERSION_10_12 1120 +#define MAC_OS_X_VERSION_10_13 1130 +#define MAC_OS_X_VERSION_10_14 1140 +#endif /* MAC_OS_X_VERSION_10_0 */ + +/* Allow MAC_OS_X_VERSION_MAX_ALLOWED to be used in place of GS_OPENSTEP_V + * if GS_OPENSTEP_V is not defined. + */ +#ifndef GS_OPENSTEP_V +#ifdef MAC_OS_X_VERSION_MAX_ALLOWED +#define GS_OPENSTEP_V GS_OSX_ADJUST(MAC_OS_X_VERSION_MAX_ALLOWED) +#endif /* MAC_OS_X_VERSION_MAX_ALLOWED */ +#endif /* GS_OPENSTEP_V */ + +/* + * NB. The version values below must be integers ... by convention these are + * made up of two digits each for major, minor and subminor version numbers + * (ie each is in the range 00 to 99 though a leading zero in the major + * number is not permitted). + * So for a MacOS-X 10.3.9 release the version number would be 100309 + * + * You may define GS_GNUSTEP_V or GS_OPENSTEP_V to ensure that your + * program only 'sees' the specified varsion of the API. + */ + +/** + * <p>Macro to check a defined GNUstep version number (GS_GNUSTEP_V) against + * the supplied arguments. Returns true if no GNUstep version is specified, + * or if ADD <= version < REM, where ADD is the version + * number at which a feature guarded by the macro was introduced and + * REM is the version number at which it was removed. + * </p> + * <p>The version number arguments are six digit integers where the first + * two digits are the major version number, the second two are the minor + * version number and the last two are the subminor number (all left padded + * with a zero where necessary). However, for convenience you can also + * use the predefined constants ... + * <ref type="macro" id="GS_API_NONE">GS_API_NONE</ref>, + * <ref type="macro" id="GS_API_LATEST">GS_API_LATEST</ref>, + * </p> + * <p>Also see <ref type="macro" id="OS_API_VERSION">OS_API_VERSION</ref> + * </p> + * <p>NB. If you are changing the API (eg adding a new feature) you need + * to control the visibility io the new header file code using<br /> + * <code>#if GS_API_VERSION(ADD,GS_API_LATEST)</code><br /> + * where <code>ADD</code> is the version number of the next minor + * release after the most recent one.<br /> + * As a general principle you should <em>not</em> change the API with + * changing subminor version numbers ... as that tends to confuse + * people (though Apple has sometimes done it). + * </p> + */ +#define GS_API_VERSION(ADD,REM) \ + (!defined(GS_GNUSTEP_V) || (GS_GNUSTEP_V >= ADD && GS_GNUSTEP_V < REM)) + +/** + * <p>Macro to check a defined OpenStep/OPENSTEP/MacOS-X version against the + * supplied arguments. Returns true if no version is specified, or if + * ADD <= version < REM, where ADD is the version + * number at which a feature guarded by the macro was introduced and + * REM is the version number at which it was removed. + * </p> + * <p>The version number arguments are six digit integers where the first + * two digits are the major version number, the second two are the minor + * version number and the last two are the subminor number (all left padded + * with a zero where necessary). However, for convenience you can also + * use any of several predefined constants ... + * <ref type="macro" id="GS_API_NONE">GS_API_NONE</ref>, + * <ref type="macro" id="GS_API_LATEST">GS_API_LATEST</ref>, + * <ref type="macro" id="GS_API_OSSPEC">GS_API_OSSPEC</ref>, + * <ref type="macro" id="GS_API_OPENSTEP">GS_API_OPENSTEP</ref>, + * <ref type="macro" id="GS_API_MACOSX">GS_API_MACOSX</ref> + * </p> + * <p>Also see <ref type="macro" id="GS_API_VERSION">GS_API_VERSION</ref> + * </p> + * <p>For OSX compatibility, this macro also supports the use of Apple's + * symbolic constants for version numbering. Their contants are currently + * four digit values (two digits for the major version, one for the minor, + * and one for the subminor). + * </p> + * <p>The Apple compatibility version macros are currently: + * <ref type="macro" id="MAC_OS_X_VERSION_10_0">MAC_OS_X_VERSION_10_0</ref>, + * <ref type="macro" id="MAC_OS_X_VERSION_10_1">MAC_OS_X_VERSION_10_1</ref>, + * <ref type="macro" id="MAC_OS_X_VERSION_10_2">MAC_OS_X_VERSION_10_2</ref>, + * <ref type="macro" id="MAC_OS_X_VERSION_10_3">MAC_OS_X_VERSION_10_3</ref>, + * <ref type="macro" id="MAC_OS_X_VERSION_10_4">MAC_OS_X_VERSION_10_4</ref>, + * <ref type="macro" id="MAC_OS_X_VERSION_10_5">MAC_OS_X_VERSION_10_5</ref>, + * <ref type="macro" id="MAC_OS_X_VERSION_10_6">MAC_OS_X_VERSION_10_6</ref>, + * <ref type="macro" id="MAC_OS_X_VERSION_10_7">MAC_OS_X_VERSION_10_7</ref>, + * <ref type="macro" id="MAC_OS_X_VERSION_10_8">MAC_OS_X_VERSION_10_8</ref> + * <ref type="macro" id="MAC_OS_X_VERSION_10_9">MAC_OS_X_VERSION_10_9</ref> + * </p> + */ +#define OS_API_VERSION(ADD,REM) \ + (!defined(GS_OPENSTEP_V) \ + || (GS_OPENSTEP_V>=GS_OSX_ADJUST(ADD) && GS_OPENSTEP_V<GS_OSX_ADJUST(REM))) + +/** + * A constant which is the lowest possible version number (0) so that + * when used as the removal version (second argument of the GS_API_VERSION + * or OS_API_VERSION macro) represents a feature which is not present in + * any version.<br /> + * eg.<br /> + * #if <ref type="macro" id="OS_API_VERSION">OS_API_VERSION</ref> + * (GS_API_NONE, GS_API_NONE)<br /> + * denotes code not present in OpenStep/OPENSTEP/MacOS-X + */ +#define GS_API_NONE 0 + +/** + * A constant to represent a feature which is still present in the latest + * version. This is the highest possible version number.<br /> + * eg.<br /> + * #if <ref type="macro" id="OS_API_VERSION">OS_API_VERSION</ref> + * (GS_API_MACOSX, GS_API_LATEST)<br /> + * denotes code present from the initial MacOS-X version onwards. + */ +#define GS_API_LATEST 999999 + +/** + * The version number of the initial OpenStep specification.<br /> + * eg.<br /> + * #if <ref type="macro" id="OS_API_VERSION">OS_API_VERSION</ref> + * (GS_API_OSSPEC, GS_API_LATEST)<br /> + * denotes code present from the OpenStep specification onwards. + */ +#define GS_API_OSSPEC 10000 + +/** + * The version number of the first OPENSTEP implementation.<br /> + * eg.<br /> + * #if <ref type="macro" id="OS_API_VERSION">OS_API_VERSION</ref> + * (GS_API_OPENSTEP, GS_API_LATEST)<br /> + * denotes code present from the initial OPENSTEP version onwards. + */ +#define GS_API_OPENSTEP 40000 + +/** + * The version number of the first MacOS-X implementation.<br /> + * eg.<br /> + * #if <ref type="macro" id="OS_API_VERSION">OS_API_VERSION</ref> + * (GS_API_MACOSX, GS_API_LATEST)<br /> + * denotes code present from the initial MacOS-X version onwards. + */ +#define GS_API_MACOSX 100000 + +/* Allow OSX code comparing MAC_OS_X_VERSION_MAX_ALLOWED with a specific + * version to see if that version is allowed, to always have it allowed + * on GNUstep. + */ +#ifndef MAC_OS_X_VERSION_MAX_ALLOWED +#define MAC_OS_X_VERSION_MAX_ALLOWED GS_API_LATEST +#endif /* MAC_OS_X_VERSION_MAX_ALLOWED */ + + +#if defined(GNUSTEP_BASE_INTERNAL) +#include "GNUstepBase/GSConfig.h" +#else +#include "GSConfig.h" +#endif + + +#if defined(__GNUC__) && defined(__GNUC_MINOR__) && !defined(__clang__) +# define GS_GCC_MINREQ(maj, min) \ + ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min)) +#else +# define GS_GCC_MINREQ(maj, min) 0 +#endif + +#if defined(__clang__) +# define GS_CLANG_MINREQ(maj, min) \ + ((__clang_major__ << 16) + __clang_minor__ >= ((maj) << 16) + (min)) +#else +# define GS_CLANG_MINREQ(maj, min) 0 +#endif + +/* Attribute definitions for attributes which may or may not be supported + * depending on the compiler being used. + * NB we currently expect gcc to be version 4 or later. + * + * The definition should be of the form GS_XXX_CONTEXT where XXX is the + * name of the attribute and CONTEXT is one of FUNC, METH, or IVAR + * depending on where the attribute can be applied. + */ + +#if defined(__clang__) || GS_GCC_MINREQ(3,1) +# define GS_DEPRECATED_FUNC __attribute__ ((deprecated)) +#else +# define GS_DEPRECATED_FUNC +#endif + +#define GS_UNUSED_ARG __attribute__((unused)) + +#define GS_UNUSED_FUNC __attribute__((unused)) + +// FIXME ... what version of gcc? +#if __clang__ +# define GS_UNUSED_IVAR __attribute__((unused)) +#else +# define GS_UNUSED_IVAR +#endif + + + +#ifndef __has_feature +#define __has_feature(x) 0 +#endif + +/* The following is for deciding whether private instance variables + * should be visible ... if we are building with a compiler which + * does not define __has_feature then we know we don't have non-fragile + * ivar support. + * In the header we bracket instance variable declarations in a + * '#if GS_EXPOSE(classname) ... #endif' sequence, so that the variables + * will not be visible to code which uses the library. + * In the source file we define EXPOSE_classname_IVARS to be 1 + * before including the header, so that the ivars are always available + * in the class source itsself + */ + +#if GS_MIXEDABI +# undef GS_NONFRAGILE +# define GS_NONFRAGILE 0 /* Mixed is treated as fragile */ +#else +# if (__has_feature(objc_nonfragile_abi)) +# if !GS_NONFRAGILE +# if defined(GNUSTEP_BASE_INTERNAL) +# error "You are building gnustep-base using the objc-nonfragile-abi but your gnustep-base was not configured to use it." +# endif +# endif +# else +# if GS_NONFRAGILE +# error "Your gnustep-base was configured for the objc-nonfragile-abi but you are not using it now." +# endif +# endif +#endif + +#define GS_EXPOSE(X) (!GS_NONFRAGILE || defined(EXPOSE_##X##_IVARS)) + +/* Static analyser macros: Provide annotations to help the analyser */ +#ifdef __clang__ +# define GS_NORETURN_METHOD __attribute__((__noreturn__)) +#else +# define GS_NORETURN_METHOD +#endif + +#ifndef NS_RETURNS_RETAINED +# if __has_feature(attribute_ns_returns_retained) +# define NS_RETURNS_RETAINED __attribute__((ns_returns_retained)) +# else +# define NS_RETURNS_RETAINED +# endif +#endif + +#ifndef NS_RETURNS_NOT_RETAINED +# if __has_feature(attribute_ns_returns_not_retained) +# define NS_RETURNS_NOT_RETAINED __attribute__((ns_returns_not_retained)) +# else +# define NS_RETURNS_NOT_RETAINED +# endif +#endif + +#ifndef NS_CONSUMED +# if __has_feature(attribute_ns_consumed) +# define NS_CONSUMED __attribute__((ns_consumed)) +# else +# define NS_CONSUMED +# endif +#endif + + +#ifndef NS_CONSUMES_SELF +# if __has_feature(attribute_ns_consumes_self) +# define NS_CONSUMES_SELF __attribute__((ns_consumes_self)) +# else +# define NS_CONSUMES_SELF +# endif +#endif + +#if defined(__clang__) && defined(__OBJC__) +static inline void gs_consumed(id NS_CONSUMED o) GS_UNUSED_FUNC; +static inline void gs_consumed(id NS_CONSUMED GS_UNUSED_ARG o) { return; } +#define GS_CONSUMED(O) gs_consumed(O); +#else +#define GS_CONSUMED(O) +#endif + +/* Include the appropriate header for ObjC2 blocks support if it is in use. + * + * FIXME: "OBJC2RUNTIME" is set to "1" if the runtime supports the ObjC2 + * runtime API, which is unrelated to whether the compiler has blocks + * support or not. + */ +#if __has_feature(blocks) +# if OBJC2RUNTIME +# if defined(__APPLE__) +# include <Block.h> +# else +# include <objc/blocks_runtime.h> +# endif +# else +# include <ObjectiveC2/blocks_runtime.h> +# endif +#endif + +/* Attribute definition for root classes, annotates the interface declaration + * of the class. + */ +#ifndef GS_ROOT_CLASS +# if GS_HAVE_OBJC_ROOT_CLASS_ATTR || __has_feature(attribute_objc_root_class) +# define GS_ROOT_CLASS __attribute__((objc_root_class)) +# else +# define GS_ROOT_CLASS +# endif +#endif + + + +#if defined(GNUSTEP_WITH_DLL) + +#if BUILD_libgnustep_base_DLL +# +# if defined(__MINGW__) + /* On Mingw, the compiler will export all symbols automatically, so + * __declspec(dllexport) is not needed. + */ +# define GS_EXPORT extern +# define GS_DECLARE +# else +# define GS_EXPORT __declspec(dllexport) +# define GS_DECLARE __declspec(dllexport) +# endif +#else +# define GS_EXPORT extern __declspec(dllimport) +# define GS_DECLARE __declspec(dllimport) +#endif + +#else /* GNUSTEP_WITH[OUT]_DLL */ + +# define GS_EXPORT extern +# define GS_DECLARE + +#endif + + +/* Attribute macros compatible with Apple. + */ + +#ifndef NS_FORMAT_ARGUMENT +#if defined(__clang__) || GS_GCC_MINREQ(4,2) +# define NS_FORMAT_ARGUMENT(A) __attribute__((format_arg(A))) +#else +# define NS_FORMAT_ARGUMENT(F,A) +#endif +#endif + +// FIXME ... what version of gcc? +#ifndef NS_FORMAT_FUNCTION +#if __clang__ +# define NS_FORMAT_FUNCTION(F,A) __attribute__((format(__NSString__, F, A))) +#else +# define NS_FORMAT_FUNCTION(F,A) +#endif +#endif + +#ifndef NS_REQUIRES_NIL_TERMINATION +#define NS_REQUIRES_NIL_TERMINATION __attribute__((sentinel)) +#endif + +// FIXME ... what exact version of clang and gcc? +#ifndef UNAVAILABLE_ATTRIBUTE +#if defined(__clang__) || GS_GCC_MINREQ(4,0) +# define UNAVAILABLE_ATTRIBUTE __attribute__((unavailable)) +#else +# define UNAVAILABLE_ATTRIBUTE +#endif +#endif + +/* Check if compiler supports @optional in protocols + */ +#if defined(__clang__) || GS_GCC_MINREQ(4,6) +# define GS_PROTOCOLS_HAVE_OPTIONAL 1 +#else +# define GS_PROTOCOLS_HAVE_OPTIONAL 0 +#endif + +/* Check if compiler supports declared properties + */ +#if defined(__clang__) || GS_GCC_MINREQ(4,6) +# define GS_HAS_DECLARED_PROPERTIES 1 +#else +# define GS_HAS_DECLARED_PROPERTIES 0 +#endif + +#endif /* __GNUSTEP_GSVERSIONMACROS_H_INCLUDED_ */ diff --git a/gcc/testsuite/objc-obj-c++-shared/GNUStep/GNUstepBase/NSArray+GNUstepBase.h b/gcc/testsuite/objc-obj-c++-shared/GNUStep/GNUstepBase/NSArray+GNUstepBase.h new file mode 100644 index 00000000000..c9b595aa2f6 --- /dev/null +++ b/gcc/testsuite/objc-obj-c++-shared/GNUStep/GNUstepBase/NSArray+GNUstepBase.h @@ -0,0 +1,78 @@ +/** Declaration of extension methods for base additions + + Copyright (C) 2003-2010 Free Software Foundation, Inc. + + Written by: Richard Frith-Macdonald <rfm@gnu.org> + and: Adam Fedor <fedor@gnu.org> + + This file is part of the GNUstep Base Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, 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 + Library General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02111 USA. + +*/ + +#ifndef INCLUDED_NSArray_GNUstepBase_h +#define INCLUDED_NSArray_GNUstepBase_h + +#import "../GNUstepBase/GSVersionMacros.h" +#import "../Foundation/NSArray.h" + +#if defined(__cplusplus) +extern "C" { +#endif + +#if OS_API_VERSION(GS_API_NONE,GS_API_LATEST) + +@interface NSArray (GNUstepBase) + +/** <p>Method for working with sorted arrays - use a binary chop + * to determine the insertion location for an object. If equal objects + * already exist in the array, they will be located immediately before + * the insertion position. + * </p> + * <p>The comparator function takes two items as arguments, the first is the + * item to be added, the second is the item already in the array. + * The function should return NSOrderedAscending if the item to be + * added is 'less than' the item in the array, NSOrderedDescending + * if it is greater, and NSOrderedSame if it is equal. + * </p> + */ +- (NSUInteger) insertionPosition: (id)item + usingFunction: (NSComparisonResult (*)(id, id, void *))sorter + context: (void *)context; + +/* <p>Method for working with sorted arrays - use a binary chop + * to determine the insertion location for an object. If equal objects + * already exist in the array, they will be located immediately before + * the insertion position. + * </p> + * <p>The selector identifies a method returning NSOrderedAscending if + * the receiver is 'less than' the argument, and NSOrderedDescending if + * it is greate. + * </p> + */ +- (NSUInteger) insertionPosition: (id)item + usingSelector: (SEL)comp; +@end + +#endif /* OS_API_VERSION */ + +#if defined(__cplusplus) +} +#endif + +#endif /* INCLUDED_NSArray_GNUstepBase_h */ + diff --git a/gcc/testsuite/objc-obj-c++-shared/GNUStep/GNUstepBase/NSMutableString+GNUstepBase.h b/gcc/testsuite/objc-obj-c++-shared/GNUStep/GNUstepBase/NSMutableString+GNUstepBase.h new file mode 100644 index 00000000000..b3f71909c0c --- /dev/null +++ b/gcc/testsuite/objc-obj-c++-shared/GNUStep/GNUstepBase/NSMutableString+GNUstepBase.h @@ -0,0 +1,57 @@ +/** Declaration of extension methods for base additions + + Copyright (C) 2003-2010 Free Software Foundation, Inc. + + Written by: Richard Frith-Macdonald <rfm@gnu.org> + and: Adam Fedor <fedor@gnu.org> + + This file is part of the GNUstep Base Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, 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 + Library General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02111 USA. + +*/ + +#ifndef INCLUDED_NSMutableString_GNUstepBase_h +#define INCLUDED_NSMutableString_GNUstepBase_h + +#import "GSVersionMacros.h" +#import "../Foundation/NSString.h" + +#if defined(__cplusplus) +extern "C" { +#endif + +#if OS_API_VERSION(GS_API_NONE,GS_API_LATEST) + +@interface NSMutableString (GNUstepBase) +- (void) deleteSuffix: (NSString*)suffix; +- (void) deletePrefix: (NSString*)prefix; +- (NSString*) immutableProxy; +- (void) replaceString: (NSString*)replace + withString: (NSString*)by; +- (void) trimLeadSpaces; +- (void) trimTailSpaces; +- (void) trimSpaces; +@end + +#endif /* OS_API_VERSION */ + +#if defined(__cplusplus) +} +#endif + +#endif /* INCLUDED_NSMutableString_GNUstepBase_h */ + diff --git a/gcc/testsuite/objc-obj-c++-shared/GNUStep/GNUstepBase/NSNumber+GNUstepBase.h b/gcc/testsuite/objc-obj-c++-shared/GNUStep/GNUstepBase/NSNumber+GNUstepBase.h new file mode 100644 index 00000000000..1bed065303b --- /dev/null +++ b/gcc/testsuite/objc-obj-c++-shared/GNUStep/GNUstepBase/NSNumber+GNUstepBase.h @@ -0,0 +1,56 @@ +/** Declaration of extension methods for base additions + + Copyright (C) 2003-2010 Free Software Foundation, Inc. + + Written by: Richard Frith-Macdonald <rfm@gnu.org> + and: Adam Fedor <fedor@gnu.org> + + This file is part of the GNUstep Base Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, 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 + Library General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02111 USA. + +*/ + +#ifndef INCLUDED_NSNumber_GNUstepBase_h +#define INCLUDED_NSNumber_GNUstepBase_h + +#import "GSVersionMacros.h" +#import "../Foundation/NSValue.h" + +#if defined(__cplusplus) +extern "C" { +#endif + +#if OS_API_VERSION(GS_API_NONE,GS_API_LATEST) + +@interface NSNumber(GNUstepBase) +/** + * Parses string as a <code>double</code>, <code>int</code>, or <code>unsigned + * int</code> depending on what characters are present. Uses + * <code>atof</code> and <code>atoi</code> which don't report errors, so be + * careful if the string might contain an invalid value. + */ ++ (NSValue*) valueFromString: (NSString *)string; +@end + +#endif /* OS_API_VERSION */ + +#if defined(__cplusplus) +} +#endif + +#endif /* INCLUDED_NSNumber_GNUstepBase_h */ + diff --git a/gcc/testsuite/objc-obj-c++-shared/GNUStep/GNUstepBase/NSObject+GNUstepBase.h b/gcc/testsuite/objc-obj-c++-shared/GNUStep/GNUstepBase/NSObject+GNUstepBase.h new file mode 100644 index 00000000000..d3b2574341b --- /dev/null +++ b/gcc/testsuite/objc-obj-c++-shared/GNUStep/GNUstepBase/NSObject+GNUstepBase.h @@ -0,0 +1,242 @@ +/** Declaration of extension methods for base additions + + Copyright (C) 2003-2010 Free Software Foundation, Inc. + + Written by: Richard Frith-Macdonald <rfm@gnu.org> + and: Adam Fedor <fedor@gnu.org> + + This file is part of the GNUstep Base Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, 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 + Library General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02111 USA. + +*/ + +#ifndef INCLUDED_NSObject_GNUstepBase_h +#define INCLUDED_NSObject_GNUstepBase_h + +#import "GSVersionMacros.h" +#import "../Foundation/NSObject.h" + +#if defined(__cplusplus) +extern "C" { +#endif + +#if OS_API_VERSION(GS_API_NONE,GS_API_LATEST) + +@class NSHashTable; + +@interface NSObject (GNUstepBase) + +/** + WARNING: The -compare: method for NSObject is deprecated + due to subclasses declaring the same selector with + conflicting signatures. + Comparision of arbitrary objects is not just meaningless + but also dangerous as most concrete implementations + expect comparable objects as arguments often accessing + instance variables directly. + This method will be removed in a future release. +*/ +- (NSComparisonResult) compare: (id)anObject; + +/** For backward compatibility only ... use class_isMetaClass() on the + * class of the receiver instead. + */ +- (BOOL) isInstance; + +/** DEPRECATED ... do not use. + * Transmutes the receiver into an immutable version of the same object + * and returns the result.<br /> + * If the receiver is not a mutable object or cannot be simply transmuted, + * then this method either returns the receiver unchanged or, + * if the force flag is set to YES, returns an autoreleased copy of the + * receiver.<br /> + * Mutable classes should override this default implementation.<br /> + * This method is used in methods which are declared to return immutable + * objects (eg. an NSArray), but which create and build mutable ones + * internally. + */ +- (id) makeImmutableCopyOnFail: (BOOL)force; + +/** Transmutes the receiver into an immutable version of the same object. + * Returns YES if the receiver has become immutable, NO otherwise.<br /> + * The default implementation returns NO.<br /> + * Mutable classes which have an immutable counterpart they can efficiently + * change into, should override to transmute themselves and return YES.<br /> + * Immutable classes should override this to simply return YES with no + * further action.<br /> + * This method is used in methods which are declared to return immutable + * objects (eg. an NSArray), but which create and build mutable ones + * internally. + */ +- (BOOL) makeImmutable; + +/** + * Message sent when an implementation wants to explicitly exclude a method + * (but cannot due to compiler constraint), and wants to make sure it is not + * called by mistake. Default implementation raises an exception at runtime. + */ +- (id) notImplemented: (SEL)aSel GS_NORETURN_METHOD; + +/** + * Message sent when an implementation wants to explicitly require a subclass + * to implement a method (but cannot at compile time since there is no + * <code>abstract</code> keyword in Objective-C). Default implementation + * raises an exception at runtime to alert developer that he/she forgot to + * override a method. + */ +- (id) subclassResponsibility: (SEL)aSel GS_NORETURN_METHOD; + +/** + * Message sent when an implementation wants to explicitly exclude a method + * (but cannot due to compiler constraint) and forbid that subclasses + * implement it. Default implementation raises an exception at runtime. If a + * subclass <em>does</em> implement this method, however, the superclass's + * implementation will not be called, so this is not a perfect mechanism. + */ +- (id) shouldNotImplement: (SEL)aSel GS_NORETURN_METHOD; + +@end + +/** This is an informal protocol ... classes may implement the method to + * report how much memory is used by the instance and any objects it acts + * as a container for. + */ +@interface NSObject(MemoryFootprint) +/* This method returns the memory usage of the receiver, excluding any + * objects already present in the exclude table.<br /> + * The argument is a hash table configured to hold non-retained pointer + * objects and is used to inform the receiver that its size should not + * be counted again if it's already in the table.<br /> + * The NSObject implementation returns zero if the receiver is in the + * table, but otherwise adds itself to the table and returns its memory + * footprint (the sum of all of its instance variables, but not any + * memory pointed to by those variables).<br /> + * Subclasses should override this method by calling the superclass + * implementation, and either return the result (if it was zero) or + * return that value plus the sizes of any memory owned by the receiver + * (eg found by calling the same method on objects pointed to by the + * receiver's instance variables). + */ +- (NSUInteger) sizeInBytesExcluding: (NSHashTable*)exclude; +@end + +/** This is an informal protocol ... classes may implement the method and + * register themselves to have it called on process exit. + */ +@interface NSObject(GSAtExit) +/** This method is called on exit for any class which implements it and which + * has called +registerAtExit to register it to be called.<br /> + * The order in which methods for different classes is called is the reverse + * of the order in which the classes were registered, but it's best to assume + * the method can not depend on any other class being in a usable state + * at the point when the method is called (rather like +load).<br /> + * Typical use would be to release memory occupied by class data structures + * so that memory usage analysis software will not think the memory has + * been leaked. + */ ++ (void) atExit; +@end + +/** Category for methods handling leaked memory cleanup on exit of process + * (for use when debugging memory leaks).<br /> + * You enable this by calling the +setShouldCleanUp: method (done implicitly + * by gnustep-base if the GNUSTEP_SHOULD_CLEAN_UP environment variable is + * set to YES).<br /> + * Your class then has two options for performing cleanup when the process + * ends: + * <p>1. Use the +leak: method to register objects which are simply to be + * retained until the process ends, and then either ignored or released + * depending on the cleanup setting in force. This mechanism is simple + * and should be sufficient for many classes. + * </p> + * <p>2. Implement a +atExit method to be run when the process ends and, + * within your +initialize implementation, call +shouldCleanUp to determine + * whether cleanup should be done, and if it returns YES then call + * +registerAtExit to have your +atExit method called when the process + * terminates. + * </p> + * <p>The order in which 'leaked' objects are released and +atExit methods + * are called on process exist is the reverse of the order in which they + * werse set up suing this API. + * </p> + */ +@interface NSObject(GSCleanup) + + +/** This method simply retains its argument so that it will never be + * deallocated during normal operation, but keeps track of it so that + * it is released during process exit if cleanup is enabled.<br /> + * Returns its argument. + */ ++ (id) NS_RETURNS_RETAINED leak: (id)anObject; + +/** This method retains the object at *anAddress so that it will never be + * deallocated during normal operation, but keeps track of the address + * so that the object is released and the address is zeroed during process + * exit if cleanup is enabled.<br /> + * Returns the object at *anAddress. + */ ++ (id) NS_RETURNS_RETAINED leakAt: (id*)anAddress; + +/** Sets the receiver to have its +atExit method called at the point when + * the process terminates.<br /> + * Returns YES on success and NO on failure (if the class does not implement + * the method or if it is already registered to call it).<br /> + * Implemented as a call to +registerAtExit: with the selector for the +atExit + * method as its argument. + */ ++ (BOOL) registerAtExit; + +/** Sets the receiver to have the specified method called at the point when + * the process terminates.<br /> + * Returns YES on success and NO on failure (if the class does not implement + * the method ir if it is already registered to call it). + */ ++ (BOOL) registerAtExit: (SEL)aSelector; + +/** Specifies the default cleanup behavior on process exit ... the value + * returned by the NSObject implementation of the +shouldClanUp method.<br /> + * Calling this method with a YES argument implicitly calls the +enableAtExit + * method as well.<br /> + * The GNUstep Base library calls this method with the value obtained from + * the GNUSTEP_SHOULD_CLEAN_UP environment variable when NSObject is + * initialised. + */ ++ (void) setShouldCleanUp: (BOOL)aFlag; + +/** Returns a flag indicating whether the receiver should clean up + * its data structures etc at process exit.<br /> + * The NSObject implementation returns the value set by the +setShouldCleanUp: + * method but subclasses may override this. + */ ++ (BOOL) shouldCleanUp; + +@end + +/* Macro to take an autoreleased object and either make it immutable or + * create an autoreleased copy of the original. + */ +#define GS_IMMUTABLE(O) ([O makeImmutable] == YES ? O : AUTORELEASE([O copy])) + +#endif /* OS_API_VERSION */ + +#if defined(__cplusplus) +} +#endif + +#endif /* INCLUDED_NSObject_GNUstepBase_h */ + diff --git a/gcc/testsuite/objc-obj-c++-shared/GNUStep/GNUstepBase/NSString+GNUstepBase.h b/gcc/testsuite/objc-obj-c++-shared/GNUStep/GNUstepBase/NSString+GNUstepBase.h new file mode 100644 index 00000000000..48633cde5d7 --- /dev/null +++ b/gcc/testsuite/objc-obj-c++-shared/GNUStep/GNUstepBase/NSString+GNUstepBase.h @@ -0,0 +1,105 @@ +/** Declaration of extension methods for base additions + + Copyright (C) 2003-2010 Free Software Foundation, Inc. + + Written by: Richard Frith-Macdonald <rfm@gnu.org> + and: Adam Fedor <fedor@gnu.org> + + This file is part of the GNUstep Base Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, 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 + Library General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02111 USA. + +*/ + +#ifndef INCLUDED_NSString_GNUstepBase_h +#define INCLUDED_NSString_GNUstepBase_h + +#import "GSVersionMacros.h" +#import "../Foundation/NSString.h" + +#if defined(__cplusplus) +extern "C" { +#endif + +#if OS_API_VERSION(GS_API_NONE,GS_API_LATEST) + +/** + * Provides some additional (non-standard) utility methods. + */ +@interface NSString (GNUstepBase) + +/** + * Alternate way to invoke <code>stringWithFormat</code> if you have or wish + * to build an explicit <code>va_list</code> structure. + */ ++ (id) stringWithFormat: (NSString*)format + arguments: (va_list)argList NS_FORMAT_FUNCTION(1,0); + +/** + * Returns a string formed by removing the prefix string from the + * receiver. Raises an exception if the prefix is not present. + */ +- (NSString*) stringByDeletingPrefix: (NSString*)prefix; + +/** + * Returns a string formed by removing the suffix string from the + * receiver. Raises an exception if the suffix is not present. + */ +- (NSString*) stringByDeletingSuffix: (NSString*)suffix; + +/** + * Returns a string formed by removing leading white space from the + * receiver. + */ +- (NSString*) stringByTrimmingLeadSpaces; + +/** + * Returns a string formed by removing trailing white space from the + * receiver. + */ +- (NSString*) stringByTrimmingTailSpaces; + +/** + * Returns a string formed by removing both leading and trailing + * white space from the receiver. + */ +- (NSString*) stringByTrimmingSpaces; + +/** + * Returns a string in which any (and all) occurrences of + * replace in the receiver have been replaced with by. + * Returns the receiver if replace + * does not occur within the receiver. NB. an empty string is + * not considered to exist within the receiver. + */ +- (NSString*) stringByReplacingString: (NSString*)replace + withString: (NSString*)by; + +/** + * An obsolete name for -substringWithRange: ... deprecated. + */ +- (NSString*) substringFromRange: (NSRange)aRange; + +@end + +#endif /* OS_API_VERSION */ + +#if defined(__cplusplus) +} +#endif + +#endif /* INCLUDED_NSString_GNUstepBase_h */ + diff --git a/gcc/testsuite/objc.dg/encode-7-next-64bit.m b/gcc/testsuite/objc.dg/encode-7-next-64bit.m index 4a418fc92b1..5686cb4c537 100644 --- a/gcc/testsuite/objc.dg/encode-7-next-64bit.m +++ b/gcc/testsuite/objc.dg/encode-7-next-64bit.m @@ -9,10 +9,11 @@ #include <stdbool.h> #include <string.h> #include <stdlib.h> -#include <Foundation/NSObject.h> +#include <stdio.h> +#include "../objc-obj-c++-shared/F-NSObject.h" +#include "../objc-obj-c++-shared/CF-CFString.h" #include "../objc-obj-c++-shared/runtime.h" -extern int printf(char *,...); void CHECK_IF(const char *s1, const char *s2) { if (strcmp(s1,s2) != 0) { diff --git a/gcc/testsuite/objc.dg/headers.m b/gcc/testsuite/objc.dg/headers.m index 355c2cf3c60..e628199f0cc 100644 --- a/gcc/testsuite/objc.dg/headers.m +++ b/gcc/testsuite/objc.dg/headers.m @@ -2,6 +2,7 @@ // test in libstdc++-v3). Author: Loren J. Rittle <ljrittle@acm.org>. // { dg-options "-Wall -Wpointer-arith -Wcast-qual -Wstrict-prototypes -Wshadow" } // { dg-do compile } +/* { dg-xfail-if "PR90709" { *-*-darwin1[4-9]* } { "-fnext-runtime" } { "" } } */ #ifdef __NEXT_RUNTIME__ #include <Foundation/NSString.h> diff --git a/gcc/testsuite/objc.dg/image-info.m b/gcc/testsuite/objc.dg/image-info.m index 09329130a73..b2effe5dc86 100644 --- a/gcc/testsuite/objc.dg/image-info.m +++ b/gcc/testsuite/objc.dg/image-info.m @@ -7,7 +7,7 @@ /* { dg-skip-if "NeXT-only" { *-*-* } { "-fgnu-runtime" } { "" } } */ /* { dg-options "-freplace-objc-classes" } */ -#include <Foundation/NSObject.h> +#include "../objc-obj-c++-shared/F-NSObject.h" extern void abort(void); #define CHECK_IF(expr) if(!(expr)) abort(); diff --git a/gcc/testsuite/objc.dg/isa-field-1.m b/gcc/testsuite/objc.dg/isa-field-1.m index 4501d01a11e..a786ec3deb5 100644 --- a/gcc/testsuite/objc.dg/isa-field-1.m +++ b/gcc/testsuite/objc.dg/isa-field-1.m @@ -1,5 +1,7 @@ /* Ensure there are no bizarre difficulties with accessing the 'isa' field of objects. */ /* { dg-do compile } */ +/* The use of isa is deprecated, but we still want to test that it works. */ +/* { dg-additional-options "-Wno-deprecated-declarations" } */ #include "../objc-obj-c++-shared/TestsuiteObject.h" #include "../objc-obj-c++-shared/runtime.h" diff --git a/gcc/testsuite/objc.dg/method-6.m b/gcc/testsuite/objc.dg/method-6.m index 35676b18f06..a90c7634da7 100644 --- a/gcc/testsuite/objc.dg/method-6.m +++ b/gcc/testsuite/objc.dg/method-6.m @@ -5,12 +5,12 @@ /* { dg-options "-Wstrict-selector-match" } */ #ifdef __NEXT_RUNTIME__ -#include <Foundation/NSObject.h> -#define OBJECT NSObject +# include "../objc-obj-c++-shared/F-NSObject.h" +# define OBJECT NSObject #else -#include <objc/Object.h> -#include <objc/Protocol.h> -#define OBJECT Object +# include <objc/Object.h> +# include <objc/Protocol.h> +# define OBJECT Object #endif @interface Base diff --git a/gcc/testsuite/objc.dg/no-extra-load.m b/gcc/testsuite/objc.dg/no-extra-load.m index f5e1d74563d..35bd1daf661 100644 --- a/gcc/testsuite/objc.dg/no-extra-load.m +++ b/gcc/testsuite/objc.dg/no-extra-load.m @@ -1,7 +1,7 @@ /* { dg-do compile { target *-*-darwin* } } */ /* { dg-skip-if "" { *-*-* } { "-fgnu-runtime" } { "" } } */ -#include <Foundation/NSObject.h> +#include "../objc-obj-c++-shared/F-NSObject.h" main() { [NSObject new]; } /* { dg-final { scan-assembler-not "L_objc_msgSend\\\$non_lazy_ptr" } } */ diff --git a/gcc/testsuite/objc.dg/objc-foreach-4.m b/gcc/testsuite/objc.dg/objc-foreach-4.m index 4d902f55882..c8dc074b267 100644 --- a/gcc/testsuite/objc.dg/objc-foreach-4.m +++ b/gcc/testsuite/objc.dg/objc-foreach-4.m @@ -5,9 +5,9 @@ /* { dg-skip-if "No NeXT fast enum. pre-Darwin9" { *-*-darwin[5-8]* } { "-fnext-runtime" } { "" } } */ /* { dg-additional-options "-framework Foundation" { target { *-*-darwin* } } } */ -#include <Foundation/NSString.h> -#include <Foundation/NSAutoreleasePool.h> -#include <Foundation/NSArray.h> +#include "../objc-obj-c++-shared/F-NSString.h" +#include "../objc-obj-c++-shared/F-NSAutoreleasePool.h" +#include "../objc-obj-c++-shared/F-NSArray.h" // gcc -o foo foo.m -framework Foundation diff --git a/gcc/testsuite/objc.dg/objc-foreach-5.m b/gcc/testsuite/objc.dg/objc-foreach-5.m index 7113a7ac262..e02bd7aa06d 100644 --- a/gcc/testsuite/objc.dg/objc-foreach-5.m +++ b/gcc/testsuite/objc.dg/objc-foreach-5.m @@ -4,8 +4,9 @@ /* { dg-skip-if "No NeXT fast enum. pre-Darwin9" { *-*-darwin[5-8]* } { "-fnext-runtime" } { "" } } */ /* { dg-additional-options "-framework Foundation" { target { *-*-darwin* } } } */ -#include <Foundation/NSArray.h> -#include <Foundation/NSAutoreleasePool.h> +#include "../objc-obj-c++-shared/F-NSArray.h" +#include "../objc-obj-c++-shared/F-NSAutoreleasePool.h" +#include "../objc-obj-c++-shared/F-NSValue.h" NSArray * createTestVictim(unsigned capacity) { NSMutableArray * arr = [[NSMutableArray alloc] initWithCapacity:capacity]; diff --git a/gcc/testsuite/objc.dg/objc-gc-4.m b/gcc/testsuite/objc.dg/objc-gc-4.m index 747da4d5199..96c32788dfe 100644 --- a/gcc/testsuite/objc.dg/objc-gc-4.m +++ b/gcc/testsuite/objc.dg/objc-gc-4.m @@ -3,6 +3,7 @@ /* Contributed by Ziemowit Laski <zlaski@apple.com> */ /* { dg-do compile } */ +/* { dg-skip-if "GC API is an error from Darwin16." { *-*-darwin1[6-8]* } { "-fnext-runtime" } { "" } } */ /* { dg-options "-fobjc-gc" } */ /* { dg-prune-output "cc1obj: warning: '-fobjc-gc' is ignored for '-fgnu-runtime'" } */ diff --git a/gcc/testsuite/objc.dg/proto-lossage-7.m b/gcc/testsuite/objc.dg/proto-lossage-7.m index b32cfd8a0dd..118a130fd9e 100644 --- a/gcc/testsuite/objc.dg/proto-lossage-7.m +++ b/gcc/testsuite/objc.dg/proto-lossage-7.m @@ -3,7 +3,7 @@ /* { dg-do compile } */ #ifdef __NEXT_RUNTIME__ -#include <Foundation/NSObject.h> +#include "../objc-obj-c++-shared/F-NSObject.h" #define OBJECT NSObject #else #include <objc/Object.h> diff --git a/gcc/testsuite/objc.dg/strings/const-cfstring-2.m b/gcc/testsuite/objc.dg/strings/const-cfstring-2.m index 14ae68c6c50..effe7f57bdc 100644 --- a/gcc/testsuite/objc.dg/strings/const-cfstring-2.m +++ b/gcc/testsuite/objc.dg/strings/const-cfstring-2.m @@ -8,8 +8,8 @@ /* { dg-skip-if "NeXT only" { *-*-* } { "-fgnu-runtime" } { "" } } */ /* { dg-options "-mconstant-cfstrings -Wnonportable-cfstrings" } */ -#import <Foundation/NSString.h> -#import <CoreFoundation/CFString.h> +#include "../../objc-obj-c++-shared/F-NSString.h" +#include "../../objc-obj-c++-shared/CF-CFString.h" #ifndef __CONSTANT_CFSTRINGS__ #error The -fconstant-cfstrings option is not functioning properly diff --git a/gcc/testsuite/objc.dg/strings/const-cfstring-5.m b/gcc/testsuite/objc.dg/strings/const-cfstring-5.m index 98bb7c5bddc..762afb6b1ba 100644 --- a/gcc/testsuite/objc.dg/strings/const-cfstring-5.m +++ b/gcc/testsuite/objc.dg/strings/const-cfstring-5.m @@ -6,7 +6,7 @@ /* { dg-skip-if "NeXT only" { *-*-* } { "-fgnu-runtime" } { "" } } */ /* { dg-options "-mconstant-cfstrings" } */ -#include <Foundation/NSObject.h> +#include "../../objc-obj-c++-shared/F-NSObject.h" @interface Foo: NSObject { char *cString; diff --git a/gcc/testsuite/objc.dg/strings/const-str-12b.m b/gcc/testsuite/objc.dg/strings/const-str-12b.m index d0dfb668ea9..e04f0f66660 100644 --- a/gcc/testsuite/objc.dg/strings/const-str-12b.m +++ b/gcc/testsuite/objc.dg/strings/const-str-12b.m @@ -6,11 +6,11 @@ /* { dg-options "-mno-constant-cfstrings -fconstant-string-class=Foo" { target *-*-darwin* } } */ #ifdef __NEXT_RUNTIME__ -#include <Foundation/NSObject.h> -#define OBJECT NSObject +# include "../../objc-obj-c++-shared/F-NSObject.h" +# define OBJECT NSObject #else -#include <objc/Object.h> -#define OBJECT Object +# include <objc/Object.h> +# define OBJECT Object #endif #include "../../objc-obj-c++-shared/objc-test-suite-types.h" diff --git a/gcc/testsuite/objc.dg/symtab-1.m b/gcc/testsuite/objc.dg/symtab-1.m index 04d747dbce1..e6e0b613923 100644 --- a/gcc/testsuite/objc.dg/symtab-1.m +++ b/gcc/testsuite/objc.dg/symtab-1.m @@ -4,7 +4,7 @@ /* { dg-do compile { target { *-*-darwin* } } } */ /* { dg-skip-if "" { *-*-* } { "-fgnu-runtime" } { "" } } */ -#include <Foundation/NSObject.h> +#include "../objc-obj-c++-shared/F-NSObject.h" @interface Base: NSObject - (void)setValues; diff --git a/gcc/testsuite/objc.dg/torture/strings/const-cfstring-1.m b/gcc/testsuite/objc.dg/torture/strings/const-cfstring-1.m index 7e989156419..a9c0ab666f1 100644 --- a/gcc/testsuite/objc.dg/torture/strings/const-cfstring-1.m +++ b/gcc/testsuite/objc.dg/torture/strings/const-cfstring-1.m @@ -13,8 +13,8 @@ Well, we don't implement writable ones at this juncture. */ /* { dg-options "-mconstant-cfstrings -framework Cocoa -Wl,-w" { target *-*-darwin[123]* } } */ -#import <Foundation/NSString.h> -#import <CoreFoundation/CFString.h> +#include "../../../objc-obj-c++-shared/F-NSString.h" +#include "../../../objc-obj-c++-shared/CF-CFString.h" #include <stdlib.h> void printOut(NSString *str) { diff --git a/gcc/testsuite/objc.dg/torture/strings/const-str-10.m b/gcc/testsuite/objc.dg/torture/strings/const-str-10.m index 120bcd94c7b..6565dc20007 100644 --- a/gcc/testsuite/objc.dg/torture/strings/const-str-10.m +++ b/gcc/testsuite/objc.dg/torture/strings/const-str-10.m @@ -6,7 +6,8 @@ /* { dg-skip-if "" { *-*-* } { "-fgnu-runtime" } { "" } } */ /* { dg-options "-mno-constant-cfstrings" { target *-*-darwin* } } */ -#include <Foundation/NSObject.h> +#include "../../../objc-obj-c++-shared/F-NSObject.h" +#include <stdlib.h> #include "../../../objc-obj-c++-shared/runtime.h" /* For NEXT_OBJC_USE_NEW_INTERFACE. */ @interface NSString: NSObject diff --git a/gcc/testsuite/objc.dg/torture/strings/const-str-11.m b/gcc/testsuite/objc.dg/torture/strings/const-str-11.m index 4c3f9eac893..2bdb1531e1d 100644 --- a/gcc/testsuite/objc.dg/torture/strings/const-str-11.m +++ b/gcc/testsuite/objc.dg/torture/strings/const-str-11.m @@ -7,7 +7,7 @@ /* { dg-options "-fconstant-string-class=XStr" } */ /* { dg-options "-mno-constant-cfstrings -fconstant-string-class=XStr" { target *-*-darwin* } } */ -#include <Foundation/NSObject.h> +#include "../../../objc-obj-c++-shared/F-NSObject.h" #include "../../../objc-obj-c++-shared/runtime.h" /* For NEXT_OBJC_USE_NEW_INTERFACE. */ @interface XString: NSObject { diff --git a/gcc/testsuite/objc.dg/torture/strings/const-str-9.m b/gcc/testsuite/objc.dg/torture/strings/const-str-9.m index d65aa01c044..966ea5e498d 100644 --- a/gcc/testsuite/objc.dg/torture/strings/const-str-9.m +++ b/gcc/testsuite/objc.dg/torture/strings/const-str-9.m @@ -5,7 +5,7 @@ /* { dg-skip-if "" { *-*-* } { "-fgnu-runtime" } { "" } } */ /* { dg-options "-mno-constant-cfstrings" { target *-*-darwin* } } */ -#include <Foundation/NSObject.h> +#include "../../../objc-obj-c++-shared/F-NSObject.h" #include "../../../objc-obj-c++-shared/runtime.h" /* For NEXT_OBJC_USE_NEW_INTERFACE. */ @interface NSConstantString: NSObject { diff --git a/gcc/testsuite/objc.dg/zero-link-1.m b/gcc/testsuite/objc.dg/zero-link-1.m index 812267bc376..e1148deb4a7 100644 --- a/gcc/testsuite/objc.dg/zero-link-1.m +++ b/gcc/testsuite/objc.dg/zero-link-1.m @@ -5,7 +5,7 @@ /* { dg-skip-if "" { *-*-* } { "-fgnu-runtime" } { "" } } */ /* { dg-options "-fzero-link" } */ -#include <Foundation/NSObject.h> +#include "../objc-obj-c++-shared/F-NSObject.h" extern void abort(void); #define CHECK_IF(expr) if(!(expr)) abort(); diff --git a/gcc/testsuite/objc.dg/zero-link-2.m b/gcc/testsuite/objc.dg/zero-link-2.m index 3bfe84d021d..19100919b3c 100644 --- a/gcc/testsuite/objc.dg/zero-link-2.m +++ b/gcc/testsuite/objc.dg/zero-link-2.m @@ -5,7 +5,7 @@ /* { dg-skip-if "" { *-*-* } { "-fgnu-runtime" } { "" } } */ /* { dg-options "-fno-zero-link" } */ -#include <Foundation/NSObject.h> +#include "../objc-obj-c++-shared/F-NSObject.h" extern void abort(void); #define CHECK_IF(expr) if(!(expr)) abort(); diff --git a/gcc/testsuite/objc.dg/zero-link-3.m b/gcc/testsuite/objc.dg/zero-link-3.m index 18f21db4e65..0c77c095d4d 100644 --- a/gcc/testsuite/objc.dg/zero-link-3.m +++ b/gcc/testsuite/objc.dg/zero-link-3.m @@ -7,12 +7,12 @@ /* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */ #ifdef __NEXT_RUNTIME__ -#include <Foundation/NSObject.h> -#define OBJECT NSObject +# include "../objc-obj-c++-shared/F-NSObject.h" +# define OBJECT NSObject #else -#include <objc/Object.h> -#include <objc/Protocol.h> -#define OBJECT Object +# include <objc/Object.h> +# include <objc/Protocol.h> +# define OBJECT Object #endif extern void abort(void); -- cgit v1.2.3 From 9af54304cecff133504040345bf6caacbe81ec31 Mon Sep 17 00:00:00 2001 From: Iain Sandoe <iain@sandoe.co.uk> Date: Sun, 1 Sep 2019 19:37:44 +0000 Subject: [PATCH, Ada] Push -shared-libgcc where needed. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Gnatlink has code that checks for duplicate '-shared-libgcc’ switches (but not duplicate ‘static-libgcc’) and also pushes ’static-libgcc' onto the link line for targets that default to static linking, provided '-shared-libgcc' is not present. For targets that should use a shared libgcc we need the same process to be applied (in inverse), in the event that they do not default to providing the shared flag implicitly. So this adds the complementary set of tests for the shared case and pushes the shared flag as needed. As a minor tidy-up there’s no need push duplicates of the libgcc switch onto the link line when one has already been seen (given by the user). The patch does not alter any of the platform defaults for static/shared libgcc, but it ensures that the intent of the link is explicit. 2019-09-01 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline. 2019-06-30 Iain Sandoe <iain@sandoe.co.uk> * gnatlink.adb (Link_Step): Push -shared-libgcc explicitly, when it is the target default (unless overidden by the static flag). When the user has put an instance of shared/static-libgcc do not push a duplicate of this. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@275282 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ada/ChangeLog | 10 ++++++++++ gcc/ada/gnatlink.adb | 30 +++++++++++++++++++++++++++++- 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index e77b0a82f84..66dd37ca13b 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,13 @@ +2019-09-01 Iain Sandoe <iain@sandoe.co.uk> + + Backport from mainline. + 2019-06-30 Iain Sandoe <iain@sandoe.co.uk> + + * gnatlink.adb (Link_Step): Push -shared-libgcc explicitly, when it + is the target default (unless overidden by the static flag). + When the user has put an instance of shared/static-libgcc do not push + a duplicate of this. + 2019-06-29 Eric Botcazou <ebotcazou@adacore.com> * gcc-interface/decl.c (gnat_to_gnu_entity): Beep up comment on SAVED, diff --git a/gcc/ada/gnatlink.adb b/gcc/ada/gnatlink.adb index 855d6d38a5b..45104a2ac4d 100644 --- a/gcc/ada/gnatlink.adb +++ b/gcc/ada/gnatlink.adb @@ -1882,6 +1882,7 @@ begin Clean_Link_Option_Set : declare J : Natural; Shared_Libgcc_Seen : Boolean := False; + Static_Libgcc_Seen : Boolean := False; begin J := Linker_Options.First; @@ -1903,7 +1904,7 @@ begin end if; end if; - -- Remove duplicate -shared-libgcc switch + -- Remove duplicate -shared-libgcc switches if Linker_Options.Table (J).all = Shared_Libgcc_String then if Shared_Libgcc_Seen then @@ -1917,6 +1918,20 @@ begin end if; end if; + -- Remove duplicate -static-libgcc switches + + if Linker_Options.Table (J).all = Static_Libgcc_String then + if Static_Libgcc_Seen then + Linker_Options.Table (J .. Linker_Options.Last - 1) := + Linker_Options.Table (J + 1 .. Linker_Options.Last); + Linker_Options.Decrement_Last; + Num_Args := Num_Args - 1; + + else + Static_Libgcc_Seen := True; + end if; + end if; + -- Here we just check for a canonical form that matches the -- pragma Linker_Options set in the NT runtime. @@ -1948,14 +1963,27 @@ begin -- libgcc, if gcc is not called with -shared-libgcc, call it -- with -static-libgcc, as there are some platforms where one -- of these two switches is compulsory to link. + -- Don't push extra switches if we already saw one. if Shared_Libgcc_Default = 'T' and then not Shared_Libgcc_Seen + and then not Static_Libgcc_Seen then Linker_Options.Increment_Last; Linker_Options.Table (Linker_Options.Last) := Static_Libgcc; Num_Args := Num_Args + 1; end if; + + -- Likewise, the reverse. + + if Shared_Libgcc_Default = 'H' + and then not Static_Libgcc_Seen + and then not Shared_Libgcc_Seen + then + Linker_Options.Increment_Last; + Linker_Options.Table (Linker_Options.Last) := Shared_Libgcc; + Num_Args := Num_Args + 1; + end if; end if; end Clean_Link_Option_Set; -- cgit v1.2.3 From a56bf5e59c87168abe59a2bd8dd9cc8610e38156 Mon Sep 17 00:00:00 2001 From: Iain Sandoe <iain@sandoe.co.uk> Date: Sun, 1 Sep 2019 19:43:33 +0000 Subject: [Ada, Darwin, PPC] PPC Darwin has stack check probes. On PPC, Darwin uses the same code as other parts of the port 2019-09-01 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline. 2019-07-02 Iain Sandoe <iain@sandoe.co.uk> * libgnat/system-darwin-ppc.ads: Set Stack_Check_Probes True for PPC Darwin. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@275283 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ada/ChangeLog | 8 ++++++++ gcc/ada/libgnat/system-darwin-ppc.ads | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 66dd37ca13b..ae241640019 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,5 +1,13 @@ 2019-09-01 Iain Sandoe <iain@sandoe.co.uk> + Backport from mainline. + 2019-07-02 Iain Sandoe <iain@sandoe.co.uk> + + * libgnat/system-darwin-ppc.ads: Set Stack_Check_Probes True for + PPC Darwin. + +2019-08-05 Iain Sandoe <iain@sandoe.co.uk> + Backport from mainline. 2019-06-30 Iain Sandoe <iain@sandoe.co.uk> diff --git a/gcc/ada/libgnat/system-darwin-ppc.ads b/gcc/ada/libgnat/system-darwin-ppc.ads index 9648767f742..8b7fc5687d8 100644 --- a/gcc/ada/libgnat/system-darwin-ppc.ads +++ b/gcc/ada/libgnat/system-darwin-ppc.ads @@ -158,7 +158,7 @@ private Preallocated_Stacks : constant Boolean := False; Signed_Zeros : constant Boolean := True; Stack_Check_Default : constant Boolean := False; - Stack_Check_Probes : constant Boolean := False; + Stack_Check_Probes : constant Boolean := True; Stack_Check_Limits : constant Boolean := False; Support_Aggregates : constant Boolean := True; Support_Atomic_Primitives : constant Boolean := Word_Size = 64; -- cgit v1.2.3 From 2f2765f9299065708e7a7e3a4491eecc36563fea Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Mon, 2 Sep 2019 00:16:28 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@275288 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index de7aab44512..4dad3d2323d 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190901 +20190902 -- cgit v1.2.3 From de669c7efa20bf874d434a3d9436d8645ddb473a Mon Sep 17 00:00:00 2001 From: Richard Biener <rguenther@suse.de> Date: Mon, 2 Sep 2019 07:12:11 +0000 Subject: 2019-09-02 Richard Biener <rguenther@suse.de> PR testsuite/91619 * gcc.dg/vect/pr81740-2.c: Restrict to vect_hw_misalign. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@275294 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/vect/pr81740-2.c | 1 + 2 files changed, 6 insertions(+) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c9503689f57..4e1db5ae25d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-09-02 Richard Biener <rguenther@suse.de> + + PR testsuite/91619 + * gcc.dg/vect/pr81740-2.c: Restrict to vect_hw_misalign. + 2019-09-01 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline. diff --git a/gcc/testsuite/gcc.dg/vect/pr81740-2.c b/gcc/testsuite/gcc.dg/vect/pr81740-2.c index 76637ad0f81..6bb8371aacb 100644 --- a/gcc/testsuite/gcc.dg/vect/pr81740-2.c +++ b/gcc/testsuite/gcc.dg/vect/pr81740-2.c @@ -1,5 +1,6 @@ /* { dg-do run } */ /* { dg-require-effective-target vect_int } */ +/* { dg-require-effective-target vect_hw_misalign } */ #include "tree-vect.h" -- cgit v1.2.3 From e283acb71278453f5ecaebc45c3fe480ba33c0ae Mon Sep 17 00:00:00 2001 From: Jonathan Wakely <jwakely@redhat.com> Date: Mon, 2 Sep 2019 08:12:42 +0000 Subject: Fix recent unique_ptr regressions These test changes should have been committed with r275193. * testsuite/20_util/unique_ptr/assign/48635_neg.cc: Replace dg-error with dg-prune-output for enable_if failure. * testsuite/20_util/unique_ptr/cons/cv_qual_neg.cc: Add dg-prune-output for enable_if failure. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@275296 138bc75d-0d04-0410-961f-82ee72b054a4 --- libstdc++-v3/ChangeLog | 7 +++++++ libstdc++-v3/testsuite/20_util/unique_ptr/assign/48635_neg.cc | 3 +-- libstdc++-v3/testsuite/20_util/unique_ptr/cons/cv_qual_neg.cc | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index e5e30f8afdd..b7954727a28 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,10 @@ +2019-09-02 Jonathan Wakely <jwakely@redhat.com> + + * testsuite/20_util/unique_ptr/assign/48635_neg.cc: Replace dg-error + with dg-prune-output for enable_if failure. + * testsuite/20_util/unique_ptr/cons/cv_qual_neg.cc: Add + dg-prune-output for enable_if failure. + 2019-08-30 Jonathan Wakely <jwakely@redhat.com> Backport from mainline diff --git a/libstdc++-v3/testsuite/20_util/unique_ptr/assign/48635_neg.cc b/libstdc++-v3/testsuite/20_util/unique_ptr/assign/48635_neg.cc index b22d0e123b4..23a5eb007a1 100644 --- a/libstdc++-v3/testsuite/20_util/unique_ptr/assign/48635_neg.cc +++ b/libstdc++-v3/testsuite/20_util/unique_ptr/assign/48635_neg.cc @@ -42,10 +42,9 @@ void f() std::unique_ptr<int, D&> ud(nullptr, d); ub = std::move(ud); // { dg-error "no match" } ub2 = ud; // { dg-error "no match" } -// { dg-error "no type" "" { target *-*-* } 307 } std::unique_ptr<int[], B&> uba(nullptr, b); std::unique_ptr<int[], D&> uda(nullptr, d); uba = std::move(uda); // { dg-error "no match" } -// { dg-error "no type" "" { target *-*-* } 566 } } +// { dg-prune-output "no type" } diff --git a/libstdc++-v3/testsuite/20_util/unique_ptr/cons/cv_qual_neg.cc b/libstdc++-v3/testsuite/20_util/unique_ptr/cons/cv_qual_neg.cc index c1b1c9efc64..7e820ba129a 100644 --- a/libstdc++-v3/testsuite/20_util/unique_ptr/cons/cv_qual_neg.cc +++ b/libstdc++-v3/testsuite/20_util/unique_ptr/cons/cv_qual_neg.cc @@ -39,7 +39,7 @@ test07() std::unique_ptr<const A[]> cA3(p); // { dg-error "no matching function" } std::unique_ptr<volatile A[]> vA3(p); // { dg-error "no matching function" } std::unique_ptr<const volatile A[]> cvA3(p); // { dg-error "no matching function" } - // { dg-error "no type" "" { target *-*-* } 473 } + // { dg-prune-output "no type" } } template<typename T> -- cgit v1.2.3 From ecdc0acc9422f04067b58bf85f9989d510c1c6d1 Mon Sep 17 00:00:00 2001 From: Jonathan Wakely <jwakely@redhat.com> Date: Mon, 2 Sep 2019 10:34:02 +0000 Subject: Regenerate libstdc++ HTML docs * doc/html/*: Regenerate. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@275305 138bc75d-0d04-0410-961f-82ee72b054a4 --- libstdc++-v3/ChangeLog | 2 ++ libstdc++-v3/doc/html/manual/bugs.html | 4 ---- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index b7954727a28..73866e94067 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,5 +1,7 @@ 2019-09-02 Jonathan Wakely <jwakely@redhat.com> + * doc/html/*: Regenerate. + * testsuite/20_util/unique_ptr/assign/48635_neg.cc: Replace dg-error with dg-prune-output for enable_if failure. * testsuite/20_util/unique_ptr/cons/cv_qual_neg.cc: Add diff --git a/libstdc++-v3/doc/html/manual/bugs.html b/libstdc++-v3/doc/html/manual/bugs.html index 2f54867855f..df69da077a2 100644 --- a/libstdc++-v3/doc/html/manual/bugs.html +++ b/libstdc++-v3/doc/html/manual/bugs.html @@ -497,10 +497,6 @@ should call <code class="code">make_heap</code> </em></span> </span></dt><dd><p>Call <code class="code">make_heap</code>. - </p></dd><dt><a id="manual.bugs.dr2566"></a><span class="term"><a class="link" href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2566" target="_top">2566</a>: - <span class="emphasis"><em>Requirements on the first template parameter of container adaptors - </em></span> - </span></dt><dd><p>Add static assertions to enforce the requirement. </p></dd><dt><a id="manual.bugs.dr2583"></a><span class="term"><a class="link" href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2583" target="_top">2583</a>: <span class="emphasis"><em>There is no way to supply an allocator for <code class="code">basic_string(str, pos)</code> </em></span> -- cgit v1.2.3 From 16fd9333b3c972ac99360a2af1f7c66185d550ba Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Tue, 3 Sep 2019 00:16:31 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@275326 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 4dad3d2323d..f2823424071 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190902 +20190903 -- cgit v1.2.3 From d78257abe03e9e163fbbb1493cfc5d8cea863398 Mon Sep 17 00:00:00 2001 From: Iain Sandoe <iain@sandoe.co.uk> Date: Tue, 3 Sep 2019 18:56:04 +0000 Subject: [c-family] Backport fix for PCH / PR61250. When we are parsing a source file, the very first token might be a PRAGMA_GCC_PCH_PREPROCESS. This indicates that we are going read in a PCH file (named as the value of the pragma). If we don't see this pragma, then we know that it's OK to release any resources that the host might have set aside for the PCH file. There is a thinko in the current implementation, in that the decision to release resources is happening unconditionally right after the first token is extracted but before it's been checked or acted upon. This leads to the pch bug on Darwin, because we actually do release resources - which are subsequently (reasonably) assumed to be available when reading a PCH file. We then get random crashes or hangs depending on the interaction between unmmap and malloc. The bug is present everywhere but doesn't show on (say) Linux, since the release of PCH resources is a NOP there. This effects all the c-family front ends, because they all use c_lex_with_flags () to implement this. The solution is to check for the PRAGMA_GCC_PCH_PREPROCESS and only call c_common_no_more_pch () when that is not the first token. A secondary effect of the collection is that the name of the PCH file can be collected during the ggc_pch_read() reset of state. Therefore we should issue any diagnostic that might name the file before the collections are triggered. gcc/ 2019-09-03 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline 2019-08-23 Iain Sandoe <iain@sandoe.co.uk> PR pch/61250 * ggc-page.c (ggc_pch_read): Read the ggc_pch_ondisk structure and issue any diagnostics needed before collecting the pre-PCH state. gcc/c-family/ 2019-09-03 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline 2019-08-23 Iain Sandoe <iain@sandoe.co.uk> PR pch/61250 * c-lex.c (c_lex_with_flags): Don't call c_common_no_more_pch () from here. gcc/c/ 2019-09-03 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline. 2019-08-23 Iain Sandoe <iain@sandoe.co.uk> PR pch/61250 * c-parser.c (c_parse_file): Call c_common_no_more_pch () after determining that the first token is not PRAGMA_GCC_PCH_PREPROCESS. gcc/cp/ 2019-09-03 Iain Sandoe <iain@sandoe.co.uk> Backported from mainline 2019-08-23 Iain Sandoe <iain@sandoe.co.uk> PR pch/61250 * parser.c (cp_parser_initial_pragma): Call c_common_no_more_pch () after determining that the first token is not PRAGMA_GCC_PCH_PREPROCESS. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@275346 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 10 ++++++++++ gcc/c-family/ChangeLog | 9 +++++++++ gcc/c-family/c-lex.c | 7 ------- gcc/c/ChangeLog | 10 ++++++++++ gcc/c/c-parser.c | 2 ++ gcc/cp/ChangeLog | 10 ++++++++++ gcc/cp/parser.c | 5 ++++- gcc/ggc-page.c | 5 +++-- 8 files changed, 48 insertions(+), 10 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 7d303631e76..b51d165c4d0 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +2019-09-03 Iain Sandoe <iain@sandoe.co.uk> + + Backport from mainline + 2019-08-23 Iain Sandoe <iain@sandoe.co.uk> + + PR pch/61250 + * ggc-page.c (ggc_pch_read): Read the ggc_pch_ondisk structure + and issue any diagnostics needed before collecting the pre-PCH + state. + 2019-09-01 Eric Botcazou <ebotcazou@adacore.com> PR target/91472 diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index 14952a8e1e5..7db9a94f23d 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,12 @@ +2019-09-03 Iain Sandoe <iain@sandoe.co.uk> + + Backport from mainline + 2019-08-23 Iain Sandoe <iain@sandoe.co.uk> + + PR pch/61250 + * c-lex.c (c_lex_with_flags): Don't call + c_common_no_more_pch () from here. + 2019-08-30 Richard Biener <rguenther@suse.de> Backport from mainline diff --git a/gcc/c-family/c-lex.c b/gcc/c-family/c-lex.c index a4ad0a30f38..a8dc0dd9130 100644 --- a/gcc/c-family/c-lex.c +++ b/gcc/c-family/c-lex.c @@ -392,7 +392,6 @@ enum cpp_ttype c_lex_with_flags (tree *value, location_t *loc, unsigned char *cpp_flags, int lex_flags) { - static bool no_more_pch; const cpp_token *tok; enum cpp_ttype type; unsigned char add_flags = 0; @@ -626,12 +625,6 @@ c_lex_with_flags (tree *value, location_t *loc, unsigned char *cpp_flags, if (cpp_flags) *cpp_flags = tok->flags | add_flags; - if (!no_more_pch) - { - no_more_pch = true; - c_common_no_more_pch (); - } - timevar_pop (TV_CPP); return type; diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index c0b7ed17bcf..5633ddef078 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,13 @@ +2019-09-03 Iain Sandoe <iain@sandoe.co.uk> + + Backport from mainline. + 2019-08-23 Iain Sandoe <iain@sandoe.co.uk> + + PR pch/61250 + * c-parser.c (c_parse_file): Call c_common_no_more_pch () + after determining that the first token is not + PRAGMA_GCC_PCH_PREPROCESS. + 2019-08-29 Jakub Jelinek <jakub@redhat.com> Backported from mainline diff --git a/gcc/c/c-parser.c b/gcc/c/c-parser.c index 06c0d5648c4..097c4bf16da 100644 --- a/gcc/c/c-parser.c +++ b/gcc/c/c-parser.c @@ -18478,6 +18478,8 @@ c_parse_file (void) if (c_parser_peek_token (&tparser)->pragma_kind == PRAGMA_GCC_PCH_PREPROCESS) c_parser_pragma_pch_preprocess (&tparser); + else + c_common_no_more_pch (); the_parser = ggc_alloc<c_parser> (); *the_parser = tparser; diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 64edbab6816..7accdfab2d3 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,13 @@ +2019-09-03 Iain Sandoe <iain@sandoe.co.uk> + + Backported from mainline + 2019-08-23 Iain Sandoe <iain@sandoe.co.uk> + + PR pch/61250 + * parser.c (cp_parser_initial_pragma): Call c_common_no_more_pch () + after determining that the first token is not + PRAGMA_GCC_PCH_PREPROCESS. + 2019-08-30 Richard Biener <rguenther@suse.de> Backport from mainline diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 921916a0844..5193c36dc85 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -38734,7 +38734,10 @@ cp_parser_initial_pragma (cp_token *first_token) cp_lexer_get_preprocessor_token (NULL, first_token); if (cp_parser_pragma_kind (first_token) != PRAGMA_GCC_PCH_PREPROCESS) - return; + { + c_common_no_more_pch (); + return; + } cp_lexer_get_preprocessor_token (NULL, first_token); if (first_token->type == CPP_STRING) diff --git a/gcc/ggc-page.c b/gcc/ggc-page.c index 51783e51356..821535ec026 100644 --- a/gcc/ggc-page.c +++ b/gcc/ggc-page.c @@ -2555,6 +2555,9 @@ ggc_pch_read (FILE *f, void *addr) count_old_page_tables = G.by_depth_in_use; + if (fread (&d, sizeof (d), 1, f) != 1) + fatal_error (input_location, "cannot read PCH file: %m"); + /* We've just read in a PCH file. So, every object that used to be allocated is now free. */ clear_marks (); @@ -2583,8 +2586,6 @@ ggc_pch_read (FILE *f, void *addr) /* Allocate the appropriate page-table entries for the pages read from the PCH file. */ - if (fread (&d, sizeof (d), 1, f) != 1) - fatal_error (input_location, "can%'t read PCH file: %m"); for (i = 0; i < NUM_ORDERS; i++) { -- cgit v1.2.3 From c1dfbbc0757a2ce00daa1ac1f656ca7378e17c59 Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Wed, 4 Sep 2019 00:16:24 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@275360 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index f2823424071..45edab8adff 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190903 +20190904 -- cgit v1.2.3 From a99e9318bb1f75aee2a0c01ef4c00975c053f679 Mon Sep 17 00:00:00 2001 From: Wilco Dijkstra <wdijkstr@arm.com> Date: Wed, 4 Sep 2019 13:06:55 +0000 Subject: [AArch64] Fix PR81800 PR81800 is about the lrint inline giving spurious FE_INEXACT exceptions. The previous change for PR81800 didn't fix this: when lrint is disabled in the backend, the midend will simply use llrint. This actually makes things worse since llrint now also ignores FE_INVALID exceptions! The fix is to disable lrint/llrint on double if the size of a long is smaller (ie. ilp32). gcc/ PR target/81800 * gcc/config/aarch64/aarch64.md (lrint): Disable lrint pattern if GPF operand is larger than a long int. testsuite/ PR target/81800 * gcc.target/aarch64/no-inline-lrint_3.c: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@275374 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 9 +++++++++ gcc/config/aarch64/aarch64.md | 2 +- gcc/testsuite/ChangeLog | 8 ++++++++ gcc/testsuite/gcc.target/aarch64/no-inline-lrint_3.c | 17 +++++++++++++++++ 4 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.target/aarch64/no-inline-lrint_3.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b51d165c4d0..32ffe570a11 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2019-09-04 Wilco Dijkstra <wdijkstr@arm.com> + + Backport from mainline + 2019-08-13 Wilco Dijkstra <wdijkstr@arm.com> + + PR target/81800 + * gcc/config/aarch64/aarch64.md (lrint): Disable lrint pattern if GPF + operand is larger than a long int. + 2019-09-03 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline diff --git a/gcc/config/aarch64/aarch64.md b/gcc/config/aarch64/aarch64.md index 11c0ef00dcf..06d2dacb563 100644 --- a/gcc/config/aarch64/aarch64.md +++ b/gcc/config/aarch64/aarch64.md @@ -5413,7 +5413,7 @@ [(match_operand:GPI 0 "register_operand") (match_operand:GPF 1 "register_operand")] "TARGET_FLOAT - && ((GET_MODE_SIZE (<GPF:MODE>mode) <= GET_MODE_SIZE (<GPI:MODE>mode)) + && ((GET_MODE_BITSIZE (<GPF:MODE>mode) <= LONG_TYPE_SIZE) || !flag_trapping_math || flag_fp_int_builtin_inexact)" { rtx cvt = gen_reg_rtx (<GPF:MODE>mode); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 4e1db5ae25d..f3fe6d402dc 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2019-09-04 Wilco Dijkstra <wdijkstr@arm.com> + + Backport from mainline + 2019-08-13 Wilco Dijkstra <wdijkstr@arm.com> + + PR target/81800 + * gcc.target/aarch64/no-inline-lrint_3.c: New test. + 2019-09-02 Richard Biener <rguenther@suse.de> PR testsuite/91619 diff --git a/gcc/testsuite/gcc.target/aarch64/no-inline-lrint_3.c b/gcc/testsuite/gcc.target/aarch64/no-inline-lrint_3.c new file mode 100644 index 00000000000..ca772cb999e --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/no-inline-lrint_3.c @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target ilp32 } */ +/* { dg-options "-O3 -fno-math-errno -fno-fp-int-builtin-inexact" } */ + +#define TEST(name, float_type, int_type, fn) void f_##name (float_type x) \ +{ \ + volatile int_type b = __builtin_##fn (x); \ +} + +TEST (dld, double, long, lrint) +TEST (flf, float , long, lrintf) + +TEST (did, double, int, lrint) +TEST (fif, float , int, lrintf) + +/* { dg-final { scan-assembler-times "fcvtzs\tw\[0-9\]+, \[d,s\]\[0-9\]+" 2 } } */ +/* { dg-final { scan-assembler-times "bl\tlrint" 2 } } */ -- cgit v1.2.3 From 016b7d26640777c6b5510c0f1a357263dfed7442 Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Thu, 5 Sep 2019 00:16:17 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@275393 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 45edab8adff..59cbaa8930f 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190904 +20190905 -- cgit v1.2.3 From 26ad4a2987456284c546f454d30325366a100280 Mon Sep 17 00:00:00 2001 From: "Steven G. Kargl" <kargl@gcc.gnu.org> Date: Thu, 5 Sep 2019 19:28:04 +0000 Subject: 2019-09-05 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/91660 * decl.c (gfc_match_decl_type_spec): Improve and restore error message for malformed types-spec. 2019-09-05 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/91660 * gfortran.dg/pdt_4.f03: Fix invalid code. * gfortran.dg/pr91660_1.f90: New test. * gfortran.dg/pr91660_2.f90: Ditto. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@275432 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fortran/ChangeLog | 7 +++++++ gcc/fortran/decl.c | 25 ++++++++++++++++++++----- gcc/testsuite/ChangeLog | 7 +++++++ gcc/testsuite/gfortran.dg/pdt_4.f03 | 4 ++-- gcc/testsuite/gfortran.dg/pr91660_1.f90 | 9 +++++++++ gcc/testsuite/gfortran.dg/pr91660_2.f90 | 9 +++++++++ 6 files changed, 54 insertions(+), 7 deletions(-) create mode 100644 gcc/testsuite/gfortran.dg/pr91660_1.f90 create mode 100644 gcc/testsuite/gfortran.dg/pr91660_2.f90 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 7e530bfd832..f11fab33b80 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,10 @@ +2019-09-05 Steven G. Kargl <kargl@gcc.gnu.org> + + PR fortran/91660 + * gfortran.dg/pdt_4.f03: Fix invalid code. + * gfortran.dg/pr91660_1.f90: New test. + * gfortran.dg/pr91660_2.f90: Ditto. + 2013-08-13 Thomas Koenig <tkoenig@gcc.gnu.org> Backport from trunk diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c index 7cc276ea64a..e138375607d 100644 --- a/gcc/fortran/decl.c +++ b/gcc/fortran/decl.c @@ -3899,7 +3899,6 @@ gfc_match_decl_type_spec (gfc_typespec *ts, int implicit_flag) return MATCH_YES; } - m = gfc_match (" type ("); matched_type = (m == MATCH_YES); if (matched_type) @@ -3948,7 +3947,10 @@ gfc_match_decl_type_spec (gfc_typespec *ts, int implicit_flag) m = MATCH_YES; if (matched_type && m == MATCH_YES && gfc_match_char (')') != MATCH_YES) - m = MATCH_ERROR; + { + gfc_error ("Malformed type-spec at %C"); + return MATCH_ERROR; + } return m; } @@ -3971,8 +3973,12 @@ gfc_match_decl_type_spec (gfc_typespec *ts, int implicit_flag) && !gfc_notify_std (GFC_STD_F2008, "TYPE with " "intrinsic-type-spec at %C")) return MATCH_ERROR; + if (matched_type && gfc_match_char (')') != MATCH_YES) - return MATCH_ERROR; + { + gfc_error ("Malformed type-spec at %C"); + return MATCH_ERROR; + } ts->type = BT_REAL; ts->kind = gfc_default_double_kind; @@ -4002,7 +4008,10 @@ gfc_match_decl_type_spec (gfc_typespec *ts, int implicit_flag) return MATCH_ERROR; if (matched_type && gfc_match_char (')') != MATCH_YES) - return MATCH_ERROR; + { + gfc_error ("Malformed type-spec at %C"); + return MATCH_ERROR; + } ts->type = BT_COMPLEX; ts->kind = gfc_default_double_kind; @@ -4023,7 +4032,13 @@ gfc_match_decl_type_spec (gfc_typespec *ts, int implicit_flag) if (m == MATCH_ERROR) return m; - m = gfc_match_char (')'); + gfc_gobble_whitespace (); + if (gfc_peek_ascii_char () != ')') + { + gfc_error ("Malformed type-spec at %C"); + return MATCH_ERROR; + } + m = gfc_match_char (')'); /* Burn closing ')'. */ } if (m != MATCH_YES) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index f3fe6d402dc..7cb6a931810 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2019-09-05 Steven G. Kargl <kargl@gcc.gnu.org> + + PR fortran/91660 + * gfortran.dg/pdt_4.f03: Fix invalid code. + * gfortran.dg/pr91660_1.f90: New test. + * gfortran.dg/pr91660_2.f90: Ditto. + 2019-09-04 Wilco Dijkstra <wdijkstr@arm.com> Backport from mainline diff --git a/gcc/testsuite/gfortran.dg/pdt_4.f03 b/gcc/testsuite/gfortran.dg/pdt_4.f03 index 0bb58f91c67..c1af65a5248 100644 --- a/gcc/testsuite/gfortran.dg/pdt_4.f03 +++ b/gcc/testsuite/gfortran.dg/pdt_4.f03 @@ -97,9 +97,9 @@ contains type (mytype(4, *)) :: arg ! OK end subroutine subroutine bar(arg) ! { dg-error "is neither allocatable nor a pointer" } - type (thytype(8, :, 4) :: arg + type (thytype(8, :, 4)) :: arg end subroutine subroutine foobar(arg) ! OK - type (thytype(8, *, 4) :: arg + type (thytype(8, *, 4)) :: arg end subroutine end diff --git a/gcc/testsuite/gfortran.dg/pr91660_1.f90 b/gcc/testsuite/gfortran.dg/pr91660_1.f90 new file mode 100644 index 00000000000..b0c96d95d0f --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr91660_1.f90 @@ -0,0 +1,9 @@ +! { dg-do compile } +! PR fortran/91660 +! Code contributed by Gerhard Steinmetz +program p + type t + end type + type (t x ! { dg-error "Malformed type-spec" } + x = t() ! { dg-error "Can't convert" } +end diff --git a/gcc/testsuite/gfortran.dg/pr91660_2.f90 b/gcc/testsuite/gfortran.dg/pr91660_2.f90 new file mode 100644 index 00000000000..0072aba1680 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr91660_2.f90 @@ -0,0 +1,9 @@ +! { dg-do compile } +! PR fortran/91660 +program foo + type(doubleprecision :: x ! { dg-error "Malformed type-spec" } + type(double precision :: y ! { dg-error "Malformed type-spec" } + type(character(len=3) :: a ! { dg-error "Malformed type-spec" } + type(doublecomplex :: b ! { dg-error "Malformed type-spec" } + type(double complex :: c ! { dg-error "Malformed type-spec" } +end program foo -- cgit v1.2.3 From cbdf90e0557e51551b089c7c4a44e13ba362f8e9 Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Fri, 6 Sep 2019 00:16:29 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@275447 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 59cbaa8930f..445ed446cd6 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190905 +20190906 -- cgit v1.2.3 From cb3edd469ee54447e259f7bfcb366c8e6be51b01 Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Sat, 7 Sep 2019 00:16:31 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@275480 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 445ed446cd6..3182cee6629 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190906 +20190907 -- cgit v1.2.3 From 4a698ecb06b9aab9d50862d30f76d3b586994470 Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Sun, 8 Sep 2019 00:16:26 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@275491 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 3182cee6629..c204a76e355 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190907 +20190908 -- cgit v1.2.3 From 072ed87913f2a7bdd17cc87f794e6ed68767d0b3 Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Mon, 9 Sep 2019 00:16:52 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@275499 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index c204a76e355..4defdea11fc 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190908 +20190909 -- cgit v1.2.3 From 8ea0fc84f0ebd0acd32a0ada7bd338eaa3f81cd2 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek <jakub@redhat.com> Date: Mon, 9 Sep 2019 10:59:48 +0000 Subject: PR target/91704 * config/i386/avxintrin.h (__v32qs): New typedef. * config/i386/avx2intrin.h (_mm256_cmpgt_epi8): Use casts to __v32qs instead of __v32qi. * gcc.target/i386/pr91704.c: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@275511 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 7 +++++++ gcc/config/i386/avx2intrin.h | 2 +- gcc/config/i386/avxintrin.h | 1 + gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.target/i386/pr91704.c | 14 ++++++++++++++ 5 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.target/i386/pr91704.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 32ffe570a11..7e6eff4774c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2019-09-09 Jakub Jelinek <jakub@redhat.com> + + PR target/91704 + * config/i386/avxintrin.h (__v32qs): New typedef. + * config/i386/avx2intrin.h (_mm256_cmpgt_epi8): Use casts to __v32qs + instead of __v32qi. + 2019-09-04 Wilco Dijkstra <wdijkstr@arm.com> Backport from mainline diff --git a/gcc/config/i386/avx2intrin.h b/gcc/config/i386/avx2intrin.h index a56d3fc804a..f6a2555de33 100644 --- a/gcc/config/i386/avx2intrin.h +++ b/gcc/config/i386/avx2intrin.h @@ -258,7 +258,7 @@ extern __inline __m256i __attribute__ ((__gnu_inline__, __always_inline__, __artificial__)) _mm256_cmpgt_epi8 (__m256i __A, __m256i __B) { - return (__m256i) ((__v32qi)__A > (__v32qi)__B); + return (__m256i) ((__v32qs)__A > (__v32qs)__B); } extern __inline __m256i diff --git a/gcc/config/i386/avxintrin.h b/gcc/config/i386/avxintrin.h index 3891ffd099c..ca201b51be9 100644 --- a/gcc/config/i386/avxintrin.h +++ b/gcc/config/i386/avxintrin.h @@ -47,6 +47,7 @@ typedef unsigned int __v8su __attribute__ ((__vector_size__ (32))); typedef short __v16hi __attribute__ ((__vector_size__ (32))); typedef unsigned short __v16hu __attribute__ ((__vector_size__ (32))); typedef char __v32qi __attribute__ ((__vector_size__ (32))); +typedef signed char __v32qs __attribute__ ((__vector_size__ (32))); typedef unsigned char __v32qu __attribute__ ((__vector_size__ (32))); /* The Intel API is flexible enough that we must allow aliasing with other diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 7cb6a931810..155409b9953 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-09-09 Jakub Jelinek <jakub@redhat.com> + + PR target/91704 + * gcc.target/i386/pr91704.c: New test. + 2019-09-05 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/91660 diff --git a/gcc/testsuite/gcc.target/i386/pr91704.c b/gcc/testsuite/gcc.target/i386/pr91704.c new file mode 100644 index 00000000000..b996e24ad74 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr91704.c @@ -0,0 +1,14 @@ +/* PR target/91704 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -funsigned-char -mavx2 -mavx512f -masm=att" } */ +/* { dg-final { scan-assembler-times "\tvpcmpgtb\t%ymm" 1 } } */ +/* { dg-final { scan-assembler-not "\tvpsubusb\t" } } */ +/* { dg-final { scan-assembler-not "\tvpcmpeqb\t" } } */ + +#include <x86intrin.h> + +__m256i +foo (__m256i x, __m256i y) +{ + return _mm256_cmpgt_epi8 (x, y); +} -- cgit v1.2.3 From 682fc93bb195a80332e18e940d64ad615b121b5e Mon Sep 17 00:00:00 2001 From: Jakub Jelinek <jakub@redhat.com> Date: Mon, 9 Sep 2019 11:00:46 +0000 Subject: PR target/87853 * config/i386/emmintrin.h (_mm_cmpeq_epi8): Use casts to __v16qi instead of __v16qs. * gcc.target/i386/pr87853.c: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@275512 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 4 ++++ gcc/config/i386/emmintrin.h | 2 +- gcc/testsuite/ChangeLog | 3 +++ gcc/testsuite/gcc.target/i386/pr87853.c | 20 ++++++++++++++++++++ 4 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.target/i386/pr87853.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 7e6eff4774c..879abdac0ac 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,9 @@ 2019-09-09 Jakub Jelinek <jakub@redhat.com> + PR target/87853 + * config/i386/emmintrin.h (_mm_cmpeq_epi8): Use casts to __v16qi + instead of __v16qs. + PR target/91704 * config/i386/avxintrin.h (__v32qs): New typedef. * config/i386/avx2intrin.h (_mm256_cmpgt_epi8): Use casts to __v32qs diff --git a/gcc/config/i386/emmintrin.h b/gcc/config/i386/emmintrin.h index 040470f51d2..33e3b64b1d0 100644 --- a/gcc/config/i386/emmintrin.h +++ b/gcc/config/i386/emmintrin.h @@ -1296,7 +1296,7 @@ _mm_xor_si128 (__m128i __A, __m128i __B) extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__)) _mm_cmpeq_epi8 (__m128i __A, __m128i __B) { - return (__m128i) ((__v16qs)__A == (__v16qs)__B); + return (__m128i) ((__v16qi)__A == (__v16qi)__B); } extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__)) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 155409b9953..f691a8635e5 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2019-09-09 Jakub Jelinek <jakub@redhat.com> + PR target/87853 + * gcc.target/i386/pr87853.c: New test. + PR target/91704 * gcc.target/i386/pr91704.c: New test. diff --git a/gcc/testsuite/gcc.target/i386/pr87853.c b/gcc/testsuite/gcc.target/i386/pr87853.c new file mode 100644 index 00000000000..9a288879679 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr87853.c @@ -0,0 +1,20 @@ +/* PR target/87853 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -funsigned-char -msse2 -mno-sse3 -masm=att" } */ +/* { dg-final { scan-assembler-times "\tpcmpgtb\t%xmm" 2 } } */ +/* { dg-final { scan-assembler-not "\tpsubusb\t" } } */ +/* { dg-final { scan-assembler-not "\tpcmpeqb\t" } } */ + +#include <x86intrin.h> + +__m128i +foo (__m128i x, __m128i y) +{ + return _mm_cmpgt_epi8 (x, y); +} + +__m128i +bar (__m128i x, __m128i y) +{ + return _mm_cmplt_epi8 (x, y); +} -- cgit v1.2.3 From 26fde95a083c0449982409ea3464371b92a03d48 Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Tue, 10 Sep 2019 00:16:09 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@275553 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 4defdea11fc..757af504a8e 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190909 +20190910 -- cgit v1.2.3 From 8ab49cd4f02179842a72b68283ed8f94530c3ab4 Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Wed, 11 Sep 2019 00:16:29 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@275620 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 757af504a8e..0766c007215 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190910 +20190911 -- cgit v1.2.3 From 1a6e57d0a572b8f12a082226c22e168dfab0131f Mon Sep 17 00:00:00 2001 From: Eric Botcazou <ebotcazou@adacore.com> Date: Wed, 11 Sep 2019 10:43:19 +0000 Subject: PR rtl-optimization/89795 * rtlanal.c (nonzero_bits1) <SUBREG>: Do not propagate results from inner REGs to paradoxical SUBREGs if WORD_REGISTER_OPERATIONS is set. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@275637 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 6 ++++++ gcc/rtlanal.c | 2 +- gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/gcc.target/sparc/20161111-1.c | 2 +- 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 879abdac0ac..350c7099a8c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2019-09-11 Eric Botcazou <ebotcazou@adacore.com> + + PR rtl-optimization/89795 + * rtlanal.c (nonzero_bits1) <SUBREG>: Do not propagate results from + inner REGs to paradoxical SUBREGs if WORD_REGISTER_OPERATIONS is set. + 2019-09-09 Jakub Jelinek <jakub@redhat.com> PR target/87853 diff --git a/gcc/rtlanal.c b/gcc/rtlanal.c index dabc5403f28..96763957cfc 100644 --- a/gcc/rtlanal.c +++ b/gcc/rtlanal.c @@ -4756,7 +4756,7 @@ nonzero_bits1 (const_rtx x, scalar_int_mode mode, const_rtx known_x, || ((extend_op = load_extend_op (inner_mode)) == SIGN_EXTEND ? val_signbit_known_set_p (inner_mode, nonzero) : extend_op != ZERO_EXTEND) - || (!MEM_P (SUBREG_REG (x)) && !REG_P (SUBREG_REG (x)))) + || !MEM_P (SUBREG_REG (x))) && xmode_width > inner_width) nonzero |= (GET_MODE_MASK (GET_MODE (x)) & ~GET_MODE_MASK (inner_mode)); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index f691a8635e5..0bb00622775 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2019-09-11 Eric Botcazou <ebotcazou@adacore.com> + + * gcc.target/sparc/20161111-1.c: XFAIL redundant zero-extension test. + 2019-09-09 Jakub Jelinek <jakub@redhat.com> PR target/87853 diff --git a/gcc/testsuite/gcc.target/sparc/20161111-1.c b/gcc/testsuite/gcc.target/sparc/20161111-1.c index eda8b0a9f12..8195fec8990 100644 --- a/gcc/testsuite/gcc.target/sparc/20161111-1.c +++ b/gcc/testsuite/gcc.target/sparc/20161111-1.c @@ -14,4 +14,4 @@ unsigned char ee_isdigit2(unsigned int i) return retval; } -/* { dg-final { scan-assembler-not "and\t%" } } */ +/* { dg-final { scan-assembler-not "and\t%" { xfail *-*-* } } } */ -- cgit v1.2.3 From 8c7168f53cb9b650244f371c565aaef12997e9ab Mon Sep 17 00:00:00 2001 From: Jonathan Wakely <jwakely@redhat.com> Date: Wed, 11 Sep 2019 11:41:04 +0000 Subject: Fix Xmethod for shared_ptr::use_count() This was reported in https://bugzilla.redhat.com/show_bug.cgi?id=1749578 * python/libstdcxx/v6/xmethods.py (SharedPtrUseCountWorker.__call__): Fix syntax error. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@275646 138bc75d-0d04-0410-961f-82ee72b054a4 --- libstdc++-v3/ChangeLog | 5 +++++ libstdc++-v3/python/libstdcxx/v6/xmethods.py | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 73866e94067..098fc6a5fb4 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,8 @@ +2019-09-11 Jonathan Wakely <jwakely@redhat.com> + + * python/libstdcxx/v6/xmethods.py (SharedPtrUseCountWorker.__call__): + Fix syntax error. + 2019-09-02 Jonathan Wakely <jwakely@redhat.com> * doc/html/*: Regenerate. diff --git a/libstdc++-v3/python/libstdcxx/v6/xmethods.py b/libstdc++-v3/python/libstdcxx/v6/xmethods.py index 01819592ff2..12fefdb041c 100644 --- a/libstdc++-v3/python/libstdcxx/v6/xmethods.py +++ b/libstdc++-v3/python/libstdcxx/v6/xmethods.py @@ -728,7 +728,7 @@ class SharedPtrUseCountWorker(gdb.xmethod.XMethodWorker): return gdb.lookup_type('long') def __call__(self, obj): - refcounts = ['_M_refcount']['_M_pi'] + refcounts = obj['_M_refcount']['_M_pi'] return refcounts['_M_use_count'] if refcounts else 0 class SharedPtrUniqueWorker(SharedPtrUseCountWorker): -- cgit v1.2.3 From ee27a3d99d1974b6b2d5d7b6349639e08cdcbb7d Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Thu, 12 Sep 2019 00:16:11 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@275678 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 0766c007215..fabe17c4360 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190911 +20190912 -- cgit v1.2.3 From 4561fd86ae50156ba3e8934633d2e4f969d8f34a Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Fri, 13 Sep 2019 00:16:12 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@275693 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index fabe17c4360..8c8707812e3 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190912 +20190913 -- cgit v1.2.3 From 1d6a72a05e59caceb824c6ef4ca5b78777f0054e Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Sat, 14 Sep 2019 00:16:09 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@275707 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 8c8707812e3..fce7d428499 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190913 +20190914 -- cgit v1.2.3 From c6b469ffe87e63c7614989496887a3579c1cc7ce Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Sun, 15 Sep 2019 00:16:15 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@275721 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index fce7d428499..c958b3ad478 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190914 +20190915 -- cgit v1.2.3 From 5aa4e7306d63a4c0c13e365a574176a9a8d630c5 Mon Sep 17 00:00:00 2001 From: Thomas Koenig <tkoenig@gcc.gnu.org> Date: Sun, 15 Sep 2019 20:01:44 +0000 Subject: 2019-09-15 Thomas Koenig <tkoenig@gcc.gnu.org> Backport from trunk PR fortran/91557 * trans-decl.c (generate_local_decl): Do not warn if the symbol is artificial. * trans-types.c (get_formal_from_actual_arglist): Set artificial attribute on dummy arguments. 2019-09-15 Thomas Koenig <tkoenig@gcc.gnu.org> Backport from trunk PR fortran/91557 * gfortran.dg/warn_unused_dummy_argument_5.f90: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@275734 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fortran/ChangeLog | 12 +++++++----- gcc/fortran/trans-decl.c | 8 +++++--- gcc/fortran/trans-types.c | 1 + gcc/testsuite/ChangeLog | 6 ++++++ .../gfortran.dg/warn_unused_dummy_argument_5.f90 | 16 ++++++++++++++++ 5 files changed, 35 insertions(+), 8 deletions(-) create mode 100644 gcc/testsuite/gfortran.dg/warn_unused_dummy_argument_5.f90 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index f11fab33b80..9bfd1525830 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,9 +1,11 @@ -2019-09-05 Steven G. Kargl <kargl@gcc.gnu.org> +2019-09-15 Thomas Koenig <tkoenig@gcc.gnu.org> - PR fortran/91660 - * gfortran.dg/pdt_4.f03: Fix invalid code. - * gfortran.dg/pr91660_1.f90: New test. - * gfortran.dg/pr91660_2.f90: Ditto. + Backport from trunk + PR fortran/91557 + * trans-decl.c (generate_local_decl): Do not warn if the symbol + is artificial. + * trans-types.c (get_formal_from_actual_arglist): Set artificial + attribute on dummy arguments. 2013-08-13 Thomas Koenig <tkoenig@gcc.gnu.org> diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c index 8ccadaf9a17..4b490950530 100644 --- a/gcc/fortran/trans-decl.c +++ b/gcc/fortran/trans-decl.c @@ -5724,9 +5724,11 @@ generate_local_decl (gfc_symbol * sym) } else if (warn_unused_dummy_argument) { - gfc_warning (OPT_Wunused_dummy_argument, - "Unused dummy argument %qs at %L", sym->name, - &sym->declared_at); + if (!sym->attr.artificial) + gfc_warning (OPT_Wunused_dummy_argument, + "Unused dummy argument %qs at %L", sym->name, + &sym->declared_at); + if (sym->backend_decl != NULL_TREE) TREE_NO_WARNING(sym->backend_decl) = 1; } diff --git a/gcc/fortran/trans-types.c b/gcc/fortran/trans-types.c index 502a383c393..cc505aeb0bd 100644 --- a/gcc/fortran/trans-types.c +++ b/gcc/fortran/trans-types.c @@ -3042,6 +3042,7 @@ get_formal_from_actual_arglist (gfc_symbol *sym, gfc_actual_arglist *actual_args } } s->attr.dummy = 1; + s->attr.artificial = 1; s->attr.intent = INTENT_UNKNOWN; (*f)->sym = s; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 0bb00622775..4b593b520a0 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2019-09-15 Thomas Koenig <tkoenig@gcc.gnu.org> + + Backport from trunk + PR fortran/91557 + * gfortran.dg/warn_unused_dummy_argument_5.f90: New test. + 2019-09-11 Eric Botcazou <ebotcazou@adacore.com> * gcc.target/sparc/20161111-1.c: XFAIL redundant zero-extension test. diff --git a/gcc/testsuite/gfortran.dg/warn_unused_dummy_argument_5.f90 b/gcc/testsuite/gfortran.dg/warn_unused_dummy_argument_5.f90 new file mode 100644 index 00000000000..fa93f1d7ff2 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/warn_unused_dummy_argument_5.f90 @@ -0,0 +1,16 @@ +! { dg-do compile } +! { dg-additional-options "-Wunused-dummy-argument" } +! PR 91557 - this used to generate a bogus warning +! Test case by Gerhard Steinmetz +program p + integer :: a, b + a = 1 + call g +contains + subroutine g + integer :: x, y + call h (x, y) + if ( a > 0 ) y = y - 1 + b = y - x + 1 + end +end -- cgit v1.2.3 From f7550cca42f32f0ac8212e7dcae3b9200c2cc708 Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Mon, 16 Sep 2019 00:16:10 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@275739 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index c958b3ad478..2a82338b9b9 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190915 +20190916 -- cgit v1.2.3 From 6eac5e089d943a5f179bdb7c6de4ef5a4cfe40d7 Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Tue, 17 Sep 2019 00:16:26 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@275761 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 2a82338b9b9..2dd6da8d918 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190916 +20190917 -- cgit v1.2.3 From 4fc691aa920fb911c8d8883101e092c07883a914 Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Wed, 18 Sep 2019 00:16:08 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@275831 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 2dd6da8d918..2d37305fa62 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190917 +20190918 -- cgit v1.2.3 From 301ed1343c4d2f016e8b0679d6b9cec7c8bc190d Mon Sep 17 00:00:00 2001 From: Thomas Koenig <tkoenig@gcc.gnu.org> Date: Wed, 18 Sep 2019 17:39:33 +0000 Subject: 2019-09-18 Thomas Koenig <tkoenig@gcc.gnu.org> Backport from trunk PR fortran/91550 * frontend-passes.c (do_subscript): If step equals zero, a previuos error has been reported; do nothing in this case. * resolve.c (gfc_resolve_iterator): Move error checking after type conversion. 2019-09-18 Thomas Koenig <tkoenig@gcc.gnu.org> Backport from trunk PR fortran/91550 * gfortran.dg/do_subscript_6.f90: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@275892 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fortran/ChangeLog | 10 ++++++++++ gcc/fortran/frontend-passes.c | 22 +++++++++++++++++++++- gcc/fortran/resolve.c | 26 +++++++++++++------------- gcc/testsuite/ChangeLog | 6 ++++++ gcc/testsuite/gfortran.dg/do_subscript_6.f90 | 11 +++++++++++ 5 files changed, 61 insertions(+), 14 deletions(-) create mode 100644 gcc/testsuite/gfortran.dg/do_subscript_6.f90 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 9bfd1525830..a40efff7bcc 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,13 @@ +2019-09-18 Thomas Koenig <tkoenig@gcc.gnu.org> + + Backport from trunk + PR fortran/91550 + * frontend-passes.c (do_subscript): If step equals + zero, a previuos error has been reported; do nothing + in this case. + * resolve.c (gfc_resolve_iterator): Move error checking + after type conversion. + 2019-09-15 Thomas Koenig <tkoenig@gcc.gnu.org> Backport from trunk diff --git a/gcc/fortran/frontend-passes.c b/gcc/fortran/frontend-passes.c index 69bf1365479..2c1aafebb5f 100644 --- a/gcc/fortran/frontend-passes.c +++ b/gcc/fortran/frontend-passes.c @@ -2516,6 +2516,7 @@ do_subscript (gfc_expr **e) bool have_do_start, have_do_end; bool error_not_proven; int warn; + int sgn; dl = lp->c; if (dl == NULL) @@ -2544,7 +2545,16 @@ do_subscript (gfc_expr **e) Do not warn in this case. */ if (dl->ext.iterator->step->expr_type == EXPR_CONSTANT) - mpz_init_set (do_step, dl->ext.iterator->step->value.integer); + { + sgn = mpz_cmp_ui (dl->ext.iterator->step->value.integer, 0); + /* This can happen, but then the error has been + reported previusly. */ + if (sgn == 0) + continue; + + mpz_init_set (do_step, dl->ext.iterator->step->value.integer); + } + else continue; @@ -2568,6 +2578,16 @@ do_subscript (gfc_expr **e) if (!have_do_start && !have_do_end) return 0; + /* No warning inside a zero-trip loop. */ + if (have_do_start && have_do_end) + { + int cmp; + + cmp = mpz_cmp (do_end, do_start); + if ((sgn > 0 && cmp < 0) || (sgn < 0 && cmp > 0)) + break; + } + /* May have to correct the end value if the step does not equal one. */ if (have_do_start && have_do_end && mpz_cmp_ui (do_step, 1) != 0) diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index ad9090ef48c..3aad0bfa79b 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -6929,19 +6929,6 @@ gfc_resolve_iterator (gfc_iterator *iter, bool real_ok, bool own_scope) "Step expression in DO loop")) return false; - if (iter->step->expr_type == EXPR_CONSTANT) - { - if ((iter->step->ts.type == BT_INTEGER - && mpz_cmp_ui (iter->step->value.integer, 0) == 0) - || (iter->step->ts.type == BT_REAL - && mpfr_sgn (iter->step->value.real) == 0)) - { - gfc_error ("Step expression in DO loop at %L cannot be zero", - &iter->step->where); - return false; - } - } - /* Convert start, end, and step to the same type as var. */ if (iter->start->ts.kind != iter->var->ts.kind || iter->start->ts.type != iter->var->ts.type) @@ -6955,6 +6942,19 @@ gfc_resolve_iterator (gfc_iterator *iter, bool real_ok, bool own_scope) || iter->step->ts.type != iter->var->ts.type) gfc_convert_type (iter->step, &iter->var->ts, 1); + if (iter->step->expr_type == EXPR_CONSTANT) + { + if ((iter->step->ts.type == BT_INTEGER + && mpz_cmp_ui (iter->step->value.integer, 0) == 0) + || (iter->step->ts.type == BT_REAL + && mpfr_sgn (iter->step->value.real) == 0)) + { + gfc_error ("Step expression in DO loop at %L cannot be zero", + &iter->step->where); + return false; + } + } + if (iter->start->expr_type == EXPR_CONSTANT && iter->end->expr_type == EXPR_CONSTANT && iter->step->expr_type == EXPR_CONSTANT) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 4b593b520a0..5c1e6e00efa 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2019-09-18 Thomas Koenig <tkoenig@gcc.gnu.org> + + Backport from trunk + PR fortran/91550 + * gfortran.dg/do_subscript_6.f90: New test. + 2019-09-15 Thomas Koenig <tkoenig@gcc.gnu.org> Backport from trunk diff --git a/gcc/testsuite/gfortran.dg/do_subscript_6.f90 b/gcc/testsuite/gfortran.dg/do_subscript_6.f90 new file mode 100644 index 00000000000..d78b9d39056 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/do_subscript_6.f90 @@ -0,0 +1,11 @@ +! { dg-do compile } +! { dg-options "-std=legacy" } +! PR 91550 - this used to cause an ICE +! Test case by Gerhard Steinmetz +program p + real :: a(3) + integer :: i + do i = 1, 3, .1 ! { dg-error "cannot be zero" } + a(i) = i + end do +end -- cgit v1.2.3 From 56fba6f8e180af661829e0214710740df15da191 Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Thu, 19 Sep 2019 00:16:08 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@275922 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 2d37305fa62..c8a46c121fd 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190918 +20190919 -- cgit v1.2.3 From ca4a818d7f9426c4cbf124a0ced3b6e68b292b0d Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Fri, 20 Sep 2019 00:16:08 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@275984 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index c8a46c121fd..0fc3d8d4c09 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190919 +20190920 -- cgit v1.2.3 From a81014892ca2fafdad3e5d7264a01e7b6f3ac0d9 Mon Sep 17 00:00:00 2001 From: Andreas Krebbel <krebbel@linux.ibm.com> Date: Fri, 20 Sep 2019 09:03:44 +0000 Subject: Fix PR88751 This patch implements a small improvement for the heuristic in lra which decides when it has to activate the simpler register allocation algorithm. gcc/ChangeLog: 2019-09-20 Andreas Krebbel <krebbel@linux.ibm.com> Backport from mainline 2019-06-06 Andreas Krebbel <krebbel@linux.ibm.com> PR rtl-optimization/88751 * ira.c (ira): Use the number of the actually referenced registers when calculating the threshold. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@275991 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 9 +++++++++ gcc/ira.c | 9 ++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 350c7099a8c..03c2e33c7bc 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2019-09-20 Andreas Krebbel <krebbel@linux.ibm.com> + + Backport from mainline + 2019-06-06 Andreas Krebbel <krebbel@linux.ibm.com> + + PR rtl-optimization/88751 + * ira.c (ira): Use the number of the actually referenced registers + when calculating the threshold. + 2019-09-11 Eric Botcazou <ebotcazou@adacore.com> PR rtl-optimization/89795 diff --git a/gcc/ira.c b/gcc/ira.c index b7bcc15a15d..8d4361864d8 100644 --- a/gcc/ira.c +++ b/gcc/ira.c @@ -5147,6 +5147,8 @@ ira (FILE *f) int ira_max_point_before_emit; bool saved_flag_caller_saves = flag_caller_saves; enum ira_region saved_flag_ira_region = flag_ira_region; + unsigned int i; + int num_used_regs = 0; clear_bb_flags (); @@ -5162,12 +5164,17 @@ ira (FILE *f) ira_conflicts_p = optimize > 0; + /* Determine the number of pseudos actually requiring coloring. */ + for (i = FIRST_PSEUDO_REGISTER; i < DF_REG_SIZE (df); i++) + num_used_regs += !!(DF_REG_USE_COUNT (i) + DF_REG_DEF_COUNT (i)); + /* If there are too many pseudos and/or basic blocks (e.g. 10K pseudos and 10K blocks or 100K pseudos and 1K blocks), we will use simplified and faster algorithms in LRA. */ lra_simple_p = (ira_use_lra_p - && max_reg_num () >= (1 << 26) / last_basic_block_for_fn (cfun)); + && num_used_regs >= (1 << 26) / last_basic_block_for_fn (cfun)); + if (lra_simple_p) { /* It permits to skip live range splitting in LRA. */ -- cgit v1.2.3 From 63729677c13f807bc5af18da7eebc8991d7d46ad Mon Sep 17 00:00:00 2001 From: Iain Sandoe <iain@sandoe.co.uk> Date: Fri, 20 Sep 2019 18:29:16 +0000 Subject: [Darwin, X86, testsuite] Fix PR81058. The tests fail because Darwin indirects common accesses which causes different codegen and the mismatch in output. Placing the vars in regular .data section fixes that. gcc/testsuite/ 2019-09-20 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline. 2019-05-11 Iain Sandoe <iain@sandoe.co.uk> PR testsuite/81058 * gcc.target/i386/avx512bw-vpmovswb-1.c: Use regular data section for variables on Darwin, rather than common. * gcc.target/i386/avx512bw-vpmovuswb-1.c: Likewise. * gcc.target/i386/avx512bw-vpmovwb-1.c: Likewise. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@276003 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/testsuite/ChangeLog | 11 +++++++++++ gcc/testsuite/gcc.target/i386/avx512bw-vpmovswb-1.c | 1 + gcc/testsuite/gcc.target/i386/avx512bw-vpmovuswb-1.c | 1 + gcc/testsuite/gcc.target/i386/avx512bw-vpmovwb-1.c | 1 + 4 files changed, 14 insertions(+) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 5c1e6e00efa..e451d9c128e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,14 @@ +2019-09-20 Iain Sandoe <iain@sandoe.co.uk> + + Backport from mainline. + 2019-05-11 Iain Sandoe <iain@sandoe.co.uk> + + PR testsuite/81058 + * gcc.target/i386/avx512bw-vpmovswb-1.c: Use regular data section + for variables on Darwin, rather than common. + * gcc.target/i386/avx512bw-vpmovuswb-1.c: Likewise. + * gcc.target/i386/avx512bw-vpmovwb-1.c: Likewise. + 2019-09-18 Thomas Koenig <tkoenig@gcc.gnu.org> Backport from trunk diff --git a/gcc/testsuite/gcc.target/i386/avx512bw-vpmovswb-1.c b/gcc/testsuite/gcc.target/i386/avx512bw-vpmovswb-1.c index 6bb87d25f4d..9d470c62b9e 100644 --- a/gcc/testsuite/gcc.target/i386/avx512bw-vpmovswb-1.c +++ b/gcc/testsuite/gcc.target/i386/avx512bw-vpmovswb-1.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-mavx512bw -mavx512vl -O2" } */ +/* { dg-additional-options "-fno-common" { target *-*-darwin* } } */ /* { dg-final { scan-assembler-times "vpmovswb\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\[^\n\]*%xmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */ /* { dg-final { scan-assembler-times "vpmovswb\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\[^\n\]*%xmm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */ /* { dg-final { scan-assembler-times "vpmovswb\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\[^\n\]*%xmm\[0-9\]+\{%k\[1-7\]\}{z}(?:\n|\[ \\t\]+#)" 1 } } */ diff --git a/gcc/testsuite/gcc.target/i386/avx512bw-vpmovuswb-1.c b/gcc/testsuite/gcc.target/i386/avx512bw-vpmovuswb-1.c index 7825e46a944..da51198ffe1 100644 --- a/gcc/testsuite/gcc.target/i386/avx512bw-vpmovuswb-1.c +++ b/gcc/testsuite/gcc.target/i386/avx512bw-vpmovuswb-1.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-mavx512bw -mavx512vl -O2" } */ +/* { dg-additional-options "-fno-common" { target *-*-darwin* } } */ /* { dg-final { scan-assembler-times "vpmovuswb\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\[^\n\]*%xmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */ /* { dg-final { scan-assembler-times "vpmovuswb\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\[^\n\]*%xmm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */ /* { dg-final { scan-assembler-times "vpmovuswb\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\[^\n\]*%xmm\[0-9\]+\{%k\[1-7\]\}{z}(?:\n|\[ \\t\]+#)" 1 } } */ diff --git a/gcc/testsuite/gcc.target/i386/avx512bw-vpmovwb-1.c b/gcc/testsuite/gcc.target/i386/avx512bw-vpmovwb-1.c index a1ad551392b..e67da87b33d 100644 --- a/gcc/testsuite/gcc.target/i386/avx512bw-vpmovwb-1.c +++ b/gcc/testsuite/gcc.target/i386/avx512bw-vpmovwb-1.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-mavx512bw -mavx512vl -O2" } */ +/* { dg-additional-options "-fno-common" { target *-*-darwin* } } */ /* { dg-final { scan-assembler-times "vpmovwb\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\[^\n\]*%xmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */ /* { dg-final { scan-assembler-times "vpmovwb\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\[^\n\]*%xmm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */ /* { dg-final { scan-assembler-times "vpmovwb\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\[^\n\]*%xmm\[0-9\]+\{%k\[1-7\]\}{z}(?:\n|\[ \\t\]+#)" 1 } } */ -- cgit v1.2.3 From a3b405f35893ca81db335c2b20abc0ed8e09ac6a Mon Sep 17 00:00:00 2001 From: John David Anglin <danglin@gcc.gnu.org> Date: Fri, 20 Sep 2019 21:56:25 +0000 Subject: * config/pa/pa.c (pa_trampoline_init): Remove spurious extended character. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@276009 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 5 +++++ gcc/config/pa/pa.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 03c2e33c7bc..fa4b29638b9 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2019-09-20 John David Anglin <danglin@gcc.gnu.org> + + * config/pa/pa.c (pa_trampoline_init): Remove spurious extended + character. + 2019-09-20 Andreas Krebbel <krebbel@linux.ibm.com> Backport from mainline diff --git a/gcc/config/pa/pa.c b/gcc/config/pa/pa.c index 65be97def0a..411ea9cbb0d 100644 --- a/gcc/config/pa/pa.c +++ b/gcc/config/pa/pa.c @@ -10234,7 +10234,7 @@ pa_trampoline_init (rtx m_tramp, tree fndecl, rtx chain_value) } #ifdef HAVE_ENABLE_EXECUTE_STACK -  emit_library_call (gen_rtx_SYMBOL_REF (Pmode, "__enable_execute_stack"), + emit_library_call (gen_rtx_SYMBOL_REF (Pmode, "__enable_execute_stack"), LCT_NORMAL, VOIDmode, XEXP (m_tramp, 0), Pmode); #endif } -- cgit v1.2.3 From c67fc362aa27baabbe14283c4b61890b2fc36338 Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Sat, 21 Sep 2019 00:16:09 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@276013 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 0fc3d8d4c09..6108a455f56 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190920 +20190921 -- cgit v1.2.3 From 4406c0a43f552cb51b9426a45b24c2c8c74292a9 Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Sun, 22 Sep 2019 00:16:08 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@276024 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 6108a455f56..088b92f47f6 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190921 +20190922 -- cgit v1.2.3 From 98ddc37fb6723657ee228e42f4121acc260e5462 Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Mon, 23 Sep 2019 00:16:10 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@276033 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 088b92f47f6..0bff5aa14a2 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190922 +20190923 -- cgit v1.2.3 From ca5bd7dd7069fe73ed0c8f729d4a8bf197a30600 Mon Sep 17 00:00:00 2001 From: Max Filippov <jcmvbkbc@gmail.com> Date: Mon, 23 Sep 2019 07:48:41 +0000 Subject: xtensa: backport fix for PR target/90922 Stack pointer adjustment code in prologue missed a case of no callee-saved registers and a stack frame size bigger than 128 bytes. Handle that case. This fixes the following gcc tests with call0 ABI: gcc.c-torture/execute/stdarg-2.c gcc.dg/torture/pr55882.c gcc.dg/torture/pr57569.c gcc/ 2019-09-23 Max Filippov <jcmvbkbc@gmail.com> Backport from mainline 2019-06-18 Max Filippov <jcmvbkbc@gmail.com> * config/xtensa/xtensa.c (xtensa_expand_prologue): Add stack pointer adjustment for the case of no callee-saved registers and stack frame bigger than 128 bytes. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@276038 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 9 +++++++++ gcc/config/xtensa/xtensa.c | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index fa4b29638b9..1a4c3993252 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2019-09-23 Max Filippov <jcmvbkbc@gmail.com> + + Backport from mainline + 2019-06-18 Max Filippov <jcmvbkbc@gmail.com> + + * config/xtensa/xtensa.c (xtensa_expand_prologue): Add stack + pointer adjustment for the case of no callee-saved registers and + stack frame bigger than 128 bytes. + 2019-09-20 John David Anglin <danglin@gcc.gnu.org> * config/pa/pa.c (pa_trampoline_init): Remove spurious extended diff --git a/gcc/config/xtensa/xtensa.c b/gcc/config/xtensa/xtensa.c index 080bb4ad765..08f9f7c7a8f 100644 --- a/gcc/config/xtensa/xtensa.c +++ b/gcc/config/xtensa/xtensa.c @@ -2862,7 +2862,8 @@ xtensa_expand_prologue (void) gen_rtx_SET (mem, reg)); } } - if (total_size > 1024) + if (total_size > 1024 + || (!callee_save_size && total_size > 128)) { rtx tmp_reg = gen_rtx_REG (Pmode, A9_REG); emit_move_insn (tmp_reg, GEN_INT (total_size - -- cgit v1.2.3 From c9187bb25c822fcc6e04f8ad1930f21f1481e5de Mon Sep 17 00:00:00 2001 From: Eric Botcazou <ebotcazou@adacore.com> Date: Mon, 23 Sep 2019 08:09:22 +0000 Subject: * gcc-interface/trans.c (Attribute_to_gnu): Test Can_Use_Internal_Rep on the underlying type of the node. (Call_to_gnu): Likewise with the type of the prefix. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@276043 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ada/ChangeLog | 6 ++++++ gcc/ada/gcc-interface/trans.c | 48 +++++++++++++++++++++---------------------- 2 files changed, 29 insertions(+), 25 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index ae241640019..478bb86cf4f 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,9 @@ +2019-09-23 Eric Botcazou <ebotcazou@adacore.com> + + * gcc-interface/trans.c (Attribute_to_gnu): Test Can_Use_Internal_Rep + on the underlying type of the node. + (Call_to_gnu): Likewise with the type of the prefix. + 2019-09-01 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline. diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c index 1dc427082f8..5925a4860da 100644 --- a/gcc/ada/gcc-interface/trans.c +++ b/gcc/ada/gcc-interface/trans.c @@ -1720,32 +1720,29 @@ Attribute_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, int attribute) /* For other address attributes applied to a nested function, find an inner ADDR_EXPR and annotate it so that we can issue a useful warning with -Wtrampolines. */ - else if (TREE_CODE (TREE_TYPE (gnu_prefix)) == FUNCTION_TYPE) + else if (TREE_CODE (TREE_TYPE (gnu_prefix)) == FUNCTION_TYPE + && (gnu_expr = remove_conversions (gnu_result, false)) + && TREE_CODE (gnu_expr) == ADDR_EXPR + && decl_function_context (TREE_OPERAND (gnu_expr, 0))) { - gnu_expr = remove_conversions (gnu_result, false); + set_expr_location_from_node (gnu_expr, gnat_node); - if (TREE_CODE (gnu_expr) == ADDR_EXPR - && decl_function_context (TREE_OPERAND (gnu_expr, 0))) - { - set_expr_location_from_node (gnu_expr, gnat_node); - - /* Also check the inlining status. */ - check_inlining_for_nested_subprog (TREE_OPERAND (gnu_expr, 0)); - - /* Moreover, for 'Access or 'Unrestricted_Access with non- - foreign-compatible representation, mark the ADDR_EXPR so - that we can build a descriptor instead of a trampoline. */ - if ((attribute == Attr_Access - || attribute == Attr_Unrestricted_Access) - && targetm.calls.custom_function_descriptors > 0 - && Can_Use_Internal_Rep (Etype (gnat_node))) - FUNC_ADDR_BY_DESCRIPTOR (gnu_expr) = 1; - - /* Otherwise, we need to check that we are not violating the - No_Implicit_Dynamic_Code restriction. */ - else if (targetm.calls.custom_function_descriptors != 0) - Check_Implicit_Dynamic_Code_Allowed (gnat_node); - } + /* Also check the inlining status. */ + check_inlining_for_nested_subprog (TREE_OPERAND (gnu_expr, 0)); + + /* Moreover, for 'Access or 'Unrestricted_Access with non- + foreign-compatible representation, mark the ADDR_EXPR so + that we can build a descriptor instead of a trampoline. */ + if ((attribute == Attr_Access + || attribute == Attr_Unrestricted_Access) + && targetm.calls.custom_function_descriptors > 0 + && Can_Use_Internal_Rep (Underlying_Type (Etype (gnat_node)))) + FUNC_ADDR_BY_DESCRIPTOR (gnu_expr) = 1; + + /* Otherwise, we need to check that we are not violating the + No_Implicit_Dynamic_Code restriction. */ + else if (targetm.calls.custom_function_descriptors != 0) + Check_Implicit_Dynamic_Code_Allowed (gnat_node); } break; @@ -4318,7 +4315,8 @@ Call_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, tree gnu_target, /* If the access type doesn't require foreign-compatible representation, be prepared for descriptors. */ if (targetm.calls.custom_function_descriptors > 0 - && Can_Use_Internal_Rep (Etype (Prefix (Name (gnat_node))))) + && Can_Use_Internal_Rep + (Underlying_Type (Etype (Prefix (Name (gnat_node)))))) by_descriptor = true; } else if (Nkind (Name (gnat_node)) == N_Attribute_Reference) -- cgit v1.2.3 From 14801e6947cd363d05651dbc399cc1efcc5a1b18 Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Tue, 24 Sep 2019 00:16:27 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@276087 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 0bff5aa14a2..1012279ef74 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190923 +20190924 -- cgit v1.2.3 From c865343a24869dba532fe2fa9389c9a1c249595b Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Wed, 25 Sep 2019 00:16:33 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@276109 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 1012279ef74..63194839a60 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190924 +20190925 -- cgit v1.2.3 From e3264a6a5585b3cb0ee542e94031aacbedc85e62 Mon Sep 17 00:00:00 2001 From: Kyrylo Tkachov <kyrylo.tkachov@arm.com> Date: Wed, 25 Sep 2019 15:05:07 +0000 Subject: [arm] Fix use of CRC32 intrinsics with Armv8-a and hard-float 2019-09-25 Kyrylo Tkachov <kyrylo.tkachov@arm.com> Backport from mainline 2019-08-22 Kyrylo Tkachov <kyrylo.tkachov@arm.com> * config/arm/arm_acle.h: Use arch=armv8-a+crc+simd pragma for CRC32 intrinsics if __ARM_FP. Use __ARM_FEATURE_CRC32 ifdef guard. * gcc.target/arm/acle/crc_hf_1.c: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@276129 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 9 +++++++++ gcc/config/arm/arm_acle.h | 8 ++++++-- gcc/testsuite/ChangeLog | 7 +++++++ gcc/testsuite/gcc.target/arm/acle/crc_hf_1.c | 14 ++++++++++++++ 4 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gcc.target/arm/acle/crc_hf_1.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 1a4c3993252..d37d462f906 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2019-09-25 Kyrylo Tkachov <kyrylo.tkachov@arm.com> + + Backport from mainline + 2019-08-22 Kyrylo Tkachov <kyrylo.tkachov@arm.com> + + * config/arm/arm_acle.h: Use arch=armv8-a+crc+simd pragma for CRC32 + intrinsics if __ARM_FP. + Use __ARM_FEATURE_CRC32 ifdef guard. + 2019-09-23 Max Filippov <jcmvbkbc@gmail.com> Backport from mainline diff --git a/gcc/config/arm/arm_acle.h b/gcc/config/arm/arm_acle.h index c0f6ea2d156..eb1b218bc76 100644 --- a/gcc/config/arm/arm_acle.h +++ b/gcc/config/arm/arm_acle.h @@ -174,8 +174,12 @@ __arm_mrrc2 (const unsigned int __coproc, const unsigned int __opc1, #endif /* (!__thumb__ || __thumb2__) && __ARM_ARCH >= 4. */ #pragma GCC push_options -#if __ARM_ARCH >= 8 +#ifdef __ARM_FEATURE_CRC32 +#ifdef __ARM_FP +#pragma GCC target ("arch=armv8-a+crc+simd") +#else #pragma GCC target ("arch=armv8-a+crc") +#endif __extension__ static __inline uint32_t __attribute__ ((__always_inline__)) __crc32b (uint32_t __a, uint8_t __b) @@ -235,7 +239,7 @@ __crc32cd (uint32_t __a, uint64_t __b) } #endif -#endif /* __ARM_ARCH >= 8. */ +#endif /* __ARM_FEATURE_CRC32 */ #pragma GCC pop_options #ifdef __cplusplus diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e451d9c128e..ce0b36cdb56 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2019-09-25 Kyrylo Tkachov <kyrylo.tkachov@arm.com> + + Backport from mainline + 2019-08-22 Kyrylo Tkachov <kyrylo.tkachov@arm.com> + + * gcc.target/arm/acle/crc_hf_1.c: New test. + 2019-09-20 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline. diff --git a/gcc/testsuite/gcc.target/arm/acle/crc_hf_1.c b/gcc/testsuite/gcc.target/arm/acle/crc_hf_1.c new file mode 100644 index 00000000000..e6cbfc0b33e --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/acle/crc_hf_1.c @@ -0,0 +1,14 @@ +/* Test that using an Armv8-a hard-float target doesn't + break CRC intrinsics. */ + +/* { dg-do compile } */ +/* { dg-require-effective-target arm_hard_vfp_ok } */ +/* { dg-options "-mfloat-abi=hard -march=armv8-a+simd+crc" } */ + +#include <arm_acle.h> + +uint32_t +foo (uint32_t a, uint32_t b) +{ + return __crc32cw (a, b); +} -- cgit v1.2.3 From 500f3bb10c0042ab0647e08c6be9ef9df9766b6d Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Thu, 26 Sep 2019 00:16:15 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@276137 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 63194839a60..1c14e6dbe55 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190925 +20190926 -- cgit v1.2.3 From ad1106cdab4948f87e986986fc7e7151f41566b2 Mon Sep 17 00:00:00 2001 From: Iain Sandoe <iain@sandoe.co.uk> Date: Thu, 26 Sep 2019 19:11:41 +0000 Subject: [Darwin, opts processing] Fix missing RejectNegative etc. This adds RejectNegative in a number of places it was needed, reorders the opts into two groups (one general and one driver-only). We also add a minimal description to each opt, and note some that are now obsolete. The only functional change is to permit -mtarget-linker= as an alias of -mtarget-linker. This fixes the Darwin part of PR89327 2019-09-26 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline 2019-06-16 Iain Sandoe <iain@sandoe.co.uk> * config/darwin.opt (prebind, noprebind, seglinkedit, noseglinkedit): Add RejectNegative. Backport from mainline 2019-06-14 Iain Sandoe <iain@sandoe.co.uk> * config/darwin.opt: Add RejectNegative where needed, reorder and add minimal functional descriptions. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@276161 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 14 ++ gcc/config/darwin.opt | 397 ++++++++++++++++++++++++++++++-------------------- 2 files changed, 252 insertions(+), 159 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d37d462f906..b704d3a8399 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,17 @@ +2019-09-26 Iain Sandoe <iain@sandoe.co.uk> + + Backport from mainline + 2019-06-16 Iain Sandoe <iain@sandoe.co.uk> + + * config/darwin.opt (prebind, noprebind, seglinkedit, + noseglinkedit): Add RejectNegative. + + Backport from mainline + 2019-06-14 Iain Sandoe <iain@sandoe.co.uk> + + * config/darwin.opt: Add RejectNegative where needed, reorder + and add minimal functional descriptions. + 2019-09-25 Kyrylo Tkachov <kyrylo.tkachov@arm.com> Backport from mainline diff --git a/gcc/config/darwin.opt b/gcc/config/darwin.opt index 0d733702649..52a919a3f17 100644 --- a/gcc/config/darwin.opt +++ b/gcc/config/darwin.opt @@ -18,240 +18,378 @@ ; along with GCC; see the file COPYING3. If not see ; <http://www.gnu.org/licenses/>. -; Various linker options have a -Z added so that they can get to specs -; processing without interference. Note that an option name with a -; prefix that matches another option name, that also takes an -; argument, being mapped to a -Z linker option, needs to be modified -; so the prefix is different, otherwise a '*' after the shorter option -; will match with the longer one. +; We have a lot of Driver options, many of which are obsolete or very very +; rarely used so, to keep this file easier to manage: + +; Please place all Non-driver options first (in alphabetical order), followed +; by Driver-only options. + +; Non-driver options. + +dependency-file +C ObjC C++ ObjC++ Separate Alias(MF) MissingArgError(missing filename after %qs) + +fapple-kext +Target Report C++ Var(flag_apple_kext) +Generate code for darwin loadable kernel extensions. + +iframework +Target RejectNegative C ObjC C++ ObjC++ Joined Separate +-iframework <dir> Add <dir> to the end of the system framework include path. + +mconstant-cfstrings +Target Report Var(darwin_constant_cfstrings) Init(1) +Generate compile-time CFString objects. + +Wnonportable-cfstrings +Target Report Var(darwin_warn_nonportable_cfstrings) Init(1) Warning +Warn if constant CFString objects contain non-portable characters. + +; Use new-style pic stubs if this is true, x86 only so far. +matt-stubs +Target Report Var(darwin_macho_att_stub) Init(1) +Generate AT&T-style stubs for Mach-O. + +mdynamic-no-pic +Target Common Report Mask(MACHO_DYNAMIC_NO_PIC) +Generate code suitable for executables (NOT shared libs). + +mfix-and-continue +Target Report Var(darwin_fix_and_continue) +Generate code suitable for fast turn around debugging. + +mkernel +Target Report Var(flag_mkernel) +Generate code for the kernel or loadable kernel extensions. + +; The Init here is for the convenience of GCC developers, so that cc1 +; and cc1plus don't crash if no -mmacosx-version-min is passed. The +; driver will always pass a -mmacosx-version-min, so in normal use the +; Init is never used. +mmacosx-version-min= +Target RejectNegative Joined Report Var(darwin_macosx_version_min) Init(DEF_MIN_OSX_VERSION) +The earliest MacOS X version on which this program will run. + +; Really, only relevant to PowerPC which has a 4 byte bool by default. +mone-byte-bool +Target RejectNegative Report Var(darwin_one_byte_bool) +Set sizeof(bool) to 1. + +; Some code-gen may be improved / adjusted if the linker is sufficiently modern. +mtarget-linker= +Target RejectNegative Joined Report Alias(mtarget-linker) + +mtarget-linker +Target RejectNegative Joined Separate Report Var(darwin_target_linker) Init(LD64_VERSION) +The version of ld64 in use for this toolchain. + +; Driver options. all_load -Driver Alias(Zall_load) +Driver RejectNegative Alias(Zall_load) +Loads all members of archive libraries allowable_client -Driver Separate Alias(Zallowable_client) +Driver RejectNegative Separate Alias(Zallowable_client) +-allowable_client <name> The output dylib is private to the client(s) named arch Driver RejectNegative Separate +-arch <name> Specify that the output file should be generated for architecture \"name\" arch_errors_fatal -Driver Alias(Zarch_errors_fatal) +Driver RejectNegative Alias(Zarch_errors_fatal) +Mismatches between file architecture and the \"-arch\" are errors instead of warnings asm_macosx_version_min= Driver RejectNegative Joined +The earliest MacOS X version on which this program will run (formatted for the assembler) bind_at_load -Driver Alias(Zbind_at_load) +Driver RejectNegative Alias(Zbind_at_load) +Produce an output file that will bind symbols on load, rather than lazily. bundle -Driver Alias(Zbundle) +Driver RejectNegative Alias(Zbundle) +Produce a Mach-O bundle (file type MH_BUNDLE) bundle_loader -Driver Separate Alias(Zbundle_loader) +Driver RejectNegative Separate Alias(Zbundle_loader) +-bundle_loader <executable> Treat \"executable\" (that will be loading this bundle) as if it was one of the dynamic libraries the bundle is linked against for symbol resolution -dead_strip -Driver Alias(Zdead_strip) +client_name +Driver RejectNegative Separate +-client_name <name> Enable the executable being built to link against a private dylib (using allowable_client) -dependency-file -C ObjC C++ ObjC++ Separate Alias(MF) MissingArgError(missing filename after %qs) +compatibility_version +Driver RejectNegative Separate +-compatibility_version <number> Set the minimum version for the client interface. Clients must record a greater number than this or the binding will fail at runtime + +current_version +Driver RejectNegative Separate +-current_version <number> Set the current version for the library. + +dead_strip +Driver RejectNegative Alias(Zdead_strip) +Remove code and data that is unreachable from any exported symbol (including the entry point) dylib_file Driver Separate Alias(Zdylib_file) dylinker -Driver +Driver RejectNegative +Produce a Mach-O dylinker (file type MH_DYLINKER), only used for building dyld. + +dylinker_install_name +Driver RejectNegative Separate +-dylinker_install_name <path> Only used for building dyld. dynamic -Driver Alias(Zdynamic) +Driver RejectNegative Alias(Zdynamic) +The default (and opposite of -static), implied by user mode executables, shared libraries and bundles. dynamiclib -Driver Alias(Zdynamiclib) +Driver RejectNegative Alias(Zdynamiclib) +Produce a Mach-O shared library (file type MH_DYLIB), synonym for -shared exported_symbols_list -Driver Separate Alias(Zexported_symbols_list) +Driver RejectNegative Separate Alias(Zexported_symbols_list) +-exported_symbols_list <filename> Global symbols in \"filename\" will be exported from the linked output file, any symbols not mentioned will be treated as hidden. filelist Driver RejectNegative Separate +Supply a list of objects to be linked from a file, rather than the command line findirect-virtual-calls Driver RejectNegative +Used for generating code for some older kernel revisions. flat_namespace Driver RejectNegative Alias(Zflat_namespace) +Ignore the normal two-level namespace; resolve symbols in command line order and do not record which library provided the resolved symbol. force_cpusubtype_ALL Driver RejectNegative Alias(Zforce_cpusubtype_ALL) +For the assembler (and linker) permit any architecture sub-variant to be used without error. force_flat_namespace Driver RejectNegative Alias(Zforce_flat_namespace) +Set the output object such that, on loading, dyld will ignore any two-level information and resolve symbols in the discovery order for loaded libs. framework Driver RejectNegative Separate +-framework <name> The linker should search for the named framework in the framework search path. fterminated-vtables Driver RejectNegative +Used for generating code for some older kernel revisions. gfull Driver RejectNegative +Abbreviation for \"-g -fno-eliminate-unused-debug-symbols\" gused Driver RejectNegative +Abbreviation for \"-g -feliminate-unused-debug-symbols\" headerpad_max_install_names -Driver +Driver RejectNegative +Automatically adds space for longer path names in load commands (up to MAXPATHLEN) image_base -Driver Separate Alias(Zimage_base) +Driver RejectNegative Separate Alias(Zimage_base) +-image_base <address> Choose a base address for a dylib or bundle. init -Driver Separate Alias(Zinit) +Driver RejectNegative Separate Alias(Zinit) +-init <symbol_name> The symbol \"symbol_name\" will be used as the first initialiser for a dylib. install_name -Driver Separate Alias(Zinstall_name) +Driver RejectNegative Separate Alias(Zinstall_name) +-install_name <name> Set the install name for a dylib. keep_private_externs -Driver - -mconstant-cfstrings -Target Report Var(darwin_constant_cfstrings) Init(1) -Generate compile-time CFString objects. +Driver RejectNegative +Usually \"private extern\" (hidden) symbols are made local when linking, this command suppresses that such that they remain exported. multi_module Driver RejectNegative Alias(Zmulti_module) +(Obsolete after 10.4) Multi modules are ignored at runtime since MacOS 10.4 multiply_defined Driver RejectNegative Separate Alias(Zmultiply_defined) +(Obsolete after 10.4) -multiply_defined <treatment> Provided a mechanism for warning about symbols defined in multiple dylibs. multiply_defined_unused Driver RejectNegative Separate Alias(Zmultiplydefinedunused) +(Obsolete after 10.4) -multiply_defined_unused <treatment> Provided a mechanism for warning about symbols defined in the current executable also being defined in linked dylibs. no_dead_strip_inits_and_terms -Driver Alias(Zno_dead_strip_inits_and_terms) +Driver RejectNegative Alias(Zno_dead_strip_inits_and_terms) +(Obsolete) The linker never dead strips these items, so the option is not needed. nofixprebinding -Driver +Driver RejectNegative +(Obsolete after 10.3.9) Set MH_NOPREFIXBINDING, in an exectuable. nomultidefs -Driver +Driver RejectNegative +(Obsolete after 10.4) Set MH_NOMULTIDEFS in an umbrella framework. noprebind -Driver +Driver RejectNegative Negative(prebind) +(Obsolete) LD_PREBIND is no longer supported. noseglinkedit -Driver +Driver RejectNegative Negative(seglinkedit) +(Obsolete) This is the default. object -Driver +Driver RejectNegative + +pagezero_size +Driver RejectNegative Separate +-pagezero_size size Allows setting the page 0 size to 4kb for certain special cases. prebind -Driver +Driver RejectNegative Negative(noprebind) +(Obsolete) LD_PREBIND is no longer supported. prebind_all_twolevel_modules -Driver +Driver RejectNegative +(Obsolete) LD_PREBIND is no longer supported. preload -Driver +Driver RejectNegative +Produces a Mach-O file suitable for embedded/ROM use. private_bundle -Driver +Driver RejectNegative +(Obsolete) Allowed linking to proceed with \"-flat_namespace\" when a linked bundle contained a symbol also exported from the main executable. pthread -Driver +Driver RejectNegative rdynamic -Driver +Driver RejectNegative +Synonym for \"-export-dynamic\" for linker versions that support it. + +read_only_relocs +Driver RejectNegative Separate +-read_only_relocs <treatment> This will allow relocs in read-only pages (not advisable). + +sectalign +Driver RejectNegative Separate Args(3) +-sectalign <segname> <sectname> <value> Set section \"sectname\" in segment \"segname\" to have alignment \"value\" which must be an integral power of two expressed in hexadecimal form. + +sectcreate +Driver RejectNegative Separate Args(3) +-sectcreate <segname> <sectname> <file> Create section \"sectname\" in segment \"segname\" from the contents of \"file\". + +sectobjectsymbols +Driver RejectNegative Separate Args(2) +(Obsolete) -sectobjectsymbols <segname> <sectname> Setting a local symbol at the start of a section is no longer supported. + +sectorder +Driver RejectNegative Separate Args(3) +(Obsolete) -sectorder <segname> <sectname> orderfile Replaced by a more general option \"-order_file\". seg_addr_table -Driver Separate Alias(Zseg_addr_table) +Driver RejectNegative Separate Alias(Zseg_addr_table) +-seg_addr_table <file> Specify the base addresses for dynamic libraries, \"file\" contains a line for each library. +; This is only usable by the ld_classic linker. seg_addr_table_filename -Driver Separate Alias(Zfn_seg_addr_table_filename) +Driver RejectNegative Separate Alias(Zfn_seg_addr_table_filename) +(Obsolete, ld_classic only) -seg_addr_table_filename <path> + +seg1addr +Driver RejectNegative Separate +Synonym for \"image_base\" segaddr -Driver Separate Args(2) Alias(Zsegaddr) +Driver RejectNegative Separate Args(2) Alias(Zsegaddr) +-segaddr <name> <address> Set the base address of segment \"name\" to \"address\" which must be aligned to a page boundary (currently 4kb). + +; This is only usable by the ld_classic linker. +segcreate +Driver RejectNegative Separate Args(3) +(Obsolete, ld_classic only) -sectcreate segname sectname file seglinkedit -Driver +Driver RejectNegative Negative(noseglinkedit) +(Obsolete) Object files with LINKEDIT sections are no longer supported. + +segprot +Driver RejectNegative Separate Args(3) +-segprot <segname> max_prot init_prot The protection values are \"r\", \"w\", \"x\" or \"-\" the latter meaning \"no access\". segs_read_only_addr -Driver Separate Alias(Zsegs_read_only_addr) +Driver RejectNegative Separate Alias(Zsegs_read_only_addr) +-segs_read_only_addr address Allows specifying the address of the read only portion of a dylib. segs_read_write_addr -Driver Separate Alias(Zsegs_read_write_addr) +Driver RejectNegative Separate Alias(Zsegs_read_write_addr) +-segs_read_write_addr address Allows specifying the address of the read/write portion of a dylib. single_module -Driver Alias(Zsingle_module) +Driver RejectNegative Alias(Zsingle_module) +(Obsolete) This is the default. + +sub_library +Driver RejectNegative Separate +-sub_library <name> Library named \"name\" will be re-exported (only useful for dylibs). + +sub_umbrella +Driver RejectNegative Separate +-sub_umbrella <name> Framework named \"name\" will be re-exported (only useful for dylibs). twolevel_namespace -Driver +Driver RejectNegative +This is the default twolevel_namespace_hints -Driver +Driver RejectNegative +Specifies content that can speed up dynamic loading when the binaries are unchanged. umbrella -Driver Separate Alias(Zumbrella) +Driver RejectNegative Separate Alias(Zumbrella) +-umbrella <framework> The specified framework will be re-exported. + +undefined +Driver RejectNegative Separate +-undefined <treatment> Specify the handling for undefined symbols (default is error). unexported_symbols_list -Driver Separate Alias(Zunexported_symbols_list) +Driver RejectNegative Separate Alias(Zunexported_symbols_list) +-unexported_symbols_list <filename> Don't export global symbols listed in filename. weak_reference_mismatches -Driver Separate Alias(Zweak_reference_mismatches) +Driver RejectNegative Separate Alias(Zweak_reference_mismatches) +-weak_reference_mismatches <treatment> Specifies what to do if a symbol import conflicts between file (weak in one and not in another) the default is to treat the symbol as non-weak. whatsloaded -Driver +Driver RejectNegative +Logs the object files the linker loads whyload -Driver +Driver RejectNegative +Logs which symbol(s) caused an object to be loaded. + +;(Obsolete, ignored) Strip symbols starting with "L", this is the default. +X +Driver RejectNegative y -Driver Joined +Driver RejectNegative Joined +(Obsolete, ignored) Old support similar to whyload. Mach -Driver - -Wnonportable-cfstrings -Target Report Var(darwin_warn_nonportable_cfstrings) Init(1) Warning -Warn if constant CFString objects contain non-portable characters. - -; Use new-style pic stubs if this is true, x86 only so far. -matt-stubs -Target Report Var(darwin_macho_att_stub) Init(1) -Generate AT&T-style stubs for Mach-O. - -mdynamic-no-pic -Target Common Report Mask(MACHO_DYNAMIC_NO_PIC) -Generate code suitable for executables (NOT shared libs). - -mfix-and-continue -Target Report Var(darwin_fix_and_continue) -Generate code suitable for fast turn around debugging. - -; The Init here is for the convenience of GCC developers, so that cc1 -; and cc1plus don't crash if no -mmacosx-version-min is passed. The -; driver will always pass a -mmacosx-version-min, so in normal use the -; Init is never used. -mmacosx-version-min= -Target Joined Report Var(darwin_macosx_version_min) Init(DEF_MIN_OSX_VERSION) -The earliest MacOS X version on which this program will run. - -mone-byte-bool -Target RejectNegative Report Var(darwin_one_byte_bool) -Set sizeof(bool) to 1. - -fapple-kext -Target Report C++ Var(flag_apple_kext) -Generate code for darwin loadable kernel extensions. - -mkernel -Target Report Var(flag_mkernel) -Generate code for the kernel or loadable kernel extensions. - -iframework -Target RejectNegative C ObjC C++ ObjC++ Joined Separate --iframework <dir> Add <dir> to the end of the system framework include path. +Driver RejectNegative +(Obsolete and unhandled by ld64, ignored) ld should produce an executable (only handled by ld_classic). -X -Driver +;; These are not "real" options, but placeholders used to hide the real options +;; from generic options processing... FIXME: they can be eliminated now. Zall_load Driver @@ -343,62 +481,3 @@ Driver Separate Zweak_reference_mismatches Driver Separate -client_name -Driver Separate - -compatibility_version -Driver Separate - -current_version -Driver Separate - -dylinker_install_name -Driver Separate - -pagezero_size -Driver Separate - -read_only_relocs -Driver Separate - -sectalign -Driver Separate Args(3) - -sectcreate -Driver Separate Args(3) - -sectobjectsymbols -Driver Separate Args(2) - -sectorder -Driver Separate Args(3) - -seg1addr -Driver Separate - -segcreate -Driver Separate Args(3) - -segprot -Driver Separate Args(3) - -segs_read_only_addr -Driver Separate - -segs_read_write_addr -Driver Separate - -sub_library -Driver Separate - -sub_umbrella -Driver Separate - -; Certain aspects of code-gen may be improved / adjusted if the version of ld64 -; is sufficiently modern. -mtarget-linker -Target RejectNegative Joined Separate Report Var(darwin_target_linker) Init(LD64_VERSION) -The version of ld64 in use for this toolchain. - -undefined -Driver Separate -- cgit v1.2.3 From eb8c1f019a51f016206fe26f3ff1d6a26e4686a8 Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Fri, 27 Sep 2019 00:16:13 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@276170 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 1c14e6dbe55..cdcc7ba9fde 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190926 +20190927 -- cgit v1.2.3 From 6200408bff5a564a6c30fd73d4569bb995348d19 Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Sat, 28 Sep 2019 00:16:15 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@276225 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index cdcc7ba9fde..2087f60437a 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190927 +20190928 -- cgit v1.2.3 From de97b6cc7819cd57f1da683cf633f29918c91fd1 Mon Sep 17 00:00:00 2001 From: Oleg Endo <olegendo@gcc.gnu.org> Date: Sat, 28 Sep 2019 07:23:10 +0000 Subject: gcc/ 2018-09-28 Oleg Endo <olegendo@gcc.gnu.org> Backport from mainline 2018-07-15 Jeff Law <law@redhat.com> PR target/85993 * config/sh/sh.c (output_mi_thunk): Remove dead conditional block. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@276237 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 9 +++++++++ gcc/config/sh/sh.c | 6 ------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b704d3a8399..7ae49f9354c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2018-09-28 Oleg Endo <olegendo@gcc.gnu.org> + + Backport from mainline + 2018-07-15 Jeff Law <law@redhat.com> + + PR target/85993 + * config/sh/sh.c (output_mi_thunk): Remove dead conditional + block. + 2019-09-26 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c index ced66408265..e062b1814f2 100644 --- a/gcc/config/sh/sh.c +++ b/gcc/config/sh/sh.c @@ -10875,12 +10875,6 @@ sh_output_mi_thunk (FILE *file, tree thunk_fndecl ATTRIBUTE_UNUSED, emit_insn (gen_add2_insn (scratch0, GEN_INT (vcall_offset))); offset_addr = scratch0; } - else if (scratch0 != scratch1) - { - emit_move_insn (scratch1, GEN_INT (vcall_offset)); - emit_insn (gen_add2_insn (scratch0, scratch1)); - offset_addr = scratch0; - } else gcc_unreachable (); /* FIXME */ emit_load_ptr (scratch0, offset_addr); -- cgit v1.2.3 From 2464233a99afbad6ff30161d2b62fb6a9cc132c2 Mon Sep 17 00:00:00 2001 From: Oleg Endo <olegendo@gcc.gnu.org> Date: Sat, 28 Sep 2019 07:27:43 +0000 Subject: fix date typo in changelog git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@276238 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 7ae49f9354c..90e6e9e17c3 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,4 +1,4 @@ -2018-09-28 Oleg Endo <olegendo@gcc.gnu.org> +2019-09-28 Oleg Endo <olegendo@gcc.gnu.org> Backport from mainline 2018-07-15 Jeff Law <law@redhat.com> -- cgit v1.2.3 From 99479788ffdcc3bc9d8a33c9e33a89b6d33ac3ad Mon Sep 17 00:00:00 2001 From: Oleg Endo <olegendo@gcc.gnu.org> Date: Sat, 28 Sep 2019 08:39:40 +0000 Subject: gcc/ 2019-09-28 Oleg Endo <olegendo@gcc.gnu.org> Backport from mainline 2019-09-28 Oleg Endo <olegendo@gcc.gnu.org> PR target/80672 * config/sh/sh.c (parse_validate_atomic_model_option): Use std::string::compare instead of std::string::find. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@276242 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 9 +++++++++ gcc/config/sh/sh.c | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 90e6e9e17c3..20140f9dd6a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2019-09-28 Oleg Endo <olegendo@gcc.gnu.org> + + Backport from mainline + 2019-09-28 Oleg Endo <olegendo@gcc.gnu.org> + + PR target/80672 + * config/sh/sh.c (parse_validate_atomic_model_option): Use + std::string::compare instead of std::string::find. + 2019-09-28 Oleg Endo <olegendo@gcc.gnu.org> Backport from mainline diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c index e062b1814f2..28a307aa076 100644 --- a/gcc/config/sh/sh.c +++ b/gcc/config/sh/sh.c @@ -736,7 +736,7 @@ got_mode_name:; { if (tokens[i] == "strict") ret.strict = true; - else if (tokens[i].find ("gbr-offset=") == 0) + else if (!tokens[i].compare (0, strlen ("gbr-offset="), "gbr-offset=")) { std::string offset_str = tokens[i].substr (strlen ("gbr-offset=")); ret.tcb_gbr_offset = integral_argument (offset_str.c_str ()); -- cgit v1.2.3 From c659ec1630b4dd953c9b900badf0c942f7cb41a3 Mon Sep 17 00:00:00 2001 From: Oleg Endo <olegendo@gcc.gnu.org> Date: Sat, 28 Sep 2019 09:11:02 +0000 Subject: libitm/ 2019-09-28 Oleg Endo <olegendo@gcc.gnu.org> Backport from mainline 2018-08-03 Sergei Trofimovich <slyfox@gentoo.org> PR target/86712 * config/sh/sjlj.S: Adjust to use PIC vs normal code to avoid absolute relocation in a shared library. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@276246 138bc75d-0d04-0410-961f-82ee72b054a4 --- libitm/ChangeLog | 9 +++++++++ libitm/config/sh/sjlj.S | 4 ++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/libitm/ChangeLog b/libitm/ChangeLog index 78ff2e548e2..2ba270728e6 100644 --- a/libitm/ChangeLog +++ b/libitm/ChangeLog @@ -1,3 +1,12 @@ +2019-09-28 Oleg Endo <olegendo@gcc.gnu.org> + + Backport from mainline + 2018-08-03 Sergei Trofimovich <slyfox@gentoo.org> + + PR target/86712 + * config/sh/sjlj.S: Adjust to use PIC vs normal code to avoid + absolute relocation in a shared library. + 2019-02-22 Release Manager * GCC 8.3.0 released. diff --git a/libitm/config/sh/sjlj.S b/libitm/config/sh/sjlj.S index 043f36749be..f265ab8f898 100644 --- a/libitm/config/sh/sjlj.S +++ b/libitm/config/sh/sjlj.S @@ -53,7 +53,7 @@ _ITM_beginTransaction: #else cfi_def_cfa_offset (4*10) #endif -#if defined HAVE_ATTRIBUTE_VISIBILITY || !defined __PIC__ +#if !defined __PIC__ mov.l .Lbegin, r1 jsr @r1 mov r15, r5 @@ -78,7 +78,7 @@ _ITM_beginTransaction: .align 2 .Lbegin: -#if defined HAVE_ATTRIBUTE_VISIBILITY || !defined __PIC__ +#if !defined __PIC__ .long GTM_begin_transaction #else .long GTM_begin_transaction@PCREL-(.Lbegin0-.) -- cgit v1.2.3 From fae1d88542a435c41574847974bcd25bcc48a427 Mon Sep 17 00:00:00 2001 From: Paul Thomas <pault@gcc.gnu.org> Date: Sat, 28 Sep 2019 15:48:35 +0000 Subject: 2019-09-28 Paul Thomas <pault@gcc.gnu.org> Backport from mainline PR fortran/91588 * expr.c (check_inquiry): Remove extended component refs by using symbol pointers. If a function argument is an associate variable with a constant target, copy the target expression in place of the argument expression. Check that the charlen is not NULL before using the string length. 2019-09-28 Paul Thomas <pault@gcc.gnu.org> Backport from mainline PR fortran/91588 * gfortran.dg/associate_49.f90 : New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@276252 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fortran/ChangeLog | 10 ++++ gcc/fortran/expr.c | 77 +++++++++++++++++------------- gcc/testsuite/ChangeLog | 6 +++ gcc/testsuite/gfortran.dg/associate_49.f90 | 34 +++++++++++++ 4 files changed, 94 insertions(+), 33 deletions(-) create mode 100644 gcc/testsuite/gfortran.dg/associate_49.f90 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index a40efff7bcc..fe752879f23 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,13 @@ +2019-09-28 Paul Thomas <pault@gcc.gnu.org> + + Backport from mainline + PR fortran/91588 + * expr.c (check_inquiry): Remove extended component refs by + using symbol pointers. If a function argument is an associate + variable with a constant target, copy the target expression in + place of the argument expression. Check that the charlen is not + NULL before using the string length. + 2019-09-18 Thomas Koenig <tkoenig@gcc.gnu.org> Backport from trunk diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c index 2731a714fca..8a23374a6c9 100644 --- a/gcc/fortran/expr.c +++ b/gcc/fortran/expr.c @@ -2396,6 +2396,8 @@ check_inquiry (gfc_expr *e, int not_restricted) int i = 0; gfc_actual_arglist *ap; + gfc_symbol *sym; + gfc_symbol *asym; if (!e->value.function.isym || !e->value.function.isym->inquiry) @@ -2405,20 +2407,22 @@ check_inquiry (gfc_expr *e, int not_restricted) if (e->symtree == NULL) return MATCH_NO; - if (e->symtree->n.sym->from_intmod) + sym = e->symtree->n.sym; + + if (sym->from_intmod) { - if (e->symtree->n.sym->from_intmod == INTMOD_ISO_FORTRAN_ENV - && e->symtree->n.sym->intmod_sym_id != ISOFORTRAN_COMPILER_OPTIONS - && e->symtree->n.sym->intmod_sym_id != ISOFORTRAN_COMPILER_VERSION) + if (sym->from_intmod == INTMOD_ISO_FORTRAN_ENV + && sym->intmod_sym_id != ISOFORTRAN_COMPILER_OPTIONS + && sym->intmod_sym_id != ISOFORTRAN_COMPILER_VERSION) return MATCH_NO; - if (e->symtree->n.sym->from_intmod == INTMOD_ISO_C_BINDING - && e->symtree->n.sym->intmod_sym_id != ISOCBINDING_C_SIZEOF) + if (sym->from_intmod == INTMOD_ISO_C_BINDING + && sym->intmod_sym_id != ISOCBINDING_C_SIZEOF) return MATCH_NO; } else { - name = e->symtree->n.sym->name; + name = sym->name; functions = (gfc_option.warn_std & GFC_STD_F2003) ? inquiry_func_f2003 : inquiry_func_f95; @@ -2440,41 +2444,48 @@ check_inquiry (gfc_expr *e, int not_restricted) if (!ap->expr) continue; + asym = ap->expr->symtree ? ap->expr->symtree->n.sym : NULL; + if (ap->expr->ts.type == BT_UNKNOWN) { - if (ap->expr->symtree->n.sym->ts.type == BT_UNKNOWN - && !gfc_set_default_type (ap->expr->symtree->n.sym, 0, gfc_current_ns)) + if (asym && asym->ts.type == BT_UNKNOWN + && !gfc_set_default_type (asym, 0, gfc_current_ns)) return MATCH_NO; - ap->expr->ts = ap->expr->symtree->n.sym->ts; + ap->expr->ts = asym->ts; } - /* Assumed character length will not reduce to a constant expression - with LEN, as required by the standard. */ - if (i == 5 && not_restricted && ap->expr->symtree - && ap->expr->symtree->n.sym->ts.type == BT_CHARACTER - && (ap->expr->symtree->n.sym->ts.u.cl->length == NULL - || ap->expr->symtree->n.sym->ts.deferred)) - { - gfc_error ("Assumed or deferred character length variable %qs " - "in constant expression at %L", - ap->expr->symtree->n.sym->name, - &ap->expr->where); - return MATCH_ERROR; - } - else if (not_restricted && !gfc_check_init_expr (ap->expr)) - return MATCH_ERROR; + if (asym && asym->assoc && asym->assoc->target + && asym->assoc->target->expr_type == EXPR_CONSTANT) + { + gfc_free_expr (ap->expr); + ap->expr = gfc_copy_expr (asym->assoc->target); + } - if (not_restricted == 0 - && ap->expr->expr_type != EXPR_VARIABLE - && !check_restricted (ap->expr)) + /* Assumed character length will not reduce to a constant expression + with LEN, as required by the standard. */ + if (i == 5 && not_restricted && asym + && asym->ts.type == BT_CHARACTER + && ((asym->ts.u.cl && asym->ts.u.cl->length == NULL) + || asym->ts.deferred)) + { + gfc_error ("Assumed or deferred character length variable %qs " + "in constant expression at %L", + asym->name, &ap->expr->where); return MATCH_ERROR; + } + else if (not_restricted && !gfc_check_init_expr (ap->expr)) + return MATCH_ERROR; - if (not_restricted == 0 - && ap->expr->expr_type == EXPR_VARIABLE - && ap->expr->symtree->n.sym->attr.dummy - && ap->expr->symtree->n.sym->attr.optional) - return MATCH_NO; + if (not_restricted == 0 + && ap->expr->expr_type != EXPR_VARIABLE + && !check_restricted (ap->expr)) + return MATCH_ERROR; + + if (not_restricted == 0 + && ap->expr->expr_type == EXPR_VARIABLE + && asym->attr.dummy && asym->attr.optional) + return MATCH_NO; } return MATCH_YES; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ce0b36cdb56..6a9c3143407 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2019-09-28 Paul Thomas <pault@gcc.gnu.org> + + Backport from mainline + PR fortran/91588 + * gfortran.dg/associate_49.f90 : New test. + 2019-09-25 Kyrylo Tkachov <kyrylo.tkachov@arm.com> Backport from mainline diff --git a/gcc/testsuite/gfortran.dg/associate_49.f90 b/gcc/testsuite/gfortran.dg/associate_49.f90 new file mode 100644 index 00000000000..1b205950556 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/associate_49.f90 @@ -0,0 +1,34 @@ +! { dg-do run } +! +! Test the fix for PR91588, in which the declaration of 'a' caused +! an ICE. +! +! Contributed by Gerhardt Steinmetz <gscfq@t-online.de> +! +program p + character(4), parameter :: parm = '7890' + associate (z => '1234') + block + integer(len(z)) :: a + if (kind(a) .ne. 4) stop 1 + end block + end associate + associate (z => '123') + block + integer(len(z)+1) :: a + if (kind(a) .ne. 4) stop 2 + end block + end associate + associate (z => 1_8) + block + integer(kind(z)) :: a + if (kind(a) .ne. 8) stop 3 + end block + end associate + associate (z => parm) + block + integer(len(z)) :: a + if (kind(a) .ne. 4) stop 4 + end block + end associate +end -- cgit v1.2.3 From 891a02f43c46921898871e41be1c79fea0c94651 Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Sun, 29 Sep 2019 00:16:23 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@276262 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 2087f60437a..244a194c54a 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190928 +20190929 -- cgit v1.2.3 From 914c5396341c744e09b55ce4558d925992ade825 Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Mon, 30 Sep 2019 00:16:31 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@276274 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 244a194c54a..afc3f207f2d 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190929 +20190930 -- cgit v1.2.3 From 6c98caa250656259469889f2bc77ec2bb5740ab4 Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Tue, 1 Oct 2019 00:16:08 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@276384 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index afc3f207f2d..05ec96c98da 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20190930 +20191001 -- cgit v1.2.3 From 2086c894bdb43813d0d42e269d28ede4080e683e Mon Sep 17 00:00:00 2001 From: Eric Botcazou <ebotcazou@adacore.com> Date: Tue, 1 Oct 2019 08:10:17 +0000 Subject: PR target/91854 Backport from mainline 2019-09-20 Eric Botcazou <ebotcazou@adacore.com> PR target/91269 * config/sparc/sparc.h (HARD_REGNO_CALLER_SAVE_MODE): Define. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@276390 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 9 +++++++ gcc/config/sparc/sparc.h | 7 ++++++ gcc/testsuite/ChangeLog | 4 +++ gcc/testsuite/gcc.dg/pr91854.c | 55 ++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 75 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/pr91854.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 20140f9dd6a..69b008b5a91 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2019-10-01 Eric Botcazou <ebotcazou@adacore.com> + + PR target/91854 + Backport from mainline + 2019-09-20 Eric Botcazou <ebotcazou@adacore.com> + + PR target/91269 + * config/sparc/sparc.h (HARD_REGNO_CALLER_SAVE_MODE): Define. + 2019-09-28 Oleg Endo <olegendo@gcc.gnu.org> Backport from mainline diff --git a/gcc/config/sparc/sparc.h b/gcc/config/sparc/sparc.h index 94456d0fc35..a32b9f825d2 100644 --- a/gcc/config/sparc/sparc.h +++ b/gcc/config/sparc/sparc.h @@ -748,6 +748,13 @@ extern enum cmodel sparc_cmodel; register window instruction in the prologue. */ #define HARD_REGNO_RENAME_OK(FROM, TO) ((FROM) != 1) +/* Select a register mode required for caller save of hard regno REGNO. + Contrary to what is documented, the default is not the smallest suitable + mode but the largest suitable mode for the given (REGNO, NREGS) pair and + it quickly creates paradoxical subregs that can be problematic. */ +#define HARD_REGNO_CALLER_SAVE_MODE(REGNO, NREGS, MODE) \ + ((MODE) == VOIDmode ? choose_hard_reg_mode (REGNO, NREGS, false) : (MODE)) + /* Specify the registers used for certain standard purposes. The values of these macros are register numbers. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 6a9c3143407..9cc3da279b6 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2019-10-01 Eric Botcazou <ebotcazou@adacore.com> + + * gcc.dg/pr91854.c: New test. + 2019-09-28 Paul Thomas <pault@gcc.gnu.org> Backport from mainline diff --git a/gcc/testsuite/gcc.dg/pr91854.c b/gcc/testsuite/gcc.dg/pr91854.c new file mode 100644 index 00000000000..fbf33a58890 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr91854.c @@ -0,0 +1,55 @@ +/* PR target/91854 */ +/* Testcase by Sergei Trofimovich <slyfox@inbox.ru> */ +/* { dg-do assemble } */ +/* { dg-options "-O2 -Wno-int-conversion" } */ +/* { dg-additional-options "-fPIE -mcpu=niagara4" { target sparc*-*-* } } */ + +typedef struct { + long a; +} __attribute__((packed)) c; +void *e, *f; +int i, j, ab, k, l, m, o; +inline int g(int p) { + if (__builtin_expect(p, 1)) { + const int aa = ((c *)e)->a ^ ((c *)f)->a; + if (aa) + f = sizeof(long); + return f; + } +} +void d(); +int am (); +inline int n(char p, int u) { + int q, r, ac = i; + short b = m; + while (r && u) { + if (l) { + if (k) { + void *h = i; + if (__builtin_expect(p, 1)) { + const int aa = ((c *)e)->a ^ ((c *)h)->a; + if (aa) + h = sizeof(long); + q = h; + } + } + ab = q; + char s; + if (s) { + char t = l = g(t); + } + } + if (j && b) + if (ac) + d(); + } +} +void v() { + const int al = am(); + if (al) + n(am, v); +an: + n(am, v); + if (o) + goto an; +} -- cgit v1.2.3 From 770cda33094d972b569f5a2af5476123e3d0c1f7 Mon Sep 17 00:00:00 2001 From: Kyrylo Tkachov <kyrylo.tkachov@arm.com> Date: Tue, 1 Oct 2019 10:37:55 +0000 Subject: [AArch64] Don't split 64-bit constant stores to volatile location 2019-10-01 Kyrylo Tkachov <kyrylo.tkachov@arm.com> Backport from mainline 2019-09-24 Kyrylo Tkachov <kyrylo.tkachov@arm.com> * config/aarch64/aarch64.md (mov<mode>): Don't call aarch64_split_dimode_const_store on volatile MEM. * gcc.target/aarch64/nosplit-di-const-volatile_1.c: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@276399 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 8 ++++++++ gcc/config/aarch64/aarch64.md | 4 ++-- gcc/testsuite/ChangeLog | 7 +++++++ .../gcc.target/aarch64/nosplit-di-const-volatile_1.c | 15 +++++++++++++++ 4 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gcc.target/aarch64/nosplit-di-const-volatile_1.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 69b008b5a91..eabd74afc88 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2019-10-01 Kyrylo Tkachov <kyrylo.tkachov@arm.com> + + Backport from mainline + 2019-09-24 Kyrylo Tkachov <kyrylo.tkachov@arm.com> + + * config/aarch64/aarch64.md (mov<mode>): Don't call + aarch64_split_dimode_const_store on volatile MEM. + 2019-10-01 Eric Botcazou <ebotcazou@adacore.com> PR target/91854 diff --git a/gcc/config/aarch64/aarch64.md b/gcc/config/aarch64/aarch64.md index 06d2dacb563..82db038c77a 100644 --- a/gcc/config/aarch64/aarch64.md +++ b/gcc/config/aarch64/aarch64.md @@ -975,8 +975,8 @@ (match_operand:GPI 1 "general_operand" ""))] "" " - if (MEM_P (operands[0]) && CONST_INT_P (operands[1]) - && <MODE>mode == DImode + if (MEM_P (operands[0]) && !MEM_VOLATILE_P (operands[0]) + && CONST_INT_P (operands[1]) && <MODE>mode == DImode && aarch64_split_dimode_const_store (operands[0], operands[1])) DONE; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 9cc3da279b6..2533bcd529d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2019-10-01 Kyrylo Tkachov <kyrylo.tkachov@arm.com> + + Backport from mainline + 2019-09-24 Kyrylo Tkachov <kyrylo.tkachov@arm.com> + + * gcc.target/aarch64/nosplit-di-const-volatile_1.c: New test. + 2019-10-01 Eric Botcazou <ebotcazou@adacore.com> * gcc.dg/pr91854.c: New test. diff --git a/gcc/testsuite/gcc.target/aarch64/nosplit-di-const-volatile_1.c b/gcc/testsuite/gcc.target/aarch64/nosplit-di-const-volatile_1.c new file mode 100644 index 00000000000..da5975ad165 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/nosplit-di-const-volatile_1.c @@ -0,0 +1,15 @@ +/* Check that storing the 64-bit immediate to a volatile location is done + with a single store. */ + +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +typedef unsigned long long u64; + +void bar (u64 *x) +{ + *(volatile u64 *)x = 0xabcdef10abcdef10ULL; +} + +/* { dg-final { scan-assembler-times "str\tx..?, .*" 1 } } */ +/* { dg-final { scan-assembler-not "str\tw..?, .*" } } */ -- cgit v1.2.3 From 3485ea74e0b971b9d7eddd413bc4059c0b8f19ce Mon Sep 17 00:00:00 2001 From: Oleg Endo <olegendo@gcc.gnu.org> Date: Tue, 1 Oct 2019 15:00:40 +0000 Subject: gcc/ 2019-10-01 Oleg Endo <olegendo@gcc.gnu.org> Backport from mainline 2019-10-01 Oleg Endo <olegendo@gcc.gnu.org> PR target/88562 * config/sh/sh.c (sh_extending_set_of_reg::use_as_extended_reg): Use sh_check_add_incdec_notes to preserve REG_INC notes when replacing a memory access insn. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@276413 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 11 +++++++++++ gcc/config/sh/sh.c | 6 ++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index eabd74afc88..1dbb18ce427 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,14 @@ +2019-10-01 Oleg Endo <olegendo@gcc.gnu.org> + + Backport from mainline + + 2019-10-01 Oleg Endo <olegendo@gcc.gnu.org> + + PR target/88562 + * config/sh/sh.c (sh_extending_set_of_reg::use_as_extended_reg): Use + sh_check_add_incdec_notes to preserve REG_INC notes when replacing + a memory access insn. + 2019-10-01 Kyrylo Tkachov <kyrylo.tkachov@arm.com> Backport from mainline diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c index 28a307aa076..f77dbdcee16 100644 --- a/gcc/config/sh/sh.c +++ b/gcc/config/sh/sh.c @@ -12071,9 +12071,11 @@ sh_extending_set_of_reg::use_as_extended_reg (rtx_insn* use_at_insn) const rtx r = gen_reg_rtx (SImode); rtx_insn* i0; if (from_mode == QImode) - i0 = emit_insn_after (gen_extendqisi2 (r, set_src), insn); + i0 = sh_check_add_incdec_notes ( + emit_insn_after (gen_extendqisi2 (r, set_src), insn)); else if (from_mode == HImode) - i0 = emit_insn_after (gen_extendhisi2 (r, set_src), insn); + i0 = sh_check_add_incdec_notes ( + emit_insn_after (gen_extendhisi2 (r, set_src), insn)); else gcc_unreachable (); -- cgit v1.2.3 From c7ef42b59514f58b56350bc0e636e24724babe33 Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Wed, 2 Oct 2019 00:16:11 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@276436 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 05ec96c98da..11b6d832c9b 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20191001 +20191002 -- cgit v1.2.3 From 1f46f68e8fcd7351a5504fbb22a2d71d3e226c18 Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Thu, 3 Oct 2019 00:16:11 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@276500 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 11b6d832c9b..e0a8c093198 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20191002 +20191003 -- cgit v1.2.3 From a644b418be566b1508514820aab626b436361a8b Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Fri, 4 Oct 2019 00:16:09 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@276558 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index e0a8c093198..cd0a63ad464 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20191003 +20191004 -- cgit v1.2.3 From ae6623ca1c45f4bc990246fb28ca10636853d9fe Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Sat, 5 Oct 2019 00:16:12 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@276616 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index cd0a63ad464..4d531d0f906 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20191004 +20191005 -- cgit v1.2.3 From 26d213c842dba144df18dbb370e8cc83b1129350 Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Sun, 6 Oct 2019 00:16:27 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@276632 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 4d531d0f906..3d165d7721f 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20191005 +20191006 -- cgit v1.2.3 From 637f962ddd4e5ca222d17aaad489795b4fe85b2e Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Mon, 7 Oct 2019 00:16:17 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@276642 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 3d165d7721f..19cc9745a1a 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20191006 +20191007 -- cgit v1.2.3 From 6caad669cdbb7f646a8cc44bdbde54da69ff8ad3 Mon Sep 17 00:00:00 2001 From: Bill Schmidt <wschmidt@linux.ibm.com> Date: Mon, 7 Oct 2019 19:34:41 +0000 Subject: [gcc] 2019-10-07 Bill Schmidt <wschmidt@linux.ibm.com> Backport from mainline 2019-10-01 Bill Schmidt <wschmidt@linux.ibm.com> PR target/91275 * config/rs6000/rs6000-p8swap.c (rtx_is_swappable_p): Don't swap vpmsumd. [gcc/testsuite] 2019-10-07 Bill Schmidt <wschmidt@linux.ibm.com> Backport from mainline 2019-10-01 Bill Schmidt <wschmdit@linux.ibm.com> PR target/91275 * gcc.target/powerpc/pr91275.c: New. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@276669 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 9 +++++++++ gcc/config/rs6000/rs6000-p8swap.c | 5 +++++ gcc/testsuite/ChangeLog | 8 ++++++++ gcc/testsuite/gcc.target/powerpc/pr91275.c | 21 +++++++++++++++++++++ 4 files changed, 43 insertions(+) create mode 100644 gcc/testsuite/gcc.target/powerpc/pr91275.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 1dbb18ce427..eee03cad8a3 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2019-10-07 Bill Schmidt <wschmidt@linux.ibm.com> + + Backport from mainline + 2019-10-01 Bill Schmidt <wschmidt@linux.ibm.com> + + PR target/91275 + * config/rs6000/rs6000-p8swap.c (rtx_is_swappable_p): Don't swap + vpmsumd. + 2019-10-01 Oleg Endo <olegendo@gcc.gnu.org> Backport from mainline diff --git a/gcc/config/rs6000/rs6000-p8swap.c b/gcc/config/rs6000/rs6000-p8swap.c index 3ba5ebae17f..c73120d4e55 100644 --- a/gcc/config/rs6000/rs6000-p8swap.c +++ b/gcc/config/rs6000/rs6000-p8swap.c @@ -792,6 +792,11 @@ rtx_is_swappable_p (rtx op, unsigned int *special) case UNSPEC_REDUC_PLUS: case UNSPEC_REDUC: return 1; + case UNSPEC_VPMSUM: + /* vpmsumd is not swappable, but vpmsum[bhw] are. */ + if (GET_MODE (op) == V2DImode) + return 0; + break; } } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 2533bcd529d..32558dcfe16 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2019-10-07 Bill Schmidt <wschmidt@linux.ibm.com> + + Backport from mainline + 2019-10-01 Bill Schmidt <wschmdit@linux.ibm.com> + + PR target/91275 + * gcc.target/powerpc/pr91275.c: New. + 2019-10-01 Kyrylo Tkachov <kyrylo.tkachov@arm.com> Backport from mainline diff --git a/gcc/testsuite/gcc.target/powerpc/pr91275.c b/gcc/testsuite/gcc.target/powerpc/pr91275.c new file mode 100644 index 00000000000..b23d75be29b --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/pr91275.c @@ -0,0 +1,21 @@ +/* Test that we generate vpmsumd correctly without a swap error. */ + +/* { dg-do run { target { p8vector_hw } } } */ +/* { dg-options "-O2 -std=gnu11" } */ + +#include <altivec.h> + +int main() { + + const unsigned long long r0l = 0x8e7dfceac070e3a0; + vector unsigned long long r0 = (vector unsigned long long) {r0l, 0}, v; + const vector unsigned long long pd + = (vector unsigned long) {0xc2LLU << 56, 0}; + + v = __builtin_crypto_vpmsumd ((vector unsigned long long) {r0[0], 0}, pd); + + if (v[0] != 0x4000000000000000 || v[1] != 0x65bd7ab605a4a8ff) + __builtin_abort (); + + return 0; +} -- cgit v1.2.3 From 7e4a78af6933a5568cd413348d2d6b3e877d862d Mon Sep 17 00:00:00 2001 From: Thomas Koenig <tkoenig@gcc.gnu.org> Date: Mon, 7 Oct 2019 20:12:00 +0000 Subject: 2019-10-07 Thomas Koenig <tkoenig@gcc.gnu.org> Backport from trunk PR fortran/84487 * trans-decl.c (gfc_get_symbol_decl): For __def_init, set DECL_ARTIFICAL and do not set TREE_READONLY. 2019-10-07 Thomas Koenig <tkoenig@gcc.gnu.org> Backport from trunk PR fortran/84487 * gfortran.dg/typebound_call_22.f03: xfail. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@276673 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fortran/ChangeLog | 7 +++++++ gcc/fortran/trans-decl.c | 2 +- gcc/testsuite/ChangeLog | 6 ++++++ gcc/testsuite/gfortran.dg/typebound_call_22.f03 | 2 +- 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index fe752879f23..355420b1629 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,10 @@ +2019-10-07 Thomas Koenig <tkoenig@gcc.gnu.org> + + Backport from trunk + PR fortran/84487 + * trans-decl.c (gfc_get_symbol_decl): For __def_init, set + DECL_ARTIFICAL and do not set TREE_READONLY. + 2019-09-28 Paul Thomas <pault@gcc.gnu.org> Backport from mainline diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c index 4b490950530..c1cc658542e 100644 --- a/gcc/fortran/trans-decl.c +++ b/gcc/fortran/trans-decl.c @@ -1894,7 +1894,7 @@ gfc_get_symbol_decl (gfc_symbol * sym) if (sym->attr.vtab || (sym->name[0] == '_' && strncmp ("__def_init", sym->name, 10) == 0)) - TREE_READONLY (decl) = 1; + DECL_ARTIFICIAL (decl) = 1; return decl; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 32558dcfe16..216d3ece4c9 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2019-10-07 Thomas Koenig <tkoenig@gcc.gnu.org> + + Backport from trunk + PR fortran/84487 + * gfortran.dg/typebound_call_22.f03: xfail. + 2019-10-07 Bill Schmidt <wschmidt@linux.ibm.com> Backport from mainline diff --git a/gcc/testsuite/gfortran.dg/typebound_call_22.f03 b/gcc/testsuite/gfortran.dg/typebound_call_22.f03 index b9f0b712573..30f86937fe2 100644 --- a/gcc/testsuite/gfortran.dg/typebound_call_22.f03 +++ b/gcc/testsuite/gfortran.dg/typebound_call_22.f03 @@ -26,4 +26,4 @@ program test call x%bar () end program -! { dg-final { scan-tree-dump-times "base \\(\\);" 1 "optimized" } } +! { dg-final { scan-tree-dump-times "base \\(\\);" 1 "optimized" { xfail *-*-* } } } -- cgit v1.2.3 From d7a65a3b82e5bce8b91f6cb4463be067ab2aee4f Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Tue, 8 Oct 2019 00:16:08 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@276683 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 19cc9745a1a..c440771e27d 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20191007 +20191008 -- cgit v1.2.3 From 4478bf4643b235fb3577bed4b1067921ae18b535 Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Wed, 9 Oct 2019 00:16:14 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@276748 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index c440771e27d..70f16fccca3 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20191008 +20191009 -- cgit v1.2.3 From 8b35da1153ce46040a685591b81f9b4e36739248 Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Thu, 10 Oct 2019 00:16:11 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@276784 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 70f16fccca3..caa1d99aa14 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20191009 +20191010 -- cgit v1.2.3 From 1839adea02bd4c45b42541f17288de81eb0e3ae3 Mon Sep 17 00:00:00 2001 From: Oleg Endo <olegendo@gcc.gnu.org> Date: Thu, 10 Oct 2019 15:28:31 +0000 Subject: gcc/ Backport from mainline 2019-10-10 Oleg Endo <olegendo@gcc.gnu.org> PR target/88630 * config/sh/sh.h (TARGET_FPU_SH4_300): New macro. * config/sh/sh.c (sh_option_override): Enable fsca and fsrra insns also for TARGET_FPU_SH4_300. (sh_emit_mode_set): Check for TARGET_FPU_SH4_300 instead of TARGET_SH4_300. * config/sh/sh.md (toggle_pr): Add TARGET_FPU_SH4_300 condition. (negsf2): Expand to either negsf2_fpscr or negsf2_no_fpscr. (*negsf2_i): Split into ... (negsf2_fpscr, negsf2_no_fpscr): ... these new patterns. (abssf2): Expand to either abssf2_fpsc or abssf2_no_fpsc. (**abssf2_i): Split into ... (abssf2_fpscr, abssf2_no_fpscr): ... these new patterns. (negdf2): Expand to either negdf2_fpscr or negdf2_no_fpscr. (*negdf2_i): Split into ... (negdf2_fpscr, negdf2_no_fpscr): ... these new patterns. (absdf2): Expand to either absdf2_fpscr or absdf2_no_fpsc. (**abssf2_i): Split into ... (absdf2_fpscr, absdf2_no_fpscr): ... these new patterns. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@276837 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 25 +++++++++++++++ gcc/config/sh/sh.c | 8 +++-- gcc/config/sh/sh.h | 2 ++ gcc/config/sh/sh.md | 90 +++++++++++++++++++++++++++++++++++++++++++++-------- 4 files changed, 109 insertions(+), 16 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index eee03cad8a3..9a1f54f6b03 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,28 @@ +2019-10-10 Oleg Endo <olegendo@gcc.gnu.org> + + Backport from mainline + 2019-10-10 Oleg Endo <olegendo@gcc.gnu.org> + + PR target/88630 + * config/sh/sh.h (TARGET_FPU_SH4_300): New macro. + * config/sh/sh.c (sh_option_override): Enable fsca and fsrra insns + also for TARGET_FPU_SH4_300. + (sh_emit_mode_set): Check for TARGET_FPU_SH4_300 instead of + TARGET_SH4_300. + * config/sh/sh.md (toggle_pr): Add TARGET_FPU_SH4_300 condition. + (negsf2): Expand to either negsf2_fpscr or negsf2_no_fpscr. + (*negsf2_i): Split into ... + (negsf2_fpscr, negsf2_no_fpscr): ... these new patterns. + (abssf2): Expand to either abssf2_fpsc or abssf2_no_fpsc. + (**abssf2_i): Split into ... + (abssf2_fpscr, abssf2_no_fpscr): ... these new patterns. + (negdf2): Expand to either negdf2_fpscr or negdf2_no_fpscr. + (*negdf2_i): Split into ... + (negdf2_fpscr, negdf2_no_fpscr): ... these new patterns. + (absdf2): Expand to either absdf2_fpscr or absdf2_no_fpsc. + (**abssf2_i): Split into ... + (absdf2_fpscr, absdf2_no_fpscr): ... these new patterns. + 2019-10-07 Bill Schmidt <wschmidt@linux.ibm.com> Backport from mainline diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c index f77dbdcee16..041c792cc50 100644 --- a/gcc/config/sh/sh.c +++ b/gcc/config/sh/sh.c @@ -957,11 +957,13 @@ sh_option_override (void) if (flag_unsafe_math_optimizations) { /* Enable fsca insn for SH4A if not otherwise specified by the user. */ - if (global_options_set.x_TARGET_FSCA == 0 && TARGET_SH4A_FP) + if (global_options_set.x_TARGET_FSCA == 0 + && (TARGET_SH4A_FP || TARGET_FPU_SH4_300)) TARGET_FSCA = 1; /* Enable fsrra insn for SH4A if not otherwise specified by the user. */ - if (global_options_set.x_TARGET_FSRRA == 0 && TARGET_SH4A_FP) + if (global_options_set.x_TARGET_FSRRA == 0 + && (TARGET_SH4A_FP || TARGET_FPU_SH4_300)) TARGET_FSRRA = 1; } @@ -12493,7 +12495,7 @@ static void sh_emit_mode_set (int entity ATTRIBUTE_UNUSED, int mode, int prev_mode, HARD_REG_SET regs_live ATTRIBUTE_UNUSED) { - if ((TARGET_SH4A_FP || TARGET_SH4_300) + if ((TARGET_SH4A_FP || TARGET_FPU_SH4_300) && prev_mode != FP_MODE_NONE && prev_mode != mode) { emit_insn (gen_toggle_pr ()); diff --git a/gcc/config/sh/sh.h b/gcc/config/sh/sh.h index 2f5930bbebd..190853ab105 100644 --- a/gcc/config/sh/sh.h +++ b/gcc/config/sh/sh.h @@ -69,6 +69,8 @@ extern int code_for_indirect_jump_scratch; FPU is disabled (which makes it compatible with SH4al-dsp). */ #define TARGET_SH4A_FP (TARGET_SH4A && TARGET_FPU_ANY) +/* True if the FPU is a SH4-300 variant. */ +#define TARGET_FPU_SH4_300 (TARGET_FPU_ANY && TARGET_SH4_300) /* This is not used by the SH2E calling convention */ #define TARGET_VARARGS_PRETEND_ARGS(FUN_DECL) \ diff --git a/gcc/config/sh/sh.md b/gcc/config/sh/sh.md index 57dd7869419..5912679ee3c 100644 --- a/gcc/config/sh/sh.md +++ b/gcc/config/sh/sh.md @@ -9163,7 +9163,7 @@ (xor:SI (reg:SI FPSCR_REG) (const_int FPSCR_PR))) (set (reg:SI FPSCR_MODES_REG) (unspec_volatile:SI [(const_int 0)] UNSPECV_FPSCR_MODES))] - "TARGET_SH4A_FP" + "TARGET_SH4A_FP || TARGET_FPU_SH4_300" "fpchg" [(set_attr "type" "fpscr_toggle")]) @@ -9391,15 +9391,31 @@ (define_expand "negsf2" [(set (match_operand:SF 0 "fp_arith_reg_operand") (neg:SF (match_operand:SF 1 "fp_arith_reg_operand")))] - "TARGET_SH2E") + "TARGET_FPU_ANY" +{ + if (TARGET_FPU_SH4_300) + emit_insn (gen_negsf2_fpscr (operands[0], operands[1])); + else + emit_insn (gen_negsf2_no_fpscr (operands[0], operands[1])); + DONE; +}) -(define_insn "*negsf2_i" +(define_insn "negsf2_no_fpscr" [(set (match_operand:SF 0 "fp_arith_reg_operand" "=f") (neg:SF (match_operand:SF 1 "fp_arith_reg_operand" "0")))] - "TARGET_SH2E" + "TARGET_FPU_ANY && !TARGET_FPU_SH4_300" "fneg %0" [(set_attr "type" "fmove")]) +(define_insn "negsf2_fpscr" + [(set (match_operand:SF 0 "fp_arith_reg_operand" "=f") + (neg:SF (match_operand:SF 1 "fp_arith_reg_operand" "0"))) + (use (reg:SI FPSCR_MODES_REG))] + "TARGET_FPU_SH4_300" + "fneg %0" + [(set_attr "type" "fmove") + (set_attr "fp_mode" "single")]) + (define_expand "sqrtsf2" [(set (match_operand:SF 0 "fp_arith_reg_operand" "") (sqrt:SF (match_operand:SF 1 "fp_arith_reg_operand" "")))] @@ -9489,15 +9505,31 @@ (define_expand "abssf2" [(set (match_operand:SF 0 "fp_arith_reg_operand") (abs:SF (match_operand:SF 1 "fp_arith_reg_operand")))] - "TARGET_SH2E") + "TARGET_FPU_ANY" +{ + if (TARGET_FPU_SH4_300) + emit_insn (gen_abssf2_fpscr (operands[0], operands[1])); + else + emit_insn (gen_abssf2_no_fpscr (operands[0], operands[1])); + DONE; +}) -(define_insn "*abssf2_i" +(define_insn "abssf2_no_fpscr" [(set (match_operand:SF 0 "fp_arith_reg_operand" "=f") (abs:SF (match_operand:SF 1 "fp_arith_reg_operand" "0")))] - "TARGET_SH2E" + "TARGET_FPU_ANY && !TARGET_FPU_SH4_300" "fabs %0" [(set_attr "type" "fmove")]) +(define_insn "abssf2_fpscr" + [(set (match_operand:SF 0 "fp_arith_reg_operand" "=f") + (abs:SF (match_operand:SF 1 "fp_arith_reg_operand" "0"))) + (use (reg:SI FPSCR_MODES_REG))] + "TARGET_FPU_SH4_300" + "fabs %0" + [(set_attr "type" "fmove") + (set_attr "fp_mode" "single")]) + (define_expand "adddf3" [(set (match_operand:DF 0 "fp_arith_reg_operand" "") (plus:DF (match_operand:DF 1 "fp_arith_reg_operand" "") @@ -9673,12 +9705,28 @@ (define_expand "negdf2" [(set (match_operand:DF 0 "fp_arith_reg_operand") (neg:DF (match_operand:DF 1 "fp_arith_reg_operand")))] - "TARGET_FPU_DOUBLE") + "TARGET_FPU_DOUBLE" +{ + if (TARGET_FPU_SH4_300) + emit_insn (gen_negdf2_fpscr (operands[0], operands[1])); + else + emit_insn (gen_negdf2_no_fpscr (operands[0], operands[1])); + DONE; +}) -(define_insn "*negdf2_i" +(define_insn "negdf2_fpscr" + [(set (match_operand:DF 0 "fp_arith_reg_operand" "=f") + (neg:DF (match_operand:DF 1 "fp_arith_reg_operand" "0"))) + (use (reg:SI FPSCR_MODES_REG))] + "TARGET_FPU_SH4_300" + "fneg %0" + [(set_attr "type" "fmove") + (set_attr "fp_mode" "double")]) + +(define_insn "negdf2_no_fpscr" [(set (match_operand:DF 0 "fp_arith_reg_operand" "=f") (neg:DF (match_operand:DF 1 "fp_arith_reg_operand" "0")))] - "TARGET_FPU_DOUBLE" + "TARGET_FPU_DOUBLE && !TARGET_FPU_SH4_300" "fneg %0" [(set_attr "type" "fmove")]) @@ -9704,15 +9752,31 @@ (define_expand "absdf2" [(set (match_operand:DF 0 "fp_arith_reg_operand") (abs:DF (match_operand:DF 1 "fp_arith_reg_operand")))] - "TARGET_FPU_DOUBLE") + "TARGET_FPU_DOUBLE" +{ + if (TARGET_FPU_SH4_300) + emit_insn (gen_absdf2_fpscr (operands[0], operands[1])); + else + emit_insn (gen_absdf2_no_fpscr (operands[0], operands[1])); + DONE; +}) -(define_insn "*absdf2_i" +(define_insn "absdf2_no_fpscr" [(set (match_operand:DF 0 "fp_arith_reg_operand" "=f") (abs:DF (match_operand:DF 1 "fp_arith_reg_operand" "0")))] - "TARGET_FPU_DOUBLE" + "TARGET_FPU_DOUBLE && !TARGET_FPU_SH4_300" "fabs %0" [(set_attr "type" "fmove")]) +(define_insn "absdf2_fpscr" + [(set (match_operand:DF 0 "fp_arith_reg_operand" "=f") + (abs:DF (match_operand:DF 1 "fp_arith_reg_operand" "0"))) + (use (reg:SI FPSCR_MODES_REG))] + "TARGET_FPU_SH4_300" + "fabs %0" + [(set_attr "type" "fmove") + (set_attr "fp_mode" "double")]) + (define_expand "extendsfdf2" [(set (match_operand:DF 0 "fp_arith_reg_operand" "") (float_extend:DF (match_operand:SF 1 "fpul_operand" "")))] -- cgit v1.2.3 From e7d8bec1856f5da10c0bcfdc232c6eb13135ec51 Mon Sep 17 00:00:00 2001 From: Uros Bizjak <ubizjak@gmail.com> Date: Thu, 10 Oct 2019 17:58:24 +0000 Subject: PR target/92022 * config/alpha/alpha.c (alpha_handle_trap_shadows): Skip DEBUG_INSN. testsuite/ChangeLog: PR target/92022 * g++.dg/pr92022.C: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@276845 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 5 +++++ gcc/config/alpha/alpha.c | 3 +++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/pr92022.C | 13 +++++++++++++ 4 files changed, 26 insertions(+) create mode 100644 gcc/testsuite/g++.dg/pr92022.C diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 9a1f54f6b03..f8ef39e471c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2019-10-10 Uroš Bizjak <ubizjak@gmail.com> + + PR target/92022 + * config/alpha/alpha.c (alpha_handle_trap_shadows): Skip DEBUG_INSN. + 2019-10-10 Oleg Endo <olegendo@gcc.gnu.org> Backport from mainline diff --git a/gcc/config/alpha/alpha.c b/gcc/config/alpha/alpha.c index db2c831506a..ee95b4428ec 100644 --- a/gcc/config/alpha/alpha.c +++ b/gcc/config/alpha/alpha.c @@ -8835,6 +8835,9 @@ alpha_handle_trap_shadows (void) case CODE_LABEL: goto close_shadow; + case DEBUG_INSN: + break; + default: gcc_unreachable (); } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 216d3ece4c9..2579998c7a3 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-10-10 Uroš Bizjak <ubizjak@gmail.com> + + PR target/92022 + * g++.dg/pr92022.C: New test. + 2019-10-07 Thomas Koenig <tkoenig@gcc.gnu.org> Backport from trunk diff --git a/gcc/testsuite/g++.dg/pr92022.C b/gcc/testsuite/g++.dg/pr92022.C new file mode 100644 index 00000000000..066d984ffc5 --- /dev/null +++ b/gcc/testsuite/g++.dg/pr92022.C @@ -0,0 +1,13 @@ +// { dg-do compile { target alpha*-*-* } } +// { dg-options "-O1 -g -fno-var-tracking -mcpu=ev4 -mieee" } + +struct a { + a(long); +}; +long b; +void c() { + a d(1); + double e = b; + for (; b;) + d = e; +} -- cgit v1.2.3 From 3c1a45e8b34b07335424907e0db8df4ee8bb5bee Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Fri, 11 Oct 2019 00:16:32 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@276856 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index caa1d99aa14..e21f9c0d1ab 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20191010 +20191011 -- cgit v1.2.3 From be5b9483f80d28e0ee3c0dd10687e4db89571c71 Mon Sep 17 00:00:00 2001 From: Eric Botcazou <ebotcazou@adacore.com> Date: Fri, 11 Oct 2019 08:57:48 +0000 Subject: * gcc-interface/decl.c (annotate_value) <INTEGER_CST>: Really test the sign of the value when deciding to build a NEGATE_EXPR. <PLUS_EXPR>: Remove redundant line. <BIT_AND_EXPR>: Do the negation here. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@276868 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ada/ChangeLog | 7 +++++++ gcc/ada/gcc-interface/decl.c | 16 +++++++--------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 478bb86cf4f..c7e8185c67f 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,10 @@ +2019-10-11 Eric Botcazou <ebotcazou@adacore.com> + + * gcc-interface/decl.c (annotate_value) <INTEGER_CST>: Really test the + sign of the value when deciding to build a NEGATE_EXPR. + <PLUS_EXPR>: Remove redundant line. + <BIT_AND_EXPR>: Do the negation here. + 2019-09-23 Eric Botcazou <ebotcazou@adacore.com> * gcc-interface/trans.c (Attribute_to_gnu): Test Can_Use_Internal_Rep diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c index 9f499e0ad59..3e8552a2d5c 100644 --- a/gcc/ada/gcc-interface/decl.c +++ b/gcc/ada/gcc-interface/decl.c @@ -8107,9 +8107,8 @@ annotate_value (tree gnu_size) { case INTEGER_CST: /* For negative values, build NEGATE_EXPR of the opposite. Such values - can appear for discriminants in expressions for variants. Note that, - sizetype being unsigned, we don't directly use tree_int_cst_sgn. */ - if (tree_int_cst_sign_bit (gnu_size)) + can appear for discriminants in expressions for variants. */ + if (tree_int_cst_sgn (gnu_size) < 0) { tree t = wide_int_to_tree (sizetype, -wi::to_wide (gnu_size)); tcode = Negate_Expr; @@ -8187,9 +8186,8 @@ annotate_value (tree gnu_size) && tree_int_cst_sign_bit (TREE_OPERAND (gnu_size, 1))) { tcode = Minus_Expr; - ops[0] = annotate_value (TREE_OPERAND (gnu_size, 0)); - wide_int op1 = -wi::to_wide (TREE_OPERAND (gnu_size, 1)); - ops[1] = annotate_value (wide_int_to_tree (sizetype, op1)); + wide_int wop1 = -wi::to_wide (TREE_OPERAND (gnu_size, 1)); + ops[1] = annotate_value (wide_int_to_tree (sizetype, wop1)); break; } @@ -8230,9 +8228,9 @@ annotate_value (tree gnu_size) Such values can appear in expressions with aligning patterns. */ if (TREE_CODE (TREE_OPERAND (gnu_size, 1)) == INTEGER_CST) { - wide_int op1 = wi::sext (wi::to_wide (TREE_OPERAND (gnu_size, 1)), - TYPE_PRECISION (sizetype)); - ops[1] = annotate_value (wide_int_to_tree (sizetype, op1)); + wide_int wop1 = -wi::to_wide (TREE_OPERAND (gnu_size, 1)); + tree op1 = wide_int_to_tree (sizetype, wop1); + ops[1] = annotate_value (build1 (NEGATE_EXPR, sizetype, op1)); } break; -- cgit v1.2.3 From dfb5de3c8123f88b03a677ef5151d816ddb5cf76 Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Sat, 12 Oct 2019 00:16:09 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@276910 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index e21f9c0d1ab..662cb4489e0 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20191011 +20191012 -- cgit v1.2.3 From 53372a864203f03fa7b77ec144a384e8ea1cf64a Mon Sep 17 00:00:00 2001 From: Eric Botcazou <ebotcazou@adacore.com> Date: Sat, 12 Oct 2019 14:50:05 +0000 Subject: PR ada/91995 * sem_ch8.adb (Chain_Use_Clause): Remove second argument in calls to Defining_Entity. * sem_elab.adb (Find_Unit_Entity): Likewise. Deal with N_Subunit here in lieu of in Defining_Entity. * sem_spark.adb (Check_Callable_Body): Likewise. (Check_Package_Body): Likewise. * sem_util.ads (Defining_Entity): Remove 2nd and 3th parameters. * sem_util.adb (Defining_Entity): Remove 2nd and 3th parameters, and adjust accordingly. Deal with N_Compilation_Unit. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@276918 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ada/ChangeLog | 13 +++++++++++++ gcc/ada/sem_ch8.adb | 6 ++---- gcc/ada/sem_elab.adb | 16 +++++++++++++--- gcc/ada/sem_spark.adb | 4 ++-- gcc/ada/sem_util.adb | 43 +++++++++---------------------------------- gcc/ada/sem_util.ads | 21 +-------------------- 6 files changed, 40 insertions(+), 63 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index c7e8185c67f..492180381a2 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,16 @@ +2019-10-12 Eric Botcazou <ebotcazou@adacore.com> + + PR ada/91995 + * sem_ch8.adb (Chain_Use_Clause): Remove second argument in calls + to Defining_Entity. + * sem_elab.adb (Find_Unit_Entity): Likewise. Deal with N_Subunit + here in lieu of in Defining_Entity. + * sem_spark.adb (Check_Callable_Body): Likewise. + (Check_Package_Body): Likewise. + * sem_util.ads (Defining_Entity): Remove 2nd and 3th parameters. + * sem_util.adb (Defining_Entity): Remove 2nd and 3th parameters, + and adjust accordingly. Deal with N_Compilation_Unit. + 2019-10-11 Eric Botcazou <ebotcazou@adacore.com> * gcc-interface/decl.c (annotate_value) <INTEGER_CST>: Really test the diff --git a/gcc/ada/sem_ch8.adb b/gcc/ada/sem_ch8.adb index 49b11835afc..753c3f0deaf 100644 --- a/gcc/ada/sem_ch8.adb +++ b/gcc/ada/sem_ch8.adb @@ -4259,16 +4259,14 @@ package body Sem_Ch8 is -- Common case for compilation unit - elsif Defining_Entity (N => Parent (N), - Empty_On_Errors => True) = Current_Scope - then + elsif Defining_Entity (Parent (N)) = Current_Scope then null; else -- If declaration appears in some other scope, it must be in some -- parent unit when compiling a child. - Pack := Defining_Entity (Parent (N), Empty_On_Errors => True); + Pack := Defining_Entity (Parent (N)); if not In_Open_Scopes (Pack) then null; diff --git a/gcc/ada/sem_elab.adb b/gcc/ada/sem_elab.adb index cc5d0456cdc..d2a21e00b6b 100644 --- a/gcc/ada/sem_elab.adb +++ b/gcc/ada/sem_elab.adb @@ -5544,13 +5544,23 @@ package body Sem_Elab is N_Procedure_Instantiation) and then Nkind (Context) = N_Compilation_Unit then - return - Related_Instance (Defining_Entity (N, Concurrent_Subunit => True)); + return Related_Instance (Defining_Entity (N)); + + -- The unit denotes a concurrent body acting as a subunit. Such bodies + -- are generally rewritten into null statements. The proper entity is + -- that of the "original node". + + elsif Nkind (N) = N_Subunit + and then Nkind (Proper_Body (N)) = N_Null_Statement + and then Nkind_In (Original_Node (Proper_Body (N)), N_Protected_Body, + N_Task_Body) + then + return Defining_Entity (Original_Node (Proper_Body (N))); -- Otherwise the proper entity is the defining entity else - return Defining_Entity (N, Concurrent_Subunit => True); + return Defining_Entity (N); end if; end Find_Unit_Entity; diff --git a/gcc/ada/sem_spark.adb b/gcc/ada/sem_spark.adb index e8aede44af9..4b7ea0f232c 100644 --- a/gcc/ada/sem_spark.adb +++ b/gcc/ada/sem_spark.adb @@ -971,7 +971,7 @@ package body Sem_SPARK is if Present (SPARK_Pragma (Defining_Entity (Body_N))) then if Get_SPARK_Mode_From_Annotation - (SPARK_Pragma (Defining_Entity (Body_N, False))) /= Opt.On + (SPARK_Pragma (Defining_Entity (Body_N))) /= Opt.On then return; end if; @@ -2379,7 +2379,7 @@ package body Sem_SPARK is CorSp : Node_Id; begin - if Present (SPARK_Pragma (Defining_Entity (Pack, False))) then + if Present (SPARK_Pragma (Defining_Entity (Pack))) then if Get_SPARK_Mode_From_Annotation (SPARK_Pragma (Defining_Entity (Pack))) /= Opt.On then diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb index 5fa02ddde1c..1f1523d1dad 100644 --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -5714,11 +5714,7 @@ package body Sem_Util is -- Defining_Entity -- --------------------- - function Defining_Entity - (N : Node_Id; - Empty_On_Errors : Boolean := False; - Concurrent_Subunit : Boolean := False) return Entity_Id - is + function Defining_Entity (N : Node_Id) return Entity_Id is begin case Nkind (N) is when N_Abstract_Subprogram_Declaration @@ -5769,24 +5765,11 @@ package body Sem_Util is => return Defining_Identifier (N); - when N_Subunit => - declare - Bod : constant Node_Id := Proper_Body (N); - Orig_Bod : constant Node_Id := Original_Node (Bod); - - begin - -- Retrieve the entity of the original protected or task body - -- if requested by the caller. + when N_Compilation_Unit => + return Defining_Entity (Unit (N)); - if Concurrent_Subunit - and then Nkind (Bod) = N_Null_Statement - and then Nkind_In (Orig_Bod, N_Protected_Body, N_Task_Body) - then - return Defining_Entity (Orig_Bod); - else - return Defining_Entity (Bod); - end if; - end; + when N_Subunit => + return Defining_Entity (Proper_Body (N)); when N_Function_Instantiation | N_Function_Specification @@ -5812,14 +5795,10 @@ package body Sem_Util is -- can continue semantic analysis. elsif Nam = Error then - if Empty_On_Errors then - return Empty; - else - Err := Make_Temporary (Sloc (N), 'T'); - Set_Defining_Unit_Name (N, Err); + Err := Make_Temporary (Sloc (N), 'T'); + Set_Defining_Unit_Name (N, Err); - return Err; - end if; + return Err; -- If not an entity, get defining identifier @@ -5834,11 +5813,7 @@ package body Sem_Util is return Entity (Identifier (N)); when others => - if Empty_On_Errors then - return Empty; - else - raise Program_Error; - end if; + raise Program_Error; end case; end Defining_Entity; diff --git a/gcc/ada/sem_util.ads b/gcc/ada/sem_util.ads index 3de394456b0..60171ff4b21 100644 --- a/gcc/ada/sem_util.ads +++ b/gcc/ada/sem_util.ads @@ -543,10 +543,7 @@ package Sem_Util is -- in the case of a descendant of a generic formal type (returns Int'Last -- instead of 0). - function Defining_Entity - (N : Node_Id; - Empty_On_Errors : Boolean := False; - Concurrent_Subunit : Boolean := False) return Entity_Id; + function Defining_Entity (N : Node_Id) return Entity_Id; -- Given a declaration N, returns the associated defining entity. If the -- declaration has a specification, the entity is obtained from the -- specification. If the declaration has a defining unit name, then the @@ -557,22 +554,6 @@ package Sem_Util is -- local entities declared during loop expansion. These entities need -- debugging information, generated through Qualify_Entity_Names, and -- the loop declaration must be placed in the table Name_Qualify_Units. - -- - -- Set flag Empty_On_Error to change the behavior of this routine as - -- follows: - -- - -- * True - A declaration that lacks a defining entity returns Empty. - -- A node that does not allow for a defining entity returns Empty. - -- - -- * False - A declaration that lacks a defining entity is given a new - -- internally generated entity which is subsequently returned. A node - -- that does not allow for a defining entity raises Program_Error. - -- - -- The former semantics is appropriate for the back end; the latter - -- semantics is appropriate for the front end. - -- - -- Set flag Concurrent_Subunit to handle rewritings of concurrent bodies - -- which act as subunits. Such bodies are generally rewritten as null. function Denotes_Discriminant (N : Node_Id; -- cgit v1.2.3 From c753cc4caf4a3569c91cad01d269d78c7c758c27 Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Sun, 13 Oct 2019 00:16:18 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@276931 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 662cb4489e0..b22adfb18e1 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20191012 +20191013 -- cgit v1.2.3 From edfd618427030f94ff1dec7ee8d7bf5f2bdbdd4b Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Mon, 14 Oct 2019 00:16:09 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@276945 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index b22adfb18e1..d6c8807ea6f 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20191013 +20191014 -- cgit v1.2.3 From c27587e31c5e07a71aa4b9f182ba9c1781a867d4 Mon Sep 17 00:00:00 2001 From: Will Schmidt <will_schmidt@vnet.ibm.com> Date: Mon, 14 Oct 2019 18:08:58 +0000 Subject: Backport from trunk [gcc] 2019-09-26 Will Schmidt <will_schmidt@vnet.ibm.com> * config/rs6000/rs6000-builtin.def: (LVSL, LVSR, LVEBX, LVEHX, LVEWX, LVXL, LVXL_V2DF, LVXL_V2DI, LVXL_V4SF, LVXL_V4SI, LVXL_V8HI, LVXL_V16QI, LVX, LVX_V1TI, LVX_V2DF, LVX_V2DI, LVX_V4SF, LVX_V4SI, LVX_V8HI, LVX_V16QI, LVLX, LVLXL, LVRX, LVRXL, LXSDX, LXVD2X_V1TI, LXVD2X_V2DF, LXVD2X_V2DI, LXVDSX, LXVW4X_V4SF, LXVW4X_V4SI, LXVW4X_V8HI, LXVW4X_V16QI, LD_ELEMREV_V1TI, LD_ELEMREV_V2DF, LD_ELEMREV_V2DI, LD_ELEMREV_V4SF, LD_ELEMREV_V4SI, LD_ELEMREV_V8HI, LD_ELEMREV_V16QI): Use the PURE attribute. [testsuite] 2019-09-26 Will Schmidt <will_schmidt@vnet.ibm.com> * gcc.target/powerpc/pure-builtin-redundant-load.c: New. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@276965 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 14 ++++ gcc/config/rs6000/rs6000-builtin.def | 80 +++++++++++----------- gcc/testsuite/ChangeLog | 7 ++ .../powerpc/pure-builtin-redundant-load.c | 47 +++++++++++++ 4 files changed, 108 insertions(+), 40 deletions(-) create mode 100644 gcc/testsuite/gcc.target/powerpc/pure-builtin-redundant-load.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f8ef39e471c..90594b13648 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,17 @@ +2019-10-14 Will Schmidt <will_schmidt@vnet.ibm.com> + + Backport from trunk + 2019-09-26 Will Schmidt <will_schmidt@vnet.ibm.com> + + * config/rs6000/rs6000-builtin.def: (LVSL, LVSR, LVEBX, LVEHX, + LVEWX, LVXL, LVXL_V2DF, LVXL_V2DI, LVXL_V4SF, LVXL_V4SI, LVXL_V8HI, + LVXL_V16QI, LVX, LVX_V1TI, LVX_V2DF, LVX_V2DI, LVX_V4SF, LVX_V4SI, + LVX_V8HI, LVX_V16QI, LVLX, LVLXL, LVRX, LVRXL, LXSDX, LXVD2X_V1TI, + LXVD2X_V2DF, LXVD2X_V2DI, LXVDSX, LXVW4X_V4SF, LXVW4X_V4SI, + LXVW4X_V8HI, LXVW4X_V16QI, LD_ELEMREV_V1TI, LD_ELEMREV_V2DF, + LD_ELEMREV_V2DI, LD_ELEMREV_V4SF, LD_ELEMREV_V4SI, LD_ELEMREV_V8HI, + LD_ELEMREV_V16QI): Use the PURE attribute. + 2019-10-10 Uroš Bizjak <ubizjak@gmail.com> PR target/92022 diff --git a/gcc/config/rs6000/rs6000-builtin.def b/gcc/config/rs6000/rs6000-builtin.def index d2896fce7c3..78042d51593 100644 --- a/gcc/config/rs6000/rs6000-builtin.def +++ b/gcc/config/rs6000/rs6000-builtin.def @@ -1223,26 +1223,26 @@ BU_ALTIVEC_X (MTVSCR, "mtvscr", MISC) BU_ALTIVEC_X (MFVSCR, "mfvscr", MISC) BU_ALTIVEC_X (DSSALL, "dssall", MISC) BU_ALTIVEC_X (DSS, "dss", MISC) -BU_ALTIVEC_X (LVSL, "lvsl", MEM) -BU_ALTIVEC_X (LVSR, "lvsr", MEM) -BU_ALTIVEC_X (LVEBX, "lvebx", MEM) -BU_ALTIVEC_X (LVEHX, "lvehx", MEM) -BU_ALTIVEC_X (LVEWX, "lvewx", MEM) -BU_ALTIVEC_X (LVXL, "lvxl", MEM) -BU_ALTIVEC_X (LVXL_V2DF, "lvxl_v2df", MEM) -BU_ALTIVEC_X (LVXL_V2DI, "lvxl_v2di", MEM) -BU_ALTIVEC_X (LVXL_V4SF, "lvxl_v4sf", MEM) -BU_ALTIVEC_X (LVXL_V4SI, "lvxl_v4si", MEM) -BU_ALTIVEC_X (LVXL_V8HI, "lvxl_v8hi", MEM) -BU_ALTIVEC_X (LVXL_V16QI, "lvxl_v16qi", MEM) -BU_ALTIVEC_X (LVX, "lvx", MEM) -BU_ALTIVEC_X (LVX_V1TI, "lvx_v1ti", MEM) -BU_ALTIVEC_X (LVX_V2DF, "lvx_v2df", MEM) -BU_ALTIVEC_X (LVX_V2DI, "lvx_v2di", MEM) -BU_ALTIVEC_X (LVX_V4SF, "lvx_v4sf", MEM) -BU_ALTIVEC_X (LVX_V4SI, "lvx_v4si", MEM) -BU_ALTIVEC_X (LVX_V8HI, "lvx_v8hi", MEM) -BU_ALTIVEC_X (LVX_V16QI, "lvx_v16qi", MEM) +BU_ALTIVEC_X (LVSL, "lvsl", PURE) +BU_ALTIVEC_X (LVSR, "lvsr", PURE) +BU_ALTIVEC_X (LVEBX, "lvebx", PURE) +BU_ALTIVEC_X (LVEHX, "lvehx", PURE) +BU_ALTIVEC_X (LVEWX, "lvewx", PURE) +BU_ALTIVEC_X (LVXL, "lvxl", PURE) +BU_ALTIVEC_X (LVXL_V2DF, "lvxl_v2df", PURE) +BU_ALTIVEC_X (LVXL_V2DI, "lvxl_v2di", PURE) +BU_ALTIVEC_X (LVXL_V4SF, "lvxl_v4sf", PURE) +BU_ALTIVEC_X (LVXL_V4SI, "lvxl_v4si", PURE) +BU_ALTIVEC_X (LVXL_V8HI, "lvxl_v8hi", PURE) +BU_ALTIVEC_X (LVXL_V16QI, "lvxl_v16qi", PURE) +BU_ALTIVEC_X (LVX, "lvx", PURE) +BU_ALTIVEC_X (LVX_V1TI, "lvx_v1ti", PURE) +BU_ALTIVEC_X (LVX_V2DF, "lvx_v2df", PURE) +BU_ALTIVEC_X (LVX_V2DI, "lvx_v2di", PURE) +BU_ALTIVEC_X (LVX_V4SF, "lvx_v4sf", PURE) +BU_ALTIVEC_X (LVX_V4SI, "lvx_v4si", PURE) +BU_ALTIVEC_X (LVX_V8HI, "lvx_v8hi", PURE) +BU_ALTIVEC_X (LVX_V16QI, "lvx_v16qi", PURE) BU_ALTIVEC_X (STVX, "stvx", MEM) BU_ALTIVEC_X (STVX_V2DF, "stvx_v2df", MEM) BU_ALTIVEC_X (STVX_V2DI, "stvx_v2di", MEM) @@ -1250,10 +1250,10 @@ BU_ALTIVEC_X (STVX_V4SF, "stvx_v4sf", MEM) BU_ALTIVEC_X (STVX_V4SI, "stvx_v4si", MEM) BU_ALTIVEC_X (STVX_V8HI, "stvx_v8hi", MEM) BU_ALTIVEC_X (STVX_V16QI, "stvx_v16qi", MEM) -BU_ALTIVEC_C (LVLX, "lvlx", MEM) -BU_ALTIVEC_C (LVLXL, "lvlxl", MEM) -BU_ALTIVEC_C (LVRX, "lvrx", MEM) -BU_ALTIVEC_C (LVRXL, "lvrxl", MEM) +BU_ALTIVEC_C (LVLX, "lvlx", PURE) +BU_ALTIVEC_C (LVLXL, "lvlxl", PURE) +BU_ALTIVEC_C (LVRX, "lvrx", PURE) +BU_ALTIVEC_C (LVRXL, "lvrxl", PURE) BU_ALTIVEC_X (STVEBX, "stvebx", MEM) BU_ALTIVEC_X (STVEHX, "stvehx", MEM) BU_ALTIVEC_X (STVEWX, "stvewx", MEM) @@ -1764,15 +1764,15 @@ BU_VSX_P (XVCMPGEDP_P, "xvcmpgedp_p", CONST, vector_ge_v2df_p) BU_VSX_P (XVCMPGTDP_P, "xvcmpgtdp_p", CONST, vector_gt_v2df_p) /* VSX builtins that are handled as special cases. */ -BU_VSX_X (LXSDX, "lxsdx", MEM) -BU_VSX_X (LXVD2X_V1TI, "lxvd2x_v1ti", MEM) -BU_VSX_X (LXVD2X_V2DF, "lxvd2x_v2df", MEM) -BU_VSX_X (LXVD2X_V2DI, "lxvd2x_v2di", MEM) -BU_VSX_X (LXVDSX, "lxvdsx", MEM) -BU_VSX_X (LXVW4X_V4SF, "lxvw4x_v4sf", MEM) -BU_VSX_X (LXVW4X_V4SI, "lxvw4x_v4si", MEM) -BU_VSX_X (LXVW4X_V8HI, "lxvw4x_v8hi", MEM) -BU_VSX_X (LXVW4X_V16QI, "lxvw4x_v16qi", MEM) +BU_VSX_X (LXSDX, "lxsdx", PURE) +BU_VSX_X (LXVD2X_V1TI, "lxvd2x_v1ti", PURE) +BU_VSX_X (LXVD2X_V2DF, "lxvd2x_v2df", PURE) +BU_VSX_X (LXVD2X_V2DI, "lxvd2x_v2di", PURE) +BU_VSX_X (LXVDSX, "lxvdsx", PURE) +BU_VSX_X (LXVW4X_V4SF, "lxvw4x_v4sf", PURE) +BU_VSX_X (LXVW4X_V4SI, "lxvw4x_v4si", PURE) +BU_VSX_X (LXVW4X_V8HI, "lxvw4x_v8hi", PURE) +BU_VSX_X (LXVW4X_V16QI, "lxvw4x_v16qi", PURE) BU_VSX_X (STXSDX, "stxsdx", MEM) BU_VSX_X (STXVD2X_V1TI, "stxvd2x_v1ti", MEM) BU_VSX_X (STXVD2X_V2DF, "stxvd2x_v2df", MEM) @@ -1781,13 +1781,13 @@ BU_VSX_X (STXVW4X_V4SF, "stxvw4x_v4sf", MEM) BU_VSX_X (STXVW4X_V4SI, "stxvw4x_v4si", MEM) BU_VSX_X (STXVW4X_V8HI, "stxvw4x_v8hi", MEM) BU_VSX_X (STXVW4X_V16QI, "stxvw4x_v16qi", MEM) -BU_VSX_X (LD_ELEMREV_V1TI, "ld_elemrev_v1ti", MEM) -BU_VSX_X (LD_ELEMREV_V2DF, "ld_elemrev_v2df", MEM) -BU_VSX_X (LD_ELEMREV_V2DI, "ld_elemrev_v2di", MEM) -BU_VSX_X (LD_ELEMREV_V4SF, "ld_elemrev_v4sf", MEM) -BU_VSX_X (LD_ELEMREV_V4SI, "ld_elemrev_v4si", MEM) -BU_VSX_X (LD_ELEMREV_V8HI, "ld_elemrev_v8hi", MEM) -BU_VSX_X (LD_ELEMREV_V16QI, "ld_elemrev_v16qi", MEM) +BU_VSX_X (LD_ELEMREV_V1TI, "ld_elemrev_v1ti", PURE) +BU_VSX_X (LD_ELEMREV_V2DF, "ld_elemrev_v2df", PURE) +BU_VSX_X (LD_ELEMREV_V2DI, "ld_elemrev_v2di", PURE) +BU_VSX_X (LD_ELEMREV_V4SF, "ld_elemrev_v4sf", PURE) +BU_VSX_X (LD_ELEMREV_V4SI, "ld_elemrev_v4si", PURE) +BU_VSX_X (LD_ELEMREV_V8HI, "ld_elemrev_v8hi", PURE) +BU_VSX_X (LD_ELEMREV_V16QI, "ld_elemrev_v16qi", PURE) BU_VSX_X (ST_ELEMREV_V1TI, "st_elemrev_v1ti", MEM) BU_VSX_X (ST_ELEMREV_V2DF, "st_elemrev_v2df", MEM) BU_VSX_X (ST_ELEMREV_V2DI, "st_elemrev_v2di", MEM) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 2579998c7a3..909369d523d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2019-10-14 Will Schmidt <will_schmidt@vnet.ibm.com> + + Backport from trunk. + 2019-09-26 Will Schmidt <will_schmidt@vnet.ibm.com> + + * gcc.target/powerpc/pure-builtin-redundant-load.c: New. + 2019-10-10 Uroš Bizjak <ubizjak@gmail.com> PR target/92022 diff --git a/gcc/testsuite/gcc.target/powerpc/pure-builtin-redundant-load.c b/gcc/testsuite/gcc.target/powerpc/pure-builtin-redundant-load.c new file mode 100644 index 00000000000..16ab6abfc3b --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/pure-builtin-redundant-load.c @@ -0,0 +1,47 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target powerpc_vsx_ok } */ +/* { dg-options "-O2 -fdump-tree-fre-all -mvsx" } */ + +/* Verify we remove a redundant load that occurs both before and after +we call a vector load builtin. +This testcase is introduced as we updated a number of our vector load +built-ins with the attribute of PURE instead of MEM, to indicate that +those builtins only read from memory, versus reading from and writing +to the same. +This means we can identify the redundant load instructions in an earlier +pass, and optimize them away. */ + +#include <altivec.h> + +vector signed short load_data; + +vector signed short foo() +{ + vector signed short r11,r12,r13; + r11 = load_data; + r12 = vec_xl (0, &load_data[0]); + r13 = load_data; + return (r11 + r12 + r13); +} + +vector signed short biz() +{ + vector signed short r21,r22,r23; + r21 = load_data; + r22 = vec_lvehx (0, &load_data[0]); + r23 = load_data; + return (r21 + r22 + r23); +} + +vector signed short bar() +{ + vector signed short r31,r32,r33; + r31 = load_data; + r32 = vec_lvx (0, &load_data[0]); + r33 = load_data; + return (r31 + r32 + r33); +} + +/* { dg-final { scan-tree-dump-times "Removing dead stmt r13_. = load_data;" 1 "fre1" } } */ +/* { dg-final { scan-tree-dump-times "Removing dead stmt r23_. = load_data;" 1 "fre1" } } */ +/* { dg-final { scan-tree-dump-times "Removing dead stmt r33_. = load_data;" 1 "fre1" } } */ -- cgit v1.2.3 From 52ea879faf3edb0f2b1e284e9a91ca5f9984cbbb Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Tue, 15 Oct 2019 00:16:09 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@276980 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index d6c8807ea6f..d62a9007659 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20191014 +20191015 -- cgit v1.2.3 From 69191418311fae4aa58f09bb3d61b89185f369cf Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Wed, 16 Oct 2019 00:16:08 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@277031 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index d62a9007659..e6b876ab237 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20191015 +20191016 -- cgit v1.2.3 From c2f0519aa5886a27fad31ef72bec8e2d6f298268 Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Thu, 17 Oct 2019 00:16:09 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@277086 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index e6b876ab237..6f145caa08d 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20191016 +20191017 -- cgit v1.2.3 From 1f37039194de051b5ec8e7f1c72ec7f89bcbb4e0 Mon Sep 17 00:00:00 2001 From: Bill Schmidt <wschmidt@linux.ibm.com> Date: Thu, 17 Oct 2019 15:33:58 +0000 Subject: 2019-10-17 Bill Schmidt <wschmidt@linux.ibm.com> Backport from mainline 2019-10-15 Bill Schmidt <wschmidt@linux.ibm.com> PR target/92093 * gcc.target/powerpc/pr91275.c: Fix type and endian issues. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@277118 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/testsuite/ChangeLog | 8 ++++++++ gcc/testsuite/gcc.target/powerpc/pr91275.c | 7 ++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 909369d523d..b0275113453 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2019-10-17 Bill Schmidt <wschmidt@linux.ibm.com> + + Backport from mainline + 2019-10-15 Bill Schmidt <wschmidt@linux.ibm.com> + + PR target/92093 + * gcc.target/powerpc/pr91275.c: Fix type and endian issues. + 2019-10-14 Will Schmidt <will_schmidt@vnet.ibm.com> Backport from trunk. diff --git a/gcc/testsuite/gcc.target/powerpc/pr91275.c b/gcc/testsuite/gcc.target/powerpc/pr91275.c index b23d75be29b..cd461158af7 100644 --- a/gcc/testsuite/gcc.target/powerpc/pr91275.c +++ b/gcc/testsuite/gcc.target/powerpc/pr91275.c @@ -10,12 +10,17 @@ int main() { const unsigned long long r0l = 0x8e7dfceac070e3a0; vector unsigned long long r0 = (vector unsigned long long) {r0l, 0}, v; const vector unsigned long long pd - = (vector unsigned long) {0xc2LLU << 56, 0}; + = (vector unsigned long long) {0xc2LLU << 56, 0}; v = __builtin_crypto_vpmsumd ((vector unsigned long long) {r0[0], 0}, pd); +#if __LITTLE_ENDIAN__ if (v[0] != 0x4000000000000000 || v[1] != 0x65bd7ab605a4a8ff) __builtin_abort (); +#else + if (v[1] != 0x4000000000000000 || v[0] != 0x65bd7ab605a4a8ff) + __builtin_abort (); +#endif return 0; } -- cgit v1.2.3 From b17936d92a235b9a7a2d8e0e4f566f9e2eb3d80c Mon Sep 17 00:00:00 2001 From: Richard Earnshaw <rearnsha@arm.com> Date: Thu, 17 Oct 2019 16:47:42 +0000 Subject: [arm] PR target/89400 fix thumb1 unaligned access expansion Armv6 has support for unaligned accesses to memory. However, the thumb1 code patterns were trying to use the 32-bit code constraints. One failure mode from this was that the patterns are designed to be compatible with conditional execution and this was then causing an assert in the compiler. The unaligned_loadhis pattern is only used for expanding extv, which in turn is only enabled for systems supporting thumb2. Given that there is no simple expansion for a thumb1 sign-extending load (the instruction has no immediate offset form and requires two registers in the address) it seems simpler to just disable this for thumb1. Fixed thusly: Backport from trunk: 2019-05-03 Richard Earnshaw <rearnsha@arm.com> PR target/89400 * config/arm/arm.md (unaligned_loadsi): Add variant for thumb1. Restrict 'all' variant to 32-bit configurations. (unaligned_loadhiu): Likewise. (unaligned_storehi): Likewise. (unaligned_storesi): Likewise. (unaligned_loadhis): Disable when compiling for thumb1. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@277124 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 13 +++++++++ gcc/config/arm/arm.md | 74 +++++++++++++++++++++++++++++++-------------------- 2 files changed, 58 insertions(+), 29 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 90594b13648..bc72864c2b3 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,16 @@ +2019-10-17 Richard Earnshaw <rearnsha@arm.com> + + Backport from mainline + 2019-05-03 Richard Earnshaw <rearnsha@arm.com> + + PR target/89400 + * config/arm/arm.md (unaligned_loadsi): Add variant for thumb1. + Restrict 'all' variant to 32-bit configurations. + (unaligned_loadhiu): Likewise. + (unaligned_storehi): Likewise. + (unaligned_storesi): Likewise. + (unaligned_loadhis): Disable when compiling for thumb1. + 2019-10-14 Will Schmidt <will_schmidt@vnet.ibm.com> Backport from trunk diff --git a/gcc/config/arm/arm.md b/gcc/config/arm/arm.md index b6782d8009f..f78e1477eab 100644 --- a/gcc/config/arm/arm.md +++ b/gcc/config/arm/arm.md @@ -4448,62 +4448,78 @@ ; ARMv6+ unaligned load/store instructions (used for packed structure accesses). (define_insn "unaligned_loadsi" - [(set (match_operand:SI 0 "s_register_operand" "=l,r") - (unspec:SI [(match_operand:SI 1 "memory_operand" "Uw,m")] + [(set (match_operand:SI 0 "s_register_operand" "=l,l,r") + (unspec:SI [(match_operand:SI 1 "memory_operand" "m,Uw,m")] UNSPEC_UNALIGNED_LOAD))] "unaligned_access" - "ldr%?\t%0, %1\t@ unaligned" - [(set_attr "arch" "t2,any") - (set_attr "length" "2,4") - (set_attr "predicable" "yes") - (set_attr "predicable_short_it" "yes,no") + "@ + ldr\t%0, %1\t@ unaligned + ldr%?\t%0, %1\t@ unaligned + ldr%?\t%0, %1\t@ unaligned" + [(set_attr "arch" "t1,t2,32") + (set_attr "length" "2,2,4") + (set_attr "predicable" "no,yes,yes") + (set_attr "predicable_short_it" "no,yes,no") (set_attr "type" "load_4")]) +;; The 16-bit Thumb1 variant of ldrsh requires two registers in the +;; address (there's no immediate format). That's tricky to support +;; here and we don't really need this pattern for that case, so only +;; enable for 32-bit ISAs. (define_insn "unaligned_loadhis" [(set (match_operand:SI 0 "s_register_operand" "=r") (sign_extend:SI (unspec:HI [(match_operand:HI 1 "memory_operand" "Uh")] UNSPEC_UNALIGNED_LOAD)))] - "unaligned_access" + "unaligned_access && TARGET_32BIT" "ldrsh%?\t%0, %1\t@ unaligned" [(set_attr "predicable" "yes") (set_attr "type" "load_byte")]) (define_insn "unaligned_loadhiu" - [(set (match_operand:SI 0 "s_register_operand" "=l,r") + [(set (match_operand:SI 0 "s_register_operand" "=l,l,r") (zero_extend:SI - (unspec:HI [(match_operand:HI 1 "memory_operand" "Uw,m")] + (unspec:HI [(match_operand:HI 1 "memory_operand" "m,Uw,m")] UNSPEC_UNALIGNED_LOAD)))] "unaligned_access" - "ldrh%?\t%0, %1\t@ unaligned" - [(set_attr "arch" "t2,any") - (set_attr "length" "2,4") - (set_attr "predicable" "yes") - (set_attr "predicable_short_it" "yes,no") + "@ + ldrh\t%0, %1\t@ unaligned + ldrh%?\t%0, %1\t@ unaligned + ldrh%?\t%0, %1\t@ unaligned" + [(set_attr "arch" "t1,t2,32") + (set_attr "length" "2,2,4") + (set_attr "predicable" "no,yes,yes") + (set_attr "predicable_short_it" "no,yes,no") (set_attr "type" "load_byte")]) (define_insn "unaligned_storesi" - [(set (match_operand:SI 0 "memory_operand" "=Uw,m") - (unspec:SI [(match_operand:SI 1 "s_register_operand" "l,r")] + [(set (match_operand:SI 0 "memory_operand" "=m,Uw,m") + (unspec:SI [(match_operand:SI 1 "s_register_operand" "l,l,r")] UNSPEC_UNALIGNED_STORE))] "unaligned_access" - "str%?\t%1, %0\t@ unaligned" - [(set_attr "arch" "t2,any") - (set_attr "length" "2,4") - (set_attr "predicable" "yes") - (set_attr "predicable_short_it" "yes,no") + "@ + str\t%1, %0\t@ unaligned + str%?\t%1, %0\t@ unaligned + str%?\t%1, %0\t@ unaligned" + [(set_attr "arch" "t1,t2,32") + (set_attr "length" "2,2,4") + (set_attr "predicable" "no,yes,yes") + (set_attr "predicable_short_it" "no,yes,no") (set_attr "type" "store_4")]) (define_insn "unaligned_storehi" - [(set (match_operand:HI 0 "memory_operand" "=Uw,m") - (unspec:HI [(match_operand:HI 1 "s_register_operand" "l,r")] + [(set (match_operand:HI 0 "memory_operand" "=m,Uw,m") + (unspec:HI [(match_operand:HI 1 "s_register_operand" "l,l,r")] UNSPEC_UNALIGNED_STORE))] "unaligned_access" - "strh%?\t%1, %0\t@ unaligned" - [(set_attr "arch" "t2,any") - (set_attr "length" "2,4") - (set_attr "predicable" "yes") - (set_attr "predicable_short_it" "yes,no") + "@ + strh\t%1, %0\t@ unaligned + strh%?\t%1, %0\t@ unaligned + strh%?\t%1, %0\t@ unaligned" + [(set_attr "arch" "t1,t2,32") + (set_attr "length" "2,2,4") + (set_attr "predicable" "no,yes,yes") + (set_attr "predicable_short_it" "no,yes,no") (set_attr "type" "store_4")]) -- cgit v1.2.3 From 85db0034f0b651f66327fe73ae1cb167370d9670 Mon Sep 17 00:00:00 2001 From: Segher Boessenkool <segher@kernel.crashing.org> Date: Thu, 17 Oct 2019 19:51:01 +0000 Subject: Backport from trunk 2019-03-15 Segher Boessenkool <segher@kernel.crashing.org> PR rtl-optimization/89721 * lra-constraints (invariant_p): Return false if side_effects_p holds. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@277131 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 8 ++++++++ gcc/lra-constraints.c | 3 +++ 2 files changed, 11 insertions(+) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index bc72864c2b3..d96d4e08e31 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2019-10-17 Segher Boessenkool <segher@kernel.crashing.org> + + Backport from trunk + 2019-03-15 Segher Boessenkool <segher@kernel.crashing.org> + + PR rtl-optimization/89721 + * lra-constraints (invariant_p): Return false if side_effects_p holds. + 2019-10-17 Richard Earnshaw <rearnsha@arm.com> Backport from mainline diff --git a/gcc/lra-constraints.c b/gcc/lra-constraints.c index 484e9fa148c..575ffad1573 100644 --- a/gcc/lra-constraints.c +++ b/gcc/lra-constraints.c @@ -5767,6 +5767,9 @@ invariant_p (const_rtx x) enum rtx_code code; int i, j; + if (side_effects_p (x)) + return false; + code = GET_CODE (x); mode = GET_MODE (x); if (code == SUBREG) -- cgit v1.2.3 From a30911c9b809c8814e5deb0c3efefb3bd70acd6c Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Fri, 18 Oct 2019 00:16:08 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@277138 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 6f145caa08d..9e5dc633f2d 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20191017 +20191018 -- cgit v1.2.3 From 4872e3df61c3c33d94f1ecbc60c824ccd78644f3 Mon Sep 17 00:00:00 2001 From: Georg-Johann Lay <avr@gjlay.de> Date: Fri, 18 Oct 2019 09:12:34 +0000 Subject: Backport from 2019-10-18 trunk r277143. PR target/86040 * config/avr/avr.c (avr_out_lpm): Do not shortcut-return. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@277148 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 7 +++++++ gcc/config/avr/avr.c | 15 ++++++++------- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d96d4e08e31..fed72e5e2e2 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2019-10-18 Georg-Johann Lay <avr@gjlay.de> + + Backport from 2019-10-18 trunk r277143. + + PR target/86040 + * config/avr/avr.c (avr_out_lpm): Do not shortcut-return. + 2019-10-17 Segher Boessenkool <segher@kernel.crashing.org> Backport from trunk diff --git a/gcc/config/avr/avr.c b/gcc/config/avr/avr.c index 81c35e7fbc2..21bf94fc16c 100644 --- a/gcc/config/avr/avr.c +++ b/gcc/config/avr/avr.c @@ -3797,13 +3797,14 @@ avr_out_lpm (rtx_insn *insn, rtx *op, int *plen) gcc_unreachable(); case 1: - return avr_asm_len ("%4lpm %0,%a2", xop, plen, 1); + avr_asm_len ("%4lpm %0,%a2", xop, plen, 1); + break; case 2: if (REGNO (dest) == REG_Z) - return avr_asm_len ("%4lpm %5,%a2+" CR_TAB - "%4lpm %B0,%a2" CR_TAB - "mov %A0,%5", xop, plen, 3); + avr_asm_len ("%4lpm %5,%a2+" CR_TAB + "%4lpm %B0,%a2" CR_TAB + "mov %A0,%5", xop, plen, 3); else { avr_asm_len ("%4lpm %A0,%a2+" CR_TAB @@ -3832,9 +3833,9 @@ avr_out_lpm (rtx_insn *insn, rtx *op, int *plen) "%4lpm %B0,%a2+", xop, plen, 2); if (REGNO (dest) == REG_Z - 2) - return avr_asm_len ("%4lpm %5,%a2+" CR_TAB - "%4lpm %C0,%a2" CR_TAB - "mov %D0,%5", xop, plen, 3); + avr_asm_len ("%4lpm %5,%a2+" CR_TAB + "%4lpm %C0,%a2" CR_TAB + "mov %D0,%5", xop, plen, 3); else { avr_asm_len ("%4lpm %C0,%a2+" CR_TAB -- cgit v1.2.3 From 784d0063af2ef4736015a6a4606ca48fb0b7f3c0 Mon Sep 17 00:00:00 2001 From: "Steven G. Kargl" <kargl@gcc.gnu.org> Date: Fri, 18 Oct 2019 18:18:34 +0000 Subject: 2019-10-18 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/69455 * trans-decl.c (generate_local_decl): Avoid misconstructed intrinsic modules in a BLOCK construct. 2019-10-18 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/69455 * gfortran.dg/pr69455_1.f90: New test. * gfortran.dg/pr69455_2.f90: Ditto. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@277161 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fortran/ChangeLog | 6 ++++++ gcc/fortran/trans-decl.c | 9 ++++++++- gcc/testsuite/ChangeLog | 6 ++++++ gcc/testsuite/gfortran.dg/pr69455_1.f90 | 14 ++++++++++++++ gcc/testsuite/gfortran.dg/pr69455_2.f90 | 13 +++++++++++++ 5 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gfortran.dg/pr69455_1.f90 create mode 100644 gcc/testsuite/gfortran.dg/pr69455_2.f90 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 355420b1629..f7ddfdd6377 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2019-10-18 Steven G. Kargl <kargl@gcc.gnu.org> + + PR fortran/69455 + * trans-decl.c (generate_local_decl): Avoid misconstructed + intrinsic modules in a BLOCK construct. + 2019-10-07 Thomas Koenig <tkoenig@gcc.gnu.org> Backport from trunk diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c index c1cc658542e..4e778be34c5 100644 --- a/gcc/fortran/trans-decl.c +++ b/gcc/fortran/trans-decl.c @@ -5820,7 +5820,14 @@ generate_local_decl (gfc_symbol * sym) if (sym->ns && sym->ns->construct_entities) { - if (sym->attr.referenced) + /* Construction of the intrinsic modules within a BLOCK + construct, where ONLY and RENAMED entities are included, + seems to be bogus. This is a workaround that can be removed + if someone ever takes on the task to creating full-fledge + modules. See PR 69455. */ + if (sym->attr.referenced + && sym->from_intmod != INTMOD_ISO_C_BINDING + && sym->from_intmod != INTMOD_ISO_FORTRAN_ENV) gfc_get_symbol_decl (sym); sym->mark = 1; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b0275113453..7de8346b956 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2019-10-18 Steven G. Kargl <kargl@gcc.gnu.org> + + PR fortran/69455 + * gfortran.dg/pr69455_1.f90: New test. + * gfortran.dg/pr69455_2.f90: Ditto. + 2019-10-17 Bill Schmidt <wschmidt@linux.ibm.com> Backport from mainline diff --git a/gcc/testsuite/gfortran.dg/pr69455_1.f90 b/gcc/testsuite/gfortran.dg/pr69455_1.f90 new file mode 100644 index 00000000000..fe62e5c1b0b --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr69455_1.f90 @@ -0,0 +1,14 @@ +! { dg-do run } +program foo + block + use, intrinsic :: iso_c_binding, only: wp => c_float, ik => c_int + if (ik /= 4) stop 1 + if (wp /= 4) stop 2 + end block + block + use, intrinsic :: iso_c_binding, only: wp => c_double, ik => c_int64_t + if (ik /= 8) stop 3 + if (wp /= 8) stop 4 + end block +end program foo + diff --git a/gcc/testsuite/gfortran.dg/pr69455_2.f90 b/gcc/testsuite/gfortran.dg/pr69455_2.f90 new file mode 100644 index 00000000000..8f9fb35021f --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr69455_2.f90 @@ -0,0 +1,13 @@ +! { dg-do run } +program foo + block + use, intrinsic :: ISO_FORTRAN_ENV, only: wp => REAL32, ik => INT32 + if (ik /= 4) stop 1 + if (wp /= 4) stop 2 + end block + block + use, intrinsic :: ISO_FORTRAN_ENV, only: wp => REAL64, ik => INT64 + if (ik /= 8) stop 3 + if (wp /= 8) stop 4 + end block +end program foo -- cgit v1.2.3 From f9e5b5661c53efc2bc50c13bf9f5e18f8e9d19ff Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Sat, 19 Oct 2019 00:18:01 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@277197 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 9e5dc633f2d..7fd1715f1bd 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20191018 +20191019 -- cgit v1.2.3 From e6a89f79d572a90615bd2e1ca16c717aac44b442 Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Sun, 20 Oct 2019 00:16:19 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@277207 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 7fd1715f1bd..cf3b588aba3 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20191019 +20191020 -- cgit v1.2.3 From c24ac7f5cd9bb8ea6136035e51ef06700cbbb757 Mon Sep 17 00:00:00 2001 From: Iain Sandoe <iain@sandoe.co.uk> Date: Sun, 20 Oct 2019 16:29:27 +0000 Subject: [Darwin, specs] Fix driver handling of PIE options. pie, no-pie and rdynamic are driver options, we can process them in the relevant place and drop them once dealt with. There's no need to generate a new header to process the no_compact_unwind which is applied on the basis of the target system. Support for the -pie, -no_pie and -no_compact_unwind options should ideally be checked at configure time, however the status quo is to assert that linkers capable of targeting the relevant systems support these options (i.e. we trust that the user doesn't attempt to configure inappropriately). TODO: check the availability of the linker opts in configure rather than trusting to the user. This will fix the fail of pie-7.c, which is a result of failing to handle the no-pie driver option. gcc/ 2019-10-20 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline 2019-07-03 Iain Sandoe <iain@sandoe.co.uk> * config/darwin.h (DRIVER_SELF_SPECS): Remove the linker cases. (RDYNAMIC): Rename to, DARWIN_RDYNAMIC. (DARWIN_PIE_SPEC, DARWIN_NOPIE_SPEC): Adjust to remove the Xlinker clauses. (LINK_COMMAND_SPEC_A): Add DARWIN_RDYNAMIC, DARWIN_PIE_SPEC and DARWIN_NOPIE_SPEC. Backport from mainline 2019-06-19 Iain Sandoe <iain@sandoe.co.uk> * config/darwin.h (DRIVER_SELF_SPECS): Add RDYNAMIC, DARWIN_PIE_SPEC and DARWIN_NOPIE_SPEC. (RDYNAMIC): New, modified from DARWIN_EXPORT_DYNAMIC. (DARWIN_PIE_SPEC): Collate from darwin.h and darwin9.h. (DARWIN_NOPIE_SPEC): Collate from darwin10.h. (DARWIN_NOCOMPACT_UNWIND): New from darwin10.h (DARWIN_EXPORT_DYNAMIC): Delete. * config/darwin10.h (LINK_GCC_C_SEQUENCE_SPEC): Move no_compact_unwind and pie options processing to darwin.h. * config/darwin9.h (DARWIN_PIE_SPEC): Move pie processing to darwin.h git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@277212 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 26 ++++++++++++++++++++++++++ gcc/config/darwin.h | 45 ++++++++++++++++++++++++++++++++++----------- gcc/config/darwin10.h | 12 ++++-------- gcc/config/darwin9.h | 6 ------ 4 files changed, 64 insertions(+), 25 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index fed72e5e2e2..f8b2fd06b6a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,29 @@ +2019-10-16 Iain Sandoe <iain@sandoe.co.uk> + + Backport from mainline + 2019-07-03 Iain Sandoe <iain@sandoe.co.uk> + + * config/darwin.h (DRIVER_SELF_SPECS): Remove the linker cases. + (RDYNAMIC): Rename to, DARWIN_RDYNAMIC. + (DARWIN_PIE_SPEC, DARWIN_NOPIE_SPEC): Adjust to remove the Xlinker + clauses. + (LINK_COMMAND_SPEC_A): Add DARWIN_RDYNAMIC, DARWIN_PIE_SPEC and + DARWIN_NOPIE_SPEC. + + Backport from mainline + 2019-06-19 Iain Sandoe <iain@sandoe.co.uk> + + * config/darwin.h (DRIVER_SELF_SPECS): Add RDYNAMIC, DARWIN_PIE_SPEC + and DARWIN_NOPIE_SPEC. + (RDYNAMIC): New, modified from DARWIN_EXPORT_DYNAMIC. + (DARWIN_PIE_SPEC): Collate from darwin.h and darwin9.h. + (DARWIN_NOPIE_SPEC): Collate from darwin10.h. + (DARWIN_NOCOMPACT_UNWIND): New from darwin10.h + (DARWIN_EXPORT_DYNAMIC): Delete. + * config/darwin10.h (LINK_GCC_C_SEQUENCE_SPEC): Move no_compact_unwind + and pie options processing to darwin.h. + * config/darwin9.h (DARWIN_PIE_SPEC): Move pie processing to darwin.h + 2019-10-18 Georg-Johann Lay <avr@gjlay.de> Backport from 2019-10-18 trunk r277143. diff --git a/gcc/config/darwin.h b/gcc/config/darwin.h index a04f35d8231..b1f13b6e3a8 100644 --- a/gcc/config/darwin.h +++ b/gcc/config/darwin.h @@ -129,6 +129,24 @@ extern GTY(()) int darwin_ms_struct; "%{gsplit-dwarf:%ngsplit-dwarf is not supported on this platform } \ %<gsplit-dwarf" +#if LD64_HAS_EXPORT_DYNAMIC +#define DARWIN_RDYNAMIC "%{rdynamic:-export_dynamic}" +#else +#define DARWIN_RDYNAMIC "%{rdynamic:%nrdynamic is not supported}" +#endif + +/* FIXME: we should check that the linker supports the -pie and -no_pie. + options. */ +#define DARWIN_PIE_SPEC \ +"%{pie|fpie|fPIE:\ + %{mdynamic-no-pic: \ + %n'-mdynamic-no-pic' overrides '-pie', '-fpie' or '-fPIE'; \ + :%:version-compare(>= 10.5 mmacosx-version-min= -pie) }} " + +#define DARWIN_NOPIE_SPEC \ +"%{no-pie|fno-pie|fno-PIE: \ + %:version-compare(>= 10.7 mmacosx-version-min= -no_pie) }" + #define DARWIN_CC1_SPEC \ "%{findirect-virtual-calls: -fapple-kext} %<findirect-virtual-calls " \ "%{fterminated-vtables: -fapple-kext} %<fterminated-vtables " \ @@ -159,6 +177,16 @@ extern GTY(()) int darwin_ms_struct; #define CPP_SPEC "%{static:%{!dynamic:-D__STATIC__}}%{!static:-D__DYNAMIC__}" \ " %{pthread:-D_REENTRANT}" +/* This is a fix for PR41260 by passing -no_compact_unwind on darwin10 and + later until the assembler, linker and libunwind are able to deal with the + output from GCC. + + FIXME: we should check that the linker supports the option. +*/ + +#define DARWIN_NOCOMPACT_UNWIND \ +" %:version-compare(>= 10.6 mmacosx-version-min= -no_compact_unwind) " + /* This is mostly a clone of the standard LINK_COMMAND_SPEC, plus precomp, libtool, and fat build additions. @@ -167,12 +195,6 @@ extern GTY(()) int darwin_ms_struct; specifying the handling of options understood by generic Unix linkers, and for positional arguments like libraries. */ -#if LD64_HAS_EXPORT_DYNAMIC -#define DARWIN_EXPORT_DYNAMIC " %{rdynamic:-export_dynamic}" -#else -#define DARWIN_EXPORT_DYNAMIC " %{rdynamic: %nrdynamic is not supported}" -#endif - #define LINK_COMMAND_SPEC_A \ "%{!fdump=*:%{!fsyntax-only:%{!c:%{!M:%{!MM:%{!E:%{!S:\ %(linker)" \ @@ -193,10 +215,14 @@ extern GTY(()) int darwin_ms_struct; %{%:sanitize(address): -lasan } \ %{%:sanitize(undefined): -lubsan } \ %(link_ssp) \ - " DARWIN_EXPORT_DYNAMIC " %<rdynamic \ %(link_gcc_c_sequence) \ }}\ - %{!nostdlib:%{!nostartfiles:%E}} %{T*} %{F*} }}}}}}}" + %{!nostdlib:%{!r:%{!nostartfiles:%E}}} %{T*} %{F*} "\ + DARWIN_PIE_SPEC \ + DARWIN_NOPIE_SPEC \ + DARWIN_RDYNAMIC \ + DARWIN_NOCOMPACT_UNWIND \ + "}}}}}}} %<pie %<no-pie %<rdynamic " #define DSYMUTIL "\ndsymutil" @@ -233,8 +259,6 @@ extern GTY(()) int darwin_ms_struct; #define STANDARD_STARTFILE_PREFIX_1 "" #define STANDARD_STARTFILE_PREFIX_2 "" -#define DARWIN_PIE_SPEC "%{fpie|pie|fPIE:}" - /* Please keep the random linker options in alphabetical order (modulo 'Z' and 'no' prefixes). Note that options taking arguments may appear multiple times on a command line with different arguments each time, @@ -298,7 +322,6 @@ extern GTY(()) int darwin_ms_struct; %:version-compare(< 10.5 mmacosx-version-min= -multiply_defined) \ %:version-compare(< 10.5 mmacosx-version-min= suppress)}} \ %{Zmultiplydefinedunused*:-multiply_defined_unused %*} \ - " DARWIN_PIE_SPEC " \ %{prebind} %{noprebind} %{nofixprebinding} %{prebind_all_twolevel_modules} \ %{read_only_relocs} \ %{sectcreate*} %{sectorder*} %{seg1addr*} %{segprot*} \ diff --git a/gcc/config/darwin10.h b/gcc/config/darwin10.h index 7da32917742..a0657ca08b0 100644 --- a/gcc/config/darwin10.h +++ b/gcc/config/darwin10.h @@ -18,17 +18,13 @@ You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see <http://www.gnu.org/licenses/>. */ -/* Fix PR41260 by passing -no_compact_unwind on darwin10 and later until - unwinder in libSystem is fixed to digest new epilog unwinding notes. +/* Fix PR47558 by linking against libSystem ahead of libgcc_ext. */ - Fix PR47558 by linking against libSystem ahead of libgcc_ext. */ #undef LINK_GCC_C_SEQUENCE_SPEC #define LINK_GCC_C_SEQUENCE_SPEC \ -"%:version-compare(>= 10.6 mmacosx-version-min= -no_compact_unwind) \ - %{!static:%{!static-libgcc: \ - %:version-compare(>= 10.6 mmacosx-version-min= -lSystem) } } \ - %{fno-pic|fno-PIC|fno-pie|fno-PIE|fapple-kext|mkernel|static|mdynamic-no-pic: \ - %:version-compare(>= 10.7 mmacosx-version-min= -no_pie) } %G %L" +"%{!static:%{!static-libgcc: \ + %:version-compare(>= 10.6 mmacosx-version-min= -lSystem) } } \ + %G %L" #undef DEF_MIN_OSX_VERSION #define DEF_MIN_OSX_VERSION "10.6" diff --git a/gcc/config/darwin9.h b/gcc/config/darwin9.h index 72f593951e1..71adea978ce 100644 --- a/gcc/config/darwin9.h +++ b/gcc/config/darwin9.h @@ -35,12 +35,6 @@ along with GCC; see the file COPYING3. If not see /* Tell collect2 to run dsymutil for us as necessary. */ #define COLLECT_RUN_DSYMUTIL 1 -#undef DARWIN_PIE_SPEC -#define DARWIN_PIE_SPEC \ - "%{fpie|pie|fPIE: \ - %{mdynamic-no-pic: %n'-mdynamic-no-pic' overrides '-pie', '-fpie' or '-fPIE'; \ - :-pie}}" - /* Only ask as for debug data if the debug style is stabs (since as doesn't yet generate dwarf.) */ -- cgit v1.2.3 From 0fb4490c00fb1e804727d38f81243a8ccd60e602 Mon Sep 17 00:00:00 2001 From: Iain Sandoe <iain@sandoe.co.uk> Date: Sun, 20 Oct 2019 16:43:57 +0000 Subject: [Darwin] Pick up SDKROOT as the sysroot fallback. For compatibility with xcrun and the behaviour of the clang driver, make use of the setting of the SDKROOT environment variable when it is available. This applies to both finding headers and libraries (i.e. it is also passed to ld64). Priority: 1. User's command-line specified --sysroot= or -isysroot. 2. The SDKROOT variable when set, and validated. 3. Any sysroot provided by --with-sysroot= configuration parameter. SDKROOT is checked thus: 1. Presence. 2. That it starts with / (i.e. 'absolute'). 3. That it is not / only (since that's the default). 4. That it is readable by the process executing the driver. This is pretty much the same rule set as used by the clang driver. NOTE: (3) might turn out to be overly restrictive in the case that we have configured with --with-sysroot= and then we want to run on a system with an installation of the headers/libraries in /. We can revisit this if that turns out to be an important use-case. So one can do: xcrun --sdk macosx /path/to/gcc .... and that provides the SDK path as the sysroot to GCC as expected. CAVEAT: An unfortunate effect of the fact that gcc (and g++) are executables in the Xcode installation, which are found ahead of any such named in the $PATH PATH=/path/to/gcc/install:$PATH xcrun --sdk macosx gcc .... does *not* work, instead that executes the clang from the xcode/commmand line tools installation. PATH=/path/to/gcc/install:$PATH xcrun --sdk macosx x64_64-apple-darwinXX-gcc ... does work as expected, however. gcc/ 2019-10-20 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline 2019-10-03 Iain Sandoe <iain@sandoe.co.uk> PR target/87243 * config/darwin-driver.c (maybe_get_sysroot_from_sdkroot): New. (darwin_driver_init): Use the sysroot provided by SDKROOT when that is available and the user has not set one on the command line. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@277213 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 12 +++++++++++- gcc/config/darwin-driver.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f8b2fd06b6a..76691cfbfdf 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,4 +1,14 @@ -2019-10-16 Iain Sandoe <iain@sandoe.co.uk> +2019-10-20 Iain Sandoe <iain@sandoe.co.uk> + + Backport from mainline + 2019-10-03 Iain Sandoe <iain@sandoe.co.uk> + + PR target/87243 + * config/darwin-driver.c (maybe_get_sysroot_from_sdkroot): New. + (darwin_driver_init): Use the sysroot provided by SDKROOT when that + is available and the user has not set one on the command line. + +2019-10-20 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline 2019-07-03 Iain Sandoe <iain@sandoe.co.uk> diff --git a/gcc/config/darwin-driver.c b/gcc/config/darwin-driver.c index cf3bd8297db..2d72ab9a4d2 100644 --- a/gcc/config/darwin-driver.c +++ b/gcc/config/darwin-driver.c @@ -210,6 +210,28 @@ darwin_default_min_version (void) return new_flag; } +/* See if we can find the sysroot from the SDKROOT environment variable. */ + +static const char * +maybe_get_sysroot_from_sdkroot () +{ + const char *maybe_sysroot = getenv ("SDKROOT"); + + /* We'll use the same rules as the clang driver, for compatibility. + 1) The path must be absolute + 2) Ignore "/", that is the default anyway and we do not want the + sysroot semantics to be applied to it. + 3) It must exist (actually, we'll check it's readable too). */ + + if (maybe_sysroot == NULL + || *maybe_sysroot != '/' + || strlen (maybe_sysroot) == 1 + || access (maybe_sysroot, R_OK) == -1) + return NULL; + + return xstrndup (maybe_sysroot, strlen (maybe_sysroot)); +} + /* Translate -filelist and -framework options in *DECODED_OPTIONS (size *DECODED_OPTIONS_COUNT) to use -Xlinker so that they are considered to be linker inputs in the case that no other inputs are @@ -234,6 +256,7 @@ darwin_driver_init (unsigned int *decoded_options_count, bool appendM64 = false; const char *vers_string = NULL; bool seen_version_min = false; + bool seen_sysroot_p = false; for (i = 1; i < *decoded_options_count; i++) { @@ -314,6 +337,11 @@ darwin_driver_init (unsigned int *decoded_options_count, --*decoded_options_count; break; + case OPT__sysroot_: + case OPT_isysroot: + seen_sysroot_p = true; + break; + default: break; } @@ -375,6 +403,22 @@ darwin_driver_init (unsigned int *decoded_options_count, &(*decoded_options)[*decoded_options_count - 1]); } + if (! seen_sysroot_p) + { + /* We will pick up an SDKROOT if we didn't specify a sysroot and treat + it as overriding any configure-time --with-sysroot. */ + const char *sdkroot = maybe_get_sysroot_from_sdkroot (); + if (sdkroot) + { + ++*decoded_options_count; + *decoded_options = XRESIZEVEC (struct cl_decoded_option, + *decoded_options, + *decoded_options_count); + generate_option (OPT__sysroot_, sdkroot, 1, CL_DRIVER, + &(*decoded_options)[*decoded_options_count - 1]); + } + } + /* We will need to know the OS X version we're trying to build for here so that we can figure out the mechanism and source for the sysroot to be used. */ -- cgit v1.2.3 From 244175cfbc3906de5eb0dc087fc93a6923cf66e3 Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Mon, 21 Oct 2019 00:16:09 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@277219 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index cf3b588aba3..f20c6fc8424 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20191020 +20191021 -- cgit v1.2.3 From 667d4d0f1b03cd425b392e41d8c6051626b8fe2f Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Tue, 22 Oct 2019 00:16:08 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@277274 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index f20c6fc8424..31567130ae5 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20191021 +20191022 -- cgit v1.2.3 From 67ebc9f823802667c058e51cc68c55e0911253fe Mon Sep 17 00:00:00 2001 From: Marek Polacek <polacek@redhat.com> Date: Tue, 22 Oct 2019 17:46:12 +0000 Subject: PR c++/92106 - ICE with structured bindings and -Wreturn-local-addr. * typeck.c (maybe_warn_about_returning_address_of_local): Avoid recursing on null initializer and return false instead. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@277296 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cp/ChangeLog | 9 +++++++ gcc/cp/typeck.c | 6 +++-- gcc/testsuite/g++.dg/cpp1z/decomp50.C | 51 +++++++++++++++++++++++++++++++++++ 3 files changed, 64 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/g++.dg/cpp1z/decomp50.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 7accdfab2d3..5a1c4c5765b 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,12 @@ +2019-10-22 Marek Polacek <polacek@redhat.com> + + Backported from mainline + 2019-10-21 Marek Polacek <polacek@redhat.com> + + PR c++/92106 - ICE with structured bindings and -Wreturn-local-addr. + * typeck.c (maybe_warn_about_returning_address_of_local): Avoid + recursing on null initializer and return false instead. + 2019-09-03 Iain Sandoe <iain@sandoe.co.uk> Backported from mainline diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index 62f9ba09bf4..5c064086e90 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -9109,8 +9109,10 @@ maybe_warn_about_returning_address_of_local (tree retval) tree base = DECL_DECOMP_BASE (whats_returned); if (TREE_CODE (TREE_TYPE (base)) == REFERENCE_TYPE) { - tree init = DECL_INITIAL (base); - return maybe_warn_about_returning_address_of_local (init); + if (tree init = DECL_INITIAL (base)) + return maybe_warn_about_returning_address_of_local (init); + else + return false; } } if (TREE_CODE (valtype) == REFERENCE_TYPE) diff --git a/gcc/testsuite/g++.dg/cpp1z/decomp50.C b/gcc/testsuite/g++.dg/cpp1z/decomp50.C new file mode 100644 index 00000000000..5400a826948 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1z/decomp50.C @@ -0,0 +1,51 @@ +// PR c++/92106 - ICE with structured bindings and -Wreturn-local-addr. +// { dg-do compile { target c++17 } } + +template <typename> struct B; +template <typename _Tp> struct B<_Tp *> { typedef _Tp& reference; }; +struct C { + template <typename _Up> using rebind = _Up *; +}; +template <typename _Iterator, typename> class D { +public: + typename B<_Iterator>::reference operator*(); + void operator++(); +}; + +template <typename _Iterator, typename _Container> +bool operator!=(D<_Iterator, _Container>, D<_Iterator, _Container>); +template <typename _Tp> class F { +public: + typedef _Tp value_type; +}; + +template <typename _Alloc> struct G { + template <typename _Tp> struct H { using type = C::rebind<_Tp>; }; + using const_pointer = typename H<typename _Alloc::value_type>::type; +}; +template <typename _Tp, typename _Alloc = F<_Tp>> class I { + typedef D<typename G<_Alloc>::const_pointer, int> const_iterator; + +public: + const_iterator begin(); + const_iterator end(); +}; + +struct A { + struct J { + int name; + int value; + }; + I<J> members; + template <typename Key> const int *find(Key) { + for (const auto &[name, value] : members) + // See <https://gcc.gnu.org/ml/gcc-patches/2019-10/msg01107.html> + // for why we don't warn here. + return &value; // { dg-bogus "address of local variable" } + return nullptr; + } +}; +int main() { + A a; + a.find(""); +} -- cgit v1.2.3 From feb017b942d2a9df80c8a27dfe21887d8348f5a5 Mon Sep 17 00:00:00 2001 From: GCC Administrator <gccadmin@gcc.gnu.org> Date: Wed, 23 Oct 2019 00:16:16 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@277304 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 31567130ae5..c77090f7f81 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20191022 +20191023 -- cgit v1.2.3 From 791ea6ab671e7b79b1963576028f0d5d9e30cf4c Mon Sep 17 00:00:00 2001 From: Eric Botcazou <ebotcazou@adacore.com> Date: Wed, 23 Oct 2019 11:38:41 +0000 Subject: PR tree-optimization/92131 * tree-vrp.c (extract_range_from_plus_minus_expr): If the resulting range would be symbolic, drop to varying for any explicit overflow in the constant part or if neither range is a singleton. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@277316 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 7 +++ gcc/testsuite/ChangeLog | 4 ++ gcc/testsuite/gcc.c-torture/execute/20191023-1.c | 73 ++++++++++++++++++++++++ gcc/tree-vrp.c | 11 ++-- 4 files changed, 91 insertions(+), 4 deletions(-) create mode 100644 gcc/testsuite/gcc.c-torture/execute/20191023-1.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 76691cfbfdf..075f1cefdf1 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2019-10-23 Eric Botcazou <ebotcazou@adacore.com> + + PR tree-optimization/92131 + * tree-vrp.c (extract_range_from_plus_minus_expr): If the resulting + range would be symbolic, drop to varying for any explicit overflow + in the constant part or if neither range is a singleton. + 2019-10-20 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 7de8346b956..efe24bca899 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2019-10-23 Eric Botcazou <ebotcazou@adacore.com> + + * gcc.c-torture/execute/20191023-1.c: New test. + 2019-10-18 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/69455 diff --git a/gcc/testsuite/gcc.c-torture/execute/20191023-1.c b/gcc/testsuite/gcc.c-torture/execute/20191023-1.c new file mode 100644 index 00000000000..3811ebca151 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20191023-1.c @@ -0,0 +1,73 @@ +/* PR tree-optimization/92131 */ +/* Testcase by Armin Rigo <arigo@tunes.org> */ + +long b, c, d, e, f, i; +char g, h, j, k; +int *aa; + +static void error (void) __attribute__((noipa)); +static void error (void) { __builtin_abort(); } + +static void see_me_here (void) __attribute__((noipa)); +static void see_me_here (void) {} + +static void aaa (void) __attribute__((noipa)); +static void aaa (void) {} + +static void a (void) __attribute__((noipa)); +static void a (void) { + long am, ao; + if (aa == 0) { + aaa(); + if (j) + goto ay; + } + return; +ay: + aaa(); + if (k) { + aaa(); + goto az; + } + return; +az: + if (i) + if (g) + if (h) + if (e) + goto bd; + return; +bd: + am = 0; + while (am < e) { + switch (c) { + case 8: + goto bh; + case 4: + return; + } + bh: + if (am >= 0) + b = -am; + ao = am + b; + f = ao & 7; + if (f == 0) + see_me_here(); + if (ao >= 0) + am++; + else + error(); + } +} + +int main (void) +{ + j++; + k++; + i++; + g++; + h++; + e = 1; + a(); + return 0; +} diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c index 8f897cfdd4a..73b4aa8bbd6 100644 --- a/gcc/tree-vrp.c +++ b/gcc/tree-vrp.c @@ -1618,10 +1618,13 @@ extract_range_from_binary_expr_1 (value_range *vr, max_ovf = 1; } - /* If we have overflow for the constant part and the resulting - range will be symbolic, drop to VR_VARYING. */ - if ((min_ovf && sym_min_op0 != sym_min_op1) - || (max_ovf && sym_max_op0 != sym_max_op1)) + /* If the resulting range will be symbolic, we need to eliminate any + explicit or implicit overflow introduced in the above computation + because compare_values could make an incorrect use of it. That's + why we require one of the ranges to be a singleton. */ + if ((sym_min_op0 != sym_min_op1 || sym_max_op0 != sym_max_op1) + && (min_ovf || max_ovf + || (min_op0 != max_op0 && min_op1 != max_op1))) { set_value_range_to_varying (vr); return; -- cgit v1.2.3 From 8f65dbab76417427f74f17bd7e21b72f3a5da775 Mon Sep 17 00:00:00 2001 From: Richard Biener <rguenther@suse.de> Date: Wed, 23 Oct 2019 12:31:24 +0000 Subject: 2019-10-23 Richard Biener <rguenther@suse.de> Backport from mainline 2019-10-17 Richard Biener <rguenther@suse.de> PR debug/91887 * dwarf2out.c (gen_formal_parameter_die): Also try to match context_die against a DW_TAG_GNU_formal_parameter_pack parent. * g++.dg/debug/dwarf2/pr91887.C: New testcase. 2019-09-19 Richard Biener <rguenther@suse.de> PR tree-optimization/91812 * tree-ssa-phiprop.c (propagate_with_phi): Do not replace volatile loads. * gcc.dg/torture/pr91812.c: New testcase. 2019-09-17 Richard Biener <rguenther@suse.de> PR debug/91772 * dwarf2out.c (dwarf2out_late_global_decl): If early dwarf was missing generate locations only once. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@277319 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 21 ++++++++++++++++++ gcc/dwarf2out.c | 33 ++++++++++++----------------- gcc/testsuite/ChangeLog | 13 ++++++++++++ gcc/testsuite/g++.dg/debug/dwarf2/pr91887.C | 12 +++++++++++ gcc/testsuite/gcc.dg/torture/pr91812.c | 26 +++++++++++++++++++++++ gcc/tree-ssa-phiprop.c | 11 ++++++++-- 6 files changed, 95 insertions(+), 21 deletions(-) create mode 100644 gcc/testsuite/g++.dg/debug/dwarf2/pr91887.C create mode 100644 gcc/testsuite/gcc.dg/torture/pr91812.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 075f1cefdf1..b7be4a93b1a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,24 @@ +2019-10-23 Richard Biener <rguenther@suse.de> + + Backport from mainline + 2019-10-17 Richard Biener <rguenther@suse.de> + + PR debug/91887 + * dwarf2out.c (gen_formal_parameter_die): Also try to match + context_die against a DW_TAG_GNU_formal_parameter_pack parent. + + 2019-09-19 Richard Biener <rguenther@suse.de> + + PR tree-optimization/91812 + * tree-ssa-phiprop.c (propagate_with_phi): Do not replace + volatile loads. + + 2019-09-17 Richard Biener <rguenther@suse.de> + + PR debug/91772 + * dwarf2out.c (dwarf2out_late_global_decl): If early dwarf + was missing generate locations only once. + 2019-10-23 Eric Botcazou <ebotcazou@adacore.com> PR tree-optimization/92131 diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 533652ac733..0d67d303eb7 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -22221,19 +22221,18 @@ gen_formal_parameter_die (tree node, tree origin, bool emit_name_p, /* If the contexts differ, we may not be talking about the same thing. ??? When in LTO the DIE parent is the "abstract" copy and the - context_die is the specification "copy". But this whole block - should eventually be no longer needed. */ - if (parm_die && parm_die->die_parent != context_die && !in_lto_p) + context_die is the specification "copy". */ + if (parm_die + && parm_die->die_parent != context_die + && (parm_die->die_parent->die_tag != DW_TAG_GNU_formal_parameter_pack + || parm_die->die_parent->die_parent != context_die) + && !in_lto_p) { - if (!DECL_ABSTRACT_P (node)) - { - /* This can happen when creating an inlined instance, in - which case we need to create a new DIE that will get - annotated with DW_AT_abstract_origin. */ - parm_die = NULL; - } - else - gcc_unreachable (); + gcc_assert (!DECL_ABSTRACT_P (node)); + /* This can happen when creating a concrete instance, in + which case we need to create a new DIE that will get + annotated with DW_AT_abstract_origin. */ + parm_die = NULL; } if (parm_die && parm_die->die_parent == NULL) @@ -26592,16 +26591,12 @@ dwarf2out_late_global_decl (tree decl) { dw_die_ref die = lookup_decl_die (decl); - /* We may have to generate early debug late for LTO in case debug + /* We may have to generate full debug late for LTO in case debug was not enabled at compile-time or the target doesn't support the LTO early debug scheme. */ if (! die && in_lto_p) - { - dwarf2out_decl (decl); - die = lookup_decl_die (decl); - } - - if (die) + dwarf2out_decl (decl); + else if (die) { /* We get called via the symtab code invoking late_global_decl for symbols that are optimized out. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index efe24bca899..233bef2100b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,16 @@ +2019-10-23 Richard Biener <rguenther@suse.de> + + Backport from mainline + 2019-10-17 Richard Biener <rguenther@suse.de> + + PR debug/91887 + * g++.dg/debug/dwarf2/pr91887.C: New testcase. + + 2019-09-19 Richard Biener <rguenther@suse.de> + + PR tree-optimization/91812 + * gcc.dg/torture/pr91812.c: New testcase. + 2019-10-23 Eric Botcazou <ebotcazou@adacore.com> * gcc.c-torture/execute/20191023-1.c: New test. diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/pr91887.C b/gcc/testsuite/g++.dg/debug/dwarf2/pr91887.C new file mode 100644 index 00000000000..6cd99cc9bb8 --- /dev/null +++ b/gcc/testsuite/g++.dg/debug/dwarf2/pr91887.C @@ -0,0 +1,12 @@ +// { dg-do compile } +// { dg-require-effective-target c++11 } +// { dg-options "-g -fdebug-types-section" } +class A { +public: + A(); + template <typename U> A(U); +}; +template <class> struct B { typedef A type; }; +template <class R, typename... Args> +int Bind(R(Args...), typename B<Args>::type...) { return 0; } +void KeepBufferRefs(A, A) { A a, b(Bind(KeepBufferRefs, a, b)); } diff --git a/gcc/testsuite/gcc.dg/torture/pr91812.c b/gcc/testsuite/gcc.dg/torture/pr91812.c new file mode 100644 index 00000000000..ebc67a01e33 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr91812.c @@ -0,0 +1,26 @@ +/* { dg-do compile } */ +/* { dg-skip-if "" { *-*-* } { "-fno-fat-lto-objects" } { "" } } */ +/* { dg-options "-fdump-tree-optimized-blocks" } */ + +unsigned register1; +unsigned register2; + +void busy_wait_for_register (int x) +{ + volatile unsigned* ptr; + switch(x) { + case 0x1111: + ptr = ®ister1; + break; + + case 0x2222: + ptr = ®ister2; + break; + + default: + return; + } + while (*ptr) {} +} + +/* { dg-final { scan-tree-dump "loop depth 1" "optimized" } } */ diff --git a/gcc/tree-ssa-phiprop.c b/gcc/tree-ssa-phiprop.c index 14dfe2ab3bd..71d1d079c26 100644 --- a/gcc/tree-ssa-phiprop.c +++ b/gcc/tree-ssa-phiprop.c @@ -338,8 +338,15 @@ propagate_with_phi (basic_block bb, gphi *phi, struct phiprop_d *phivn, && (!type || types_compatible_p (TREE_TYPE (gimple_assign_lhs (use_stmt)), type)) - /* We cannot replace a load that may throw or is volatile. */ - && !stmt_can_throw_internal (use_stmt))) + /* We cannot replace a load that may throw or is volatile. + For volatiles the transform can change the number of + executions if the load is inside a loop but the address + computations outside (PR91812). We could relax this + if we guard against that appropriately. For loads that can + throw we could relax things if the moved loads all are + known to not throw. */ + && !stmt_can_throw_internal (use_stmt) + && !gimple_has_volatile_ops (use_stmt))) continue; /* Check if we can move the loads. The def stmt of the virtual use -- cgit v1.2.3 From d844b1d496ef9602a263834327aa73f72663cb6b Mon Sep 17 00:00:00 2001 From: Peter Bergner <bergner@linux.ibm.com> Date: Wed, 23 Oct 2019 21:36:06 +0000 Subject: Backport from mainline 2019-10-08 Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com> * config.gcc: Move -L usage from LINK_OS_EXTRA_SPEC32 and LINK_OS_EXTRA_SPEC64 to MD_STARTFILE_PREFIX and MD_STARTFILE_PREFIX_1 when using --with-advance-toolchain. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@277354 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 9 +++++++++ gcc/config.gcc | 11 ++++++----- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b7be4a93b1a..041f1d123cc 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2019-10-23 Peter Bergner <bergner@linux.ibm.com> + + Backport from mainline + 2019-10-08 Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com> + + * config.gcc: Move -L usage from LINK_OS_EXTRA_SPEC32 and + LINK_OS_EXTRA_SPEC64 to MD_STARTFILE_PREFIX and + MD_STARTFILE_PREFIX_1 when using --with-advance-toolchain. + 2019-10-23 Richard Biener <rguenther@suse.de> Backport from mainline diff --git a/gcc/config.gcc b/gcc/config.gcc index 33a21fafe48..47cfce25dee 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -4463,14 +4463,12 @@ case "${target}" in echo "#undef LINK_OS_EXTRA_SPEC32" echo "#define LINK_OS_EXTRA_SPEC32" \ "\"%(link_os_new_dtags)" \ - "-rpath $prefix/lib -rpath $at/lib" \ - "-L $prefix/lib -L $at/lib\"" + "-rpath $prefix/lib -rpath $at/lib\"" echo echo "#undef LINK_OS_EXTRA_SPEC64" echo "#define LINK_OS_EXTRA_SPEC64" \ "\"%(link_os_new_dtags)" \ - "-rpath $prefix/lib64 -rpath $at/lib64" \ - "-L $prefix/lib64 -L $at/lib64\"" + "-rpath $prefix/lib64 -rpath $at/lib64\"" echo echo "#undef LINK_OS_NEW_DTAGS_SPEC" echo "#define LINK_OS_NEW_DTAGS_SPEC" \ @@ -4483,7 +4481,10 @@ case "${target}" in echo "#define MD_EXEC_PREFIX \"$at/bin/\"" echo echo "#undef MD_STARTFILE_PREFIX" - echo "#define MD_STARTFILE_PREFIX \"$at/lib/\"") \ + echo "#define MD_STARTFILE_PREFIX \"$prefix/lib/\"" + echo + echo "#undef MD_STARTFILE_PREFIX_1" + echo "#define MD_STARTFILE_PREFIX_1 \"$at/lib/\"") \ > advance-toolchain.h else echo "Unknown advance-toolchain $with_advance_toolchain" -- cgit v1.2.3