Tobias Burnus [Sun, 26 Jul 2020 05:20:24 +0000 (07:20 +0200)]
libgfortran: Skip integer-kind=16 check for amdgcn
libgfortran/ChangeLog:
PR target/96306
* configure.ac: Add LIBGOMP_CHECKED_INT_KINDS and
LIBGOMP_CHECKED_REAL_KINDS and use it for to skip
integer kind=16 checks for amdgcn.
* Makefile.am (kinds.h, selected_int_kind.inc,
selected_real_kind.inc): Pass them on.
* mk-kinds-h.sh: Takes to-be-check kinds as argument.
* mk-sik-inc.sh: Likewise.
* mk-srk-inc.sh: Likewise.
* Makefile.in: Regenerate.
* configure: Regenerate.
Hans-Peter Nilsson [Sun, 26 Jul 2020 01:33:15 +0000 (03:33 +0200)]
gcc.dg/tree-ssa/forwprop-36.c: Adjust for mmix
The label of interest here is "b.0_2" for
e.g. x86_64-pc-linux-gnu but "b::1_2" for mmix-knuth-mmixware.
The test seems to be of some interest for mmix (hey, gcc
open-coded 128-bit integer support behind my back!) so I didn't
want to just disable it. I also didn't want to obscure the
matching pattern by generalizing it, so instead I added a
separate matching pattern.
gcc/testsuite:
* gcc.dg/tree-ssa/forwprop-36.c: Adjust for mmix.
Hans-Peter Nilsson [Sun, 26 Jul 2020 00:44:02 +0000 (02:44 +0200)]
gcc.dg/torture/pr59330.c: Disable for mmix
With the dejagnu status-wrapper, there's a reference to write in
each executable, which for mmix in newlib has a reference to a
variable defined in open, which for mmix in newlib has a
reference to sprintf (oops!) and the dependency-chain goes on;
ad finitum there's a reference to malloc, which in default
newlib is colocated with free; the same file
newlib/libc/stdlib/malloc.c.
Not being compiled with -ffunction-sections, they're emitted in
the same section (.text) and thus inseparable: you can't
override just one of them as in this test, or else you'll get:
<X>/pre/mmix/bin/ld: <X>/gccobj/mmix/./newlib/libc.a(lib_a-malloc.o): in function `free':
<X>/gcc/newlib/libc/stdlib/malloc.c:169: multiple definition of `free'; /tmp/ccvRA0zb.o:(.text+0x0): first defined here
collect2: error: ld returned 1 exit status
compiler exited with status 1
FAIL: gcc.dg/torture/pr59330.c -O0 (test for excess errors)
I'm using a dg-skip-if here instead of starting a hardly
scalable dg-do target selector. I'm not keying on
effective-target unwrapped because the dependency-chain is
target-specific rather than dejagnu status-wrapper-specific.
gcc/testsuite:
* gcc.dg/torture/pr59330.c: Disable for mmix.
GCC Administrator [Sun, 26 Jul 2020 00:16:21 +0000 (00:16 +0000)]
Daily bump.
Hans-Peter Nilsson [Sat, 25 Jul 2020 21:25:09 +0000 (23:25 +0200)]
config/mmix/mmix.c (TARGET_ASM_OUTPUT_IDENT): Override.
Funny that default_asm_output_ident_directive isn't the default...
Anyway, since dot-pseudos like .ident are treated as comments by
mmixal, there's nothing lost compatibilitywise by supporting it.
If mmix-knuth-mmixware had included elfos.h this'd have been the
default. There might be enough reason to do that; relocatable objects
are ELF but (by default) links to produce mmo. Fixes
c-c++-common/ident-1b.c and 2b in C and C++ testing. Committed.
gcc:
* config/mmix/mmix.c (TARGET_ASM_OUTPUT_IDENT): Override the default
with default_asm_output_ident_directive.
Iain Sandoe [Sat, 25 Jul 2020 20:42:55 +0000 (21:42 +0100)]
C++, testsuite: Adjust pure-virtual1.C options for Darwin.
Darwin's static linker expects, by default, that all linkage will
be satisfied (even for weak items). This allows the two-level
namespace to work even for weak cases.
However, there's an option to make it behave in a similar manner
to ELF. This is needed for the pure-virtual1.C testcase to pass
on Darwin.
gcc/testsuite/ChangeLog:
* g++.dg/abi/pure-virtual1.C: Add dynamic_lookup option
for Darwin.
Martin Sebor [Sat, 25 Jul 2020 20:21:47 +0000 (14:21 -0600)]
Fix PR c++/96310 - Ignoring -Wnonnull via pragma gcc diagnostics still produces an unwanted note.
gcc/c-family/ChangeLog:
PR c++/96310
* c-common.c (check_nonnull_arg): Print note only when warning was
issued.
Andrew Stubbs [Sat, 25 Jul 2020 14:02:52 +0000 (15:02 +0100)]
amdgcn: Enable TImode
This enables types __int128 et al for move, add, subtract, and logical
operations. At least shift, rotate, multiple, divide, and modulus are broken
so we can expect some test failures.
This is required now because libgomp no longer builds without __int128.
An additional patch will be required to unbreak the libgfortran build.
gcc/ChangeLog:
* config/gcn/gcn.c (gcn_scalar_mode_supported_p): New function.
(TARGET_SCALAR_MODE_SUPPORTED_P): New define.
GCC Administrator [Sat, 25 Jul 2020 00:16:22 +0000 (00:16 +0000)]
Daily bump.
David Edelsohn [Fri, 24 Jul 2020 19:05:42 +0000 (15:05 -0400)]
aix: Support GCC64 for AIX 7.1.
gcc/ChangeLog:
2020-07-24 David Edelsohn <dje.gcc@gmail.com>
Clement Chigot <clement.chigot@atos.net>
* config.gcc (powerpc-ibm-aix7.1): Use t-aix64 and biarch64 for
cpu_is_64bit.
* config/rs6000/aix71.h (ASM_SPEC): Remove aix64 option.
(ASM_SPEC32): New.
(ASM_SPEC64): New.
(ASM_CPU_SPEC): Remove vsx and altivec options.
(CPP_SPEC_COMMON): Rename from CPP_SPEC.
(CPP_SPEC32): New.
(CPP_SPEC64): New.
(CPLUSPLUS_CPP_SPEC): Rename to CPLUSPLUS_CPP_SPEC_COMMON..
(TARGET_DEFAULT): Use 64 bit mask if BIARCH.
(LIB_SPEC_COMMON): Rename from LIB_SPEC.
(LIB_SPEC32): New.
(LIB_SPEC64): New.
(LINK_SPEC_COMMON): Rename from LINK_SPEC.
(LINK_SPEC32): New.
(LINK_SPEC64): New.
(STARTFILE_SPEC): Add 64 bit version of crtcxa and crtdbase.
(ASM_SPEC): Define 32 and 64 bit alternatives using DEFAULT_ARCH64_P.
(CPP_SPEC): Same.
(CPLUSPLUS_CPP_SPEC): Same.
(LIB_SPEC): Same.
(LINK_SPEC): Same.
(SUBTARGET_EXTRA_SPECS): Add new 32/64 specs.
* config/rs6000/aix72.h (TARGET_DEFAULT): Use 64 bit mask if BIARCH.
* config/rs6000/defaultaix64.h: Delete.
Segher Boessenkool [Fri, 24 Jul 2020 23:12:08 +0000 (23:12 +0000)]
rs6000: Remove -mpower10 option (PR95907)
The only way to enable or disable Power10 insns (ISA 3.1 insns) should
be via the -mcpu= switch. This patch disables the -mpower10 options the
same way the -mdirect-move switch is neutered already. That is not an
ideal way, but it works, it is not the first, and doing it properly is
more work, and will happen later.
2020-07-24 Segher Boessenkool <segher@kernel.crashing.org>
* config/rs6000/rs6000.opt: Delete -mpower10.
gcc/testsuite/
* gcc.target/powerpc/pr95907.c: New.
Hans-Peter Nilsson [Fri, 24 Jul 2020 22:05:42 +0000 (00:05 +0200)]
c-c++-common/pr56493.c: Allow ":" in label, for mmix.
No dots in labels for MMIX: internal labels instead contain ":".
gcc/testsuite:
* c-c++-common/pr56493.c: Allow ":" in label, for mmix.
Hans-Peter Nilsson [Fri, 24 Jul 2020 21:50:05 +0000 (23:50 +0200)]
testsuite: Adjust patchable_function tests for mmix.
There's no reason anyone would want to use the "patchable function"
feature for MMIX and also no reason to exclude those tests. For MMIX,
the NOP equivalent is SWYM ("swymming" is a healthy exercise).
Text-wise, making the tests pass by adjusting the regexp, is shorter,
and it seems unlikely to both appear as a mnemonic for other targets
*and* being emitted in uppercase.
gcc/testsuite:
* c-c++-common/patchable_function_entry-decl.c,
c-c++-common/patchable_function_entry-default.c,
c-c++-common/patchable_function_entry-definition.c: Adjust for mmix.
Sunil K Pandey [Fri, 24 Jul 2020 21:08:41 +0000 (14:08 -0700)]
Add testcase to show kernel issue got fixed by pr95237 [PR96192]
This test case, extracted from PR 95645, was failing because alignment
of local long long variable got lowered from 8 bytes to 4 bytes in
adjust alignment pass, which triggered assert failure.
This test case passes now because PR 95237 fix only allows lowering of
alignment of local variables in the front end. As a result, alignment
of local long long variable no longer gets lowered in adjust alignment
pass.
gcc/testsuite/ChangeLog:
PR target/96192
* c-c++-common/pr96192-1.c: New test.
Alexandre Oliva [Fri, 24 Jul 2020 18:38:42 +0000 (15:38 -0300)]
add offload target to testname for pass/fail message
Offload tests that scan dump files may run multiple times, once per
offload target, but the test result messages do not mention the
offload target, so we may seem to have repeated results. Fixed by
modifying the test name so that it contains the offload target name.
Co-Authored-By: Thomas Schwinge <thomas@codesourcery.com>
for gcc/testsuite/ChangeLog
* lib/scanoffload.exp (scoff-testname, scoff-adjust): New.
(scoff): Call them.
Alexandre Oliva [Fri, 24 Jul 2020 18:38:40 +0000 (15:38 -0300)]
revamp intelmic-mkoffload aux dump names
Rework intelmic-mkoffload into the new aux and dump file naming
semantics. Obey -save-temps.
Co-Authored-By: Thomas Schwinge <thomas@codesourcery.com>
for gcc/ChangeLog
* config/i386/intelmic-mkoffload.c
(generate_target_descr_file): Use dumppfx for save_temps
files. Pass -dumpbase et al down to the compiler.
(generate_target_offloadend_file): Likewise.
(generate_host_descr_file): Likewise.
(prepare_target_image): Likewise. Move out_obj_filename
setting...
(main): ... here. Detect -dumpbase, set dumppfx too.
Alexandre Oliva [Fri, 24 Jul 2020 18:38:38 +0000 (15:38 -0300)]
[PR96230] some -dumpbase-ext fixes
The initial bug report was that compiling (-c) with -dumpbase ""
-dumpbase-ext .<ext> crashes the driver.
The verification of -dumpbase-ext against -dumpbase doesn't cover the
case in which -dumpbase activates backward-compatibility mode.
I added a test for that, and for -dumpbase-ext without -dumpbase,
trying to make it work in a sensible way, as if applied to the default
-dumpbase for each file. It turned out that this made for too much
complexity in dealing with suffixes derived from input filenames, so I
gave that up and returned to discarding -dumpbase-ext as documented,
ending up with a change identical to that in the original bug report.
I also thought I caught an off-by-one error in the initial
verification, that caused dumpbase_ext to be discarded if it was
identical to the specified dumpbase, but that turned out to be
intentional as well, so I put in comments and a test to reflect it.
Finally, an earlier version of the newly-added tests used "$var.ext"
in an expected output list, which showed me the handling of string
expansion was incorrect. Reworked the expr into an eval to make that
work, and, absent any reliance on post-eval adjustments to so-expanded
output names, I arranged for the adjustments to be skipped after eval.
Co-Authored-By: "Zhanghaijian (A)" <z.zhanghaijian@huawei.com>
for gcc/ChangeLog
PR driver/96230
* gcc.c (process_command): Adjust and document conditions to
reset dumpbase_ext.
for gcc/testsuite/ChangeLog
PR driver/96230
* gcc.misc-tests/outputs.exp: Add tests with -dumpbase-ext,
with identical -dumpbase, with -dumpbase "", and without any
-dumpbase.
(outest): Fix "" expansion in expected outputs, skip
adjustments.
Alexandre Oliva [Fri, 24 Jul 2020 18:38:35 +0000 (15:38 -0300)]
[PR95720] protect gluefile and wrap_flags with -Wl too
The testglue object file gets interpreted as another input file,
changing the dump and aux output names in GCC unless it is protected
by -Wl, like board file-named extra inputs.
Refactor the code that modifies the board settings so that it can be
used to modify regular variables as well, and do so.
for gcc/testsuite/ChangeLog
PR testsuite/95720
* lib/gcc-defs.exp (gcc_adjust_linker_flags_list): Split out of...
(gcc_adjust_linker_flags): ... this. Protect gluefile and
wrap_flags.
* gcc.misc-tests/outputs.exp: Use gcc_adjust_linker_flags_list.
Dominique d'Humieres [Fri, 24 Jul 2020 18:27:53 +0000 (20:27 +0200)]
PR 93567, G edit descriptor uses E instead of F editing in rounding mode UP.
The switch between FMT_E and FMT_F is based on the absolute value.
Set r=0 for rounding toward zero and r = 1 otherwise.
If (exp_d - m) == 1 there is no rounding needed.
libgfortran/ChangeLog:
PR fortran/93567
* io/write_float.def (determine_en_precision): Fix switch between
FMT_E and FMT_F.
gcc/testsuite/ChangeLog:
PR fortran/93567
* gfortran.dg/round_3.f08: Add test cases.
Dominique d'Humieres [Fri, 24 Jul 2020 18:07:12 +0000 (20:07 +0200)]
PR 93592 - Invalid UP/DOWN rounding with EN descriptor.
The fix is obvious (I have added a comment). The tests are probably
an overkill, but it does not hurt.
libgfortran/ChangeLog:
PR fortran/93592
* io/write_float.def (build_float_string): Do not reset
nbefore for FMT_F and FMT_EN.
gcc/testsuite/ChangeLog:
PR fortran/93592
* gfortran.dg/fmt_en.f90: Adjust test.
* gfortran.dg/fmt_en_rd.f90: New test.
* gfortran.dg/fmt_en_rn.f90: New test.
* gfortran.dg/fmt_en_ru.f90: New test.
* gfortran.dg/fmt_en_rz.f90: New test.
Patrick Palka [Fri, 24 Jul 2020 18:31:36 +0000 (14:31 -0400)]
c++: Add testcase for [PR81339]
We correctly reject this testcase since r11-434, i.e. since the fix for
PR c++/57943.
gcc/testsuite/ChangeLog:
PR c++/81339
* g++.dg/cpp0x/decltype78.C: New test.
Matthias Klose [Fri, 24 Jul 2020 14:17:44 +0000 (16:17 +0200)]
iDefine TARGET_OFFLOAD_OPTIONS for AArch64
2020-07-24 Matthias Klose <doko@ubuntu.com>
* config/aarch64/aarch64.c (+aarch64_offload_options,
TARGET_OFFLOAD_OPTIONS): New.
Uros Bizjak [Fri, 24 Jul 2020 13:59:38 +0000 (15:59 +0200)]
i386: Emit mfence_sse2 for -Os [PR95750]
2020-07-24 Uroš Bizjak <ubizjak@gmail.com>
gcc/ChangeLog:
PR target/95750
* config/i386/sync.md (mmem_thread_fence): Emit mfence_sse2 for -Os.
Thomas Schwinge [Wed, 1 Jul 2020 10:33:59 +0000 (12:33 +0200)]
[testsuite] Unset 'offload_target' after use
..., so that we don't leak this into '*.exp' files running later.
This is relevant after commit
efc16503ca10bc0e934e0bace5777500e4dc757a "handle
dumpbase in offloading, adjust testsuite" -- I was confused why in a
(simplified) testing sequence as follows:
default 'libgomp.c/c.exp'
default 'libgomp.oacc-c/c.exp'
'-m32' 'libgomp.c/c.exp'
'-m32' 'libgomp.oacc-c/c.exp'
..., the "'-m32' 'libgomp.c/c.exp'" variant would not execute any offloading
dump scanning. The reason is that the "default 'libgomp.oacc-c/c.exp'" variant
ends with 'offload_target=disable' set, so that's what the "'-m32'
'libgomp.c/c.exp'" variant would then see, in particular
'gcc/testsuite/lib/scanoffload.exp:scoff'.
libgomp/
* testsuite/libgomp.oacc-c++/c++.exp: Unset 'offload_target' after
use.
* testsuite/libgomp.oacc-c/c.exp: Likewise.
* testsuite/libgomp.oacc-fortran/fortran.exp: Likewise.
Thomas Schwinge [Tue, 30 Jun 2020 05:18:19 +0000 (07:18 +0200)]
[testsuite] Fix TCL syntax error in 'scan-dump-dem-not'
ERROR: [...]: error executing dg-final: missing close-bracket
Bug introduced in commit
2ef1bce664881cd59dac7db6c3f3b5709d858bfe (r188996),
long ago.
gcc/testsuite/
* lib/scandump.exp (scan-dump-dem-not): Fix TCL syntax error.
Szabolcs Nagy [Thu, 16 Jul 2020 15:39:23 +0000 (16:39 +0100)]
aarch64: add PAC-RET protection to libitm sjlj.S
_ITM_beginTransaction is a 'returns_twice' function that saves x30
on the stack as part of gtm_jmpbuf (that is passed down to
GTM_begin_transaction), but the saved x30 is also used for return.
The return path should be protected so we don't leave an
ldp x29, x30, [sp]
ret
gadget in the code, so x30 is signed on function entry. This
exposes the signed address in the gtm_jmpbuf too. The jmpbuf does
not need a signed address since GTM_longjmp uses
ldp x29, x30, [x1]
br x30
and with BTI there is a BTI j at the _ITM_beginTransaction call site
where this jump returns. Using PAC does not hurt: the gtm_jmpbuf is
internal to libitm and its layout is only used by sjlj.S so the
signed address does not escape. Saving signed x30 into gtm_jmpbuf
provides a bit of extra protection, but more importantly it allows
adding the PAC-RET support without changing the existing code much.
In theory bti and pac-ret protection can be added unconditionally
since the instructions are in the nop space, in practice they
can cause trouble if some tooling does not understand the gnu
property note (e.g. old binutils) or some unwinder or debugger
does not understand the new dwarf op code used for pac-ret (e.g
old gdb). So the code is written to only support branch-protection
according to the code generation options.
libitm/ChangeLog:
* config/aarch64/sjlj.S: Add conditional pac-ret protection.
Szabolcs Nagy [Thu, 16 Jul 2020 15:26:10 +0000 (16:26 +0100)]
aarch64: add PAC GNU property note to libgcc lse.S
This note is not used anywhere currently but it is supposed to mark
objects if the return address is protected with PAC on the stack.
Since lse.S only has leaf functions the return address is never
saved on the stack so we can add the note.
The note is only added if pac-ret is enabled because it can cause
problems with old linkers and we don't have checks for that. This
can be changed later to be unconditional, for now it is consistent
with how gcc generates the notes.
libgcc/ChangeLog:
* config/aarch64/lse.S: Add PAC property note.
H.J. Lu [Fri, 24 Jul 2020 02:14:06 +0000 (19:14 -0700)]
Restrict PR middle-end/95886 x86 test to !ia32
Since gcc.target/i386/memcpy-pr95886.c requires 64-bit register, restrict
it to !ia32.
PR middle-end/95886
* gcc.target/i386/memcpy-pr95886.c: Restrict test to !ia32.
GCC Administrator [Fri, 24 Jul 2020 00:16:20 +0000 (00:16 +0000)]
Daily bump.
Clément Chigot [Thu, 16 Jul 2020 09:29:49 +0000 (11:29 +0200)]
libgo: add AIX FAT libraries support
AIX-style libraries contains both 32 and 64 bit shared objects.
This patch follows the adding of FAT libraries support in other gcc
libraries (libgcc, listdc++, etc).
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/242957
Martin Sebor [Thu, 23 Jul 2020 20:08:22 +0000 (14:08 -0600)]
Restrict test to LP64.
gcc/testsuite/ChangeLog:
PR testsuite/95886
* gcc.target/i386/memcpy-pr95886.c: Restrict test to LP64.
Julian Brown [Thu, 2 Jul 2020 21:18:20 +0000 (14:18 -0700)]
openacc: Remove unnecessary detach finalization
The call to gomp_detach_pointer in gomp_unmap_vars_internal does not
need to force finalization, and doing so may mask mismatched pointer
attachments/detachments. This patch removes the forcing.
2020-07-16 Julian Brown <julian@codesourcery.com>
Thomas Schwinge <thomas@codesourcery.com>
libgomp/
* target.c (gomp_unmap_vars_internal): Remove unnecessary forcing of
finalization for detach operation.
* testsuite/libgomp.oacc-c-c++-common/structured-detach-underflow.c:
New test.
Co-Authored-By: Thomas Schwinge <thomas@codesourcery.com>
Roger Sayle [Thu, 23 Jul 2020 17:48:54 +0000 (18:48 +0100)]
Resolve regression rtl-optimization/96298. Sorry for the breakage.
2020-07-23 Roger Sayle <roger@nextmovesoftware.com>
gcc/ChangeLog
PR rtl-optimization/96298
* simplify-rtx.c (simplify_binary_operation_1) [XOR]: Xor doesn't
distribute over xor, so (a^b)^(c^b) is not the same as (a^c)^b.
Patrick Palka [Thu, 23 Jul 2020 14:38:58 +0000 (10:38 -0400)]
contrib/vimrc: detect more C-like files
Currently this script doesn't set the indentation style for the standard
library headers under libstdc++/ because they lack a file extension.
But they do have a modeline, so the file type is still set appropriately
by Vim. So by inspecting &filetype, we can also detect these standard
library headers as C-like files.
contrib/ChangeLog:
* vimrc (SetStyle): Also inspect &filetype to determine whether
a file is C-like.
Tobias Burnus [Thu, 23 Jul 2020 15:36:41 +0000 (17:36 +0200)]
OpenMP: Support 'lastprivate (conditional:' in Fortran
gcc/fortran/ChangeLog:
* gfortran.h (gfc_omp_namelist): Add lastprivate_conditional.
* openmp.c (gfc_match_omp_clauses): Handle 'conditional:'
modifier of 'lastprivate'.
* trans-openmp.c (gfc_omp_clause_default_ctor): Don't assert
on OMP_CLAUSE__CONDTEMP_ and other OMP_*TEMP_.
(gfc_trans_omp_variable_list): Handle lastprivate_conditional.
gcc/testsuite/ChangeLog:
* gfortran.dg/gomp/lastprivate-conditional-1.f90: New test.
* gfortran.dg/gomp/lastprivate-conditional-2.f90: New test.
* gfortran.dg/gomp/lastprivate-conditional-3.f90: New test.
* gfortran.dg/gomp/lastprivate-conditional-4.f90: New test.
* gfortran.dg/gomp/lastprivate-conditional-5.f90: New test.
Arnaud Charlet [Thu, 23 Jul 2020 13:54:45 +0000 (09:54 -0400)]
[Ada] Stub CUDA_Execute and CUDA_Global pragmas
This commit adds CUDA_Execute and CUDA_Global to the list of allowed
pragmas. It also implements basic validation of said pragmas.
gcc/ada/
* aspects.ads: Declare CUDA_Global as aspect.
* einfo.ads: Use Flag118 for the Is_CUDA_Kernel flag.
(Set_Is_CUDA_Kernel): New function.
(Is_CUDA_Kernel): New function.
* einfo.adb (Set_Is_CUDA_Kernel): New function.
(Is_CUDA_Kernel): New function.
* par-prag.adb (Prag): Ignore Pragma_CUDA_Execute and
Pragma_CUDA_global.
* rtsfind.ads: Define CUDA.Driver_Types.Stream_T and
CUDA.Vector_Types.Dim3 entities
* rtsfind.adb: Define CUDA_Descendant subtype.
(Get_Unit_Name): Handle CUDA_Descendant packages.
* sem_prag.ads: Mark CUDA_Global as aspect-specifying pragma.
* sem_prag.adb (Analyze_Pragma): Validate Pragma_CUDA_Execute and
Pragma_CUDA_Global.
* snames.ads-tmpl: Define Name_CUDA_Execute and Name_CUDA_Global.
Arnaud Charlet [Thu, 23 Jul 2020 13:11:56 +0000 (09:11 -0400)]
[Ada]
Ada2020: AI12-0027 Access values and unaliased component
Access values should never designate unaliased components.
This new feature is documented in AI12-0027-1.
gcc/ada/
* sem_ch13.ads (Same_Representation): Renamed as
Has_Compatible_Representation because now the order of the arguments
are taken into account; its formals are also renamed as Target_Type
and Operand_Type.
* sem_ch13.adb (Same_Representation): Renamed and moved to place the
routine in alphabetic order.
* sem_attr.adb (Prefix_With_Safe_Accessibility_Level): New subprogram.
(Resolve_Attribute): Check that the prefix of attribute Access
does not have a value conversion of an array type.
* sem_res.adb (Resolve_Actuals): Remove restrictive check on view
conversions which required matching value of Has_Aliased_Components of
formals and actuals.
* exp_ch4.adb (Handle_Changed_Representation): Update call to
Same_Representation.
(Expand_N_Type_Conversion): Update call to Same_Representation.
* exp_ch5.adb (Change_Of_Representation): Update call to
Same_Representation.
* exp_ch6.adb (Add_Call_By_Copy_Code): Update call to
Same_Representation.
(Expand_Actuals): Update call to Same_Representation.
(Expand_Call_Helper): Update call to Same_Representation.
Dong JianQiang [Tue, 21 Jul 2020 17:24:52 +0000 (01:24 +0800)]
gcov-tool: Fix merging of different endian coverage data [PR96267]
2020-07-21 Dong JianQiang <dongjianqiang2@huawei.com>
gcc/ChangeLog:
PR gcov-profile/96267
* gcov-io.c (gcov_open): enable if IN_GCOV_TOOL.
Tobias Burnus [Thu, 23 Jul 2020 13:02:15 +0000 (15:02 +0200)]
libomp: Add omp_depend_kind to omp_lib.{f90,h}
gcc/fortran/ChangeLog:
* intrinsic.texi (OMP_LIB_KINDS): Add omp_depend_kind.
libgomp/ChangeLog:
* configure.ac: Add OMP_DEPEND_KIND and OMP_INT128_SIZE.
* libgomp_f.h.in (omp_check_defines): Check whether
sizeof of determined Fortran kind and C typedef match.
* omp_lib.f90.in: Add omp_depened_kind.
* omp_lib.h.in: Likewise; fix omp_alloctrait_key_kind.
* configure: Regenerate.
* Makefile.in: Regenerate.
* testsuite/Makefile.in: Regenerate.
Arnaud Charlet [Thu, 23 Jul 2020 12:57:22 +0000 (08:57 -0400)]
[Ada] Add push/pop capability in Output
Add the capability to use the Write_* procedures in an environment where
you want to write debugging info but still use them to write to other
files (such a C source files).
gcc/ada/
* output.ads (Push_Output, Pop_Output): New procedures.
* output.adb (FD_Array, FD_Stack, FD_Stack_Idx): New type and vars.
(Push_Output, Pop_Output): New procedures.
Kewen Lin [Thu, 23 Jul 2020 10:01:36 +0000 (05:01 -0500)]
rs6000: Rename function adjust_vectorization_cost
This patch is to rename the existing function adjust_vectorization_cost
to rs6000_adjust_vect_cost_per_stmt, to avoid some confusion.
gcc/ChangeLog:
* config/rs6000/rs6000.c (adjust_vectorization_cost): Renamed to ...
(rs6000_adjust_vect_cost_per_stmt): ... here.
(rs6000_add_stmt_cost): Rename adjust_vectorization_cost to
rs6000_adjust_vect_cost_per_stmt.
Kewen Lin [Thu, 23 Jul 2020 09:27:50 +0000 (04:27 -0500)]
ivopts: Handle vector with length IFNs
This patch is to handle vector with length internal functions
IFN_LEN_LOAD and IFN_LEN_STORE in IVOPTS.
gcc/ChangeLog:
* tree-ssa-loop-ivopts.c (get_mem_type_for_internal_fn): Handle
IFN_LEN_LOAD and IFN_LEN_STORE.
(get_alias_ptr_type_for_ptr_address): Likewise.
Tobias Burnus [Thu, 23 Jul 2020 10:55:53 +0000 (12:55 +0200)]
OpenMP: Update gcc/fortran/*.texi
gcc/fortran/ChangeLog:
* gfortran.texi (Standards): Update URL; state that OpenMP 4.5
is supported and 5.0 is partially.
* intrinsic.texi (OpenMP Modules): Refer also to OpenMP 5.0;
(OMP_LIB): Add missing derived type and new named constants.
Martin Liska [Fri, 10 Jul 2020 08:56:34 +0000 (10:56 +0200)]
gcov: create folders with 0777.
libgcc/ChangeLog:
PR gcov-profile/96035
* libgcov-driver-system.c: Create gcov folders with 0777
so that it respects a system umask.
Martin Liska [Thu, 23 Jul 2020 08:39:00 +0000 (10:39 +0200)]
gcc-changelog: fix when somebody reverts a backport
contrib/ChangeLog:
* gcc-changelog/git_commit.py: When reverting a backport,
we should print only Revert header.
Kito Cheng [Wed, 22 Jul 2020 06:50:40 +0000 (14:50 +0800)]
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.
Hans-Peter Nilsson [Thu, 23 Jul 2020 02:27:25 +0000 (04:27 +0200)]
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.
GCC Administrator [Thu, 23 Jul 2020 00:16:28 +0000 (00:16 +0000)]
Daily bump.
Jonathan Wakely [Wed, 22 Jul 2020 19:10:38 +0000 (20:10 +0100)]
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.
Tobias Burnus [Wed, 22 Jul 2020 19:02:01 +0000 (21:02 +0200)]
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.
Peter Bergner [Wed, 22 Jul 2020 16:44:35 +0000 (11:44 -0500)]
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.
Nathan Sidwell [Wed, 22 Jul 2020 15:38:58 +0000 (08:38 -0700)]
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.
Nathan Sidwell [Wed, 22 Jul 2020 15:34:22 +0000 (08:34 -0700)]
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 '-'
Nathan Sidwell [Wed, 22 Jul 2020 15:27:30 +0000 (08:27 -0700)]
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.
Nathan Sidwell [Wed, 22 Jul 2020 15:20:31 +0000 (08:20 -0700)]
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'.
Nathan Sidwell [Wed, 22 Jul 2020 15:07:25 +0000 (08:07 -0700)]
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.
Nathan Sidwell [Wed, 22 Jul 2020 15:01:45 +0000 (08:01 -0700)]
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.
Nathan Sidwell [Wed, 22 Jul 2020 14:52:31 +0000 (07:52 -0700)]
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.
H.J. Lu [Wed, 22 Jul 2020 14:33:54 +0000 (07:33 -0700)]
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.
Jonathan Wakely [Wed, 22 Jul 2020 12:25:11 +0000 (13:25 +0100)]
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.
Jozef Lawrynowicz [Wed, 22 Jul 2020 11:37:29 +0000 (12:37 +0100)]
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.
Jozef Lawrynowicz [Wed, 22 Jul 2020 11:34:30 +0000 (12:34 +0100)]
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.
Tobias Burnus [Wed, 22 Jul 2020 10:12:48 +0000 (12:12 +0200)]
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/.
Przemyslaw Wirkus [Wed, 22 Jul 2020 09:14:39 +0000 (10:14 +0100)]
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.
Wei Wentao [Wed, 22 Jul 2020 09:16:34 +0000 (10:16 +0100)]
doc: fix a typo in languages.texi
gcc/
* doc/languages.texi: Fix “then”/“than” typo.
Przemyslaw Wirkus [Wed, 22 Jul 2020 09:13:00 +0000 (10:13 +0100)]
MAINTAINERS: Add myself for write after approval
2020-07-22 Przemyslaw Wirkus <przemyslaw.wirkus@arm.com>
* MAINTAINERS (Write After Approval): Add myself.
Tobias Burnus [Tue, 21 Jul 2020 16:29:53 +0000 (18:29 +0200)]
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.
Hans-Peter Nilsson [Wed, 22 Jul 2020 01:46:46 +0000 (03:46 +0200)]
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.
GCC Administrator [Wed, 22 Jul 2020 00:16:27 +0000 (00:16 +0000)]
Daily bump.
Sunil K Pandey [Sat, 18 Jul 2020 02:42:09 +0000 (19:42 -0700)]
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.
Peter Bergner [Tue, 21 Jul 2020 21:20:33 +0000 (16:20 -0500)]
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.
Nathan Sidwell [Tue, 21 Jul 2020 19:37:58 +0000 (12:37 -0700)]
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.
Harald Anlauf [Tue, 21 Jul 2020 19:37:30 +0000 (21:37 +0200)]
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.
Uros Bizjak [Tue, 21 Jul 2020 18:22:05 +0000 (20:22 +0200)]
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.
Jozef Lawrynowicz [Tue, 21 Jul 2020 16:24:04 +0000 (17:24 +0100)]
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.
Jozef Lawrynowicz [Tue, 21 Jul 2020 16:24:03 +0000 (17:24 +0100)]
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.
Jozef Lawrynowicz [Tue, 21 Jul 2020 16:24:03 +0000 (17:24 +0100)]
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.
Sandra Loosemore [Tue, 21 Jul 2020 16:20:36 +0000 (09:20 -0700)]
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.
Dimitar Dimitrov [Thu, 9 Jul 2020 19:29:13 +0000 (22:29 +0300)]
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>
Dimitar Dimitrov [Thu, 9 Jul 2020 19:29:37 +0000 (22:29 +0300)]
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>
Dimitar Dimitrov [Thu, 9 Jul 2020 19:04:38 +0000 (22:04 +0300)]
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>
Dimitar Dimitrov [Thu, 9 Jul 2020 19:00:46 +0000 (22:00 +0300)]
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>
Kito Cheng [Mon, 20 Jul 2020 06:41:04 +0000 (14:41 +0800)]
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.
Xionghu Luo [Tue, 21 Jul 2020 03:37:30 +0000 (22:37 -0500)]
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.
Kewen Lin [Tue, 21 Jul 2020 03:14:19 +0000 (22:14 -0500)]
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.
Hans-Peter Nilsson [Tue, 21 Jul 2020 00:43:11 +0000 (02:43 +0200)]
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.
Hans-Peter Nilsson [Tue, 21 Jul 2020 00:35:26 +0000 (02:35 +0200)]
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.
GCC Administrator [Tue, 21 Jul 2020 00:16:28 +0000 (00:16 +0000)]
Daily bump.
Hans-Peter Nilsson [Mon, 20 Jul 2020 23:15:36 +0000 (01:15 +0200)]
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.
Jonathan Wakely [Mon, 20 Jul 2020 22:49:27 +0000 (23:49 +0100)]
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.
Jason Merrill [Sun, 12 Jul 2020 21:31:24 +0000 (17:31 -0400)]
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.
Jason Merrill [Tue, 7 Jul 2020 05:41:35 +0000 (01:41 -0400)]
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.
Jason Merrill [Wed, 8 Jul 2020 05:11:44 +0000 (01:11 -0400)]
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.
Sergei Trofimovich [Tue, 14 Jul 2020 06:48:42 +0000 (07:48 +0100)]
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.
Jonathan Wakely [Mon, 20 Jul 2020 19:06:46 +0000 (20:06 +0100)]
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.
y00520163 [Mon, 20 Jul 2020 18:47:05 +0000 (19:47 +0100)]
vect: Fix an ICE in vectorizable_simd_clone_call
In vectorizable_simd_clone_call, type compatibility is handled based on
the number of elements and the type compatibility of elements, which is
not enough. This patch add VIEW_CONVERT_EXPRs if the arguments types
and return type of simd clone function are distinct with the vectype of
stmt.
2020-07-20 Yang Yang <yangyang305@huawei.com>
gcc/ChangeLog:
* tree-vect-stmts.c (vectorizable_simd_clone_call): Add
VIEW_CONVERT_EXPRs if the arguments types and return type
of simd clone function are distinct with the vectype of stmt.
gcc/testsuite/ChangeLog:
* gcc.target/aarch64/sve/pr96195.c: New test.
Uros Bizjak [Mon, 20 Jul 2020 18:34:46 +0000 (20:34 +0200)]
i386: Use lock prefixed insn instead of MFENCE [PR95750]
Currently, __atomic_thread_fence(seq_cst) on x86 and x86-64 generates
mfence instruction. A dummy atomic instruction (a lock-prefixed instruction
or xchg with a memory operand) would provide the same sequential consistency
guarantees while being more efficient on most current CPUs. The mfence
instruction additionally orders non-temporal stores, which is not relevant
for atomic operations and are not ordered by seq_cst atomic operations anyway.
2020-07-20 Uroš Bizjak <ubizjak@gmail.com>
gcc/ChangeLog:
PR target/95750
* config/i386/i386.h (TARGET_AVOID_MFENCE):
Rename from TARGET_USE_XCHG_FOR_ATOMIC_STORE.
* config/i386/sync.md (mfence_sse2): Disable for TARGET_AVOID_MFENCE.
(mfence_nosse): Enable also for TARGET_AVOID_MFENCE. Emit stack
referred memory in word_mode.
(mem_thread_fence): Do not generate mfence_sse2 pattern when
TARGET_AVOID_MFENCE is true.
(atomic_store<mode>): Update for rename.
* config/i386/x86-tune.def (X86_TUNE_AVOID_MFENCE):
Rename from X86_TUNE_USE_XCHG_FOR_ATOMIC_STORE.
gcc/testsuite/ChangeLog:
PR target/95750
* gcc.target/i386/pr95750.c: New test.
Martin Sebor [Mon, 20 Jul 2020 18:06:18 +0000 (12:06 -0600)]
Correct handling of constant representations containing embedded nuls.
Resolves:
PR middle-end/95189 - memcmp being wrongly stripped like strcm
PR middle-end/95886 - suboptimal memcpy with embedded zero bytes
gcc/ChangeLog:
PR middle-end/95189
PR middle-end/95886
* builtins.c (inline_expand_builtin_string_cmp): Rename...
(inline_expand_builtin_bytecmp): ...to this.
(builtin_memcpy_read_str): Don't expect data to be nul-terminated.
(expand_builtin_memory_copy_args): Handle object representations
with embedded nul bytes.
(expand_builtin_memcmp): Same.
(expand_builtin_strcmp): Adjust call to naming change.
(expand_builtin_strncmp): Same.
* expr.c (string_constant): Create empty strings with nonzero size.
* fold-const.c (c_getstr): Rename locals and update comments.
* tree.c (build_string): Accept null pointer argument.
(build_string_literal): Same.
* tree.h (build_string): Provide a default.
(build_string_literal): Same.
gcc/testsuite/ChangeLog:
PR middle-end/95189
PR middle-end/95886
* gcc.dg/memcmp-pr95189.c: New test.
* gcc.dg/strncmp-3.c: New test.
* gcc.target/i386/memcpy-pr95886.c: New test.
Joseph Myers [Mon, 20 Jul 2020 18:05:30 +0000 (18:05 +0000)]
Regenerate .pot files.
gcc/po/
* gcc.pot: Regenerate.
libcpp/po/
* cpplib.pot: Regenerate.
Martin Sebor [Mon, 20 Jul 2020 17:56:54 +0000 (11:56 -0600)]
Remove stray text from option description (PR c/96249).
gcc/c-family/ChangeLog:
PR c/96249
* c.opt: Remove stray text.