aboutsummaryrefslogtreecommitdiff
path: root/gcc
AgeCommit message (Collapse)AuthorFilesLines
2021-03-11compiler: create temporaries for heap variablesIan Lance Taylor6-56/+99
The compiler generally doesn't create a temporary for an expression that is a variable, because it's normally valid to simply reload the value from the variable. However, if the variable is in the heap, then loading the value is a pointer indirection. The process of creating GCC IR can cause the variable load and the pointer indirection to be split, such that the second evaluation only does the pointer indirection. If there are conditionals in between the two uses, this can cause the second use to load the pointer from an uninitialized register. Avoid this by introducing a new Expression method that returns whether it is safe to evaluate an expression multiple times, and use it everywhere. The test case is https://golang.org/cl/300789. Fixes golang/go#44383 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/300809
2021-03-11analyzer: new implementation of shortest feasible path [PR96374]David Malcolm20-106/+1366
The analyzer builds an exploded graph of (point,state) pairs and when it finds a problem, records a diagnostic at the relevant exploded node. Once it has finished exploring the graph, the analyzer needs to generate the shortest feasible path through the graph to each diagnostic's node. This is used: - for rejecting diagnostics that are infeasible (due to impossible sets of constraints), - for use in determining which diagnostic to use in each deduplication set (the one with the shortest path), and - for building checker_paths for the "winning" diagnostics, giving a list of events Prior to this patch the analyzer simply found the shortest path to the node, and then checked it for feasibility, which could lead to falsely rejecting diagnostics: "the shortest path, if feasible" is not the same as "the shortest feasible path" (PR analyzer/96374). An example is PR analyzer/93355, where this issue causes the analyzer to fail to emit a leak warning for a missing fclose on an error-handling path in intl/localealias.c. This patch implements a new algorithm for finding the shortest feasible path to an exploded node: instead of simply finding the shortest path, the new algorithm uses a worklist to iteratively build a tree of path prefixes, which are feasible paths by construction, until a path to the target node is found. The worklist is prioritized, so that the first feasible path discovered is the shortest possible feasible path. The algorithm continues trying paths until the target node is reached or a limit is exceeded, in which case the diagnostic is treated as being infeasible (which could still be a false negative, but is much less likely to happen than before). Iteratively building a tree of paths allows for work to be reused, and the tree can be dumped in .dot form (via a new -fdump-analyzer-feasibility option), making it much easier to debug compared to other approaches I tried. Doing so fixes the missing leak warning for PR analyzer/93355 and various other test cases. Testing: - I manually verified that the behavior is determistic using 50 builds of pr93355-localealias.c. All dumps were identical. - I manually verified that it still builds with --disable-analyzer. - Lightly tested with valgrind; no additional issues. - Lightly performance tested, showing a slight speed regression to the analyzer relative to before the patch, but correctness for this issue is more important than the slight performance hit for the analyzer. gcc/ChangeLog: PR analyzer/96374 * Makefile.in (ANALYZER_OBJS): Add analyzer/feasible-graph.o and analyzer/trimmed-graph.o. * doc/analyzer.texi (Analyzer Paths): Rewrite description of feasibility checking to reflect new implementation. * doc/invoke.texi (-fdump-analyzer-feasibility): Document new option. * shortest-paths.h (shortest_paths::get_shortest_distance): New. gcc/analyzer/ChangeLog: PR analyzer/96374 * analyzer.opt (-param=analyzer-max-infeasible-edges=): New param. (fdump-analyzer-feasibility): New flag. * diagnostic-manager.cc: Include "analyzer/trimmed-graph.h" and "analyzer/feasible-graph.h". (epath_finder::epath_finder): Convert m_sep to a pointer and only create it if !flag_analyzer_feasibility. (epath_finder::~epath_finder): New. (epath_finder::m_sep): Convert to a pointer. (epath_finder::get_best_epath): Add param "diag_idx" and use it when logging. Rather than finding the shortest path and then checking feasibility, instead use explore_feasible_paths unless !flag_analyzer_feasibility, in which case simply use the shortest path, and note if it is infeasible. Update for m_sep becoming a pointer. (class feasible_worklist): New. (epath_finder::explore_feasible_paths): New. (epath_finder::process_worklist_item): New. (class dump_eg_with_shortest_path): New. (epath_finder::dump_trimmed_graph): New. (epath_finder::dump_feasible_graph): New. (saved_diagnostic::saved_diagnostic): Add "idx" param, using it on new field m_idx. (saved_diagnostic::to_json): Dump m_idx. (saved_diagnostic::calc_best_epath): Pass m_idx to get_best_epath. Remove assertion that m_problem was set when m_best_epath is NULL. (diagnostic_manager::add_diagnostic): Pass an index when created saved_diagnostic instances. * diagnostic-manager.h (saved_diagnostic::saved_diagnostic): Add "idx" param. (saved_diagnostic::get_index): New accessor. (saved_diagnostic::m_idx): New field. * engine.cc (exploded_node::dump_dot): Call args.dump_extra_info. Move code to... (exploded_node::dump_processed_stmts): ...this new function and... (exploded_node::dump_saved_diagnostics): ...this new function. Add index of each diagnostic. (exploded_edge::dump_dot): Move bulk of code to... (exploded_edge::dump_dot_label): ...this new function. * exploded-graph.h (eg_traits::dump_args_t::dump_extra_info): New vfunc. (exploded_node::dump_processed_stmts): New decl. (exploded_node::dump_saved_diagnostics): New decl. (exploded_edge::dump_dot_label): New decl. * feasible-graph.cc: New file. * feasible-graph.h: New file. * trimmed-graph.cc: New file. * trimmed-graph.h: New file. gcc/testsuite/ChangeLog: PR analyzer/96374 * gcc.dg/analyzer/dot-output.c: Add -fdump-analyzer-feasibility to options. * gcc.dg/analyzer/feasibility-1.c (test_6): Remove xfail. (test_7): New. * gcc.dg/analyzer/pr93355-localealias-feasibility-2.c: Remove xfail. * gcc.dg/analyzer/pr93355-localealias-feasibility-3.c: Remove xfails. * gcc.dg/analyzer/pr93355-localealias-feasibility.c: Remove -fno-analyzer-feasibility from options. * gcc.dg/analyzer/pr93355-localealias.c: Likewise. * gcc.dg/analyzer/unknown-fns-4.c: Remove xfail.
2021-03-11analyzer: support reverse direction in shortest-paths.hDavid Malcolm3-37/+125
This patch generalizes shortest-path.h so that it can be used to find the shortest path from each node to a given target node (on top of the existing support for finding the shortest path from a given origin node to each node). I've marked this as "analyzer" as this is the only code using shortest-paths.h. This patch is required by followup work to fix PR analyzer/96374. gcc/analyzer/ChangeLog: * diagnostic-manager.cc (epath_finder::epath_finder): Update shortest_paths init for new param. gcc/ChangeLog: * digraph.cc (selftest::test_shortest_paths): Update shortest_paths init for new param. Add test of SPS_TO_GIVEN_TARGET. * shortest-paths.h (enum shortest_path_sense): New. (shortest_paths::shortest_paths): Add "sense" param. Update for renamings. Generalize to use "sense" param. (shortest_paths::get_shortest_path): Rename param. (shortest_paths::m_sense): New field. (shortest_paths::m_prev): Rename... (shortest_paths::m_best_edge): ...to this. (shortest_paths::get_shortest_path): Update for renamings. Conditionalize flipping of path on sense of traversal.
2021-03-11analyzer: gracefully handle impossible paths in shortest-paths.hDavid Malcolm2-24/+83
This bulletproofs the shortest_paths code against unreachable nodes, gracefully handling them, rather than failing an assertion. I've marked this as "analyzer" as this is the only code using shortest-paths.h. This patch is required by followup work to fix PR analyzer/96374. gcc/ChangeLog: * digraph.cc (selftest::test_shortest_paths): Add test coverage for paths from B and C. * shortest-paths.h (shortest_paths::shortest_paths): Handle unreachable nodes, rather than asserting.
2021-03-11aix: Use lcomm for TLS static data.David Edelsohn4-9/+5
GCC on AIX generates thread local uninitialized data in the common section, which could conflict with another module. This patch changes the code generation to place static uninitialized thread local data into the local common section specified with .lcomm. This change also removes the need to create a file-local name for the TBSS data. gcc/ChangeLog: 2021-03-11 David Edelsohn <dje.gcc@gmail.com> PR target/99094 * config/rs6000/rs6000.c (rs6000_xcoff_file_start): Don't create xcoff_tbss_section_name. * config/rs6000/xcoff.h (ASM_OUTPUT_TLS_COMMON): Use .lcomm. * xcoffout.c (xcoff_tbss_section_name): Delete. * xcoffout.h (xcoff_tbss_section_name): Delete.
2021-03-11c++: Fix unhiding friend with imports [PR 99248]Nathan Sidwell5-3/+19
This was a simple thinko about which object held the reference to the binding vector. I also noticed stale code in the tree dumper, as I recently removed the flags from a lazy number. PR c++/99248 gcc/cp/ * name-lookup.c (lookup_elaborated_type_1): Access slot not bind when there's a binding vector. * ptree.c (cxx_print_xnode): Lazy flags are no longer a thing. gcc/testsuite/ * g++.dg/modules/pr99248.h: New. * g++.dg/modules/pr99248_a.H: New. * g++.dg/modules/pr99248_b.H: New.
2021-03-11c++: template partial instantiation mismatch [PR 99528]Nathan Sidwell5-45/+35
This turned out to be an existing problem, which had been hidden by other bugs. Templated members of templated classes can end up instantiating the template itself, and we were not handling the mergeableness of that correctly. PR c++/99528 gcc/cp/ * module.cc (enum merge_kind): Delete MK_type_tmpl_spec, MK_decl_tmpl_spec. (trees_in::decl_value): Adjust add_mergeable_specialization call. (trees_out::get_merge_kind): Adjust detecting a partial template instantiation. (trees_out::key_mergeable): Adjust handling same. (trees_in::key_mergeabvle): Likewise. gcc/testsuite/ * g++.dg/modules/pr99528.h: New. * g++.dg/modules/pr99528_a.H: New. * g++.dg/modules/pr99528_b.H: New. * g++.dg/modules/pr99528_c.C: New.
2021-03-11testsuite/98245 - adjust dump scanning of gcc.dg/vect/bb-slp-46.cRichard Biener1-2/+2
Checking the number of pluses is unreliable since the vector size isn't known. Instead see that the unwanted scalar compute is not there. 2021-03-11 Richard Biener <rguenther@suse.de> PR testsuite/98245 * gcc.dg/vect/bb-slp-46.c: Scan for the scalar compute instead of verifying the total number of adds.
2021-03-11testsuite/97494 - XFAIL gcc.dg/vect/pr97428.c on !vect_hw_misalignRichard Biener1-1/+3
While we could at least vectorize it on targets which support re-alignment tokens we fail to do this because of imperfections in alignment analysis. XFAIL when the HW cannot deal with misaligned vector accesses for now. 2021-03-11 Richard Biener <rguenther@suse.de> PR testsuite/97494 * gcc.dg/vect/pr97428.c: XFAIL on !vect_hw_misalign.
2021-03-11testsuite/97494 - XFAIL gcc.dg/vect/vect-complex-5.c on !vect_hw_misalignRichard Biener1-1/+1
This is a missed optimization due to bogus alignment analysis. 2021-03-11 Richard Biener <rguenther@suse.de> PR testsuite/97494 * gcc.dg/vect/vect-complex-5.c: XFAIL on !vect_hw_misalign.
2021-03-11testsuite/97494 - amend gcc.dg/vect/slp-21.cRichard Biener1-2/+2
As reported in the PR all powerpc64 targets fail FAIL: gcc.dg/vect/slp-21.c scan-tree-dump-times vect "vectorizing stmts using SLP" 2 because like on arm we now vectorize 4 opportunities. This adjusts the testcase to follow the arm example. 2021-03-11 Richard Biener <rguenther@suse.de> PR testsuite/97494 * gcc.dg/vect/slp-21.c: Adjust for powerpc64*-*-*.
2021-03-11tree-optimization/99523 - missing SSA decls in dumpsRichard Biener1-1/+6
This makes sure to dump SSA names without identifier in the declaration part of a function dump. While we dump the anonymous variable decls the SSA names referencing them appear without a clear reference as to what anonymous variable is used (_3 vs. D.1234). 2021-03-11 Richard Biener <rguenther@suse.de> PR tree-optimization/99523 * tree-cfg.c (dump_function_to_file): Dump SSA names w/o identifier to the decls section as well, not only those without a VAR_DECL.
2021-03-11icf: Check return type of internal fn calls [PR99517]Jakub Jelinek3-1/+54
The following testcase is miscompiled, because IPA-ICF considers the two functions identical. They aren't, the types of the .VEC_CONVERT call lhs is different. But for calls to internal functions, there is no fntype nor callee with a function type to compare, so all we compare is just the ifn, arguments and some call flags. The following patch fixes it by checking the internal fn calls like e.g. gimple assignments where the type of the lhs is checked too. 2021-03-11 Jakub Jelinek <jakub@redhat.com> PR ipa/99517 * ipa-icf-gimple.c (func_checker::compare_gimple_call): For internal function calls with lhs fail if the lhs don't have compatible types. * gcc.target/i386/avx2-pr99517-1.c: New test. * gcc.target/i386/avx2-pr99517-2.c: New test.
2021-03-11cris: define HARD_FRAME_POINTER_REGNUMHans-Peter Nilsson3-20/+36
Beware, tm.texi doesn't tell the whole story: a defined HARD_FRAME_POINTER_REGNUM (different to FRAME_POINTER_REGNUM) is supposed to make work easier for reload, being able to easily tell actual frame-pointer-related addresses from those that happen to use the same register or something to that effect. On reasonable code the performance effect is barely measurable. Looking at libgcc changes for -march=v10, the effect (where noticeable) is mostly indeterminate churn. Instances where it's not just insns moved around at no obvious effect: one more insn for addvdi3, subvdi3; two insns more in floatdisf; three insns shorter fixunsdfdi. Some of those seem related to pairing r8 with r9. The only effect on coremark is an infinitesimal positive effect from a three(!) cycles total (from the 15 calls) faster execution paths in vfprintf_r. Local microbenchmarks give similar results. With that in mind and not forgetting that expectations in the register allocator and reload leaning towards HARD_FRAME_POINTER_REGNUM defined (and different to) FRAME_POINTER_REGNUM or to wit, "all the kids do it", why not. Note that the offset at elimination really is 0. gcc: * config/cris/cris.h (HARD_FRAME_POINTER_REGNUM): Define. Change FRAME_POINTER_REGNUM to correspond to a new faked register faked_fp, part of GENNONACR_REGS like faked_ap. (CRIS_FAKED_REGS_CONTENTS): New helper macro. (FIRST_PSEUDO_REGISTER, FIXED_REGISTERS, CALL_USED_REGISTERS): (REG_ALLOC_ORDER, REG_CLASS_CONTENTS, REGNO_OK_FOR_BASE_P) (ELIMINABLE_REGS, REGISTER_NAMES): Adjust accordingly. * config/cris/cris.md (CRIS_FP_REGNUM): Renumber to new faked register. (CRIS_REAL_FP_REGNUM): New constant. * config/cris/cris.c (cris_reg_saved_in_regsave_area): Check for HARD_FRAME_POINTER_REGNUM instead of FRAME_POINTER_REGNUM. (cris_initial_elimination_offset): Handle elimination changes to HARD_FRAME_POINTER_REGNUM instead of FRAME_POINTER_REGNUM and add one from FRAME_POINTER_REGNUM to HARD_FRAME_POINTER_REGNUM. (cris_expand_prologue, cris_expand_epilogue): Emit code for hard_frame_pointer_rtx instead of frame_pointer_rtx.
2021-03-11Daily bump.GCC Administrator7-1/+165
2021-03-10aix: align double complexDavid Edelsohn3-2/+54
AIX word-aligns floating point doubles. This behavior also extends to double _Complex, which had been overlooked when compiler support for double _Complex was added. This patch adds DCmode to the modes whose alignment is adjusted and adds a testcase to confirm the correct alignment. gcc/ChangeLog: 2021-03-10 David Edelsohn <dje.gcc@gmail.com> PR target/99492 * config/rs6000/aix.h (ADJUST_FIELD_ALIGN): Add check for DCmode. * config/rs6000/rs6000.c (rs6000_special_round_type_align): Same. gcc/testsuite/ChangeLog: 2021-03-10 David Edelsohn <dje.gcc@gmail.com> PR target/99492 * gcc.target/powerpc/pr99492.c: New testcase.
2021-03-10PR fortran/99205 - Out of memory with undefined character lengthHarald Anlauf4-1/+30
A character variable appearing as a data statement object cannot be automatic, thus it shall have constant length. gcc/fortran/ChangeLog: PR fortran/99205 * data.c (gfc_assign_data_value): Reject non-constant character length for lvalue. * trans-array.c (gfc_conv_array_initializer): Restrict loop to elements which are defined to avoid NULL pointer dereference. gcc/testsuite/ChangeLog: PR fortran/99205 * gfortran.dg/data_char_4.f90: New test. * gfortran.dg/data_char_5.f90: New test.
2021-03-10[PR99422] LRA: Don't check unknown constraint, use X for empty constraintVladimir N. Makarov1-4/+3
Using CONSTRAINT__UNKNOWN was a bad idea, although it triggered a lot hidden bugs. It is better to use X instead of empty constraint. gcc/ChangeLog: PR target/99422 * lra-constraints.c (process_address_1): Don't check unknown constraint, use X for empty constraint.
2021-03-10rs6000: Fix pr98959 testcaseSegher Boessenkool1-0/+2
It needs the int128 selector because it uses __int128, and the lp64 selector is the best we can do for -mcmodel=. 2021-03-10 Segher Boessenkool <segher@kernel.crashing.org> gcc/testsuite/ * gcc.target/powerpc/pr98959.c: Add int128 and lp64 selectors.
2021-03-10Fortran: Fix wording in intrinsic.texi's MINTobias Burnus1-1/+1
gcc/fortran/ChangeLog: * intrinsic.texi (MIN): Correct 'maximum' to 'minimum'.
2021-03-10c++: ICE do to GC leakage [PR 99423]Nathan Sidwell3-1/+24
My reworking of pending-entity loading introduced a GC problem. The post-load processing needs to inhibit GCs (that would otherwise occur in clone_decl). That wasn't happening on one code path, leading to dangling pointers in the active call frames. PR c++/99423 gcc/cp/ * module.cc (post_load_processing): Assert not gcable. (laxy_load_pendings): Extend no-gc region around post_load_processing. gcc/testsuite/ * g++.dg/modules/pr99423_a.H: New. * g++.dg/modules/pr99423_b.H: New.
2021-03-10analyzer: factor out new class feasibility_stateDavid Malcolm2-101/+172
As preparatory work for a fix to PR analyzer/96374, this patch moves the core state-update logic from the loop in exploded_path::feasible_p into a new class feasibility_state. No functional change intended. gcc/analyzer/ChangeLog: PR analyzer/96374 * engine.cc (exploded_path::feasible_p): Move "snodes_visited" and "model" locals into a new class feasibility_state. Move heart of per-edge processing into feasibility_state::maybe_update_for_edge. (feasibility_state::feasibility_state): New. (feasibility_state::maybe_update_for_edge): New, based on loop body in exploded_path::feasible_p. * exploded-graph.h (class feasibility_state): New.
2021-03-10committed: analyzer: remove duplicated vfuncsDavid Malcolm1-18/+10
Implement dyn_cast_callgraph_superedge once in callgraph_superedge, rather than twice in the two subclasses. Spotted whilst working on a patch for call summaries. gcc/analyzer/ChangeLog: * supergraph.h (callgraph_superedge::dyn_cast_callgraph_superedge): New. (call_superedge::dyn_cast_callgraph_superedge): Delete. (return_superedge::dyn_cast_callgraph_superedge): Delete.
2021-03-10testsuite: Fix up pr99305.C test on unsigned_char targets [PR99498]Jakub Jelinek1-1/+1
On unsigned_char targets, the cast stmt to unsigned char is obviously not needed (and shouldn't be there). But it doesn't hurt to test the rest also on targets where char is unsigned. 2021-03-10 Jakub Jelinek <jakub@redhat.com> PR tree-optimization/99305 PR testsuite/99498 * g++.dg/opt/pr99305.C: Don't expect cast to unsigned char on unsigned_char effective targets.
2021-03-10c++: Propagate assembler name from local-externs [PR 99508]Nathan Sidwell2-0/+27
This is another place where our one-true-decl representation breaks down. The fix here propagates the assembly name to the ns-scope alias. that fixes the reported problem but changes the behaviour when the user has explicitly declared the entity in its namespace. However, we didn't handle that case 'correctly' anyway before. Previously we'd also ignore the explicitly specified assembler name, now we propagate it. It's not clear to me what the desired semantics would be in decorating just one of the local extern declarations this way. I don't think we can really do better without propagating this aliasing property into the middle end (which is also needed for some constexpr handling, see PR97306). I tried that before and it turned into a rat-hole. PR c++/99508 gcc/cp/ * decl.c (make_rtl_for_nonlocal_decl): Propagate local-extern's assembler name to the ns alias. gcc/testsuite/ * g++.dg/ext/pr99508.C: New.
2021-03-10aarch64: Fix typo in aarch64.c commentAlex Coplan1-1/+1
This fixes a typo in the description of aarch64_vfp_is_call_or_return_candidate. gcc/ChangeLog: * config/aarch64/aarch64.c (aarch64_vfp_is_call_or_return_candidate): Fix typo in comment describing "is_ha" argument.
2021-03-10Add LRA target selector.John David Anglin6-6/+17
gcc/ChangeLog: * doc/sourcebuild.texi: Document LRA target selector. gcc/testsuite/ChangeLog: PR testsuite/99292 * lib/target-supports.exp (check_effective_target_lra): New. * gcc.c-torture/compile/asmgoto-2.c: Use LRA target selector. * gcc.c-torture/compile/asmgoto-5.c: Likewise. * gcc.c-torture/compile/pr98096.c: Likewise. * gcc.dg/pr97954.c: Likewise.
2021-03-10analyzer: remove some no-longer-needed -Wno-analyzer-too-complexDavid Malcolm2-6/+0
A couple of analyzer testcases no longer have state explosions; updating them accordingly in case they regress. gcc/testsuite/ChangeLog: * gcc.dg/analyzer/pr94047.c: Remove "-Wno-analyzer-too-complex". * gcc.dg/analyzer/zlib-2.c: Likewise.
2021-03-10docs: add interactive vs batch distinction to UX guidelinesDavid Malcolm1-0/+25
gcc/ChangeLog: * doc/ux.texi: Add subsection contrasting interactive versus batch usage of GCC.
2021-03-10[testsuite] Fix target selector for pr99102.cJoel Hutton1-2/+2
The target selector should explicitly choose 256 bit hardware as explicit 256 bit compiler options are used to trigger the bug. gcc/testsuite/ChangeLog: * gcc.dg/vect/pr99102.c: Fix target selector.
2021-03-10[Vect] Fix mask check on Scatter loads/storesJoel Hutton2-2/+22
Previously, IFN_MASK_SCATTER_STORE was used if 'loop_masks' was non-null, but the mask used is 'final_mask'. This caused a bug where a 'MASK_STORE' was vectorized into a 'SCATTER_STORE' instead of a 'MASK_SCATTER_STORE'. This fixes PR target/99102. gcc/ChangeLog: PR target/99102 * tree-vect-stmts.c (vectorizable_store): Fix scatter store mask check condition. (vectorizable_load): Fix gather load mask check condition. gcc/testsuite/ChangeLog: PR target/99102 * gcc.dg/vect/pr99102.c: New test.
2021-03-10tree-optimization/99510 - fix type reuse of build_aligned_typeRichard Biener1-1/+3
The fix for PR94775 added more strict checking for type reuse to check_aligned_type, specifically matching TYPE_USER_ALIGN. But then build_aligned_type sets TYPE_USER_ALIGN on the built variant so if the type we build an aligned variant for does not have TYPE_USER_ALIGN we'll never re-use the newly created aligned variant. This results in ~35000 identical variants being created for polyhedron doduc. The following instead checks that the candidate has TYPE_USER_ALIGN set. 2021-03-10 Richard Biener <rguenther@suse.de> PR tree-optimization/99510 * tree.c (check_aligned_type): Check that the candidate has TYPE_USER_ALIGN set instead of matching with the original type.
2021-03-10Do not assume that __float128 existsEric Botcazou1-1/+1
The code in build_round_expr implicitly assumes that __float128 exists, which is *not* the common case among 64-bit architectures since the "long double" type is generally already 128-bit for them. gcc/fortran/ PR fortran/96983 * trans-intrinsic.c (build_round_expr): Do not implicitly assume that __float128 is the 128-bit floating-point type.
2021-03-10Fix ICE on atomic enumeration type with LTOEric Botcazou2-0/+16
This is a strange regression whereby an enumeration type declared as atomic (or volatile) incorrectly triggers the ODR machinery for its values in LTO mode. gcc/ada/ * gcc-interface/decl.c (gnat_to_gnu_entity): Build a TYPE_STUB_DECL for the main variant of an enumeration type declared as volatile. gcc/testsuite/ * gnat.dg/specs/lto25.ads: New test.
2021-03-10Fix miscompilation of Ada runtime on 64-bit SPARCEric Botcazou1-10/+5
Returning a REGMODE_NATURAL_SIZE of 4 for DFmode in 64-bit mode is just asking for trouble because sub-word SUBREGs are always treated differently than the others, in particular by the register allocator. gcc/ * config/sparc/sparc.c (sparc_regmode_natural_size): Return 4 for float and vector integer modes only if the mode is not larger.
2021-03-10cris: define DWARF_FRAME_REGISTERSHans-Peter Nilsson1-0/+3
When DWARF_FRAME_REGISTERS isn't defined, the default is FIRST_PSEUDO_REGISTER which means that if you add faked registers to the port, used for frame-context related elimination, room is allocated for them in the register context used for frame-unwinding, which is wasteful because they're eliminated before the final form of the code that is emitted. Stopping after MOF saves two register slots in the unwind contest, compared to the current default. For regular C programming this is uninteresting, but defining DWARF_FRAME_REGISTERS now also avoids the need to remember to define it later, when twiddling with additional faked registers (alternatively suffering churn from comparing differences in unwind context). As expected, no effect on test-results, coremark or local (C-specific) microbenchmarks. gcc: * config/cris/cris.h (DWARF_FRAME_REGISTERS): Define.
2021-03-10Daily bump.GCC Administrator5-1/+141
2021-03-09IRA: Process digital constraints containing more one digitVladimir N. Makarov2-54/+69
gcc/ChangeLog: * ira.c (ira_setup_alts, ira_get_dup_out_num): Process digital constraints > 9. * ira-lives.c (single_reg_class): Ditto.
2021-03-09RTEMS: Fix -Werror buildsSebastian Huber1-5/+5
Fix build errors due to warnings such as: gcc/config/v850/rtems.h:43: error: "RTEMS_STARTFILE_SPEC" redefined [-Werror] 43 | #define RTEMS_STARTFILE_SPEC "" The problem was that "gcc/config/rtems.h" was included before the architecture-specific "gcc/config/*/rtems.h" header file on some architectures. gcc/ * config.gcc (aarch64-*-rtems*): Include general rtems.h after the architecture-specific rtems.h. (aarch64-*-rtems*): Likewise. (arm*-*-rtems*): Likewise. (epiphany-*-rtems*): Likewise. (riscv*-*-rtems*): Likewise.
2021-03-09phiopt: Fix up conditional_replacement [PR99305]Jakub Jelinek2-3/+29
Before my PR97690 changes, conditional_replacement would not set neg when the nonzero arg was boolean true. I've simplified the testing, so that it first finds the zero argument and then checks the other argument for all the handled cases (1, -1 and 1 << X, where the last case is what the patch added support for). But, unfortunately I've placed the integer_all_onesp test first. For unsigned precision 1 types such as bool integer_all_onesp, integer_onep and integer_pow2p can all be true and the code set neg to true in that case, which is undesirable. The following patch tests integer_pow2p first (which is trivially true for integer_onep too and tree_log2 in that case gives shift == 0) and only if that isn't the case, integer_all_onesp. 2021-03-09 Jakub Jelinek <jakub@redhat.com> PR tree-optimization/99305 * tree-ssa-phiopt.c (conditional_replacement): Test integer_pow2p before integer_all_onesp instead of vice versa. * g++.dg/opt/pr99305.C: New test.
2021-03-09rs6000: Fix check_effective_target_sqrt_insn (PR99352)Segher Boessenkool1-1/+16
The previous version returned true for all PowerPC. This is incorrect. We only support floating point square root instructions if a) we support floating point instructions at all, and b) we have _ARCH_PPCSQ defined. 2020-03-09 Segher Boessenkool <segher@kernel.crashing.org> gcc/testsuite/ * lib/target-supports.exp (check_effective_target_powerpc_sqrt): New. (check_effective_target_sqrt_insn): Use it.
2021-03-09arm: fix bootstrap failure following automatic mode selection patchRichard Earnshaw1-1/+1
Fix a signed vs unsigned comparison in last change. gcc: * common/config/arm/arm-common.c (arm_config_default): Change type of 'i' to unsigned.
2021-03-09[PR99454] LRA: Process separately 'g' and digital constraints > 9 in ↵Vladimir N. Makarov2-5/+51
process_address_1 gcc/ChangeLog: PR target/99454 * lra-constraints.c (process_address_1): Process constraint 'g' separately and digital constraints containing more one digit. gcc/testsuite/ChangeLog: PR target/99454 * gcc.target/i386/pr99454.c: New.
2021-03-09Re: [PATCH v2] fix Ada bootstrap on Cygwin64 (PR bootstrap/94918)Mikael Pettersson1-0/+6
gcc/ada/ * raise-gcc.c: On Cygwin include mingw32.h to prevent windows.h from including x86intrin.h or emmintrin.h.
2021-03-09c++: Fix coroutines on targetm.cxx.cdtor_return_this targets [PR99459]Jakub Jelinek1-16/+18
The r11-7528 build_co_await changes broke coroutines on arm*-linux-gnuabi, 2780 ^FAIL.*coroutines/ in total. The problem is that arm is targetm.cxx.cdtor_return_this target where both ctors and dtors in the ABI return this pointer rather than void, and build_new_method_call_1 does: else if (call != error_mark_node && DECL_DESTRUCTOR_P (cand->fn) && !VOID_TYPE_P (TREE_TYPE (call))) /* An explicit call of the form "x->~X()" has type "void". However, on platforms where destructors return "this" (i.e., those where targetm.cxx.cdtor_returns_this is true), such calls will appear to have a return value of pointer type to the low-level call machinery. We do not want to change the low-level machinery, since we want to be able to optimize "delete f()" on such platforms as "operator delete(~X(f()))" (rather than generating "t = f(), ~X(t), operator delete (t)"). */ call = build_nop (void_type_node, call); The new code in build_co_await relies on build_special_member_call returned expression being a CALL_EXPR, but due to the build_nop in there it is a NOP_EXPR around the CALL_EXPR. It can't be stripped with STRIP_NOPS because void has different mode from the pointer mode. 2021-03-09 Jakub Jelinek <jakub@redhat.com> PR c++/99459 * coroutines.cc (build_co_await): Look through NOP_EXPRs in build_special_member_call return value to find the CALL_EXPR. Simplify.
2021-03-09Fix building the RX port of gcc.Nick Clifton1-0/+3
* config/rx/rx.h (DBX_DEBUGGING_INFO): Define. (DWARF"_DEBUGGING_INFO): Define.
2021-03-09Assorted testsuite fixesEric Botcazou4-3/+5
First, gcc.dg/array-quals-1.c does not pass if the compiler is configured with --enable-default-pie because the sections change, so force -fno-pie. Second, replace *-*-solaris* with sparc*-*-* for gfortran.dg/pr95690.f90 because this depends on the architecture rather than the OS. Third force SRA to trigger on Aarch64 (like PowerPC) for gnat.dg/opt39.adb. gcc/testsuite/ * gcc.dg/array-quals-1.c: Pass -fno-pie if supported. * gcc.dg/loop-9.c: Likewise. * gfortran.dg/pr95690.f90: Replace *-*-solaris* with sparc*-*-*. * gnat.dg/opt39.adb: Pass --param option for Aarch64 too.
2021-03-09Fix internal error on lambda functionEric Botcazou1-13/+11
This boils down to the RTL expander trying to take the address of a DECL whose RTX is a register. gcc/ PR c++/90448 * calls.c (initialize_argument_information): When the argument is passed by reference, do not make a copy in a thunk only if the argument is already in memory. Remove redundant test for the case of callee copy.
2021-03-09[PR99454] LRA: Process 0..9 constraints in process_address_1Vladimir N. Makarov1-0/+4
We need to process 0..9 constraints to fetch the right op constraint in the function. Also 0..9 constraints gives unknown class constraint class which can result in skipping address normalization for memory in asm. gcc/ChangeLog: PR target/99454 * lra-constraints.c (process_address_1): Process 0..9 constraints in process_address_1.
2021-03-09IBM Z: arch14 fix option string used for BinutilsAndreas Krebbel1-1/+1
gcc/ChangeLog: * config/s390/s390.c (struct s390_processor processor_table): Binutils name string must not be empty.