Commit Graph

153883 Commits

Author SHA1 Message Date
GCC Administrator c9173d486c Daily bump.
From-SVN: r256826
2018-01-18 00:16:12 +00:00
Jason Merrill b4e93c5826 PR c++/81843 - ICE with variadic member template.
PR c++/72801
	* pt.c (unify_pack_expansion): Don't try to deduce enclosing
	template args.

From-SVN: r256808
2018-01-17 13:08:05 -05:00
Jason Merrill 99547487e1 PR c++/82331 - ICE with variadic partial specialization of auto
* pt.c (unify) [TEMPLATE_PARM_INDEX]: Set processing_template_decl
	around call to tsubst.

From-SVN: r256807
2018-01-17 13:07:53 -05:00
Jason Merrill d1f067b812 PR c++/82760 - memory corruption with aligned new.
* call.c (build_operator_new_call): Update *args if we add the
	align_arg.

From-SVN: r256806
2018-01-17 13:07:45 -05:00
Richard Biener 4743bef07a backport: [multiple changes]
2018-01-17  Richard Biener  <rguenther@suse.de>

	Backport from mainline
	2017-12-18  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/81877
	* tree-ssa-loop-im.c (ref_indep_loop_p): Remove safelen parameters.
	(outermost_indep_loop): Adjust.
	(ref_indep_loop_p_1): Likewise.  Remove safelen handling again.
	(can_sm_ref_p): Adjust.

	* g++.dg/torture/pr81877.C: New testcase.
	* g++.dg/vect/pr70729.cc: XFAIL.
	* g++.dg/vect/pr70729-nest.cc: XFAIL.

	2017-12-08  Richard Biener  <rguenther@suse.de>

	PR middle-end/81782
	* tree-ssa-uninit.c (warn_uninitialized_vars): Properly
	handle accesses outside of zero-sized vars.

	* gcc.dg/uninit-pr81782.c: New testcase.

From-SVN: r256792
2018-01-17 12:51:07 +00:00
Kyrylo Tkachov f743dd807b [arm] PR target/83687: Fix invalid combination of VSUB + VABS into VABD
Backport from mailine
        2018-01-15  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>

        PR target/83687
        * config/arm/iterators.md (VF): New mode iterator.
        * config/arm/neon.md (neon_vabd<mode>_2): Use the above.
        Remove integer-related logic from pattern.
        (neon_vabd<mode>_3): Likewise.

        * gcc.target/arm/neon-combine-sub-abs-into-vabd.c: Delete integer
        tests.
        * gcc.target/arm/pr83687.c: New test.

From-SVN: r256791
2018-01-17 11:51:03 +00:00
Martin Liska 76bc6ce90f Backport r256266
2018-01-17  Martin Liska  <mliska@suse.cz>

	Backport from mainline
	2018-01-04  Jakub Jelinek  <jakub@redhat.com>

	PR ipa/82352
	* g++.dg/ipa/pr82352.C (size_t): Define to __SIZE_TYPE__ instead of
	long unsigned int.

From-SVN: r256790
2018-01-17 11:46:56 +00:00
Martin Liska 6f8fe8b724 Backport r256226
2018-01-17  Martin Liska  <mliska@suse.cz>

	Backport from mainline
	2018-01-04  Martin Liska  <mliska@suse.cz>

	PR ipa/82352
	* ipa-icf.c (sem_function::merge): Do not cross comdat boundary.
2018-01-17  Martin Liska  <mliska@suse.cz>

	Backport from mainline
	2018-01-04  Martin Liska  <mliska@suse.cz>

	PR ipa/82352
	* g++.dg/ipa/pr82352.C: New test.

From-SVN: r256789
2018-01-17 11:46:31 +00:00
Martin Liska c27677a5db Backport r256177
2018-01-17  Martin Liska  <mliska@suse.cz>

	Backport from mainline
	2018-01-03  Martin Liska  <mliska@suse.cz>

	PR ipa/83549
	* cif-code.def (VARIADIC_THUNK): New enum value.
	* ipa-inline-analysis.c (compute_inline_parameters):
	Do not inline variadic thunks.
2018-01-17  Martin Liska  <mliska@suse.cz>

	Backport from mainline
	2018-01-03  Martin Liska  <mliska@suse.cz>

	PR ipa/83549
	* g++.dg/ipa/pr83549.C: New test.

From-SVN: r256788
2018-01-17 11:45:48 +00:00
Martin Liska c7773e6715 Subject: Backport r256009
2018-01-17  Martin Liska  <mliska@suse.cz>

	Backport from mainline
	2017-12-27  Martin Liska  <mliska@suse.cz>

	PR tree-optimization/83552
	* tree-ssa-strlen.c (fold_strstr_to_strncmp): Assign result
	of get_string_lenth to a SSA_NAME if not a GIMPLE value.
2018-01-17  Martin Liska  <mliska@suse.cz>

	Backport from mainline
	2017-12-27  Martin Liska  <mliska@suse.cz>

	PR tree-optimization/83552
	* gcc.dg/pr83552.c: New test.

From-SVN: r256786
2018-01-17 11:43:56 +00:00
GCC Administrator d64efb4249 Daily bump.
From-SVN: r256771
2018-01-17 00:16:10 +00:00
Eric Botcazou f1560a4d9e re PR testsuite/77734 (FAIL: gcc.dg/plugin/must-tail-call-1.c -fplugin=./must_tail_call_plugin.so (test for excess errors))
PR testsuite/77734
	* gcc.dg/plugin/must-tail-call-1.c: Pass -fdelayed-branch on SPARC.

From-SVN: r256757
2018-01-16 20:48:43 +00:00
Eric Botcazou d60de20fe0 * testsuite/17_intro/names.cc: Undefine 'y' on SPARC/Linux.
From-SVN: r256755
2018-01-16 20:40:30 +00:00
Segher Boessenkool 3a76f570dc rtlanal: dead_or_set_regno_p should handle CLOBBER (PR83424)
In PR83424 combine's move_deaths puts a REG_DEAD note in the wrong place
because dead_or_set_regno_p does not account for CLOBBER insns.  This
fixes it.


	PR rtl-optimization/83424
	* rtlanal.c (dead_or_set_regno_p): Handle CLOBBER just like SET.

gcc/testsuite/
	PR rtl-optimization/83424
	* gcc.dg/pr83424.c: New testsuite.

From-SVN: r256750
2018-01-16 17:20:10 +01:00
H.J. Lu f1176d9edc i386: Don't use reference of struct ix86_frame
Use reference of struct ix86_frame in ix86_expand_prologue and
ix86_expand_epilogue caused:

raised STORAGE_ERROR : stack overflow or erroneous memory access
make[5]: *** [/export/gnu/import/git/sources/gcc/gcc/ada/Make-generated.in:45: ada/sinfo.h] Error 1

on trunk when bootstrapping GCC with ada on x86-64.

	* config/i386/i386.c (ix86_expand_prologue): Don't use reference
	of struct ix86_frame.
	(ix86_expand_epilogue): Likewise.

From-SVN: r256742
2018-01-16 04:49:29 -08:00
H.J. Lu ce8249fe78 x86: Disallow -mindirect-branch=/-mfunction-return= with -mcmodel=large
Since the thunk function may not be reachable in large code model,
-mcmodel=large is incompatible with -mindirect-branch=thunk,
-mindirect-branch=thunk-extern, -mfunction-return=thunk and
-mfunction-return=thunk-extern.  Issue an error when they are used with
-mcmodel=large.

gcc/

	Backport from mainline
	2018-01-14  H.J. Lu  <hongjiu.lu@intel.com>

	* config/i386/i386.c (ix86_set_indirect_branch_type): Disallow
	-mcmodel=large with -mindirect-branch=thunk,
	-mindirect-branch=thunk-extern, -mfunction-return=thunk and
	-mfunction-return=thunk-extern.
	* doc/invoke.texi: Document -mcmodel=large is incompatible with
	-mindirect-branch=thunk, -mindirect-branch=thunk-extern,
	-mfunction-return=thunk and -mfunction-return=thunk-extern.

gcc/testsuite/

	Backport from mainline
	2018-01-14  H.J. Lu  <hongjiu.lu@intel.com>

	* gcc.target/i386/indirect-thunk-10.c: New test.
	* gcc.target/i386/indirect-thunk-8.c: Likewise.
	* gcc.target/i386/indirect-thunk-9.c: Likewise.
	* gcc.target/i386/indirect-thunk-attr-10.c: Likewise.
	* gcc.target/i386/indirect-thunk-attr-11.c: Likewise.
	* gcc.target/i386/indirect-thunk-attr-9.c: Likewise.
	* gcc.target/i386/ret-thunk-17.c: Likewise.
	* gcc.target/i386/ret-thunk-18.c: Likewise.
	* gcc.target/i386/ret-thunk-19.c: Likewise.
	* gcc.target/i386/ret-thunk-20.c: Likewise.
	* gcc.target/i386/ret-thunk-21.c: Likewise.

From-SVN: r256737
2018-01-16 03:22:01 -08:00
H.J. Lu 3a205fe54c x86: Add 'V' register operand modifier
Add 'V', a special modifier which prints the name of the full integer
register without '%'.  For

extern void (*func_p) (void);

void
foo (void)
{
  asm ("call __x86_indirect_thunk_%V0" : : "a" (func_p));
}

it generates:

foo:
	movq	func_p(%rip), %rax
	call	__x86_indirect_thunk_rax
	ret

gcc/

	Backport from mainline
	2018-01-14  H.J. Lu  <hongjiu.lu@intel.com>

	* config/i386/i386.c (print_reg): Print the name of the full
	integer register without '%'.
	(ix86_print_operand): Handle 'V'.
	 * doc/extend.texi: Document 'V' modifier.

gcc/testsuite/

	Backport from mainline
	2018-01-14  H.J. Lu  <hongjiu.lu@intel.com>

	* gcc.target/i386/indirect-thunk-register-4.c: New test.

From-SVN: r256736
2018-01-16 03:19:51 -08:00
H.J. Lu fedde6d3b9 x86: Add -mindirect-branch-register
Add -mindirect-branch-register to force indirect branch via register.
This is implemented by disabling patterns of indirect branch via memory,
similar to TARGET_X32.

-mindirect-branch= and -mfunction-return= tests are updated with
-mno-indirect-branch-register to avoid false test failures when
-mindirect-branch-register is added to RUNTESTFLAGS for "make check".

gcc/

	Backport from mainline
	2018-01-14  H.J. Lu  <hongjiu.lu@intel.com>

	* config/i386/constraints.md (Bs): Disallow memory operand for
	-mindirect-branch-register.
	(Bw): Likewise.
	* config/i386/predicates.md (indirect_branch_operand): Likewise.
	(GOT_memory_operand): Likewise.
	(call_insn_operand): Likewise.
	(sibcall_insn_operand): Likewise.
	(GOT32_symbol_operand): Likewise.
	* config/i386/i386.md (indirect_jump): Call convert_memory_address
	for -mindirect-branch-register.
	(tablejump): Likewise.
	(*sibcall_memory): Likewise.
	(*sibcall_value_memory): Likewise.
	Disallow peepholes of indirect call and jump via memory for
	-mindirect-branch-register.
	(*call_pop): Replace m with Bw.
	(*call_value_pop): Likewise.
	(*sibcall_pop_memory): Replace m with Bs.
	* config/i386/i386.opt (mindirect-branch-register): New option.
	* doc/invoke.texi: Document -mindirect-branch-register option.

gcc/testsuite/

	Backport from mainline
	2018-01-14  H.J. Lu  <hongjiu.lu@intel.com>

	* gcc.target/i386/indirect-thunk-1.c (dg-options): Add
	-mno-indirect-branch-register.
	* gcc.target/i386/indirect-thunk-2.c: Likewise.
	* gcc.target/i386/indirect-thunk-3.c: Likewise.
	* gcc.target/i386/indirect-thunk-4.c: Likewise.
	* gcc.target/i386/indirect-thunk-5.c: Likewise.
	* gcc.target/i386/indirect-thunk-6.c: Likewise.
	* gcc.target/i386/indirect-thunk-7.c: Likewise.
	* gcc.target/i386/indirect-thunk-attr-1.c: Likewise.
	* gcc.target/i386/indirect-thunk-attr-2.c: Likewise.
	* gcc.target/i386/indirect-thunk-attr-3.c: Likewise.
	* gcc.target/i386/indirect-thunk-attr-4.c: Likewise.
	* gcc.target/i386/indirect-thunk-attr-5.c: Likewise.
	* gcc.target/i386/indirect-thunk-attr-6.c: Likewise.
	* gcc.target/i386/indirect-thunk-attr-7.c: Likewise.
	* gcc.target/i386/indirect-thunk-bnd-1.c: Likewise.
	* gcc.target/i386/indirect-thunk-bnd-2.c: Likewise.
	* gcc.target/i386/indirect-thunk-bnd-3.c: Likewise.
	* gcc.target/i386/indirect-thunk-bnd-4.c: Likewise.
	* gcc.target/i386/indirect-thunk-extern-1.c: Likewise.
	* gcc.target/i386/indirect-thunk-extern-2.c: Likewise.
	* gcc.target/i386/indirect-thunk-extern-3.c: Likewise.
	* gcc.target/i386/indirect-thunk-extern-4.c: Likewise.
	* gcc.target/i386/indirect-thunk-extern-5.c: Likewise.
	* gcc.target/i386/indirect-thunk-extern-6.c: Likewise.
	* gcc.target/i386/indirect-thunk-extern-7.c: Likewise.
	* gcc.target/i386/indirect-thunk-inline-1.c: Likewise.
	* gcc.target/i386/indirect-thunk-inline-2.c: Likewise.
	* gcc.target/i386/indirect-thunk-inline-3.c: Likewise.
	* gcc.target/i386/indirect-thunk-inline-4.c: Likewise.
	* gcc.target/i386/indirect-thunk-inline-5.c: Likewise.
	* gcc.target/i386/indirect-thunk-inline-6.c: Likewise.
	* gcc.target/i386/indirect-thunk-inline-7.c: Likewise.
	* gcc.target/i386/ret-thunk-10.c: Likewise.
	* gcc.target/i386/ret-thunk-11.c: Likewise.
	* gcc.target/i386/ret-thunk-12.c: Likewise.
	* gcc.target/i386/ret-thunk-13.c: Likewise.
	* gcc.target/i386/ret-thunk-14.c: Likewise.
	* gcc.target/i386/ret-thunk-15.c: Likewise.
	* gcc.target/i386/ret-thunk-9.c: Likewise.
	* gcc.target/i386/indirect-thunk-register-1.c: New test.
	* gcc.target/i386/indirect-thunk-register-2.c: Likewise.
	* gcc.target/i386/indirect-thunk-register-3.c: Likewise.

i386: Rename to ix86_indirect_branch_register

Rename the variable for -mindirect-branch-register to
ix86_indirect_branch_register to match the command-line option name.

	Backport from mainline
	2018-01-15  H.J. Lu  <hongjiu.lu@intel.com>

	* config/i386/constraints.md (Bs): Replace
	ix86_indirect_branch_thunk_register with
	ix86_indirect_branch_register.
	(Bw): Likewise.
	* config/i386/i386.md (indirect_jump): Likewise.
	(tablejump): Likewise.
	(*sibcall_memory): Likewise.
	(*sibcall_value_memory): Likewise.
	Peepholes of indirect call and jump via memory: Likewise.
	* config/i386/i386.opt: Likewise.
	* config/i386/predicates.md (indirect_branch_operand): Likewise.
	(GOT_memory_operand): Likewise.
	(call_insn_operand): Likewise.
	(sibcall_insn_operand): Likewise.
	(GOT32_symbol_operand): Likewise.

x86: Rewrite ix86_indirect_branch_register logic

Rewrite ix86_indirect_branch_register logic with

(and (not (match_test "ix86_indirect_branch_register"))
     (original condition before r256662))

	Backport from mainline
	2018-01-15  H.J. Lu  <hongjiu.lu@intel.com>

	* config/i386/predicates.md (constant_call_address_operand):
	Rewrite ix86_indirect_branch_register logic.
	(sibcall_insn_operand): Likewise.

Don't check ix86_indirect_branch_register for GOT operand

Since GOT_memory_operand and GOT32_symbol_operand are simple pattern
matches, don't check ix86_indirect_branch_register here.  If needed,
-mindirect-branch= will convert indirect branch via GOT slot to a call
and return thunk.

	Backport from mainline
	2018-01-15  H.J. Lu  <hongjiu.lu@intel.com>

	* config/i386/constraints.md (Bs): Update
	ix86_indirect_branch_register check.  Don't check
	ix86_indirect_branch_register with GOT_memory_operand.
	(Bw): Likewise.
	* config/i386/predicates.md (GOT_memory_operand): Don't check
	ix86_indirect_branch_register here.
	(GOT32_symbol_operand): Likewise.

i386: Rewrite indirect_branch_operand logic

	Backport from mainline
	2018-01-15  H.J. Lu  <hongjiu.lu@intel.com>

	* config/i386/predicates.md (indirect_branch_operand): Rewrite
	ix86_indirect_branch_register logic.

From-SVN: r256735
2018-01-16 03:17:49 -08:00
H.J. Lu c03a554103 x86: Add -mfunction-return=
Add -mfunction-return= option to convert function return to call and
return thunks.  The default is 'keep', which keeps function return
unmodified.  'thunk' converts function return to call and return thunk.
'thunk-inline' converts function return to inlined call and return thunk.
'thunk-extern' converts function return to external call and return
thunk provided in a separate object file.  You can control this behavior
for a specific function by using the function attribute function_return.

Function return thunk is the same as memory thunk for -mindirect-branch=
where the return address is at the top of the stack:

__x86_return_thunk:
	call L2
L1:
	pause
	lfence
	jmp L1
L2:
	lea 8(%rsp), %rsp|lea 4(%esp), %esp
	ret

and function return becomes

	jmp __x86_return_thunk

-mindirect-branch= tests are updated with -mfunction-return=keep to
avoid false test failures when -mfunction-return=thunk is added to
RUNTESTFLAGS for "make check".

gcc/

	Backport from mainline
	2018-01-14  H.J. Lu  <hongjiu.lu@intel.com>

	* config/i386/i386-protos.h (ix86_output_function_return): New.
	* config/i386/i386.c (ix86_set_indirect_branch_type): Also
	set function_return_type.
	(indirect_thunk_name): Add ret_p to indicate thunk for function
	return.
	(output_indirect_thunk_function): Pass false to
	indirect_thunk_name.
	(ix86_output_indirect_branch_via_reg): Likewise.
	(ix86_output_indirect_branch_via_push): Likewise.
	(output_indirect_thunk_function): Create alias for function
	return thunk if regno < 0.
	(ix86_output_function_return): New function.
	(ix86_handle_fndecl_attribute): Handle function_return.
	(ix86_attribute_table): Add function_return.
	* config/i386/i386.h (machine_function): Add
	function_return_type.
	* config/i386/i386.md (simple_return_internal): Use
	ix86_output_function_return.
	(simple_return_internal_long): Likewise.
	* config/i386/i386.opt (mfunction-return=): New option.
	(indirect_branch): Mention -mfunction-return=.
	* doc/extend.texi: Document function_return function attribute.
	* doc/invoke.texi: Document -mfunction-return= option.

gcc/testsuite/

	Backport from mainline
	2018-01-14  H.J. Lu  <hongjiu.lu@intel.com>

	* gcc.target/i386/indirect-thunk-1.c (dg-options): Add
	-mfunction-return=keep.
	* gcc.target/i386/indirect-thunk-2.c: Likewise.
	* gcc.target/i386/indirect-thunk-3.c: Likewise.
	* gcc.target/i386/indirect-thunk-4.c: Likewise.
	* gcc.target/i386/indirect-thunk-5.c: Likewise.
	* gcc.target/i386/indirect-thunk-6.c: Likewise.
	* gcc.target/i386/indirect-thunk-7.c: Likewise.
	* gcc.target/i386/indirect-thunk-attr-1.c: Likewise.
	* gcc.target/i386/indirect-thunk-attr-2.c: Likewise.
	* gcc.target/i386/indirect-thunk-attr-3.c: Likewise.
	* gcc.target/i386/indirect-thunk-attr-4.c: Likewise.
	* gcc.target/i386/indirect-thunk-attr-5.c: Likewise.
	* gcc.target/i386/indirect-thunk-attr-6.c: Likewise.
	* gcc.target/i386/indirect-thunk-attr-7.c: Likewise.
	* gcc.target/i386/indirect-thunk-attr-8.c: Likewise.
	* gcc.target/i386/indirect-thunk-bnd-1.c: Likewise.
	* gcc.target/i386/indirect-thunk-bnd-2.c: Likewise.
	* gcc.target/i386/indirect-thunk-bnd-3.c: Likewise.
	* gcc.target/i386/indirect-thunk-bnd-4.c: Likewise.
	* gcc.target/i386/indirect-thunk-extern-1.c: Likewise.
	* gcc.target/i386/indirect-thunk-extern-2.c: Likewise.
	* gcc.target/i386/indirect-thunk-extern-3.c: Likewise.
	* gcc.target/i386/indirect-thunk-extern-4.c: Likewise.
	* gcc.target/i386/indirect-thunk-extern-5.c: Likewise.
	* gcc.target/i386/indirect-thunk-extern-6.c: Likewise.
	* gcc.target/i386/indirect-thunk-extern-7.c: Likewise.
	* gcc.target/i386/indirect-thunk-inline-1.c: Likewise.
	* gcc.target/i386/indirect-thunk-inline-2.c: Likewise.
	* gcc.target/i386/indirect-thunk-inline-3.c: Likewise.
	* gcc.target/i386/indirect-thunk-inline-4.c: Likewise.
	* gcc.target/i386/indirect-thunk-inline-5.c: Likewise.
	* gcc.target/i386/indirect-thunk-inline-6.c: Likewise.
	* gcc.target/i386/indirect-thunk-inline-7.c: Likewise.
	* gcc.target/i386/ret-thunk-1.c: New test.
	* gcc.target/i386/ret-thunk-10.c: Likewise.
	* gcc.target/i386/ret-thunk-11.c: Likewise.
	* gcc.target/i386/ret-thunk-12.c: Likewise.
	* gcc.target/i386/ret-thunk-13.c: Likewise.
	* gcc.target/i386/ret-thunk-14.c: Likewise.
	* gcc.target/i386/ret-thunk-15.c: Likewise.
	* gcc.target/i386/ret-thunk-16.c: Likewise.
	* gcc.target/i386/ret-thunk-2.c: Likewise.
	* gcc.target/i386/ret-thunk-3.c: Likewise.
	* gcc.target/i386/ret-thunk-4.c: Likewise.
	* gcc.target/i386/ret-thunk-5.c: Likewise.
	* gcc.target/i386/ret-thunk-6.c: Likewise.
	* gcc.target/i386/ret-thunk-7.c: Likewise.
	* gcc.target/i386/ret-thunk-8.c: Likewise.
	* gcc.target/i386/ret-thunk-9.c: Likewise.

i386: Don't use ASM_OUTPUT_DEF for TARGET_MACHO

ASM_OUTPUT_DEF isn't defined for TARGET_MACHO.  Use ASM_OUTPUT_LABEL to
generate the __x86_return_thunk label, instead of the set directive.
Update testcase to remove the __x86_return_thunk label check.  Since
-fno-pic is ignored on Darwin, update testcases to sscan or "push"
only on Linux.

gcc/

	Backport from mainline
	2018-01-15  H.J. Lu  <hongjiu.lu@intel.com>

	PR target/83839
	* config/i386/i386.c (output_indirect_thunk_function): Use
	ASM_OUTPUT_LABEL, instead of ASM_OUTPUT_DEF, for TARGET_MACHO
	for  __x86.return_thunk.

gcc/testsuite/

	Backport from mainline
	2018-01-15  H.J. Lu  <hongjiu.lu@intel.com>

	PR target/83839
	* gcc.target/i386/indirect-thunk-1.c: Scan for "push" only on
	Linux.
	* gcc.target/i386/indirect-thunk-2.c: Likewise.
	* gcc.target/i386/indirect-thunk-3.c: Likewise.
	* gcc.target/i386/indirect-thunk-4.c: Likewise.
	* gcc.target/i386/indirect-thunk-7.c: Likewise.
	* gcc.target/i386/indirect-thunk-attr-1.c: Likewise.
	* gcc.target/i386/indirect-thunk-attr-2.c: Likewise.
	* gcc.target/i386/indirect-thunk-attr-5.c: Likewise.
	* gcc.target/i386/indirect-thunk-attr-6.c: Likewise.
	* gcc.target/i386/indirect-thunk-attr-7.c: Likewise.
	* gcc.target/i386/indirect-thunk-extern-1.c: Likewise.
	* gcc.target/i386/indirect-thunk-extern-2.c: Likewise.
	* gcc.target/i386/indirect-thunk-extern-3.c: Likewise.
	* gcc.target/i386/indirect-thunk-extern-4.c: Likewise.
	* gcc.target/i386/indirect-thunk-extern-7.c: Likewise.
	* gcc.target/i386/indirect-thunk-register-1.c: Likewise.
	* gcc.target/i386/indirect-thunk-register-3.c: Likewise.
	* gcc.target/i386/indirect-thunk-register-4.c: Likewise.
	* gcc.target/i386/ret-thunk-10.c: Likewise.
	* gcc.target/i386/ret-thunk-11.c: Likewise.
	* gcc.target/i386/ret-thunk-12.c: Likewise.
	* gcc.target/i386/ret-thunk-13.c: Likewise.
	* gcc.target/i386/ret-thunk-14.c: Likewise.
	* gcc.target/i386/ret-thunk-15.c: Likewise.
	* gcc.target/i386/ret-thunk-9.c: Don't check the
	__x86_return_thunk label.
	Scan for "push" only for Linux.

From-SVN: r256734
2018-01-16 03:10:44 -08:00
H.J. Lu 0c198399c1 Update ChangeLog entries
From-SVN: r256733
2018-01-16 03:04:48 -08:00
H.J. Lu 7799a85590 x86: Add -mindirect-branch=
Add -mindirect-branch= option to convert indirect call and jump to call
and return thunks.  The default is 'keep', which keeps indirect call and
jump unmodified.  'thunk' converts indirect call and jump to call and
return thunk.  'thunk-inline' converts indirect call and jump to inlined
call and return thunk.  'thunk-extern' converts indirect call and jump to
external call and return thunk provided in a separate object file.  You
can control this behavior for a specific function by using the function
attribute indirect_branch.

2 kinds of thunks are geneated.  Memory thunk where the function address
is at the top of the stack:

__x86_indirect_thunk:
	call L2
L1:
	pause
	lfence
	jmp L1
L2:
	lea 8(%rsp), %rsp|lea 4(%esp), %esp
	ret

Indirect jmp via memory, "jmp mem", is converted to

	push memory
	jmp __x86_indirect_thunk

Indirect call via memory, "call mem", is converted to

	jmp L2
L1:
	push [mem]
	jmp __x86_indirect_thunk
L2:
	call L1

Register thunk where the function address is in a register, reg:

__x86_indirect_thunk_reg:
	call	L2
L1:
	pause
	lfence
	jmp	L1
L2:
	movq	%reg, (%rsp)|movl    %reg, (%esp)
	ret

where reg is one of (r|e)ax, (r|e)dx, (r|e)cx, (r|e)bx, (r|e)si, (r|e)di,
(r|e)bp, r8, r9, r10, r11, r12, r13, r14 and r15.

Indirect jmp via register, "jmp reg", is converted to

	jmp __x86_indirect_thunk_reg

Indirect call via register, "call reg", is converted to

	call __x86_indirect_thunk_reg

gcc/

	Backport from mainline
	* config/i386/i386-opts.h (indirect_branch): New.
	* config/i386/i386-protos.h (ix86_output_indirect_jmp): Likewise.
	* config/i386/i386.c (ix86_using_red_zone): Disallow red-zone
	with local indirect jump when converting indirect call and jump.
	(ix86_set_indirect_branch_type): New.
	(ix86_set_current_function): Call ix86_set_indirect_branch_type.
	(indirectlabelno): New.
	(indirect_thunk_needed): Likewise.
	(indirect_thunk_bnd_needed): Likewise.
	(indirect_thunks_used): Likewise.
	(indirect_thunks_bnd_used): Likewise.
	(INDIRECT_LABEL): Likewise.
	(indirect_thunk_name): Likewise.
	(output_indirect_thunk): Likewise.
	(output_indirect_thunk_function): Likewise.
	(ix86_output_indirect_branch_via_reg): Likewise.
	(ix86_output_indirect_branch_via_push): Likewise.
	(ix86_output_indirect_branch): Likewise.
	(ix86_output_indirect_jmp): Likewise.
	(ix86_code_end): Call output_indirect_thunk_function if needed.
	(ix86_output_call_insn): Call ix86_output_indirect_branch if
	needed.
	(ix86_handle_fndecl_attribute): Handle indirect_branch.
	(ix86_attribute_table): Add indirect_branch.
	* config/i386/i386.h (machine_function): Add indirect_branch_type
	and has_local_indirect_jump.
	* config/i386/i386.md (indirect_jump): Set has_local_indirect_jump
	to true.
	(tablejump): Likewise.
	(*indirect_jump): Use ix86_output_indirect_jmp.
	(*tablejump_1): Likewise.
	(simple_return_indirect_internal): Likewise.
	* config/i386/i386.opt (mindirect-branch=): New option.
	(indirect_branch): New.
	(keep): Likewise.
	(thunk): Likewise.
	(thunk-inline): Likewise.
	(thunk-extern): Likewise.
	* doc/extend.texi: Document indirect_branch function attribute.
	* doc/invoke.texi: Document -mindirect-branch= option.

gcc/testsuite/

	Backport from mainline
	* gcc.target/i386/indirect-thunk-1.c: New test.
	* gcc.target/i386/indirect-thunk-2.c: Likewise.
	* gcc.target/i386/indirect-thunk-3.c: Likewise.
	* gcc.target/i386/indirect-thunk-4.c: Likewise.
	* gcc.target/i386/indirect-thunk-5.c: Likewise.
	* gcc.target/i386/indirect-thunk-6.c: Likewise.
	* gcc.target/i386/indirect-thunk-7.c: Likewise.
	* gcc.target/i386/indirect-thunk-attr-1.c: Likewise.
	* gcc.target/i386/indirect-thunk-attr-2.c: Likewise.
	* gcc.target/i386/indirect-thunk-attr-3.c: Likewise.
	* gcc.target/i386/indirect-thunk-attr-4.c: Likewise.
	* gcc.target/i386/indirect-thunk-attr-5.c: Likewise.
	* gcc.target/i386/indirect-thunk-attr-6.c: Likewise.
	* gcc.target/i386/indirect-thunk-attr-7.c: Likewise.
	* gcc.target/i386/indirect-thunk-attr-8.c: Likewise.
	* gcc.target/i386/indirect-thunk-bnd-1.c: Likewise.
	* gcc.target/i386/indirect-thunk-bnd-2.c: Likewise.
	* gcc.target/i386/indirect-thunk-bnd-3.c: Likewise.
	* gcc.target/i386/indirect-thunk-bnd-4.c: Likewise.
	* gcc.target/i386/indirect-thunk-extern-1.c: Likewise.
	* gcc.target/i386/indirect-thunk-extern-2.c: Likewise.
	* gcc.target/i386/indirect-thunk-extern-3.c: Likewise.
	* gcc.target/i386/indirect-thunk-extern-4.c: Likewise.
	* gcc.target/i386/indirect-thunk-extern-5.c: Likewise.
	* gcc.target/i386/indirect-thunk-extern-6.c: Likewise.
	* gcc.target/i386/indirect-thunk-extern-7.c: Likewise.
	* gcc.target/i386/indirect-thunk-inline-1.c: Likewise.
	* gcc.target/i386/indirect-thunk-inline-2.c: Likewise.
	* gcc.target/i386/indirect-thunk-inline-3.c: Likewise.
	* gcc.target/i386/indirect-thunk-inline-4.c: Likewise.
	* gcc.target/i386/indirect-thunk-inline-5.c: Likewise.
	* gcc.target/i386/indirect-thunk-inline-6.c: Likewise.
	* gcc.target/i386/indirect-thunk-inline-7.c: Likewise.

From-SVN: r256732
2018-01-16 02:59:42 -08:00
Richard Biener 30bd6019be backport: re PR target/81481 (Spills %xmm to stack in glibc strspn SSE 4.2 variant)
2018-01-16  Richard Biener  <rguenther@suse.de>

	Backport from mainline
	2017-09-29  Vladimir Makarov  <vmakarov@redhat.com>

	PR target/81481
	* ira-costs.c (scan_one_insn): Don't take into account PIC equiv
	with a symbol for LRA.

	* gcc.target/i386/pr81481.c: New.

From-SVN: r256731
2018-01-16 09:51:57 +00:00
GCC Administrator 31ba61a781 Daily bump.
From-SVN: r256718
2018-01-16 00:16:20 +00:00
Segher Boessenkool 8cd9e9f172 backport: re PR target/83629 (ICE: in decompose_normal_address, at rtlanal.c:6329 with -O2 -fPIC -frename-registers --param=sched-autopref-queue-depth=nnn)
Backport from mainline
	2018-01-10  Segher Boessenkool  <segher@kernel.crashing.org>

	PR target/83629
	* config/rs6000/rs6000.md (load_toc_v4_PIC_2, load_toc_v4_PIC_3b,
	load_toc_v4_PIC_3c): Wrap const term in CONST RTL.

gcc/testsuite/
	Backport from mainline
	2018-01-10  Segher Boessenkool  <segher@kernel.crashing.org>

	PR target/83629
	* gcc.target/powerpc/pr83629.c: New testcase.

	2018-01-12  Segher Boessenkool  <segher@kernel.crashing.org>

	PR target/83629
	* gcc.target/powerpc/pr83629.c: Require ilp32.

From-SVN: r256711
2018-01-15 23:08:12 +01:00
H.J. Lu 1984fccf0b i386: Align stack frame if argument is passed on stack
When a function call is removed, it may become a leaf function.  But if
argument may be passed on stack, we need to align the stack frame when
there is no tail call.

Tested on Linux/i686 and Linux/x86-64.

gcc/

	Backport from mainline
	PR target/83330
	* config/i386/i386.c (ix86_function_arg_advance): Set
	outgoing_args_on_stack to true if there are outgoing arguments
	on stack.
	(ix86_function_arg): Likewise.
	(ix86_compute_frame_layout): Align stack frame if argument is
	passed on stack.
	* config/i386/i386.h (machine_function): Add
	outgoing_args_on_stack.

gcc/testsuite/

	Backport from mainline
	PR target/83330
	* gcc.target/i386/pr83330.c: New test.

From-SVN: r256703
2018-01-15 08:13:23 -08:00
H.J. Lu d031a3aaf5 i386: More use reference of struct ix86_frame to avoid copy
When there is no need to make a copy of ix86_frame, we can use reference
of struct ix86_frame to avoid copy.

	Backport from mainline
	* config/i386/i386.c (ix86_expand_prologue): Use reference of
	struct ix86_frame.
	(ix86_expand_epilogue): Likewise.

From-SVN: r256695
2018-01-15 03:33:42 -08:00
H.J. Lu ed493f2709 Move ChangeLog entries to gcc/ChangeLog
From-SVN: r256693
2018-01-15 03:32:23 -08:00
H.J. Lu b3bb6c435e i386: Use reference of struct ix86_frame to avoid copy
When there is no need to make a copy of ix86_frame, we can use reference
of struct ix86_frame to avoid copy.

	Backport from mainline
	* config/i386/i386.c (ix86_can_use_return_insn_p): Use reference
	of struct ix86_frame.
	(ix86_initial_elimination_offset): Likewise.
	(ix86_expand_split_stack_prologue): Likewise.

From-SVN: r256692
2018-01-15 03:28:44 -08:00
H.J. Lu 37d3afcae7 i386: Move struct ix86_frame to machine_function
Make ix86_frame available to i386 code generation.  This is needed to
backport the patch set of -mindirect-branch= to mitigate variant #2 of
the speculative execution vulnerabilities on x86 processors identified
by CVE-2017-5715, aka Spectre.

	Backport from mainline
	* config/i386/i386.c (ix86_frame): Moved to ...
	* config/i386/i386.h (ix86_frame): Here.
	(machine_function): Add frame.
	* config/i386/i386.c (ix86_compute_frame_layout): Repace the
	frame argument with &cfun->machine->frame.
	(ix86_can_use_return_insn_p): Don't pass &frame to
	ix86_compute_frame_layout.  Copy frame from cfun->machine->frame.
	(ix86_can_eliminate): Likewise.
	(ix86_expand_prologue): Likewise.
	(ix86_expand_epilogue): Likewise.
	(ix86_expand_split_stack_prologue): Likewise.

From-SVN: r256691
2018-01-15 03:27:24 -08:00
GCC Administrator b6294d3eab Daily bump.
From-SVN: r256679
2018-01-15 00:16:23 +00:00
Jerry DeLisle 6e3d1ae6e1 backport: re PR libfortran/83811 (fortran 'e' format broken for single digit exponents)
2018-01-14  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	Backport from trunk
	PR libgfortran/83811
	* gfortran.dg/fmt_e.f90: New test.

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

From-SVN: r256675
2018-01-14 21:44:50 +00:00
Bill Schmidt ed402c475a backport: re PR target/83677 (PPC: The xxpermr instruction is not generated correctly)
[gcc]

2018-01-14  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>

	Backport from mainline
	2018-01-08  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>

	PR target/83677
	* config/rs6000/altivec.md (*altivec_vpermr_<mode>_internal):
	Reverse order of second and third operands in first alternative.
	* config/rs6000/rs6000.c (rs6000_expand_vector_set): Reverse order
	of first and second elements in UNSPEC_VPERMR vector.
	(altivec_expand_vec_perm_le): Likewise.

[gcc/testsuite]

2018-01-14  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>

	Backport from mainline
	2018-01-08  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>

	PR target/83677
	* gcc.target/powerpc/pr83677.c: New file.

From-SVN: r256670
2018-01-14 17:47:30 +00:00
Uros Bizjak 38c84ba5d6 backport: re PR rtl-optimization/83628 (performance regression when accessing arrays on alpha)
Backport from mainline
	2018-01-12  Uros Bizjak  <ubizjak@gmail.com>

	PR target/83628
	* config/alpha/alpha.md (*saddsi_1): New insn_ans_split pattern.
	(*saddl_se_1): Ditto.
	(*ssubsi_1): Ditto.
	(*ssubl_se_1): Ditto.

	Backport from mainline
	2018-01-09  Uros Bizjak  <ubizjak@gmail.com>

	PR target/83628
	* combine.c (force_int_to_mode) <case ASHIFT>: Use mode instead of
	op_mode in the force_to_mode call.

testsuite/ChangeLog:

	Backport from mainline
	2018-01-12  Uros Bizjak  <ubizjak@gmail.com>

	PR target/83628
	* gcc.target/alpha/pr83628-3.c: New test.

From-SVN: r256665
2018-01-14 16:45:38 +01:00
GCC Administrator 2d8d78a10d Daily bump.
From-SVN: r256652
2018-01-14 00:16:08 +00:00
Steven G. Kargl e2be496352 backport: re PR fortran/78814 (ICE in symbol_rank, at fortran/interface.c:1265)
2012-01-13  Steven G. Kargl  <kargl@gcc.gnu.org>

	Backport from mainline
        PR fortran/78814
        * interface.c (symbol_rank): Check for NULL pointer.

2012-01-13  Steven G. Kargl  <kargl@gcc.gnu.org>

	Backport from mainline
        PR fortran/78814
        * gfortran.dg/interface_40.f90: New testcase.

From-SVN: r256646
2018-01-13 18:58:56 +00:00
Jonathan Wakely f43b6a905e Fix type printers for Library Fundamentals types
* python/libstdcxx/v6/printers.py (register_type_printers): Remove
	printer for experimental::any. Fix printers for experimental::optional
	and experimental::basic_string_view.

From-SVN: r256604
2018-01-13 01:53:52 +00:00
Jonathan Wakely b520d0cffb PR libstdc++/83626 simplify filesystem::remove and filesystem::remove_all
Backport from mainline
2018-01-05  Jonathan Wakely  <jwakely@redhat.com>

	PR libstdc++/83626
	* src/filesystem/ops.cc (remove(const path&, error_code&)): Remove
	unnecessary symlink_status call.
	(remove_all(const path&, error_code&)): Use filesystem::remove.

From-SVN: r256603
2018-01-13 01:53:47 +00:00
GCC Administrator ab1c0a5d9c Daily bump.
From-SVN: r256601
2018-01-13 00:16:10 +00:00
Oleg Endo 22ec74897c backport: re PR target/81819 ([RX] internal compiler error: in rx_is_restricted_memory_address, at config/rx/rx.c:311)
gcc/
	Backport from mainline
	2018-01-12  Oleg Endo  <olegendo@gcc.gnu.org>

	PR target/81819
	* config/rx/rx.c (rx_is_restricted_memory_address):
	Handle SUBREG case.

From-SVN: r256579
2018-01-12 12:12:38 +00:00
Eric Botcazou 951346c205 re PR rtl-optimization/83565 (RTL combine pass yields wrong rotate result)
PR rtl-optimization/83565
	* rtlanal.c (nonzero_bits1): On WORD_REGISTER_OPERATIONS machines, do
	not extend the result to a larger mode for rotate operations.
	(num_sign_bit_copies1): Likewise.

From-SVN: r256573
2018-01-12 10:20:42 +00:00
Rainer Orth 28b93b9304 Avoid Solaris/SPARC comparison failures with Solaris as (PR bootstrap/81926)
Backport from mainline
	2018-01-04  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	PR bootstrap/81926
	* cgraphunit.c (symbol_table::compile): Switch to text_section
	before calling assembly_start debug hook.

From-SVN: r256562
2018-01-12 05:32:31 +00:00
GCC Administrator e1521062de Daily bump.
From-SVN: r256560
2018-01-12 00:16:09 +00:00
Oleg Endo 05d34c633d backport: re PR target/81821 ([RX] xchg_mem<mode> uses wrong memory operand size)
gcc/
	Backport from mainline
	2018-01-11  Oleg Endo  <olegendo@gcc.gnu.org>

	PR target/81821
	* config/rx/rx.md (BW): New mode attribute.
	(sync_lock_test_and_setsi): Add mode suffix to insn output.

From-SVN: r256538
2018-01-11 15:18:38 +00:00
GCC Administrator 4bf06d991a Daily bump.
From-SVN: r256471
2018-01-11 00:16:09 +00:00
Steven G. Kargl 91716fe0dd re PR fortran/82367 (ICE with deferred length string allocate on non-deferred length argument)
2018-01-10  Steven G. Kargl  <kargl@gcc.gnu.org>

	PR fortran/82367
	* resolve.c (resolve_allocate_expr): Check for NULL pointer.

2018-01-10  Steven G. Kargl  <kargl@gcc.gnu.org>

	PR fortran/82367
	* gfortran.dg/deferred_character_18.f90: New test.

From-SVN: r256466
2018-01-10 23:41:48 +00:00
Steven G. Kargl 7a760f1977 backport: re PR fortran/83093 (ICE in fold_convert_loc, at fold-const.c:2266)
2018-01-10 Steven G. Kargl  <kargl@gcc.gnu.org>

	Backport from trunk
	PR fortran/83093
	* resolve.c (resolve_charlen): Check the type of cl->length
	after resolution.

2018-01-10  Steven G. Kargl  <kargl@gcc.gnu.org>

	Backport from trunk
	PR fortran/83093
	* gfortran.dg/allocate_with_typespec_7.f90: New test.

From-SVN: r256459
2018-01-10 22:35:00 +00:00
Steven G. Kargl ee30b822e5 backport: re PR fortran/82841 (Segfault in gfc_simplify_transfer)
2018-01-10  Steven G. Kargl  <kargl@kgcc.gnu.org>

	Backport r254555 from trunk
	PR Fortran/82841
	* gfortran.dg/transfer_simplify_11.f90: New test.


2018-01-10  Steven G. Kargl  <kargl@kgcc.gnu.org>

	Backport r254555 from trunk
	PR Fortran/82841
	* simplify.c(gfc_simplify_transfer): Do not dereference a NULL pointer.
	Unwrap a short line.

From-SVN: r256445
2018-01-10 18:47:44 +00:00
GCC Administrator df18d5afa6 Daily bump.
From-SVN: r256414
2018-01-10 00:16:13 +00:00
Joseph Myers 8c90c237aa * es.po: Update.
From-SVN: r256409
2018-01-09 23:36:24 +00:00
Richard Biener d8d1029d8e backport: re PR c++/83713 (ICE in do_narrow at gcc/convert.c:474)
2018-01-09  Richard Biener  <rguenther@suse.de>

	Backport from mainline
	2018-01-08  Richard Biener  <rguenther@suse.de>

	PR middle-end/83713
	* convert.c (do_narrow): Properly guard TYPE_OVERFLOW_WRAPS checks.

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

From-SVN: r256371
2018-01-09 08:53:14 +00:00