aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2021-01-20Fix gfortran.dg/gomp/task-detach-1.f90 for non 64bit pointersTobias Burnus1-1/+1
gcc/testsuite/ChangeLog: PR fortran/98763 * gfortran.dg/gomp/task-detach-1.f90: Use integer(1) to avoid missing diagnostic issues with c_intptr_t == default integer kind.
2021-01-20builtins: Fix up two bugs in access_ref::inform_access [PR98721]Jakub Jelinek3-11/+36
The following patch fixes two bugs in the access_ref::inform_access function (plus some formatting nits). The first problem is that ref can be various things, e.g. *_DECL, or SSA_NAME, or IDENTIFIER_NODE. And allocfn is non-NULL only if ref is (at least originally) an SSA_NAME initialized to the result of some allocator function (but not e.g. __builtin_alloca_with_align which is handled differently). A few lines above the last hunk of this patch in builtins.c, the code uses if (mode == access_read_write || mode == access_write_only) { if (allocfn == NULL_TREE) { if (*offstr) inform (loc, "at offset %s into destination object %qE of size %s", offstr, ref, sizestr); else inform (loc, "destination object %qE of size %s", ref, sizestr); return; } if (*offstr) inform (loc, "at offset %s into destination object of size %s " "allocated by %qE", offstr, sizestr, allocfn); else inform (loc, "destination object of size %s allocated by %qE", sizestr, allocfn); return; } so if allocfn is NULL, it prints whatever ref is, if it is non-NULL, it prints instead the allocation function. But strangely the hunk a few lines below wasn't consistent with that and instead printed the first form only if DECL_P (ref) and would ICE if ref wasn't a decl but still allocfn was NULL. Fixed by making it consistent what the code does earlier. Another bug is that the code earlier contains an ugly hack for VLAs and was assuming that SSA_NAME_IDENTIFIER must be non-NULL on the lhs of __builtin_alloca_with_align. While that is likely true for the cases where the compiler emits this builtin for VLAs (and it will also be true that the name of the VLA in that case can be taken from that identifier up to the first .), the builtin is user accessible as the testcase shows, so one can have any other SSA_NAME in there. I think it would be better to add some more reliable way how to identify VLA names corresponding to __builtin_alloca_with_align allocations, perhaps internal fn or whatever, but that is beyond the scope of this patch. 2021-01-20 Jakub Jelinek <jakub@redhat.com> PR tree-optimization/98721 * builtins.c (access_ref::inform_access): Don't assume SSA_NAME_IDENTIFIER must be non-NULL. Print messages about object whenever allocfn is NULL, rather than only when DECL_P is true. Use %qE instead of %qD for that. Formatting fixes. * gcc.dg/pr98721-1.c: New test. * gcc.dg/pr98721-2.c: New test.
2021-01-20tree-optimization/98758 - fix integer arithmetic in data-ref analysisRichard Biener2-6/+19
This fixes some int arithmetic issues and a bogus truncation. 2021-01-20 Richard Biener <rguenther@suse.de> PR tree-optimization/98758 * tree-data-ref.c (int_divides_p): Use lambda_int arguments. (lambda_matrix_right_hermite): Avoid undefinedness with signed integer abs and multiplication. (analyze_subscript_affine_affine): Use lambda_int. * gcc.dg/torture/pr98758.c: New testcase.
2021-01-20openmp: Don't ICE on detach clause with erroneous decl [PR98742]Jakub Jelinek2-0/+15
Similarly to how we handle erroneous operands to e.g. allocate clause, this change just removes those clauses instead of accessing TYPE_MAIN_VARIANT of its type, which doesn't work on error_mark_node. Also, just for good measure, bails out if TYPE_NAME is NULL. 2021-01-20 Jakub Jelinek <jakub@redhat.com> PR c++/98742 * semantics.c (finish_omp_clauses) <case OMP_CLAUSE_DETACH>: If error_operand_p, remove clause without further checking. Check for non-NULL TYPE_NAME. * c-c++-common/gomp/task-detach-2.c: New test.
2021-01-20OpenMP/Fortran: Fix gfortran.dg/gomp/is_device_ptr-2.f90Tobias Burnus1-1/+1
gcc/testsuite/ChangeLog: PR fortran/98757 PR fortran/98476 * gfortran.dg/gomp/is_device_ptr-2.f90: Fix dg-error.
2021-01-19dwarf2out: reset generation count in toplev::finalize [PR98751]David Malcolm1-26/+40
PR debug/98751 reports an issue in which most of libgccjit's tests fails in DWARF 5 handling with `.Ldebug_loc2' is already defined" asm errors. The bogus label is being emitted at the 3rd in-process iteration, at: 31673 ASM_OUTPUT_LABEL (asm_out_file, loc_section_label); which on the initial iteration emits: 145 │ .Ldebug_loc0: on the 2nd iteration: 145 │ .Ldebug_loc1: and on the 3rd iteration: 145 │ .Ldebug_loc2: which is a duplicate of a label emitted earlier: 138 │ .section .debug_loclists,"",@progbits 139 │ .long .Ldebug_loc3-.Ldebug_loc2 140 │ .Ldebug_loc2: 141 │ .value 0x5 142 │ .byte 0x8 143 │ .byte 0 144 │ .long 0 145 │ .Ldebug_loc2: The issue seems to be that init_sections_and_labels creates the label ASM_GENERATE_INTERNAL_LABEL (loc_section_label, DEBUG_LOC_SECTION_LABEL, generation); where "generation" is a static local to init_sections_and_labels that increments, and thus eventually hits the duplicate value. It appears that this value is intended to be either 0 or 1, but in the libgccjit case the compilation code can be invoked an arbitrary number of times in-process, and hence can eventually lead to a label name collision. This patch adds code to dwarf2out_c_finalize (called by toplev::finalize in libgccjit) to reset the generation counts, fixing the issue. gcc/ChangeLog: PR debug/98751 * dwarf2out.c (output_line_info): Rename static variable "generation", moving it out of the function to... (output_line_info_generation): New. (init_sections_and_labels): Likewise, renaming the variable to... (init_sections_and_labels_generation): New. (dwarf2out_c_finalize): Reset the new variables.
2021-01-20Daily bump.GCC Administrator8-1/+273
2021-01-19testsuite: aix testsuite adjustmentsDavid Edelsohn6-10/+8
This patch re-enables the DWARF5 tests that seem to be functioning again. It adds a comment to pr41445-7.c that any changes in lines need to be reflected in the expected output. The patch also allows for additional failures in ucs.c and reflects that builtin-sprintf-warn-20.c requires 4 byte wide char support. gcc/testsuite/ChangeLog: * gcc.dg/cpp/ucs.c: Expect Invalid warning for 2byte wchar. * gcc.dg/debug/dwarf2/inline6.c: Remove skip AIX. * gcc.dg/debug/dwarf2/lang-c11.c: Remove skip AIX. * gcc.dg/debug/dwarf2/pr41445-7.c: Remove skip AIX. * gcc.dg/debug/dwarf2/pr41445-8.c: Remove skip AIX. * gcc.dg/tree-ssa/builtin-sprintf-warn-20.c: Require 4byte wchar.
2021-01-19Update gcc de.po.Joseph Myers1-12/+11
* de.po: Update.
2021-01-19c++: Crash when deducing template arguments [PR98659]Marek Polacek2-4/+26
maybe_instantiate_noexcept doesn't expect to see error_mark_node, but the new callsite I introduced in r11-6476 can pass error_mark_node to it. So cope. gcc/cp/ChangeLog: PR c++/98659 * pt.c (maybe_instantiate_noexcept): Return false if FN is error_mark_node. gcc/testsuite/ChangeLog: PR c++/98659 * g++.dg/template/deduce8.C: New test.
2021-01-19compiler: initialize variables with go:embed directivesIan Lance Taylor4-2/+347
This completes the compiler work for go:embed. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/281536
2021-01-19c++: ICE with USING_DECL redeclaration [PR98687]Marek Polacek5-49/+145
My recent patch that introduced push_using_decl_bindings didn't handle USING_DECL redeclaration, therefore things broke. This patch amends that by breaking out a part of finish_nonmember_using_decl out to a separate function, push_using_decl_bindings, and calling it. It needs an overload, because name_lookup is only available inside of name-lookup.c. gcc/cp/ChangeLog: PR c++/98687 * name-lookup.c (push_using_decl_bindings): New, broken out of... (finish_nonmember_using_decl): ...here. * name-lookup.h (push_using_decl_bindings): Update declaration. * pt.c (tsubst_expr): Update the call to push_using_decl_bindings. gcc/testsuite/ChangeLog: PR c++/98687 * g++.dg/lookup/using64.C: New test. * g++.dg/lookup/using65.C: New test.
2021-01-19PR middle-end/98664 - inconsistent -Wfree-nonheap-object for inlined calls ↵Martin Sebor6-18/+255
to system headers gcc/ChangeLog: PR middle-end/98664 * tree-ssa-live.c (remove_unused_scope_block_p): Keep scopes for all functions, even if they're not declared artificial or inline. * tree.c (tree_inlined_location): Use macro expansion location only if scope traversal fails to expose one. gcc/testsuite/ChangeLog: PR middle-end/98664 * gcc.dg/Wvla-larger-than-4.c: Adjust expected output. * gcc.dg/plugin/diagnostic-test-inlining-3.c: Same. * g++.dg/warn/Wfree-nonheap-object-5.C: New test. * gcc.dg/Wfree-nonheap-object-4.c: New test.
2021-01-19c++: Always check access during late-parsing of members [PR58993]Patrick Palka6-7/+69
This patch removes a vestigial use of dk_no_check from cp_parser_late_parsing_for_member, which ideally should have been removed as part of the PR41437 patch that improved access checking inside templates. This allows us to correctly reject f1 and f2 in the testcase access34.C below (whereas before we'd only reject f3). Additional testing revealed a new access issue when late-parsing a hidden friend within a class template. In the testcase friend68.C below, we're tripping over the checking assert from friend_accessible_p(f, S::j, S, S) during lookup of j in x.j (for which type_dependent_object_expression_p returns false, which is why we're doing the lookup at parse time). The reason for the assert failure is that DECL_FRIENDLIST(S) contains f but DECL_BEFRIENDING_CLASSES(f) is empty, and so friend_accessible_p (which looks at DECL_BEFRIENDING_CLASSES) wants to return false, but is_friend (which looks at DECL_FRIENDLIST) returns true. For sake of symmetry one would expect that DECL_BEFRIENDING_CLASSES(f) contains S, but add_friend avoids updating DECL_BEFRIENDING_CLASSES when the class type (S in this case) is dependent, for some reason. This patch works around this issue by making friend_accessible_p consider the DECL_FRIEND_CONTEXT of the access scope. Thus we sidestep the DECL_BEFRIENDING_CLASSES / DECL_FRIENDLIST asymmetry issue while correctly validating the x.j access at parse time. A earlier version of this patch checked friend_accessible_p instead of protected_accessible_p in the DECL_FRIEND_CONTEXT hunk below, but this had the side effect of making us accept the ill-formed testcase friend69.C below (ill-formed because the hidden friend g is not actually a member of A, so g doesn't have access to B's members despite B befriending A). gcc/cp/ChangeLog: PR c++/41437 PR c++/58993 * search.c (friend_accessible_p): If scope is a hidden friend defined inside a dependent class, consider access from the class. * parser.c (cp_parser_late_parsing_for_member): Don't push a dk_no_check access state. gcc/testsuite/ChangeLog: PR c++/41437 PR c++/58993 * g++.dg/opt/pr87974.C: Adjust. * g++.dg/template/access34.C: New test. * g++.dg/template/friend68.C: New test. * g++.dg/template/friend69.C: New test.
2021-01-19c++: ICE when late parsing noexcept/NSDMI [PR98333]Marek Polacek2-23/+31
Since certain members of a class are a complete-class context [class.mem.general]p7, we delay their parsing untile the whole class has been parsed. For instance, NSDMIs and noexcept-specifiers. The order in which we perform this delayed parsing matters; we were first parsing NSDMIs and only they did we parse noexcept-specifiers. That turns out to be wrong: since NSDMIs may use noexcept-specifiers, we must process noexcept-specifiers first. Otherwise we'll ICE in code that doesn't expect to see DEFERRED_PARSE. This doesn't just shift the problem, noexcept-specifiers can use members with a NSDMI just fine, and I've also tested a similar test with this member function: bool f() { return __has_nothrow_constructor (S<true>); } and that compiled fine too. gcc/cp/ChangeLog: PR c++/98333 * parser.c (cp_parser_class_specifier_1): Perform late-parsing of NSDMIs before late-parsing of noexcept-specifiers. gcc/testsuite/ChangeLog: PR c++/98333 * g++.dg/cpp0x/noexcept62.C: New test.
2021-01-19c++: Remove unused fnNathan Sidwell1-6/+3
I had two overloads of a function, but only one was needed. Let's keep the constant one. gcc/cp/ * module.cc (identifier): Merge overloads.
2021-01-19c++: Fix null this pointer [PR 98624]Nathan Sidwell1-1/+1
There's no need for this function to have an object, so make it static and avoid UB. PR c++/98624 gcc/cp/ * module.cc (trees_out::write_location): Make static.
2021-01-19alias: Fix offset checks involving section anchors [PR92294]Richard Sandiford1-16/+31
memrefs_conflict_p assumes that: [XB + XO, XB + XO + XS) does not alias [YB + YO, YB + YO + YS) whenever: [XO, XO + XS) does not intersect [YO, YO + YS) In other words, the accesses can alias only if XB == YB at runtime. However, this doesn't cope correctly with section anchors. For example, if XB is an anchor symbol and YB is at offset XO from the anchor, then: [XB + XO, XB + XO + XS) overlaps [YB, YB + YS) whatever the value of XO is. In other words, when doing the alias check for two symbols whose local definitions are in the same block, we should apply the known difference between their block offsets to the intersection test above. gcc/ PR rtl-optimization/92294 * alias.c (compare_base_symbol_refs): Take an extra parameter and add the distance between two symbols to it. Enshrine in comments that -1 means "either 0 or 1, but we can't tell which at compile time". (memrefs_conflict_p): Update call accordingly. (rtx_equal_for_memref_p): Likewise. Take the distance between symbols into account.
2021-01-19[PATCH, rs6000] Update pr88233.c test (pr91799)Will Schmidt1-1/+1
Hi, This is a follow-up fix to clean up pr91799. Per review of test results, it appears that the combination of target and dg-require stanzas is not sufficient to properly limit the test to 64-bit only on darwin. This adds an additional dg-require clause to limit the test to 64-bit environments. Tested on power7 and power8 using assorted variations of make -k check-gcc-c "RUNTESTFLAGS=powerpc.exp=pr88233.c --target_board=unix/'{-mcpu=power7,-mcpu=power6,-mcpu=power8}''{-m32,-m64}'" PR target/91799 2021-01-19 Will Schmidt <will_schmidt@vnet.ibm.com> gcc/testsuite/ChangeLog: * gcc.target/powerpc/pr88233.c: Update dg- stanzas.
2021-01-19aarch64: Relax flags of saturation builtinsKyrylo Tkachov1-63/+63
This patch relaxes the flags for the saturating arithmetic builtins to NONE, allowing for more optimisation. gcc/ChangeLog * config/aarch64/aarch64-simd-builtins.def (sqshl, uqshl, sqrshl, uqrshl, sqadd, uqadd, sqsub, uqsub, suqadd, usqadd, sqmovn, uqmovn, sqxtn2, uqxtn2, sqabs, sqneg, sqdmlal, sqdmlsl, sqdmlal_lane, sqdmlsl_lane, sqdmlal_laneq, sqdmlsl_laneq, sqdmlal_n, sqdmlsl_n, sqdmlal2, sqdmlsl2, sqdmlal2_lane, sqdmlsl2_lane, sqdmlal2_laneq, sqdmlsl2_laneq, sqdmlal2_n, sqdmlsl2_n, sqdmull, sqdmull_lane, sqdmull_laneq, sqdmull_n, sqdmull2, sqdmull2_lane, sqdmull2_laneq, sqdmull2_n, sqdmulh, sqrdmulh, sqdmulh_lane, sqdmulh_laneq, sqrdmulh_lane, sqrdmulh_laneq, sqshrun_n, sqrshrun_n, sqshrn_n, uqshrn_n, sqrshrn_n, uqrshrn_n, sqshlu_n, sqshl_n, uqshl_n, sqrdmlah, sqrdmlsh, sqrdmlah_lane, sqrdmlsh_lane, sqrdmlah_laneq, sqrdmlsh_laneq, sqmovun): Use NONE flags.
2021-01-19aarch64: Remove testing of saturation cumulative QC bitKyrylo Tkachov41-1786/+753
Since we don't guarantee the ordering of the QC flag in FPSR in the saturation intrinsics, we shouldn't be testing for it. I want to relax the flags for some of the builtins to enable more optimisation but that triggers the QC flag tests in advsimd-intrinsics.exp. We don't implement the saturation flag access intrinsics in aarch64 anyway and we don't want to. gcc/testsuite/ChangeLog: * gcc.target/aarch64/advsimd-intrinsics/arm-neon-ref.h (CHECK_CUMULATIVE_SAT): Delete. (CHECK_CUMULATIVE_SAT_NAMED): Likewise. Deleted related variables. * gcc.target/aarch64/advsimd-intrinsics/binary_sat_op.inc: Remove uses of the above. * gcc.target/aarch64/advsimd-intrinsics/unary_sat_op.inc: Likewise. * gcc.target/aarch64/advsimd-intrinsics/vqabs.c: Likewise. * gcc.target/aarch64/advsimd-intrinsics/vqadd.c: Likewise. * gcc.target/aarch64/advsimd-intrinsics/vqdmlXl.inc: Likewise. * gcc.target/aarch64/advsimd-intrinsics/vqdmlXl_lane.inc: Likewise. * gcc.target/aarch64/advsimd-intrinsics/vqdmlXl_n.inc: Likewise. * gcc.target/aarch64/advsimd-intrinsics/vqdmlal.c: Likewise. * gcc.target/aarch64/advsimd-intrinsics/vqdmlal_lane.c: Likewise. * gcc.target/aarch64/advsimd-intrinsics/vqdmlal_n.c: Likewise. * gcc.target/aarch64/advsimd-intrinsics/vqdmlsl.c: Likewise. * gcc.target/aarch64/advsimd-intrinsics/vqdmlsl_lane.c: Likewise. * gcc.target/aarch64/advsimd-intrinsics/vqdmlsl_n.c: Likewise. * gcc.target/aarch64/advsimd-intrinsics/vqdmulh.c: Likewise. * gcc.target/aarch64/advsimd-intrinsics/vqdmulh_lane.c: Likewise. * gcc.target/aarch64/advsimd-intrinsics/vqdmulh_n.c: Likewise. * gcc.target/aarch64/advsimd-intrinsics/vqdmull.c: Likewise. * gcc.target/aarch64/advsimd-intrinsics/vqdmull_lane.c: Likewise. * gcc.target/aarch64/advsimd-intrinsics/vqdmull_n.c: Likewise. * gcc.target/aarch64/advsimd-intrinsics/vqmovn.c: Likewise. * gcc.target/aarch64/advsimd-intrinsics/vqmovun.c: Likewise. * gcc.target/aarch64/advsimd-intrinsics/vqneg.c: Likewise. * gcc.target/aarch64/advsimd-intrinsics/vqrdmlXh.inc: Likewise. * gcc.target/aarch64/advsimd-intrinsics/vqrdmlXh_lane.inc: Likewise. * gcc.target/aarch64/advsimd-intrinsics/vqrdmlah.c: Likewise. * gcc.target/aarch64/advsimd-intrinsics/vqrdmlah_lane.c: Likewise. * gcc.target/aarch64/advsimd-intrinsics/vqrdmlsh.c: Likewise. * gcc.target/aarch64/advsimd-intrinsics/vqrdmlsh_lane.c: Likewise. * gcc.target/aarch64/advsimd-intrinsics/vqrdmulh.c: Likewise. * gcc.target/aarch64/advsimd-intrinsics/vqrdmulh_lane.c: Likewise. * gcc.target/aarch64/advsimd-intrinsics/vqrdmulh_n.c: Likewise. * gcc.target/aarch64/advsimd-intrinsics/vqrshl.c: Likewise. * gcc.target/aarch64/advsimd-intrinsics/vqrshrn_n.c: Likewise. * gcc.target/aarch64/advsimd-intrinsics/vqrshrun_n.c: Likewise. * gcc.target/aarch64/advsimd-intrinsics/vqshl.c: Likewise. * gcc.target/aarch64/advsimd-intrinsics/vqshl_n.c: Likewise. * gcc.target/aarch64/advsimd-intrinsics/vqshlu_n.c: Likewise. * gcc.target/aarch64/advsimd-intrinsics/vqshrn_n.c: Likewise. * gcc.target/aarch64/advsimd-intrinsics/vqshrun_n.c: Likewise. * gcc.target/aarch64/advsimd-intrinsics/vqsub.c: Likewise.
2021-01-19[committed] Fix dwarf-float.c test in testsuiteJeff Law1-5/+5
gcc/testsuite * gcc.dg/debug/dwarf2/dwarf-float.c: Force dwarf-4 generation and update expected output.
2021-01-19ipa/98330 - avoid ICEing on call indirect callRichard Biener3-5/+21
The following avoids ICEing on a indirect calls with a fnspec in modref analysis. 2021-01-19 Richard Biener <rguenther@suse.de> PR ipa/98330 * ipa-modref.c (analyze_stmt): Only record a summary for a direct call. * g++.dg/pr98330.C: New testcase. * gcc.dg/pr98330.c: Likewise.
2021-01-19middle-end/98638 - avoid SSA reference to stmts after SSA deconstructionRichard Biener1-0/+8
Since SSA names do leak into global tree data structures like TYPE_SIZE or in this case GFC_DECL_SAVED_DESCRIPTOR because of frontend bugs we have to be careful to wipe references to the CFG when we deconstruct SSA form because we now do ggc_free that. 2021-01-19 Richard Biener <rguenther@suse.de> PR middle-end/98638 * tree-ssanames.c (fini_ssanames): Zero SSA_NAME_DEF_STMT.
2021-01-19sparc,rtems: add __FIX_LEON3FT_TN0018 for affected targetsDaniel Hellstrom1-0/+2
Enable a define FIX_LEON3FT_TN0018 for the LEON3FT targets affected by the GRLIB-TN-0018 errata described here: https://www.gaisler.com/notes gcc/ * config/sparc/rtemself.h (TARGET_OS_CPP_BUILTINS): Add built-in define __FIX_LEON3FT_TN0018.
2021-01-19ipa/97673 - fix input_location leakRichard Biener2-0/+21
This fixes input_location leaking with an invalid BLOCK from expand_call_inline to tree_function_versioning via clone materialization. 2021-01-19 Richard Biener <rguenther@suse.de> PR ipa/97673 * tree-inline.c (tree_function_versioning): Set input_location to UNKNOWN_LOCATION throughout the function. * gfortran.dg/pr97673.f90: New testcase.
2021-01-19OpenMP/Fortran: Fixes for {use,is}_device_ptrTobias Burnus6-23/+160
gcc/fortran/ChangeLog: PR fortran/98476 * openmp.c (resolve_omp_clauses): Change use_device_ptr to use_device_addr for unless type(c_ptr); check all list item for is_device_ptr. gcc/ChangeLog: PR fortran/98476 * omp-low.c (lower_omp_target): Handle nonpointer is_device_ptr. libgomp/ChangeLog: PR fortran/98476 * testsuite/libgomp.fortran/is_device_ptr-1.f90: New test. gcc/testsuite/ChangeLog: PR fortran/98476 * gfortran.dg/gomp/map-3.f90: Update expected scan-dump-tree. * gfortran.dg/gomp/is_device_ptr-2.f90: New test. * gfortran.dg/gomp/use_device_ptr-1.f90: New test.
2021-01-19ipa-sra: Do not remove return values needed because of non-call EHMartin Jambor2-9/+38
IPA-SRA already contains a check to figure out that an otherwise dead parameter is actually required because of non-call exceptions, but it is not present at the equivalent spot where SRA figures out whether the return statement is used for anything useful. This patch adds that condition there. Unfortunately, even though this patch should be good enough for any normal (I'd even say reasonable) use of the compiler, it hints that when the user manually switches all sorts of DCE, IPA-SRA would probably leave behind problematic statements manipulating what originally were return values, just like it does for parameters (PR 93385). Fixing this properly might unfortunately be a separate issue from the mentioned bug because the LHS of a call is changed during call redirection and the caller often is not a clone. But I'll see what I can do. Meanwhile, the patch below has been bootstrapped and tested on x86_64. gcc/ChangeLog: 2021-01-18 Martin Jambor <mjambor@suse.cz> PR ipa/98690 * ipa-sra.c (ssa_name_only_returned_p): New parameter fun. Check whether non-call exceptions allow removal of a statement. (isra_analyze_call): Pass the appropriate function to ssa_name_only_returned_p. gcc/testsuite/ChangeLog: 2021-01-18 Martin Jambor <mjambor@suse.cz> PR ipa/98690 * g++.dg/ipa/pr98690.C: New test.
2021-01-19Fix PR ada/98740Eric Botcazou1-5/+6
It's a long-standing GENERIC tree sharing issue. gcc/ada/ChangeLog: PR ada/98740 * gcc-interface/trans.c (add_decl_expr): Always mark TYPE_ADA_SIZE.
2021-01-19RISC-V: The 'multilib-generator' enhancement.Geng Qi2-6/+20
Think about this case: ./multilib-generator rv32imc-ilp32-rv32imac,rv32imacxthead-f Here are 2 problems: 1. A unexpected 'xtheadf' extension was made. 2. The arch 'rv32imac' was not be created. This modification fix these two, and also sorts 'multi-letter'. gcc/ChangeLog: * config/riscv/arch-canonicalize (longext_sort): New function for sorting 'multi-letter'. * config/riscv/multilib-generator: Adjusting the loop of 'alt' in 'alts'. The 'arch' may not be the first of 'alts'. (_expand_combination): Add underline for the 'ext' without '*'. This is because, a single-letter extension can always be treated well with a '_' prefix, but it cannot be separated out if it is appended to a multi-letter.
2021-01-18compiler: read embedcfg files, parse go:embed directivesIan Lance Taylor9-33/+234
This change reads go:embed directives and attaches them to variables. We still don't do anything with the directives. This change also reads the file passed in the -fgo-embedcfg option. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/281533
2021-01-19Daily bump.GCC Administrator7-1/+239
2021-01-18[committed] Minor fix to pr41445-7 testcaseJeff Law1-2/+2
gcc/testsuite * gcc.dg/debug/dwarf2/pr41445-7.c: Fix expected output.
2021-01-18libbacktrace: don't fail tests if dwz failsIan Lance Taylor3-9/+17
* Makefile.am (%_dwz): If dwz fails, use uncompressed debug info. * Makefile.in: Regenerate. * configure: Regenerate.
2021-01-18libbacktrace: use correct directory/filename for DWARF 5Ian Lance Taylor1-31/+33
PR debug/98716 * dwarf.c (read_v2_paths): Allocate zero entry for dirs and filenames. (read_line_program): Remove parameter u, change caller. Don't subtract one from dirs and filenames index. (read_function_entry): Don't subtract one from filenames index.
2021-01-18[PR97847] IRA: Skip abnormal critical edge splittingVladimir N. Makarov1-1/+11
PPC64 can generate jumps with clobbered pseudo-regs and a BB with such jump can have abnormal output edges. IRA hits an assert when trying to split abnormal critical edge to deal with asm goto output reloads later. The patch just skips splitting abnormal edges. It is assumed that asm-goto with output reloads can not be in BB with output abnormal edges. gcc/ChangeLog: PR target/97847 * ira.c (ira): Skip abnormal critical edge splitting.
2021-01-18c++: Add CTAD + pack expansion testcasePatrick Palka1-0/+6
After r11-6614 made cp_walk_subtrees walk into the template of a CTAD placeholder, we now correctly accept the below testcase. We used to reject it because find_parameter_packs_r would fail to find the parameter pack Ts inside the CTAD placeholder within the pack expansion. gcc/testsuite/ChangeLog: * g++.dg/cpp1z/class-deduction77.C: New test.
2021-01-18widening_mul: Fix up signed multiplication overflow check handling [PR98727]Jakub Jelinek2-0/+21
I forgot one line, which means that if the second operand of the multiplication isn't constant, it would be just the same as the first one. 2021-01-18 Jakub Jelinek <jakub@redhat.com> PR tree-optimization/98727 * tree-ssa-math-opts.c (match_arith_overflow): Fix up computation of second .MUL_OVERFLOW operand for signed multiplication with overflow checking if the second operand of multiplication is not constant. * gcc.c-torture/execute/pr98727.c: New test.
2021-01-18aix: document dwarf 4 default (and TPF default)David Edelsohn1-2/+3
gcc/ChangeLog: * doc/invoke.texi (-gdwarf): TPF defaults to version 2 and AIX defaults to version 4.
2021-01-18Skip asm goto tests on hppa*-*-*.John David Anglin2-0/+2
gcc/testsuite/ChangeLog: PR testsuite/97987 * gcc.c-torture/compile/asmgoto-2.c: Skip on hppa. * gcc.c-torture/compile/asmgoto-5.c: Likewise.
2021-01-18Avoid no-stack-protector-attr fails on hppa*-*-*.John David Anglin2-2/+2
gcc/testsuite/ChangeLog: * g++.dg/no-stack-protector-attr-3.C: Don't compile on hppa*-*-*. * g++.dg/no-stack-protector-attr.C: Likewise.
2021-01-18analyzer: use "malloc" attributeDavid Malcolm17-128/+1354
In dce6c58db87ebf7f4477bd3126228e73e4eeee97 msebor extended the "malloc" attribute to support user-defined allocator/deallocator pairs. This patch extends the "malloc" checker within -fanalyzer to use these attributes. It is based on an earlier patch: 'RFC: add "deallocated_by" attribute for use by analyzer' https://gcc.gnu.org/pipermail/gcc-patches/2020-October/555544.html which added a different attribute. The patch needed a lot of reworking to support multiple deallocators per allocator. My hope was that this would provide a minimal level of markup that would support library-checking without requiring lots of further markup. I attempted to use this to detect a memory leak within a Linux driver (CVE-2019-19078), by adding the attribute to mark these fns: extern struct urb *usb_alloc_urb(int iso_packets, gfp_t mem_flags); extern void usb_free_urb(struct urb *urb); where there is a leak of a "urb" on an error-handling path. Unfortunately I ran into the problem that there are various other fns that take "struct urb *" and the analyzer conservatively assumes that a urb passed to them might or might not be freed and thus stops tracking state for them. Hence this will only detect issues for the simplest cases (without adding another attribute). gcc/analyzer/ChangeLog: * analyzer.h (is_std_named_call_p): New decl. * diagnostic-manager.cc (path_builder::get_sm): New. (state_change_event_creator::state_change_event_creator): Add "pb" param. (state_change_event_creator::on_global_state_change): Don't consider state changes affecting other state_machines. (state_change_event_creator::on_state_change): Likewise. (state_change_event_creator::m_pb): New field. (diagnostic_manager::add_events_for_eedge): Pass pb to visitor ctor. * region-model-impl-calls.cc (region_model::impl_deallocation_call): New. * region-model.cc: Include "attribs.h". (region_model::on_call_post): Handle fndecls referenced by __attribute__((deallocated_by(FOO))). * region-model.h (region_model::impl_deallocation_call): New decl. * sm-malloc.cc: Include "stringpool.h" and "attribs.h". Add leading comment. (class api): Delete. (enum resource_state): Update comment for change from api to deallocator and deallocator_set. (allocation_state::allocation_state): Drop api param. Add "deallocators" and "deallocator". (allocation_state::m_api): Drop field in favor of... (allocation_state::m_deallocators): New field. (allocation_state::m_deallocator): New field. (enum wording): Add WORDING_DEALLOCATED. (struct deallocator): New. (struct standard_deallocator): New. (struct custom_deallocator): New. (struct deallocator_set): New. (struct custom_deallocator_set): New. (struct standard_deallocator_set): New. (struct deallocator_set_map_traits): New. (malloc_state_machine::m_malloc): Drop field (malloc_state_machine::m_scalar_new): Likewise. (malloc_state_machine::m_vector_new): Likewise. (malloc_state_machine::m_free): New field (malloc_state_machine::m_scalar_delete): Likewise. (malloc_state_machine::m_vector_delete): Likewise. (malloc_state_machine::deallocator_map_t): New typedef. (malloc_state_machine::m_deallocator_map): New field. (malloc_state_machine::deallocator_set_cache_t): New typedef. (malloc_state_machine::m_custom_deallocator_set_cache): New field. (malloc_state_machine::custom_deallocator_set_map_t): New typedef. (malloc_state_machine::m_custom_deallocator_set_map): New field. (malloc_state_machine::m_dynamic_sets): New field. (malloc_state_machine::m_dynamic_deallocators): New field. (api::api): Delete. (deallocator::deallocator): New ctor. (deallocator::hash): New. (deallocator::dump_to_pp): New. (deallocator::cmp): New. (deallocator::cmp_ptr_ptr): New. (standard_deallocator::standard_deallocator): New ctor. (deallocator_set::deallocator_set): New ctor. (deallocator_set::dump): New. (custom_deallocator_set::custom_deallocator_set): New ctor. (custom_deallocator_set::contains_p): New. (custom_deallocator_set::maybe_get_single): New. (custom_deallocator_set::dump_to_pp): New. (standard_deallocator_set::standard_deallocator_set): New ctor. (standard_deallocator_set::contains_p): New. (standard_deallocator_set::maybe_get_single): New. (standard_deallocator_set::dump_to_pp): New. (start_p): New. (class mismatching_deallocation): Update for conversion from api to deallocator_set and deallocator. (double_free::emit): Use %qs. (class use_after_free): Update for conversion from api to deallocator_set and deallocator. (malloc_leak::describe_state_change): Only emit "allocated here" on a start->nonnull transition, rather than on other transitions to nonnull. (allocation_state::dump_to_pp): Update for conversion from api to deallocator_set. (allocation_state::get_nonnull): Likewise. (malloc_state_machine::malloc_state_machine): Likewise. (malloc_state_machine::~malloc_state_machine): New. (malloc_state_machine::add_state): Update for conversion from api to deallocator_set. (malloc_state_machine::get_or_create_custom_deallocator_set): New. (malloc_state_machine::maybe_create_custom_deallocator_set): New. (malloc_state_machine::get_or_create_deallocator): New. (malloc_state_machine::on_stmt): Update for conversion from api to deallocator_set. Handle "__attribute__((malloc(FOO)))", and the special attribute set on FOO. (malloc_state_machine::on_allocator_call): Update for conversion from api to deallocator_set. Add "returns_nonnull" param and use it to affect which state to transition to. (malloc_state_machine::on_deallocator_call): Update for conversion from api to deallocator_set. gcc/ChangeLog: * attribs.h (fndecl_dealloc_argno): New decl. * builtins.c (call_dealloc_argno): Split out second half of function into... (fndecl_dealloc_argno): New. * doc/extend.texi (Common Function Attributes): Document the interaction between the analyzer and the malloc attribute. * doc/invoke.texi (Static Analyzer Options): Likewise. gcc/testsuite/ChangeLog: * gcc.dg/analyzer/attr-malloc-1.c: New test. * gcc.dg/analyzer/attr-malloc-2.c: New test. * gcc.dg/analyzer/attr-malloc-4.c: New test. * gcc.dg/analyzer/attr-malloc-5.c: New test. * gcc.dg/analyzer/attr-malloc-6.c: New test. * gcc.dg/analyzer/attr-malloc-CVE-2019-19078-usb-leak.c: New test. * gcc.dg/analyzer/attr-malloc-misuses.c: New test.
2021-01-18libstdc++: Only test writing to wostream if supported [PR 98725]Jonathan Wakely1-0/+2
libstdc++-v3/ChangeLog: PR libstdc++/98725 * testsuite/20_util/unique_ptr/io/lwg2948.cc: Do not try to write to a wide character stream if wide character support is disabled in the library.
2021-01-18testsuite/97494 - adjust gcc.dg/vect/slp-11b.cRichard Biener1-7/+5
Support for loop SLP splitting exposed that slp-11b.c has folding that breaks SLP discovery which isn't what was intended when the testcase was written. The following makes it SLP-able and "only" run into the issue that a load permutation is required. And tries to adjust the target selectors accordingly. 2021-01-18 Richard Biener <rguenther@suse.de> PR testsuite/97494 * gcc.dg/vect/slp-11b.c: Adjust.
2021-01-18libgomp: enable linux-futex on riscv64Andreas Schwab1-0/+4
Regtested on riscv64-suse-linux. libgomp/ * configure.tgt (riscv64*-*-linux*): Add linux to config_path.
2021-01-18[arm,testsuite]: Fix options for vceqz_p64.c and vceqzq_p64.cChristophe Lyon2-2/+4
These two tests need: dg-require-effective-target arm_crypto_ok dg-add-options arm_crypto because they use intrinsics that need -mfpu=crypto-neon-fp-armv8. 2021-01-18 Christophe Lyon <christophe.lyon@linaro.org> gcc/testsuite/ PR target/71233 * gcc.target/arm/simd/vceqz_p64.c: Use arm_crypto options. * gcc.target/arm/simd/vceqzq_p64.c: Likewise.
2021-01-18testsuite/97299 - fix test condition of gcc.dg/vect/slp-reduc-3.cRichard Biener1-1/+2
This avoids looking for permute optimization when SLP cannot be applied. 2021-01-18 Richard Biener <rguenther@suse.de> PR testsuite/97299 * gcc.dg/vect/slp-reduc-3.c: Guard VEC_PERM_EXPR scan.
2021-01-18libstdc++: Fix narrow char test to use stringbuf not wstringbufJonathan Wakely1-1/+1
This seems to be a copy & paste error. libstdc++-v3/ChangeLog: * testsuite/27_io/basic_stringstream/cons/char/1.cc: Use stringbuf not wstringbuf.
2021-01-18libstd++: : Add workaround for as Error: file number less than one error ↵Jakub Jelinek2-4/+4
[PR98708] As mentioned in the PR, since the switch to DWARF5 by default instead of DWARF4, gcc fails to build when configured against recent binutils. The problem is that cxx11-ios_failure* is built in separate steps, -S compilation (with -g -O2) followed by some sed and followed by -c -g -O2 -g0 assembly. When gcc is configured against recent binutils and DWARF5 is the default, we emit .file 0 "..." directive on which the assembler then fails (unless --gdwarf-5 is passed to it, but we don't want that generally because on the other side older assemblers don't like -g* passed to it when invoked on *.s file with compiler generated debug info. I hope the bug will be fixed soon on the binutils side, but it would be nice to have a workaround. The following patch is one of the possibilities, another one is to do that but add configure check for whether it is needed, essentially echo 'int main () { return 0; }' > conftest.c ${CXX} ${CXXFLAGS} -g -O2 -S conftest.c -o conftest.s ${CXX} ${CXXFLAGS} -g -O2 -g0 -c conftest.s -o conftest.o and if the last command fails, we need that -gno-as-loc-support. Or yet another option would be I think do a different check, whether ${CXX} ${CXXFLAGS} -g -O2 -S conftest.c -o conftest.s ${CXX} ${CXXFLAGS} -g -O2 -c conftest.s -o conftest.o works and if yes, don't add the -g0 to cxx11-ios_failure*.s assembly. 2021-01-18 Jakub Jelinek <jakub@redhat.com> PR debug/98708 * src/c++11/Makefile.am (cxx11-ios_failure-lt.s, cxx11-ios_failure.s): Compile with -gno-as-loc-support. * src/c++11/Makefile.in: Regenerated.
2021-01-18RTEMS: Fix libgomp buildSebastian Huber1-0/+5
libgomp/ * config/rtems/sem.h (gomp_sem_getcount): New function.