aboutsummaryrefslogtreecommitdiff
path: root/gcc
AgeCommit message (Collapse)AuthorFilesLines
2020-11-30gimple ISEL: fix BB stmt iterationMartin Liska1-0/+2
gcc/ChangeLog: PR tree-optimization/98066 * gimple-isel.cc (gimple_expand_vec_exprs): Return when gimple_expand_vec_exprs replaces last stmt.
2020-11-30rtl_dump_bb: fix segfault when reporting internal errorIlya Leoshkevich1-1/+9
During ICE reporting, sometimes rtl_dump_bb is called on partially initialized basic blocks. This produces another ICE, obscuring the original problem. Fix by checking that that basic blocks are initialized before touching their bb_infos. gcc/ChangeLog: 2020-11-25 Ilya Leoshkevich <iii@linux.ibm.com> * cfgrtl.c (rtl_bb_info_initialized_p): New function. (rtl_dump_bb): Use rtl_bb_info_initialized_p before accessing bb insns.
2020-11-30d: Add freebsd support for D compiler and runtimeIain Buclaw3-0/+66
gcc/ChangeLog: PR d/87818 * config.gcc (*-*-freebsd*): Add freebsd-d.o and t-freebsd. * config/freebsd-d.c: New file. * config/t-freebsd: New file. libphobos/ChangeLog: PR d/87818 * configure.tgt: Add x86_64-*-freebsd* and i?86-*-freebsd* as supported targets.
2020-11-30[Obvious] arm: Fix test from failing on some targets [PR91816]Stam Markianos-Wright1-2/+3
This recently submitted test was found to fail on some Cortex-M targets. This was because codegen on these CPUs would emit a ldr instead of a movw/movt pair, resulting in an overall smaller test (i.e. the branch wasn't as far) and the behaviour being tested for not being triggered. This commit doubles the size of the test to account for this. gcc/testsuite/ChangeLog: * gcc.target/arm/pr91816.c: New test.
2020-11-30expansion: Improve double-word modulo by certain constant divisors [PR97459]Jakub Jelinek5-1/+337
As discussed in the PR, e.g. on x86_64 (both -m32 and -m64) there is no double-word modulo and so we expand it to a __{,u}mod[dt]i3 call. For certain constant divisors we can do better. E.g. consider 32-bit word-size, 0x100000000ULL % 3 == 1, so we can use partly the Hacker's delight modulo by summing digits approach and optimize unsigned long long foo (unsigned long long x) { return x % 3; } as unsigned long long foo (unsigned long long x) { unsigned int sum, carry; carry = __builtin_add_overflow ((unsigned int) x, (unsigned int) (x >> 32), &sum); sum += carry; return sum % 3; } Similarly, 0x10000000ULL % 5 == 1 (note, 1 << 28), so unsigned long long bar (unsigned long long x) { return x % 5; } as unsigned long long bar (unsigned long long x) { unsigned int sum = x & ((1 << 28) - 1); sum += (x >> 28) & ((1 << 28) - 1); sum += (x >> 56); return sum % 5; } etc. And we can do also signed modulo, long long baz (long long x) { return x % 5; } as long long baz (long long x) { unsigned int sum = x & ((1 << 28) - 1); sum += ((unsigned long long) x >> 28) & ((1 << 28) - 1); sum += ((unsigned long long) x >> 56); /* Sum adjustment for negative x. */ sum += (x >> 63) & 3; unsigned int rem = sum % 5; /* And finally adjust it to the right interval for negative values. */ return (int) (rem + ((x >> 63) & -4)); } 2020-11-30 Jakub Jelinek <jakub@redhat.com> PR rtl-optimization/97459 * internal-fn.h (expand_addsub_overflow): Declare. * internal-fn.c (expand_addsub_overflow): No longer static. * optabs.c (expand_doubleword_mod): New function. (expand_binop): Optimize double-word mod with constant divisor. * gcc.dg/pr97459-1.c: New test. * gcc.dg/pr97459-2.c: New test.
2020-11-30RISC-V: Always define MULTILIB_DEFAULTSKito Cheng3-88/+12
- Define MULTILIB_DEFAULTS can reduce the total number of multilib if the default arch and ABI are listed in the multilib config. - This also simplify the implementation of --with-multilib-list. gcc/ChangeLog: * config.gcc (riscv*-*-*): Add TARGET_RISCV_DEFAULT_ABI and TARGET_RISCV_DEFAULT_ARCH to tm_defines. Remove including riscv/withmultilib.h for --with-multilib-list. * config/riscv/riscv.h (STRINGIZING): New. (__STRINGIZING): Ditto. (MULTILIB_DEFAULTS): Ditto. * config/riscv/withmultilib.h: Remove.
2020-11-30Fix print_multilib_info when default arguments appear in the option list ↵Kito Cheng1-6/+17
with '!' This issue is found when we try to always define MULTILIB_DEFAULTS for -march and -mabi for RISC-V back-end, however `-print-multi-lib` will skip multi-lib setting if match any one of flag in MULTILIB_DEFAULTS, even some options are specified in the option list with '!'. e.g. We have default march=rv32i and mabi=ilp32. And we have following multi-lib set: ". !march=rv32i !march=rv32im !march=rv32imafc !mabi=ilp32 !mabi=ilp32f;" "rv32i/ilp32 march=rv32i !march=rv32im !march=rv32imafc mabi=ilp32 !mabi=ilp32f;" "rv32im/ilp32 !march=rv32i march=rv32im !march=rv32imafc mabi=ilp32 !mabi=ilp32f;" "rv32imafc/ilp32f !march=rv32i !march=rv32ic !march=rv32im march=rv32imafc !mabi=ilp32 mabi=ilp32f;" `-print-multi-lib` willl show `.` and `rv32imafc/ilp32f` only, because the mabi=ilp32 is matched, however there is `!march=rv32i` in `rv32im/ilp32`, so `rv32im/ilp32` should keep, because it reject march=rv32i. Note: This can be reproduced via following configure options with patch [1]: gcc/configure --target=riscv64-elf --with-arch=rv32i --with-abi=ilp32 \ --with-multilib-generator="rv32i-ilp32--;rv32im-ilp32--;rv32imafc-ilp32f--" [1] https://gcc.gnu.org/pipermail/gcc-patches/2020-November/559707.html gcc/ChangeLog: * gcc.c (print_multilib_info): Check default arguments not appeared in multi-lib option list with '!'
2020-11-29Fix minor bug in ft32 widening multiplyJeff Law1-3/+3
gcc/ * config/ft32/ft32.md (umulsidi3): Do not allow constants as arguments.
2020-11-30Daily bump.GCC Administrator6-1/+121
2020-11-29PR fortran/98017 - Suspected regression using PACKHarald Anlauf2-0/+17
When substituting a parameter variable of type character, the character length was reset to 1. Fix this by copying the length. gcc/fortran/ChangeLog: * expr.c (simplify_parameter_variable): Fix up character length after copying an array-valued expression. gcc/testsuite/ChangeLog: * gfortran.dg/pr98017.f90: New test.
2020-11-29Fix handling of ignore_stores in ipa_merge_modref_summary_after_inliningJan Hubicka1-2/+2
* ipa-modref.c (ipa_merge_modref_summary_after_inlining): Fix handling of ignore_stores.
2020-11-29Fix freeing of thunk-infoJan Hubicka1-1/+1
PR jit/97867 * symtab-thunks.h (thunk_info::release): Use ggc_delete.
2020-11-29Handle PHIs in compute_objsize.Martin Sebor26-651/+2190
PR middle-end/92936 - missing warning on a past-the-end store to a PHI PR middle-end/92940 - incorrect offset and size in -Wstringop-overflow for out-of-bounds store into VLA and two offset ranges PR middle-end/89428 - missing -Wstringop-overflow on a PHI with variable offset gcc/ChangeLog: PR middle-end/92936 PR middle-end/92940 PR middle-end/89428 * builtins.c (access_ref::access_ref): Initialize member. (access_ref::phi): New function. (access_ref::get_ref): New function. (access_ref::add_offset): Remove duplicate assignment. (maybe_warn_for_bound): Add "maybe" kind of warning messages. (warn_for_access): Same. (inform_access): Rename... (access_ref::inform_access): ...to this. Print PHI arguments. Format offset the same as size and simplify. Improve printing of allocation functions and VLAs. (check_access): Adjust to the above. (gimple_parm_array_size): Change argument. (handle_min_max_size): New function. * builtins.h (class ssa_name_limit_t): Move class here from tree-ssa-strlen.c. (struct access_ref): Declare new members. (gimple_parm_array_size): Change argument. * tree-ssa-strlen.c (maybe_warn_overflow): Use access_ref and simplify. (handle_builtin_memcpy): Correct argument passed to maybe_warn_overflow. (handle_builtin_memset): Same. (class ssa_name_limit_t): Move class to builtins.{h,c}. gcc/testsuite/ChangeLog: PR middle-end/92936 PR middle-end/92940 PR middle-end/89428 * c-c++-common/Wstringop-overflow-2.c: Adjust text of expected informational notes. * g++.dg/warn/Wstringop-overflow-3.C: Same. * g++.dg/warn/Wplacement-new-size.C: Remove a test for a no longer issued warning. * gcc.dg/Warray-bounds-43.c: Removed unused declarations. * gcc.dg/Wstringop-overflow-11.c: Remove xfails. * gcc.dg/Wstringop-overflow-12.c: Same. * gcc.dg/Wstringop-overflow-17.c: Adjust text of expected messages. * gcc.dg/Wstringop-overflow-27.c: Same. Remove xfails. * gcc.dg/Wstringop-overflow-28.c: Adjust text of expected messages. * gcc.dg/Wstringop-overflow-29.c: Same. * gcc.dg/Wstringop-overflow-37.c: Same. * gcc.dg/Wstringop-overflow-46.c: Same. * gcc.dg/Wstringop-overflow-47.c: Same. * gcc.dg/Wstringop-overflow-54.c: Same. * gcc.dg/warn-strnlen-no-nul.c: Add expected warning. * gcc.dg/Wstringop-overflow-7.c: New test. * gcc.dg/Wstringop-overflow-58.c: New test. * gcc.dg/Wstringop-overflow-59.c: New test. * gcc.dg/Wstringop-overflow-60.c: New test. * gcc.dg/Wstringop-overflow-61.c: New test. * gcc.dg/Wstringop-overflow-62.c: New test. * gcc.dg/Wstringop-overflow-63.c: New test. * gcc.dg/Wstringop-overflow-64.c: New test.
2020-11-29d: Add darwin support for D language front-endIain Buclaw8-3/+122
gcc/ChangeLog: * config.gcc (*-*-darwin*): Set d_target_objs and target_has_targetdm. * config/elfos.h (TARGET_D_MINFO_SECTION): New macro. (TARGET_D_MINFO_START_NAME): New macro. (TARGET_D_MINFO_END_NAME): New macro. * config/t-darwin: Add darwin-d.o. * doc/tm.texi: Regenerate. * doc/tm.texi.in (D language and ABI): Add @hook for TARGET_D_MINFO_SECTION, TARGET_D_MINFO_START_NAME, and TARGET_D_MINFO_END_NAME. * config/darwin-d.c: New file. gcc/d/ChangeLog: * d-target.def (d_minfo_section): New hook. (d_minfo_start_name): New hook. (d_minfo_end_name): New hook. * modules.cc: Include d-target.h. (register_moduleinfo): Update to use new targetdm hooks.
2020-11-29Fix PR ada/97504 on hppa*-*-hpux*.John David Anglin1-0/+2
2020-11-29 John David Anglin <danglin@gcc.gnu.org> gcc/ada/ PR ada/97504 * Makefile.rtl (LIBGNAT_TARGET_PAIRS) <hppa*-*-hpux*>: Use wraplf version of Aux_Long_Long_Float.
2020-11-29Skip EAF_UNUSED parameters in handle_pure_callJan Hubicka1-0/+5
* tree-ssa-structalias.c (handle_pure_call): Skip EAF_UNUSED parameters.
2020-11-29Detect unused parameters in ipa-modrefJan Hubicka1-4/+26
* ipa-modref.c (modref_lattice::merge): Do nothing if F is EAF_UNUSED. (analyze_parms): Detect unused params. (modref_merge_call_site_flags): Merge correct EAF_UNUSED.
2020-11-29d: Remove d_size_t from front-end sources (PR 87788)Iain Buclaw10-45/+31
The typedef for d_size_t assumes that the implementation of the front-end is written in D itself, where size_t can map only to uint32_t or uint64_t. As that is not the case for the current D front-end, the typedef should be removed. This would fix the bootstrap on targets where in C++ size_t is a long, such as darwin i386. Reviewed-on: https://github.com/dlang/dmd/pull/12008 gcc/d/ChangeLog: PR d/87788 * dmd/MERGE: Merge upsream dmd 45fa6cfd2.
2020-11-29Daily bump.GCC Administrator5-1/+68
2020-11-28Improve support of simple bit-fields in -fdump-ada-specEric Botcazou1-14/+9
This fixes an issue with nested structures and adds an Alignment clause to counter the effect of the Pack aspect. gcc/c-family/ChangeLog: * c-ada-spec.c (dump_nested_type) <RECORD_TYPE>: Remove obsolete code. (dump_ada_structure): Also deal with convention, unchecked union and bit-field for nested types. In the latter case, print an Alignment aspect along with the Pack aspect.
2020-11-28compiler: avoid follow-on errors for bad typesIan Lance Taylor5-16/+95
Mark bad types as erroneous, to avoid generating further errors. This required some code using array types to check for errors. For https://golang.org/issue/19880 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/273626
2020-11-28compiler: better error for x, x := 1, 2Ian Lance Taylor2-4/+12
Was assign.go:59:28: error: multiple assignments to x Now assign.go:59:28: error: ‘x’ repeated on left side of := Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/273546
2020-11-28Fix PR target/97939Eric Botcazou3-55/+113
The little dance around 4096 that add/sub instructions do on the SPARC needs to be taken into account for the overflow arithmetic operations. It cannot be done for unsigned overflow, but it can be done for signed overflow. gcc/ChangeLog: PR target/97939 * config/sparc/predicates.md (arith_double_add_operand): Comment. * config/sparc/sparc.md (uaddvdi4): Use arith_double_operand. (addvdi4): Use arith_double_add_operand. (addsi3): Remove useless attributes. (addvsi4): Use arith_add_operand. (*cmp_ccv_plus): Likewise and add second alternative accordingly. (*cmp_ccxv_plus): Likewise. (*cmp_ccv_plus_set): Likewise. (*cmp_ccxv_plus_set): Likewise. (*cmp_ccv_plus_sltu_set): Likewise. (usubvdi4): Use arith_double_operand. (subvdi4): Use arith_double_add_operand. (subsi3): Remove useless attributes. (subvsi4): Use arith_add_operand. (*cmp_ccv_minus): Likewise and add second alternative accordingly. (*cmp_ccxv_minus): Likewise. (*cmp_ccv_minus_set): Likewise. (*cmp_ccxv_minus_set): Likewise. (*cmp_ccv_minus_sltu_set): Likewise. (negsi2): Use register_operand. (unegvsi3): Likewise. (negvsi3) Likewise. (*cmp_ccnz_neg): Likewise. (*cmp_ccxnz_neg): Likewise. (*cmp_ccnz_neg_set): Likewise. (*cmp_ccxnz_neg_set): Likewise. (*cmp_ccc_neg_set): Likewise. (*cmp_ccxc_neg_set): Likewise. (*cmp_ccc_neg_sltu_set): Likewise. (*cmp_ccv_neg): Likewise. (*cmp_ccxv_neg): Likewise. (*cmp_ccv_neg_set): Likewise. (*cmp_ccxv_neg_set): Likewise. (*cmp_ccv_neg_sltu_set): Likewise. gcc/testsuite/ChangeLog: * gcc.target/sparc/overflow-6.c: New test.
2020-11-28Generate correct fn specs for some Fortran library functions.Thomas Koenig5-10/+98
This patch works by generating the correct fn spec from the actual arguments in specific_intrinsic_symbol, and by passing this down via gfc_get_extern_function_decl to gfc_get_function_type. CSHIFT remains to be done. gcc/fortran/ChangeLog: PR fortran/97454 * trans-decl.c (gfc_get_extern_function_decl): Add argument fnspec. * trans-intrinsic.c (MAX_SPEC_ARG): Define. (intrinsic_fnspec): New function. (ADD_CHAR): Define. (specific_intrinsic_symbol): Adjust comment. Pass fn spec to gfc_get_extern_function_decl. (gfc_conv_intrinsic_funcall): Add ANY, ALL, NORM2, PRODUCT and SUM intrnisic. Add FIXME for cshift et al. * trans-types.c (gfc_get_function_type): Add fnspec argument, handle it. * trans-types.h (gfc_get_function_type): Add optinal fnspec argument. * trans.h (gfc_get_extern_function_decl): Likewise.
2020-11-28Daily bump.GCC Administrator6-1/+435
2020-11-27Revert previous change and use pragma to suppress -Wformat-diag.Martin Sebor1-10/+8
gcc/cp/ChangeLog: * error.c (add_quotes): Revert previous change and use pragma to suppress -Wformat-diag.
2020-11-27preprocessor: Fix #line overflow check [PR97602]Joseph Myers2-0/+10
The preprocessor check for overflow (of linenum_type = unsigned int) when reading the line number in a #line directive is incomplete; it checks "reg < reg_prev" which doesn't cover all cases where multiplying by 10 overflowed. Fix this by checking for overflow before rather than after it occurs (using essentially the same logic as used by e.g. glibc printf when reading width and precision values from strings). Bootstrapped with no regressions for x86_64-pc-linux-gnu. libcpp/ 2020-11-27 Joseph Myers <joseph@codesourcery.com> PR preprocessor/97602 * directives.c (strtolinenum): Check for overflow before it occurs. Correct comment. gcc/testsuite/ 2020-11-27 Joseph Myers <joseph@codesourcery.com> PR preprocessor/97602 * gcc.dg/cpp/line9.c, gcc.dg/cpp/line10.c: New tests.
2020-11-27d: Merge upstream dmd db0df3f7e.Iain Buclaw14-986/+4
Removes all support code and tests for the extern(Pascal) calling convention. Reviewed-on: https://github.com/dlang/dmd/pull/11994 gcc/d/ChangeLog: * dmd/MERGE: Merge upstream dmd db0df3f7e. * types.cc (TypeVisitor::visit (TypeFunction *)): Remove LINKpascal.
2020-11-27d: Add float and double overloads for all core.math intrinsicsIain Buclaw3-38/+86
For the math intrinsics: cos, fabs, ldexp, rint, rndtol, and sin, new overloads have been added to the core.math module for matching float and double types. These have been implemented in the compiler. A recent change to dump_function_to_file started triggering some scan-tree-dump tests to FAIL, these have been adjusted as well when updating the test. gcc/d/ChangeLog: * intrinsics.cc (maybe_expand_intrinsic): Handle new intrinsics. * intrinsics.def (INTRINSIC_COS): Add float and double overloads. (INTRINSIC_FABS): Likewise. (INTRINSIC_LDEXP): Likewise. (INTRINSIC_RINT): Likewise. (INTRINSIC_RNDTOL): Likewise. (INTRINSIC_SIN): Likewise. (INTRINSIC_TOPREC): Adjust signature. libphobos/ChangeLog: * libdruntime/MERGE: Merge upstream druntime 5e4492c4. gcc/testsuite/ChangeLog: * gdc.dg/intrinsics.d: Adjust patterns in scan-tree-dump.
2020-11-27testsuite/i386: Fix XOP and FMA4 checking functions [PR98036].Uros Bizjak11-71/+57
Add missing returns and remove unnecessary postfix increments. 2020-11-27 Uroš Bizjak <ubizjak@gmail.com> PR testsuite/98036 gcc/testsuite/ * gcc.target/i386/fma4-256-maccXX.c (check_maccps): Remove unnecessary postfix increment on a returned variable. (check_maccpd): Ditto. * gcc.target/i386/fma4-256-msubXX.c (check_msubps): Ditto. (check_msubpd): Ditto. * gcc.target/i386/fma4-256-nmaccXX.c (check_nmaccps): Ditto. (check_nmaccpd): Ditto. * gcc.target/i386/fma4-256-nmsubXX.c (check_nmsubps): Ditto. (check_nmsubpd): Ditto. * gcc.target/i386/fma4-maccXX.c (check_maccps): Ditto. (check_maccpd): Ditto. (check_maccss): Ditto. (check_maccsd): Ditto. * gcc.target/i386/fma4-msubXX.c (check_msubps): Ditto. (check_msubpd): Ditto. (check_msubss): Ditto. (check_msubsd): Ditto. * gcc.target/i386/fma4-nmaccXX.c (check_nmaccps): Ditto. (check_nmaccpd): Ditto. (check_nmaccss): Ditto. (check_nmaccsd): Ditto. * gcc.target/i386/fma4-nmsubXX.c (check_nmsubps): Ditto. (check_nmsubpd): Ditto. (check_nmsubss): Ditto. (check_nmsubsd): Ditto. * gcc.target/i386/xop-haddX.c (check_sbyte2word): Add missing return. (check_sbyte2dword): Remove unnecessary postfix increment on a returned value. (check_sbyte2qword): Ditto. (check_sword2dword): Add missing return. (check_sword2qword): Remove unnecessary postfix increment on a returned value. (check_dword2qword): Add missing return. * gcc.target/i386/xop-hadduX.c (check_byte2word): Add missing return. (check_byte2dword): Remove unnecessary postfix increment on a returned value. (check_byte2qword): Ditto. (check_word2dword): Add missing return. (check_word2qword): Remove unnecessary postfix increment on a returned value. (check_word2qword): Add missing return. * gcc.target/i386/xop-hsubX.c (check_sbyte2word): Add missing return. (check_sword2dword): Ditto. (check_sword2qword): Ditto.
2020-11-27INSTALL: Default to --enable-cet=autoH.J. Lu1-5/+4
PR other/98027 * doc/install.texi: Default to --enable-cet=auto.
2020-11-27In 'gcc/omp-oacc-kernels-decompose.cc:flatten_binds', don't choke on empty ↵Thomas Schwinge3-3/+13
GIMPLE sequence Also, instead of just examining the first statement of inner 'GIMPLE_BIND' (via 'inner_sequence' being a 'typedef gimple *gimple_seq'), in fact examine all statements contained therein, which I suppose must've been the intention here. This "fixes" the testcase 'c-c++-common/goacc/kernels-decompose-ice-2.c' (which now runs into the same ICE as 'c-c++-common/goacc/kernels-decompose-ice-1.c', etc.). gcc/ * omp-oacc-kernels-decompose.cc (flatten_binds): Don't choke on empty GIMPLE sequence, and examine all statements contained in inner 'GIMPLE_BIND'. gcc/testsuite/ * c-c++-common/goacc/kernels-decompose-ice-1.c: Adjust. * c-c++-common/goacc/kernels-decompose-ice-2.c: Likewise.
2020-11-27tree-optimization/98024 - fix rnflow regressionRichard Biener1-2/+4
The change to make PRE insertion iterate less had a typo in checking successors RPO state. Fixing this exposes that regular PRE insertion when facing a value that is the same on all edges inserts an assignment in place of a PHI node but fails to set up things so that this insertion is not repeated (it correctly does not return 'new_stuff'). But with the new iteration scheme this causes us to repeatedly insert such assignment and change AVAIL_OUT over to the newly inserted expression. The fix is to treat this as PHI and insert into PHI_GEN, avoiding repetitive insertion. 2020-11-27 Richard Biener <rguenther@suse.de> PR tree-optimization/98024 * tree-ssa-pre.c (insert): Fix successor RPO order check. (do_pre_regular_insertion): When inserting an assignment in place of an all-same-value PHI still record that into PHI_GEN.
2020-11-27gfortran.dg/gomp/requires-4.f90: Fix !$omp clauseTobias Burnus1-1/+1
gcc/testsuite/ * gfortran.dg/gomp/requires-4.f90: Fix typo in '!$omp' clause.
2020-11-27gfortran.dg/gomp/requires-4.f90: Fix !$omp syntaxTobias Burnus1-2/+2
gcc/testsuite/ * gfortran.dg/gomp/requires-4.f90: Fix '!$omp' syntax.
2020-11-27tree-ssanames: Allow non-SSA_NAME arguments to get_range_infoJakub Jelinek4-76/+56
My recent match.pd change required quite a lot of code due to the separate need to handle INTEGER_CSTs and SSA_NAMEs, and after all, I didn't even handle one case there, when in x * y / y the x is INTEGER_CST and y is SSA_NAME. The following patch allows to simplify it, by allowing non-SSA_NAME argument to get_range_info, for INTEGER_CSTs it will return VR_RANGE with *min == *max equal to the constnat, and for non-INTEGER_CST/SSA_NAMEs it will just return VR_VARYING. This allows not to simplify just the match.pd, but some other spots too. 2020-11-27 Jakub Jelinek <jakub@redhat.com> * tree-ssanames.c (get_range_info): Handle INTEGER_CST by returning VR_RANGE with both *min and *max set to the wide_int value of the INTEGER_CST. Return VR_VARYING for non-SSA_NAMEs. * match.pd ((t * 2) / 2) -> t): Handle also @0 being INTEGER_CST. Simplify by calling get_range_info on everything. * tree-ssa-strlen.c (maybe_diag_stxncpy_trunc): Simplify by calling get_range_info on everything. * tree-scalar-evolution.c (iv_can_overflow_p): Likewise.
2020-11-27gimple-fold: Fix another __builtin_clear_padding ICEJakub Jelinek2-0/+26
When playing with __builtin_bit_cast, I have noticed __builtin_clear_padding ICE on the G class below. The artificial field with D type has offset 0 and size 8 bytes, but the following artificial field with E type has offset 0 and size 0, so it triggers the asserts that we don't move current position backwards. Fixed by ignoring is_empty_type (TREE_TYPE (field)) fields, all of their bits are padding which is what is added when skipping over to next field anyway. 2020-11-27 Jakub Jelinek <jakub@redhat.com> PR libstdc++/88101 * gimple-fold.c (clear_padding_type): Ignore fields with is_empty_type types. * g++.dg/torture/builtin-clear-padding-3.C: New test.
2020-11-27OpenACC: Fix integer-type issue with collapse/tile [PR97880]Tobias Burnus2-13/+25
gcc/ChangeLog: PR c/97880 * omp-expand.c (expand_oacc_collapse_init, expand_oacc_collapse_vars): Use now passed diff_type. (expand_oacc_for): Take largest type for diff_type, taking tiling and collapsing into account. gcc/testsuite/ChangeLog: PR c/97880 * gcc.dg/goacc/tile-1.c: New test.
2020-11-27aarch64: Introduce --param=aarch64-autovec-preference to select autovec ↵Kyrylo Tkachov3-6/+91
preference in backend This is a patch that introduces the aarch64-autovec-preference that can take values from 0 - 4, 0 being the default. It can be used to override the autovectorisation preferences in the backend: 0 - use default scheme 1 - only use Advanced SIMD 2 - only use SVE 3 - use Advanced SIMD and SVE, prefer Advanced SIMD in the event of a tie (as determined by costs) 4 - use Advanced SIMD and SVE, prefer SVE in the event of a tie (as determined by costs) It can valuable for experimentation when comparing SVE and Advanced SIMD autovectorisation strategies. It achieves this adjusting the order of the interleaved SVE and Advanced SIMD modes in aarch64_autovectorize_vector_modes. It also adjusts aarch64_preferred_simd_mode to use the new comparison function to pick Advanced SIMD or SVE to start with. Bootstrapped and tested on aarch64-none-linux-gnu. gcc/ * config/aarch64/aarch64.opt (-param=aarch64-autovec-preference): Define. * config/aarch64/aarch64.c (aarch64_override_options_internal): Set aarch64_sve_compare_costs to 0 when preferring only Advanced SIMD. (aarch64_cmp_autovec_modes): Define. (aarch64_preferred_simd_mode): Adjust to use the above. (aarch64_autovectorize_vector_modes): Likewise. * doc/invoke.texi: Document aarch64-autovec-preference param.
2020-11-27[Ada] Small tweaks to couple of Value routinesEric Botcazou2-9/+14
gcc/ada/ * libgnat/s-valuef.adb (Integer_To_Fixed): Take into account the extra digit when scaling up the input. * libgnat/s-valuer.adb (Scan_Decimal_Digits): Restrict previous change to fixed-point types. (Scan_Integral_Digits): Likewise.
2020-11-27[Ada] Simplify Parent_Is_Boolean with subtype membershipsPiotr Trojanek1-26/+8
gcc/ada/ * sem_res.adb (Parent_Is_Boolean): Simplify. (Resolve_Op_Not): Reduce scope of a local variable.
2020-11-27[Ada] Reuse Append_New_Elmt where possiblePiotr Trojanek2-15/+3
gcc/ada/ * cstand.adb: Simplify with Append_New_Elmt. * sem_util.adb: Likewise.
2020-11-27[Ada] Wrong compile time evaluation of Shift_RightArnaud Charlet1-6/+23
gcc/ada/ * sem_eval.adb (Fold_Shift): Fix evaluation of Shift_Right on negative values.
2020-11-27[Ada] Reference before declaration on C392015Arnaud Charlet1-1/+2
gcc/ada/ * exp_ch6.adb (Expand_Call): Properly split Transform_Function_Array and Modify_Tree_For_C.
2020-11-27[Ada] Restore access type instead of mode out parameterPiotr Trojanek3-24/+24
gcc/ada/ * sem_eval.ads (Compile_Time_Compare): Restore parameter Diff to be of an access type. * sem_eval.adb (Compile_Time_Compare): Adapt body and callers. * sem_attr.adb (Eval_Attribute): Adapt callers.
2020-11-27[Ada] Small improvement to System.Value_R.Scan_Raw_RealEric Botcazou1-6/+40
gcc/ada/ * libgnat/s-valuer.adb (Scan_Decimal_Digits): Round Extra. (Scan_Integral_Digits): Likewise.
2020-11-27[Ada] Do not apply range checks inside generics in GNATprove modeYannick Moy1-3/+3
gcc/ada/ * checks.adb (Selected_Range_Checks): Adapt the condition for applying range checks so that it is not done inside generics.
2020-11-27[Ada] Do not use 128-bit division for 64-bit fixed-point typesEric Botcazou1-22/+38
gcc/ada/ * exp_fixd.adb (Build_Double_Divide): Only use a 128-bit division if one of the operands is larger than 64 bits. (Build_Double_Divide_Code): Likewise. (Build_Scaled_Divide): Likewise. (Build_Scaled_Divide_Code): Likewise.
2020-11-27[Ada] To_GM_Time returning invalid value for Invalid_TimeArnaud Charlet1-1/+24
gcc/ada/ * libgnat/s-os_lib.adb (To_GM_Time): Return valid and consistent values for Invalid_Time.
2020-11-27[Ada] Implement AI12-0187 (Stable properties of abstract data types)Steve Baird8-39/+777
gcc/ada/ * snames.ads-tmpl: Define new Name_Stable_Properties Name_Id value. * aspects.ads, aspects.adb: Add new Aspect_Stable_Properties enumeration literal to Aspect_Id type. Add Class_Present parameter to Find_Aspect and related functions (Find_Value_Of_Aspect and Has_Aspect). * sem_util.adb (Has_Nontrivial_Precondition): Fix previously-latent bug uncovered by adding Class_Present parameter to Aspect.Find_Aspect. The code was wrong before, but with the change the bug was more likely to make a user-visible difference. * sem_ch6.adb (Analyze_Operator_Symbol): If a string literal like "abs" or "-" occurs in a Stable_Properties aspect specification, then it is to be interpreted as an operator symbol and not as a string literal. * sem_ch13.ads: Export new Parse_Aspect_Stable_Properties function, analogous to the existing Parse_Aspect_Aggregate exported procedure. * sem_ch13.adb: (Parse_Aspect_Stable_Properties): New function; analogous to existing Parse_Aspect_Aggregate. (Validate_Aspect_Stable_Properties): New procedure; analogous to existing Validate_Aspect_Aggregate. Called from the same case statement (casing on an Aspect_Id value) where Validate_Aspect_Aggregate is called. (Resolve_Aspect_Stable_Properties): New procedure; analogous to existing Resolve_Aspect_Aggregate. Called from the same two case statements (each casing on an Aspect_Id value) where Resolve_Aspect_Aggregate is called. (Analyze_Aspect_Specifications): Set Has_Delayed_Aspects and Is_Delayed_Aspect attributes for Aspect_Stable_Properties aspect specifications. (Check_Aspect_At_End_Of_Declarations): The syntactic "expression" for a Stable_Properties aspect specification is not semantically an expression; it doesn't have a type. Thus, force T to be empty in this case. * contracts.adb (Expand_Subprogram_Contract): Add call to new local procedure, Expand_Subprogram_Contract.Add_Stable_Property_Contracts, which generates Postcondition pragmas corresponding to stable property checks.