summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2022-05-27Update ChangeLog and version files for releasereleases/gcc-9.5.0releases/gcc-9Richard Biener
2022-05-27Revert "libcpp: Fix up ##__VA_OPT__ handling [PR89971]"Richard Biener
This reverts commit 86b98701bf927ea438354723932e623557c04e42.
2022-05-27Daily bump.GCC Administrator
2022-05-26Daily bump.GCC Administrator
2022-05-25Daily bump.GCC Administrator
2022-05-24Daily bump.GCC Administrator
2022-05-23Daily bump.GCC Administrator
2022-05-22Daily bump.GCC Administrator
2022-05-21Daily bump.GCC Administrator
2022-05-20Daily bump.GCC Administrator
2022-05-19Daily bump.GCC Administrator
2022-05-18Daily bump.GCC Administrator
2022-05-17Daily bump.GCC Administrator
2022-05-16Fortran: fix error recovery on invalid array sectionHarald Anlauf
gcc/fortran/ChangeLog: PR fortran/105230 * expr.c (find_array_section): Correct logic to avoid NULL pointer dereference on invalid array section. gcc/testsuite/ChangeLog: PR fortran/105230 * gfortran.dg/pr105230.f90: New test. Co-authored-by: Steven G. Kargl <kargl@gcc.gnu.org> (cherry picked from commit 0acdbe29f66017fc5cca40dcbd72a0dd41491d07)
2022-05-16Fortran: improve error recovery on invalid array sectionHarald Anlauf
gcc/fortran/ChangeLog: PR fortran/104849 * expr.c (find_array_section): Avoid NULL pointer dereference on invalid array section. gcc/testsuite/ChangeLog: PR fortran/104849 * gfortran.dg/pr104849.f90: New test. (cherry picked from commit 22015e77d3e45306077396b9de8a8a28bb67fb20)
2022-05-16Fortran: a RECURSIVE procedure cannot be an INTRINSICHarald Anlauf
gcc/fortran/ChangeLog: PR fortran/105138 * intrinsic.c (gfc_is_intrinsic): When a symbol refers to a RECURSIVE procedure, it cannot be an INTRINSIC. gcc/testsuite/ChangeLog: PR fortran/105138 * gfortran.dg/recursive_reference_3.f90: New test. Co-authored-by: Steven G. Kargl <kargl@gcc.gnu.org> (cherry picked from commit d46685b04071a485b56de353d997a866bfc8caba)
2022-05-16libstdc++: Fix status docs for <bit> supportJonathan Wakely
libstdc++-v3/ChangeLog: * doc/html/manual/status.html: Regenerate. * doc/xml/manual/status_cxx2020.xml: Fix supported version for C++20 bit operations and power-of-two operations. (cherry picked from commit 64648821f151b0f86e16185bef7f0be5635fd737)
2022-05-16[AArch64] add barriers to ool __sync builtinsSebastian Pop
2022-05-13 Sebastian Pop <spop@amazon.com> gcc/ PR target/105162 * config/aarch64/aarch64-protos.h (atomic_ool_names): Increase dimension of str array. * config/aarch64/aarch64.c (aarch64_atomic_ool_func): Call memmodel_from_int and handle MEMMODEL_SYNC_*. (DEF0): Add __aarch64_*_sync functions. gcc/testsuite/ PR target/105162 * gcc.target/aarch64/sync-comp-swap-ool.c: New. * gcc.target/aarch64/sync-op-acquire-ool.c: New. * gcc.target/aarch64/sync-op-full-ool.c: New. * gcc.target/aarch64/target_attr_20.c: Update check. * gcc.target/aarch64/target_attr_21.c: Same. libgcc/ PR target/105162 * config/aarch64/lse.S: Define BARRIER and handle memory MODEL 5. * config/aarch64/t-lse: Add a 5th memory model for _sync functions.
2022-05-16Daily bump.GCC Administrator
2022-05-15Daily bump.GCC Administrator
2022-05-14Daily bump.GCC Administrator
2022-05-13c++: static memfn from non-dependent base [PR101078]Jason Merrill
After my patch for PR91706, or before that with the qualified call, tsubst_baselink returned a BASELINK with BASELINK_BINFO indicating a base of a still-dependent derived class. We need to look up the relevant base binfo in the substituted class. PR c++/101078 gcc/cp/ChangeLog: * pt.c (tsubst_baselink): Update binfos in non-dependent case. gcc/testsuite/ChangeLog: * g++.dg/template/access39.C: New test.
2022-05-13c++: extern template and static data member [PR99066]Jason Merrill
'extern template' should mean that the relevant symbols are never emitted. But in this case we were assuming that DECL_EXTERNAL was already set on the variable, so we just needed to clear DECL_NOT_REALLY_EXTERN. Since DECL_EXTERNAL was not set, we emitted a definition of npos. gcc/cp/ChangeLog: PR c++/99066 * pt.c (mark_decl_instantiated): Set DECL_EXTERNAL. gcc/testsuite/ChangeLog: PR c++/99066 * g++.dg/cpp0x/extern_template-6.C: New test.
2022-05-13c++: missing dtor with -fno-elide-constructors [PR100838]Jason Merrill
tf_no_cleanup only applies to the outermost TARGET_EXPR, and we already clear it for nested calls in build_over_call, but in this case both constructor calls came from convert_like, so we need to clear it in the recursive call as well. This revealed that we were adding an extra ck_rvalue in direct-initialization cases where it was wrong. PR c++/100838 PR c++/105265 gcc/cp/ChangeLog: * call.c (convert_like_internal): Clear tf_no_cleanup when recursing. (build_user_type_conversion_1): Only add ck_rvalue if LOOKUP_ONLYCONVERTING. gcc/testsuite/ChangeLog: * g++.dg/init/no-elide2.C: New test. * g++.dg/cpp0x/initlist-new6.C: New test.
2022-05-13c++: NRV in lambda in template [PR91217]Jason Merrill
tsubst_lambda_expr was producing a function with two blocks that claimed to be the outermost block in the function body, one from the call to start_lambda_function in tsubst_lambda_expr, and one from tsubsting the block added by start_lambda_function when we first parsed the lambda. This messed with the named return value optimization, which only works for variables in the outermost block. gcc/cp/ChangeLog: PR c++/91217 * pt.c (tsubst_lambda_expr): Skip the body block from DECL_SAVED_TREE. gcc/testsuite/ChangeLog: PR c++/91217 * g++.dg/opt/nrv20.C: New test.
2022-05-13c++: array new initialized from a call [PR99643]Jason Merrill
Here the get_foo() call results in a TARGET_EXPR, which we strip in massage_init_elt, but then when build_vec_init tries to use it to initialize the array element we crash because build_aggr_init expects a class rvalue to have a TARGET_EXPR. So don't strip it. The stripping was added in r206639 for PR59659, so I checked that removing it didn't significantly increase compile time or memory usage for that testcase; compile time was unaffected, memory usage increased by 0.00004%. gcc/cp/ChangeLog: PR c++/99643 * typeck2.c (massage_init_elt): Don't strip TARGET_EXPR. gcc/testsuite/ChangeLog: PR c++/99643 * g++.dg/cpp0x/initlist-new5.C: New test.
2022-05-13c++: alignment of local typedef in template [PR65211]Jason Merrill
Because common_handle_aligned_attribute only applies the alignment to the TREE_TYPE of a typedef, not the DECL_ORIGINAL_TYPE, we need to copy it explicitly in tsubst. PR c++/65211 gcc/cp/ChangeLog: * pt.c (tsubst_decl) [TYPE_DECL]: Copy TYPE_ALIGN. gcc/testsuite/ChangeLog: * g++.target/i386/vec-tmpl1.C: New test.
2022-05-13c++: template conversion op [PR101698]Jason Merrill
Asking for conversion to a dependent type also makes a BASELINK dependent. PR c++/101698 gcc/cp/ChangeLog: * pt.c (tsubst_baselink): Also check dependent optype. gcc/testsuite/ChangeLog: * g++.dg/template/conv19.C: New test.
2022-05-13c++: NRV and ref-extended temps [PR101442]Jason Merrill
This issue goes back to r83221, where the cleanup for extended ref temps changed from being unconditional to being tied to the declaration they formed part of the initializer for. The named return value optimization changes the cleanup for the NRV variable to only run on the EH path; we don't want that change to affect temporary cleanups. The perform_member_init change isn't necessary (there 'decl' is a COMPONENT_REF), it's just for consistency. PR c++/101442 gcc/cp/ChangeLog: * decl.c (cp_finish_decl): Don't pass decl to push_cleanup. * init.c (perform_member_init): Likewise. * semantics.c (push_cleanup): Adjust comment. gcc/testsuite/ChangeLog: * g++.dg/cpp0x/initlist-nrv1.C: New test.
2022-05-13c++: operator new lookup [PR98249]Jason Merrill
The standard says, as we quote in the comment just above, that if we don't find operator new in the allocated type, it should be looked up in the global scope. This is specifically ::, not just any namespace, and we already give an error for an operator new declared in any other namespace. PR c++/98249 gcc/cp/ChangeLog: * call.c (build_operator_new_call): Just look in ::. gcc/testsuite/ChangeLog: * g++.dg/lookup/new3.C: New test.
2022-05-13c++: constexpr trivial -fno-elide-ctors [PR104646]Jason Merrill
The constexpr constructor checking code got confused by the expansion of a trivial copy constructor; we don't need to do that checking for defaulted ctors, anyway. PR c++/104646 gcc/cp/ChangeLog: * constexpr.c (maybe_save_constexpr_fundef): Don't do extra checks for defaulted ctors. gcc/testsuite/ChangeLog: * g++.dg/cpp0x/constexpr-fno-elide-ctors1.C: New test.
2022-05-13c++: assignment to temporary [PR59950]Jason Merrill
Given build_this of a TARGET_EXPR, cp_build_fold_indirect_ref returns the TARGET_EXPR. But that's the wrong value category for the result of the defaulted class assignment operator, which returns an lvalue, so we need to actually build the INDIRECT_REF. PR c++/59950 gcc/cp/ChangeLog: * call.c (build_over_call): Use cp_build_indirect_ref. gcc/testsuite/ChangeLog: * g++.dg/init/assign2.C: New test.
2022-05-13c++: C++17 constexpr static data member linkage [PR99901]Jason Merrill
C++17 makes constexpr static data members implicitly inline variables. In C++14, a subsequent out-of-class declaration is the definition. We want to continue emitting a symbol for such a declaration in C++17 mode, for ABI compatibility with C++14 code that wants to refer to it. Normally I'd distinguish in- and out-of-class declarations by looking at DECL_IN_AGGR_P, but we never set DECL_IN_AGGR_P on inline variables. I think that's wrong, but don't want to mess with it so close to release. Conveniently, we already have a test for in-class declaration earlier in the function. gcc/cp/ChangeLog: PR c++/99901 * decl.c (cp_finish_decl): mark_needed an implicitly inline static data member with an out-of-class redeclaration. gcc/testsuite/ChangeLog: PR c++/99901 * g++.dg/cpp1z/inline-var9.C: New test.
2022-05-13c++: nested generic lambda in DMI [PR101717]Jason Merrill
We were already checking COMPLETE_TYPE_P to recognize instantiation of a generic lambda, but didn't consider that we might be nested in a non-generic lambda. PR c++/101717 gcc/cp/ChangeLog: * lambda.c (lambda_expr_this_capture): Check all enclosing lambdas for completeness. gcc/testsuite/ChangeLog: * g++.dg/cpp1y/lambda-generic-this4.C: New test.
2022-05-13c++: PMF template parm and noexcept [PR90664]Jason Merrill
The constexpr code only wants to preserve PTRMEM_CST in conversions if the conversions are only qualification conversions; dropping noexcept counts as a qualification adjustment in overload resolution, so let's include it here. gcc/cp/ChangeLog: PR c++/90664 * cvt.c (can_convert_qual): Check fnptr_conv_p. gcc/testsuite/ChangeLog: PR c++/90664 * g++.dg/cpp1z/noexcept-type24.C: New test.
2022-05-13c++: lambda in DMI in class template [PR95870]Jason Merrill
Here enclosing_instantiation_of was failing to find a match because otctx is struct S<T> and current_function_decl is S<int>::S(), so the latter has more function contexts, and we end up trying to compare S() to NULL_TREE. After spending a bit of time working on establishing the correspondence in this case (class <=> constructor), it occurred to me that we could just use DECL_SOURCE_LOCATION, which is unique for lambdas, since they cannot be redeclared. Since we're so close to release, for now I'm only doing this for the case that was failing before. gcc/cp/ChangeLog: PR c++/95870 * pt.c (enclosing_instantiation_of): Compare DECL_SOURCE_LOCATION if there is no enclosing non-lambda function. gcc/testsuite/ChangeLog: PR c++/95870 * g++.dg/cpp0x/lambda/lambda-nsdmi10.C: New test.
2022-05-13c++: -Wunused, constant, and generic lambda [PR96311]Jason Merrill
We never called mark_use for a return value in a function with dependent return type. In that situation we don't know if the use is as an rvalue or lvalue, but we can use mark_exp_read instead. gcc/cp/ChangeLog: PR c++/96311 * typeck.c (check_return_expr): Call mark_exp_read in dependent case. gcc/testsuite/ChangeLog: PR c++/96311 * g++.dg/cpp1y/lambda-generic-Wunused.C: New test.
2022-05-13c++: access checking in aggregate initialization [PR96673]Jason Merrill
We were deferring access checks while parsing B<int>{}, didn't adjust that when we went to instantiate the default member initializer for B::c, deferred access checking for C::C, and then checked it after parsing B<int>{}, back in the main() context which has no access. We need to do the access checks in the class context of the DMI. I tried fixing this in push_to/pop_from_top_level, but that caused several regressions. gcc/cp/ChangeLog: PR c++/96673 * init.c (get_nsdmi): Don't defer access checking. gcc/testsuite/ChangeLog: PR c++/96673 * g++.dg/cpp1y/nsdmi-aggr13.C: New test.
2022-05-13c++: constexpr, inheritance, and local class [PR91933]Jason Merrill
Here we complained about referring to nm3 from the local class member function because referring to the base class subobject involved taking the variable's address. Let's shortcut this case to avoid that. gcc/cp/ChangeLog: PR c++/91933 * class.c (build_base_path): Shortcut simple non-pointer case. gcc/testsuite/ChangeLog: PR c++/91933 * g++.dg/cpp0x/constexpr-base7.C: New test.
2022-05-13c++: alias template equivalence and cv-quals [PR100032]Jason Merrill
We also need to check that the cv-qualifiers are the same. gcc/cp/ChangeLog: PR c++/100032 * pt.c (get_underlying_template): Compare TYPE_QUALS. gcc/testsuite/ChangeLog: PR c++/100032 * g++.dg/cpp0x/alias-decl-equiv1.C: New test.
2022-05-13re PR c++/67184 (Missed optimization with C++11 final specifier)Jakub Jelinek
PR c++/67184 PR c++/69445 * call.c (build_new_method_call_1): Remove set but not used variable binfo.
2022-05-13c++: fix testcasesJason Merrill
Only the first dg-error in constexpr-array23.C needs to be xfailed on the 9 branch. lambda-pack-init6.C depends on the fix for PR94546; rather than backport that as well, let's remove the test. gcc/testsuite/ChangeLog: * g++.dg/cpp0x/constexpr-array23.C: Remove xfail. * g++.dg/cpp2a/lambda-pack-init6.C: Removed.
2022-05-13Daily bump.GCC Administrator
2022-05-12Daily bump.GCC Administrator
2022-05-11testsuite: Fix up pr102860.f90 for gcc 9 [PR105570]Jakub Jelinek
Apparently -mcpu=power10 is gcc 10+, but the PR102860 change otherwise made sense also for 9.x. So just adjusting testcase... 2022-05-11 Jakub Jelinek <jakub@redhat.com> PR middle-end/102860 PR testsuite/105570 * gfortran.dg/pr102860.f90: Use -mcpu=power9 instead of -mcpu=power10.
2022-05-11c++: ICE when building builtin operator->* set [PR103455]Patrick Palka
Here when constructing the builtin operator->* candidate set according to the available conversion functions for the operand types, we end up considering a candidate with C1=T (through B's dependent conversion function) and C2=F, during which we crash from DERIVED_FROM_P because dependent_type_p sees a TEMPLATE_TYPE_PARM outside of a template context. Sidestepping the question of whether we should be considering such a dependent conversion function here in the first place, it seems futile to test DERIVED_FROM_P for anything other than an actual class type, so this patch fixes this ICE by simply guarding the DERIVED_FROM_P test with CLASS_TYPE_P instead of MAYBE_CLASS_TYPE_P. PR c++/103455 gcc/cp/ChangeLog: * call.c (add_builtin_candidate) <case MEMBER_REF>: Test CLASS_TYPE_P instead of MAYBE_CLASS_TYPE_P. gcc/testsuite/ChangeLog: * g++.dg/overload/builtin6.C: New test. (cherry picked from commit 04f19580e8dbdbc7366d0f5fd068aa0cecafdc9d)
2022-05-11c++: deleted fn and noexcept inst [PR101532, PR104225]Patrick Palka
Here when attempting to use B's implicitly deleted default constructor, mark_used rightfully returns false, but for the wrong reason: it tries to instantiate the synthesized noexcept specifier which then only silently fails because get_defaulted_eh_spec suppresses diagnostics for deleted functions. This lack of diagnostics causes us to crash on the first testcase below (thanks to the assert in finish_expr_stmt), and silently accept the second testcase. To fix this, this patch makes mark_used avoid attempting to instantiate the noexcept specifier of a deleted function, so that we'll instead directly reject (and diagnose) the function due to its deletedness. PR c++/101532 PR c++/104225 gcc/cp/ChangeLog: * decl2.c (mark_used): Don't consider maybe_instantiate_noexcept on a deleted function. gcc/testsuite/ChangeLog: * g++.dg/cpp0x/nsdmi-template21.C: New test. * g++.dg/cpp0x/nsdmi-template21a.C: New test. (cherry picked from commit bc90dd0ecf02e11d47d1af7f627e2e2acaa40106)
2022-05-11c++: Fix deduction with reference NTTP [PR83476]Patrick Palka
In the testcase ref11.C below, during deduction for the call f(a), uses_deducible_template_parms returns false for the dependent specialization A<V> because the generic template argument V here is wrapped in an implicit INDIRECT_REF (formed from template_parm_to_arg). Since uses_deducible_template_parms returns false, unify_one_argument exits early without ever attempting to deduce 'n' for 'V'. This patch fixes this by making deducible_expression look through such implicit INDIRECT_REFs. gcc/cp/ChangeLog: PR c++/83476 PR c++/99885 * pt.c (deducible_expression): Look through implicit INDIRECT_REFs as well. gcc/testsuite/ChangeLog: PR c++/83476 PR c++/99885 * g++.dg/cpp1z/class-deduction85.C: New test. * g++.dg/template/ref11.C: New test. (cherry picked from commit 2ccc05a5141506fde0e20dec702c717fd67bf6ee)
2022-05-11g++.dg/gomp/clause-3.C: Fix - missing in r12-438-g1580fc7 [PR100422]Tobias Burnus
gcc/testsuite/ PR testsuite/100422 * g++.dg/gomp/clause-3.C: Use 'reduction(&:..)' instead of '...(&&:..)'. (cherry picked from commit af4e4d35f0b84d7c2f57a7b682a09116e9911142)
2022-05-11asan: Fix up asan_redzone_buffer::emit_redzone_byte [PR105396]Jakub Jelinek
On the following testcase, we have in main's frame 3 variables, some red zone padding, 4 byte d, followed by 12 bytes of red zone padding, then 8 byte b followed by 24 bytes of red zone padding, then 40 bytes c followed by some red zone padding. The intended content of shadow memory for that is (note, each byte describes 8 bytes of memory): f1 f1 f1 f1 04 f2 00 f2 f2 f2 00 00 00 00 00 f3 f3 f3 f3 f3 left red d mr b middle r c right red zone f1 is left red zone magic f2 is middle red zone magic f3 is right red zone magic 00 when all 8 bytes are accessible 01-07 when only 1 to 7 bytes are accessible followed by inaccessible bytes The -fdump-rtl-expand-details dump makes it clear that it misbehaves: Flushing rzbuffer at offset -160 with: f1 f1 f1 f1 Flushing rzbuffer at offset -128 with: 04 f2 00 00 Flushing rzbuffer at offset -128 with: 00 00 00 f2 Flushing rzbuffer at offset -96 with: f2 f2 00 00 Flushing rzbuffer at offset -64 with: 00 00 00 f3 Flushing rzbuffer at offset -32 with: f3 f3 f3 f3 In the end we end up with f1 f1 f1 f1 00 00 00 f2 f2 f2 00 00 00 00 00 f3 f3 f3 f3 f3 shadow bytes because at offset -128 there are 2 overlapping stores as asan_redzone_buffer::emit_redzone_byte has flushed the temporary 4 byte buffer in the middle. The function is called with an offset and value. If the passed offset is consecutive with the prev_offset + buffer size (off == offset), then we handle it correctly, similarly if the new offset is far enough from the old one (we then flush whatever was in the buffer and if needed add up to 3 bytes of 00 before actually pushing value. But what isn't handled correctly is when the offset isn't consecutive to what has been added last time, but it is in the same 4 byte word of shadow memory (32 bytes of actual memory), like the above case where we have consecutive 04 f2 and then skip one shadow memory byte (aka 8 bytes of real memory) and then want to emit f2. Emitting that as a store of little-endian 0x0000f204 followed by a store of 0xf2000000 to the same address doesn't work, we want to emit 0xf200f204. The following patch does that by pushing 1 or 2 00 bytes. Additionally, as a small cleanup, instead of using m_shadow_bytes.safe_push (value); flush_if_full (); in all of if, else if and else bodies it sinks those 2 stmts to the end of function as all do the same thing. 2022-04-27 Jakub Jelinek <jakub@redhat.com> PR sanitizer/105396 * asan.c (asan_redzone_buffer::emit_redzone_byte): Handle the case where offset is bigger than off but smaller than m_prev_offset + 32 bits by pushing one or more 0 bytes. Sink the m_shadow_bytes.safe_push (value); flush_if_full (); statements from all cases to the end of the function. * gcc.dg/asan/pr105396.c: New test. (cherry picked from commit 9715f10c0651c9549b479b69d67be50ac4bd98a6)