]> git.ipfire.org Git - thirdparty/gcc.git/log
thirdparty/gcc.git
4 years agoAdd TODOs in README.native_coarrays.
Thomas Koenig [Wed, 23 Dec 2020 13:14:25 +0000 (14:14 +0100)] 
Add TODOs in README.native_coarrays.

libgfortran/ChangeLog:

* caf_shared/README.native_coarrays:

4 years agoAdd offset to allocatable shared coarrays.
Thomas Koenig [Wed, 23 Dec 2020 10:40:00 +0000 (11:40 +0100)] 
Add offset to allocatable shared coarrays.

This adds the calculation of the offset for allocatable coarrays,
which was missing before, and fixes the resulting fallout for
ALLOCATED.  Additionally, it prepares the way for STAT and ERRMSG
for ALLOCATE of coarrays, but that still needs changes to
gfc_trans_allocate.

gcc/fortran/ChangeLog:

* trans-array.c (gfc_conv_array_ref): If se->address_only is set,
throw away all the offset calculation.
(gfc_allocate_shared_coarray): Add arguments stat, errmsg and
errlen to call to allocate.  Calculate offset for allocatable
coarrays.
(gfc_array_allocate): Adjust call to gfc_allocate_shared_coarray.
* trans-array.h (gfc_allocate_shared_coarray): Change prototype
of cas_coarray_alloc.
* trans-decl.c (gfc_build_builtin_function_decls): Adjust
cas_coarray_alloc to changed prototypes.
(gfc_trans_shared_coarray): Adjust call to gfc_allocate_shared_coarray.
* trans-intrinsic.c (gfc_conv_allocated): Set address_only on se.
* trans.h: Add flag address_only to gfc_se.

libgfortran/ChangeLog:

* caf_shared/wrapper.c (cas_coarray_alloc): Add status, error and
errmsg arguments and their checking.

4 years agoMade the ALLOCATED intrinsic work with scalar coarrays.
Thomas Koenig [Sun, 20 Dec 2020 19:38:10 +0000 (20:38 +0100)] 
Made the ALLOCATED intrinsic work with scalar coarrays.

gcc/fortran/ChangeLog:

* trans-array.c (gfc_conv_array_ref): Whitespace fix. Do not
add offset if se->no_impl_this_image is set.
* trans-intrinsic.c (gfc_conv_allocated): Set
no_imp_this_image if checking the allocation status of
a scalar.
* trans.h (gfc_se): Add no_impl_this_image flag.

gcc/testsuite/ChangeLog:

* gfortran.dg/caf-shared/scalar_alloc_1.f90: New test.
* gfortran.dg/caf-shared/scalar_alloc_2.f90: New test.

4 years agoSet DECL_ARTIFICIAL on gfortran internal variables.
Thomas Koenig [Sun, 20 Dec 2020 15:27:01 +0000 (16:27 +0100)] 
Set DECL_ARTIFICIAL on gfortran internal variables.

It seems we sometimes use DECL_ARTIFICIAL as choosing between
different code paths.  In order not to make -fdebug-aux-vars
do different things, set DECL_ARTIFICIAL on the variables to
avoid these different code paths (and the corresponding
regressions).

gcc/fortran/ChangeLog:

* trans.c (create_var_debug_raw): Set DECL_ARTIFICIAL
on variables.

(cherry picked from commit 8d76c007afe4c70f51fd56b0e5b89522de5de61f)

4 years agoFix allocation with source for coarrays.
Thomas Koenig [Sun, 20 Dec 2020 15:34:41 +0000 (16:34 +0100)] 
Fix allocation with source for coarrays.

gcc/fortran/ChangeLog:

* resolve.c (gfc_expr_to_initialize): Check for coarrays only
if the reference is right.
* trans-array.c (gfc_array_allocate): If SOURCE has a size,
use it.

4 years agoMake allocate with source work, some more offset fixes for implied this_image().
Thomas Koenig [Sat, 19 Dec 2020 19:49:03 +0000 (20:49 +0100)] 
Make allocate with source work, some more offset fixes for implied this_image().

gcc/fortran/ChangeLog:

* options.c (gfc_post_options): Always set flag_debug_aux_vars for
shared coarrays.
* resolve.c (gfc_expr_to_initialize): Set extra dimensions to
DIMEN_THIS_IMAGE.
* trans-array.c (cas_add_strides): Re-introduce.
(cas_add_this_image_offset): Rename add_lbound to
correct_full_offset, use cas_add_strides.

gcc/testsuite/ChangeLog:

* gfortran.dg/caf-shared/alloc_coarray_with_source_1.f90: New test.
* gfortran.dg/caf-shared/cobounds_torture_1.f90: New test.
* gfortran.dg/caf-shared/cobounds_torture_2.f90: New test.
* gfortran.dg/caf-shared/cobounds_torture_3.f90: New test.

4 years agoAdd a few test cases that work for shared coarrays.
Thomas Koenig [Thu, 17 Dec 2020 21:32:02 +0000 (22:32 +0100)] 
Add a few test cases that work for shared coarrays.

gcc/testsuite/ChangeLog:

* gfortran.dg/caf-shared/coarray_13.f90: New test.
* gfortran.dg/caf-shared/get_array.f90: New test.
* gfortran.dg/caf-shared/sendget_array.f90: New test.

4 years agoSync all for allocation and deallocation of coarrays.
Thomas Koenig [Thu, 17 Dec 2020 18:58:49 +0000 (19:58 +0100)] 
Sync all for allocation and deallocation of coarrays.

gcc/fortran/ChangeLog:

* trans-stmt.c (coarray_alloc_p): New function.
(gfc_trans_allocate): If there are shared coarrays present,
call sync all.
(gfc_trans_deallocate): Likewise.

gcc/testsuite/ChangeLog:

* gfortran.dg/caf-shared/allocate_1.f90: New test.

4 years agoUse __builtin_atomic_thread_fence and implement SYNC_MEMORY.
Thomas Koenig [Thu, 17 Dec 2020 14:58:45 +0000 (15:58 +0100)] 
Use __builtin_atomic_thread_fence and implement SYNC_MEMORY.

gcc/fortran/ChangeLog:

* trans.c (gfc_trans_memory_barrier_fence): New
function.
* trans.h (gfc_trans_memory_barrier_fence): Prototype it.
* trans-stmt.c (gfc_trans_sync): For shared coarrays,
use memory fence. Don't do anything else for SYNC MEMORY.

gcc/testsuite/ChangeLog:

* gfortran.dg/caf-shared/sync_all_1.f90: New test.
* gfortran.dg/caf-shared/sync_memory_1.f90: New test.

4 years agoAdd the -fdebug-aux-vars flag to debug variables generated by Fortran.
Thomas Koenig [Tue, 15 Dec 2020 16:10:37 +0000 (17:10 +0100)] 
Add the -fdebug-aux-vars flag to debug variables generated by Fortran.

gcc/fortran/ChangeLog:

PR fortran/90207
* invoke.texi: Document -fdebug-aux-vars.
* lang.opt: Add -fdebug-aux-vars.
* trans.c (MAX_PREFIX_LEN): New macro.
(create_var_debug_raw): New function.
(gfc_create_var_np): Call create_var_debug_raw if
flag_debug_aux_vars is set.

(cherry picked from commit 662de36bf798c8c470b382015283fe3a439cdd8f)

4 years agoShow coarrays on parse tree dump, implement debug for array references.
Thomas Koenig [Sun, 13 Dec 2020 11:54:57 +0000 (12:54 +0100)] 
Show coarrays on parse tree dump, implement debug for array references.

gcc/fortran/ChangeLog:

* dump-parse-tree.c (show_array_ref): Also show coarrays.
(debug): Implement for array reference.

(cherry picked from commit 501f470267445e037614649639d17a1b32b4a9aa)

4 years agoFix handling of shared coarray indexing.
Thomas Koenig [Wed, 16 Dec 2020 20:06:09 +0000 (21:06 +0100)] 
Fix handling of shared coarray indexing.

gcc/fortran/ChangeLog:

* dependency.c: Add options.h header.
(gfc_full_array_ref_p): Coarrays only are full if the have DIMEN_STAR.
* trans-array.c (cas_add_strides): Remove.
(cas_add_this_image_offset): Reorganize.
(cas_impl_this_image_ref): Fix return for reference.
(gfc_conv_ss_descriptor): Fix handling of offset.
(gfc_conv_array_ref): Likewise.
(gfc_trans_preloop_setup): Use effective dimension.
(gfc_conv_section_startstride): Shared coarrays should be handled
like deferred arrays.
(gfc_get_dataptr_offset): Adjust call to cas_add_this_image_offset.
(gfc_conv_expr_descriptor): Adjust dimensions.
(gfc_walk_array_ref): Likewise.
* trans-types.c (gfc_sym_type): Handle shared coarrays like
allocatable arrays.
(gfc_get_derived_type): Likewise.

gcc/testsuite/ChangeLog:

* gfortran.dg/caf-shared/lower_cobound_1.f90: New test.
* gfortran.dg/caf-shared/whole_array_1.f90: New test.

4 years agoAdd caf-shared subdirectory to gfortran.dg with passing tests.
Thomas Koenig [Sun, 6 Dec 2020 12:27:19 +0000 (13:27 +0100)] 
Add caf-shared subdirectory to gfortran.dg with passing tests.

gcc/testsuite/ChangeLog:

* gfortran.dg/caf-shared/cas.exp: New file.
* gfortran.dg/caf-shared/alloc_comp_1.f90: New test.
* gfortran.dg/caf-shared/arg_passing_1.f90: New test.
* gfortran.dg/caf-shared/assign_array_1.f90: New test.
* gfortran.dg/caf-shared/atomic_1.f90: New test.
* gfortran.dg/caf-shared/coarray_40.f90: New test.
* gfortran.dg/caf-shared/codimension_2.f90: New test.
* gfortran.dg/caf-shared/codimension_2a.f90: New test.
* gfortran.dg/caf-shared/codimension_2b.f90: New test.
* gfortran.dg/caf-shared/collectives_1.f90: New test.
* gfortran.dg/caf-shared/collectives_2.f90: New test.
* gfortran.dg/caf-shared/collectives_4.f90: New test.
* gfortran.dg/caf-shared/cosubscript_1.f90: New test.
* gfortran.dg/caf-shared/data_1.f90: New test.
* gfortran.dg/caf-shared/dummy_1.f90: New test.
* gfortran.dg/caf-shared/image_index_2.f90: New test.
* gfortran.dg/caf-shared/num_images_1.f90: New test.
* gfortran.dg/caf-shared/subobject_1.f90: New test.
* gfortran.dg/caf-shared/this_image_1.f90: New test.
* gfortran.dg/caf-shared/this_image_2.f90: New test.

4 years agoYet another offset fix.
Thomas Koenig [Sun, 29 Nov 2020 19:01:33 +0000 (20:01 +0100)] 
Yet another offset fix.

4 years agoFixed the rest of the offset calculation issue.
Nicolas Koenig [Sun, 29 Nov 2020 14:01:45 +0000 (15:01 +0100)] 
Fixed the rest of the offset calculation issue.

4 years agoFix offset calculation.
Nicolas Koenig [Sun, 29 Nov 2020 13:40:31 +0000 (14:40 +0100)] 
Fix offset calculation.

4 years agoFix memory calculation in get_master.
Thomas Koenig [Sat, 28 Nov 2020 16:54:10 +0000 (17:54 +0100)] 
Fix memory calculation in get_master.

libgfortran/ChangeLog:

* caf_shared/coarraynative.c (get_master): Use correct
struct for sizeof calculation.

4 years agoUse size of correct struct in allocation for sync interface.
Thomas Koenig [Fri, 27 Nov 2020 07:14:34 +0000 (08:14 +0100)] 
Use size of correct struct in allocation for sync interface.

libgfortran/ChangeLog:

* caf_shared/counter_barrier.c (change_internal_barrier_count):
Adjust whitespace.
* caf_shared/sync.c (sync_iface_init): Use size of correct
struct.

4 years agoFix coarrays in namelist.
Thomas Koenig [Tue, 24 Nov 2020 20:51:17 +0000 (21:51 +0100)] 
Fix coarrays in namelist.

gcc/fortran/ChangeLog:

* trans-array.c (cas_array_ref): Correct assert.
* trans-io.c (cas_nml_addr_expr): New function.
(transfer_namelist_element): Call when needed.

4 years agoFix handling of coarrays with mutiple coranks.
Thomas Koenig [Sun, 22 Nov 2020 13:14:59 +0000 (14:14 +0100)] 
Fix handling of coarrays with mutiple coranks.

gcc/fortran/ChangeLog:

PR fortran/97589
* trans-array.c (gfc_add_strides): Rename to..
(cas_add_strides): Multiply strides by lbound.
(cas_add_this_image_offset): Remove "subtract" argument.  Better
comment, correct logic.
(gfc_conv_ss_descriptor): Adjust call of cas_this_image_offset.
(gfc_conv_array_ref): Likewise.
(gfc_get_dataptr_offset): Likewise.

4 years agoUse correct block for intermediate variables.
Thomas Koenig [Tue, 17 Nov 2020 21:51:26 +0000 (22:51 +0100)] 
Use correct block for intermediate variables.

gcc/fortran/ChangeLog:

* trans-array.c (gfc_array_init_size): Use correct
block for intermediate variables.

4 years agoFollow reference for determining offset.
Thomas Koenig [Mon, 16 Nov 2020 20:10:12 +0000 (21:10 +0100)] 
Follow reference for determining offset.

gcc/fortran/ChangeLog:

* trans-array.c (gfc_conv_ss_descriptor): Follow reference
for determining offset.

4 years agoRename directory from nca to caf_shared; also rename some files.
Nicolas Koenig [Sun, 15 Nov 2020 14:41:40 +0000 (15:41 +0100)] 
Rename directory from nca to caf_shared; also rename some files.

libgfortran/ChangeLog:

* nca: Rename directory to
* caf_shared: New name
* Makefile.am: Change directory name from nca to caf_shared,
nca_minmax_c to cas_collsub_c and nca_minmax to cas_collsub.
* Makefile.in: Regenerated.
* generated/nca_minmax_i1.c: Regenerated.
* generated/nca_minmax_i16.c: Regenerated.
* generated/nca_minmax_i2.c: Regenerated.
* generated/nca_minmax_i4.c: Regenerated.
* generated/nca_minmax_i8.c: Regenerated.
* generated/nca_minmax_r10.c: Regenerated.
* generated/nca_minmax_r16.c: Regenerated.
* generated/nca_minmax_r4.c: Regenerated.
* generated/nca_minmax_r8.c: Regenerated.
* generated/nca_minmax_s1.c: Regenerated.
* generated/nca_minmax_s4.c: Regenerated.
* m4/nca-minmax-s.m4: Rename to cas_collsub-s.m4. Adjust include path.
* m4/nca_minmax.m4: Rename to cas_collsub.m4. Adjust include path.

4 years agoDo not do overflow checks on allocating shared coarrays; reformatting.
Nicolas Koenig [Sun, 15 Nov 2020 11:40:05 +0000 (12:40 +0100)] 
Do not do overflow checks on allocating shared coarrays; reformatting.

gcc/fortran/ChangeLog:

PR fortran/97589
* trans-array.c (gfc_array_allocate): Do not do overflow checks
for shared coarrays.

libgfortran/ChangeLog:

* nca/alloc.c: Reformat.
* nca/allocator.c: Reformat.
* nca/coarraynative.c: Reformat.
* nca/collective_subroutine.c Reformat.
* nca/counter_barrier.c: Reformat.
* nca/hashmap.c: Reformat.
* nca/shared_memory.c: Reformat.
* nca/sync.c: Reformat.
* nca/util.c: Reformat.
* nca/wrapper.c: Reformat.

4 years agoFix test for size of memory allocation.
Thomas Koenig [Mon, 9 Nov 2020 21:22:05 +0000 (22:22 +0100)] 
Fix test for size of memory allocation.

libgfortran/ChangeLog:

        * nca/shared_memory.c (shared_memory_get_mem_with_alignment):
Fix test.

4 years agoSome naming fixes; fix handling of coarrays which are components.
Thomas Koenig [Mon, 9 Nov 2020 20:06:28 +0000 (21:06 +0100)] 
Some naming fixes; fix handling of coarrays which are components.

gcc/fortran/ChangeLog:

* resolve.c (fixup_shared_coarray_args): Symbol does not
have to have a codimension.
* trans-array.c (gfc_native_coarray_add_this_image_offset):
Rename to...
(cas_add_this_image_offset): this.
(cas_array_ref): New function.
(gfc_conv_ss_descriptor): Use it; use cas_add_this_image_offset.
(gfc_conv_array_ref): Likewise.
(gfc_native_coarray_get_allocation_type): Rename to...
(gfc_cas_get_allocation_type): this.
(gfc_allocate_native_coarray): Rename to...
(gfc_allocate_shared_coarray): this.
(gfc_array_allocate): Use new functionn names.
(gfc_get_dataptr_offset): Use cas_array_ref; fix logic.
* trans-array.h (gfc_native_coarray_get_allocation_type): Rename
prototype to...
(gfc_cas_get_allocation_type): this.
(gfc_allocate_native_coarray): Rename prototype to...
(gfc_allocate_shared_coarray): this.
* trans-decl.c (gfc_trans_native_coarray): Rename to...
(gfc_trans_shared_coarray): This. Use changed function names.
(gfc_trans_native_coarray_static): Rename to...
(gfc_trans_shared_coarray_static): this.
(gfc_trans_native_coarray_inline): Rename to...
(gfc_trans_shared_coarray_inline): this.
(gfc_trans_deferred_vars): Use new function names.
(gfc_create_module_variable): Use new function names.
* trans-stmt.c (gfc_trans_deallocate): Likewise.

4 years agoImplement stat and errmsg.
Nicolas Koenig [Sun, 8 Nov 2020 16:07:48 +0000 (17:07 +0100)] 
Implement stat and errmsg.

gcc/fortran/ChangeLog:

* trans-decl.c (gfc_sym_mangled_function_id): Whitespace fix.
(gfc_build_builtin_function_decls): Correct fn specs.
* trans-intrinsic.c (trans_argument): Re-apply fix (?)
(conv_cas_reduce): Likewise.
(conv_co_collective): Likewise.

libgfortran/ChangeLog:

* Makefile.am: Add counter_barrier.c and counter_barrier.h
* Makefile.in: Regenerate.
* generated/nca_minmax_i1.c: Regenerated.
* generated/nca_minmax_i16.c: Regenerated.
* generated/nca_minmax_i2.c: Regenerated.
* generated/nca_minmax_i4.c: Regenerated.
* generated/nca_minmax_i8.c: Regenerated.
* generated/nca_minmax_r10.c: Regenerated.
* generated/nca_minmax_r16.c: Regenerated.
* generated/nca_minmax_r4.c: Regenerated.
* generated/nca_minmax_r8.c: Regenerated.
* generated/nca_minmax_s1.c: Regenerated.
* generated/nca_minmax_s4.c: Regenerated.
* m4/nca-minmax-s.m4: Add stat and errmsg.
* m4/nca_minmax.m4: Likewise.
* nca/coarraynative.c (get_master): New function.
(test_for_cas_errors): New function.
(master_is_image_active): New function.
(master_get_num_active_images): New function.
(master_bind_active_image_barrier): New function.
(error_on_missing_images): New function.
(cas_master): New function.
* nca/collective_subroutine.c (collsub_sync): Replace pthread_barrier_wait
by counter_barrier.
(collsub_reduce_array): Add error_on_missing_images. Adjust to number of
images.
(collsub_reduce_scalar): Likewise.
(collsub_iface_init): Likewise.
* nca/collective_subroutine.h: Replace pthread_barrier_t by counter_barrier.
* nca/libcoarraynative.h: Include counter_barrier.h.  Add handling
for failed images, stat and errmsg.
* nca/sync.c (sync_all_init): Replace pthread_barrir by counter_barrier.
(sync_iface_init): Adjust handling to total_num_images.
(sync_table): Likewise.
(sync_all): LIkewise.
* nca/sync.h: Include some theaders, adjust to counter_barrier.
* nca/util.h: Add internal_proto to unpack_array_finish.
* nca/wrapper.c (cas_collsub_reduce_array): Adjust to total_num_images,
handle status and errmsg.
(cas_collsub_reduce_scalar): Likewise.
(cas_collsub_broadcast_array): Likewise.
(cas_collsub_broadcast_scalar): Likewise.
(cas_coarray_alloc): Likewise.
(cas_coarray_free): Likewise.
(cas_coarray_num_images): Likewise.
(cas_coarray_sync_all): Likewise.
(cas_sync_images): Likewise.
* nca/counter_barrier.c: New file.
* nca/counter_barrier.h: New file.

4 years agoFix two cases where -fcoarray=shared broke non-coarrays programs.
Thomas Koenig [Thu, 29 Oct 2020 20:55:16 +0000 (21:55 +0100)] 
Fix two cases where -fcoarray=shared broke non-coarrays programs.

gcc/fortran/ChangeLog:

* trans-stmt.c (gfc_trans_deallocate): Style fix. Allow for NULL
pointer in ref.
* trans-types.c (gfc_get_array_type_bounds): Explicit test for
codimen if shared coarrays are used.

4 years agoAlso add spaces to the end of fndecl specs.
Thomas Koenig [Thu, 29 Oct 2020 15:17:24 +0000 (16:17 +0100)] 
Also add spaces to the end of fndecl specs.

gcc/fortran/ChangeLog:

* trans-decl.c (gfc_build_builtin_function_decls): Also add
spaces to the end of fn specs.

4 years agoThis adds the spaces to the fndecl specs, which are now required.
Thomas Koenig [Thu, 29 Oct 2020 14:48:31 +0000 (15:48 +0100)] 
This adds the spaces to the fndecl specs, which are now required.

gcc/fortran/ChangeLog:

* trans-decl.c (gfc_build_builtin_function_decls): Add spaces to
fndecl specs for shared memory coarrays.

4 years agoMerge branch 'master' into devel/coarray_native.
Thomas Koenig [Wed, 28 Oct 2020 17:41:24 +0000 (18:41 +0100)] 
Merge branch 'master' into devel/coarray_native.

Merge into devel/coarray_native to prepare for later merging of
coarray_native with master.

4 years agoAlways include libgfortran.h first; sanitize header dependencies.
Thomas Koenig [Tue, 27 Oct 2020 17:20:57 +0000 (18:20 +0100)] 
Always include libgfortran.h first; sanitize header dependencies.

libgfortran/ChangeLog:

* nca/coarraynative.c: Do not include util.h. Remove commented
include for stdlib.h..
* nca/collective_subroutine.c: Move #include <string.h> after
other #include statement.
* nca/hashmap.c: Include shared_memory.h and allocator.h
* nca/hashmap.h: Remove includess.
* nca/libcoarraynative.h: Include only those headers which
are needed.
* nca/shared_memory.c: Do not include util.h
* nca/shared_memory.h: Do not include other headers.
* nca/sync.c: Move include of string.h after other headers.
* nca/sync.h: Remove include of shared_memory.h and alloc.h.
* nca/util.h: Do not include stdint.h and stddef.h; include
limits.h and assert.h.
* nca/wrapper.c: Remove include for sync.h, util.h and
collective_subroutine.h. Move include of string.h after other
headers.

4 years agoCorrect decls for functions which do not pass actual arguments.
Thomas Koenig [Sun, 25 Oct 2020 12:16:16 +0000 (13:16 +0100)] 
Correct decls for functions which do not pass actual arguments.

A wrong decl for findloc caused segfaults at runtime on
Darwin for ARM; however, this is only a symptom of a larger
disease: The declarations for our library functions are often
inconsistent.  This patch solves that problem for the functions
specifically for the functions for which we do not pass optional
arguments, i.e. findloc and (min|max)loc.

It works by saving the symbols of the specific functions in
gfc_intrinsic_namespace and by generating the formal argument
lists from the actual argument lists.  Because symbols are
re-used, so are the backend decls.

gcc/fortran/ChangeLog:

PR fortran/97454
* gfortran.h (gfc_symbol): Add pass_as_value flag.
(gfc_copy_formal_args_intr): Add optional argument
copy_type.
(gfc_get_intrinsic_function_symbol): Add prototype.
(gfc_find_intrinsic_symbol): Add prototype.
* intrinsic.c (gfc_get_intrinsic_function_symbol): New function.
(gfc_find_intrinsic_symbol): New function.
* symbol.c (gfc_copy_formal_args_intr): Add argument. Handle case
where the type needs to be copied from the actual argument.
* trans-intrinsic.c (remove_empty_actual_arguments): New function.
(specific_intrinsic_symbol): New function.
(gfc_conv_intrinsic_funcall): Use it.
(strip_kind_from_actual): Adjust so that the expression pointer
is set to NULL.
(gfc_conv_intrinsic_minmaxloc): Likewise.
(gfc_conv_intrinsic_minmaxval): Adjust removal of dim.
* trans-types.c (gfc_sym_type): If sym->pass_as_value is set, do
not pass by reference.

4 years agoCheck for correct type of ref before trying to handle coarrays.
Nicolas KÃnig [Sun, 25 Oct 2020 10:36:08 +0000 (11:36 +0100)] 
Check for correct type of ref before trying to handle coarrays.

gcc/fortran/ChangeLog:

PR native_coarray/97530
* trans-array.c (gfc_conv_ss_descriptor): Check for correct type
of ref before handling coarrays.

4 years agoDaily bump.
GCC Administrator [Sun, 25 Oct 2020 00:16:26 +0000 (00:16 +0000)] 
Daily bump.

4 years agoUpdate check for working assembler --gdwarf-4 option
H.J. Lu [Fri, 16 Oct 2020 12:59:51 +0000 (05:59 -0700)] 
Update check for working assembler --gdwarf-4 option

Rename HAVE_AS_WORKING_DWARF_4_FLAG to HAVE_AS_WORKING_DWARF_N_FLAG
Don't set HAVE_AS_WORKING_DWARF_N_FLAG if --gdwarf-5/--gdwarf-4 generate
an extra assembly input file in debug info from compiler generated
.debug_line or fail with the APP marker:

https://sourceware.org/bugzilla/show_bug.cgi?id=25878
https://sourceware.org/bugzilla/show_bug.cgi?id=26740
https://sourceware.org/bugzilla/show_bug.cgi?id=26778

Also replace success with dwarf4_success in the 32-bit --gdwarf-4 check.

PR bootstrap/97451
* configure.ac (HAVE_AS_WORKING_DWARF_4_FLAG): Renamed to ...
(HAVE_AS_WORKING_DWARF_N_FLAG): This.  Don't define if there is
an extra assembly input file in debug info.  Replace success
with dwarf4_success in the 32-bit --gdwarf-4 check.
* dwarf2out.c (asm_outputs_debug_line_str): Check
HAVE_AS_WORKING_DWARF_N_FLAG instead of
HAVE_AS_WORKING_DWARF_4_FLAG.
* gcc.c (ASM_DEBUG_SPEC): Likewise.
(ASM_DEBUG_OPTION_SPEC): Likewise.
* config.in: Regenerated.
* configure: Likewise.

4 years agoc++: Fix verify_ctor_sanity ICE [PR96241]
Marek Polacek [Thu, 15 Oct 2020 20:10:45 +0000 (16:10 -0400)] 
c++: Fix verify_ctor_sanity ICE [PR96241]

The code added in r10-6437 caused us to create a CONSTRUCTOR when we're
{}-initializing an aggregate.  Then we pass this new CONSTRUCTOR down to
cxx_eval_constant_expression which, if the CONSTRUCTOR isn't TREE_CONSTANT
or reduced_constant_expression_p, calls cxx_eval_bare_aggregate.  In
this case the CONSTRUCTOR wasn't reduced_constant_expression_p because
for r_c_e_p a CONST_DECL isn't good enough so it returns false.  So we
go to cxx_eval_bare_aggregate where we crash, because ctx->ctor wasn't
set up properly.  So my fix is to do so.  Since we're value-initializing,
I'm not setting CONSTRUCTOR_NO_CLEARING.  To avoid keeping a garbage
constructor around, I call free_constructor in case the evaluation did
not use it.

gcc/cp/ChangeLog:

PR c++/96241
* constexpr.c (cxx_eval_array_reference): Set up ctx->ctor if we
are initializing an aggregate.  Call free_constructor on the new
CONSTRUCTOR if it isn't returned from cxx_eval_constant_expression.

gcc/testsuite/ChangeLog:

PR c++/96241
* g++.dg/cpp0x/constexpr-96241.C: New test.
* g++.dg/cpp1y/constexpr-96241.C: New test.

4 years agoHandle undefined ranges in get_size_range.
Aldy Hernandez [Fri, 23 Oct 2020 13:54:58 +0000 (15:54 +0200)] 
Handle undefined ranges in get_size_range.

An undefined range was leaking through to the end of this function,
which leads us to use an uninitialized wide_int.

gcc/ChangeLog:

PR tree-optimization/97538
* calls.c (get_size_range): Handle undefined ranges.

gcc/testsuite/ChangeLog:

* g++.dg/pr97538.C: New test.

4 years agocgraph: move former_thunk_p out of CHECKING_P macro.
Martin Liska [Sat, 24 Oct 2020 06:41:16 +0000 (08:41 +0200)] 
cgraph: move former_thunk_p out of CHECKING_P macro.

This fixes the following failure:

ld: cgraph.o: in function `cgraph_edge::verify_corresponds_to_fndecl(tree_node*)':
gcc/cgraph.c:3067: undefined reference to `cgraph_node::former_thunk_p()'
ld: cgraph.o: in function `clone_of_p':

gcc/ChangeLog:

* cgraph.c (cgraph_node::former_thunk_p): Move out of CHECKING_P
macro.

4 years ago[RS6000] altivec style lvx/stvx addresses vs power10
Alan Modra [Fri, 23 Oct 2020 01:41:15 +0000 (12:11 +1030)] 
[RS6000] altivec style lvx/stvx addresses vs power10

gcc.target/powerpc/fold-vec-st-pixel.c and other testcases fail on
power10, generating
addi 9,5,12
rldicr 9,9,0,59
stxv 34,0(9)
rather than
addi 5,5,12
stvx 2,0,5
for an altivec lvx/stvx style address.

The problem starts with fwprop creating
(insn 9 4 0 2 (set (mem:V8HI (and:DI (plus:DI (reg/v/f:DI 121 [ vpp ])
                    (const_int 12 [0xc]))
                (const_int -16 [0xfffffffffffffff0])) [0 MEM <vector(8) short int> [(void *)_4 & -16B]+0 S16 A128])
        (reg/v:V8HI 120 [ vp1 ])) "pixel.c":6:10 1237 {vsx_movv8hi_64bit}
which is finally thrown out as invalid by lra.  lra of course does that
by reloading the entire address.

fwprop creates the invalid address due to rs6000_legitimate_address_p
trimming off the outer AND of altivec style addresses before applying
other predicates.  address_is_prefixed then allows the inner address.

Now at the time the AND stripping was added (git commit 850e8d3d56d),
rs6000_legitimate_address looked a lot simpler.  This patch allows
through just those addresses that were legitimate in those simpler
days.

* config/rs6000/rs6000.c (rs6000_legitimate_address_p): Limit
AND addressing to just lvx/stvx style addresses.

4 years ago[RS6000] Power10 ICE running gcc.target/powerpc/ppc-ne0-1.c
Alan Modra [Thu, 22 Oct 2020 00:13:09 +0000 (10:43 +1030)] 
[RS6000] Power10 ICE running gcc.target/powerpc/ppc-ne0-1.c

* config/rs6000/rs6000.md (cstore<mode>4): Don't call
rs6000_emit_int_cmove for power10 when -mno-isel.

4 years agoDaily bump.
GCC Administrator [Sat, 24 Oct 2020 00:16:29 +0000 (00:16 +0000)] 
Daily bump.

4 years agonet/http/cgi: merge upstream changes to default env vars
Nikhil Benesch [Wed, 21 Oct 2020 07:00:04 +0000 (03:00 -0400)] 
net/http/cgi: merge upstream changes to default env vars

Incorporate upstream modifications to the cgi package's set of rules
about which environment variables should be inherited by child processes
by default on each platform. In particular this permits tests to pass on
NetBSD by preserving the value of the LD_LIBRARY_PATH environment
variable.

This is a partial backport of the following upstream CLs:

    https://golang.org/cl/263802
    https://golang.org/cl/263577
    https://golang.org/cl/254740

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/264097

4 years agotestsuite: Fix -Wsizeof-array-div tests.
Marek Polacek [Fri, 23 Oct 2020 23:26:43 +0000 (19:26 -0400)] 
testsuite: Fix -Wsizeof-array-div tests.

gcc/testsuite/ChangeLog:

* c-c++-common/Wsizeof-array-div1.c: Expect certain warnings on
lp64 targets only.
* g++.dg/warn/Wsizeof-array-div2.C: Only run on lp64 targets.

4 years agoMove thunks out of cgraph_node
Jan Hubicka [Fri, 23 Oct 2020 19:44:23 +0000 (21:44 +0200)] 
Move thunks out of cgraph_node

this patch moves thunk_info out of cgraph_node into a symbol summary.
I also moved it to separate hearder file since cgraph.h became really too
fat.  I plan to contiue with similar breakup in order to cleanup interfaces
and reduce WPA memory footprint (symbol table now consumes more memory than
trees)

gcc/ChangeLog:

2020-10-23  Jan Hubicka  <hubicka@ucw.cz>

* Makefile.in: Add symtab-thunks.o
(GTFILES): Add symtab-thunks.h and symtab-thunks.cc; remove cgraphunit.c
* cgraph.c: Include symtab-thunks.h.
(cgraph_node::create_thunk): Update
(symbol_table::create_edge): Update
(cgraph_node::dump): Update
(cgraph_node::call_for_symbol_thunks_and_aliases): Update
(set_nothrow_flag_1): Update
(set_malloc_flag_1): Update
(set_const_flag_1): Update
(collect_callers_of_node_1): Update
(clone_of_p): Update
(cgraph_node::verify_node): Update
(cgraph_node::function_symbol): Update
(cgraph_c_finalize): Call thunk_info::release.
(cgraph_node::has_thunk_p): Update
(cgraph_node::former_thunk_p): Move here from cgraph.h; reimplement.
* cgraph.h (struct cgraph_thunk_info): Rename to symtab-thunks.h.
(cgraph_node): Remove thunk field; add thunk bitfield.
(cgraph_node::expand_thunk): Move to symtab-thunks.h
(symtab_thunks_cc_finalize): Declare.
(cgraph_node::has_gimple_body_p): Update.
(cgraph_node::former_thunk_p): Update.
* cgraphclones.c: Include symtab-thunks.h.
(duplicate_thunk_for_node): Update.
(cgraph_edge::redirect_callee_duplicating_thunks): Update.
(cgraph_node::expand_all_artificial_thunks): Update.
(cgraph_node::create_edge_including_clones): Update.
* cgraphunit.c: Include symtab-thunks.h.
(vtable_entry_type): Move to symtab-thunks.c.
(cgraph_node::analyze): Update.
(analyze_functions): Update.
(mark_functions_to_output): Update.
(thunk_adjust): Move to symtab-thunks.c
(cgraph_node::expand_thunk): Move to symtab-thunks.c
(cgraph_node::assemble_thunks_and_aliases): Update.
(output_in_order): Update.
(cgraphunit_c_finalize): Do not clear vtable_entry_type.
(cgraph_node::create_wrapper): Update.
* gengtype.c (open_base_files): Add symtab-thunks.h
* ipa-comdats.c (propagate_comdat_group): UPdate.
(ipa_comdats): Update.
* ipa-cp.c (determine_versionability): UPdate.
(gather_caller_stats): Update.
(count_callers): Update
(set_single_call_flag): Update
(initialize_node_lattices): Update
(call_passes_through_thunk_p): Update
(call_passes_through_thunk): Update
(propagate_constants_across_call): Update
(find_more_scalar_values_for_callers_subset): Update
(has_undead_caller_from_outside_scc_p): Update
* ipa-fnsummary.c (evaluate_properties_for_edge): Update.
(compute_fn_summary): Update.
(inline_analyze_function): Update.
* ipa-icf.c: Include symtab-thunks.h.
(sem_function::equals_wpa): Update.
(redirect_all_callers): Update.
(sem_function::init): Update.
(sem_function::parse): Update.
* ipa-inline-transform.c: Include symtab-thunks.h.
(inline_call): Update.
(save_inline_function_body): Update.
(preserve_function_body_p): Update.
* ipa-inline.c (inline_small_functions): Update.
* ipa-polymorphic-call.c: Include alloc-pool.h, symbol-summary.h,
symtab-thunks.h
(ipa_polymorphic_call_context::ipa_polymorphic_call_context): Update.
* ipa-pure-const.c: Include symtab-thunks.h.
(analyze_function): Update.
* ipa-sra.c (check_for_caller_issues): Update.
* ipa-utils.c (ipa_reverse_postorder): Update.
(ipa_merge_profiles): Update.
* ipa-visibility.c (non_local_p): Update.
(cgraph_node::local_p): Update.
(function_and_variable_visibility): Update.
* ipa.c (symbol_table::remove_unreachable_nodes): Update.
* lto-cgraph.c: Include alloc-pool.h, symbol-summary.h and
symtab-thunks.h
(lto_output_edge): Update.
(lto_output_node): Update.
(compute_ltrans_boundary): Update.
(output_symtab): Update.
(verify_node_partition): Update.
(input_overwrite_node): Update.
(input_node): Update.
* lto-streamer-in.c (fixup_call_stmt_edges): Update.
* symtab-thunks.cc: New file.
* symtab-thunks.h: New file.
* toplev.c (toplev::finalize): Call symtab_thunks_cc_finalize.
* trans-mem.c (ipa_tm_mayenterirr_function): Update.
(ipa_tm_execute): Update.
* tree-inline.c (expand_call_inline): Update.
* tree-nested.c (create_nesting_tree): Update.
(convert_all_function_calls): Update.
(gimplify_all_functions): Update.
* tree-profile.c (tree_profiling): Update.
* tree-ssa-structalias.c (associate_varinfo_to_alias): Update.
* tree.c (free_lang_data_in_decl): Update.
* value-prof.c (init_node_map): Update.

gcc/c-family/ChangeLog:

2020-10-23  Jan Hubicka  <hubicka@ucw.cz>

* c-common.c (c_common_finalize_early_debug): Update for new thunk api.

gcc/d/ChangeLog:

2020-10-23  Jan Hubicka  <hubicka@ucw.cz>

* decl.cc (finish_thunk): Update for new thunk api.

gcc/lto/ChangeLog:

2020-10-23  Jan Hubicka  <hubicka@ucw.cz>

* lto-partition.c (add_symbol_to_partition_1): Update for new thunk
api.

4 years agoc, c++: Implement -Wsizeof-array-div [PR91741]
Marek Polacek [Fri, 11 Sep 2020 20:19:08 +0000 (16:19 -0400)] 
c, c++: Implement -Wsizeof-array-div [PR91741]

This patch implements a new warning, -Wsizeof-array-div.  It warns about
code like

  int arr[10];
  sizeof (arr) / sizeof (short);

where we have a division of two sizeof expressions, where the first
argument is an array, and the second sizeof does not equal the size
of the array element.  See e.g. <https://www.viva64.com/en/examples/v706/>.

Clang makes it possible to suppress the warning by parenthesizing the
second sizeof like this:

  sizeof (arr) / (sizeof (short));

so I followed suit.  In the C++ FE this was rather easy, because
finish_parenthesized_expr already set TREE_NO_WARNING.  In the C FE
I've added a new tree code, PAREN_SIZEOF_EXPR, to discern between the
non-() and () versions.

This warning is enabled by -Wall.  An example of the output:

x.c:5:23: warning: expression does not compute the number of elements in this array; element type is â€˜int’, not â€˜short int’ [-Wsizeof-array-div]
    5 |   return sizeof (arr) / sizeof (short);
      |          ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
x.c:5:25: note: add parentheses around â€˜sizeof (short int)’ to silence this warning
    5 |   return sizeof (arr) / sizeof (short);
      |                         ^~~~~~~~~~~~~~
      |                         (             )
x.c:4:7: note: array â€˜arr’ declared here
    4 |   int arr[10];
      |       ^~~

gcc/c-family/ChangeLog:

PR c++/91741
* c-common.c (verify_tree): Handle PAREN_SIZEOF_EXPR.
(c_common_init_ts): Likewise.
* c-common.def (PAREN_SIZEOF_EXPR): New tree code.
* c-common.h (maybe_warn_sizeof_array_div): Declare.
* c-warn.c (sizeof_pointer_memaccess_warning): Unwrap NOP_EXPRs.
(maybe_warn_sizeof_array_div): New function.
* c.opt (Wsizeof-array-div): New option.

gcc/c/ChangeLog:

PR c++/91741
* c-parser.c (c_parser_binary_expression): Implement -Wsizeof-array-div.
(c_parser_postfix_expression): Set PAREN_SIZEOF_EXPR.
(c_parser_expr_list): Handle PAREN_SIZEOF_EXPR like SIZEOF_EXPR.
* c-tree.h (char_type_p): Declare.
* c-typeck.c (char_type_p): No longer static.

gcc/cp/ChangeLog:

PR c++/91741
* typeck.c (cp_build_binary_op): Implement -Wsizeof-array-div.

gcc/ChangeLog:

PR c++/91741
* doc/invoke.texi: Document -Wsizeof-array-div.

gcc/testsuite/ChangeLog:

PR c++/91741
* c-c++-common/Wsizeof-pointer-div.c: Add dg-warning.
* c-c++-common/Wsizeof-array-div1.c: New test.
* g++.dg/warn/Wsizeof-array-div1.C: New test.
* g++.dg/warn/Wsizeof-array-div2.C: New test.

4 years agoPR middle-end/97552 - missing waning passing null to a VLA argument declared [static]
Martin Sebor [Fri, 23 Oct 2020 18:37:38 +0000 (12:37 -0600)] 
PR middle-end/97552 - missing waning passing null to a VLA argument declared [static]

gcc/ChangeLog:

PR middle-end/97552
* attribs.c (init_attr_rdwr_indices): Handle static VLA parameters.

gcc/c/ChangeLog:

PR middle-end/97552
* c-decl.c (get_parm_array_spec): Handle static VLA parameters.

gcc/testsuite/ChangeLog:

PR middle-end/97552
* gcc.dg/Wvla-parameter-2.c: Adjust text of expected warning.
* gcc.dg/Wnonnull-5.c: New test.

4 years agoPR c/97463 - ICE in warn_parm_ptrarray_mismatch on an incompatible function redeclaration
Martin Sebor [Fri, 23 Oct 2020 18:30:20 +0000 (12:30 -0600)] 
PR c/97463 - ICE in warn_parm_ptrarray_mismatch on an incompatible function redeclaration

gcc/c-family/ChangeLog:

PR c/97463
* c-warn.c (warn_parm_ptrarray_mismatch): Move null test earlier.

gcc/testsuite/ChangeLog:

PR c/97463
* gcc.dg/pr97463.c: New test.

4 years agoDarwin, Ada : Fix bootstrap after stat entry changes.
Iain Sandoe [Thu, 22 Oct 2020 17:12:25 +0000 (18:12 +0100)] 
Darwin, Ada : Fix bootstrap after stat entry changes.

Darwin struct stat has timeval entry fields for file access and
modification times but they are named differently from those
on Linux.

As a workaround define the field names to the Darwin equivalent.

gcc/ada/ChangeLog:

* adaint.c: On Darwin platforms, define st_atim to
st_atimespec. Likwise st_mtim to st_mtimespec.

4 years agoFix typo in recent change to Makefile.rtl (bis)
Eric Botcazou [Fri, 23 Oct 2020 17:19:19 +0000 (19:19 +0200)] 
Fix typo in recent change to Makefile.rtl (bis)

gcc/ada/ChangeLog:
* Makefile.rtl (EXTRA_GNATRTL_NONTASKING_OBJS) [IA64/Linux]: Fix typo.

4 years agoFix typo in recent change to Makefile.rtl
Eric Botcazou [Fri, 23 Oct 2020 16:16:58 +0000 (18:16 +0200)] 
Fix typo in recent change to Makefile.rtl

gcc/ada/ChangeLog:
* Makefile.rtl (EXTRA_GNATRTL_NONTASKING_OBJS) [IA64/Linux]: Fix typo.

4 years agoLink with the configured net lib on vxworks7
Douglas Rupp [Mon, 13 Apr 2020 17:52:39 +0000 (10:52 -0700)] 
Link with the configured net lib on vxworks7

The net library is configurable on vxworks7. Pick the library
to include in link closures in accordance with the availability
of a revealing header file, using the recently introduced
if-exist-then-else spec builtin function.

2021-10-23  Douglas Rupp  <rupp@adacore.com>

gcc/
* config/vxworks.h (VXWORKS_NET_LIBS_RTP): Use -lrtnet if
rtnetStackLib.h is available,fallback to -lnet otherwise.

4 years agotestsuite: Correct vec-rlmi-rlnm.c testsuite expected result
David Edelsohn [Fri, 23 Oct 2020 15:21:49 +0000 (11:21 -0400)] 
testsuite: Correct vec-rlmi-rlnm.c testsuite expected result

gcc/testsuite/ChangeLog:

* gcc.target/powerpc/vec-rlmi-rlnm.c: Update xxlor expect.

4 years agoFix overzealous gthread support inhibition for vxworks
Rasmus Villemoes [Fri, 23 Oct 2020 09:09:05 +0000 (09:09 +0000)] 
Fix overzealous gthread support inhibition for vxworks

The tests for macros possibly defined in gthr.h needs to
be performed after the corresponding #include. This was tested
together with the previous updates to gthr-vxworks-thread.c
and gthr-vxworks-cond.c and was meant to be squashed with them.

2010-10-23  Rasmus Villemoes  <rv@rasmusvillemoes.dk>

libgcc/
* config/gthr-vxworks-thread.c: #include gthr.h before
testing the guard defined there.
* config/gthr-vxworks-cond.c: Likewise.

4 years agoAdd a if-exists-then-else built-in spec function
Douglas Rupp [Tue, 7 Apr 2020 21:05:57 +0000 (14:05 -0700)] 
Add a if-exists-then-else built-in spec function

This patch adds an if-exists-then-else
builtin spec function, which tests for the existence of
a file and returns one or the other of the following
arguments depending on the result of the test.

This differs from the existing if-exists or
if-exists-else function which return the name of the
tested file if it exists.

This new function is of help to a forthcoming change for
VxWorks where we check for the presence of a specific header
file to decide the name of a library to include in the link
closure.

2020-10-23  Douglas Rupp  <rupp@adacore.com>

gcc/
* gcc.c (if-exists-then-else): New built-in spec function.
* doc/invoke.texi: Document it.

4 years agors6000: Fix extraneous characters in the documentation
Tulio Magno Quites Machado Filho via Gcc-patches [Wed, 19 Aug 2020 19:03:31 +0000 (16:03 -0300)] 
rs6000: Fix extraneous characters in the documentation

Replace them with a whitespace in order to avoid artifacts in the HTML
document.

2020-08-19  Tulio Magno Quites Machado Filho  <tuliom@linux.ibm.com>

gcc/
* doc/extend.texi (PowerPC Built-in Functions): Replace
extraneous characters with whitespace.

4 years agogcov: fix reading of zero sections.
Martin Liska [Fri, 23 Oct 2020 14:20:53 +0000 (16:20 +0200)] 
gcov: fix reading of zero sections.

I noticed that during coverage build of binutils.

gcc/ChangeLog:

* gcov.c (read_count_file): Never call gcov_sync with a negative
value.

4 years agotestsuite: Add noexcept(false) to throwing destructor
Jonathan Wakely [Fri, 23 Oct 2020 14:03:38 +0000 (15:03 +0100)] 
testsuite: Add noexcept(false) to throwing destructor

I think this test is intended to check this property of the C++
standard:

"If a destructor directly invoked by stack unwinding exits via an
exception, std::terminate is invoked." [except.throw]

Since C++11 any exception escaping a destructor will call
std::terminate, so the test would terminate even if the unwinding
behaviour was wrong.

Give the destructor a potentially-throwing exception specification,
so that we know that terminate was called for the right reason.

gcc/testsuite/ChangeLog:

* g++.dg/compat/eh/filter2_y.C: Add noexcept(false) to
destructor.

4 years agolibstdc++: Apply proposed resolutions for LWG 3428, 3447
Patrick Palka [Fri, 23 Oct 2020 13:03:25 +0000 (09:03 -0400)] 
libstdc++: Apply proposed resolutions for LWG 3428, 3447

libstdc++-v3/ChangeLog:

* include/std/ranges (single_view::single_view): Mark the
in place constructor explicit as per LWG 3428.
(take_view): Remove the constraint on the deduction guide's
template parameter as per LWG 3447.

4 years agomore wraplf for aux long long float: s390, sparc and powerpc
Alexandre Oliva [Fri, 23 Oct 2020 09:37:07 +0000 (06:37 -0300)] 
more wraplf for aux long long float: s390, sparc and powerpc

The wraplf version of Ada.Numerics.Aux_Long_Long_Float is needed on
s390* as well.  Also add it to sparc*-linux-gnu and powerpc-darwin,
that were missed when adding it for sparc and ppc targets.

for  gcc/ada/ChangeLog

PR ada/97504
* Makefile.rtl (LIBGNAT_TARGET_PAIRS): Select wraplf version
of Aux_Long_Long_Float for s390 and remaining sparc and
powerpc targets.

4 years ago[Ada] Sockets.Poll implementation
Dmitriy Anisimkov [Sat, 8 Aug 2020 12:49:27 +0000 (18:49 +0600)] 
[Ada] Sockets.Poll implementation

gcc/ada/

* Makefile.rtl (GNATRTL_SOCKETS_OBJS): New object
g-socpol$(objext) New source files noted: g-socpol.adb,
g-socpol.ads, g-socpol__dummy.adb, g-socpol__dummy.ads,
g-sopowa.adb, g-sopowa__posix.adb, g-sopowa__mingw.adb,
g-spogwa.adb, g-spogwa.ads.
* impunit.adb (Non_Imp_File_Names_95): New base filename
g-socpol in "GNAT Library Units" section for GNAT.Sockets.Poll
unit.
* libgnat/g-socket.ads, libgnat/g-socket.adb:
(Raise_Socket_Error): Moved from body to private part of
specification to use in GNAT.Sockets.Poll.
* libgnat/g-socpol.ads, libgnat/g-socpol.adb: Main unit of the
implementation.
* libgnat/g-socpol__dummy.ads, libgnat/g-socpol__dummy.adb:
Empty unit for the systems without sockets support.
* libgnat/g-spogwa.ads, libgnat/g-spogwa.adb: Generic unit
implementing sockets poll on top of select system call.
* libgnat/g-sopowa.adb (Wait): Separate implementation for
operation systems with poll system call support.
* libgnat/g-sopowa__posix.adb (Wait): Separate implementation
for POSIX select system call.
* libgnat/g-sopowa__mingw.adb (Wait): Separate implementation
for Windows select system call.
* gsocket.h (_WIN32_WINNT): Increase to 0x0600 for winsock2.h to
allow WSAPoll related definitions.
* s-oscons-tmplt.c: Fix comment next to #endif for
#if defined (__linux__) || defined (__ANDROID__) line.  Include
<poll.h> for all except VxWorks and Windows.
(SIZEOF_nfds_t): New definition.
(SIZEOF_fd_type): New definition.
(SIZEOF_pollfd_events): New definition.
(POLLIN, POLLPRI, POLLOUT, POLLERR, POLLHUP, POLLNVAL): New
definitions for VxWorks to be able to emulate poll on top of
select in it.  Define POLLPRI as zero on Windows as it is not
supported there.
(Poll_Linkname): New definition, because the poll system call
has different name in Windows and POSIX.

4 years ago[Ada] Further Ada 2020 work on accessibility checking
Justin Squirek [Wed, 2 Sep 2020 18:20:55 +0000 (14:20 -0400)] 
[Ada] Further Ada 2020 work on accessibility checking

gcc/ada/

* checks.adb (Apply_Accessibility_Check): Skip checks against
the extra accessibility of a function result when in Ada 2005
mode or earlier.
* exp_ch3.adb (Build_Initialization_Call): Modify accessibility
level calls to use Accessibility_Level.
(Expand_N_Object_Declaration): Modify accessibility level calls
to use Accessibility_Level.
* exp_ch4.adb (Expand_Allocator_Expression): Add static check
for anonymous access discriminants. Remove unneeded propagation
of accessibility actual.
(Expand_N_In): Modify accessibility level calls to use
Accessibility_Level.
(Expand_N_Type_Conversion): Modify accessibility level calls to
use Accessibility_Level.
* exp_ch5.adb (Expand_N_Assignment_Statement): Modify
accessibility level calls to use Accessibility_Level.
* exp_ch6.adb (Expand_Call_Helper): Rewrite accessibility
calculation for the extra accessibility of result actual in
function calls, and modify accessibility level calls to use
Accessibility_Level.
(Check_Against_Result_Level): Removed.
* exp_ch9.adb (Expand_N_Requeue_Statement): Add dynamic
accessibility check for requeues
* sem_attr.adb (Resolve_Attribute): Modify accessibility level
calls to use Accessibility_Level.
* sem_ch13.adb (Associate_Storage_Pool): Modify accessibility
level calls to use Accessibility_Level.
* sem_ch4.adb (Analyze_Call): Add static check for explicitly
aliased formals in function calls within return statements.
* sem_ch6.adb (Check_Return_Construct_Accessibility): Rewrite
routine to account for non-aggregate return objects.
(Generate_Minimum_Accessibility): Created.
(Analyze_Call): Modify accessibility level calls to use
Accessibility_Level.
(Analyze_Subprogram_Body_Helper): Add generation of minimum
accessibility for the extra accessibility of the function
result.
* sem_ch9.adb (Analyze_Requeue): Modify accessibility level
calls to use Accessibility_Level.
* sem_res.adb: (Check_Aliased_Parameters): Modify accessibility
level calls to use Accessibility_Level.
(Valid_Conversion): Modify accessibility level calls to use
Accessibility_Level.
* sem_util.adb, sem_util.ads (Accessibility_Level_Helper):
Renamed to Accessibility_Level, add detection for functions in
prefix notation, and add cases where to return zero when
specified. Modified to take new, more descriptive, parameters.
(Accessibility_Level): Created.
(Function_Call_Level): Removed.
(Function_Call_Or_Allocator_Level): Created to centralize the
calculation accessibility levels for function calls and
allocators.
(Static_Accessibility_Level): Removed.
(Dynamic_Accessibility_Level): Removed.
(Get_Dynamic_Accessibility): Renamed from Get_Accessibility.
(In_Return_Value): Created to determine if a given expression
contributes to the current function's return value.
(Is_Master): Created.
(Is_Explicitly_Aliased): Created

4 years ago[Ada] gnatpp: Document --no-comments-fill
Bob Duff [Tue, 8 Sep 2020 21:23:35 +0000 (17:23 -0400)] 
[Ada] gnatpp: Document --no-comments-fill

gcc/ada/

* doc/gnat_ugn/gnat_utility_programs.rst: Document
--no-comments-fill.

4 years ago[Ada] Reject illegal syntax in pragma Contract_Cases
Piotr Trojanek [Fri, 4 Sep 2020 12:51:02 +0000 (14:51 +0200)] 
[Ada] Reject illegal syntax in pragma Contract_Cases

gcc/ada/

* contracts.adb (Analyze_Entry_Or_Subprogram_Contract,
Analyze_Subprogram_Body_Stub_Contract): Fix missing references
to Subprogram_Variant where similar references to Contract_Cases
are present.
* sem_prag.adb (Analyze_Contract_Case, Analyze_Variant): Check
that aggregate parameter has no expressions.
(Analyze_Pragma): Replace Contract_Cases with Subprogram_Variant
in a copy-pasted comment.

4 years ago[Ada] GNAT.Sockets: fix comment typo
Philippe Gil [Tue, 8 Sep 2020 08:30:36 +0000 (10:30 +0200)] 
[Ada] GNAT.Sockets: fix comment typo

gcc/ada/

* libgnat/g-socket.ads: Fix comment typo.

4 years ago[Ada] Implement new legality rules introduced in C.6(12) by AI12-0363
Eric Botcazou [Mon, 7 Sep 2020 16:25:23 +0000 (18:25 +0200)] 
[Ada] Implement new legality rules introduced in C.6(12) by AI12-0363

gcc/ada/

* doc/gnat_rm/implementation_defined_pragmas.rst (VFA): Remove uage
restrictions in conjunction with Atomic and Aliased.
* gnat_rm.texi: Regenerate.
* aspects.ads (Aspect_Id): Add Aspect_Full_Access_Only.
(Is_Representation_Aspect): Likewise.
(Aspect_Names): Likewise.
(Aspect_Delay): Likewise.
* einfo.ads (Is_Atomic_Or_VFA): Rename into...
(Is_Full_Access): ...this.
(Is_Volatile_Full_Access): Document new usage for Full_Access_Only.
* einfo.adb (Is_Atomic_Or_VFA): Rename into...
(Is_Full_Access): ...this.
* freeze.ads (Is_Atomic_VFA_Aggregate): Rename into...
(Is_Full_Access_Aggregate): ...this.
* freeze.adb (Is_Atomic_VFA_Aggregate): Rename into...
(Is_Full_Access_Aggregate): ...this.  Adjust to above renaming.
(Freeze_Array_Type): Likewise.
(Freeze_Entity): Likewise.
* exp_aggr.adb (Aggr_Assignment_OK_For_Backend): Likewise.
(Expand_Record_Aggregate): Likewise.
* exp_ch4.adb (Expand_N_Op_Eq): Likewise.
* exp_ch5.adb (Expand_Assign_Array): Likewise.
* exp_ch8.adb (Evaluation_Required): Likewise.
* layout.adb (Layout_Type): Likewise.
(Set_Composite_Alignment): Likewise.
* sem_aux.ads (Has_Rep_Item): Delete.
* sem_aux.adb (Has_Rep_Item): Likewise.
* sem_attr.adb (Resolve_Attribute) <Attribute_Access>: Implement
new legality rules in C.6(12).
* sem_ch12.adb (Instantiate_Object): Likewise.
* sem_res.adb (Resolve_Actuals): Likewise.
* sem_ch13.adb (Inherit_Delayed_Rep_Aspects): Deal with aspect
Full_Access_Only.
(Check_False_Aspect_For_Derived_Type): Likewise.
(Make_Pragma_From_Boolean_Aspect): Test for the presence of Expr.
Deal with aspect Full_Access_Only.
(Analyze_Aspects_At_Freeze_Point): Likewise.
(Analyze_One_Aspect): Do not set Delay_Required to true even for
Always_Delay boolean aspects if they have no expression.  Force
Delay_Required to true for aspect Full_Access_Only in all cases.
Reject aspect Full_Access_Only if not in Ada 2020 mode.
(Check_Aspect_At_End_Of_Declarations): Deal with empty expression.
(Check_Aspect_At_Freeze_Point): Likewise.
(Rep_Item_Entity): Delete.
(Inherit_Aspects_At_Freeze_Point): Align handling for Bit_Order
with that for Scalar_Storage_Order.
* sem_prag.adb (Check_Atomic_VFA): Delete.
(Check_VFA_Conflicts): Likewise.
(Check_Full_Access_Only): New procedure.
(Process_Atomic_Independent_Shared_Volatile): Call to implement
the new legality checks in C.6(8/2) and mark the entity last.
(Analyze_Pragma) <Pragma_Atomic_Components>: Remove obsolete check.
* sem_util.ads (Is_Atomic_Or_VFA_Object): Rename into...
(Is_Full_Access_Object): ...this.
(Is_Subcomponent_Of_Atomic_Object): Rename into...
(Is_Subcomponent_Of_Full_Access_Object): ...this.
* sem_util.adb (Inherit_Rep_Item_Chain): Use Present_In_Rep_Item.
(Is_Atomic_Or_VFA_Object): Rename into...
(Is_Full_Access_Object): ...this.
(Is_Subcomponent_Of_Atomic_Object): Rename into...
(Is_Subcomponent_Of_Full_Access_Object): ...this and adjust.
* snames.ads-tmpl (Name_Full_Access_Only): New name of aspect.
* gcc-interface/decl.c (gnat_to_gnu_entity): Adjust for renaming.
(promote_object_alignment): Likewise.
(gnat_to_gnu_field): Likewise.  Rename local variable and use
specific qualifier in error message for Volatile_Full_Access.
* gcc-interface/trans.c (lvalue_required_p): Likewise.

4 years ago[Ada] Clean up in writing of ALI files
Arnaud Charlet [Mon, 7 Sep 2020 12:44:26 +0000 (08:44 -0400)] 
[Ada] Clean up in writing of ALI files

gcc/ada/

* lib-writ.ads, lib-writ.adb (Write_ALI): No longer read
existing ALI files in -gnatc mode.

4 years ago[Ada] Fix logic in C_Select under mingw
Arnaud Charlet [Thu, 3 Sep 2020 08:04:22 +0000 (04:04 -0400)] 
[Ada] Fix logic in C_Select under mingw

gcc/ada/

* libgnat/g-socthi__mingw.adb (C_Select): Fix logic in code and
make it explicit that we are checking against null values before
dereferencing them.

4 years ago[Ada] Do not use Long_Long_Long_Integer'Image with pragma Discard_Names
Eric Botcazou [Fri, 4 Sep 2020 10:34:02 +0000 (12:34 +0200)] 
[Ada] Do not use Long_Long_Long_Integer'Image with pragma Discard_Names

gcc/ada/

* exp_imgv.adb (Expand_Image_Attribute): For an enumeration type
subject to pragma Discard_Names, convert 'Pos to Long_Long_Integer
before applying 'Img to the result.

4 years ago[Ada] Crash on expression function and access type
Ed Schonberg [Thu, 3 Sep 2020 13:54:40 +0000 (09:54 -0400)] 
[Ada] Crash on expression function and access type

gcc/ada/

* freeze.adb (Freeze_Type_Refs): Add guard on freezing of the
designated type of an access type appearing in the expression,
when expression includes an explicit dereference whose prefix
includes a function call.

4 years ago[Ada] Fix crash in SPARK on array delta_aggregate with subtype_indication
Piotr Trojanek [Tue, 1 Sep 2020 08:55:34 +0000 (10:55 +0200)] 
[Ada] Fix crash in SPARK on array delta_aggregate with subtype_indication

gcc/ada/

* exp_spark.adb (Expand_SPARK_Delta_Or_Update): Handle
subtype_indication; do not apply range checks for ranges; add
comment saying that others_choices is not allowed.

4 years ago[Ada] Decorate iterated_component_association in SPARK expansion
Piotr Trojanek [Tue, 4 Aug 2020 17:18:20 +0000 (19:18 +0200)] 
[Ada] Decorate iterated_component_association in SPARK expansion

gcc/ada/

* exp_spark.adb (Expand_SPARK_N_Aggregate,
Expand_SPARK_Delta_Or_Update): Expand
Iterated_Component_Association occurring within delta
aggregates.
(Expand_SPARK): Apply SPARK-specific expansion to ordinary
aggregates.

4 years ago[Ada] GNATprove: remove support for external axiomatizations
Johannes Kanig [Mon, 17 Aug 2020 00:41:10 +0000 (09:41 +0900)] 
[Ada] GNATprove: remove support for external axiomatizations

gcc/ada/

* exp_util.adb, exp_util.ads
(Containing_Package_With_Ext_Axioms,
Has_Annotate_Pragma_For_External_Axiomatizations): Removed.
* sem_ch8.adb (Analyze_Subprogram_Renaming): Removed code
related to external axiomatizations.
* einfo.ads
(Is_Generic_Actual_Subprogram): Removed comment about external
axiomatization.

4 years ago[Ada] Ignore container types for aggregates if not in Ada_2020
Ed Schonberg [Wed, 2 Sep 2020 13:30:09 +0000 (09:30 -0400)] 
[Ada] Ignore container types for aggregates if not in Ada_2020

gcc/ada/

* sem_aggr.adb (Resolve_Aggregate): Do not call
Resolve_Container_Aggregate if compilation version is earlier
than Ada_2020.

4 years ago[Ada] Improve documentation of pragma Abort_Defer
Arnaud Charlet [Fri, 28 Aug 2020 08:46:52 +0000 (04:46 -0400)] 
[Ada] Improve documentation of pragma Abort_Defer

gcc/ada/

* doc/gnat_rm/implementation_defined_pragmas.rst: Improve
documentation of pragma Abort_Defer.
* gnat_rm.texi: Regenerate.

4 years ago[Ada] CUDA: fix CUDA_Execute not working with aggregates
Ghjuvan Lacambre [Tue, 1 Sep 2020 08:57:39 +0000 (10:57 +0200)] 
[Ada] CUDA: fix CUDA_Execute not working with aggregates

gcc/ada/

* exp_prag.adb (Etype_Or_Dim3): New function.
(Expand_Pragma_Cuda_Execute): Use Etype_Or_Dim3 for temporary
decls.

4 years ago[Ada] Error when closing c_stream
Arnaud Charlet [Thu, 27 Aug 2020 12:38:35 +0000 (08:38 -0400)] 
[Ada] Error when closing c_stream

gcc/ada/

* libgnat/s-fileio.adb (Open): Fix setting of Tempfile.

4 years ago[Ada] CUDA: Use internal types instead of public ones
Ghjuvan Lacambre [Thu, 27 Aug 2020 09:27:00 +0000 (11:27 +0200)] 
[Ada] CUDA: Use internal types instead of public ones

gcc/ada/

* exp_prag.adb (Get_Launch_Kernel_Arg_Type): Renamed to
Get_Nth_Arg_Type and made more generic.
(Build_Dim3_Declaration): Now builds a CUDA.Internal.Dim3
instead of a CUDA.Vector_Types.Dim3.
(Build_Shared_Memory_Declaration): Now infers needed type from
Launch_Kernel instead of using a hard-coded type.
(Expand_Pragma_CUDA_Execute): Build additional temporaries to
store Grids and Blocks.
* rtsfind.ads: Move Launch_Kernel from public to internal
package.

4 years ago[Ada] Missing detection of unused with_clause
Arnaud Charlet [Fri, 28 Aug 2020 12:20:44 +0000 (08:20 -0400)] 
[Ada] Missing detection of unused with_clause

gcc/ada/

* sem_ch4.adb (Complete_Object_Operation): Only mark entities
referenced if we are compiling the extended main unit.
* sem_attr.adb (Analyze_Attribute [Attribute_Tag]): Record a
reference on the type and its scope.

4 years ago[Ada] Prevent copying uninitialized array with address clause
Ed Schonberg [Sat, 29 Aug 2020 14:24:55 +0000 (10:24 -0400)] 
[Ada] Prevent copying uninitialized array with address clause

gcc/ada/

* freeze.adb (Is_Uninitialized_Aggregate): Recognize an array
aggregate with box initialization, scalar components, and no
component default values.
(Freeze_Entity, Check_Address_Clause): Call it, and simplify
freeze code for entity by removing useless assignment.

4 years ago[Ada] Spurious errors on tagged types with renamed subprograms
Javier Miranda [Fri, 28 Aug 2020 13:24:22 +0000 (09:24 -0400)] 
[Ada] Spurious errors on tagged types with renamed subprograms

gcc/ada/

* sem_ch3.adb (Check_Abstract_Overriding): Subprogram renamings
cannot be overridden.
(Derive_Subprogram): Enable setting attribute
Requires_Overriding on functions with controlling access results
of record extensions with a null extension part require
overriding (AI95-00391/06).

4 years ago[Ada] Fix scope of index parameter inside a delta aggregate
Piotr Trojanek [Wed, 5 Aug 2020 22:53:11 +0000 (00:53 +0200)] 
[Ada] Fix scope of index parameter inside a delta aggregate

gcc/ada/

* sem_aggr.adb (Resolve_Delta_Array_Aggregate): Push scope of
the implicit loop before entering name of the index parameter,
not after; enter name no matter if the identifier has been
decorated before.

4 years ago[Ada] Better error for illegal call to abstract operation in instantiations
Gary Dismukes [Wed, 26 Aug 2020 23:35:06 +0000 (19:35 -0400)] 
[Ada] Better error for illegal call to abstract operation in instantiations

gcc/ada/

* sem_ch4.adb (Analyze_Call): In the case where the call is not
overloaded, check for a call to an abstract nondispatching
operation and flag an error.

4 years ago[Ada] Always enable the support for 128-bit integer types on 64-bit platforms
Eric Botcazou [Thu, 27 Aug 2020 18:52:14 +0000 (20:52 +0200)] 
[Ada] Always enable the support for 128-bit integer types on 64-bit platforms

gcc/ada/

* gnat1drv.adb (Adjust_Global_Switches): Rewrite again code enabling
or disabling the support for 128-bit integer types.

4 years ago[Ada] Update header of front-end files
Arnaud Charlet [Thu, 27 Aug 2020 10:28:00 +0000 (06:28 -0400)] 
[Ada] Update header of front-end files

gcc/ada/

* alloc.ads, aspects.adb, aspects.ads, atree.adb, atree.ads,
casing.adb, casing.ads, csets.adb, csets.ads, debug.adb, debug.ads,
einfo.adb, einfo.ads, elists.adb, elists.ads, fname.adb, fname.ads,
gnatvsn.adb, gnatvsn.ads, hostparm.ads, indepsw-aix.adb,
indepsw-darwin.adb, indepsw-gnu.adb, indepsw.adb, indepsw.ads,
krunch.adb, krunch.ads, lib-list.adb, lib-sort.adb, lib.adb, lib.ads,
namet-sp.adb, namet-sp.ads, namet.adb, namet.ads, nlists.adb,
nlists.ads, opt.adb, opt.ads, output.adb, output.ads, rident.ads,
scans.adb, scans.ads, scil_ll.adb, scil_ll.ads, sem_aux.ads,
sem_aux.adb, sfn_scan.adb, sinfo.adb, sinfo.ads, sinput.adb,
sinput.ads, snames.adb-tmpl, snames.ads-tmpl, stand.ads,
stringt.adb, stringt.ads, table.adb, table.ads, types.adb,
types.ads, uintp.adb, uintp.ads, uname.adb, uname.ads,
urealp.adb, urealp.ads, vast.adb, vast.ads, widechar.adb,
widechar.ads: Update header.

4 years ago[Ada] Take advantage of Long_Long_Long_Integer in From_String
Arnaud Charlet [Tue, 11 Aug 2020 19:42:46 +0000 (15:42 -0400)] 
[Ada] Take advantage of Long_Long_Long_Integer in From_String

gcc/ada/

* libgnat/a-nbnbin.adb (From_String): Take advantage of
Long_Long_Long_Integer.
* libgnat/s-genbig.ads, libgnat/s-genbig.adb (To_Bignum): New
function taking a Long_Long_Long_Integer.

4 years ago[Ada] Iterative patch for accessibility cleanup
Justin Squirek [Mon, 24 Aug 2020 18:17:36 +0000 (14:17 -0400)] 
[Ada] Iterative patch for accessibility cleanup

gcc/ada/

* sem_util.adb (Accessibility_Call_Helper): In the selected
component case, test if a prefix is a function call and whether
the subprogram call is not being used in its entirety and use
the Innermost_Master_Scope_Depth in that case.
(Innermost_Master_Scope_Depth): Test against the node_par
instead of its identifier to avoid misattributing unnamed blocks
as not being from source.
(Function_Call_Level): Add calculation for whether a subprogram
call is initializing an object in its entirety.
(Subprogram_Call_Level): Renamed to Function_Call_Level.

4 years ago[Ada] Sync code for external properties with SPARK RM
Piotr Trojanek [Wed, 26 Aug 2020 12:20:20 +0000 (14:20 +0200)] 
[Ada] Sync code for external properties with SPARK RM

gcc/ada/

* sem_prag.adb (Check_External_Properties): Rewrite to match the
SPARK RM description.

4 years ago[Ada] Fix whitespace in code for external property pragmas
Piotr Trojanek [Wed, 26 Aug 2020 11:19:13 +0000 (13:19 +0200)] 
[Ada] Fix whitespace in code for external property pragmas

gcc/ada/

* contracts.adb (Check_Type_Or_Object_External_Properties):
Cleanup.

4 years ago[Ada] Fix default value for re-analysis of external property pragmas
Piotr Trojanek [Wed, 26 Aug 2020 11:18:48 +0000 (13:18 +0200)] 
[Ada] Fix default value for re-analysis of external property pragmas

gcc/ada/

* sem_prag.adb (Analyze_External_Property_In_Decl_Part): Set the
output parameter Expr_Val to the (implicit) pragma argument even
when returning early.

4 years agoFix up plugin header install
Jakub Jelinek [Fri, 23 Oct 2020 08:11:41 +0000 (10:11 +0200)] 
Fix up plugin header install

Jeff has noticed and I've confirmed that config/i386/i386.h header which is
installed on x86 in plugin/include/ directory newly in GCC 11 has
which breaks all plugins that include tm.h etc. because that header is not
shipped.
The following patch seems to fix that.  Unfortunately it isn't just a matter
of TM_H += t-i386 change, because the header has full path and therefore
needs to be installed in its full path.
Additionally, I've noticed that the b-header-vars generation is completely
broken, it will just throw many of the dependencies away, because it
incorrectly removed everything from first ... remaining till the last /,
while what it clearly wants to do is remove each ... till last / in the same
header path (i.e. instead of .* should have used [^     ]* and g modifier).
I've also noticed that some other headers mentioned in #include of other
headers aren't included (gomp-constants.h as dependency of omp-general.h
and various dependencies of expr.h (where omp-general.h and expr.h were
previously installed)).

2020-10-23  Jakub Jelinek  <jakub@redhat.com>

* Makefile.in (PLUGIN_HEADERS): Add gomp-constants.h and $(EXPR_H).
(s-header-vars): Accept not just spaces but also tabs between *_H name
and =.  Handle common/config/ headers similarly to config.  Don't
throw away everything from first ... to last / on the remaining
string, instead skip just ... to corresponding last / without
intervening spaces and tabs.
(install-plugin): Treat common/config headers like config headers.
* config/i386/t-i386 (TM_H): Add
$(srcdir)/common/config/i386/i386-cpuinfo.h.

4 years agostor-layout: Reject forming arrays with elt sizes not divisible by elt alignment...
Jakub Jelinek [Fri, 23 Oct 2020 08:05:17 +0000 (10:05 +0200)] 
stor-layout: Reject forming arrays with elt sizes not divisible by elt alignment [PR97164]

As mentioned in the PR, since 2005 we reject if array elements are smaller
than their alignment (i.e. overaligned elements), because such arrays don't
make much sense, only their first element is guaranteed to be aligned as
user requested, but the next element can't be.
The following testcases show something we've been silent about but is
equally bad, the 2005 case is just the most common special case of that
the array element size is not divisible by the alignment.  In those arrays
too only the first element is guaranteed to be properly aligned and the
second one can't be.

This patch rejects those cases too, but keeps the existing wording for the
old common case.

Unfortunately, the patch breaks bootstrap, because libbid uses this mess
(forms arrays with 24 byte long elements with 16 byte element alignment).
I don't really see justification for that, so I've decreased the alignment
to 8 bytes instead.

2020-10-23  Jakub Jelinek  <jakub@redhat.com>

PR tree-optimization/97164
gcc/
* stor-layout.c (layout_type): Also reject arrays where element size
is constant, but not a multiple of element alignment.
gcc/testsuite/
* c-c++-common/pr97164.c: New test.
* gcc.c-torture/execute/pr36093.c: Move ...
* gcc.dg/pr36093.c: ... here.  Add dg-do compile and dg-error
directives.
* gcc.c-torture/execute/pr43783.c: Move ...
* gcc.dg/pr43783.c: ... here.  Add dg-do compile, dg-options and
dg-error directives.
libgcc/config/libbid/
* bid_functions.h (UINT192): Decrease alignment to 8 bytes.

4 years agoDo not use doloop pattern with pragma Unroll
Eric Botcazou [Fri, 23 Oct 2020 07:51:46 +0000 (09:51 +0200)] 
Do not use doloop pattern with pragma Unroll

This fixes the following Ada failure on 64-bit PowerPC:

-FAIL: gnat.dg/unroll4.adb scan-rtl-dump-times loop2_unroll "optimized:
loop unrolled 7 times" 2

The IVOPTS pass detects a doloop pattern and consequently discombobulates
the loop sufficiently as to make it hard for the RTL unrolling pass to
compute the best number of iterations.

gcc/ChangeLog:
* tree-ssa-loop-ivopts.c (analyze_and_mark_doloop_use): Bail out if
the loop is subject to a pragma Unroll with no specific count.

4 years agoarm: Auto-vectorization for MVE: vsub
Dennis Zhang [Fri, 23 Oct 2020 07:53:53 +0000 (08:53 +0100)] 
arm: Auto-vectorization for MVE: vsub

This patch enables MVE vsub instructions for auto-vectorization.
The sub<mode>3 in vec-common.md is modified to use new mode macros
to include MVE extension for vectorization. MVE vsub insns in mve.md are
modified to use 'minus' instead of unspec expression to support
sub<mode>3. Use VDQ instead fo VALL to cover all supported modes. The
redundant sub<mode>3 insns in neon.md are then removed.

gcc/ChangeLog:

2020-10-23  Dennis Zhang  <dennis.zhang@arm.com>

* config/arm/mve.md (mve_vsubq<mode>): New entry for vsub instruction
using expression 'minus'.
(mve_vsubq_f<mode>): Use minus instead of VSUBQ_F unspec.
* config/arm/neon.md (sub<mode>3, sub<mode>3_fp16): Removed.
(neon_vsub<mode>): Use gen_sub<mode>3 instead of gen_sub<mode>3_fp16.
* config/arm/vec-common.md (sub<mode>3): Use the new mode macros
ARM_HAVE_<MODE>_ARITH. Use iterator VDQ instead of VALL.

gcc/testsuite/ChangeLog:

* gcc.target/arm/simd/mve-vsub_1.c: New test.

4 years agoLTO: check that make command works
Martin Liska [Thu, 22 Oct 2020 12:07:29 +0000 (14:07 +0200)] 
LTO: check that make command works

gcc/ChangeLog:

PR lto/97524
* lto-wrapper.c (make_exists): New function.
(run_gcc): Use it to check that make is present and working
for parallel execution.

4 years agoRevert "middle-end/97521 - fix VECTOR_CST expansion"
Richard Biener [Fri, 23 Oct 2020 06:21:39 +0000 (08:21 +0200)] 
Revert "middle-end/97521 - fix VECTOR_CST expansion"

2020-10-23  Richard Biener  <rguenther@suse.de>

PR middle-end/97521
* expr.c (expand_expr_real_1): Revert last change.

* gcc.target/i386/pr97521.c: Remove.
This reverts commit b960a9c83a93b58a84a7a370002990810675ac5d.

4 years agovect: Remove redundant LOOP_VINFO_FULLY_MASKED_P
Kewen Lin [Fri, 23 Oct 2020 03:47:39 +0000 (22:47 -0500)] 
vect: Remove redundant LOOP_VINFO_FULLY_MASKED_P

Remove one redundant LOOP_VINFO_FULLY_MASKED_P condition check
which will be checked in vect_use_loop_mask_for_alignment_p.

gcc/ChangeLog:

* tree-vect-loop.c (vect_transform_loop): Remove the redundant
LOOP_VINFO_FULLY_MASKED_P check.

4 years agoDaily bump.
GCC Administrator [Fri, 23 Oct 2020 00:16:30 +0000 (00:16 +0000)] 
Daily bump.

4 years agolibstdc++: Ensure std::forward_as_tuple is defined
Jonathan Wakely [Thu, 22 Oct 2020 23:58:35 +0000 (00:58 +0100)] 
libstdc++: Ensure std::forward_as_tuple is defined

The recent changes to reduce includes in <memory_resource> went a bit
too far, and it's possible for std::forward_as_tuple to not be defined
when used.

While doing this, I noticed the problematic calls to forward_as_tuple
were not qualified, so performed unwanted ADL.

libstdc++-v3/ChangeLog:

* include/experimental/memory_resource: Include <tuple>.
(polymorphic_allocator::construct): Qualify forward_as_tuple.
* include/std/memory_resource: Likewise.

4 years ago[RS6000] Power10 vec-splati-runnable multiple test failures
Alan Modra [Thu, 22 Oct 2020 01:33:00 +0000 (12:03 +1030)] 
[RS6000] Power10 vec-splati-runnable multiple test failures

FAIL: gcc.target/powerpc/vec-splati-runnable.c 1 blank line(s) in output
FAIL: gcc.target/powerpc/vec-splati-runnable.c (test for excess errors)
Excess errors:
rs6000_emit_xxspltidp_v2df called ...

and running the test fails.  As the comment says
  /* Although the instruction says the results are not defined, it does seem
     to work, at least on Mambo.  But no guarentees!  */
So the simulator works but not real hardware.

gcc/
* config/rs6000/rs6000.c (rs6000_emit_xxspltidp_v2df): Delete
debug printf.  Remove trailing ".\n" from inform message.
Break long line.
gcc/testsuite/
* gcc.target/powerpc/vec-splati-runnable.c: Don't abort on
undefined output.