Implement the go:linkname compiler directive for functions (both
function definitions and function declarations). At least for now, give
an error for code that tries to use go:linkname with a non-function.
Reviewed-on: https://go-review.googlesource.com/26651
From-SVN: r239311
* doc/gcov.texi: Change _gcov_dump to __gcov_dump and
_gcov_reset to __gcov_reset.
* doc/gcov-tool.texi: Fix typo.
* libgcov-util.c: Fix typo and GNU coding style.
From-SVN: r239307
* Makefile.in: Remove __gcov_indirect_call_profiler.
* libgcov-profiler.c (__gcov_indirect_call_profiler): Remove
function.
* libgcov.h: And the declaration of the function.
From-SVN: r239306
* value-prof.c (gimple_divmod_values_to_profile): Do not
instrument MOD histogram if a value is not a SSA name.
* gcc.dg/tree-prof/val-prof-9.c: New test.
From-SVN: r239305
* gcc.dg/tree-prof/val-prof-8.c: New test.
* value-prof.c (dump_histogram_value): Swap pow2 and non-pow2
values.
* libgcov-profiler.c (__gcov_pow2_profiler): Consider 0 as not
power of two.
From-SVN: r239304
CLONE_NEWNET is needed to compile the syscall tests on GNU/Linux.
The symbol is not defined in the CentOS 5.11 header files.
Patch from Uros Bizjak.
Reviewed-on: https://go-review.googlesource.com/26630
From-SVN: r239296
2016-08-09 Martin Jambor <mjambor@suse.cz>
PR ipa/71981
* ipa-polymorphic-call.c (get_dynamic_type): Bail out gracefully
if instance is a MEM_REF.
testsuite/
PR ipa/71981
* gcc.dg/ipa/pr71981.c: New test.
From-SVN: r239294
Rewrite the compiler directive support to recognize all the compiler
directives implemented by the current gc compiler. The directives other
than go:linkname are now turned into GOPRAGMA flags attached to a
function or function declaration. The go:linkname directive is turned
into a map attached to the Lex object. No new directives are actually
implemented yet, they are just recognized.
Reviewed-on: https://go-review.googlesource.com/26610
From-SVN: r239282
2016-08-09 Richard Biener <rguenther@suse.de>
PR tree-optimization/71802
* tree-cfgcleanup.c (cleanup_tree_cfg_bb): Make sure to catch
all merge opportunities with the predecessor.
* gcc.dg/torture/pr71802.c: New testcase.
From-SVN: r239274
2016-08-09 Richard Biener <rguenther@suse.de>
PR ipa/68273
* ipa-prop.c (ipa_modify_formal_parameters): Build
parameter types with natural alignment also for the
over-aligned case.
From-SVN: r239273
This patch fixes an bootstrap error with autoprofiledbootstrap
due to uninitiliazed variables, because the compiler cannot
figure out they don't need to be initialized in an error path.
Just always initialize them.
gcc/:
2016-08-08 Andi Kleen <ak@linux.intel.com>
* tree-vrp.c (get_single_symbol): Always initialize inv and neg.
From-SVN: r239266
There were some reports that the autofdo tests are non deterministic
with parallel builds. I wasn't able to reproduce this, but here are
two changes that may help:
- Always use unique file names for temporary files.
- Don't print file names in the test log because the directories
can vary (suggested by Jeff Law)
gcc/testsuite/:
2016-08-08 Andi Kleen <ak@linux.intel.com>
* lib/profopt.exp: (auto-profopt-execute): Don't include full
test command line in failure log.
(profopt-execute): dito. Make autofdo file names unique.
From-SVN: r239265
We already lowered the limit of recursive template invocations from
100,000 to 10,000, but the tests still fail occasionally on
x86_64-pc-linux-gnu when using GNU ld (so that split stacks are not
fully functional). Reduce the limit further, to 1000, enough so that
the test passes consistently.
Permitting 1000 recursive template invocations still seems capacious
enough for real world use.
Reviewed-on: https://go-review.googlesource.com/25590
From-SVN: r239261
This adds fix-it hints to c-format.c so that it can (sometimes) suggest
the format string the user should have used.
The patch adds selftests for the new code in c-format.c. These
selftests are thus lang-specific. This is the first time we've had
lang-specific selftests, and hence the patch also adds a langhook for
running them. (Note that currently the Makefile only invokes the
selftests for cc1).
gcc/c-family/ChangeLog:
PR c/64955
* c-common.h (selftest::c_format_c_tests): New declaration.
(selftest::run_c_tests): New declaration.
* c-format.c: Include "selftest.h.
(format_warning_va): Add param "corrected_substring" and use
it to add a replacement fix-it hint.
(format_warning_at_substring): Likewise.
(format_warning_at_char): Update for new param of
format_warning_va.
(argument_parser::check_argument_type): Pass "fki" to
check_format_types.
(check_format_types): Add param "fki" and pass it to
format_type_warning.
(deref_n_times): New function.
(get_modifier_for_format_len): New function.
(selftest::test_get_modifier_for_format_len): New function.
(get_format_for_type): New function.
(format_type_warning): Add param "fki" and use it to attempt
to provide hints for argument types when calling
format_warning_at_substring.
(selftest::get_info): New function.
(selftest::assert_format_for_type_streq): New function.
(ASSERT_FORMAT_FOR_TYPE_STREQ): New macro.
(selftest::test_get_format_for_type_printf): New function.
(selftest::test_get_format_for_type_scanf): New function.
(selftest::c_format_c_tests): New function.
gcc/c/ChangeLog:
PR c/64955
* c-lang.c (LANG_HOOKS_RUN_LANG_SELFTESTS): If CHECKING_P, wire
this up to selftest::run_c_tests.
(selftest::run_c_tests): New function.
gcc/ChangeLog:
PR c/64955
* langhooks-def.h (LANG_HOOKS_RUN_LANG_SELFTESTS): New default
do-nothing langhook.
(LANG_HOOKS_INITIALIZER): Add LANG_HOOKS_RUN_LANG_SELFTESTS.
* langhooks.h (struct lang_hooks): Add run_lang_selftests.
* selftest-run-tests.c: Include "tree.h" and "langhooks.h".
(selftest::run_tests): Call lang_hooks.run_lang_selftests.
gcc/testsuite/ChangeLog:
PR c/64955
* gcc.dg/format/diagnostic-ranges.c: Add fix-it hints to expected
output.
From-SVN: r239260
Having each .lo depend on the corresponding .lo.dep caused too many
rebuilds, because the .lo.dep files are rebuilt when Makefile changes.
Instead, if the .lo.dep file changes, remove the .lo file.
Reviewed-on: https://go-review.googlesource.com/25588
From-SVN: r239258
selftest::test_lexer_string_locations_ebcdic has this clause:
/* EBCDIC support requires iconv. */
if (!HAVE_ICONV)
return;
leading to a build failure on systems without iconv. This conditional
works in libcpp due to this in libcpp/internal.h:
#if HAVE_ICONV
#include <iconv.h>
#else
#define HAVE_ICONV 0
typedef int iconv_t; /* dummy */
#endif
Fix the problem by ensuring that HAVE_ICONV is always defined within
gcc/input.c.
gcc/ChangeLog:
PR bootstrap/72844
* input.c: Ensure that HAVE_ICONV is defined.
From-SVN: r239257
The recent changes to Makefile.am mean that if you configure with an
absolute path as srcdir then gotest will be invoked with absolute paths
for the files. That case never worked. This patch fixes it.
Reviewed-on: https://go-review.googlesource.com/25587
From-SVN: r239256
gcc/c-family/ChangeLog:
PR c/52952
* c-format.c: Include "diagnostic.h".
(location_column_from_byte_offset): Delete.
(location_from_offset): Delete.
(format_warning_va): New function.
(format_warning_at_substring): New function.
(format_warning_at_char): New function.
(check_format_arg): Capture location of format_tree and pass to
check_format_info_main.
(argument_parser): Add fields "start_of_this_format" and
"format_string_cst".
(flag_chars_t::validate): Add param "format_string_cst". Convert
warning_at call using location_from_offset to call to
format_warning_at_char.
(argument_parser::argument_parser): Add param "format_string_cst_"
and use use it to initialize field "format_string_cst".
Initialize new field "start_of_this_format".
(argument_parser::read_format_flags): Convert warning_at call
using location_from_offset to a call to format_warning_at_char.
(argument_parser::read_any_format_left_precision): Likewise.
(argument_parser::read_any_format_precision): Likewise.
(argument_parser::read_any_other_modifier): Likewise.
(argument_parser::find_format_char_info): Likewise, in three places.
(argument_parser::parse_any_scan_set): Likewise, in one place.
(argument_parser::handle_conversions): Likewise, in two places.
(argument_parser::check_argument_type): Add param "fmt_param_loc"
and use it to make a substring_loc. Pass the latter to
check_format_types.
(check_format_info_main): Add params "fmt_param_loc" and
"format_string_cst". Convert warning_at calls using
location_from_offset to calls to format_warning_at_char. Pass the
new params to the arg_parser ctor. Pass "format_string_cst" to
flag_chars.validate. Pass "fmt_param_loc" to
arg_parser.check_argument_type.
(check_format_types): Convert first param from a location_t
to a const substring_loc & and rename to "fmt_loc". Attempt
to extract the range of the relevant parameter and pass it
to format_type_warning.
(format_type_warning): Convert first param from a location_t
to a const substring_loc & and rename to "fmt_loc". Add
params "param_range" and "type". Replace calls to warning_at
with calls to format_warning_at_substring.
gcc/testsuite/ChangeLog:
PR c/52952
* gcc.dg/cpp/pr66415-1.c: Likewise.
* gcc.dg/format/asm_fprintf-1.c: Update column numbers.
* gcc.dg/format/c90-printf-1.c: Likewise.
* gcc.dg/format/diagnostic-ranges.c: New test case.
From-SVN: r239253
PR go/72814
runtime: treat zero-sized result value as void
Change the FFI interface to treat a call to a function that returns a
zero-sized result as a call to a function that returns void.
This is part of the fix for https://gcc.gnu.org/PR72814. On 32-bit
SPARC systems, a call to a function that returns a non-zero-sized struct
is followed by an unimp instruction that describes the size of the
struct. The function returns to the address after the unimp
instruction. The libffi library can not represent a zero-sized struct,
so we wind up treating it as a 1-byte struct. Thus in that case libffi
calls the function with an unimp instruction, but the function does not
adjust the return address. The result is that the program attempts to
execute the unimp instruction, causing a crash.
This is part of a change that fixes the crash by treating all functions
that return zero bytes as functions that return void.
Reviewed-on: https://go-review.googlesource.com/25585
* go-gcc.cc (Gcc_backend::function_type): If the return type is
zero bytes, treat the function as returning void.
(return_statement): If the return type is zero bytes, don't
actually return any values.
From-SVN: r239252
PR fortran/72716
* openmp.c (gfc_match_omp_declare_simd): Don't stick anything into
BLOCK DATA ns, it will be rejected later.
* gfortran.dg/gomp/pr72716.f90: New test.
From-SVN: r239250
PR middle-end/72781
* omp-low.c (lower_lastprivate_clauses): Set TREE_NO_WARNING on the
private vars for lastprivate and for linear iterator.
* gcc.dg/gomp/pr72781.c: New test.
From-SVN: r239249
PR middle-end/68762
* omp-simd-clone.c: Include varasm.h.
(simd_clone_create): Copy over DECL_COMDAT, DECL_WEAK, DECL_EXTERNAL,
DECL_VISIBILITY, DECL_VISIBILITY_SPECIFIED, DECL_DLLIMPORT_P and for
DECL_ONE_ONLY call make_decl_one_only. Fix up spelling in comment and
update function name.
* g++.dg/vect/pr68762-1.cc: New test.
* g++.dg/vect/pr68762-2.cc: New test.
* g++.dg/vect/pr68762.h: New file.
From-SVN: r239248
gcc/c-family/ChangeLog:
* c-format.c (class flag_chars_t): New class.
(struct length_modifier): New struct.
(class argument_parser): New class.
(flag_chars_t::flag_chars_t): New ctor.
(flag_chars_t::has_char_p): New method.
(flag_chars_t::add_char): New method.
(flag_chars_t::validate): New method.
(flag_chars_t::get_alloc_flag): New method.
(flag_chars_t::assignment_suppression_p): New method.
(argument_parser::argument_parser): New ctor.
(argument_parser::read_any_dollar): New method.
(argument_parser::read_format_flags): New method.
(argument_parser::read_any_format_width): New method.
(argument_parser::read_any_format_left_precision): New method.
(argument_parser::read_any_format_precision): New method.
(argument_parser::handle_alloc_chars): New method.
(argument_parser::read_any_length_modifier): New method.
(argument_parser::read_any_other_modifier): New method.
(argument_parser::find_format_char_info): New method.
(argument_parser::validate_flag_pairs): New method.
(argument_parser::give_y2k_warnings): New method.
(argument_parser::parse_any_scan_set): New method.
(argument_parser::handle_conversions): New method.
(argument_parser::check_argument_type): New method.
(check_format_info_main): Introduce classes argument_parser
and flag_chars_t, moving the code within the loop into methods
of these classes. Make various locals "const".
From-SVN: r239247