Jakub Jelinek [Thu, 5 Apr 2018 21:29:51 +0000 (23:29 +0200)]
re PR c++/85208 (ICE with #pragma weak and structured binding)
PR c++/85208
* decl.c (start_decl): For DECL_DECOMPOSITION_P decls, don't call
maybe_apply_pragma_weak here...
(cp_maybe_mangle_decomp): ... but call it here instead.
H.J. Lu [Thu, 5 Apr 2018 17:49:39 +0000 (17:49 +0000)]
Use dlsym to check if libdl is needed for plugin
config/plugins.m4 has
if test "$plugins" = "yes"; then
AC_SEARCH_LIBS([dlopen], [dl])
fi
Plugin uses dlsym, but libasan.so only intercepts dlopen, not dlsym:
[hjl@gnu-tools-1 binutils-text]$ nm -D /lib64/libasan.so.4| grep " dl" 0000000000038580 W dlclose
U dl_iterate_phdr 000000000004dc50 W dlopen
U dlsym
U dlvsym
[hjl@gnu-tools-1 binutils-text]$
Testing dlopen for libdl leads to false negative when -fsanitize=address
is used. It results in link failure:
../bfd/.libs/libbfd.a(plugin.o): undefined reference to symbol 'dlsym@@GLIBC_2.16'
dlsym should be used to check if libdl is needed for plugin.
PR gas/22318
* plugins.m4 (AC_PLUGINS): Use dlsym to check if libdl is needed.
[PR c++/84979] reject auto in explicit tmpl args for tmpl-fn
With concepts, we accept auto in explicit template arguments, but we
should only accept them for template classes. Passing them to
template functions or variables is not allowed. So, reject it, at
parse time if possible, at specialization time otherwise.
for gcc/cp/ChangeLog
PR c++/84979
* pt.c (check_auto_in_tmpl_args): New.
(tsubst_qualified_id): Use it to reject template args
referencing auto for non-type templates.
* parser.c (cp_parser_template_id): Likewise.
* cp-tree.h (check_auto_in_tmpl_args): Declare.
* typeck2.c (build_functional_cast): Report correct location
for invalid use of auto.
Jakub Jelinek [Wed, 4 Apr 2018 19:55:56 +0000 (21:55 +0200)]
re PR inline-asm/85172 (internal compiler error: unexpected expression '<statement>' of kind asm_expr)
PR inline-asm/85172
* constexpr.c (cxx_eval_builtin_function_call): For calls to
builtin_valid_in_constant_expr_p functions, don't call
cxx_eval_constant_expression if argument is not
potential_constant_expression.
* g++.dg/ext/builtin13.C: New test.
* g++.dg/ext/atomic-4.C: New test.
Jakub Jelinek [Wed, 4 Apr 2018 19:34:18 +0000 (21:34 +0200)]
re PR c++/85146 (ICE with __direct_bases for declared but not defined struct)
PR c++/85146
* cp-tree.h (calculate_bases, calculate_direct_bases): Add complain
argument.
* semantics.c (calculate_bases): Add complain argument. Use
complete_type_or_maybe_complain instead of just complete_type and
return an empty vector if it fails. Move make_tree_vector () call
after early return. Formatting fixes.
(calculate_direct_bases): Likewise. Call release_tree_vector at the
end.
(dfs_calculate_bases_post, calculate_bases_helper): Formatting fixes.
* pt.c (tsubst_pack_expansion): Adjust calculate_bases and
calculate_direct_bases callers, formatting fixes.
* g++.dg/ext/bases2.C: Expect extra error diagnostics.
* g++.dg/ext/bases3.C: New test.
[ARM] Fix PR85203: cmse_nonsecure_caller returns wrong result
__builtin_cmse_nonsecure_caller implementation returns true in almost
all cases due to 2 separate bugs:
* gen_addsi is used instead of gen_andsi to retrieve the lsb
* the lsb boolean value is not negated but the specification says
the intrinsic should return true for a nonsecure caller and a
nonsecure caller is characterized with LR's lsb being 0
This was not caught due to (1) lack of runtime test and (2) the existing
RTL scan not taking into account that '.' matches newline in Tcl regular
expressions.
This commit fixes the implementation issues and improves testing of
cmse_nonsecure_caller by (1) adding a runtime test for the secure caller
case and (2) looking for an SET insn of an AND expression in the right
function. This leaves the nonsecure caller case only partly tested
since the exact value being AND and the negation are not covered by the
scan and the existing test infrastructure does not allow 2 separate
compilation and link to be performed. It is enough though to catch the
current incorrect behavior.
The commit also reorganize the scan directives in cmse-1.c to more
easily identify what function they are intended to test in the file.
2018-04-04 Thomas Preud'homme <thomas.preudhomme@arm.com>
gcc/
PR target/85203
* config/arm/arm-builtins.c (arm_expand_builtin): Change
expansion to perform a bitwise AND of the argument followed by a
boolean negation of the result.
gcc/testsuite/
PR target/85203
* gcc.target/arm/cmse/cmse-1.c: Tighten cmse_nonsecure_caller RTL scan
to match a single insn of the baz function. Move scan directives at
the end of the file below the functions they are trying to test for
better readability.
* gcc.target/arm/cmse/cmse-16.c: New testcase.
Jakub Jelinek [Wed, 4 Apr 2018 17:18:14 +0000 (19:18 +0200)]
re PR other/85161 (Test case failures in libbacktrace on powerpc64 BE starting with r253456)
PR other/85161
* elf.c (elf_zlib_fetch): Fix up predefined macro names in test for
big endian, only use 32-bit loads if endianity macros are predefined
and indicate big or little endian.
Peter Bergner [Wed, 4 Apr 2018 15:35:03 +0000 (10:35 -0500)]
re PR rtl-optimization/84878 (ICE: Segmentation fault (in add_cross_iteration_register_deps))
gcc/
PR rtl-optimization/84878
* ddg.c (add_cross_iteration_register_deps): Use DF_REF_BB to determine
the basic block. Assert the use reference is not artificial and that
it has an associated insn.
gcc/testsuite/
PR rtl-optimization/84878
* gcc.target/powerpc/pr84878.c: New test.
Michael Matz [Wed, 4 Apr 2018 14:49:06 +0000 (14:49 +0000)]
Fix -Wstringop-overflow regression
we shouldn't claim string overflows for character arrays at
end of structures; the code that tries to avoid these
accidentally passed the address of the accessed member to
array_at_struct_end_p(), but that one wants the component_ref
or array_ref itself. Needs updating of one testcase that
incorrectly expected warning to occur in this situation.
Jakub Jelinek [Wed, 4 Apr 2018 14:14:08 +0000 (16:14 +0200)]
re PR testsuite/85189 (g++.dg/inherit/override-attribs.C FAILs on 32-bit x86)
PR testsuite/85189
* g++.dg/inherit/override-attribs.C: Use dg-message instead of dg-error
for the diagnostics of overridden functions. Adjust for new wording.
Richard Biener [Wed, 4 Apr 2018 07:52:20 +0000 (07:52 +0000)]
re PR tree-optimization/85168 (ICE in tree-ssa-coalesce.c: SSA corruption: Unable to coalesce ssa_names which are marked as MUST COALESCE when -O2 is used)
[PR c++/84943] mark function as used when taking its address
fn[0]() ICEd because we would fold the INDIRECT_REF used for the
array indexing while building the address for the call, after not
finding the decl hiding there at first. But the decl would be exposed
by the folding, and then lower layers would complain we had the decl,
after all, but it wasn't one of the artificial or special functions
that could be called without being marked as used.
This patch arranges for a FUNCTION_DECL to be marked as used when
taking its address, just like we already did when taking the address
of a static function to call it as a member function (i.e. using the
obj.fn() notation). However, we shouldn't mark functions as used when
just performing overload resolution, lest we might instantiate
templates we shouldn't, as in g++.dg/overload/template1.C, so we
adjust mark_used to return early when testing conversions.
for gcc/cp/ChangeLog
PR c++/84943
* typeck.c (cp_build_addr_expr_1): Mark FUNCTION_DECL as
used.
* decl2.c (mark_used): Return without effects if tf_conv.
Bill Schmidt [Tue, 3 Apr 2018 19:06:28 +0000 (19:06 +0000)]
emmintrin.h (_mm_cvtpd_epi32): Use __vector rather than vector.
[gcc]
2018-04-03 Bill Schmidt <wschmidt@linux.ibm.com>
* config/rs6000/emmintrin.h (_mm_cvtpd_epi32): Use __vector rather
than vector.
(_mm_cvtpd_ps): Likewise.
(_mm_cvttpd_epi32): Likewise.
* config/rs6000/mmintrin.h (_mm_unpacklo_pi8): Likewise.
* config/rs6000/xmmintrin.h: For strict-ANSI C++ or C11, undefine
vector, pixel, and bool following altivec.h include.
[gcc/testsuite]
2018-04-03 Bill Schmidt <wschmidt@linux.ibm.com>
* gcc.target/powerpc/powerpc.exp: Add .C suffix for main loop.
* gcc.target/powerpc/undef-bool-1.C: New file.
* gcc.target/powerpc/undef-bool-2.c: New file.
Paolo Carlini [Tue, 3 Apr 2018 17:53:05 +0000 (17:53 +0000)]
re PR c++/84768 (ICE with failed class template argument deduction because of invalid template parameter)
/cp
2018-04-03 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/84768
* pt.c (rewrite_template_parm): If the first argument is
error_mark_node return it immediately.
(build_deduction_guide): Check the return value of the
latter for error_mark_node.
(do_class_deduction): Check the return value of the latter.
/testsuite
2018-04-03 Paolo Carlini <paolo.carlini@oracle.com>
Jakub Jelinek [Tue, 3 Apr 2018 16:20:02 +0000 (18:20 +0200)]
re PR c++/85134 (ICE with invalid constexpr in 'shared' OpenMP clause)
PR c++/85134
* decl.c (cp_finish_decl): If ensure_literal_type_for_constexpr_object
fails, after clearing DECL_DECLARED_CONSTEXPR_P don't return early,
instead for static data members clear init and set DECL_EXTERNAL.
* g++.dg/gomp/pr85134.C: New test.
* g++.dg/cpp0x/constexpr-ice19.C: Expect one further error.
After middle-end changes combine now gets fed different input, from
which it makes different (but just as efficient) code. So remove the
test for particular asm output.
i386.c (emit_i387_cw_initialization): Always use logic instructions when changing rounding bits to preserve precision...
* config/i386/i386.c (emit_i387_cw_initialization): Always use logic
instructions when changing rounding bits to preserve precision bits
in the x87 control word.
gcc/
* config.gcc (nds32): Add nds32-relax-opt.o into extra_objs.
* config/nds32/constants.md (unspec_volatile_element): Add
UNSPEC_VOLATILE_RELAX_GROUP.
* config/nds32/nds32-relax-opt.c: New file.
* config/nds32/nds32-predicates.c
(nds32_symbol_load_store_p): New function.
* config/nds32/nds32-protos.h
(nds32_symbol_load_store_p): Declare function.
(make_pass_nds32_relax_opt): Declare new rtl pass function.
* config/nds32/nds32.c
(nds32_register_pass): New function to register pass.
(nds32_register_passes): New function to register passes.
* config/nds32/nds32.md (relax_group): New pattern.
* config/nds32/nds32.opt (mrelax-hint): New option.
* config/nds32/t-nds32 (nds32-relax-opt.o): New dependency.
Co-Authored-By: Kito Cheng <kito.cheng@gmail.com> Co-Authored-By: Kuan-Lin Chen <kuanlinchentw@gmail.com>
From-SVN: r258998