Commit Graph

178485 Commits

Author SHA1 Message Date
Kito Cheng
2ca1b6d009 PR target/96260 - KASAN should work even back-end not porting anything.
- Most KASAN function don't need any porting anything in back-end
   except asan stack protection.

 - However kernel will given shadow offset when enable asan stack
   protection, so eveything in KASAN can work if shadow offset is given.

 - Verified with x86 and risc-v.

 - Verified with RISC-V linux kernel.

gcc/ChangeLog:

	PR target/96260
	* asan.c (asan_shadow_offset_set_p): New.
	* asan.h (asan_shadow_offset_set_p): Ditto.
	* toplev.c (process_options): Allow -fsanitize=kernel-address
	even TARGET_ASAN_SHADOW_OFFSET not implemented, only check when
	asan stack protection is enabled.

gcc/testsuite/ChangeLog:

	PR target/96260
	* gcc.target/riscv/pr91441.c: Update warning message.
	* gcc.target/riscv/pr96260.c: New.
2020-07-23 14:57:31 +08:00
Hans-Peter Nilsson
5029d42c40 c-c++-common/builtin-has-attribute-4.c: Require visibility.
Another missed attribute-visibility-requirement, causing a failure for
e.g. mmix-knuth-mmixware.  Committed as obvious.

gcc/testsuite:
	* c-c++-common/builtin-has-attribute-4.c: Require visibility.
2020-07-23 04:28:27 +02:00
GCC Administrator
3ea9abca71 Daily bump. 2020-07-23 00:16:28 +00:00
Jonathan Wakely
1f53367fb5 libstdc++: Add static assertions to futures and promises [LWG 3458]
LWG recently decided it should be ill-formed to instantiate std::future
and std::shared_future for types that can't be returned from a function.
This adds static assertions to enforce it (std::future already failed,
but this makes the error more understandable).

LWG 3466 extends that to std::promise. The actual constraint is that
t.~T() is well-formed for the primary template, but rejecting arrays and
functions as done for futures matches that condition.

libstdc++-v3/ChangeLog:

	* include/std/future (future, shared_future, promise): Add
	static assertions to the primary template to reject array and
	function types.
	* testsuite/30_threads/future/requirements/lwg3458.cc: New test.
	* testsuite/30_threads/promise/requirements/lwg3466.cc: New test.
	* testsuite/30_threads/shared_future/requirements/lwg3458.cc: New test.
2020-07-22 20:11:00 +01:00
Tobias Burnus
e55ba804d3 OpenMP: Support 'if (simd:/cancel:' in Fortran
gcc/fortran/ChangeLog:

	* gfortran.h (enum gfc_omp_if_kind): Add OMP_IF_CANCEL and OMP_IF_SIMD.
	* openmp.c (OMP_SIMD_CLAUSES): Add OMP_CLAUSE_IF.
	(gfc_match_omp_clauses, resolve_omp_clauses): Handle 'if (simd/cancel:'.
	* dump-parse-tree.c (show_omp_clauses): Likewise.
	* trans-openmp.c (gfc_trans_omp_clauses, gfc_trans_omp_cancel,
	(gfc_split_omp_clauses): Likewise.

gcc/testsuite/ChangeLog:

	* gfortran.dg/gomp/cancel-2.f90: New test.
	* gfortran.dg/gomp/cancel-3.f90: New test.
	* gfortran.dg/gomp/if-1.f90: New test.
2020-07-22 21:02:01 +02:00
Peter Bergner
ae57566283 rs6000: __builtin_mma_disassemble_acc() doesn't store elements correctly in LE mode
PR96236 shows a problem where we don't correctly store our 512-bit accumulators
correctly in little-endian mode.  The patch below detects when we're doing a
little-endian memory access and stores to the correct memory locations.

2020-07-22  Peter Bergner  <bergner@linux.ibm.com>

gcc/
	PR target/96236
	* config/rs6000/rs6000-call.c (rs6000_gimple_fold_mma_builtin): Handle
	little-endian memory ordering.

gcc/testsuite/
	PR target/96236
	* gcc.target/powerpc/mma-double-test.c: Update storing results for
	correct little-endian ordering.
	* gcc.target/powerpc/mma-single-test.c: Likewise.
2020-07-22 13:36:28 -05:00
Nathan Sidwell
6e1e0decc9 c++: Don't add enums to class's decl_list
We don't need to add CONST_DECLs to a template decl's decl list.  Also made the
code flow a bit clearer.

	gcc/cp/
	* class.c (maybe_add_class_template_decl_list): Don't add CONST_DECLs.
2020-07-22 08:43:26 -07:00
Nathan Sidwell
7be9b276b4 dump: filenames containing -
I discovered the dump machinery would get confused by filenames containing '-'.
Fixed thusly.

	gcc/
	* dumpfile.c (parse_dump_option): Deal with filenames
	containing '-'
2020-07-22 08:43:26 -07:00
Nathan Sidwell
5324a3e621 c++: structural_comptypes addition
I had to debug structural_comptypes, and its complex if conditions and
tail calling of same_type_p made that hard.  I'd hope we can turn the
eqivalent of return boolean_fn () ? true : false; into a tail call of
the boolean.  We also were not dealing with TYPEOF_TYPE.

	gcc/cp/
	* typeck.c (structural_comptypes): [DECLTYPE_TYPE] break
	apart complex if.
	[UNDERLYING_TYPE]: Use an if.
	[TYPEOF_TYPE]: New.
2020-07-22 08:43:25 -07:00
Nathan Sidwell
0f32c94fc7 c++: More cleanups for modern C++
Here are some more places where we can declare variables at the
assignment point, rather than use C89.  Also, let's name our variables
by what they contain -- the register allocator is perfectly able to
track liveness for us.

	gcc/cp/
	* decl.c (decls_match): Move variables into scopes
	they're needed in.
	(duplicate_decls): Use STRIP_TEMPLATE.
	(build_typename_type): Move var decls to their assignments.
	(begin_function_body): Likewise.
	* decl2.c (get_guard): Likewise.
	(mark_used): Use true for truthiness.
	* error.c (dump_aggr_type): Hold the decl in a var called
	'decl', not 'name'.
2020-07-22 08:43:25 -07:00
Nathan Sidwell
63fa0927e8 c++: Shrink lambda-expr
I noticed the default capture mode and the discriminator both used
ints.  That seems excessive.  This shrinks them to 8 bits and 16 bits
respectively.  I suppose the discriminator could use the remaining 24
bits of an int allocation unit, if we're worried about more that 64K
lambdas per function.  I know, users are strange :)  On a 64 bit system
this saves 64 bits, because we also had 32 bits of padding added.

	gcc/cp/
	* cp-tree.h (struct tree_lambda_expr): Shrink
	default_capture_mode & discriminator.
2020-07-22 08:43:25 -07:00
Nathan Sidwell
18d96339d2 preprocessor: add_path simplifications
I noticed add_path was calling strlen more than once on the same
string.  Let's not do that.

	gcc/
	* incpath.c (add_path): Avoid multiple strlen calls.
2020-07-22 08:43:25 -07:00
Nathan Sidwell
5980c0dcc6 c++: mangling cleanups
I noticed the mangler's handling of templates could be simplified.
We know template_info is non-null, which is sufficiently boolean --
no need for an explicit bool return.  also some of the internals of
template_args_equal had crept into find_substitution.  Let's not do
that.

	gcc/cp/
	* mangle.c (decl_is_template_id): Rename to ...
	(maybe_template_info): ... here.  Return the template info,
	rather than use a pointer.  Adjust all callers.
	(find_substitution): Use template_args_equal, rather than
	local check.
2020-07-22 08:43:24 -07:00
H.J. Lu
748ada0acb Limit pr95237-6.c to x86 targets
Since c-c++-common/pr95237-6.c is x86 specific, limit it to x86 targets.

	PR target/95237
	* c-c++-common/pr95237-6.c: Only run for x86 targets.
2020-07-22 07:38:00 -07:00
Jonathan Wakely
a5a8a4e615 libstdc++: Constrain reverse_iterator and move_iterator conversions [LWG 3435]
libstdc++-v3/ChangeLog:

	* include/bits/stl_iterator.h (reverse_iterator): Constrain
	converting constructor and converting assignment operator.
	Access source iterator's data member directly instead of
	calling base().
	(move_iterator): Likewise.
	* testsuite/24_iterators/move_iterator/dr3435.cc: New test.
	* testsuite/24_iterators/reverse_iterator/dr3435.cc: New test.
2020-07-22 15:10:29 +01:00
Jozef Lawrynowicz
259c3965b1 expmed: Fix possible use of NULL_RTX return value from emit_store_flag
MSP430 does not support have any store-flag instructions, so
emit_store_flag can return NULL_RTX.  Catch the NULL_RTX in
expmed.c:expand_sdiv_pow2.

gcc/ChangeLog:

	* expmed.c (expand_sdiv_pow2): Check return value from emit_store_flag
	is not NULL_RTX before use.
2020-07-22 12:38:56 +01:00
Jozef Lawrynowicz
4821e0aabe expr: Allow scalar_int_mode target mode when converting a constant
is_int_mode does not allow MODE_PARTIAL_INT modes, so convert_modes was
not allowing a constant value to be converted to a MODE_PARTIAL_INT for
use as operand 2 in patterns such as ashlpsi3. The constant had
to be copied into a register before it could be used, but now can be
used directly as an operand without any copying.

gcc/ChangeLog:

	* expr.c (convert_modes): Allow a constant integer to be converted to
	any scalar int mode.
2020-07-22 12:34:46 +01:00
Tobias Burnus
ade6e7204c critical-hint-*.{c,f90}: Move from gcc/testsuite to libgomp/testsuite
libgomp/ChangeLog:

	* testsuite/libgomp.c-c++-common/critical-hint-1.c: New; moved from
	gcc/testsuite/c-c++-common/gomp/.
	* testsuite/libgomp.c-c++-common/critical-hint-2.c: Likewise.
	* testsuite/libgomp.fortran/critical-hint-1.f90: New; moved
	from gcc/testsuite/gfortran.dg/gomp/.
	* testsuite/libgomp.fortran/critical-hint-2.f90: Likewise.

gcc/testsuite/ChangeLog:

	* c-c++-common/gomp/critical-hint-1.c: Moved to libgomp/.
	* c-c++-common/gomp/critical-hint-2.c: Moved to libgomp/.
	* gfortran.dg/gomp/critical-hint-1.f90: Moved to libgomp/.
	* gfortran.dg/gomp/critical-hint-2.f90: Moved to libgomp/.
2020-07-22 12:14:22 +02:00
Przemyslaw Wirkus
cd91a08487 Generation of adjusted ldp/stp for vector types
Introduce simple peephole2 optimization which substitutes a sequence of
four consecutive load or store (LDR, STR) instructions with two load or
store pair (LDP, STP) instructions for 2 element supported vector modes
(V2SI, V2SF, V2DI, and V2DF).
Generated load / store pair instruction offset is adjusted accordingly.

Bootstrapped and tested on aarch64-none-linux-gnu.

Example:
$ cat stp_vec_v2sf.c
typedef float __attribute__((vector_size(8))) vec;

void
store_adjusted(vec *out, vec x, vec y)
{
  out[400] = x;
  out[401] = y;
  out[402] = y;
  out[403] = x;
}

Example compiled with:
$ ./aarch64-none-linux-gnu-gcc -S -O2 stp_vec_v2sf.c -dp

Before the patch:

store_adjusted:
    str     d0, [x0, 3200]    // 9    [c=4 l=4]  *aarch64_simd_movv2si/2
    str     d1, [x0, 3208]    // 11   [c=4 l=4]  *aarch64_simd_movv2si/2
    str     d1, [x0, 3216]    // 13   [c=4 l=4]  *aarch64_simd_movv2si/2
    str     d0, [x0, 3224]    // 15   [c=4 l=4]  *aarch64_simd_movv2si/2
    ret       // 26       [c=0 l=4]  *do_return

After the patch:

store_adjusted:
    add     x1, x0, 3200    // 27   [c=4 l=4]  *adddi3_aarch64/0
    stp     d0, d1, [x1]    // 28   [c=0 l=4]  vec_store_pairv2siv2si
    stp     d1, d0, [x1, 16]        // 29   [c=0 l=4]  vec_store_pairv2siv2si
    ret             // 22   [c=0 l=4]  *do_return

gcc/ChangeLog:

	* config/aarch64/aarch64-ldpstp.md: Add two peepholes for adjusted vector
	V2SI, V2SF, V2DI, V2DF load pair and store pair modes.
	* config/aarch64/aarch64-protos.h (aarch64_gen_adjusted_ldpstp):
	Change mode parameter to machine_mode.
	(aarch64_operands_adjust_ok_for_ldpstp): Change mode parameter to
	machine_mode.
	* config/aarch64/aarch64.c (aarch64_operands_adjust_ok_for_ldpstp):
	Change mode parameter to machine_mode.
	(aarch64_gen_adjusted_ldpstp): Change mode parameter to machine_mode.
	* config/aarch64/iterators.md (VP_2E): New iterator for 2 element vectors.

gcc/testsuite/ChangeLog:

	* gcc.target/aarch64/ldp_vec_v2sf.c: New test.
	* gcc.target/aarch64/ldp_vec_v2si.c: New test.
	* gcc.target/aarch64/stp_vec_v2df.c: New test.
	* gcc.target/aarch64/stp_vec_v2di.c: New test.
	* gcc.target/aarch64/stp_vec_v2sf.c: New test.
	* gcc.target/aarch64/stp_vec_v2si.c: New test.
2020-07-22 10:22:11 +01:00
Wei Wentao
e93676fb53 doc: fix a typo in languages.texi
gcc/
	* doc/languages.texi: Fix “then”/“than” typo.
2020-07-22 10:16:34 +01:00
Przemyslaw Wirkus
c58dde8890 MAINTAINERS: Add myself for write after approval
2020-07-22  Przemyslaw Wirkus  <przemyslaw.wirkus@arm.com>

	* MAINTAINERS (Write After Approval): Add myself.
2020-07-22 10:13:00 +01:00
Tobias Burnus
c7c24828cf OpenMP: Fixes for omp critical + hint
gcc/c-family/ChangeLog:

	* c-omp.c (c_finish_omp_critical): Check for no name but
	nonzero hint provided.

gcc/c/ChangeLog:

	* c-parser.c (c_parser_omp_clause_hint): Require nonnegative hint clause.
	(c_parser_omp_critical): Permit hint(0) clause without named critical.
	(c_parser_omp_construct): Don't assert if error_mark_node is returned.

gcc/cp/ChangeLog:

	* parser.c (cp_parser_omp_clause_hint): Require nonnegative hint.
	(cp_parser_omp_critical): Permit hint(0) clause without named critical.
	* pt.c (tsubst_expr): Re-check the latter for templates.

gcc/fortran/ChangeLog:

	* openmp.c (gfc_match_omp_critical): Fix handling hints; permit
	hint clause without named critical.
	(resolve_omp_clauses): Require nonnegative constant integer
	for the hint clause.
	(gfc_resolve_omp_directive): Check for no name but
	nonzero value for hint clause.
	* parse.c (parse_omp_structured_block): Fix same-name check
	for critical.
	* trans-openmp.c (gfc_trans_omp_critical): Handle hint clause properly.

libgomp/ChangeLog:

	* omp_lib.f90.in: Add omp_sync_hint_* and omp_sync_hint_kind.
	* omp_lib.h.in: Likewise.

gcc/testsuite/ChangeLog:

	* g++.dg/gomp/critical-3.C: Add nameless critical with hint testcase.
	* c-c++-common/gomp/critical-hint-1.c: New test.
	* c-c++-common/gomp/critical-hint-2.c: New test.
	* gfortran.dg/gomp/critical-hint-1.f90: New test.
	* gfortran.dg/gomp/critical-hint-2.f90: New test.
2020-07-22 09:57:15 +02:00
Hans-Peter Nilsson
fb1de6a854 gcc.dg/no_profile_instrument_function-attr-1.c: Adjust for NO_DOT_IN_LABEL
mmix-knuth-mmixware is a NO_DOT_IN_LABEL target, so it gets a "_"
instead of the "." in the identifier of interest.  Also tested and
compared to the output for cris-elf which is "regular" regarding
labels: there are no "false positive" identifiers there.  The "." in a
TCL bracket expression matches only a literal ".".

Committed as obvious.

gcc/testsuite:
	* gcc.dg/no_profile_instrument_function-attr-1.c: Adjust scanned
	regex for NO_DOT_IN_LABEL.
2020-07-22 03:46:46 +02:00
GCC Administrator
3043006104 Daily bump. 2020-07-22 00:16:27 +00:00
Sunil K Pandey
0a9d711df3 Add TARGET_LOWER_LOCAL_DECL_ALIGNMENT [PR95237]
Default for this hook is NOP. For x86, in 32 bit mode, this hook
sets alignment of long long on stack to 32 bits if preferred stack
boundary is 32 bits.

  - This patch prevents lowering of alignment from following macros.
	LOCAL_ALIGNMENT
	STACK_SLOT_ALIGNMENT
	LOCAL_DECL_ALIGNMENT
  - This patch fixes
	gcc.target/i386/pr69454-2.c
	gcc.target/i386/stackalign/longlong-1.c
  - Regression test on x86-64, no new fail introduced.

Tested on x86-64.

gcc/c/ChangeLog:

	PR target/95237
	* c-decl.c (finish_decl): Call target hook
	lower_local_decl_alignment to lower local decl alignment.

gcc/ChangeLog:

	PR target/95237
	* config/i386/i386-protos.h (ix86_local_alignment): Add
	another function parameter may_lower alignment. Default is
	false.
	* config/i386/i386.c (ix86_lower_local_decl_alignment): New
	function.
	(ix86_local_alignment): Amend ix86_local_alignment to accept
	another parameter may_lower. If may_lower is true, new align
	may be lower than incoming alignment. If may_lower is false,
	new align will be greater or equal to incoming alignment.
	(TARGET_LOWER_LOCAL_DECL_ALIGNMENT): Define.
	* doc/tm.texi: Regenerate.
	* doc/tm.texi.in (TARGET_LOWER_LOCAL_DECL_ALIGNMENT): New
	hook.
	* target.def (lower_local_decl_alignment): New hook.

gcc/cp/ChangeLog:

	PR target/95237
	* decl.c (cp_finish_decl): Call target hook
	lower_local_decl_alignment to lower local decl alignment.

gcc/testsuite/ChangeLog:

	PR target/95237
	* c-c++-common/pr95237-1.c: New test.
	* c-c++-common/pr95237-2.c: New test.
	* c-c++-common/pr95237-3.c: New test.
	* c-c++-common/pr95237-4.c: New test.
	* c-c++-common/pr95237-5.c: New test.
	* c-c++-common/pr95237-6.c: New test.
	* c-c++-common/pr95237-7.c: New test.
	* c-c++-common/pr95237-8.c: New test.
	* c-c++-common/pr95237-9.c: New test.
2020-07-21 16:25:43 -07:00
Peter Bergner
699f9c0cc1 rs6000: Update test case count when compiling for power9
2020-07-21  Peter Bergner  <bergner@linux.ibm.com>

gcc/testsuite/
	PR target/92488
	* gcc.target/powerpc/convert-fp-128.c (bl): Update POWER9 count.
2020-07-21 16:20:33 -05:00
Nathan Sidwell
4d6e94960a c++: Fix scan forward over pragma [PR96257]
It turns out that the paren scanning code is used for speculatively searching
to see if we're looking at a compound_literal.  So we shouldn't always purge
pragma tokens.

	gcc/cp/
	* parser.c (cp_lexer_consume_token): Drop PRAGMA_EOL assert.
	(cp_parser_skip_to_closing_parenthesis_1): Only pass start token
	to pragma skipper if recovering.
	(cp_parser_skip_to_pragma_eol): Only purge and change pragma
	state when recovering.
	gcc/testsuite/
	* g++.dg/parse/pr96257.C: New.
2020-07-21 12:42:09 -07:00
Harald Anlauf
28f2a080cc PR fortran/89574 - ICE in conv_function_val, at fortran/trans-expr.c:3792
When checking for an external procedure from the same file, do not
consider symbols from different modules.

gcc/fortran/
	PR fortran/89574
	* trans-decl.c (gfc_get_extern_function_decl): Check whether a
	symbol belongs to a different module.
2020-07-21 21:37:30 +02:00
Uros Bizjak
02363d5fdb i386: Fix insn conditions of mfence patterns [PR95750]
2020-07-21  Uroš Bizjak  <ubizjak@gmail.com>

gcc/ChangeLog:
	PR target/95750
	* config/i386/sync.md (mfence_sse2): Enable for
	TARGET_64BIT and TARGET_SSE2.
	(mfence_nosse): Always enable.
2020-07-21 20:22:45 +02:00
Jozef Lawrynowicz
b4ca70a3fa MSP430: Remove do_no_relax_short_jumps
This is an old cludge from from when the Binutils linker could not relax
BR to JMP and vice-versa when shuffling "either" sections between upper
and lower memory. This has been fixed since at least Binutils 2.30.

gcc/ChangeLog:

	* config/msp430/msp430-protos.h (msp430_do_not_relax_short_jumps):
	Remove.
	* config/msp430/msp430.c (msp430_do_not_relax_short_jumps): Likewise.
	* config/msp430/msp430.md (cbranchhi4_real): Remove special case for
	msp430_do_not_relax_short_jumps.
2020-07-21 17:32:06 +01:00
Jozef Lawrynowicz
aa360dd1c8 MSP430: Define extendqipsi2
The SXT instruction extends the sign of the low byte of the operand
through the entire PSImode register.
SXTX.A can be used to sign extend the low byte of a memory operand
through to the 19th bit. Bits 31:20 are cleared.

gcc/ChangeLog:

	* config/msp430/msp430.md: New "extendqipsi2" define_insn.
2020-07-21 17:32:06 +01:00
Jozef Lawrynowicz
111afded7f MSP430: Define NO_FUNCTION_CSE
Calling a constant function address costs the same number of clock
cycles as calling an address stored in a register. However, in terms of
instruction length, calling a constant address is more expensive.

Set NO_FUNCTION_CSE to true, only when optimizing for speed.

gcc/ChangeLog:

	* config/msp430/msp430.h (NO_FUNCTION_CSE): Set to true at -O2 and
	above.
2020-07-21 17:32:06 +01:00
Sandra Loosemore
df41897928 Scale down long-running tree-prof.exp tests for non-FDO testing.
2020-07-21  Sandra Loosemore  <sandra@codesourcery.com>

gcc/testsuite/
	* lib/profopt.exp (auto-profopt-execute): Pass -DFOR_AUTOFDO_TESTING
	on command line for both compiles.
	* gcc.dg/tree-prof/cold_partition_label.c: Scale down for
	non-FDO testing.
	* gcc.dg/tree-prof/crossmodule-indir-call-topn-1.c: Likewise.
	* gcc.dg/tree-prof/crossmodule-indir-call-topn-2.c: Likewise.
	* gcc.dg/tree-prof/indir-call-prof-topn.c: Likewise.
	* gcc.dg/tree-prof/section-attr-1.c: Likewise.
	* gcc.dg/tree-prof/section-attr-2.c: Likewise.
	* gcc.dg/tree-prof/section-attr-3.c: Likewise.
2020-07-21 09:20:36 -07:00
Dimitar Dimitrov
4e1e858cc8 testsuite: Add default_packed filters
Fix test cases assumptions that target has alignment constraints.

gcc/testsuite/ChangeLog:

	* gcc.dg/attr-copy-4.c: Unpacked may still have alignment of 1
	on targets with default_packed.
	* gcc.dg/c11-align-9.c: Remove AVR target filter and replace
	with default_packed filter.

Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
2020-07-21 18:35:44 +03:00
Dimitar Dimitrov
eb66e8e7a9 testsuite: Relax pattern to include "packed" targets
The actual warning message depends on the default alignment of the
target. With this update the test correctly passes on AVR and PRU
targets.

gcc/testsuite/ChangeLog:

	* gcc.dg/pr53037-1.c: Relax warning pattern.

Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
2020-07-21 18:35:44 +03:00
Dimitar Dimitrov
d5a8649096 testsute: Add expected warning for packed attribute
Targets which pack structures by default get warnings for packed structure
attributes. This is expected, so add markers in the test cases.

gcc/testsuite/ChangeLog:

	* c-c++-common/Waddress-of-packed-member-2.c: Add dg-warning for
	ignored attribute if target is default_packed.
	* c-c++-common/Wattributes.c: Ditto.
	* c-c++-common/attr-copy.c: Ditto.
	* c-c++-common/builtin-has-attribute-4.c: Ditto.
	* c-c++-common/pr51628-29.c: Ditto.
	* c-c++-common/pr51628-30.c: Ditto.
	* c-c++-common/pr51628-32.c: Ditto.
	* gcc.dg/Wattributes-6.c: Ditto.
	* gcc.dg/attr-copy-4.c: Ditto.
	* gcc.dg/attr-copy-8.c: Ditto.

Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
2020-07-21 18:35:44 +03:00
Dimitar Dimitrov
6741411b03 testsuite: Filter unaligned pointer value warning
Targets which pack structures by default will not get warnings about
unaligned access to structure members.

gcc/testsuite/ChangeLog:

	* c-c++-common/Waddress-of-packed-member-1.c: Filter dg-warning
	for targets who pack by default.
	* c-c++-common/Waddress-of-packed-member-2.c: Ditto.
	* c-c++-common/pr51628-13.c: Ditto.
	* c-c++-common/pr51628-15.c: Ditto.
	* c-c++-common/pr51628-16.c: Ditto.
	* c-c++-common/pr51628-26.c: Ditto.
	* c-c++-common/pr51628-27.c: Ditto.
	* c-c++-common/pr51628-28.c: Ditto.
	* c-c++-common/pr51628-29.c: Ditto.
	* c-c++-common/pr51628-3.c: Ditto.
	* c-c++-common/pr51628-30.c: Ditto.
	* c-c++-common/pr51628-31.c: Ditto.
	* c-c++-common/pr51628-32.c: Ditto.
	* c-c++-common/pr51628-33.c: Ditto.
	* c-c++-common/pr51628-35.c: Ditto.
	* c-c++-common/pr51628-4.c: Ditto.
	* c-c++-common/pr51628-5.c: Ditto.
	* c-c++-common/pr51628-6.c: Ditto.
	* c-c++-common/pr51628-8.c: Ditto.
	* c-c++-common/pr51628-9.c: Ditto.
	* c-c++-common/pr88664-2.c: Ditto.
	* gcc.dg/pr51628-17.c: Ditto.
	* gcc.dg/pr51628-19.c: Ditto.
	* gcc.dg/pr51628-20.c: Ditto.
	* gcc.dg/pr51628-21.c: Ditto.
	* gcc.dg/pr51628-22.c: Ditto.
	* gcc.dg/pr51628-24.c: Ditto.
	* gcc.dg/pr51628-25.c: Ditto.
	* gcc.dg/pr51628-34.c: Ditto.
	* gcc.dg/pr88928.c: Ditto.

Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
2020-07-21 18:35:44 +03:00
Kito Cheng
c850a642e1 testsuite: Add signal checking for signal related testcase in analyzer.
- Verifed on RISC-V and x86.

gcc/testsuite/ChangeLog:

	* gcc.dg/analyzer/signal-1.c: Add dg-require-effective-target
	signal.
	* gcc.dg/analyzer/signal-2.c: Ditto.
	* gcc.dg/analyzer/signal-3.c: Ditto.
	* gcc.dg/analyzer/signal-4a.c: Ditto.
	* gcc.dg/analyzer/signal-4b.c: Ditto.
	* gcc.dg/analyzer/signal-5.c: Ditto.
	* gcc.dg/analyzer/signal-6.c: Ditto.
	* gcc.dg/analyzer/signal-exit.c: Ditto.
2020-07-21 14:28:16 +08:00
Xionghu Luo
2ef4cf87a7 rs6000: Define movsf_from_si2 to extract high part SF element from DImode[PR89310]
For extracting high part element from DImode register like:

{%1:SF=unspec[r122:DI>>0x20#0] 86;clobber scratch;}

split it before reload with "and mask" to avoid generating shift right
32 bit then shift left 32 bit.  This pattern also exists in PR42475 and
PR67741, etc.

srdi 3,3,32
sldi 9,3,32
mtvsrd 1,9
xscvspdpn 1,1

=>

rldicr 3,3,0,31
mtvsrd 1,3
xscvspdpn 1,1

Bootstrap and regression tested pass on Power8-LE.

gcc/ChangeLog:

2020-07-21  Xionghu Luo  <luoxhu@linux.ibm.com>

	PR rtl-optimization/89310
	* config/rs6000/rs6000.md (movsf_from_si2): New define_insn_and_split.

gcc/testsuite/ChangeLog:

2020-07-21  Xionghu Luo  <luoxhu@linux.ibm.com>

	PR rtl-optimization/89310
	* gcc.target/powerpc/pr89310.c: New test.
2020-07-20 22:37:30 -05:00
Kewen Lin
41efe9812a rs6000/test: Add vector with length test cases
This patch is to add the test coverage for vector with
length feature on rs6000.  Tested on P9 LE, P7 BE and
P9 BE (aix), the results looked fine.

gcc/testsuite/ChangeLog:

	* gcc.target/powerpc/p9-vec-length-1.h: New test.
	* gcc.target/powerpc/p9-vec-length-2.h: New test.
	* gcc.target/powerpc/p9-vec-length-3.h: New test.
	* gcc.target/powerpc/p9-vec-length-4.h: New test.
	* gcc.target/powerpc/p9-vec-length-5.h: New test.
	* gcc.target/powerpc/p9-vec-length-6.h: New test.
	* gcc.target/powerpc/p9-vec-length-7.h: New test.
	* gcc.target/powerpc/p9-vec-length-8.h: New test.
	* gcc.target/powerpc/p9-vec-length-epil-1.c: New test.
	* gcc.target/powerpc/p9-vec-length-epil-2.c: New test.
	* gcc.target/powerpc/p9-vec-length-epil-3.c: New test.
	* gcc.target/powerpc/p9-vec-length-epil-4.c: New test.
	* gcc.target/powerpc/p9-vec-length-epil-5.c: New test.
	* gcc.target/powerpc/p9-vec-length-epil-6.c: New test.
	* gcc.target/powerpc/p9-vec-length-epil-7.c: New test.
	* gcc.target/powerpc/p9-vec-length-epil-8.c: New test.
	* gcc.target/powerpc/p9-vec-length-epil-run-1.c: New test.
	* gcc.target/powerpc/p9-vec-length-epil-run-2.c: New test.
	* gcc.target/powerpc/p9-vec-length-epil-run-3.c: New test.
	* gcc.target/powerpc/p9-vec-length-epil-run-4.c: New test.
	* gcc.target/powerpc/p9-vec-length-epil-run-5.c: New test.
	* gcc.target/powerpc/p9-vec-length-epil-run-6.c: New test.
	* gcc.target/powerpc/p9-vec-length-epil-run-7.c: New test.
	* gcc.target/powerpc/p9-vec-length-epil-run-8.c: New test.
	* gcc.target/powerpc/p9-vec-length-full-1.c: New test.
	* gcc.target/powerpc/p9-vec-length-full-2.c: New test.
	* gcc.target/powerpc/p9-vec-length-full-3.c: New test.
	* gcc.target/powerpc/p9-vec-length-full-4.c: New test.
	* gcc.target/powerpc/p9-vec-length-full-5.c: New test.
	* gcc.target/powerpc/p9-vec-length-full-6.c: New test.
	* gcc.target/powerpc/p9-vec-length-full-7.c: New test.
	* gcc.target/powerpc/p9-vec-length-full-8.c: New test.
	* gcc.target/powerpc/p9-vec-length-full-run-1.c: New test.
	* gcc.target/powerpc/p9-vec-length-full-run-2.c: New test.
	* gcc.target/powerpc/p9-vec-length-full-run-3.c: New test.
	* gcc.target/powerpc/p9-vec-length-full-run-4.c: New test.
	* gcc.target/powerpc/p9-vec-length-full-run-5.c: New test.
	* gcc.target/powerpc/p9-vec-length-full-run-6.c: New test.
	* gcc.target/powerpc/p9-vec-length-full-run-7.c: New test.
	* gcc.target/powerpc/p9-vec-length-full-run-8.c: New test.
	* gcc.target/powerpc/p9-vec-length-run-1.h: New test.
	* gcc.target/powerpc/p9-vec-length-run-2.h: New test.
	* gcc.target/powerpc/p9-vec-length-run-3.h: New test.
	* gcc.target/powerpc/p9-vec-length-run-4.h: New test.
	* gcc.target/powerpc/p9-vec-length-run-5.h: New test.
	* gcc.target/powerpc/p9-vec-length-run-6.h: New test.
	* gcc.target/powerpc/p9-vec-length-run-7.h: New test.
	* gcc.target/powerpc/p9-vec-length-run-8.h: New test.
	* gcc.target/powerpc/p9-vec-length.h: New test.
2020-07-20 22:14:19 -05:00
Hans-Peter Nilsson
77077c8812 gcc.dg/independent-cloneids-1.c: Skip for mmix.
Regular ELF label definitions for this test-case, matched by the
regexps, e.g.:
 /* { dg-final { scan-assembler-times {(?n)^_*bar[.$_]constprop[.$_]0:} 1 } } */
typically look like this:
bar_constprop.0:

For MMIX, they look like this:
bar_constprop::0	IS @

I think it's better to just skip the test for MMIX than further
uglifying the matching regexps, since the test is IIUC general
enough that nothing in the target port can reasonably make a
difference: it passes for all targets or fail for all targets.

gcc/testsuite:
	* gcc.dg/independent-cloneids-1.c: Skip for mmix.
	flag_stack_usage_info.
2020-07-21 02:43:11 +02:00
Hans-Peter Nilsson
5648254484 gcc.dg/cdce3.c: Update matched line-number.
I missed updating the line-number when adding that dg-skip-if.
Committed as obvious.

	* gcc.dg/cdce3.c: Update matched line-number.
2020-07-21 02:35:26 +02:00
GCC Administrator
0933f50859 Daily bump. 2020-07-21 00:16:28 +00:00
Hans-Peter Nilsson
e21a33c232 mmix: support -fstack-usage
MMIX has two stacks; the regular one using register $254 as a
convention and the register-stack, pushed and popped by call
instructions (usually).  The decision to only report the stack usage
of the regular stack (and not of the register stack) may be updated,
perhaps the sum is better.  This initial decision is helped a little
bit by the order of passes: the size of the register-stack is
calculated only later (in the machine-dependent reorg pass), long
after finalization of the stack-usage info (in the prologue/epilogue
pass).  No regressions for mmix-knuth-mmixware (but a whole lot more
PASSes), committed.

gcc:
	* config/mmix/mmix.c (mmix_expand_prologue): Calculate the total
	allocated size and set current_function_static_stack_size, if
	flag_stack_usage_info.
2020-07-21 01:17:26 +02:00
Jonathan Wakely
932fbc868a libstdc++: Add std::from_chars for floating-point types
This adds the missing std::from_chars overloads for floating-point
types, as required for C++17 conformance.

The implementation is a hack and not intended to be used in the long
term. Rather than parsing the string directly, this determines the
initial portion of the string that matches the pattern determined by the
chars_format parameter, then creates a NTBS to be parsed by strtod (or
strtold or strtof).

Because creating a NTBS requires allocating memory, but std::from_chars
is noexcept, we need to be careful to minimise allocation. Even after
being careful, allocation failure is still possible, and so a
non-conforming std::no_more_memory error code might be returned.

Because strtod et al depend on the current locale, but std::from_chars
does not, we change the current thread's locale to "C" using newlocale
and uselocale before calling strtod, and restore it afterwards.

Because strtod doesn't have the equivalent of a std::chars_format
parameter, it has to examine the input to determine the format in use,
even though the std::from_chars code has already parsed it once (or
twice for large input strings!)

By replacing the use of strtod we could avoid allocation, avoid changing
locale, and use optimised code paths specific to each std::chars_format
case. We would also get more portable behaviour, rather than depending
on the presence of uselocale, and on any bugs or quirks of the target
libc's strtod. Replacing strtod is a project for a later date.

libstdc++-v3/ChangeLog:

	* acinclude.m4 (libtool_VERSION): Bump version.
	* config.h.in: Regenerate.
	* config/abi/pre/gnu.ver: Add GLIBCXX_3.4.29 version and new
	exports.
	* config/os/gnu-linux/ldbl-extra.ver: Add _GLIBCXX_LDBL_3.4.29
	version and new export.
	* configure: Regenerate.
	* configure.ac: Check for <xlocale.h> and uselocale.
	* crossconfig.m4: Add macro or checks for uselocale.
	* include/std/charconv (from_chars): Declare overloads for
	float, double, and long double.
	* src/c++17/Makefile.am: Add new file.
	* src/c++17/Makefile.in: Regenerate.
	* src/c++17/floating_from_chars.cc: New file.
	(from_chars): Define for float, double, and long double.
	* testsuite/20_util/from_chars/1_c++20_neg.cc: Prune extra
	diagnostics caused by new overloads.
	* testsuite/20_util/from_chars/1_neg.cc: Likewise.
	* testsuite/20_util/from_chars/2.cc: Check leading '+'.
	* testsuite/20_util/from_chars/4.cc: New test.
	* testsuite/20_util/from_chars/5.cc: New test.
	* testsuite/util/testsuite_abi.cc: Add new symbol versions.
2020-07-20 23:49:27 +01:00
Jason Merrill
e443d82138 c++: Pseudo-destructor ends object lifetime.
P0593R6 is mostly about a new object model whereby malloc and the like are
treated as implicitly starting the lifetime of whatever trivial types are
necessary to give the program well-defined semantics; that seems only
relevant to TBAA, and is not implemented here.

The paper also specifies that a pseudo-destructor call (a destructor call
for a non-class type) ends the lifetime of the object like a destructor call
for an object of class type, even though it doesn't call a destructor; this
patch implements that change.

The paper was voted as a DR, so I'm applying this change to all standard
levels.  Like class end-of-life clobbers, it is controlled by
-flifetime-dse.

gcc/cp/ChangeLog:

	* pt.c (type_dependent_expression_p): A pseudo-dtor can be
	dependent.
	* semantics.c (finish_call_expr): Use build_trivial_dtor_call for
	pseudo-destructor.
	(finish_pseudo_destructor_expr): Leave type NULL for dependent arg.

gcc/testsuite/ChangeLog:

	* g++.dg/opt/flifetime-dse7.C: New test.
2020-07-20 18:18:12 -04:00
Jason Merrill
812798917c c++: Allow subobject references in C++20.
The last new thing allowed by P1907R1: subobject addresses as template
arguments.  The ABI group has discussed mangling for this; there has been
some talk of a compressed subobject mangling, but it hasn't been finalized,
so for now I'm using normal expression mangling.  In order for two array
subobject references to compare as equal template arguments, the offsets
need to have the same type, so I convert them to always be the same type,
currently ptrdiff_t.  Base class conversions are represented as a cast to
reference type, only if necessary to resolve an ambiguity.

This patch also updates the value of __cpp_nontype_template_args, since
the paper is fully implemented.

gcc/cp/ChangeLog:

	* mangle.c (write_base_ref): New.
	(write_expression): Use it for base field COMPONENT_REFs.
	* pt.c (invalid_tparm_referent_p): Canonicalize the type
	of array offsets.  Allow subobjects.

gcc/c-family/ChangeLog:

	* c-cppbuiltin.c (c_cpp_builtins): Update
	__cpp_nontype_template_args for C++20.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp1z/nontype2.C: No error in C++20.
	* g++.dg/template/nontype25.C: No error in C++20.
	* g++.dg/template/nontype8.C: No error in C++20.
	* g++.dg/cpp2a/nontype-subob1.C: New test.
	* g++.dg/cpp2a/nontype-subob2.C: New test.
	* g++.dg/cpp1z/nontype3.C: Now C++17-only.
	* g++.dg/cpp2a/feat-cxx2a.C: Adjust expected value.
2020-07-20 17:54:18 -04:00
Jason Merrill
d0ffe9d5dc c++: Aggregate CTAD and string constants.
In CWG discussion, it was suggested that deduction from a string literal
should be to reference-to-const, so that we deduce 'char' rather than 'const
char' for T.

gcc/cp/ChangeLog:

	* pt.c (collect_ctor_idx_types): Add 'const' when deducing from
	a string constant.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp2a/class-deduction-aggr7.C: New test.
2020-07-20 17:53:43 -04:00
Sergei Trofimovich
87891d5eaf sparc/sparc64: use crtendS.o for default-pie executables [PR96190]
In --enable-default-pie mode compiler should switch from
using crtend.o to crtendS.o. On sparc it is especially important
because crtend.o contains PIC-unfriendly code.

We use GNU_USER_TARGET_ENDFILE_SPEC as a baseline spec to get
crtendS.o instead of crtend.o in !no-pie mode.

gcc:

2020-07-14  Sergei Trofimovich  <siarheit@google.com>

	PR target/96190
	* config/sparc/linux.h (ENDFILE_SPEC): Use GNU_USER_TARGET_ENDFILE_SPEC
	to get crtendS.o for !no-pie mode.
	* config/sparc/linux64.h (ENDFILE_SPEC): Ditto.
2020-07-20 20:46:30 +01:00
Jonathan Wakely
4d1c5b4957 libstdc++: Avoid overflow in istream::get(streambuf&) [LWG 3464]
Similar to the recent changes to basic_istream::ignore, this change
ensures that _M_gcount doesn't overflow when extracting characters and
inserting them into another streambuf.

The solution used here is to use unsigned long long for the count. We
assume that the number of characters extracted won't exceed the maximum
value for that type, but even if it does we avoid any undefined
behaviour.

libstdc++-v3/ChangeLog:

	* include/bits/istream.tcc
	(basic_istream::get(__streambuf_type&, char_type): Use unsigned
	long long for counter and check if it would overflow _M_gcount.
	* testsuite/27_io/basic_istream/get/char/lwg3464.cc: New test.
	* testsuite/27_io/basic_istream/get/wchar_t/lwg3464.cc: New test.
2020-07-20 20:06:46 +01:00