Hi!
I've backported following 12 commits from trunk to 8.4,
bootstrapped/regtested on x86_64-linux and i686-linux and committed
to gcc-8-branch.
Jakub
2019-08-29 Jakub Jelinek <[email protected]>
Backported from mainline
2019-04-19 Jakub Jelinek <[email protected]>
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.
--- gcc/tree-outof-ssa.c (revision 270456)
+++ gcc/tree-outof-ssa.c (revision 270457)
@@ -653,6 +653,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)));
--- gcc/testsuite/gcc.c-torture/compile/pr90139.c (nonexistent)
+++ gcc/testsuite/gcc.c-torture/compile/pr90139.c (revision 270457)
@@ -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);
+ }
+}
2019-08-29 Jakub Jelinek <[email protected]>
Backported from mainline
2019-04-26 Jakub Jelinek <[email protected]>
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.
--- gcc/c/c-parser.c (revision 271347)
+++ gcc/c/c-parser.c (revision 271348)
@@ -6001,7 +6001,8 @@ c_parser_while_statement (c_parser *pars
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);
@@ -6046,6 +6047,7 @@ c_parser_do_statement (c_parser *parser,
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,
@@ -6059,7 +6061,8 @@ c_parser_do_statement (c_parser *parser,
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));
}
@@ -6132,7 +6135,9 @@ c_parser_for_statement (c_parser *parser
/* 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
@@ -6166,7 +6171,8 @@ c_parser_for_statement (c_parser *parser
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);
@@ -6196,7 +6202,8 @@ c_parser_for_statement (c_parser *parser
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);
@@ -6218,15 +6225,18 @@ c_parser_for_statement (c_parser *parser
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 %<;%>");
}
}
}
@@ -6235,18 +6245,19 @@ c_parser_for_statement (c_parser *parser
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
@@ -6275,11 +6286,13 @@ c_parser_for_statement (c_parser *parser
/* 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
@@ -6288,8 +6301,8 @@ c_parser_for_statement (c_parser *parser
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);
@@ -6312,10 +6325,14 @@ c_parser_for_statement (c_parser *parser
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
--- gcc/c/c-typeck.c (revision 271347)
+++ gcc/c/c-typeck.c (revision 271348)
@@ -10858,11 +10858,14 @@ c_finish_if_stmt (location_t if_locus, t
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;
@@ -10904,12 +10907,8 @@ c_finish_loop (location_t start_locus, t
}
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
{
@@ -10930,9 +10929,23 @@ c_finish_loop (location_t start_locus, t
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)
--- gcc/c/c-tree.h (revision 271347)
+++ gcc/c/c-tree.h (revision 271348)
@@ -694,7 +694,8 @@ extern int c_types_compatible_p (tree, t
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);
2019-08-29 Jakub Jelinek <[email protected]>
Backported from mainline
2019-05-10 Jakub Jelinek <[email protected]>
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.
--- gcc/cp/config-lang.in (revision 271349)
+++ gcc/cp/config-lang.in (revision 271350)
@@ -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 \
--- gcc/objc/config-lang.in (revision 271349)
+++ gcc/objc/config-lang.in (revision 271350)
@@ -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"
--- gcc/objcp/config-lang.in (revision 271349)
+++ gcc/objcp/config-lang.in (revision 271350)
@@ -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 \
--- gcc/testsuite/g++.dg/pch/pr90326.C (nonexistent)
+++ gcc/testsuite/g++.dg/pch/pr90326.C (revision 271350)
@@ -0,0 +1,9 @@
+#include "pr90326.H"
+
+int main()
+{
+ float f = __FLT_MAX__;
+ if (f == 0.0)
+ __builtin_abort ();
+ return 0;
+}
--- gcc/testsuite/g++.dg/pch/pr90326.Hs (nonexistent)
+++ gcc/testsuite/g++.dg/pch/pr90326.Hs (revision 271350)
@@ -0,0 +1 @@
+// empty
2019-08-29 Jakub Jelinek <[email protected]>
Backported from mainline
2019-05-15 Jakub Jelinek <[email protected]>
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.
--- gcc/cp/cp-gimplify.c (revision 271352)
+++ gcc/cp/cp-gimplify.c (revision 271353)
@@ -202,17 +202,26 @@ genericize_cp_loop (tree *stmt_p, locati
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, locati
}
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);
2019-08-29 Jakub Jelinek <[email protected]>
Backported from mainline
2019-05-24 Jakub Jelinek <[email protected]>
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 *.
--- libgomp/plugin/plugin-hsa.c (revision 271956)
+++ libgomp/plugin/plugin-hsa.c (revision 271957)
@@ -1154,8 +1154,9 @@ create_single_kernel_dispatch (struct ke
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_k
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_k
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,
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);
}
2019-08-29 Jakub Jelinek <[email protected]>
Backported from mainline
2019-06-05 Jakub Jelinek <[email protected]>
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.
--- gcc/var-tracking.c (revision 271959)
+++ gcc/var-tracking.c (revision 271960)
@@ -8491,7 +8491,7 @@ vt_expand_loc_callback (rtx x, bitmap re
/* 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;
--- gcc/testsuite/gcc.dg/pr90733.c (nonexistent)
+++ gcc/testsuite/gcc.dg/pr90733.c (revision 271960)
@@ -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;
+}
2019-08-29 Jakub Jelinek <[email protected]>
Backported from mainline
2019-06-12 Jakub Jelinek <[email protected]>
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.
--- gcc/symtab.c (revision 272799)
+++ gcc/symtab.c (revision 272800)
@@ -1553,7 +1553,7 @@ symtab_node::set_section (symtab_node *n
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);
}
--- gcc/testsuite/gcc.dg/pr90760.c (nonexistent)
+++ gcc/testsuite/gcc.dg/pr90760.c (revision 272800)
@@ -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" } */
2019-08-29 Jakub Jelinek <[email protected]>
Backported from mainline
2019-06-21 Jakub Jelinek <[email protected]>
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.
--- gcc/cp/semantics.c (revision 272800)
+++ gcc/cp/semantics.c (revision 272801)
@@ -7315,7 +7315,8 @@ finish_omp_clauses (tree clauses, enum c
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;
}
--- gcc/testsuite/g++.dg/gomp/lastprivate-1.C (nonexistent)
+++ gcc/testsuite/g++.dg/gomp/lastprivate-1.C (revision 272801)
@@ -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> ();
2019-08-29 Jakub Jelinek <[email protected]>
Backported from mainline
2019-06-25 Jakub Jelinek <[email protected]>
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.
--- gcc/c-family/c-omp.c (revision 272801)
+++ gcc/c-family/c-omp.c (revision 272802)
@@ -305,7 +305,7 @@ c_finish_omp_atomic (location_t loc, enu
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);
--- gcc/testsuite/c-c++-common/gomp/pr90954.c (nonexistent)
+++ gcc/testsuite/c-c++-common/gomp/pr90954.c (revision 272802)
@@ -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);
+}
2019-08-29 Jakub Jelinek <[email protected]>
Backported from mainline
2019-07-04 Jakub Jelinek <[email protected]>
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.
--- gcc/explow.c (revision 273475)
+++ gcc/explow.c (revision 273476)
@@ -892,16 +892,7 @@ promote_ssa_mode (const_tree name, int *
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;
--- gcc/testsuite/gcc.dg/pr90756.c (nonexistent)
+++ gcc/testsuite/gcc.dg/pr90756.c (revision 273476)
@@ -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); }
+ }
+}
2019-08-29 Jakub Jelinek <[email protected]>
Backported from mainline
2019-07-04 Jakub Jelinek <[email protected]>
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.
--- gcc/gimplify.c (revision 273476)
+++ gcc/gimplify.c (revision 273477)
@@ -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
|| 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
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;
--- gcc/testsuite/gcc.dg/gomp/pr78884.c (nonexistent)
+++ gcc/testsuite/gcc.dg/gomp/pr78884.c (revision 273477)
@@ -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);
+ }
+}
2019-08-29 Jakub Jelinek <[email protected]>
Backported from mainline
2019-07-30 Jakub Jelinek <[email protected]>
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.
--- gcc/config/i386/i386.c (revision 273963)
+++ gcc/config/i386/i386.c (revision 273964)
@@ -46199,7 +46199,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;
@@ -46253,7 +46254,7 @@ expand_vec_perm_blend (struct expand_vec
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:
--- gcc/testsuite/gcc.target/i386/avx512bw-pr91150.c (nonexistent)
+++ gcc/testsuite/gcc.target/i386/avx512bw-pr91150.c (revision 273964)
@@ -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 ();
+}