Commit Graph

30339 Commits

Author SHA1 Message Date
Jakub Jelinek 88b712c241 backport: re PR fortran/81304 (Bogus warning with -Wsurprising and -fopenmp: Type specified for intrinsic function 'min' / 'max')
Backported from mainline
	2017-11-24  Jakub Jelinek  <jakub@redhat.com>

	PR fortran/81304
	* trans-openmp.c (gfc_trans_omp_array_reduction_or_udr): Set
	attr.implicit_type in intrinsic_sym to avoid undesirable warning.

	* testsuite/libgomp.fortran/pr81304.f90: New test.

From-SVN: r255716
2017-12-15 23:00:48 +01:00
Jakub Jelinek e57525d514 backport: re PR sanitizer/83014 (ICE in pretty-print with -fsanitize=bounds)
Backported from mainline
	2017-11-24  Jakub Jelinek  <jakub@redhat.com>
 
	PR sanitizer/83014
	* ubsan.c (ubsan_type_descriptor): Use pp_unsigned_wide_integer
	instead of pp_printf with HOST_WIDE_INT_PRINT_DEC.  Avoid calling
	tree_to_uhwi twice.

	* gcc.dg/ubsan/pr83014.c: New test.

From-SVN: r255715
2017-12-15 22:58:13 +01:00
Jakub Jelinek 5a8687cc52 backport: tree-object-size.c (pass_through_call): Do not handle BUILT_IN_STPNCPY_CHK which is not a pass through call.
Backported from mainline
	2017-11-24  Jakub Jelinek  <jakub@redhat.com>

	* tree-object-size.c (pass_through_call): Do not handle
	BUILT_IN_STPNCPY_CHK which is not a pass through call.

	* gcc.dg/builtin-object-size-18.c: New test.

From-SVN: r255714
2017-12-15 22:57:19 +01:00
Jakub Jelinek 8ea87c5f83 backport: re PR middle-end/82253 (ICE in convert_move, at expr.c:604)
Backported from mainline
	2017-11-23  Jakub Jelinek  <jakub@redhat.com>

	PR middle-end/82253
	* expr.c (expand_assignment): For CONCAT to_rtx, complex type from and
	bitpos/bitsize covering the whole destination, use store_expr only if
	the complex mode is the same.  Otherwise, use expand_normal and if
	it returns CONCAT, subreg each part separately instead of trying to
	subreg the whole result.

	* gfortran.dg/pr82253.f90: New test.

From-SVN: r255711
2017-12-15 22:54:15 +01:00
Jakub Jelinek 98a409be9d backport: re PR debug/83084 (-fcompare-debug failure on ppc64le)
Backported from mainline
	2017-11-22  Jakub Jelinek  <jakub@redhat.com>

	PR debug/83084
	* valtrack.c (propagate_for_debug_subst, propagate_for_debug): Reset
	debug insns if they would contain UNSPEC_VOLATILE or volatile asm.
	(dead_debug_insert_temp): Likewise, but also ignore even non-volatile
	asm.

	* g++.dg/opt/pr83084.C: New test.

From-SVN: r255710
2017-12-15 22:53:29 +01:00
Jakub Jelinek 98ea6f03f9 backport: re PR target/82880 (gcc --help=target --help=optimizers hangs on mips)
Backported from mainline
	2017-11-21  James Cowgill  <James.Cowgill@imgtec.com>
		    Jakub Jelinek  <jakub@redhat.com>

	PR target/82880
	* config/mips/frame-header-opt.c (mips_register_frame_header_opt):
	Remove static keyword from f variable.

	* gcc.dg/opts-8.c: New test.

From-SVN: r255709
2017-12-15 22:52:06 +01:00
Jakub Jelinek 0c924e851e backport: re PR c++/83059 (ICE on invalid C++ code: in tree_to_uhwi, at tree.c:6633)
Backported from mainline
	2017-11-21  Jakub Jelinek  <jakub@redhat.com>

	PR c++/83059
	* c-common.c (get_atomic_generic_size): Use TREE_INT_CST_LOW
	instead of tree_to_uhwi, formatting fix.

	* c-c++-common/pr83059.c: New test.

From-SVN: r255708
2017-12-15 22:50:52 +01:00
Jakub Jelinek e74d698765 backport: re PR c++/82781 (Vector extension operators return wrong result in constexpr)
Backported from mainline
	2017-11-20  Jakub Jelinek  <jakub@redhat.com>

	PR c++/82781
	* constexpr.c (cxx_eval_vector_conditional_expression): New function.
	(cxx_eval_constant_expression) <case VEC_COND_EXPR>: Use it instead
	of cxx_eval_conditional_expression.

	* g++.dg/ext/constexpr-pr82781.C: New test.

From-SVN: r255707
2017-12-15 22:50:00 +01:00
Richard Biener 2c44df49aa backport: re PR tree-optimization/82060 (ICE in refs_may_alias_p_1 with devirtualization enabled)
2017-12-15  Richard Biener  <rguenther@suse.de>

	Backport from mainline
	PR tree-optimization/82060
	* tree-ssa-pre.c (eliminate_dom_walker::before_dom_children):
	Move devirtualization after stmt folding and before EH/AB/noreturn
	cleanup to get the stmt refs canonicalized.  Use a bool instead
	of gimple_modified_p since that doesn't work for NOPs.  Schedule
	NOPs generated by folding for removal.

	* g++.dg/torture/pr82060.C: New testcase.

From-SVN: r255682
2017-12-15 10:12:08 +00:00
Sudakshina Das c49c3117e3 Fix regression on soft float targets for armv8_2-fp16-move-2.c
*** gcc/testsuite/ChangeLog ***

2017-12-15  Sudakshina Das  <sudi.das@arm.com>

	* gcc.target/arm/armv8_2-fp16-move-2.c: Remove dg-add-options.

From-SVN: r255681
2017-12-15 09:59:24 +00:00
Richard Biener ab5f49b5d8 backport: [multiple changes]
2017-12-15  Richard Biener  <rguenther@suse.de>
 
	Backport from mainline
	2017-09-05  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/82102
	* tree-ssa-pre.c (eliminate): Check if lhs is NULL.

	* gcc.dg/torture/pr82102.c: New testcase.

	2017-09-13  Richard Biener  <rguenther@suse.de>

	PR middle-end/82128
	* gimple-fold.c (gimple_fold_call): Update SSA name in-place to
	default-def to avoid breaking iterator update with the weird
	interaction with cgraph_update_edges_for_call_stmt_node.

	* g++.dg/pr82128.C: New testcase.

From-SVN: r255678
2017-12-15 08:19:15 +00:00
Richard Biener ec40d1a8ad Backport PRs 82402, 82697, 82765, 82902
2017-12-15  Richard Biener  <rguenther@suse.de>

	Backport from mainline
	2017-11-24  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/82402
	* tree-vect-loop-manip.c (create_lcssa_for_virtual_phi): Properly
	set SSA_NAME_OCCURS_IN_ABNORMAL_PHI.

	* gcc.dg/torture/pr82402.c: New testcase.

	2017-10-24  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/82697
	* tree-ssa-phiopt.c (cond_store_replacement): Use alias-set
	zero for conditional load and unconditional store.

	* gcc.dg/torture/pr82697.c: New testcase.

	2017-11-02  Richard Biener  <rguenther@suse.de>

	PR middle-end/82765
	* varasm.c (decode_addr_const): Make offset HOST_WIDE_INT.
	Truncate ARRAY_REF index and element size.

	* gcc.dg/pr82765.c: New testcase.

	2017-11-09  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/82902
	* tree-ssa-phiprop.c (propagate_with_phi): Test proper type.

	* g++.dg/torture/pr82902.C: New testcase.

From-SVN: r255677
2017-12-15 08:12:10 +00:00
Peter Bergner 34f5d7982a backport: re PR target/80210 (ICE in in extract_insn, at recog.c:2311 on ppc64 for with __builtin_pow)
gcc/
	Backport from mainline
	2017-10-02  Peter Bergner  <bergner@vnet.ibm.com>

	PR target/80210
	* config/rs6000/rs6000.c (rs6000_option_override_internal): Rewrite
	function to not use the have_cpu variable.  Do not set cpu_index,
	rs6000_cpu_index or rs6000_tune_index if we end up using TARGET_DEFAULT
	or the default cpu.
	(rs6000_valid_attribute_p): Remove duplicate initializations of
	old_optimize and func_optimize.
	(rs6000_pragma_target_parse): Call rs6000_activate_target_options ().
	(rs6000_activate_target_options): Make global.
	* config/rs6000/rs6000-protos.h (rs6000_activate_target_options): Add
	prototype.

gcc/testsuite/
	Backport from mainline
	2017-10-02  Peter Bergner  <bergner@vnet.ibm.com>

	PR target/80210
	* gcc.target/powerpc/pr80210-2.c: New test.

From-SVN: r255655
2017-12-14 11:43:32 -06:00
Eric Botcazou a9834d8de0 decl.c (gnat_to_gnu_field): Do not set the alignment of the enclosing record type if it is not already set.
* gcc-interface/decl.c (gnat_to_gnu_field): Do not set the alignment
	of the enclosing record type if it is not already set.

From-SVN: r255646
2017-12-14 17:05:43 +00:00
Peter Bergner 7eb38f05ee backport: ppc-auxv.h (PPC_FEATURE2_HTM_NO_SUSPEND): New define.
gcc/
	Backport from mainline
	2017-12-13  Peter Bergner  <bergner@vnet.ibm.com>

	* config/rs6000/ppc-auxv.h (PPC_FEATURE2_HTM_NO_SUSPEND): New define.
	* config/rs6000/rs6000.c (cpu_supports_info): Use it.

gcc/testsuite/
	Backport from mainline
	2017-12-13  Peter Bergner  <bergner@vnet.ibm.com>

	* gcc.target/powerpc/cpu-builtin-1.c (htm-no-suspend): Add test.

From-SVN: r255622
2017-12-13 21:43:10 -06:00
Michael Meissner 634940f168 backport: re PR target/81959 (PowerPC __float128 optimization fails with integer PRE_INC addresses)
[gcc]
2017-12-11  Michael Meissner  <meissner@linux.vnet.ibm.com>

	Back port from trunk
	2017-12-01  Michael Meissner  <meissner@linux.vnet.ibm.com>

	PR target/81959
	* config/rs6000/rs6000.c (rs6000_address_for_fpconvert): Check for
	whether we can allocate pseudos before trying to fix an address.
	* config/rs6000/rs6000.md (float_<mode>si2_hw): Make sure the
	memory address is indexed or indirect.
	(floatuns_<mode>si2_hw2): Likewise.

[gcct/testsuite]
2017-12-11  Michael Meissner  <meissner@linux.vnet.ibm.com>

	Back port from trunk
	2017-12-01  Michael Meissner  <meissner@linux.vnet.ibm.com>

	PR target/81959
	* gcc.target/powerpc/pr81959.c: New test.

From-SVN: r255545
2017-12-11 18:54:55 +00:00
Sudakshina Das e9c07226b8 Backported 'Fix wrong code by arm_final_prescan with fp16 move instructions'
ChangeLog entry are as follow:

*** gcc/ChangeLog ***

2017-12-11  Sudakshina Das  <sudi.das@arm.com>

	Backported from trunk
	2017-12-01  Sudakshina Das  <sudi.das@arm.com>

	* config/arm/vfp.md (*movhf_vfp_fp16): Add conds attribute.

*** gcc/testsuite/ChangeLog ***

2017-12-11  Sudakshina Das  <sudi.das@arm.com>

	Backported from trunk
	2017-12-01  Sudakshina Das  <sudi.das@arm.com>

	* gcc.target/arm/armv8_2-fp16-move-2.c: New test.

From-SVN: r255541
2017-12-11 17:07:33 +00:00
Kelvin Nilsen 32c5be0d14 backport: re PR target/80101 (ICE in store_data_bypass_p, at recog.c:3737)
gcc/testsuite/ChangeLog:

2017-12-07  Kelvin Nilsen  <kelvin@gcc.gnu.org>

	Backport from trunk
	2017-05-08  Kelvin Nilsen  <kelvin@gcc.gnu.org>

	PR target/80101
	* gcc.target/powerpc/pr80101-1.c: New test.


gcc/ChangeLog:

2017-12-07  Kelvin Nilsen  <kelvin@gcc.gnu.org>

	Backport from trunk
	2017-05-08  Kelvin Nilsen  <kelvin@gcc.gnu.org>

	PR target/80101
	* config/rs6000/power6.md: Replace store_data_bypass_p calls with
	rs6000_store_data_bypass_p in seven define_bypass directives and
	in several comments.
	* config/rs6000/rs6000-protos.h: Add prototype for
	rs6000_store_data_bypass_p function.
	* config/rs6000/rs6000.c (rs6000_store_data_bypass_p): New
	function implements slightly different (rs6000-specific) semantics
	than store_data_bypass_p, returning false rather than aborting
	with assertion error when arguments do not satisfy the
	requirements of store data bypass.
	(rs6000_adjust_cost): Replace six calls of store_data_bypass_p with
	rs6000_store_data_bypass_p.

From-SVN: r255465
2017-12-07 13:20:27 +00:00
Sebastian Peryt 2df7463a7a Fix PR82941 and PR82942 by adding proper vzeroupper generation on SKX.
Add X86_TUNE_EMIT_VZEROUPPER to indicate if vzeroupper instruction should
be inserted before a transfer of control flow out of the function.  It is
turned on by default unless we are tuning for KNL.  Users can always use
-mzeroupper or -mno-zeroupper to override X86_TUNE_EMIT_VZEROUPPER.

2017-12-04  Sebastian Peryt  <sebastian.peryt@intel.com>
	H.J. Lu  <hongjiu.lu@intel.com>

gcc/
	Bakcported from trunk
	PR target/82941
	PR target/82942
	PR target/82990
	* config/i386/i386.c (pass_insert_vzeroupper): Remove
	TARGET_AVX512F check from gate condition.
	(ix86_check_avx256_register): Changed to ...
	(ix86_check_avx_upper_register): ... this. Add extra check for
	VALID_AVX512F_REG_OR_XI_MODE.
	(ix86_avx_u128_mode_needed): Changed
	ix86_check_avx256_register to ix86_check_avx_upper_register.
	(ix86_check_avx256_stores): Changed to ...
	(ix86_check_avx_upper_stores): ... this. Changed
	ix86_check_avx256_register to ix86_check_avx_upper_register.
	(ix86_avx_u128_mode_after): Changed
	avx_reg256_found to avx_upper_reg_found. Changed
	ix86_check_avx256_stores to ix86_check_avx_upper_stores.
	(ix86_avx_u128_mode_entry): Changed
	ix86_check_avx256_register to ix86_check_avx_upper_register.
	(ix86_avx_u128_mode_exit): Ditto.
	(ix86_option_override_internal): Set MASK_VZEROUPPER if
	neither -mzeroupper nor -mno-zeroupper is used and
	TARGET_EMIT_VZEROUPPER is set.
	* config/i386/i386.h: (host_detect_local_cpu): New define.
	(TARGET_EMIT_VZEROUPPER): New.
	* config/i386/x86-tune.def: Add X86_TUNE_EMIT_VZEROUPPER.

2017-12-04  Sebastian Peryt  <sebastian.peryt@intel.com>
	H.J. Lu  <hongjiu.lu@intel.com>

gcc/testsuite/
	Backported from trunk
	PR target/82941
	PR target/82942
	PR target/82990
	* gcc.target/i386/pr82941-1.c: New test.
	* gcc.target/i386/pr82941-2.c: Likewise.
	* gcc.target/i386/pr82942-1.c: Likewise.
	* gcc.target/i386/pr82942-2.c: Likewise.
	* gcc.target/i386/pr82990-1.c: Likewise.
	* gcc.target/i386/pr82990-2.c: Likewise.
	* gcc.target/i386/pr82990-3.c: Likewise.
	* gcc.target/i386/pr82990-4.c: Likewise.
	* gcc.target/i386/pr82990-5.c: Likewise.
	* gcc.target/i386/pr82990-6.c: Likewise.
	* gcc.target/i386/pr82990-7.c: Likewise.

Co-Authored-By: H.J. Lu <hongjiu.lu@intel.com>

From-SVN: r255378
2017-12-04 12:03:37 +01:00
Jerry DeLisle 7aee7828de backport: re PR fortran/83191 (Writing a namelist with repeated complex numbers)
2017-12-03  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
            Dominique d'Humieres  <dominiq@lps.ens.fr>

        Backport from trunk
        PR libgfortran/83191
        * io/transfer.c (list_formatted_read_scalar): Do not set
        namelist_mode bit here. (namelist_read): Likewise.
        (data_transfer_init): Clear the mode bit here.
        (finalize_transfer): Do set the mode bit just before any calls
        to namelist_read or namelist_write. It can now be referred to
        in complex_write.
        * io/write.c (write_complex): Suppress the leading blanks when
        namelist_mode bit is not set to 1.

        * gfortran.dg/namelist_95.f90: New test.

Co-Authored-By: Dominique d'Humieres <dominiq@lps.ens.fr>

From-SVN: r255368
2017-12-03 20:43:59 +00:00
Martin Jambor daccaeb998 Be conservative with arithmetic jmp-function types
2017-11-29  Martin Jambor  <mjambor@suse.cz>

	PR ipa/82808
	* tree.c (expr_type_first_operand_type_p): New function.
	* tree.h (expr_type_first_operand_type_p): Declare it.
	* ipa-cp.c (ipa_get_jf_pass_through_result): Use it.

testsuite/
	* gcc.dg/ipa/pr82808.c: New test.

From-SVN: r255256
2017-11-29 23:13:34 +01:00
Paul Thomas a687bfa9f7 backport: re PR fortran/79072 (ICE with class(*) pointer function result and character value)
2017-11-23  Paul Thomas  <pault@gcc.gnu.org>


	Backported from trunk
	PR fortran/79072
	* trans-expr.c (trans_class_vptr_len_assignment): Set from_len
	if the temporary is unlimited polymorphic.
	* trans-stmt.c (trans_associate_var): Use the fake result decl
	to obtain the 'len' field from an explicit function result when
	in that function scope.

2017-11-23  Paul Thomas  <pault@gcc.gnu.org>

	Backported from trunk
	PR fortran/79072
	* gfortran.dg/class_result_5.f90: New test.
	* gfortran.dg/class_result_6.f90: New test.

From-SVN: r255120
2017-11-23 21:02:48 +00:00
Paul Thomas ddf89dd532 backport: re PR fortran/82586 ([PDT] ICE: write_symbol(): bad module symbol)
2017-11-21  Paul Thomas  <pault@gcc.gnu.org>

	Backported from trunk fix for PR82586
	PR fortran/78686
	* resolve.c (resolve_generic_f): Check usage of derived type by
	calling gfc_use_derived.

2017-11-21  Paul Thomas  <pault@gcc.gnu.org>

	Backported from trunk fix for PR82586
	PR fortran/78686
	* gfortran.dg/pr78686.f90: New test.

From-SVN: r255029
2017-11-21 19:09:01 +00:00
Martin Liska 20dda3e716 Backport r254519
2017-11-21  Martin Liska  <mliska@suse.cz>

	Backport from mainline
	2017-11-08  Martin Liska  <mliska@suse.cz>

	PR sanitizer/82792
	* gimplify.c (expand_FALLTHROUGH_r): Skip IFN_ASAN_MARK.
2017-11-21  Martin Liska  <mliska@suse.cz>

	Backport from mainline
	2017-11-08  Martin Liska  <mliska@suse.cz>

	PR sanitizer/82792
	* g++.dg/asan/pr82792.C: New test.

From-SVN: r255011
2017-11-21 16:01:43 +00:00
Martin Liska 3e08f9feda Backport r253845
2017-11-21  Martin Liska  <mliska@suse.cz>

	Backport from mainline
	2017-10-18  Martin Liska  <mliska@suse.cz>

	PR sanitizer/82545
	* asan.c (asan_expand_poison_ifn): Do not put gimple stmt
	on an abnormal edge.
2017-11-21  Martin Liska  <mliska@suse.cz>

	Backport from mainline
	2017-10-18  Martin Liska  <mliska@suse.cz>

	PR sanitizer/82545
	* gcc.dg/asan/pr82545.c: New test.

From-SVN: r255008
2017-11-21 16:00:26 +00:00
Rainer Orth 4a7a8e11a3 Adapt Solaris 12 references
libgo:
	Backport from mainline

    With the change in the Solaris release model (no more major releases
    like Solaris 12 but only minor ones like 11.4), the Solaris 12
    references in GCC need to be adapted.

    Patch by Rainer Orth.

    Reviewed-on: https://go-review.googlesource.com/77490

	libgcc:
	Backport from mainline
	2017-11-14  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	* config.host (*-*-solaris2*): Adapt comment for Solaris 12
	renaming.
	* config/sol2/crtpg.c (__start_crt_compiler): Likewise.
	* configure.ac (libgcc_cv_solaris_crts): Likewise.
	* configure: Regenerate.

	gcc:
	Backport from mainline
	2017-11-14  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	* config.gcc (*-*-solaris2*): Enable default_use_cxa_atexit since
	Solaris 11.  Update comment.
	* configure.ac (gcc_cv_ld_pid): Adapt comment for Solaris 12
	renaming.
	* config/sol2.h (STARTFILE_SPEC): Likewise.
	* configure: Regenerate.

	gcc/testsuite:
	Backport from mainline
	2017-11-14  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	* lib/target-supports.exp (check_effective_target_pie): Adapt
	comment for Solaris 12 renaming.

	* gcc.dg/torture/pr60092.c: Remove *-*-solaris2.11* dg-xfail-run-if.

From-SVN: r254994
2017-11-21 09:31:12 +00:00
Segher Boessenkool 5c956beb8a rs6000: Don't touch below the stack pointer (PR77687)
With the 32-bit SVR4 ABI we don't have a red zone, so we have to restore
the callee-saved registers before we restore the stack pointer.

The previous fix for this PR failed in two ways, for huge frames: first,
we use a negative offset from r11 in that case, so the (mem:BLK 11) access
does no good; second, sched does not handle accesses to mem:BLK correctly
in this case (does not make dependencies).

This patch fixes it by doing a store to (mem:BLK (scratch)) instead.
This means no unrelated (not to stack) loads/stores can be moved over the
stack restore either, but so be it.


	PR target/77687
	* config/rs6000/rs6000.md (stack_restore_tie): Store to a scratch
	address instead of to r1 and r11.

gcc/testsuite/
	PR target/77687
	* gcc.target/powerpc/pr77687.c: New testcase.

From-SVN: r254968
2017-11-20 21:10:28 +01:00
Richard Biener e1f38328f4 re PR tree-optimization/82985 (ICC: in vn_nary_build_or_lookup_1, at tree-ssa-sccvn.c:1722)
2017-11-15  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/82985
	Backport from mainline
	2017-08-15  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/81790
	* tree-ssa-sccvn.c (vn_lookup_simplify_result): Handle both
	CONSTRUCTORs from simplifying and VN.

	* gcc.dg/torture/pr81790.c: New testcase.
	* g++.dg/torture/pr82985.C: Likewise.

From-SVN: r254766
2017-11-15 12:50:39 +00:00
Pierre-Marie de Rodat 395decb0d1 [PATCH] [PR82155] Fix crash in dwarf2out_abstract_function
Backport from mainline (r253147):

This patch is an attempt to fix the crash reported in PR82155.

When generating a C++ class method for a class that is itself nested in
a class method, dwarf2out_early_global_decl currently leaves the
existing context DIE as it is if it already exists.  However, it is
possible that this call happens at a point where this context DIE is
just a declaration that is itself not located in its own context.

From there, if dwarf2out_early_global_decl is not called on any of the
FUNCTION_DECL in the context chain, DIEs will be left badly scoped and
some (such as the nested method) will be removed by the type pruning
machinery.  As a consequence, dwarf2out_abstract_function will will
crash when called on the corresponding DECL because it asserts that the
DECL has a DIE.

This patch fixes this crash making dwarf2out_early_global_decl process
context DIEs the same way we process abstract origins for FUNCTION_DECL:
if the corresponding DIE exists but is only a declaration, call
dwarf2out_decl anyway on it so that it is turned into a more complete
DIE and so that it is relocated in the proper context.

Bootstrapped and regtested on x86_64-linux.

gcc/

	PR debug/82155
	* dwarf2out.c (dwarf2out_early_global_decl): Call dwarf2out_decl
	on the FUNCTION_DECL function context if it has a DIE that is a
	declaration.

gcc/testsuite/

	* g++.dg/pr82155.C: New testcase.

From-SVN: r254761
2017-11-15 11:54:11 +00:00
Paul Thomas 71360fd464 backport: re PR fortran/82934 (Segfault on assumed character length in allocate)
2017-11-13  Paul Thomas  <pault@gcc.gnu.org>

	Backport from trunk
	PR fortran/82934
	* trans-stmt.c (gfc_trans_allocate): Remove the gcc_assert on
	null string length for assumed length typespec and set
	expr3_esize to NULL_TREE;

2017-11-13  Paul Thomas  <pault@gcc.gnu.org>

	Backport from trunk
	PR fortran/82934
	* gfortran.dg/allocate_assumed_charlen_1.f90: New test.

From-SVN: r254709
2017-11-13 20:46:08 +00:00
Paul Thomas 7951af5409 backport: re PR fortran/78619 (ICE in copy_reference_ops_from_ref, at tree-ssa-sccvn.c:889)
2017-11-13  Paul Thomas  <pault@gcc.gnu.org>

	Backport from trunk
	PR fortran/78619
	* check.c (same_type_check): Introduce a new argument 'assoc'
	with default value false. If this is true, use the symbol type
	spec of BT_PROCEDURE expressions.
	(gfc_check_associated): Set 'assoc' true in the call to
	'same_type_check'.

2017-11-13  Paul Thomas  <pault@gcc.gnu.org>

	Backport from trunk
	PR fortran/78619
	* gfortran.dg/pr78619.f90: New test.

From-SVN: r254708
2017-11-13 20:43:26 +00:00
Janne Blomqvist 62adf57eea Introduce logical_type_node and use it
Backport from trunk.

Earlier GFortran used to redefine boolean_type_node, which in the rest
of the compiler means the C/C++ _Bool/bool type, to the Fortran
default logical type.  When this redefinition was removed, a few
issues surfaced. Namely,

1) PR 82869, where we created a boolean tmp variable, and passed it to
the runtime library as a Fortran logical variable of a different size.

2) Fortran specifies that logical operations should be done with the
default logical kind, not in any other kind.

3) Using 8-bit variables have some issues, such as
   - on x86, partial register stalls and length prefix changes.
      - s390 has a compare with immediate and jump instruction which
           works with 32-bit but not 8-bit quantities.

This patch addresses these issues by introducing a type
logical_type_node which is a Fortran LOGICAL variable of default
kind. It is then used in places were the Fortran standard mandates, as
well as for compiler generated temporary variables.

For x86-64, using the Polyhedron benchmark suite, no performance or
code size difference worth mentioning was observed.

Regtested on x86_64-pc-linux-gnu.

gcc/fortran/ChangeLog:

2017-11-13  Janne Blomqvist  <jb@gcc.gnu.org>

	PR 82869
	* convert.c (truthvalue_conversion): Use logical_type_node.
	* trans-array.c (gfc_trans_allocate_array_storage): Likewise.
	(gfc_trans_create_temp_array): Likewise.
	(gfc_trans_array_ctor_element): Likewise.
	(gfc_trans_array_constructor_value): Likewise.
	(trans_array_constructor): Likewise.
	(trans_array_bound_check): Likewise.
	(gfc_conv_array_ref): Likewise.
	(gfc_trans_scalarized_loop_end): Likewise.
	(gfc_conv_array_extent_dim): Likewise.
	(gfc_array_init_size): Likewise.
	(gfc_array_allocate): Likewise.
	(gfc_trans_array_bounds): Likewise.
	(gfc_trans_dummy_array_bias): Likewise.
	(gfc_conv_array_parameter): Likewise.
	(duplicate_allocatable): Likewise.
	(duplicate_allocatable_coarray): Likewise.
	(structure_alloc_comps): Likewise
	(get_std_lbound): Likewise
	(gfc_alloc_allocatable_for_assignment): Likewise
	* trans-decl.c (add_argument_checking): Likewise
	(gfc_generate_function_code): Likewise
	* trans-expr.c (gfc_copy_class_to_class): Likewise
	(gfc_trans_class_array_init_assign): Likewise
	(gfc_trans_class_init_assign): Likewise
	(gfc_conv_expr_present): Likewise
	(gfc_conv_substring): Likewise
	(gfc_conv_cst_int_power): Likewise
	(gfc_conv_expr_op): Likewise
	(gfc_conv_procedure_call): Likewise
	(fill_with_spaces): Likewise
	(gfc_trans_string_copy): Likewise
	(gfc_trans_alloc_subarray_assign): Likewise
	(gfc_trans_pointer_assignment): Likewise
	(gfc_trans_scalar_assign): Likewise
	(fcncall_realloc_result): Likewise
	(alloc_scalar_allocatable_for_assignment): Likewise
	(trans_class_assignment): Likewise
	(gfc_trans_assignment_1): Likewise
	* trans-intrinsic.c (build_fixbound_expr): Likewise
	(gfc_conv_intrinsic_aint): Likewise
	(gfc_trans_same_strlen_check): Likewise
	(conv_caf_send): Likewise
	(trans_this_image): Likewise
	(conv_intrinsic_image_status): Likewise
	(trans_image_index): Likewise
	(gfc_conv_intrinsic_bound): Likewise
	(conv_intrinsic_cobound): Likewise
	(gfc_conv_intrinsic_mod): Likewise
	(gfc_conv_intrinsic_dshift): Likewise
	(gfc_conv_intrinsic_dim): Likewise
	(gfc_conv_intrinsic_sign): Likewise
	(gfc_conv_intrinsic_ctime): Likewise
	(gfc_conv_intrinsic_fdate): Likewise
	(gfc_conv_intrinsic_ttynam): Likewise
	(gfc_conv_intrinsic_minmax): Likewise
	(gfc_conv_intrinsic_minmax_char): Likewise
	(gfc_conv_intrinsic_anyall): Likewise
	(gfc_conv_intrinsic_arith): Likewise
	(gfc_conv_intrinsic_minmaxloc): Likewise
	(gfc_conv_intrinsic_minmaxval): Likewise
	(gfc_conv_intrinsic_btest): Likewise
	(gfc_conv_intrinsic_bitcomp): Likewise
	(gfc_conv_intrinsic_shift): Likewise
	(gfc_conv_intrinsic_ishft): Likewise
	(gfc_conv_intrinsic_ishftc): Likewise
	(gfc_conv_intrinsic_leadz): Likewise
	(gfc_conv_intrinsic_trailz): Likewise
	(gfc_conv_intrinsic_mask): Likewise
	(gfc_conv_intrinsic_spacing): Likewise
	(gfc_conv_intrinsic_rrspacing): Likewise
	(gfc_conv_intrinsic_size): Likewise
	(gfc_conv_intrinsic_sizeof): Likewise
	(gfc_conv_intrinsic_transfer): Likewise
	(gfc_conv_allocated): Likewise
	(gfc_conv_associated): Likewise
	(gfc_conv_same_type_as): Likewise
	(gfc_conv_intrinsic_trim): Likewise
	(gfc_conv_intrinsic_repeat): Likewise
	(conv_isocbinding_function): Likewise
	(conv_intrinsic_ieee_is_normal): Likewise
	(conv_intrinsic_ieee_is_negative): Likewise
	(conv_intrinsic_ieee_copy_sign): Likewise
	(conv_intrinsic_move_alloc): Likewise
	* trans-io.c (set_parameter_value_chk): Likewise
	(set_parameter_value_inquire): Likewise
	(set_string): Likewise
	* trans-openmp.c (gfc_walk_alloc_comps): Likewise
	(gfc_omp_clause_default_ctor): Likewise
	(gfc_omp_clause_copy_ctor): Likewise
	(gfc_omp_clause_assign_op): Likewise
	(gfc_omp_clause_dtor): Likewise
	(gfc_omp_finish_clause): Likewise
	(gfc_trans_omp_clauses): Likewise
	(gfc_trans_omp_do): Likewise
	* trans-stmt.c (gfc_trans_goto): Likewise
	(gfc_trans_sync): Likewise
	(gfc_trans_arithmetic_if): Likewise
	(gfc_trans_simple_do): Likewise
	(gfc_trans_do): Likewise
	(gfc_trans_forall_loop): Likewise
	(gfc_trans_where_2): Likewise
	(gfc_trans_allocate): Likewise
	(gfc_trans_deallocate): Likewise
	* trans-types.c (gfc_init_types): Initialize logical_type_node and
	their true/false trees.
	(gfc_get_array_descr_info): Use logical_type_node.
	* trans-types.h (logical_type_node): New tree.
	(logical_true_node): Likewise.
	(logical_false_node): Likewise.
	* trans.c (gfc_trans_runtime_check): Use logical_type_node.
	(gfc_call_malloc): Likewise
	(gfc_allocate_using_malloc): Likewise
	(gfc_allocate_allocatable): Likewise
	(gfc_add_comp_finalizer_call): Likewise
	(gfc_add_finalizer_call): Likewise
	(gfc_deallocate_with_status): Likewise
	(gfc_deallocate_scalar_with_status): Likewise
	(gfc_call_realloc): Likewise


gcc/testsuite/ChangeLog:

2017-11-13  Janne Blomqvist  <jb@gcc.gnu.org>

	PR 82869
	* gfortran.dg/logical_temp_io.f90: New test.
	* gfortran.dg/logical_temp_io_kind8.f90: New test.

From-SVN: r254706
2017-11-13 22:01:20 +02:00
Eric Botcazou 98598f0537 utils.c (convert): Add comment and do not fall through to the next case.
* gcc-interface/utils.c (convert) <RECORD_TYPE>: Add comment and do
	not fall through to the next case.
	<ARRAY_TYPE>: Deal specially with a dereference from another array
	type with the same element type.

From-SVN: r254619
2017-11-10 08:23:20 +00:00
Paul Thomas d006aa2b09 backport: re PR fortran/78641 ([OOP] ICE on polymorphic allocatable function in array constructor)
2017-11-06  Paul Thomas  <pault@gcc.gnu.org>

	Backported from trunk
	PR fortran/78641
	* resolve.c (resolve_ordinary_assign): Do not add the _data
	component for class valued array constructors being assigned
	to derived type arrays.
	* trans-array.c (gfc_trans_array_ctor_element): Take the _data
	of class valued elements for assignment to derived type arrays.

2017-11-06  Paul Thomas  <pault@gcc.gnu.org>

	Backported from trunk
	PR fortran/78641
	* gfortran.dg/class_66.f90: New test.

From-SVN: r254444
2017-11-06 10:40:11 +00:00
Paul Thomas cc44302bc6 [multiple changes]
2017-11-06  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/69739
	* trans-expr.c (gfc_map_intrinsic_function): Return false for
	bounds without the DIM argument instead of ICEing.

2017-11-06  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/69739
	* gfortran.dg/pr69739.f90: New test.

From-SVN: r254442
2017-11-06 10:14:29 +00:00
Steven G. Kargl 6cdeebc0e6 re PR fortran/82796 (Private+equivalence in used module breaks compilation of pure function)
2017-11-04  Steven G. Kargl  <kargl@gcc.gnu.org>

	PR fortran/82796
	* resolve.c (resolve_equivalence): An entity in a common block within
 	a module cannot appear in an equivalence statement if the entity is
	with a pure procedure.

2017-11-04  Steven G. Kargl  <kargl@gcc.gnu.org>

	PR fortran/82796
	* gfortran.dg/equiv_pure.f90: New test.

From-SVN: r254409
2017-11-04 16:41:09 +00:00
Andre Vehreschild 56d687fec3 trans-expr.c (gfc_trans_assignment_1): Character kind conversion may create a loop variant temporary, too.
gcc/fortran/ChangeLog:

2017-11-04  Andre Vehreschild  <vehre@gcc.gnu.org>

	* trans-expr.c (gfc_trans_assignment_1): Character kind conversion may
	create a loop variant temporary, too.
	* trans-intrinsic.c (conv_caf_send): Treat char arrays as arrays and
	not as scalars.
	* trans.c (get_array_span): Take the character kind into account when
	doing pointer arithmetic.

gcc/testsuite/ChangeLog:

2017-11-04  Andre Vehreschild  <vehre@gcc.gnu.org>

	* gfortran.dg/coarray/send_char_array_1.f90: New test.

From-SVN: r254408
2017-11-04 15:37:03 +01:00
Paul Thomas 726e7a70b9 re PR fortran/81735 (double free or corruption (fasttop) error (SIGABRT) with character(:) and custom return type with allocatable)
2017-11-03  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/81735
	* trans-decl.c (gfc_trans_deferred_vars): Correct case where
	'tmp' can be used unititialized.

2017-11-03  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/81735
	* gfortran.dg/pr81735.f90: New test.

From-SVN: r254389
2017-11-03 19:01:29 +00:00
Eric Botcazou f92892ddbb Move testsuite entry to proper file
From-SVN: r254347
2017-11-02 15:02:23 +00:00
Tamar Christina 64814d1e43 backport: [multiple changes]
2017-11-01  Tamar Christina  <tamar.christina@arm.com>                                                                                                           

        Backported from trunk
        * gcc.dg/vect/vect-align-1.c: Fix vect_hw_misalign condition.
        * gcc.dg/vect/vect-align-2.c: Likewise.
        * gcc.dg/vect/vect-multitypes-1.c: Likewise

2017-11-01  Tamar Christina  <tamar.christina@arm.com>

        Backported from trunk
        * gcc.dg/vect/vect-multitypes-1.c: Correct target selector.

2017-11-01  Christophe Lyon  <christophe.lyon@linaro.org>

        Backported from trunk
        * lib/target-supports.exp (check_effective_target_vect_hw_misalign):
        Fix arm check.

From-SVN: r254301
2017-11-01 11:57:48 +00:00
Paul Thomas 3ce323d917 re PR libfortran/80850 (Sourced allocate() fails to allocate a pointer)
2017-11-01  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/80850
	* trans_expr.c (gfc_conv_procedure_call): When passing a class
	argument to an unlimited polymorphic dummy, it is wrong to cast
	the passed expression as unlimited, unless it is unlimited. The
	correct way is to assign to each of the fields and set the _len
	field to zero.

2017-11-01  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/80850
	* gfortran.dg/class_64_f90 : New test.

From-SVN: r254299
2017-11-01 11:29:07 +00:00
Martin Jambor aafe60b2f4 [PR 81702] Remove devirtualization assert
2017-11-01  Martin Jambor  <mjambor@suse.cz>

	PR c++/81702
	* gimple-fold.c (gimple_get_virt_method_for_vtable): Remove assert.

testsuite/
	* g++.dg/tree-ssa/pr81702.C: New test.

From-SVN: r254295
2017-11-01 11:35:13 +01:00
Paul Thomas 1281989b2b re PR libfortran/80850 (Sourced allocate() fails to allocate a pointer)
2017-11-01  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/80850
	* trans_expr.c (gfc_conv_procedure_call): When passing a class
	argument to an unlimited polymorphic dummy, it is wrong to cast
	the passed expression as unlimited, unless it is unlimited. The
	correct way is to assign to each of the fields and set the _len
	field to zero.

2017-11-01  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/80850
	* gfortran.dg/class_64_f90 : New test.

From-SVN: r254293
2017-11-01 09:33:26 +00:00
Paolo Carlini 4fb0491161 re PR c++/82085 (ICE: Template variable reference used in nested template alias)
/cp
2017-10-30  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/82085
	* pt.c (tsubst_copy_and_build, [INDIRECT_REF]): For a REFERENCE_REF_P,
	unconditionally call convert_from_reference.

/testsuite
2017-10-30  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/82085
	* g++.dg/cpp1y/var-templ56.C: New.

From-SVN: r254240
2017-10-30 19:17:40 +00:00
Paul Thomas d138f8ec62 re PR fortran/81758 ([OOP] Broken vtab)
2017-10-28  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/81758
	* trans-expr.c (trans_class_vptr_len_assignment): 'vptr_expr'
	must only be set if the right hand side expression is of type
	class.

2017-10-28  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/81758
	* gfortran.dg/class_63.f90: New test.

From-SVN: r254196
2017-10-28 08:53:19 +00:00
Jakub Jelinek 9dccb36f6b backport: re PR c++/82159 (ICE: in assign_temp, at function.c:961)
Backported from mainline
	2017-10-12  Jakub Jelinek  <jakub@redhat.com>

	PR c++/82159
	* expr.c (store_field): Don't optimize away bitsize == 0 store
	from CALL_EXPR with addressable return type.

	* g++.dg/opt/pr82159-2.C: New test.

From-SVN: r254181
2017-10-27 22:35:06 +02:00
Jakub Jelinek 02a55dcbaf backport: re PR c++/82373 (syntax error in error message)
Backported from mainline
	2017-10-04  Jakub Jelinek  <jakub@redhat.com>

	PR c++/82373
	* error.c (dump_function_decl): If show_return, call dump_type_suffix
	on the same return type dump_type_prefix has been called on.

	* g++.dg/cpp1y/pr82373.C: New test.

From-SVN: r254180
2017-10-27 22:34:22 +02:00
Jakub Jelinek d84264fb75 backport: re PR sanitizer/81715 (asan-stack=1 redzone allocation is too inflexible)
Backported from mainline
	2017-09-21  Jakub Jelinek  <jakub@redhat.com>

	PR sanitizer/81715
	* tree-inline.c (expand_call_inline): Emit clobber stmts for
	VAR_DECLs to which addressable non-volatile parameters are mapped
	and for id->retvar after the return value assignment, though
	for -fsanitize=kernel-address only.  Clear id->retval and id->retbnd
	after inlining.

	* g++.dg/asan/pr81715.C: New test.

From-SVN: r254179
2017-10-27 22:33:35 +02:00
Jakub Jelinek eeecd15ffc backport: re PR rtl-optimization/82192 (gcc produces incorrect code with -O2 and bit-field)
Backported from mainline
	2017-09-15  Jakub Jelinek  <jakub@redhat.com>

	PR rtl-optimization/82192
	* combine.c (make_extraction): Don't look through non-paradoxical
	SUBREGs or TRUNCATE if pos + len is or might be bigger than
	inner's mode.

	* gcc.c-torture/execute/pr82192.c: New test.

From-SVN: r254177
2017-10-27 22:32:21 +02:00
Jakub Jelinek dba9a0fe80 re PR target/82703 (Wrong addition of std::array components with -O2 -ftree-loop-vectorize -ftree-slp-vectorize (works fine with -O2))
PR target/82703
	* config/i386/i386-protos.h (maybe_get_pool_constant): Removed.
	* config/i386/i386.c (maybe_get_pool_constant): Removed.
	(ix86_split_to_parts): Use avoid_constant_pool_reference instead of
	maybe_get_pool_constant.
	* config/i386/predicates.md (zero_extended_scalar_load_operand):
	Likewise.

	* gcc.dg/pr82703.c: New test.

From-SVN: r254146
2017-10-27 14:25:34 +02:00