Arnaud Charlet [Tue, 2 Jun 2020 12:40:26 +0000 (08:40 -0400)]
[Ada] Documentation cleanups
gcc/ada/
* doc/gnat_ugn/about_this_guide.rst: Remove old section and
update for Ada 202x.
* doc/gnat_ugn/getting_started_with_gnat.rst: Add a system
requirements section. Remove obsolete section and minimal
rewording on the getting started section.
* gnat_ugn.texi: Regenerate.
Piotr Trojanek [Sat, 30 May 2020 09:56:38 +0000 (11:56 +0200)]
[Ada] Fix slices and qualified expressions being effectively volatile
gcc/ada/
* exp_ch5.adb (Expand_Assign_Array): Use short-circuit operator
(style).
* sem_res.adb (Resolve_Indexed_Component): Fix style in comment.
* sem_util.adb (Is_Effectively_Volatile_Object): Handle slices
just like indexed components; handle qualified expressions and
type conversions lie in Is_OK_Volatile_Context.
(Is_OK_Volatile_Context): Handle qualified expressions just like
type conversions.
Piotr Trojanek [Fri, 29 May 2020 18:57:53 +0000 (20:57 +0200)]
[Ada] Cleanup condition for an effectively volatile array type
gcc/ada/
* sem_prag.adb (Atomic_Components): Simplify with Ekind_In.
(Complex_Representation): Fix type of E_Id, which just like when
for pragma Atomic_Components will hold an N_Identifier node, not
an entity.
* sem_util.adb (Is_Effectively_Volatile): Refactor to avoid
unnecessary computation.
Arnaud Charlet [Wed, 27 May 2020 10:10:35 +0000 (06:10 -0400)]
[Ada] Extend static functions
gcc/ada/
* inline.adb, inline.ads
(Inline_Static_Expression_Function_Call): Renamed
Inline_Static_Function_Call.
* sem_ch13.adb (Analyze_Aspect_Static): Allow static intrinsic
imported functions under -gnatX.
* sem_util.ads, sem_util.adb (Is_Static_Expression_Function):
Renamed Is_Static_Function.
(Is_Static_Expression_Function_Call): Renamed
Is_Static_Function_Call.
* sem_ch6.adb, sem_elab.adb, sem_res.adb: Update calls to
Is_Static_Function*.
* sem_eval.adb (Fold_Dummy, Eval_Intrinsic_Call, Fold_Shift):
New.
(Eval_Call): Add support for intrinsic calls, code refactoring.
(Eval_Entity_Name): Code refactoring.
(Eval_Logical_Op): Update comment.
(Eval_Shift): Call Fold_Shift. Update comments.
* par-prag.adb (Par [Pragma_Extensions_Allowed]): Set
Ada_Version to Ada_Version_Type'Last to handle
Extensions_Allowed (On) consistently.
* opt.ads (Extensions_Allowed): Update documentation.
* sem_attr.adb: Update comment.
* doc/gnat_rm/implementation_defined_pragmas.rst: Update
documentation of Extensions_Allowed.
* gnat_rm.texi: Regenerate.
Arnaud Charlet [Tue, 2 Jun 2020 06:57:11 +0000 (02:57 -0400)]
[Ada] Potential access to uninitialized variable
gcc/ada/
* sem_aggr.adb (Resolve_Iterated_Component_Association): Ensure
Typ is never accessed uninitialized.
Piotr Trojanek [Fri, 8 May 2020 22:06:16 +0000 (00:06 +0200)]
[Ada] Fix typo in "accommodate" in docs and comments
gcc/ada/
* doc/gnat_rm/representation_clauses_and_pragmas.rst: Fix typo.
* gnat_rm.texi: Regenerate.
* libgnat/s-secsta.ads (Memory_Alignment): Likewise.
Gary Dismukes [Mon, 1 Jun 2020 19:22:48 +0000 (15:22 -0400)]
[Ada] Minor reformatting of comments and some code, plus a typo correction
gcc/ada/
* exp_ch6.adb: Add a comma and fix a typo (machinary =>
machinery) in comment.
* exp_aggr.adb: Reformat, fix capitalization, and add a couple
of commas in a comment. Adjust columns in several code
fragments.
* sem_aggr.adb: Reformat and add a comma in a comment.
Eric Botcazou [Mon, 1 Jun 2020 18:49:43 +0000 (20:49 +0200)]
[Ada] Use Sloc of delay statement in timed entry call
gcc/ada/
* exp_ch9.adb (Expand_N_Timed_Entry_Call): Use the Sloc of
the delay statement in the expansion.
Ed Schonberg [Sun, 31 May 2020 20:01:41 +0000 (16:01 -0400)]
[Ada] Ongoing work for unnamed and named container aggregates
gcc/ada/
* sem_aggr.adb (Resolve_Iterated_Component_Association): New
procedure, internal to Resolve_Container_Aggregate, to complete
semantic analysis of Iterated_Component_Associations.
* exp_aggr.adb (Expand_Iterated_Component): New procedure,
internal to Expand_Container_Aggregate, to expand the construct
into an implicit loop that performs individual insertions into
the target aggregate.
Justin Squirek [Fri, 29 May 2020 19:44:50 +0000 (15:44 -0400)]
[Ada] Spurious accessibility error on allocator
gcc/ada/
* exp_ch6.adb (Make_Build_In_Place_Call_Allocator): Normalize
the associated node for internally generated objects to be like
their SOAAT counter-parts.
Arnaud Charlet [Sat, 30 May 2020 18:01:17 +0000 (14:01 -0400)]
[Ada] Fix potentially uninitialized variable flagged by CodePeer
gcc/ada/
* libgnat/g-socket.adb (Wait_On_Socket): Fix potentially
uninitialized variable.
Nathan Sidwell [Wed, 15 Jul 2020 13:00:10 +0000 (06:00 -0700)]
c++: error recovery & pragmas
Parser error recovery can get confused by the tokens within a deferred
pragma, as treats those as regular tokens. This adjusts the recovery
so that the pragma is treated as a unit. Also, the preprocessor now
ensures that we never have an EOF token inside a pragma -- the pragma
is always closed first.
gcc/cp/
* parser.c (cp_parser_skip_to_closing_parenthesis_1): Deal with
meeting a deferred pragma.
(cp_parser_skip_to_end_of_statement): Likewise.
(cp_parser_skip_to_end_of_block_or_statement): Likewise.
(cp_parser_skip_to_pragma_eol): We should never meet EOF.
(cp_parser_omp_declare_simd): Likewise.
(cp_parser_omp_declare_reduction, cp_parser_oacc_routine)
(pragma_lex): Likewise.
gcc/testsuite/
* g++.dg/parse/pragma-recovery.C: New.
Tobias Burnus [Wed, 15 Jul 2020 10:29:44 +0000 (12:29 +0200)]
libgomp.fortran/struct-elem-map-1.f90: Add char kind=4 tests
As the Fortran PR 95837 has been fixed, the test could be be added.
libgomp/ChangeLog:
* testsuite/libgomp.fortran/struct-elem-map-1.f90: Remove unused
variables; add character(kind=4) tests; update TODO comment.
Jakub Jelinek [Wed, 15 Jul 2020 09:34:44 +0000 (11:34 +0200)]
fix _mm512_{,mask_}cmp*_p[ds]_mask at -O0 [PR96174]
The _mm512_{,mask_}cmp_p[ds]_mask and also _mm_{,mask_}cmp_s[ds]_mask
intrinsics have an argument which must have a constant passed to it
and so use an inline version only for ifdef __OPTIMIZE__ and have
a #define for -O0. But the _mm512_{,mask_}cmp*_p[ds]_mask intrinsics
don't need a constant argument, they are essentially the first
set with the constant added to them implicitly based on the comparison
name, and so there is no #define version for them (correctly).
But their inline versions are defined in between the first and s[ds]
set and so inside of ifdef __OPTIMIZE__, which means that with -O0
they aren't defined at all.
This patch fixes that by moving those after the #ifdef __OPTIMIZE #else
use #define #endif block.
2020-07-15 Jakub Jelinek <jakub@redhat.com>
PR target/96174
* config/i386/avx512fintrin.h (_mm512_cmpeq_pd_mask,
_mm512_mask_cmpeq_pd_mask, _mm512_cmplt_pd_mask,
_mm512_mask_cmplt_pd_mask, _mm512_cmple_pd_mask,
_mm512_mask_cmple_pd_mask, _mm512_cmpunord_pd_mask,
_mm512_mask_cmpunord_pd_mask, _mm512_cmpneq_pd_mask,
_mm512_mask_cmpneq_pd_mask, _mm512_cmpnlt_pd_mask,
_mm512_mask_cmpnlt_pd_mask, _mm512_cmpnle_pd_mask,
_mm512_mask_cmpnle_pd_mask, _mm512_cmpord_pd_mask,
_mm512_mask_cmpord_pd_mask, _mm512_cmpeq_ps_mask,
_mm512_mask_cmpeq_ps_mask, _mm512_cmplt_ps_mask,
_mm512_mask_cmplt_ps_mask, _mm512_cmple_ps_mask,
_mm512_mask_cmple_ps_mask, _mm512_cmpunord_ps_mask,
_mm512_mask_cmpunord_ps_mask, _mm512_cmpneq_ps_mask,
_mm512_mask_cmpneq_ps_mask, _mm512_cmpnlt_ps_mask,
_mm512_mask_cmpnlt_ps_mask, _mm512_cmpnle_ps_mask,
_mm512_mask_cmpnle_ps_mask, _mm512_cmpord_ps_mask,
_mm512_mask_cmpord_ps_mask): Move outside of __OPTIMIZE__ guarded
section.
* gcc.target/i386/avx512f-vcmppd-3.c: New test.
* gcc.target/i386/avx512f-vcmpps-3.c: New test.
Jakub Jelinek [Wed, 15 Jul 2020 09:26:22 +0000 (11:26 +0200)]
builtins: Avoid useless char/short -> int promotions before atomics [PR96176]
As mentioned in the PR, we generate a useless movzbl insn before lock cmpxchg.
The problem is that the builtin for the char/short cases has the arguments
promoted to int and combine gives up, because the instructions have
MEM_VOLATILE_P arguments and recog in that case doesn't recognize anything
when volatile_ok is false, and nothing afterwards optimizes the
(reg:SI a) = (zero_extend:SI (reg:QI a))
... (subreg:QI (reg:SI a) 0) ...
The following patch fixes it at expansion time, we already have a function
that is meant to undo the promotion, so this just adds the very common case
to that.
2020-07-15 Jakub Jelinek <jakub@redhat.com>
PR target/96176
* builtins.c: Include gimple-ssa.h, tree-ssa-live.h and
tree-outof-ssa.h.
(expand_expr_force_mode): If exp is a SSA_NAME with different mode
from MODE and get_gimple_for_ssa_name is a cast from MODE, use the
cast's rhs.
* gcc.target/i386/pr96176.c: New test.
guojiufu [Wed, 15 Jul 2020 08:07:47 +0000 (16:07 +0800)]
rs6000: Refine RTL unroll hook for small loops
For very small loops (< 6 insns), it would be fine to unroll 4
times to run fast with less latency and better cache usage. Like
below loops:
while (i) a[--i] = NULL; while (p < e) *d++ = *p++;
With this patch enhances, we could see some performance improvement
for some workloads(e.g. SPEC2017).
2020-07-13 Jiufu Guo <guojiufu@cn.ibm.com>
* config/rs6000/rs6000.c (rs6000_loop_unroll_adjust): Refine hook.
Tobias Burnus [Wed, 15 Jul 2020 06:33:20 +0000 (08:33 +0200)]
libgomp: Add Fortran routine support for allocators
libgomp/ChangeLog:
* allocator.c: Add ialias for omp_init_allocator and
omp_destroy_allocator.
* configure.ac: Set INTPTR_T_KIND.
* configure: Regenerate.
* Makefile.in: Regenerate.
* testsuite/Makefile.in: Regenerate.
* fortran.c (omp_init_allocator_, omp_destroy_allocator_,
omp_set_default_allocator_, omp_get_default_allocator_): New
functions and ialias_redirect.
* icv.c: Add ialias for omp_set_default_allocator and
omp_get_default_allocator.
* libgomp.map (OMP_5.0.1): Add omp_init_allocator_,
omp_destroy_allocator_, omp_set_default_allocator_ and
omp_get_default_allocator_.
* omp_lib.f90.in: Add allocator traits parameters, declare
allocator routines and add related kind parameters.
* omp_lib.h.in: Likewise.
* testsuite/libgomp.c-c++-common/alloc-2.c: Fix sizeof.
* testsuite/libgomp.fortran/alloc-1.F90: New test.
* testsuite/libgomp.fortran/alloc-2.F90: New test.
* testsuite/libgomp.fortran/alloc-3.F: New test.
* testsuite/libgomp.fortran/alloc-4.f90: New test.
* testsuite/libgomp.fortran/alloc-5.f90: New test.
GCC Administrator [Wed, 15 Jul 2020 00:16:35 +0000 (00:16 +0000)]
Daily bump.
Marek Polacek [Tue, 14 Jul 2020 21:31:08 +0000 (17:31 -0400)]
c++: Add new test [PR59978]
Fixed in r224162. That came without a test so adding this one.
Previously, we issued a bogus "too few arguments to function" error.
gcc/testsuite/ChangeLog:
PR c++/59978
* g++.dg/cpp0x/vt-59978.C: New test.
H.J. Lu [Tue, 14 Jul 2020 21:01:51 +0000 (14:01 -0700)]
x86: Replace __glibc_unlikely with __builtin_expect
Replace glibc specific __glibc_unlikely with __builtin_expect.
PR target/95443
* gcc.target/i386/pr95443-1.c (simple_strstr): Replace
__glibc_unlikely with __builtin_expect.
Marek Polacek [Tue, 23 Jun 2020 01:26:49 +0000 (21:26 -0400)]
c++: Make convert_like complain about bad ck_ref_bind again [PR95789]
convert_like issues errors about bad_p conversions at the beginning
of the function, but in the ck_ref_bind case, it only issues them
after we've called convert_like on the next conversion.
This doesn't work as expected since r10-7096 because when we see
a conversion from/to class type in a template, we return early, thereby
missing the error, and a bad_p conversion goes by undetected. That
made the attached test to compile even though it should not.
I had thought that I could just move the ck_ref_bind/bad_p errors
above to the rest of them, but that regressed diagnostics because
expr then wasn't converted yet by the nested convert_like_real call.
So, for bad_p conversions, do the normal processing, but still return
the IMPLICIT_CONV_EXPR to avoid introducing trees that the template
processing can't handle well. This I achieved by adding a wrapper
function.
gcc/cp/ChangeLog:
PR c++/95789
PR c++/96104
PR c++/96179
* call.c (convert_like_real_1): Renamed from convert_like_real.
(convert_like_real): New wrapper for convert_like_real_1.
gcc/testsuite/ChangeLog:
PR c++/95789
PR c++/96104
PR c++/96179
* g++.dg/conversion/ref4.C: New test.
* g++.dg/conversion/ref5.C: New test.
* g++.dg/conversion/ref6.C: New test.
David Edelsohn [Tue, 14 Jul 2020 19:31:23 +0000 (15:31 -0400)]
rs6000: Don't call movsi_from_sf in 32 bit mode.
movsi_from_sf uses rldimi instruction, which will cause the compiler to ICE
in 32 bit mode. This patch limits the recently added pattern and call to
TARGET_POWERPC64.
2020-07-14 David Edelsohn <dje.gcc@gmail.com>
gcc/ChangeLog
* config/rs6000/rs6000.md (rotldi3_insert_sf): Add TARGET_POWERPC64
condition.
* config/rs6000/rs6000.c (rs6000_expand_vector_init): Add
TARGET_POWERPC64 requirement to TARGET_P8_VECTOR case.
Nathan Sidwell [Tue, 14 Jul 2020 17:49:03 +0000 (10:49 -0700)]
c++: Parser entry cleanup
The handling of PCH is a little trick, because we have to deal with it before
allocating memory. I found the layering somewhat confusing. This patch
reorganizes that, so that the stopping of PCH is done in exactly one place,
and the ordering of lexer creation relative to that is much clearer.
I also changed the error message about multiple source files as with C++20,
'modules' means something rather specific.
Other than the error message changes, no functional changes.
gcc/cp/
* parser.c (cp_lexer_alloc): Do not deal with PCH here.
(cp_lexer_new_main): Deal with PCH here. Store the tokens directly
into the buffer.
(cp_lexer_new_from_tokens): Assert last token isn't purged either.
(cp_lexer_get_preprocessor_token): Change first arg to flags, adjust.
(cp_parser_new): Pass the lexer in, don't create it here.
(cp_parser_translation_unit): Initialize access checks here.
(cp_parser_initial_pragma): First token is provided by caller,
don't deal with PCH stopping here. Adjust error message.
(c_parse_file): Adjust, change error message to avoid C++20 module
confusion.
Kwok Cheung Yeung [Tue, 14 Jul 2020 17:31:35 +0000 (10:31 -0700)]
libgomp: Fix hang when profiling OpenACC programs with CUDA 9.0 nvprof
The version of nvprof in CUDA 9.0 causes a hang when used to profile an
OpenACC program. This is because it calls acc_get_device_type from
a callback called during device initialization, which then attempts
to acquire acc_device_lock while it is already taken, resulting in
deadlock. This works around the issue by returning acc_device_none
from acc_get_device_type without attempting to acquire the lock when
initialization has not completed yet.
2020-07-14 Tom de Vries <tom@codesourcery.com>
Cesar Philippidis <cesar@codesourcery.com>
Thomas Schwinge <thomas@codesourcery.com>
Kwok Cheung Yeung <kcy@codesourcery.com>
libgomp/
* oacc-init.c (acc_init_state_lock, acc_init_state, acc_init_thread):
New variable.
(acc_init_1): Set acc_init_thread to pthread_self (). Set
acc_init_state to initializing at the start, and to initialized at the
end.
(self_initializing_p): New function.
(acc_get_device_type): Return acc_device_none if called by thread that
is currently executing acc_init_1.
* libgomp.texi (acc_get_device_type): Update documentation.
(Implementation Status and Implementation-Defined Behavior): Likewise.
* testsuite/libgomp.oacc-c-c++-common/acc_prof-init-2.c: New.
Ian Lance Taylor [Fri, 10 Jul 2020 16:34:28 +0000 (09:34 -0700)]
demangler: don't treat lambda as a substitution candidate
libiberty/ChangeLog:
PR demangler/96143
* cp-demangle.c (d_lambda): Don't add substitution candidate.
* testsuite/demangle-expected: Update a few existing test cases
accordingly, and add a new test case.
Lewis Hyatt [Tue, 14 Jul 2020 16:05:56 +0000 (12:05 -0400)]
diagnostics: Support conversion of tabs to spaces [PR49973] [PR86904]
Supports conversion of tabs to spaces when outputting diagnostics. Also
adds -fdiagnostics-column-unit and -fdiagnostics-column-origin options to
control how the column number is output, thereby resolving the two PRs.
gcc/c-family/ChangeLog:
PR other/86904
* c-indentation.c (should_warn_for_misleading_indentation): Get
global tabstop from the new source.
* c-opts.c (c_common_handle_option): Remove handling of -ftabstop, which
is now a common option.
* c.opt: Likewise.
gcc/ChangeLog:
PR preprocessor/49973
PR other/86904
* common.opt: Handle -ftabstop here instead of in c-family
options. Add -fdiagnostics-column-unit= and
-fdiagnostics-column-origin= options.
* opts.c (common_handle_option): Handle the new options.
* diagnostic-format-json.cc (json_from_expanded_location): Add
diagnostic_context argument. Use it to convert column numbers as per
the new options.
(json_from_location_range): Likewise.
(json_from_fixit_hint): Likewise.
(json_end_diagnostic): Pass the new context argument to helper
functions above. Add "column-origin" field to the output.
(test_unknown_location): Add the new context argument to calls to
helper functions.
(test_bad_endpoints): Likewise.
* diagnostic-show-locus.c
(exploc_with_display_col::exploc_with_display_col): Support
tabstop parameter.
(layout_point::layout_point): Make use of class
exploc_with_display_col.
(layout_range::layout_range): Likewise.
(struct line_bounds): Clarify that the units are now always
display columns. Rename members accordingly. Add constructor.
(layout::print_source_line): Add support for tab expansion.
(make_range): Adapt to class layout_range changes.
(layout::maybe_add_location_range): Likewise.
(layout::layout): Adapt to class exploc_with_display_col changes.
(layout::calculate_x_offset_display): Support tabstop parameter.
(layout::print_annotation_line): Adapt to struct line_bounds changes.
(layout::print_line): Likewise.
(line_label::line_label): Add diagnostic_context argument.
(get_affected_range): Likewise.
(get_printed_columns): Likewise.
(layout::print_any_labels): Adapt to struct line_label changes.
(class correction): Add m_tabstop member.
(correction::correction): Add tabstop argument.
(correction::compute_display_cols): Use m_tabstop.
(class line_corrections): Add m_context member.
(line_corrections::line_corrections): Add diagnostic_context argument.
(line_corrections::add_hint): Use m_context to handle tabstops.
(layout::print_trailing_fixits): Adapt to class line_corrections
changes.
(test_layout_x_offset_display_utf8): Support tabstop parameter.
(test_layout_x_offset_display_tab): New selftest.
(test_one_liner_colorized_utf8): Likewise.
(test_tab_expansion): Likewise.
(test_diagnostic_show_locus_one_liner_utf8): Call the new tests.
(diagnostic_show_locus_c_tests): Likewise.
(test_overlapped_fixit_printing): Adapt to helper class and
function changes.
(test_overlapped_fixit_printing_utf8): Likewise.
(test_overlapped_fixit_printing_2): Likewise.
* diagnostic.h (enum diagnostics_column_unit): New enum.
(struct diagnostic_context): Add members for the new options.
(diagnostic_converted_column): Declare.
(json_from_expanded_location): Add new context argument.
* diagnostic.c (diagnostic_initialize): Initialize new members.
(diagnostic_converted_column): New function.
(maybe_line_and_column): Be willing to output a column of 0.
(diagnostic_get_location_text): Convert column number as per the new
options.
(diagnostic_report_current_module): Likewise.
(assert_location_text): Add origin and column_unit arguments for
testing the new functionality.
(test_diagnostic_get_location_text): Test the new functionality.
* doc/invoke.texi: Document the new options and behavior.
* input.h (location_compute_display_column): Add tabstop argument.
* input.c (location_compute_display_column): Likewise.
(test_cpp_utf8): Add selftests for tab expansion.
* tree-diagnostic-path.cc (default_tree_make_json_for_path): Pass the
new context argument to json_from_expanded_location().
libcpp/ChangeLog:
PR preprocessor/49973
PR other/86904
* include/cpplib.h (struct cpp_options): Removed support for -ftabstop,
which is now handled by diagnostic_context.
(class cpp_display_width_computation): New class.
(cpp_byte_column_to_display_column): Add optional tabstop argument.
(cpp_display_width): Likewise.
(cpp_display_column_to_byte_column): Likewise.
* charset.c
(cpp_display_width_computation::cpp_display_width_computation): New
function.
(cpp_display_width_computation::advance_display_cols): Likewise.
(compute_next_display_width): Removed and implemented this
functionality in a new function...
(cpp_display_width_computation::process_next_codepoint): ...here.
(cpp_byte_column_to_display_column): Added tabstop argument.
Reimplemented in terms of class cpp_display_width_computation.
(cpp_display_column_to_byte_column): Likewise.
* init.c (cpp_create_reader): Remove handling of -ftabstop, which is now
handled by diagnostic_context.
gcc/testsuite/ChangeLog:
PR preprocessor/49973
PR other/86904
* c-c++-common/Wmisleading-indentation-3.c: Adjust expected output
for new defaults.
* c-c++-common/Wmisleading-indentation.c: Likewise.
* c-c++-common/diagnostic-format-json-1.c: Likewise.
* c-c++-common/diagnostic-format-json-2.c: Likewise.
* c-c++-common/diagnostic-format-json-3.c: Likewise.
* c-c++-common/diagnostic-format-json-4.c: Likewise.
* c-c++-common/diagnostic-format-json-5.c: Likewise.
* c-c++-common/missing-close-symbol.c: Likewise.
* g++.dg/diagnostic/bad-binary-ops.C: Likewise.
* g++.dg/parse/error4.C: Likewise.
* g++.old-deja/g++.brendan/crash11.C: Likewise.
* g++.old-deja/g++.pt/overload2.C: Likewise.
* g++.old-deja/g++.robertl/eb109.C: Likewise.
* gcc.dg/analyzer/malloc-paths-9.c: Likewise.
* gcc.dg/bad-binary-ops.c: Likewise.
* gcc.dg/format/branch-1.c: Likewise.
* gcc.dg/format/pr79210.c: Likewise.
* gcc.dg/plugin/diagnostic-test-expressions-1.c: Likewise.
* gcc.dg/plugin/diagnostic-test-string-literals-1.c: Likewise.
* gcc.dg/redecl-4.c: Likewise.
* gfortran.dg/diagnostic-format-json-1.F90: Likewise.
* gfortran.dg/diagnostic-format-json-2.F90: Likewise.
* gfortran.dg/diagnostic-format-json-3.F90: Likewise.
* go.dg/arrayclear.go: Add a comment explaining why adding a
comment was necessary to work around a dejagnu bug.
* c-c++-common/diagnostic-units-1.c: New test.
* c-c++-common/diagnostic-units-2.c: New test.
* c-c++-common/diagnostic-units-3.c: New test.
* c-c++-common/diagnostic-units-4.c: New test.
* c-c++-common/diagnostic-units-5.c: New test.
* c-c++-common/diagnostic-units-6.c: New test.
* c-c++-common/diagnostic-units-7.c: New test.
* c-c++-common/diagnostic-units-8.c: New test.
Nathan Sidwell [Tue, 14 Jul 2020 15:19:36 +0000 (08:19 -0700)]
c++: tree dumper
A couple of C++ nodes were unknown to the tree dumper.
gcc/cp/
* ptree.c (cxx_print_type): Add TYPEOF_TYPE and BASES.
Nathan Sidwell [Tue, 14 Jul 2020 15:11:13 +0000 (08:11 -0700)]
c++: Refactor some class fns
Storing CLASSTYPE_AS_BASE in a local variable makes some code clearer
(and textually no longer). For some reason we store a DECL in a variable
called 'value', which is confusing.
gcc/cp/
* class.c (build_base_field_1): Cache CLASSTYPE_AS_BASE.
(build_self_reference): Rename value -> decl.
(dump_class_hierarchy_1): Cache CLASSTYPE_AS_BASE.
David Edelsohn [Mon, 13 Jul 2020 18:43:39 +0000 (14:43 -0400)]
aix: FAT libraries: test native compiler mode directly
The FAT libraries config fragments need to know which library is native
and which is a multilib to choose the correct multilib from which to
append the additional object file or shared object file. Testing the
top-level archive is fragile because it will fail if rebuilding. This
patch tests the compiler preprocessing macros for the 64 bit AIX specific
__64BIT__ to determine the native mode of the compiler in MULTILIBTOP.
2020-07-14 David Edelsohn <dje.gcc@gmail.com>
libatomic/ChangeLog
* config/t-aix: Set BITS from compiler cpp macro.
libgcc/ChangeLog
* config/rs6000/t-slibgcc-aix: Set BITS from compiler cpp macro.
libgfortran/ChangeLog
* config/t-aix: Set BITS from compiler cpp macro.
libgomp/ChangeLog
* config/t-aix: Set BITS from compiler cpp macro.
libstdc++-v3/ChangeLog
* config/os/aix/t-aix: Set BITS from compiler cpp macro.
Tobias Burnus [Tue, 14 Jul 2020 14:28:37 +0000 (16:28 +0200)]
Fix goacc/finalize-1.f tree dump-scanning for -m32
gcc/testsuite/ChangeLog:
* gfortran.dg/goacc/finalize-1.f: Relax scan-tree-dump-times
pattern to work on 32bit-pointer systems.
David Edelsohn [Sat, 11 Jul 2020 23:42:56 +0000 (19:42 -0400)]
testsuite: adapt g++.dg/ipa/pr83667.C for AIX
The current testsuite regex looks for THUNK0. AIX generates THUNK..0.
This patch expands the regex to allow 0 or more dots between THUNK
and the 0.
gcc/testsuite/ChangeLog
2020-07-14 David Edelsohn <dje.gcc@gmail.com>
* g++.dg/ipa/pr83667.C: Allow 0 or more dots between THUNK and 0.
Jakub Jelinek [Tue, 14 Jul 2020 14:01:11 +0000 (16:01 +0200)]
expr: Unbreak build of mesa [PR96194]
> > The store to the whole of each volatile object was picked apart
> > like there had been an individual assignment to each of the
> > fields. Reads were added as part of that; see PR for details.
> > The reads from volatile memory were a clear bug; individual
> > stores questionable. A separate patch clarifies the docs.
This breaks building of mesa on both the trunk and 10 branch.
The problem is that the middle-end may never create temporaries of non-POD
(TREE_ADDRESSABLE) types, those can be only created when the language says
so and thus only the FE is allowed to create those.
This patch just reverts the behavior to what we used to do before for the
stores to volatile non-PODs. Perhaps we want to do something else, but
definitely we can't create temporaries of the non-POD type. It is up to
discussions on what should happen in those cases.
2020-07-14 Jakub Jelinek <jakub@redhat.com>
PR middle-end/96194
* expr.c (expand_constructor): Don't create temporary for store to
volatile MEM if exp has an addressable type.
* g++.dg/opt/pr96194.C: New test.
Marek Polacek [Wed, 24 Jun 2020 21:39:21 +0000 (17:39 -0400)]
c++: Improve checking of decls with trailing return type [PR95820]
This is an ICE-on-invalid but I've been seeing it when reducing
various testcases, so it's more important for me than usually.
splice_late_return_type now checks that if we've seen a late return
type, the function return type was auto. That's a fair assumption
but grokdeclarator/cdk_function wasn't giving errors for function
pointers and similar. So we want to perform various checks not only
when funcdecl_p || inner_declarator == NULL. But only give the
!late_return_type errors when funcdecl_p, to accept e.g.
auto (*fp)() = f;
in C++11. Here's a diff -w to ease the review:
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -12102,14 +12102,9 @@ grokdeclarator (const cp_declarator *declarator,
/* Handle a late-specified return type. */
tree late_return_type = declarator->u.function.late_return_type;
- if (funcdecl_p
- /* This is the case e.g. for
- using T = auto () -> int. */
- || inner_declarator == NULL)
- {
if (tree auto_node = type_uses_auto (type))
{
- if (!late_return_type)
+ if (!late_return_type && funcdecl_p)
{
if (current_class_type
&& LAMBDA_TYPE_P (current_class_type))
@@ -12201,7 +12196,6 @@ grokdeclarator (const cp_declarator *declarator,
"type specifier", name);
return error_mark_node;
}
- }
type = splice_late_return_type (type, late_return_type);
if (type == error_mark_node)
return error_mark_node;
gcc/cp/ChangeLog:
PR c++/95820
* decl.c (grokdeclarator) <case cdk_function>: Check also
pointers/references/... to functions.
gcc/testsuite/ChangeLog:
PR c++/95820
* g++.dg/cpp1y/auto-fn58.C: New test.
Nathan Sidwell [Tue, 14 Jul 2020 13:08:44 +0000 (06:08 -0700)]
core: formatting & comment
One of hash_map's getters returns a pointer to T or null, The comment
said it returned T or null. Also an unaligned pair of comments.
gcc/
* hash-map.h (hash_map::get): Note it is a pointer to value.
* incpath.h (incpath_kind): Align comments.
Nathan Sidwell [Tue, 14 Jul 2020 12:57:57 +0000 (05:57 -0700)]
c++: Comments & formatting
I found some bad formatting and misleading or incomplete comments
during my spelunking around the c++FE. May as well clean up trunk and
record what I noted.
gcc/cp/
* cp-tree.h: Correct some tree lang flag comments,
reformat some structure definitions. Note some structure
sizes. Clarify some comments.
(yyungetc): Delete. Not been a thing for some time.
* class.c (copy_fndecl_with_name): Comment.
(check_bases_and_members): Unnecessary {}.
(layout_class_type): Comment.
* cp-tree.def (UNBOUND_CLASS_TEMPLATE): Adjust comment.
* decl.c: Fix some formatting & whitespace issues.
(function_requirements_equivalent_p): Note why
substitutions are needed.
* decl2.c (no_linkage_error): Note that heroics about
'typedef struct { ... };' are no longer needed.
* method.c: Whitespace.
* name-lookup.c: Whitespace.
(add_decl_to_level): Reformat a line.
(print_binding_stack): Mark as DEBUG_FUNCTION.
(has_using_namespace_std_directive_p): Delete comment.
* pt.c: Whitespace
* ptree.c: Whitespace.
* rtti.c: Whitespace & comment.
* tree.c: Comment.
* typeck.c (structural_comptypes): Add comment.
Nathan Sidwell [Mon, 13 Jul 2020 20:52:03 +0000 (13:52 -0700)]
core: add tree-node comments
As we've moved to 64-bit systems, the padding information has become
conditionally inaccurate. I also hit cases where invalid tree codes
did not get flagged as invalid.
gcc/
* tree-core.h (tree_decl_with_vis, tree_function_decl):
Note additional padding on 64-bits
* tree.c (cache_integer_cst): Note why no caching of enum literals.
(get_tree_code_name): Robustify error case.
Nathan Sidwell [Mon, 13 Jul 2020 20:42:52 +0000 (13:42 -0700)]
doc: Fix some typos
gty calls gt_clear*e*_cache not gt_clear_cache. I know not why it is
named so, but at least document it correctly. invoke.texi had a duplicate opindex.
gcc/
* doc/gty.texi: Fic gt_cleare_cache name.
* doc/invoke.texi: Remove duplicate opindex Wabi-tag.
Mark Eggleston [Thu, 11 Jun 2020 10:05:40 +0000 (11:05 +0100)]
Fortran : ICE in gfc_check_pointer_assign PR95612
Output an error if the right hand value is a zero sized array or
does not have a symbol tree otherwise continue checking.
2020-07-14 Steven G. Kargl <kargl@gcc.gnu.org>
gcc/fortran/
PR fortran/95612
* expr.c (gfc_check_pointer_assigb): Output an error if
rvalue is a zero sized array or output an error if rvalue
doesn't have a symbol tree.
2020-07-14 Mark Eggleston <markeggleston@gcc.gnu.org>
gcc/testsuite/
PR fortran/95612
* gfortran.dg/pr95612.f90: New test.
Tobias Burnus [Tue, 14 Jul 2020 11:39:46 +0000 (13:39 +0200)]
[OpenMP, Fortran] Add structure/derived-type element mapping
gcc/fortran/ChangeLog:
* openmp.c (gfc_match_omp_clauses): Match also derived-type
component refs in OMP_CLAUSE_MAP.
(resolve_omp_clauses): Resolve those.
* trans-openmp.c (gfc_trans_omp_array_section, gfc_trans_omp_clauses):
Handle OpenMP structure-element mapping.
(gfc_trans_oacc_construct, gfc_trans_oacc_executable_directive,
(gfc_trans_oacc_combined_directive, gfc_trans_oacc_declare): Update
add openacc=true in gfc_trans_omp_clauses call.
gcc/testsuite/ChangeLog:
* gfortran.dg/goacc/finalize-1.f: Update dump scan pattern.
* gfortran.dg/gomp/map-1.f90: Update dg-error.
* gfortran.dg/gomp/map-2.f90: New test.
libgomp/ChangeLog:
* testsuite/libgomp.fortran/struct-elem-map-1.f90: New test.
Tobias Burnus [Tue, 14 Jul 2020 10:55:53 +0000 (12:55 +0200)]
[Fortran, OpenMP] Fix allocatable-components check (PR67311)
gcc/fortran/ChangeLog:
PR fortran/67311
* trans-openmp.c (gfc_has_alloc_comps): Return false also for
pointers to arrays.
libgomp/ChangeLog:
PR fortran/67311
* testsuite/libgomp.fortran/target-map-1.f90: New test.
Jakub Jelinek [Tue, 14 Jul 2020 08:31:59 +0000 (10:31 +0200)]
openmp: Adjust outer bounds of non-rect loops
In loops like:
#pragma omp parallel for collapse(2)
for (i = -4; i < 8; i++)
for (j = 3 * i; j > 2 * i; j--)
for some outer loop iterations there are no inner loop iterations at all,
the condition is false. In order to use Summæ Potestate to count number
of iterations or to transform the logical iteration number to actual
iterator values using quadratic non-equation root discovery the outer
iterator range needs to be adjusted, such that the inner loop has at least
one iteration for each of the outer loop iterator value in the reduced
range. Sometimes this adjustment is done at the start of the range,
at other times at the end.
This patch implements it during the compile time number of loop computation
(if all expressions are compile time constants).
2020-07-14 Jakub Jelinek <jakub@redhat.com>
* omp-general.h (struct omp_for_data): Add adjn1 member.
* omp-general.c (omp_extract_for_data): For non-rect loop, punt on
count computing if n1, n2 or step are not INTEGER_CST earlier.
Narrow the outer iterator range if needed so that non-rect loop
has at least one iteration for each outer range iteration. Compute
adjn1.
* omp-expand.c (expand_omp_for_init_vars): Use adjn1 if non-NULL
instead of the outer loop's n1.
* testsuite/libgomp.c/loop-21.c: New test.
Matthias Klose [Tue, 14 Jul 2020 08:12:08 +0000 (10:12 +0200)]
LTO: pick up -fcf-protection flag for the link step
2020-07-14 Matthias Klose <doko@ubuntu.com>
PR lto/95604
* lto-wrapper.c (merge_and_complain): Add decoded options as parameter,
error on different values for -fcf-protection.
(append_compiler_options): Pass -fcf-protection option.
(find_and_merge_options): Add decoded options as parameter,
pass decoded_options to merge_and_complain.
(run_gcc): Pass decoded options to find_and_merge_options.
* lto-opts.c (lto_write_options): Pass -fcf-protection option.
Mark Eggleston [Mon, 6 Jul 2020 06:14:59 +0000 (07:14 +0100)]
Fortran : Implicitly type parameter causes an invalid error PR96038
If a paramter to declared and initialised before its type is
declared a bogus error is output at the type declaration
idicating that initialisation is missing.
2020-07-14 Steven G. Kargl <kargl@gcc.gnu.org>
gcc/fortran/
PR fortran/96038
* decl.c (add_init_expr_sym): For a symbol that is a
parameter accept an initialisation if it does not have a
value otherwise output a error and reject.
2020-07-14 Mark Eggleston <markeggleston@gcc.gnu.org>
gcc/testsuite/
PR fortran/96038
* gfortran.dg/pr96038.f90: New test.
GCC Administrator [Tue, 14 Jul 2020 00:16:30 +0000 (00:16 +0000)]
Daily bump.
Alan Modra [Mon, 13 Jul 2020 23:49:43 +0000 (09:19 +0930)]
Merge sibcall_local32/64
This patch consolidates four insn patterns into two.
* config/rs6000/rs6000.md (sibcall_local): Merge sibcall_local32
and sibcall_local64.
(sibcall_value_local): Similarly.
Aaron Sawdey [Mon, 13 Jul 2020 21:19:33 +0000 (16:19 -0500)]
rs6000: clean up testsuite power10_hw check
Because the check for power10_hw is not called
check_effective_target_power10_hw, it needs to be looked
for by is-effective-target-keyword. Also reorder things
in is-effective-target to put power10_hw with the other
ppc stuff.
gcc/testsuite/
* lib/target-supports.exp (is-effective-target):
Reorder to put powerpc stuff together.
(is-effective-target-keyword): Add power10_hw.
Nathan Sidwell [Mon, 13 Jul 2020 20:37:46 +0000 (13:37 -0700)]
testsuite: scan-lang-dump-times & scan-lang-dump-not
Sigh, last week's success at not breaking things failed with an
incorrect 'fix' this morning. Let's reduce my confusion by making
lib/scanlang.exp the same on trunk as modules.
gcc/testsuite/
* lib/scanlang.exp (scan-lang-dump): Fix breakage.
(scan-lang-dump-times, scan-lang-dump-not): New.
Nathan Sidwell [Mon, 13 Jul 2020 20:17:20 +0000 (13:17 -0700)]
Remove long-gone cxxmain.c from makefiles
I discovered we were attempting to delete some no-longer generated
files.
gcc/
* Makefile.in (distclean): Remove long gone cxxmain.c
gcc/cp/
* Make-lang.in (c++.disclean): Likewise.
Aaron Sawdey [Fri, 10 Jul 2020 22:46:17 +0000 (17:46 -0500)]
rs6000: add effective-target test ppc_mma_hw
Add a test for dejagnu to determine if execution of MMA instructions is
supported in the test environment. Add an execution test to make sure
that __builtin_cpu_supports("mma") is true if we can execute MMA
instructions.
gcc/testsuite/
* lib/target-supports.exp (check_ppc_mma_hw_available):
New function.
(is-effective-target): Add ppc_mma_hw.
(is-effective-target-keyword): Add ppc_mma_hw.
* gcc.target/powerpc/mma-supported.c: New file.
* gcc.target/powerpc/mma-single-test.c: Require ppc_mma_hw.
* gcc.target/powerpc/mma-double-test.c: Require ppc_mma_hw.
H.J. Lu [Mon, 13 Jul 2020 17:33:47 +0000 (10:33 -0700)]
x86: Pass a copy of the string length to cmpstrnqi
cmpstrnsi expander may pass the actual string length directly to cmpstrnqi
patterns. For cmpstrnsi, one of the strings must be a constant and
expand_builtin_strncmp rewrites the length argument to be the minimum of
the const string length and the actual string length. But it is not the
case for cmpmemsi. Pass a copy of the string length to cmpstrnqi patterns
to avoid changing the actual string length by cmpstrnqi patterns.
gcc/
PR target/95443
* config/i386/i386.md (cmpstrnsi): Pass a copy of the string
length to cmpstrnqi patterns.
gcc/testsuite/
PR target/95443
* gcc.target/i386/pr95443-1.c: New test.
* gcc.target/i386/pr95443-2.c: Likewise.
Marek Polacek [Mon, 13 Jul 2020 17:05:06 +0000 (13:05 -0400)]
c++: Add test [PR95288]
Somewhat improved by r11-2064, though we still generate junk that seems
redundant. But at least it says
error: expected ‘}’ before ‘.’ token
PR c++/95288
* g++.dg/diagnostic/enum2.C: New test.
Jakub Jelinek [Mon, 13 Jul 2020 16:25:53 +0000 (18:25 +0200)]
ipa-fnsummary: Fix ICE with switch predicates [PR96130]
The following testcase ICEs since r10-3199.
There is a switch with default label, where the controlling expression has
range just 0..7 and there are case labels for all those 8 values, but
nothing has yet optimized away the default.
Since r10-3199, set_switch_stmt_execution_predicate sets the switch to
default label's edge's predicate to a false predicate and then
compute_bb_predicates propagates the predicates through the cfg, but false
predicates aren't really added. The caller of compute_bb_predicates
in one place handles NULL bb->aux as false predicate:
if (fbi.info)
{
if (bb->aux)
bb_predicate = *(predicate *) bb->aux;
else
bb_predicate = false;
}
else
bb_predicate = true;
but then in two further spots that the patch below is changing
it assumes bb->aux must be non-NULL. Those two spots are guarded by a
condition that is only true if fbi.info is non-NULL, so I think the right
fix is to treat NULL aux as false predicate in those spots too.
2020-07-13 Jakub Jelinek <jakub@redhat.com>
PR ipa/96130
* ipa-fnsummary.c (analyze_function_body): Treat NULL bb->aux
as false predicate.
* gcc.dg/torture/pr96130.c: New test.
Mark Eggleston [Wed, 10 Jun 2020 06:22:50 +0000 (07:22 +0100)]
Fortran : accepts pointer initialization of DT dummy args PR45337
Initialisation of a variable results in an implicit save attribute
being added to the variable. The save attribute is not allowed for
variables with the dummy attribute set. Initialisation should be
rejected for dummy variables.
2020-07-13 Mark Eggleston <markeggleston@gcc.gnu.org>
gcc/fortran/
PR fortran/45337
* resolve.c (resolve_fl_variable): Remove type and intent
checks from the check for dummy.
2020-07-13 Mark Eggleston <markeggleston@gcc.gnu.org>
gcc/testsuite/
PR fortran/45337
* gfortran.dg/pr45337_1.f90: New test.
* gfortran.dg/pr45337_2.f90: New test.
Marek Polacek [Fri, 10 Jul 2020 00:44:05 +0000 (20:44 -0400)]
c++: Fix tentative parsing of enum-specifier [PR96077]
Here's an interesting issue: in this code a ) is missing:
enum { E = (2 } e;
but we compile the code anyway, and E is set to 0 in build_enumerator,
which is sneaky.
The problem is that cp_parser_enum_specifier parses tentatively, because
when we see the enum keyword, we don't know yet if we'll find an
enum-specifier, opaque-enum-declaration, or elaborated-enum-specifier.
In this test when we call cp_parser_enumerator_list we're still parsing
tentatively, and as a consequence, parens.require_close (parser) in
cp_parser_primary_expression doesn't report any errors. But we only go
on to parse the enumerator-list after we've seen a {, at which point we
might as well commit -- we know we're dealing with an enum-specifier.
gcc/cp/ChangeLog:
PR c++/96077
* parser.c (cp_parser_enum_specifier): Commit to tentative parse
after we've seen an opening brace.
gcc/testsuite/ChangeLog:
PR c++/96077
* g++.dg/parse/enum14.C: New test.
Nathan Sidwell [Mon, 13 Jul 2020 15:04:26 +0000 (08:04 -0700)]
testsuite: Fix scan-lang-dump-not
turned out scan-lang-dump-not was broken in the 3 argument case -- I'd missed a
necessary empty arg. Fixed thusly.
gcc/testsuite/
* lib/scanlang.exp (scan-lang-dump-not): Fix 3-arg case.
Richard Biener [Mon, 13 Jul 2020 10:41:35 +0000 (12:41 +0200)]
tree-optimization/96163 - fix placement issue with SLP and vectors
This avoids placing stmts beyond the vectorizer region begin which
confuses vect_stmt_dominates_stmt_p.
2020-07-13 Richard Biener <rguenther@suse.de>
PR tree-optimization/96163
* tree-vect-slp.c (vect_schedule_slp_instance): Put new stmts
at least after region begin.
* g++.dg/vect/pr96163.cc: New testcase.
Mark Eggleston [Tue, 30 Jun 2020 09:15:05 +0000 (10:15 +0100)]
Fortran : ICE in gfc_find_array_ref(): No ref found PR95981
When looking for an array reference allow NULL references. If
no array reference is found dim_rank_check should return false.
2020-07-13 Steven G. Kargl <kargl@gcc.gnu.org>
gcc/fortran/
PR fortran/95981
* check.c (dim_rank_check): Allow NULL references in call to
gfc_find_array_ref and return false if no reference is found.
2020-07-13 Mark Eggleston <markeggleston@gcc.gnu.org>
gcc/testsuite/
PR fortran/95981
* gfortran.dg/pr95981.f90: New test.
Szabolcs Nagy [Thu, 2 Jul 2020 15:11:04 +0000 (16:11 +0100)]
aarch64: Add missing ACLE support for PAC-RET
Define the __ARM_FEATURE_PAC_DEFAULT feature test
macro when PAC-RET branch protection is enabled.
2020-07-13 Szabolcs Nagy <szabolcs.nagy@arm.com>
gcc/ChangeLog:
* config/aarch64/aarch64-c.c (aarch64_update_cpp_builtins): Add
__ARM_FEATURE_PAC_DEFAULT support.
Szabolcs Nagy [Thu, 28 May 2020 09:28:30 +0000 (10:28 +0100)]
doc: Clarify __builtin_return_address [PR94891]
The expected semantics and valid usage of __builtin_return_address is
not clear since it exposes implementation internals that are normally
not meaningful to portable c code.
This documentation change tries to clarify the semantics in case the
return address is stored in a mangled form. This affects AArch64 when
pointer authentication is used for the return address signing (i.e.
-mbranch-protection=pac-ret).
2020-07-13 Szabolcs Nagy <szabolcs.nagy@arm.com>
gcc/ChangeLog:
PR target/94891
* doc/extend.texi: Update the text for __builtin_return_address.
Szabolcs Nagy [Thu, 4 Jun 2020 08:33:35 +0000 (09:33 +0100)]
libgcc: fix the handling of return address mangling [PR94891]
Mangling, currently only used on AArch64 for return address signing,
is an internal representation that should not be exposed via
__builtin_return_address return value,
__builtin_eh_return handler argument,
_Unwind_DebugHook handler argument.
Note that a mangled address might not even fit into a void *, e.g.
with AArch64 ilp32 ABI the return address is stored as 64bit, so
the mangled return address cannot be accessed via _Unwind_GetPtr.
This patch changes the unwinder hooks as follows:
MD_POST_EXTRACT_ROOT_ADDR is removed: root address comes from
__builtin_return_address which is not mangled.
MD_POST_EXTRACT_FRAME_ADDR is renamed to MD_DEMANGLE_RETURN_ADDR,
it now operates on _Unwind_Word instead of void *, so the hook
should work when return address signing is enabled on AArch64 ilp32.
(But for that __builtin_aarch64_autia1716 should be fixed to operate
on 64bit input instead of a void *.)
MD_POST_FROB_EH_HANDLER_ADDR is removed: it is the responsibility of
__builtin_eh_return to do the mangling if necessary.
2020-07-13 Szabolcs Nagy <szabolcs.nagy@arm.com>
libgcc/ChangeLog:
PR target/94891
* config/aarch64/aarch64-unwind.h (MD_POST_EXTRACT_ROOT_ADDR): Remove.
(MD_POST_FROB_EH_HANDLER_ADDR): Remove.
(MD_POST_EXTRACT_FRAME_ADDR): Rename to ...
(MD_DEMANGLE_RETURN_ADDR): This.
(aarch64_post_extract_frame_addr): Rename to ...
(aarch64_demangle_return_addr): This.
(aarch64_post_frob_eh_handler_addr): Remove.
* unwind-dw2.c (uw_update_context): Demangle return address.
(uw_frob_return_addr): Remove.
Szabolcs Nagy [Thu, 4 Jun 2020 12:42:16 +0000 (13:42 +0100)]
aarch64: fix __builtin_eh_return with pac-ret [PR94891]
Currently __builtin_eh_return takes a signed return address, which can
cause ABI and API issues: 1) pointer representation problems if the
address is passed around before eh return, 2) the source code needs
pac-ret specific changes and needs to know if pac-ret is used in the
current frame, 3) signed address may not be representible as void *
(with ilp32 abi).
Using address signing to protect eh return is ineffective because the
instruction sequence in the unwinder that starts from the address
signing and ends with a ret can be used as a return to anywhere gadget.
Using indirect branch istead of ret with bti j landing pads at the
target can reduce the potential of such gadget, which also implies
that __builtin_eh_return should not take a signed address.
This is a big hammer fix to the ABI and API issues: it turns pac-ret
off for the caller completely (not just on the eh return path). To
harden the caller against ROP attacks, it should use indirect branch
instead of ret, this is not attempted so the patch remains small and
backportable.
2020-07-13 Szabolcs Nagy <szabolcs.nagy@arm.com>
gcc/ChangeLog:
PR target/94891
* config/aarch64/aarch64.c (aarch64_return_address_signing_enabled):
Disable return address signing if __builtin_eh_return is used.
gcc/testsuite/ChangeLog:
PR target/94891
* gcc.target/aarch64/return_address_sign_1.c: Update test.
* gcc.target/aarch64/return_address_sign_b_1.c: Likewise.
Szabolcs Nagy [Tue, 2 Jun 2020 15:44:41 +0000 (16:44 +0100)]
aarch64: fix return address access with pac [PR94891][PR94791]
This is a big hammer fix for __builtin_return_address (PR target/94891)
returning signed addresses (sometimes, depending on wether lr happens
to be signed or not at the time of call which depends on optimizations),
and similarly -pg may pass signed return address to _mcount
(PR target/94791).
At the time of return address expansion we don't know if it's signed or
not so it is done unconditionally.
2020-07-13 Szabolcs Nagy <szabolcs.nagy@arm.com>
gcc/ChangeLog:
PR target/94891
PR target/94791
* config/aarch64/aarch64-protos.h (aarch64_return_addr_rtx): Declare.
* config/aarch64/aarch64.c (aarch64_return_addr_rtx): New.
(aarch64_return_addr): Use aarch64_return_addr_rtx.
* config/aarch64/aarch64.h (PROFILE_HOOK): Likewise.
Richard Sandiford [Mon, 13 Jul 2020 12:47:39 +0000 (13:47 +0100)]
ipa-devirt: Fix crash in obj_type_ref_class [PR95114]
The testcase has failed since r9-5035, because obj_type_ref_class
tries to look up an ODR type when no ODR type information is
available. (The information was available earlier in the
compilation, but was freed during pass_ipa_free_lang_data.)
We then crash dereferencing the null get_odr_type result.
The test passes with -O2. However, it fails again if -fdump-tree-all
is used, since obj_type_ref_class is called indirectly from the
dump routines.
Other code creates ODR type entries on the fly by passing “true”
as the insert parameter. But obj_type_ref_class can't do that
unconditionally, since it should have no side-effects when used
from the dumping code.
Following a suggestion from Honza, this patch adds parameters
to say whether the routines are being called from dump routines
and uses those to derive the insert parameter.
gcc/
PR middle-end/95114
* tree.h (virtual_method_call_p): Add a default-false parameter
that indicates whether the function is being called from dump
routines.
(obj_type_ref_class): Likewise.
* tree.c (virtual_method_call_p): Likewise.
* ipa-devirt.c (obj_type_ref_class): Likewise. Lazily add ODR
type information for the type when the parameter is false.
* tree-pretty-print.c (dump_generic_node): Update calls to
virtual_method_call_p and obj_type_ref_class accordingly.
gcc/testsuite/
PR middle-end/95114
* g++.target/aarch64/pr95114.C: New test.
Jonathan Wakely [Mon, 13 Jul 2020 09:26:39 +0000 (10:26 +0100)]
libstdc++: Fix istream::ignore exit conditions (PR 94749, PR 96161)
My previous fix for PR 94749 did fix the reported case, so that the next
character is not discarded if it happens to equal the delimiter when __n
characters have already been read. But it introduced a new bug, which is
that the delimiter character would *not* be discarded if the number of
characters discarded is numeric_limits<streamsize>::max() or more before
reaching the delimiter.
The new bug happens because I changed the code to check _M_gcount < __n.
But when __n == numeric_limits<streamsize>::max() that is false, and so
we don't discard the delimiter. It's not sufficient to check for the
delimiter when the __large_ignore condition is true, because there's an
edge case where the delimiter is reached when _M_gcount == __n and so
we break out of the loop without setting __large_ignore.
PR 96161 is a similar bug to the original PR 94749 report, where eofbit
is set after discarding __n characters if there happen to be no more
characters in the stream.
This patch fixes both cases (and the regression) by checking different
conditions for the __n == max case and the __n < max case. For the
former case, we know that we must have either reached the delimiter or
EOF, and the value of _M_gcount doesn't matter (except to avoid integer
overflow). For the latter case we need to check _M_gcount first and only
set eofbit or discard the delimiter if it didn't reach __n. For the
latter case overflow can't happen because _M_gcount <= __n < max.
libstdc++-v3/ChangeLog:
PR libstdc++/94749
PR libstdc++/96161
* include/bits/istream.tcc (basic_istream::ignore(streamsize))
[n == max]: Check overflow conditions on _M_gcount. Rely on
the fact that either EOF or the delimiter was reached.
[n < max]: Check _M_gcount < n before checking for EOF or
delimiter.
(basic_istream::ignore(streamsize, char_type): Likewise.
* src/c++98/compatibility.cc (istream::ignore(streamsize))
(wistream::ignore(streamsize)): Likewise.
* src/c++98/istream.cc (istream::ignore(streamsize, char_type))
(wistream::ignore(streamsize, char_type)): Likewise.
* testsuite/27_io/basic_istream/ignore/char/94749.cc: Check that
delimiter is discarded if the number of characters ignored
doesn't fit in streamsize.
* testsuite/27_io/basic_istream/ignore/wchar_t/94749.cc:
Likewise.
* testsuite/27_io/basic_istream/ignore/char/96161.cc: New test.
* testsuite/27_io/basic_istream/ignore/wchar_t/96161.cc: New test.
Julian Brown [Fri, 5 Jun 2020 21:46:41 +0000 (14:46 -0700)]
openacc: Don't strip TO_PSET/POINTER for enter/exit data
OpenACC 2.6 specifies that the array descriptor (when present) must be
copied to the target before attaching pointers in Fortran. This patch
reverses the stripping of GOMP_MAP_TO_PSET and GOMP_MAP_POINTER that
was introduced by the "OpenACC reference count overhaul" patch.
2020-07-10 Julian Brown <julian@codesourcery.com>
Thomas Schwinge <thomas@codesourcery.com>
gcc/
* gimplify.c (gimplify_scan_omp_clauses): Do not strip
GOMP_MAP_TO_PSET/GOMP_MAP_POINTER for OpenACC enter/exit data
directives (see also PR92929).
gcc/testsuite/
* gfortran.dg/goacc/finalize-1.f: Update expected dump output.
libgomp/
* testsuite/libgomp.oacc-fortran/dynamic-pointer-1.f90: New test.
Co-Authored-By: Thomas Schwinge <thomas@codesourcery.com>
Richard Biener [Mon, 13 Jul 2020 09:41:16 +0000 (11:41 +0200)]
fix global variable alignment for testcase gcc.dg/torture/pr96133.c
The testcase was errorneously accessing the global variable via a
type that might require bigger alignment than provided. Fix that
via an appropriate attribute.
2020-07-13 Richard Biener <rguenther@suse.de>
PR testsuite/96180
* gcc.dg/torture/pr96133.c: Align global variable.
Roger Sayle [Mon, 13 Jul 2020 08:49:34 +0000 (09:49 +0100)]
middle-end: Remove truly_noop_truncation check from convert.c
This patch eliminates a check of targetm.truly_noop_truncation from
the early middle-end, where the gimple/generic being generated by
GCC's front-ends is being inappropriately influenced by the target's
TRULY_NOOP_TRUNCATION. The (recent) intention of TRULY_NOOP_TRUNCATION
is to indicate that a backend requires explicit truncation instructions
rather than using SUBREGs to perform truncations. A long standing
(and probably unintentional) side-effect has been that this setting
also controls whether the middle-end narrows integer operations at
the tree-level. Understandably, GCC and its testsuite assume that
GIMPLE and GENERIC behave consistently across platforms, and alas
defining TRULY_NOOP_TRUNCATION away from the default triggers several
regressions (including gcc.dg/fold-rotate-1.c).
2020-07-13 Roger Sayle <roger@nextmovesoftware.com>
gcc/ChangeLog
* convert.c (convert_to_integer_1): Narrow integer operations
even on targets that require explicit truncation instructions.
Hans-Peter Nilsson [Sun, 12 Jul 2020 16:41:25 +0000 (18:41 +0200)]
cris: Add new pass eliminating compares after delay-slot-filling
Delayed-branch-slot-filling a.k.a. reorg or dbr, often causes
opportunities for more compare-elimination than were visible for
the cmpelim pass. With cc0, these were caught by the
elimination pass run in "final", thus the missed opportunities
is a regression. A simple reorg-aware pass run just after reorg
handles most of them, if not all. I chose to keep the "mach2"
pass identifier string I copy-pasted from the SPARC port instead
of inventing one like "postdbr_cmpelim". Note the gap in numbers
in the test-case file names.
gcc:
PR target/93372
* config/cris/cris-passes.def: New file.
* config/cris/t-cris (PASSES_EXTRA): Add cris-passes.def.
* config/cris/cris.c: Add infrastructure bits and pass execute
function cris_postdbr_cmpelim.
* config/cris/cris-protos.h (make_pass_cris_postdbr_cmpelim): Declare.
gcc/testsuite:
* gcc.target/cris/pr93372-44.c, gcc.target/cris/pr93372-46.c: New.
Hans-Peter Nilsson [Fri, 10 Jul 2020 02:44:49 +0000 (04:44 +0200)]
cris: Remove config/cris/t-cris gt-cris.h cargo
Getting tired of:
make[1]: Entering directory 'x/gccobj/gcc'
Makefile:2682: warning: overriding recipe for target 'gt-cris.h'
xx/gcc/gcc/config/cris/t-cris:29: warning: ignoring old recipe for target 'gt-cris.h'
I'm just going to assume it is just stale cruft no longer (if
ever) needed since nothing else but sh/t-sh has it, and the
commit log shows just (x prepended to avoid commit-log parsing
confusion):
x Merge from pch-branch up to tag pch-commit-
20020603.
x
x From-SVN: r54232
Building "works better"; the related warning is gone.
This effectively empties the t-cris file, but stuff will be
added soon enough that it's kept around.
gcc:
* config/cris/t-cris: Remove gt-cris.h-related excessive cargo.
Hans-Peter Nilsson [Wed, 8 Jul 2020 21:59:12 +0000 (23:59 +0200)]
cris: Use addi.b for additions where flags aren't inspected
Comparing to the cc0 version of the CRIS port, I ran a few
microbenchmarks, for example gcc.c-torture/execute/arith-rand.c,
where there's sometimes an addition between an operation of
interest and the test on the result.
Unfortunately this patch doesn't remedy all the performance
regression for that program. But, this patch by itself helps
and makes sense to commit separately: lots of addi.b in
previously empty delay-slots, with functions shortened by one or
a few insns, in libgcc. I had an experience with the
reload-related caveat of % on constraints, which is "fixed"
documentationwise since long (soon 15 years ago;
be3914df4cc8/r105517). I removed an even older related FIXME.
gcc:
PR target/93372
* config/cris/cris.md ("*add<mode>3_addi"): New splitter.
("*addi_b_<mode>"): New pattern.
("*addsi3<setnz>"): Remove stale %-related comment.
gcc/testsuite:
PR target/93372
* gcc.target/cris/pr93372-45.c: New test.
Hans-Peter Nilsson [Sun, 12 Jul 2020 19:58:58 +0000 (21:58 +0200)]
cris: Correct output templates in define_subst patterns.
Whoops. This little gem had the effect of making the output
operand (0) constraints disappear but not the input operand (1)
constraints for define_subst:ed patterns, probably because
there's another (match_dup 1) in the output template (not
investigated).
That went surprisingly unnoticed until I added a pass leaning
just a little bit harder on the define_subst:ed patterns and
then only by the libgfortran library generating assembly with
nominally incorrect syntax. (There was a move to a special
register from a general register, and it incorrectly matched a
pattern affecting condition codes.)
gcc:
* config/cris/cris.md ("setnz_subst", "setnz_subst", "setcc_subst"):
Use match_dup in output template, not match_operand.
Richard Biener [Fri, 10 Jul 2020 09:58:41 +0000 (11:58 +0200)]
make var-tracking iteration consistent
This eliminates the visited bitmap and makes whether a to be processed
block goes to the next or the current iteration only depend on its
position in RPO order rather than on whether it was visited in the
current iteration. As optimization single-BB iteration is processed
immediately.
2020-07-10 Richard Biener <rguenther@suse.de>
* var-tracking.c (bb_heap_node_t): Remove unused typedef.
(vt_find_locations): Eliminate visited bitmap in favor of
RPO order check. Dump statistics about the number of
local BB dataflow computes.
Hans-Peter Nilsson [Sun, 5 Jul 2020 18:50:52 +0000 (20:50 +0200)]
PR94600: fix volatile access to the whole of a compound object.
The store to the whole of each volatile object was picked apart
like there had been an individual assignment to each of the
fields. Reads were added as part of that; see PR for details.
The reads from volatile memory were a clear bug; individual
stores questionable. A separate patch clarifies the docs.
gcc:
2020-07-09 Richard Biener <rguenther@suse.de>
PR middle-end/94600
* expr.c (expand_constructor): Make a temporary also if we're
storing to volatile memory.
gcc/testsuite:
2020-07-09 Hans-Peter Nilsson <hp@axis.com>
PR middle-end/94600
* gcc.dg/pr94600-1.c, gcc.dg/pr94600-2.c, gcc.dg/pr94600-3.c,
gcc.dg/pr94600-4.c, gcc.dg/pr94600-5.c, gcc.dg/pr94600-6.c,
gcc.dg/pr94600-7.c, gcc.dg/pr94600-8.c: New tests.
Xionghu Luo [Mon, 13 Jul 2020 01:22:56 +0000 (20:22 -0500)]
rs6000: Define define_insn_and_split to split unspec sldi+or to rldimi
Combine pass could recognize the pattern defined and split it in split1,
this patch could optimize:
21: r130:DI=r133:DI<<0x20
11: {r129:DI=zero_extend(unspec[[r145:DI]] 87);clobber scratch;}
22: r134:DI=r130:DI|r129:DI
to
21: {r149:DI=zero_extend(unspec[[r145:DI]] 87);clobber scratch;}
22: r134:DI=r149:DI&0xffffffff|r133:DI<<0x20
rldimi is generated instead of sldi+or.
gcc/ChangeLog:
2020-07-13 Xionghu Luo <luoxhu@linux.ibm.com>
* config/rs6000/rs6000.md (rotl_unspec): New
define_insn_and_split.
gcc/testsuite/ChangeLog:
2020-07-13 Xionghu Luo <luoxhu@linux.ibm.com>
* gcc.target/powerpc/vector_float.c: New test.
Xionghu Luo [Mon, 13 Jul 2020 01:21:05 +0000 (20:21 -0500)]
rs6000: Init V4SF vector without converting SP to DP
Move V4SF to V4SI, init vector like V4SI and move to V4SF back.
Better instruction sequence could be generated on Power9:
lfs + xxpermdi + xvcvdpsp + vmrgew
=>
lwz + (sldi + or) + mtvsrdd
With the patch followed, it could be continue optimized to:
lwz + rldimi + mtvsrdd
The point is to use lwz to avoid converting the single-precision to
double-precision upon load, pack four 32-bit data into one 128-bit
register directly.
gcc/ChangeLog:
2020-07-13 Xionghu Luo <luoxhu@linux.ibm.com>
* config/rs6000/rs6000.c (rs6000_expand_vector_init):
Move V4SF to V4SI, init vector like V4SI and move to V4SF back.
GCC Administrator [Mon, 13 Jul 2020 00:16:22 +0000 (00:16 +0000)]
Daily bump.
H.J. Lu [Fri, 10 Jul 2020 21:50:03 +0000 (14:50 -0700)]
x86: Require Linux target for PR target/93492 tests
Since -fpatchable-function-entry is only supported on Linux and used by
Linux kernel, require Linux target for PR target/93492 tests.
PR target/93492
* gcc.target/i386/pr93492-1.c: Require Linux target.
* gcc.target/i386/pr93492-2.c: Likewise.
* gcc.target/i386/pr93492-3.c: Likewise.
* gcc.target/i386/pr93492-4.c: Likewise.
* gcc.target/i386/pr93492-5.c: Likewise.
GCC Administrator [Sun, 12 Jul 2020 00:16:23 +0000 (00:16 +0000)]
Daily bump.
Ian Lance Taylor [Fri, 10 Jul 2020 20:43:09 +0000 (13:43 -0700)]
compiler: avoid generating unnamed bool type descriptor
We were generating it in cases where a boolean expression was
converted directly to an empty interface type.
Fixes golang/go#40152
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/242002
Ian Lance Taylor [Fri, 10 Jul 2020 17:28:34 +0000 (10:28 -0700)]
compiler: handle aliases to pointer types with interfaces
Test case is https://golang.org/cl/241997.
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/241998
Roger Sayle [Sat, 11 Jul 2020 19:03:39 +0000 (20:03 +0100)]
middle-end: Improve RTL expansion in expand_mul_overflow,
This patch improves the RTL that the middle-end generates for testing
signed overflow following a widening multiplication. During this
expansion the middle-end generates a truncation which can get used
multiple times. Placing this intermediate value in a pseudo register
reduces the amount of code generated on platforms where this truncation
requires an explicit instruction.
2020-07-11 Roger Sayle <roger@nextmovesoftware.com>
gcc/ChangeLog:
* internal-fn.c (expand_mul_overflow): When checking for signed
overflow from a widening multiplication, we access the truncated
lowpart RES twice, so keep this value in a pseudo register.
Thomas Koenig [Sat, 11 Jul 2020 17:16:16 +0000 (19:16 +0200)]
Fix ICE on warning with new interface check.
In the test case, there was a warning about INTENT where an EXTERNAL
masked an interface in an outer scope, when the location of the
symbol was not set, leading to an ICE.
Two problems, two-part solution: It makes no sense to warn about
INTENT for artificially generated formal argument lists, and the
location should be set.
gcc/fortran/ChangeLog:
PR fortran/96073
* frontend-passes.c (check_externals_procedure): Add locus
information for new_sym.
* interface.c (gfc_check_dummy_characteristics): Do not warn
about INTENT for artificially generated variables.
gcc/testsuite/ChangeLog:
PR fortran/96073
* gfortran.dg/interface_48.f90: New test.
David Edelsohn [Sat, 11 Jul 2020 15:37:56 +0000 (11:37 -0400)]
ChangeLog: add missing Bugzilla PR.
Richard Sandiford [Sat, 11 Jul 2020 12:25:26 +0000 (13:25 +0100)]
value-range: Fix handling of POLY_INT_CST anti-ranges [PR96146]
The range infrastructure has code to decompose POLY_INT_CST ranges
to worst-case integer bounds. However, it had the fundamental flaw
(obvious in hindsight) that it applied to anti-ranges too, meaning
that a range 2+2X would end up with a range of ~[2, +INF], i.e.
[-INF, 1]. This patch decays to varying in that case instead.
I'm still a bit uneasy about this. ISTM that in terms of
generality:
SSA_NAME => POLY_INT_CST => INTEGER_CST
=> ADDR_EXPR
I.e. an SSA_NAME could store a POLY_INT_CST and a POLY_INT_CST
could store an INTEGER_CST (before canonicalisation). POLY_INT_CST
is also “as constant as” ADDR_EXPR (well, OK, only some ADDR_EXPRs
are run-time rather than link-time constants, whereas all POLY_INT_CSTs
are, but still). So it seems like we should at least be able to treat
POLY_INT_CST as symbolic. On the other hand, I don't have any examples
in which that would be useful.
gcc/
PR tree-optimization/96146
* value-range.cc (value_range::set): Only decompose POLY_INT_CST
bounds to integers for VR_RANGE. Decay to VR_VARYING for anti-ranges
involving POLY_INT_CSTs.
gcc/testsuite/
PR tree-optimization/96146
* gcc.target/aarch64/sve/acle/general/pr96146.c: New test.
Simon Cook [Fri, 10 Jul 2020 13:53:19 +0000 (14:53 +0100)]
RISC-V: Fix regular expression in target-specific test
Some square brackets were missing escape characters, causing DejaGnu to
try and call a proc with the name "at".
gcc/testsuite/ChangeLog:
* gcc.target/riscv/read-thread-pointer.c: Fix escaping on
regular expression.
GCC Administrator [Sat, 11 Jul 2020 00:16:31 +0000 (00:16 +0000)]
Daily bump.
David Edelsohn [Fri, 10 Jul 2020 21:06:21 +0000 (17:06 -0400)]
aix: only create named section for VAR_DECL or FUNCTION_DECL
get_constant_section() can be passed constant-like non-DECLs, such as
CONSTRUCTOR or STRING_CST, which make DECL_SECTION_NAME unhappy
(asserted in symtab_node::get). This patch ensures that xcoff select
section only invokes resolve_unique_section() for DECLs.
gcc/ChangeLog
2020-07-10 David Edelsohn <dje.gcc@gmail.com>
* config/rs6000/rs6000.c (rs6000_xcoff_select_section): Only
create named section for VAR_DECL or FUNCTION_DECL.
Joseph Myers [Fri, 10 Jul 2020 21:35:51 +0000 (21:35 +0000)]
c: Add C2X BOOL_MAX and BOOL_WIDTH to limits.h
C2X adds BOOL_MAX and BOOL_WIDTH macros to <limits.h>. As GCC only
supports values 0 and 1 for _Bool (regardless of the number of bits in
the representation, other bits are padding bits and if any of them are
nonzero, the representation is a trap representation), the values of
those macros can just be hardcoded directly in <limits.h> rather than
needing corresponding predefined macros.
Bootstrapped with no regressions on x86_64-pc-linux-gnu.
gcc/
* glimits.h [__STDC_VERSION__ > 201710L] (BOOL_MAX, BOOL_WIDTH):
New macros.
gcc/testsuite/
* gcc.dg/c11-bool-limits-1.c, gcc.dg/c2x-bool-limits-1.c: New
tests.
Aaron Sawdey [Tue, 30 Jun 2020 19:26:26 +0000 (14:26 -0500)]
rs6000: Add execution tests for mma builtins [v4]
This patch adds execution tests that use the MMA builtins and
check for the right answer, and new tests that checks whether
__builtin_cpu_supports and __builtin_cpu_is return sane
answers for power10.
2020-06-30 Rajalakshmi Srinivasaraghavan <rajis@linux.vnet.ibm.com>
Aaron Sawdey <acsawdey@linux.ibm.com>
gcc/testsuite/
* gcc.target/powerpc/p10-identify.c: New file.
* gcc.target/powerpc/p10-arch31.c: New file.
* gcc.target/powerpc/mma-single-test.c: New file.
* gcc.target/powerpc/mma-double-test.c: New file.
Alexander Popov [Fri, 10 Jul 2020 20:10:16 +0000 (14:10 -0600)]
Improve shrink wrapping debug output
Currently if requires_stack_frame_p() returns true for some insn, the
shrink-wrapping debug output contains only the number of a block containing
that insn.
But it is very useful to see the particular insn that requires the prologue.
Let's call print_rtl_single to display that insn in the following pass dump.
gcc/
* shrink-wrap.c (try_shrink_wrapping): Improve debug output.
Mike Nolta [Fri, 10 Jul 2020 20:05:41 +0000 (14:05 -0600)]
This is a harmless bug, as the script still works, but curl's '-O' option isn't the same as wget's.
contrib/ChangeLog:
* download_prerequisites: Don't pass wget options to curl.
Harald Anlauf [Fri, 10 Jul 2020 19:35:35 +0000 (21:35 +0200)]
PR fortran/95980 - ICE in get_unique_type_string, at fortran/class.c:485
In SELECT TYPE, the argument may be an incorrectly specified unlimited
CLASS variable. Avoid NULL pointer dereferences for clean error
recovery.
gcc/fortran/
PR fortran/95980
* class.c (gfc_add_component_ref, gfc_build_class_symbol):
Add checks for NULL pointer dereference.
* primary.c (gfc_variable_attr): Likewise.
* resolve.c (resolve_variable, resolve_assoc_var)
(resolve_fl_var_and_proc, resolve_fl_variable_derived)
(resolve_symbol): Likewise.
Harald Anlauf [Fri, 10 Jul 2020 19:00:13 +0000 (21:00 +0200)]
PR fortran/96086 - ICE in gfc_match_select_rank, at fortran/match.c:6645
Handle NULL pointer dereference on SELECT RANK with an invalid
assumed-rank array declaration.
gcc/fortran/
PR fortran/96086
* match.c (gfc_match_select_rank): Catch NULL pointer
dereference.
* resolve.c (resolve_assoc_var): Catch NULL pointer dereference
that may occur after an illegal declaration.
Ian Lance Taylor [Fri, 10 Jul 2020 17:51:40 +0000 (10:51 -0700)]
libgo: update to Go 1.14.4 release
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/241999
Richard Sandiford [Fri, 10 Jul 2020 18:06:46 +0000 (19:06 +0100)]
expr: Move reduce_bit_field target mode check [PR96151]
In some cases, expand_expr_real_2 prefers to use the mode of the
caller-suggested target instead of the mode of the expression when
passing values to reduce_to_bit_field_precision. E.g.:
else if (target == 0)
op0 = convert_to_mode (mode, op0,
TYPE_UNSIGNED (TREE_TYPE
(treeop0)));
else
{
convert_move (target, op0,
TYPE_UNSIGNED (TREE_TYPE (treeop0)));
op0 = target;
}
where “op0” might not have “mode” for the “else” branch,
but does for all the others.
reduce_to_bit_field_precision discards the suggested target if it
has the wrong mode. This patch moves that to expand_expr_real_2
instead (conditional on reduce_bit_field).
gcc/
PR middle-end/96151
* expr.c (expand_expr_real_2): When reducing bit fields,
clear the target if it has a different mode from the expression.
(reduce_to_bit_field_precision): Don't do that here. Instead
assert that the target already has the correct mode.
Richard Sandiford [Fri, 10 Jul 2020 18:06:45 +0000 (19:06 +0100)]
arm: Treat GNU and Advanced SIMD vectors as distinct [PR92789, PR95726]
This is an arm version of aarch64 patch r11-1741. The approach
is essentially identical, not much more than s/aarch64/arm/.
To recap, PR95726 is about template look-up for things like:
foo<float vecf __attribute__((vector_size(16)))>
foo<float32x4_t>
The immediate cause of the problem is that the hash function usually
returns different hashes for these types, yet the equality function
thinks they are equal. This then raises the question of how the types
are supposed to be treated.
The answer we chose for AArch64 was that the GNU vector type should
be treated as distinct from float32x4_t, but that each type should
implicitly convert to the other.
This would mean that, as far as the PR is concerned, the hashing
function is right to (sometimes) treat the types differently and
the equality function is wrong to treat them as the same.
The most obvious way to enforce the type difference is to use a
target-specific type attribute. That on its own is enough to fix
the PR. The difficulty is deciding whether the knock-on effects
are acceptable.
One obvious effect is that GCC then rejects:
typedef float vecf __attribute__((vector_size(16)));
vecf x;
float32x4_t &z = x;
on the basis that the types are no longer reference-compatible.
For AArch64 we took the approach that this was the correct behaviour.
It is also consistent with current Clang.
A trickier question is whether:
vecf x;
float32x4_t y;
… c ? x : y …
should be valid, and if so, what its type should be [PR92789].
As explained in the comment in the testcase, GCC and Clang both
accepted this, but GCC chose the “then” type while Clang chose
the “else” type. This can lead to different mangling for (probably
artificial) corner cases, as seen for “sel1” and “sel2” in the
testcase.
Adding the attribute makes GCC reject the conditional expression
as ambiguous. For AArch64 we took the approach that this too is
the correct behaviour, for the reasons described in the testcase.
However, it does seem to have the potential to break existing code.
gcc/
PR target/92789
PR target/95726
* config/arm/arm.c (arm_attribute_table): Add
"Advanced SIMD type".
(arm_comp_type_attributes): Check that the "Advanced SIMD type"
attributes are equal.
* config/arm/arm-builtins.c: Include stringpool.h and
attribs.h.
(arm_mangle_builtin_vector_type): Use the mangling recorded
in the "Advanced SIMD type" attribute.
(arm_init_simd_builtin_types): Add an "Advanced SIMD type"
attribute to each Advanced SIMD type, using the mangled type
as the attribute's single argument.
gcc/testsuite/
PR target/92789
PR target/95726
* g++.target/arm/pr95726.C: New test.
Carl Love [Thu, 9 Jan 2020 19:37:18 +0000 (13:37 -0600)]
RS6000, add VSX mask manipulation support
gcc/ChangeLog
2020-07-09 Carl Love <cel@us.ibm.com>
* config/rs6000/vsx.md (VSX_MM): New define_mode_iterator.
(VSX_MM4): New define_mode_iterator.
(vec_mtvsrbmi): New define_insn.
(vec_mtvsr_<mode>): New define_insn.
(vec_cntmb_<mode>): New define_insn.
(vec_extract_<mode>): New define_insn.
(vec_expand_<mode>): New define_insn.
(define_c_enum unspec): Add entries UNSPEC_MTVSBM, UNSPEC_VCNTMB,
UNSPEC_VEXTRACT, UNSPEC_VEXPAND.
* config/rs6000/altivec.h ( vec_genbm, vec_genhm, vec_genwm,
vec_gendm, vec_genqm, vec_cntm, vec_expandm, vec_extractm): Add
defines.
* config/rs6000/rs6000-builtin.def: Add defines BU_P10_2, BU_P10_1.
(BU_P10_1): Add definitions for mtvsrbm, mtvsrhm, mtvsrwm,
mtvsrdm, mtvsrqm, vexpandmb, vexpandmh, vexpandmw, vexpandmd,
vexpandmq, vextractmb, vextractmh, vextractmw, vextractmd, vextractmq.
(BU_P10_2): Add definitions for cntmbb, cntmbh, cntmbw, cntmbd.
(BU_P10_OVERLOAD_1): Add definitions for mtvsrbm, mtvsrhm,
mtvsrwm, mtvsrdm, mtvsrqm, vexpandm, vextractm.
(BU_P10_OVERLOAD_2): Add defition for cntm.
* config/rs6000/rs6000-call.c (rs6000_expand_binop_builtin): Add
checks for CODE_FOR_vec_cntmbb_v16qi, CODE_FOR_vec_cntmb_v8hi,
CODE_FOR_vec_cntmb_v4si, CODE_FOR_vec_cntmb_v2di.
(altivec_overloaded_builtins): Add overloaded argument entries for
P10_BUILTIN_VEC_MTVSRBM, P10_BUILTIN_VEC_MTVSRHM,
P10_BUILTIN_VEC_MTVSRWM, P10_BUILTIN_VEC_MTVSRDM,
P10_BUILTIN_VEC_MTVSRQM, P10_BUILTIN_VEC_VCNTMBB,
P10_BUILTIN_VCNTMBB, P10_BUILTIN_VCNTMBH,
P10_BUILTIN_VCNTMBW, P10_BUILTIN_VCNTMBD,
P10_BUILTIN_VEXPANDMB, P10_BUILTIN_VEXPANDMH,
P10_BUILTIN_VEXPANDMW, P10_BUILTIN_VEXPANDMD,
P10_BUILTIN_VEXPANDMQ, P10_BUILTIN_VEXTRACTMB,
P10_BUILTIN_VEXTRACTMH, P10_BUILTIN_VEXTRACTMW,
P10_BUILTIN_VEXTRACTMD, P10_BUILTIN_VEXTRACTMQ.
(builtin_function_type): Add case entries for P10_BUILTIN_MTVSRBM,
P10_BUILTIN_MTVSRHM, P10_BUILTIN_MTVSRWM, P10_BUILTIN_MTVSRDM,
P10_BUILTIN_MTVSRQM, P10_BUILTIN_VCNTMBB, P10_BUILTIN_VCNTMBH,
P10_BUILTIN_VCNTMBW, P10_BUILTIN_VCNTMBD,
P10_BUILTIN_VEXPANDMB, P10_BUILTIN_VEXPANDMH,
P10_BUILTIN_VEXPANDMW, P10_BUILTIN_VEXPANDMD,
P10_BUILTIN_VEXPANDMQ.
* config/rs6000/rs6000-builtin.def (altivec_overloaded_builtins): Add
entries for MTVSRBM, MTVSRHM, MTVSRWM, MTVSRDM, MTVSRQM, VCNTM,
VEXPANDM, VEXTRACTM.
gcc/testsuite/ChangeLog
2020-07-09 Carl Love <cel@us.ibm.com>
* gcc.target/powerpc/vsx_mask-count-runnable.c: New test case.
* gcc.target/powerpc/vsx_mask-expand-runnable.c: New test case.
* gcc.target/powerpc/vsx_mask-extract-runnable.c: New test case.
* gcc.target/powerpc/vsx_mask-move-runnable.c: New test case.
Julian Brown [Fri, 22 May 2020 11:06:10 +0000 (04:06 -0700)]
openacc: Adjust dynamic reference count semantics
This patch adjusts how dynamic reference counts work so that they match
the semantics of the source program more closely, instead of representing
"excess" reference counts beyond those that represent pointers in the
internal libgomp splay-tree data structure. This allows some corner
cases to be handled more gracefully.
2020-07-10 Julian Brown <julian@codesourcery.com>
Thomas Schwinge <thomas@codesourcery.com>
libgomp/
* libgomp.h (struct splay_tree_key_s): Change virtual_refcount to
dynamic_refcount.
(struct gomp_device_descr): Remove GOMP_MAP_VARS_OPENACC_ENTER_DATA.
* oacc-mem.c (acc_map_data): Substitute virtual_refcount for
dynamic_refcount.
(acc_unmap_data): Update comment.
(goacc_map_var_existing, goacc_enter_datum): Adjust for
dynamic_refcount semantics.
(goacc_exit_datum_1, goacc_exit_datum): Re-add some error checking.
Adjust for dynamic_refcount semantics.
(goacc_enter_data_internal): Implement "present" case of dynamic
memory-map handling here. Update "non-present" case for
dynamic_refcount semantics.
(goacc_exit_data_internal): Use goacc_exit_datum_1.
* target.c (gomp_map_vars_internal): Remove
GOMP_MAP_VARS_OPENACC_ENTER_DATA handling. Update for dynamic_refcount
handling.
(gomp_unmap_vars_internal): Remove virtual_refcount handling.
(gomp_load_image_to_device): Substitute dynamic_refcount for
virtual_refcount.
* testsuite/libgomp.oacc-c-c++-common/pr92843-1.c: Remove XFAILs.
* testsuite/libgomp.oacc-c-c++-common/refcounting-1.c: New test.
* testsuite/libgomp.oacc-c-c++-common/refcounting-2.c: New test.
* testsuite/libgomp.oacc-c-c++-common/struct-3-1-1.c: New test.
* testsuite/libgomp.oacc-fortran/deep-copy-6.f90: Remove XFAILs and
trace output.
* testsuite/libgomp.oacc-fortran/deep-copy-6-no_finalize.F90: Remove
trace output.
* testsuite/libgomp.oacc-fortran/dynamic-incr-structural-1.f90: New
test.
* testsuite/libgomp.oacc-c-c++-common/structured-dynamic-lifetimes-4.c:
Remove stale comment.
* testsuite/libgomp.oacc-fortran/mdc-refcount-1-1-1.f90: Remove XFAILs.
* testsuite/libgomp.oacc-fortran/mdc-refcount-1-1-2.F90: Likewise.
* testsuite/libgomp.oacc-fortran/mdc-refcount-1-2-1.f90: Likewise.
* testsuite/libgomp.oacc-fortran/mdc-refcount-1-2-2.f90: Likewise.
* testsuite/libgomp.oacc-fortran/mdc-refcount-1-3-1.f90: Likewise.
* testsuite/libgomp.oacc-fortran/mdc-refcount-1-4-1.f90: Adjust XFAIL.
Co-Authored-By: Thomas Schwinge <thomas@codesourcery.com>
Julian Brown [Tue, 30 Jun 2020 09:15:56 +0000 (02:15 -0700)]
openacc: Helper functions for enter/exit data using single mapping
This patch factors out the parts of goacc_enter_datum and
goacc_exit_datum that can be shared with goacc_enter_data_internal
and goacc_exit_data_internal respectively (in the next patch),
without overloading function return values or complicating code paths
unnecessarily.
2020-07-10 Julian Brown <julian@codesourcery.com>
Thomas Schwinge <thomas@codesourcery.com>
libgomp/
* oacc-mem.c (goacc_map_var_existing): New function.
(goacc_enter_datum): Use above function.
(goacc_exit_datum_1): New function.
(goacc_exit_datum): Use above function.
Co-Authored-By: Thomas Schwinge <thomas@codesourcery.com>
Bill Seurer, 507-253-3502, seurer@us.ibm.com [Thu, 9 Jul 2020 21:41:38 +0000 (16:41 -0500)]
rs6000: Fix __builtin_altivec_mask_for_load to use correct type
gcc/ChangeLog:
PR target/95581
* config/rs6000/rs6000-call.c: Add new type v16qi_ftype_pcvoid.
(altivec_init_builtins) Change __builtin_altivec_mask_for_load to use
v16qi_ftype_pcvoid with correct number of parameters.