aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2021-02-11Daily bump.GCC Administrator9-1/+189
2021-02-10Add test for PR tree-optimization/92879.Martin Sebor1-0/+29
gcc/testsuite/ChangeLog: PR tree-optimization/92879 * g++.dg/warn/Warray-bounds-16.C: New test.
2021-02-10libcpp: fix ICE comparing macro locations without column info [PR96391]David Malcolm3-1/+16
PR preprocessor/96391 describes an ICE in the C++ frontend on: #define CONST const #define VOID void typedef CONST VOID *PCVOID; where the typedef line occurs after enough code has been compiled that location_t values are beyond LINE_MAP_MAX_LOCATION_WITH_COLS, and hence no column numbers are available. The issue occurs in linemap_compare_locations when comparing the locations of the "const" and "void" tokens. Upon resolving the LRK_MACRO_EXPANSION_POINT, both have the same location_t, the line of the "typedef" (with no column), and so the l0 == l1 clause is triggered, but they are not from the same macro expansion, leading first_map_in_common to return NULL and triggering the "abort" condition. This patch fixes the issue by checking when the two macro expansion point location_t values are equal that the value <= LINE_MAP_MAX_LOCATION_WITH_COLS and thus has column information, fixing the issue. gcc/testsuite/ChangeLog: PR preprocessor/96391 * g++.dg/plugin/location-overflow-test-pr96391.c: New test. * g++.dg/plugin/plugin.exp (plugin_test_list): Add it, using the location_overflow_plugin.c from gcc.dg/plugin. libcpp/ChangeLog: PR preprocessor/96391 * line-map.c (linemap_compare_locations): Require that the location be <= LINE_MAP_MAX_LOCATION_WITH_COLS when treating locations as coming from the same macro expansion.
2021-02-10varasm: Fix ICE with -fsyntax-only [PR99035]Jakub Jelinek2-1/+14
My FE change from 2 years ago uses TREE_ASM_WRITTEN in -fsyntax-only mode more aggressively to avoid "expanding" functions multiple times. With -fsyntax-only nothing is really expanded, so I think it is acceptable to adjust the assert and allow declare_weak at any time, with -fsyntax-only we know it is during parsing only anyway. 2021-02-10 Jakub Jelinek <jakub@redhat.com> PR c++/99035 * varasm.c (declare_weak): For -fsyntax-only, allow even TREE_ASM_WRITTEN function decls. * g++.dg/ext/weak6.C: New test.
2021-02-10i386: Fix ICEs due to simplify_gen_subreg returning NULL [PR99025]Jakub Jelinek2-0/+28
In these patterns, we call simplify_gen_subreg on the input operand to create paradoxical subregs that have 2x, 4x or 8x elements as the input operand. That works fine if the input operand is a REG, but when it is a SUBREG, RTL doesn't allow SUBREG of SUBREG and so relies on simplify_subreg actually simplifying it. And e.g. if the input operand is a SUBREG that changes the element mode (floating vs. non-floating) and then combined with a paradoxical subreg (i.e. different size) this can easily fail, then simplify_gen_subreg returns NULL but we still use it in instructions. Fixed by forcing the operands into REG. 2021-02-10 Jakub Jelinek <jakub@redhat.com> PR target/99025 * config/i386/sse.md (fix<fixunssuffix>_truncv2sfv2di2, <insn>v8qiv8hi2, <insn>v8qiv8si2, <insn>v4qiv4si2, <insn>v4hiv4si2, <insn>v8qiv8di2, <insn>v4qiv4di2, <insn>v2qiv2di2, <insn>v4hiv4di2, <insn>v2hiv2di2, <insn>v2siv2di2): Force operands[1] into REG before calling simplify_gen_subreg on it. * gcc.target/i386/pr99025.c: New test.
2021-02-10c++: Consider addresses of heap artificial vars always non-NULL [PR98988, ↵Jakub Jelinek3-9/+48
PR99031] With -fno-delete-null-pointer-checks which is e.g. implied by -fsanitize=undefined or default on some embedded targets, the middle-end folder doesn't consider addresses of global VAR_DECLs to be non-NULL, as one of them could have address 0. Still, I think malloc/operator new (at least the nonthrowing) relies on NULL returns meaning allocation failure rather than success. Furthermore, the artificial VAR_DECLs we create for constexpr new never actually live in the address space of the program, so we can pretend they will never be NULL too. > I'm surprised that nonzero_address has such a limited set of things it will > actually believe have non-zero addresses with > -fno-delete-null-pointer-checks. But it seems that we should be able to > arrange to satisfy > > > if (definition && !DECL_EXTERNAL (decl) > > since these "variables" are indeed defined within the current translation > unit. Doing that seems to work and as added benefit it fixes another PR that has been filed recently. I need to create the varpool node explicitly and call a method that sets the definition member in there, but I can also unregister those varpool nodes at the end of constexpr processing, as the processing ensured they don't leak outside of the processing. 2021-02-10 Jakub Jelinek <jakub@redhat.com> PR c++/98988 PR c++/99031 * constexpr.c: Include cgraph.h. (cxx_eval_call_expression): Call varpool_node::finalize_decl on heap artificial vars. (cxx_eval_outermost_constant_expr): Remove varpool nodes for heap artificial vars. * g++.dg/cpp2a/constexpr-new16.C: New test. * g++.dg/cpp2a/constexpr-new17.C: New test.
2021-02-10nvptx: properly use flag_patchable_function_entryMartin Liska1-1/+5
gcc/ChangeLog: * config/nvptx/nvptx.c (nvptx_option_override): Use flag_patchable_function_entry instead of the removed function_entry_patch_area_size.
2021-02-10libstdc++: Re-enable workaround for _wstat64 bug [PR 88881]Jonathan Wakely1-2/+0
This wasn't fixed upstream for mingw-w64 so we still need the workaround. libstdc++-v3/ChangeLog: PR libstdc++/88881 * src/c++17/fs_ops.cc (fs::status): Re-enable workaround.
2021-02-10libstdc++: Use correct error category for Windows error codesJonathan Wakely2-6/+6
When the result of GetLastError() is stored in a std::error_code it should use std::system_category(), not std::generic_category() that is used for POSIX errno values. libstdc++-v3/ChangeLog: * src/c++17/fs_ops.cc (fs::create_hard_link, fs::equivalent) (fs::remove): Use std::system_category() for error codes from GetLastError(). * src/filesystem/ops.cc (fs::create_hard_link, fs::remove): Likewise.
2021-02-10libstdc++: Fix spelling of __MINGW32__ macrosJonathan Wakely5-6/+6
libstdc++-v3/ChangeLog: * testsuite/27_io/filesystem/operations/proximate.cc: Fix typo in __MINGW32__ macro name. * testsuite/27_io/filesystem/path/compare/lwg2936.cc: Likewise. * testsuite/27_io/filesystem/path/generation/proximate.cc: Likewise. * testsuite/27_io/filesystem/path/generation/relative.cc: Likewise. * testsuite/util/testsuite_fs.h: Likewise.
2021-02-10fix memory leak in optimize pragma parsingRichard Biener1-0/+1
The optimize pragma/attribute parsing calls decode_cmdline_options_to_array but doesn't free the array. The following fixes that. 2021-02-10 Richard Biener <rguenther@suse.de> gcc/c-family/ * c-common.c (parse_optimize_options): Free decoded_options.
2021-02-10c++: generic lambdas and local-externs from outer scopes [PR 99030]Nathan Sidwell2-3/+24
Lambdas can refer to local externs from their enclosing scope. When the lambda's generic but the containing function is not a temploid, we'll never have tsubsted the declaring decl so won't have a local specialization. But in that case we can just use the decl we tsubsting directly -- it's not dependent. PR c++/99030 gcc/cp * pt.c (tsubst_copy) [VAR_DECL]: For a DECL_LOCAL_DECL_P T is the answer if there's no local specialization. gcc/testsuite/ * g++.dg/lookup/pr99030.C: New.
2021-02-10if-to-switch: fix memory leak in case mergingMartin Liska3-16/+20
gcc/ChangeLog: PR tree-optimization/99002 PR tree-optimization/99026 * gimple-if-to-switch.cc (if_chain::is_beneficial): Fix memory leak when adjacent cases are merged. * tree-switch-conversion.c (switch_decision_tree::analyze_switch_statement): Use release_clusters. (make_pass_lower_switch): Remove trailing whitespace. * tree-switch-conversion.h (release_clusters): New.
2021-02-10rtl-optimization/99054 - fix leak in fixup_partitionsRichard Biener1-4/+4
This fixes a leak of the vector retured by find_partition_fixes by turning it into an auto_vec. 2021-02-10 Richard Biener <rguenther@suse.de> PR rtl-optimization/99054 * cfgrtl.c (rtl-optimization/99054): Return an auto_vec. (fixup_partitions): Adjust. (rtl_verify_edges): Likewise.
2021-02-10openmp: Temporarily disable into_ssa when gimplifying OpenMP reduction ↵Jakub Jelinek5-0/+69
clauses [PR99007] gimplify_scan_omp_clauses was already calling gimplify_expr with false as last argument to make sure it is not an SSA_NAME, but as the testcases show, that is not enough, SSA_NAME temporaries created during that gimplification can be reused too and we can't allow SSA_NAMEs to be used across OpenMP region boundaries, as we can only firstprivatize decls. Fixed by temporarily disabling into_ssa. 2021-02-10 Jakub Jelinek <jakub@redhat.com> PR middle-end/99007 * gimplify.c (gimplify_scan_omp_clauses): For MEM_REF on reductions, temporarily disable gimplify_ctxp->into_ssa around gimplify_expr calls. * g++.dg/gomp/pr99007.C: New test. * gcc.dg/gomp/pr99007-1.c: New test. * gcc.dg/gomp/pr99007-2.c: New test. * gcc.dg/gomp/pr99007-3.c: New test.
2021-02-10ipa/99029 - fix memory leak in propagate_mallocRichard Biener1-1/+1
This makes sure to release the vec<> of callees. 2021-02-10 Richard Biener <rguenther@suse.de> PR ipa/99029 * ipa-pure-const.c (propagate_malloc): Use an auto_vec<> for callees.
2021-02-10tree-optimization/99024 - fix leak in loop vect analysisRichard Biener1-1/+5
When we analyzed a loop as epilogue but later in peeling decide we're not going to use it then in the DTOR we clear the original loops ->aux which causes us to leak the main loop vinfo. Fixed by only clearing aux if it is associated with the vinfo we're destroying. 2021-02-10 Richard Biener <rguenther@suse.de> PR tree-optimization/99024 * tree-vect-loop.c (_loop_vec_info::~_loop_vec_info): Only clear loop->aux if it is associated with the destroyed loop_vinfo.
2021-02-10if-to-switch: fix a memory leakMartin Liska1-2/+1
gcc/ChangeLog: PR tree-optimization/99002 * gimple-if-to-switch.cc (find_conditions): Fix memory leak in the function.
2021-02-10ICF: fix memory leakMartin Liska1-2/+5
gcc/ChangeLog: PR ipa/99003 * ipa-icf.c (sem_item::add_reference): Fix memory leak when a reference exists.
2021-02-10dwarf2out: Don't prune static data members initialized with constants with ↵Jakub Jelinek1-0/+10
-gdwarf-5 [PR98755] In DWARF4 and earlier, static data members were represented as DW_TAG_member and the pruning code wouldn't prune those, but in DWARF5 they are represented as DW_TAG_variable with the class parent and the pruning code prunes those by default unless they are referenced from a separate definition without the class parent (out of class definition). C++17 inline vars have the definitions in the class though and even before if the static data member isn't ODR used, it doesn't need to be defined, so we could just never describe those static data members in the debug info. This change stops the pruning of DW_TAG_variable with DW_AT_const_value attribute with a class parent for -gdwarf-5 and later. This fixes -FAIL: g++.dg/debug/dwarf2/constexpr-var-1.C scan-assembler-times DW_AT_const_expr 2 -FAIL: libstdc++-prettyprinters/80276.cc whatis p4 -FAIL: libstdc++-prettyprinters/80276.cc whatis p4 -FAIL: libstdc++-prettyprinters/libfundts.cc print as -FAIL: libstdc++-prettyprinters/libfundts.cc print as -FAIL: libstdc++-prettyprinters/libfundts.cc print os -FAIL: libstdc++-prettyprinters/libfundts.cc print os 2021-02-10 Jakub Jelinek <jakub@redhat.com> PR debug/98755 * dwarf2out.c (prune_unused_types_walk): Mark DW_TAG_variable DIEs at class scope for DWARF5+.
2021-02-09openacc: Add XFAILs [PR98979]Julian Brown4-4/+12
This patch adds some XFAILs for PR98979 until the patch to fix them has been approved. See: https://gcc.gnu.org/pipermail/gcc-patches/2021-February/564711.html gcc/testsuite/ PR fortran/98979 * gfortran.dg/goacc/array-with-dt-2.f90: Add expected errors. * gfortran.dg/goacc/derived-chartypes-1.f90: Skip ICEing test. * gfortran.dg/goacc/derived-chartypes-2.f90: Likewise. libgomp/ PR fortran/98979 * testsuite/libgomp.oacc-fortran/array-stride-dt-1.f90: Add expected errors.
2021-02-09Revert "openacc: Allow strided arrays in update directives"Julian Brown1-3/+2
This patch reverts the non-testsuite parts of commit 9a4d32f85ccebc0ee4b24e6d9d7a4f11c04d7146 which cause ICEs without the yet-to-be-approved patch here: https://gcc.gnu.org/pipermail/gcc-patches/2021-February/564711.html gcc/fortran/ PR fortran/98979 * openmp.c (resolve_omp_clauses): Omit OpenACC update in contiguity check and stride-specified error.
2021-02-10Daily bump.GCC Administrator6-1/+196
2021-02-09libstdc++: Add unordered containers heterogeneous lookupFrançois Dumont12-15/+1223
Add unordered containers heterogeneous lookup member functions find, count, contains and equal_range in C++20. Those members are considered for overload resolution only if hash and equal functors used to instantiate the container have a nested is_transparent type. libstdc++-v3/ChangeLog: * include/bits/stl_tree.h (__has_is_transparent, __has_is_transparent_t): Move... * include/bits/stl_function.h: ...here. * include/bits/hashtable_policy.h (_Hash_code_base<>::_M_hash_code_tr): New.. (_Hashtable_base<>::_M_equals_tr): New. * include/bits/hashtable.h (_Hashtable<>::_M_find_tr, _Hashtable<>::_M_count_tr, _Hashtable<>::_M_equal_range_tr): New member function templates to perform heterogeneous lookup. (_Hashtable<>::_M_find_before_node_tr): New. (_Hashtable<>::_M_find_node_tr): New. * include/bits/unordered_map.h (unordered_map::find<>, unordered_map::count<>, unordered_map::contains<>, unordered_map::equal_range<>): New member function templates to perform heterogeneous lookup. (unordered_multimap::find<>, unordered_multimap::count<>, unordered_multimap::contains<>, unordered_multimap::equal_range<>): Likewise. * include/bits/unordered_set.h (unordered_set::find<>, unordered_set::count<>, unordered_set::contains<>, unordered_set::equal_range<>): Likewise. (unordered_multiset::find<>, unordered_multiset::count<>, unordered_multiset::contains<>, unordered_multiset::equal_range<>): Likewise. * include/debug/unordered_map (unordered_map::find<>, unordered_map::equal_range<>): Likewise. (unordered_multimap::find<>, unordered_multimap::equal_range<>): Likewise. * include/debug/unordered_set (unordered_set::find<>, unordered_set::equal_range<>): Likewise. (unordered_multiset::find<>, unordered_multiset::equal_range<>): Likewise. * testsuite/23_containers/unordered_map/operations/1.cc: New test. * testsuite/23_containers/unordered_multimap/operations/1.cc: New test. * testsuite/23_containers/unordered_multiset/operations/1.cc: New test. * testsuite/23_containers/unordered_set/operations/1.cc: New test.
2021-02-09libstdc++: Remove execution branch in deque iterator operator-François Dumont1-12/+8
libstdc++-v3/ChangeLog: * include/bits/stl_deque.h (std::operator-(deque::iterator, deque::iterator)): Replace if/then with a null pointer test.
2021-02-09analyzer: support "_IO_"-prefixed variants of FILE * fns [PR98575]David Malcolm3-1/+35
PR analyzer/98575 describes an unexpected -Wanalyzer-malloc-leak false positive from gcc.dg/analyzer/pr94851-1.c on glibc < 2.28. The issue is that a getchar call gets inlined into a call to _IO_getc, and "_IO_getc" is not in the set of FILE * functions the analyzer "knows about". This exposes a bug in memory leak detection on code paths in which an unknown function has been called. The memory leak bug is fixed in the prior commit, but for good measure this patch special-cases the "_IO_"-prefixed names in glibc so that the analyzer can reuse its knowledge about the unprefixed variants. gcc/analyzer/ChangeLog: PR analyzer/98575 * sm-file.cc (is_file_using_fn_p): Support "_IO_"-prefixed variants. gcc/testsuite/ChangeLog: PR analyzer/98575 * gcc.dg/analyzer/file-1.c (test_5): New. * gcc.dg/analyzer/file-3.c: New test.
2021-02-09analyzer: treat pointers written to *UNKNOWN as escaping [PR98575]David Malcolm4-4/+115
PR analyzer/98575 describes an unexpected -Wanalyzer-malloc-leak false positive from gcc.dg/analyzer/pr94851-1.c on glibc < 2.28. The issue is that a getchar call gets inlined into a call to _IO_getc, and "_IO_getc" is not in the set of FILE * functions the analyzer "knows about". This leads to a global pointer struct buf *curbp; being treated as UNKNOWN after the call to _IO_getc. Later when a malloced pointer is written to curbp->b_amark, the write is discarded (since curbp is unknown) without noting that the pointer has escaped, and so the pointer is erroneously treated as leaking when the function returns. This patch updates the handling of *UNKNOWN to treat pointers written to them as having escaped, fixing the false positive. The patch stops the leak warning in gcc.dg/analyzer/explode-1.c. After merging states at the join-point after the first switch, pp has UNKNOWN value, and so *pp is a write through UNKNOWN, which with this patch is now treated as escaping - despite the fact that all possible values for *pp are on the stack. There doesn't seem to be a good way to fix this, and the testcase is an artifically constructed one, so the patch simply removes the dg-warning directive. gcc/analyzer/ChangeLog: PR analyzer/98575 * store.cc (store::set_value): Treat a pointer written to *UNKNOWN as having escaped. gcc/testsuite/ChangeLog: PR analyzer/98575 * gcc.dg/analyzer/explode-1.c: Remove expected leak warning. * gcc.dg/analyzer/pr94851-2.c: New test. * gcc.dg/analyzer/pr98575-1.c: New test.
2021-02-09Fix miscompilation of Python on HP-PA/LinuxEric Botcazou1-2/+19
This is the miscompilation of Python at -O2 on HP-PA/Linux present on the mainline and 10 branch, caused by the presence of a call to __builtin_unreachable () in the middle of a heavily branchy code, which confuses the reorg pass. gcc/ PR rtl-optimization/96015 * reorg.c (skip_consecutive_labels): Minor comment tweaks. (relax_delay_slots): When deleting a jump to the next active instruction over a barrier, first delete the barrier if the jump is the only way to reach the target label.
2021-02-09aarch64: fix vector multiplication costsAndre Vieira6-20/+67
This patch introduces a vect.mul RTX cost and decouples the vector multiplication costing from the scalar one. gcc/ChangeLog: 2021-02-09 Andre Vieira <andre.simoesdiasvieira@arm.com> * config/aarch64/aarch64-cost-tables.h: Add entries for vect.mul. * config/aarch64/aarch64.c (aarch64_rtx_mult_cost): Use vect.mul for vector multiplies and vect.alu for SSRA. * config/arm/aarch-common-protos.h (struct vector_cost_table): Define vect.mul cost field. * config/arm/aarch-cost-tables.h: Add entries for vect.mul. * config/arm/arm.c: Likewise. gcc/testsuite/ChangeLog: 2021-02-09 Andre Vieira <andre.simoesdiasvieira@arm.com> * gcc.target/aarch64/asimd-mul-to-shl-sub.c: New test.
2021-02-09testsuite: aarch64: Add tests for vpaddq intrinsicsJonathan Wright2-0/+136
Add tests for vpaddq_* Neon intrinsics. Since these intrinsics are only supported for AArch64, these tests are restricted to only run on AArch64 targets. gcc/testsuite/ChangeLog: 2021-02-09 Jonathan Wright <jonathan.wright@arm.com> * gcc.target/aarch64/advsimd-intrinsics/vpXXXq.inc: New test template. * gcc.target/aarch64/advsimd-intrinsics/vpaddq.c: New test.
2021-02-09libstdc++: Clear up directories created by testsJonathan Wakely2-0/+4
libstdc++-v3/ChangeLog: * testsuite/27_io/filesystem/operations/remove_all.cc: Remove test directory after making it writable again. * testsuite/experimental/filesystem/operations/remove_all.cc: Likewise.
2021-02-09c++: Fix indirect partitions [PR 98944]Nathan Sidwell5-11/+45
The most recent reimplementation of module loading initialization changed the behaviour of setting an import's location, and broke some partition handling. PR c++/98944 gcc/cp/ * module.cc (module_state::is_rooted): Rename to ... (module_state::has_location): ... here. Adjust callers. (module_state::read_partitions): Adjust validity check. Don't overwrite a known location. gcc/testsuite/ * g++.dg/modules/pr98944_a.C: New. * g++.dg/modules/pr98944_b.C: New. * g++.dg/modules/pr98944_c.C: New. * g++.dg/modules/pr98944_d.C: New.
2021-02-09libstdc++: Make coroutine_handle<_Promise>::from_address() noexcept [PR 99021]Jonathan Wakely1-1/+1
The coroutine_handle<void>::from_address(void*) version is already noexcept, and they do the same thing. Make them consistent. libstdc++-v3/ChangeLog: PR libstdc++/99021 * include/std/coroutine (coroutine_handle<P>::from_address): Add noexcept.
2021-02-09libstdc++: Fix build failure for targets without unistd.hVladimir Vishnevsky2-2/+1
The patch fixes build issues occurring if build parameter "--enable-cstdio=stdio_pure" is specified and no unistd.h is present in the environment. libstdc++-v3/ChangeLog: * include/ext/stdio_sync_filebuf.h: Remove unused <unistd.h>. * src/c++17/fs_ops.cc (fs::permissions): Qualify mode_t.
2021-02-09Fix O(region-size) unwind in VNRichard Biener2-15/+18
This fixes the currently O(region-size) unwinding of avail info to be O(unwind-size) by tracking a linked-list stack of pushed avails. This reduces the compile-time spent in complete unrolling for WRF. 2021-02-09 Richard Biener <rguenther@suse.de> PR tree-optimization/98863 * tree-ssa-sccvn.h (vn_avail::next_undo): Add. * tree-ssa-sccvn.c (last_pushed_avail): New global. (rpo_elim::eliminate_push_avail): Chain pushed avails. (unwind_state::avail_top): Add. (do_unwind): Rewrite unwinding of avail entries. (do_rpo_vn): Initialize last_pushed_avail and avail_top of the undo state.
2021-02-09string: Add a workaround for -Wstringop-overread false positives [PR98465]Jakub Jelinek2-1/+18
In the PR there are several possibilities how to improve _M_disjunct at least in certain cases so that the compiler can figure out at least in some cases where __s is provably disjunct from _M_data() ... _M_data() + this->size() but it is probably GCC 12 material. The false positive warning is on this particular copy, which is done for non-disjunct pointers when __len2 > __len1 and the __s >= __p + __len1, i.e. __s used to point to the characters moved through _S_move a few lines earlier by __len2 - __len1 characters up to make space. That is why the _S_copy source is __s + __len2 - __len1. Unfortunately, when the compiler can't prove objects are disjunct, that copying from __s + __len2 - __len1 of __len2 characters can very well mean accessing characters the source object (if it is not disjunct) provably can't have. The following patch works around that by making the _S_copy be a __p based pointer instead of __s based pointer. __s + __len2 - __len1 and __p + (__s - __p) + (__len2 - __len1) have the same value and the latter may seem to be uselessly longer, but it seems at least currently in GIMPLE we keep it that way and so that is what the warning code during expansion will see, and only actually optimize it to __s + __len2 - __len1 during RTL when we lose information on what is a pointer and what is a mere offset with the same mode. So, in the end we emit exactly the same assembly, just without the false positive warning. 2021-02-09 Jakub Jelinek <jakub@redhat.com> PR middle-end/98465 * include/bits/basic_string.tcc (basic_string::_M_replace): When __s points to the characters moved by earlier _S_move, compute the source address using expression based on the __p pointer rather than __s pointer. * g++.dg/warn/Wstringop-overread-1.C: New test.
2021-02-09calls: Fix a memory leak in maybe_warn_rdwr_sizes [PR99004]Jakub Jelinek1-2/+4
The print_generic_expr_to_str function ends with return xstrdup (...); and therefore expects the caller to free the argument. The following patch does that after it has been copied. Instead of doing const_cast to cast away const char * to char *, because the code uses s0 and s1 in so few places, I chose just to change the types of the two variables so that const_cast is not needed. After all, it is a heap allocated string that this function owns and so if it wanted, it could change it too. 2021-02-09 Jakub Jelinek <jakub@redhat.com> PR middle-end/99004 * calls.c (maybe_warn_rdwr_sizes): Change s0 and s1 type from const char * to char * and free those pointers after use.
2021-02-09tree-optimization/99017 - be more forgiving in BB vect costingRichard Biener1-3/+2
This works around a SLP graph partitioning or cost collecting issue by being more forgiving in vect_bb_vectorization_profitable_p. 2021-02-09 Richard Biener <rguenther@suse.de> PR tree-optimization/99017 * tree-vect-slp.c (vect_bb_vectorization_profitable_p): Allow zero vector cost entries.
2021-02-08c++: consteval and explicit instantiation [PR96905]Jason Merrill2-0/+25
Normally, an explicit instantiation means we want to write out the instantiation. But not for a consteval function. gcc/cp/ChangeLog: PR c++/96905 * pt.c (mark_decl_instantiated): Exit early if consteval. gcc/testsuite/ChangeLog: PR c++/96905 * g++.dg/cpp2a/consteval-expinst1.C: New test.
2021-02-08c++: generic lambda, fn* conv, empty class [PR98326]Jason Merrill2-0/+21
Here, in the thunk returned from the captureless lambda conversion to pointer-to-function, we try to pass through invisible reference parameters by reference, without doing a copy. The empty class copy optimization was messing that up. gcc/cp/ChangeLog: PR c++/98326 PR c++/20408 * cp-gimplify.c (simple_empty_class_p): Don't touch an invisiref parm. gcc/testsuite/ChangeLog: PR c++/98326 * g++.dg/cpp1y/lambda-generic-empty1.C: New test.
2021-02-08c++: constexpr, union, and no_unique_address [PR98994]Jason Merrill2-1/+13
My second patch for 97566 omits nested CONSTRUCTORs for empty fields, but we do want them for empty union members. gcc/cp/ChangeLog: PR c++/98994 PR c++/97566 * constexpr.c (cxx_eval_store_expression): Only skip empty fields in RECORD_TYPE. gcc/testsuite/ChangeLog: PR c++/98994 * g++.dg/cpp2a/no_unique_address12.C: New test.
2021-02-09Daily bump.GCC Administrator5-1/+87
2021-02-08c++: cleanup function name [PR 98531]Nathan Sidwell7-9/+50
The next piece of 98531 is that in some cases we need to create a cleanup function to do the work (when the object is an array, or we're using regular atexit). We were not pushing that function's decl anywhere (not giving it a context) so streaming it failed. This is a partial fix. You'll notice we're naming these from a per-TU counter. I've captured that in PR98893. gcc/cp/ * decl.c (start_cleanup_fn): Push function into namespace. gcc/testsuite/ * g++.dg/modules/pr98531-2.h: New. * g++.dg/modules/pr98531-2_a.H: New. * g++.dg/modules/pr98531-2_b.C: New. * g++.dg/modules/pr98531-3.h: New. * g++.dg/modules/pr98531-3_a.H: New. * g++.dg/modules/pr98531-3_b.C: New.
2021-02-08c++: cross-module __cxa_atexit use [PR 98531]Nathan Sidwell10-28/+167
The compiler's use of lazily-declared library functions must insert said functions into a symbol table, so that they can be correctly merged across TUs at the module-level. We have too many different ways of declaring such library functions. This fixes __cxa_atexit (or its system-specific variations), pushing (or merging) the decl into the appropriate namespace. Because we're pushing a lazy builtin, check_redeclaration_exception_specification needed a tweak to allow a such a builtin's eh spec to differ from what the user may have already declared. (I suspect no all headers declare atexit as noexcept.) We can't test the -fno-use-cxa-atexit path with modules, as that requires a followup patch to a closely related piece (which also affects cxa_atexit targets in other circumstances). PR c++/98531 gcc/cp/ * cp-tree.h (push_abi_namespace, pop_abi_namespace): Declare. * decl.c (push_abi_namespace, pop_abi_namespace): Moved from rtti.c, add default namespace arg. (check_redeclaration_exception_specification): Allow a lazy builtin's eh spec to differ from an lready-declared user declaration. (declare_global_var): Use push/pop_abi_namespace. (get_atexit_node): Push the fndecl into a namespace. * rtti.c (push_abi_namespace, pop_abi_namespace): Moved to decl.c. gcc/testsuite/ * g++.dg/modules/pr98531-1.h: New. * g++.dg/modules/pr98531-1_a.H: New. * g++.dg/modules/pr98531-1_b.C: New. * g++.dg/abi/pr98531-1.C: New. * g++.dg/abi/pr98531-2.C: New. * g++.dg/abi/pr98531-3.C: New. * g++.dg/abi/pr98531-4.C: New.
2021-02-08mklog: automatically fill in generated entriesMike Frysinger1-0/+5
contrib/ChangeLog: * mklog.py (generated_files): New set. (generate_changelog): Add entries based on generated_files.
2021-02-08c++: Fix typo in CLASSTYPE_TI_TEMPLATE comment.Marek Polacek1-2/+2
gcc/cp/ChangeLog: * cp-tree.h (CLASSTYPE_TI_TEMPLATE): Fix typo.
2021-02-08middle-end/98974 - fixup after STMT_VINFO_VEC_STMTS reworkAndre Vieira2-1/+21
This fixes up the nvectors parameter passed to vect_get_loop_mask in vectorizable_condition after the STMT_VINFO_VEC_STMTS rework. gcc/ChangeLog: 2021-02-08 Andre Vieira <andre.simoesdiasvieira@arm.com> PR middle-end/98974 * tree-vect-stmts.c (vectorizable_condition): Remove shadow vec_num parameter in vectorizable_condition. gcc/testsuite/ChangeLog: 2021-02-08 Andre Vieira <andre.simoesdiasvieira@arm.com> PR middle-end/98974 * gfortran.dg/pr98974.F90: New test.
2021-02-08lto/96591 - walk VECTOR_CST elements in walk_treeRichard Biener2-1/+57
This implements walking of VECTOR_CST elements in walk_tree, mimicing the walk of COMPLEX_CST elements. Without this free-lang-data fails to see some types in case they are only refered to via tree constants used only as VECTOR_CST elements. 2021-02-08 Richard Biener <rguenther@suse.de> PR lto/96591 * tree.c (walk_tree_1): Walk VECTOR_CST elements. * g++.dg/lto/pr96591_0.C: New testcase.
2021-02-08opts: fix handling of -fpatchable-function-entries optionMartin Liska5-36/+55
gcc/ChangeLog: PR lto/98971 * cfgexpand.c (pass_expand::execute): Parse per-function option flag_patchable_function_entry and use it. * common.opt: Remove function_entry_patch_area_size and function_entry_patch_area_start global variables. * opts.c (parse_and_check_patch_area): New function. (common_handle_option): Use it. * opts.h (parse_and_check_patch_area): New function. * toplev.c (process_options): Parse and use function_entry_patch_area_size.
2021-02-07Correct typos in attribute malloc documentation.Martin Sebor1-8/+10
gcc/ChangeLog: * doc/extend.texi (attribute malloc): Correct typos.