- backport from 11.2.1-9: update from releases/gcc-11-branch (#2047296)
- backport from 11.2.1-9: fix up va-opt-6.c testcase - backport from 11.2.1-8: update from releases/gcc-11-branch (#2047296) - backport from 11.2.1-7.7: do not undefine _hardened_build (#2044917) - backport from 11.2.1-7.6: update annobin plugin patch (#2030667) - backport from 11.2.1-7.5: update annobin plugin patch (#2030667) - backport from 11.2.1-7.4: update annobin plugin patch (#2030667) - backport from 11.2.1-7.3: fix dg-ice tests (#1996047) - backport from 11.2.1-7.2: update annobin plugin patch (#2030667) - backport from 11.2.1-7.1: build annobin plugin (patch by Nick Clifton) (#2030667) - backport from 11.2.1-7: update from releases/gcc-11-branch (#1996858) - backport from 11.2.1-7: fix up #__VA_OPT__ handling (PR preprocessor/103415)epel9
parent
498af3f199
commit
e85810fe02
@ -0,0 +1,83 @@
|
||||
diff --git a/gcc/testsuite/c-c++-common/goacc/kernels-decompose-ice-1.c b/gcc/testsuite/c-c++-common/goacc/kernels-decompose-ice-1.c
|
||||
index 8c3884bdc00..141f089d4f8 100644
|
||||
--- a/gcc/testsuite/c-c++-common/goacc/kernels-decompose-ice-1.c
|
||||
+++ b/gcc/testsuite/c-c++-common/goacc/kernels-decompose-ice-1.c
|
||||
@@ -1,7 +1,7 @@
|
||||
/* Test OpenACC 'kernels' construct decomposition. */
|
||||
|
||||
/* { dg-additional-options "-fopt-info-omp-all" } */
|
||||
-/* { dg-additional-options "-fchecking --param=openacc-kernels=decompose" } */
|
||||
+/* { dg-additional-options "-fno-report-bug -fchecking --param=openacc-kernels=decompose" } */
|
||||
/* { dg-ice "TODO" }
|
||||
{ dg-prune-output "during GIMPLE pass: omplower" } */
|
||||
|
||||
diff --git a/gcc/testsuite/c-c++-common/goacc/kernels-decompose-ice-2.c b/gcc/testsuite/c-c++-common/goacc/kernels-decompose-ice-2.c
|
||||
index 8bf60a9a509..a07e0a42116 100644
|
||||
--- a/gcc/testsuite/c-c++-common/goacc/kernels-decompose-ice-2.c
|
||||
+++ b/gcc/testsuite/c-c++-common/goacc/kernels-decompose-ice-2.c
|
||||
@@ -1,6 +1,6 @@
|
||||
/* Test OpenACC 'kernels' construct decomposition. */
|
||||
|
||||
-/* { dg-additional-options "-fchecking --param=openacc-kernels=decompose" } */
|
||||
+/* { dg-additional-options "-fno-report-bug -fchecking --param=openacc-kernels=decompose" } */
|
||||
/* { dg-ice "TODO" }
|
||||
{ dg-prune-output "during GIMPLE pass: omplower" } */
|
||||
|
||||
diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-52830.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-52830.C
|
||||
index eae0d8c377b..ed37f95e865 100644
|
||||
--- a/gcc/testsuite/g++.dg/cpp0x/constexpr-52830.C
|
||||
+++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-52830.C
|
||||
@@ -1,6 +1,6 @@
|
||||
// PR c++/52830
|
||||
// { dg-do compile { target c++11 } }
|
||||
-// { dg-additional-options "-fchecking" }
|
||||
+// { dg-additional-options "-fchecking -fno-report-bug" }
|
||||
// { dg-ice "comptypes" }
|
||||
|
||||
template<bool b> struct eif { typedef void type; };
|
||||
diff --git a/gcc/testsuite/g++.dg/cpp0x/vt-88982.C b/gcc/testsuite/g++.dg/cpp0x/vt-88982.C
|
||||
index 7a868233d73..45307a63483 100644
|
||||
--- a/gcc/testsuite/g++.dg/cpp0x/vt-88982.C
|
||||
+++ b/gcc/testsuite/g++.dg/cpp0x/vt-88982.C
|
||||
@@ -1,6 +1,6 @@
|
||||
// PR c++/88982
|
||||
// { dg-do compile { target c++11 } }
|
||||
-// { dg-additional-options "-fchecking" }
|
||||
+// { dg-additional-options "-fchecking -fno-report-bug" }
|
||||
// { dg-ice "tsubst_pack_expansion" }
|
||||
|
||||
template<typename...Ts> struct A {
|
||||
diff --git a/gcc/testsuite/g++.dg/cpp1y/auto-fn61.C b/gcc/testsuite/g++.dg/cpp1y/auto-fn61.C
|
||||
index bed5ea0cfc0..cb235bf891a 100644
|
||||
--- a/gcc/testsuite/g++.dg/cpp1y/auto-fn61.C
|
||||
+++ b/gcc/testsuite/g++.dg/cpp1y/auto-fn61.C
|
||||
@@ -1,6 +1,6 @@
|
||||
// PR c++/88003
|
||||
// { dg-do compile { target c++14 } }
|
||||
-// { dg-additional-options "-fchecking" }
|
||||
+// { dg-additional-options "-fchecking -fno-report-bug" }
|
||||
// { dg-ice "poplevel_class" }
|
||||
|
||||
auto test() {
|
||||
diff --git a/gcc/testsuite/g++.dg/cpp1z/constexpr-lambda26.C b/gcc/testsuite/g++.dg/cpp1z/constexpr-lambda26.C
|
||||
index 0cdb400d21c..8f17cca31dd 100644
|
||||
--- a/gcc/testsuite/g++.dg/cpp1z/constexpr-lambda26.C
|
||||
+++ b/gcc/testsuite/g++.dg/cpp1z/constexpr-lambda26.C
|
||||
@@ -1,6 +1,6 @@
|
||||
// PR c++/87765
|
||||
// { dg-do compile { target c++17 } }
|
||||
-// { dg-additional-options "-fchecking" }
|
||||
+// { dg-additional-options "-fchecking -fno-report-bug" }
|
||||
// { dg-ice "cxx_eval_constant_expression" }
|
||||
|
||||
template <int N>
|
||||
diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/declare-vla-kernels-decompose-ice-1.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/declare-vla-kernels-decompose-ice-1.c
|
||||
index 0777b612b63..53abbe2db83 100644
|
||||
--- a/libgomp/testsuite/libgomp.oacc-c-c++-common/declare-vla-kernels-decompose-ice-1.c
|
||||
+++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/declare-vla-kernels-decompose-ice-1.c
|
||||
@@ -1,4 +1,4 @@
|
||||
-/* { dg-additional-options "--param=openacc-kernels=decompose" } */
|
||||
+/* { dg-additional-options "--param=openacc-kernels=decompose -fno-report-bug" } */
|
||||
/* Hopefully, this is the same issue as '../../../gcc/testsuite/c-c++-common/goacc/kernels-decompose-ice-1.c'.
|
||||
{ dg-ice "TODO" }
|
||||
TODO { dg-prune-output "during GIMPLE pass: omplower" }
|
@ -1,47 +0,0 @@
|
||||
2021-10-11 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR c++/102642
|
||||
* name-lookup.c (push_local_extern_decl_alias): Don't call
|
||||
set_decl_tls_model on error_mark_node.
|
||||
* parser.c (cp_parser_omp_declare_target): Likewise.
|
||||
|
||||
* g++.dg/tls/pr102642.C: New test.
|
||||
|
||||
--- gcc/cp/name-lookup.c.jj 2021-10-01 10:30:07.674588541 +0200
|
||||
+++ gcc/cp/name-lookup.c 2021-10-11 12:43:39.261051228 +0200
|
||||
@@ -3474,7 +3474,9 @@ push_local_extern_decl_alias (tree decl)
|
||||
push_nested_namespace (ns);
|
||||
alias = do_pushdecl (alias, /* hiding= */true);
|
||||
pop_nested_namespace (ns);
|
||||
- if (VAR_P (decl) && CP_DECL_THREAD_LOCAL_P (decl))
|
||||
+ if (VAR_P (decl)
|
||||
+ && CP_DECL_THREAD_LOCAL_P (decl)
|
||||
+ && alias != error_mark_node)
|
||||
set_decl_tls_model (alias, DECL_TLS_MODEL (decl));
|
||||
}
|
||||
}
|
||||
--- gcc/cp/parser.c.jj 2021-10-09 10:14:24.043098112 +0200
|
||||
+++ gcc/cp/parser.c 2021-10-11 12:47:21.220874667 +0200
|
||||
@@ -45665,7 +45666,8 @@ cp_parser_omp_declare_target (cp_parser
|
||||
if (VAR_OR_FUNCTION_DECL_P (t)
|
||||
&& DECL_LOCAL_DECL_P (t)
|
||||
&& DECL_LANG_SPECIFIC (t)
|
||||
- && DECL_LOCAL_DECL_ALIAS (t))
|
||||
+ && DECL_LOCAL_DECL_ALIAS (t)
|
||||
+ && DECL_LOCAL_DECL_ALIAS (t) != error_mark_node)
|
||||
handle_omp_declare_target_clause (c, DECL_LOCAL_DECL_ALIAS (t),
|
||||
device_type);
|
||||
}
|
||||
--- gcc/testsuite/g++.dg/tls/pr102642.C.jj 2021-10-11 13:00:35.889503002 +0200
|
||||
+++ gcc/testsuite/g++.dg/tls/pr102642.C 2021-10-11 13:00:20.388724721 +0200
|
||||
@@ -0,0 +1,10 @@
|
||||
+// PR c++/102642
|
||||
+// { dg-do compile { target c++11 } }
|
||||
+
|
||||
+thread_local int *z; // { dg-message "previous declaration" }
|
||||
+
|
||||
+void
|
||||
+foo ()
|
||||
+{
|
||||
+ extern thread_local int z; // { dg-error "conflicting declaration" }
|
||||
+}
|
@ -0,0 +1,197 @@
|
||||
libcpp: Fix up #__VA_OPT__ handling [PR103415]
|
||||
|
||||
stringify_arg uses pfile->u_buff to create the string literal.
|
||||
Unfortunately, paste_tokens -> _cpp_lex_direct -> lex_number -> _cpp_unaligned_alloc
|
||||
can in some cases use pfile->u_buff too, which results in losing everything
|
||||
prepared for the string literal until the token pasting.
|
||||
|
||||
The following patch fixes that by not calling paste_token during the
|
||||
construction of the string literal, but doing that before. All the tokens
|
||||
we are processing have been pushed into a token buffer using
|
||||
tokens_buff_add_token so it is fine if we paste some of them in that buffer
|
||||
(successful pasting creates a new token in that buffer), move following
|
||||
tokens if any to make it contiguous, pop (throw away) the extra tokens at
|
||||
the end and then do stringify_arg.
|
||||
|
||||
Also, paste_tokens now copies over PREV_WHITE and PREV_FALLTHROUGH flags
|
||||
from the original lhs token to the replacement token. Copying that way
|
||||
the PREV_WHITE flag is needed for the #__VA_OPT__ handling and copying
|
||||
over PREV_FALLTHROUGH fixes the new Wimplicit-fallthrough-38.c test.
|
||||
|
||||
2021-12-01 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR preprocessor/103415
|
||||
libcpp/
|
||||
* macro.c (stringify_arg): Remove va_opt argument and va_opt handling.
|
||||
(paste_tokens): On successful paste or in PREV_WHITE and
|
||||
PREV_FALLTHROUGH flags from the *plhs token to the new token.
|
||||
(replace_args): Adjust stringify_arg callers. For #__VA_OPT__,
|
||||
perform token pasting in a separate loop before stringify_arg call.
|
||||
gcc/testsuite/
|
||||
* c-c++-common/cpp/va-opt-8.c: New test.
|
||||
* c-c++-common/Wimplicit-fallthrough-38.c: New test.
|
||||
|
||||
--- libcpp/macro.c.jj
|
||||
+++ libcpp/macro.c
|
||||
@@ -295,7 +295,7 @@ static cpp_context *next_context (cpp_re
|
||||
static const cpp_token *padding_token (cpp_reader *, const cpp_token *);
|
||||
static const cpp_token *new_string_token (cpp_reader *, uchar *, unsigned int);
|
||||
static const cpp_token *stringify_arg (cpp_reader *, const cpp_token **,
|
||||
- unsigned int, bool);
|
||||
+ unsigned int);
|
||||
static void paste_all_tokens (cpp_reader *, const cpp_token *);
|
||||
static bool paste_tokens (cpp_reader *, location_t,
|
||||
const cpp_token **, const cpp_token *);
|
||||
@@ -826,8 +826,7 @@ cpp_quote_string (uchar *dest, const uch
|
||||
/* Convert a token sequence FIRST to FIRST+COUNT-1 to a single string token
|
||||
according to the rules of the ISO C #-operator. */
|
||||
static const cpp_token *
|
||||
-stringify_arg (cpp_reader *pfile, const cpp_token **first, unsigned int count,
|
||||
- bool va_opt)
|
||||
+stringify_arg (cpp_reader *pfile, const cpp_token **first, unsigned int count)
|
||||
{
|
||||
unsigned char *dest;
|
||||
unsigned int i, escape_it, backslash_count = 0;
|
||||
@@ -844,24 +843,6 @@ stringify_arg (cpp_reader *pfile, const
|
||||
{
|
||||
const cpp_token *token = first[i];
|
||||
|
||||
- if (va_opt && (token->flags & PASTE_LEFT))
|
||||
- {
|
||||
- location_t virt_loc = pfile->invocation_location;
|
||||
- const cpp_token *rhs;
|
||||
- do
|
||||
- {
|
||||
- if (i == count)
|
||||
- abort ();
|
||||
- rhs = first[++i];
|
||||
- if (!paste_tokens (pfile, virt_loc, &token, rhs))
|
||||
- {
|
||||
- --i;
|
||||
- break;
|
||||
- }
|
||||
- }
|
||||
- while (rhs->flags & PASTE_LEFT);
|
||||
- }
|
||||
-
|
||||
if (token->type == CPP_PADDING)
|
||||
{
|
||||
if (source == NULL
|
||||
@@ -995,6 +976,7 @@ paste_tokens (cpp_reader *pfile, locatio
|
||||
return false;
|
||||
}
|
||||
|
||||
+ lhs->flags |= (*plhs)->flags & (PREV_WHITE | PREV_FALLTHROUGH);
|
||||
*plhs = lhs;
|
||||
_cpp_pop_buffer (pfile);
|
||||
return true;
|
||||
@@ -1937,8 +1919,7 @@ replace_args (cpp_reader *pfile, cpp_has
|
||||
if (src->flags & STRINGIFY_ARG)
|
||||
{
|
||||
if (!arg->stringified)
|
||||
- arg->stringified = stringify_arg (pfile, arg->first, arg->count,
|
||||
- false);
|
||||
+ arg->stringified = stringify_arg (pfile, arg->first, arg->count);
|
||||
}
|
||||
else if ((src->flags & PASTE_LEFT)
|
||||
|| (src != macro->exp.tokens && (src[-1].flags & PASTE_LEFT)))
|
||||
@@ -2065,11 +2046,46 @@ replace_args (cpp_reader *pfile, cpp_has
|
||||
{
|
||||
unsigned int count
|
||||
= start ? paste_flag - start : tokens_buff_count (buff);
|
||||
- const cpp_token *t
|
||||
- = stringify_arg (pfile,
|
||||
- start ? start + 1
|
||||
- : (const cpp_token **) (buff->base),
|
||||
- count, true);
|
||||
+ const cpp_token **first
|
||||
+ = start ? start + 1
|
||||
+ : (const cpp_token **) (buff->base);
|
||||
+ unsigned int i, j;
|
||||
+
|
||||
+ /* Paste any tokens that need to be pasted before calling
|
||||
+ stringify_arg, because stringify_arg uses pfile->u_buff
|
||||
+ which paste_tokens can use as well. */
|
||||
+ for (i = 0, j = 0; i < count; i++, j++)
|
||||
+ {
|
||||
+ const cpp_token *token = first[i];
|
||||
+
|
||||
+ if (token->flags & PASTE_LEFT)
|
||||
+ {
|
||||
+ location_t virt_loc = pfile->invocation_location;
|
||||
+ const cpp_token *rhs;
|
||||
+ do
|
||||
+ {
|
||||
+ if (i == count)
|
||||
+ abort ();
|
||||
+ rhs = first[++i];
|
||||
+ if (!paste_tokens (pfile, virt_loc, &token, rhs))
|
||||
+ {
|
||||
+ --i;
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ while (rhs->flags & PASTE_LEFT);
|
||||
+ }
|
||||
+
|
||||
+ first[j] = token;
|
||||
+ }
|
||||
+ if (j != i)
|
||||
+ {
|
||||
+ while (i-- != j)
|
||||
+ tokens_buff_remove_last_token (buff);
|
||||
+ count = j;
|
||||
+ }
|
||||
+
|
||||
+ const cpp_token *t = stringify_arg (pfile, first, count);
|
||||
while (count--)
|
||||
tokens_buff_remove_last_token (buff);
|
||||
if (src->flags & PASTE_LEFT)
|
||||
--- gcc/testsuite/c-c++-common/cpp/va-opt-8.c.jj
|
||||
+++ gcc/testsuite/c-c++-common/cpp/va-opt-8.c
|
||||
@@ -0,0 +1,18 @@
|
||||
+/* PR preprocessor/103415 */
|
||||
+/* { dg-do run } */
|
||||
+/* { dg-options "-std=gnu99" { target c } } */
|
||||
+/* { dg-options "-std=c++20" { target c++ } } */
|
||||
+
|
||||
+#define n(x, ...) = #__VA_OPT__(x##3)
|
||||
+#define o(x, ...) #__VA_OPT__(x##__VA_ARGS__##9)
|
||||
+const char *c n(1 2, 4);
|
||||
+const char *d = o(5 6, 7 8);
|
||||
+
|
||||
+int
|
||||
+main ()
|
||||
+{
|
||||
+ if (__builtin_strcmp (c, "1 23")
|
||||
+ || __builtin_strcmp (d, "5 67 89"))
|
||||
+ __builtin_abort ();
|
||||
+ return 0;
|
||||
+}
|
||||
--- gcc/testsuite/c-c++-common/Wimplicit-fallthrough-38.c.jj
|
||||
+++ gcc/testsuite/c-c++-common/Wimplicit-fallthrough-38.c
|
||||
@@ -0,0 +1,24 @@
|
||||
+/* { dg-do compile } */
|
||||
+/* { dg-options "-Wimplicit-fallthrough=3" } */
|
||||
+
|
||||
+#define FOO \
|
||||
+int \
|
||||
+foo (int a) \
|
||||
+{ \
|
||||
+ switch (a) \
|
||||
+ { \
|
||||
+ case 1: \
|
||||
+ ++a; \
|
||||
+ /* FALLTHRU */ \
|
||||
+ case 2: \
|
||||
+ ++a; \
|
||||
+ /* FALLTHRU */ \
|
||||
+ ca##se 3: \
|
||||
+ ++a; \
|
||||
+ default: \
|
||||
+ break; \
|
||||
+ } \
|
||||
+ return a; \
|
||||
+}
|
||||
+
|
||||
+FOO
|
Loading…
Reference in new issue