aboutsummaryrefslogtreecommitdiff
path: root/gcc
AgeCommit message (Collapse)AuthorFilesLines
2020-12-05Daily bump.GCC Administrator4-1/+181
2020-12-04runtime: update type descriptor name in fieldtrack C support codeIan Lance Taylor1-1/+1
We were using the old name, but nothing noticed because it is a weak reference that is permitted to be nil, so that it works with code that does not use the field tracking library. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/275449
2020-12-04c++: Fix deduction from auto template parameter [PR93083]Jason Merrill2-5/+86
The check in do_class_deduction to handle passing one class placeholder template parm as an argument for itself needed to be extended to also handle equivalent parms from other templates. gcc/cp/ChangeLog: PR c++/93083 * pt.c (convert_template_argument): Handle equivalent placeholders. (do_class_deduction): Look through EXPR_PACK_EXPANSION, too. gcc/testsuite/ChangeLog: PR c++/93083 * g++.dg/cpp2a/nontype-class40.C: New test.
2020-12-04vec: Simplify use with C++11 range-based 'for'.Jason Merrill5-8/+14
It looks cleaner if we can use a vec* directly as a range for the C++11 range-based 'for' loop, without needing to indirect from it, and also works with null pointers. The change in cp_parser_late_parsing_default_args is an example of how this can be used to simplify a simple loop over a vector. Reverse or subset iteration will require adding range adaptors. I deliberately didn't format the new overloads for etags since they are trivial. gcc/ChangeLog: * vec.h (begin, end): Add overloads for vec*. * tree.c (build_constructor_from_vec): Remove *. gcc/cp/ChangeLog: * decl2.c (clear_consteval_vfns): Remove *. * pt.c (do_auto_deduction): Remove *. * parser.c (cp_parser_late_parsing_default_args): Change loop to use range 'for'.
2020-12-04rs6000: fix PTR_SIZE in rs6000.cDavid Edelsohn1-1/+1
The recent change to rs6000.c for DWARF in AIX references the macro PTR_SIZE that only is defined in dwarf2out.c. This patch changes the reference to the equivalent POINTER_SIZE_UNITS defined in defaults.h. gcc/ChangeLog: * config/rs6000/rs6000.c (rs6000_option_override_internal): Change PTR_SIZE to POINTER_SIZE_UNITS.
2020-12-04doc/implement-c.texi: About same-as-scalar-type volatile aggregate accesses, ↵Hans-Peter Nilsson1-0/+5
PR94600 We say very little about reads and writes to aggregate / compound objects, just scalar objects (i.e. assignments don't cause reads). Let's lets say something safe about aggregate objects, but only for those that are the same size as a scalar type. There's an equal-sounding section (Volatiles) in extend.texi, but this seems a more appropriate place, as specifying the behavior of a standard qualifier. gcc: 2020-12-04 Hans-Peter Nilsson <hp@axis.com> Martin Sebor <msebor@redhat.com> PR middle-end/94600 * doc/implement-c.texi (Qualifiers implementation): Add blurb about access to the whole of a volatile aggregate object, only for same-size as a scalar object.
2020-12-04gimple: Return fnspec only for replaceable new/delete operators called from ↵Jakub Jelinek2-1/+27
new/delete [PR98130] As mentioned in the PR, we shouldn't treat non-replaceable operator new/delete (e.g. with the placement new) as replaceable ones. There is some pending discussion that perhaps operator delete called from delete if not replaceable should return some other fnspec, but can we handle that incrementally, fix this wrong-code and then deal with a missed optimization? I really don't know what exactly should be returned. 2020-12-04 Jakub Jelinek <jakub@redhat.com> PR c++/98130 * gimple.c (gimple_call_fnspec): Only return ".co " for replaceable operator delete or ".mC" for replaceable operator new called from new/delete. * g++.dg/opt/pr98130.C: New test.
2020-12-04i386: Add combine splitters to allow combining multiple insns into reg1 = ↵Jakub Jelinek2-0/+48
const; reg2 = rotate (reg1, reg3 & cst) [PR96226] As mentioned in the PR, we can combine ~(1 << x) into -2 r<< x, but we give up in the ~(1 << (x & 31)) cases, as *<rotate_insn><mode>3_mask* don't allow immediate operand 1 and find_split_point prefers to split (x & 31) instead of the constant. With these combine splitters we help combine decide how to split those insns. 2020-12-04 Jakub Jelinek <jakub@redhat.com> PR target/96226 * config/i386/i386.md (splitter after *<rotate_insn><mode>3_mask, splitter after *<rotate_insn><mode>3_mask_1): New combine splitters. * gcc.target/i386/pr96226.c: New test.
2020-12-04fold-const: Don't use build_constructor for non-aggregate types in ↵Jakub Jelinek2-4/+37
native_encode_initializer [PR93121] The following testcase is rejected, because when trying to encode a zeroing CONSTRUCTOR, the code was using build_constructor to build initializers for the elements but when recursing the function handles CONSTRUCTOR only for aggregate types. The following patch fixes that by using build_zero_cst instead for non-aggregates. Another option would be add handling CONSTRUCTOR for non-aggregates in native_encode_initializer. Or we can do both, I guess the middle-end generally doesn't like CONSTRUCTORs for scalar variables, but am not 100% sure if the FE doesn't produce those sometimes. 2020-12-04 Jakub Jelinek <jakub@redhat.com> PR libstdc++/93121 * fold-const.c (native_encode_initializer): Use build_zero_cst instead of build_constructor. * g++.dg/cpp2a/bit-cast6.C: New test.
2020-12-04c++: Revert dependent-array changes [PR 98116]Nathan Sidwell5-49/+30
The changes reverted here are exposing an existing problem with alias template comparisons. The typename_type changes are also incomplete, possibly for similar reasons. It seems safer to revert them, fix the underlying issue and then move forwards. The testcases is adjusted to more robustly check the specialization table, and ICEs with and without the c++ changes. Revert: 62fb1b9e0da c++: Fix array type dependency [PR 98107] 07589ca2b2c c++: typename_type structural comparison 29ae1d7751 c++: Extend build_array_type API PR c++/98116 gcc/cp/ * cp-tree.h (comparing_typenames): Delete. (cplus_build_array_type): Remove default parm. * pt.c (comparing_typenames): Delete. (spec_hasher::equal): Don't increment it. * tree.c (set_array_type_canon): Remove dep parm. (build_cplus_array_type): Remove dep parm changes. (cp_build_qualified_type_real): Remove dependent array type changes. (strip_typedefs): Likewise. * typeck.c (structural_comptypes): Revert comparing_typename changes. gcc/testsuite/ * g++.dg/template/pr98116.C: Enable robust checking.
2020-12-04c++: Module API declarationsNathan Sidwell1-0/+97
This provides the inline predicates about module state, and declares the functions to be provided. gcc/cp/ * cp-tree.h: Add various inline module state predicates, and declare the API that will be provided by modules.cc
2020-12-04debug: Fix another vector DECL_MODE ICE [PR98100]Jakub Jelinek2-2/+14
The PR88587 fix changes DECL_MODE of vars with vector type during inlining/cloning when the vars are copied, so that their DECL_MODE matches their TYPE_MODE in the new function. Unfortunately, the following testcase still ICEs, the var isn't really used in the new function and so it isn't copied, but becomes just a nonlocalized var. So we can't adjust its DECL_MODE because it appears in multiple functions and needs different modes in between them. The following patch changes the DEBUG_INSN creation to use TYPE_MODE instead of DECL_MODE for vars with vector types. 2020-12-04 Jakub Jelinek <jakub@redhat.com> PR target/98100 * cfgexpand.c (expand_gimple_basic_block): For vars with vector type, use TYPE_MODE rather than DECL_MODE. * gcc.target/i386/pr98100.c: New test.
2020-12-04dwarf: Add -gdwarf{32,64} optionsJakub Jelinek4-95/+121
The following patch makes the choice between 32-bit and 64-bit DWARF formats selectable by command line switch, rather than being hardcoded through DWARF_OFFSET_SIZE macro. The options themselves don't turn on debug info themselves, so one needs to use -g -gdwarf64 or similar. 2020-12-04 Jakub Jelinek <jakub@redhat.com> * common.opt (-gdwarf32, -gdwarf64): New options. * config/rs6000/rs6000.c (rs6000_option_override_internal): Default dwarf_offset_size to 8 if not overridden from the command line. * dwarf2out.c: Change all occurrences of DWARF_OFFSET_SIZE to dwarf_offset_size. * doc/invoke.texi (-gdwarf32, -gdwarf64): Document.
2020-12-04testsuite: use param for if-to-switch testsMartin Liska3-3/+3
gcc/testsuite/ChangeLog: PR testsuite/98123 * gcc.dg/tree-ssa/if-to-switch-4.c: Add param to make the test stable on all architectures. * gcc.dg/tree-ssa/if-to-switch-6.c: Likewise. * gcc.dg/tree-ssa/if-to-switch-8.c: Likewise.
2020-12-04Add target selector to gcc.dg/pr98099.cEric Botcazou1-1/+1
gcc/testsuite/ChangeLog: * gcc.dg/pr98099.c: Compile only for dfp targets.
2020-12-04Refactor -frecord-gcc-switches.Martin Liska8-391/+166
gcc/ChangeLog: * doc/tm.texi: Change argument of the record_gcc_switches hook and remove SWITCH_TYPE_* enum values. * dwarf2out.c (gen_producer_string): Move to opts.c and remove handling of the dwarf_record_gcc_switches option. (dwarf2out_early_finish): Use moved gen_producer_string function. * opts.c (gen_producer_string): New. * opts.h (gen_producer_string): New. * target.def: Change type of record_gcc_switches. * target.h (enum print_switch_type): Remove. (elf_record_gcc_switches): Change first argument. * toplev.c (MAX_LINE): Remove. (print_to_asm_out_file): Likewise. (print_to_stderr): Likewise. (print_single_switch): Likewise. (print_switch_values): Likewise. (init_asm_output): Use new gen_producer_string function. (process_options): Likewise. * varasm.c (elf_record_gcc_switches): Just save the string argument to the ELF container.
2020-12-04Fix checking failure in IPA-SRAEric Botcazou5-1/+53
This is a regression present on the mainline and 10 branch: on the one hand, IPA-SRA does *not* disqualify accesses with zero size but, on the other hand, it checks that accesses present in the tree have a (strictly) positive size, thus trivially yielding an ICE in some cases. gcc/ChangeLog: * ipa-sra.c (verify_access_tree_1): Relax assertion on the size. gcc/testsuite/ChangeLog: * gnat.dg/opt91.ads, gnat.dg/opt91.adb: New test. * gnat.dg/opt91_pkg.ads, gnat.dg/opt91_pkg.adb: New helper.
2020-12-04Document missing params.Martin Liska1-7/+33
contrib/ChangeLog: * check-params-in-docs.py: use flake8 and add some tweaks to ignore aarch64 params. gcc/ChangeLog: * doc/invoke.texi: Add missing params.
2020-12-04c++: Change __builtin_source_location to use __PRETTY_FUNCTION__ instead of ↵Jakub Jelinek5-13/+13
__FUNCTION__ [PR80780] On Tue, Dec 01, 2020 at 01:03:52PM +0000, Jonathan Wakely via Gcc-patches wrote: > I mentioned in PR 80780 that a __builtin__PRETTY_FUNCTION would have > been nice, because __FUNCTION__ isn't very useful for C++, because of > overloading and namespace/class scopes. There are an unlimited number > of functions that have __FUNCTION__ == "s", e.g. "ns::s(int)" and > "ns::s()" and "another_scope::s::s<T...>(T...)" etc. > > Since __builtin_source_location() can do whatever it wants (without > needing to add __builtin__PRETTY_FUNCTION) it might be nice to use the > __PRETTY_FUNCTION__ string. JeanHeyd's tests would still need changes, > because the name would be "s::s(void*)" not "s::s" but that still > seems better for users. When I've added template tests for the previous patch, I have noticed that the current __builtin_source_location behavior is not really __FUNCTION__, just close, because e.g. in function template __FUNCTION__ is still "bar" but __builtin_source_location gave "bar<0>". Anyway, this patch implements above request to follow __PRETTY_FUNCTION__ (on top of the earlier posted patch). 2020-12-04 Jakub Jelinek <jakub@redhat.com> PR c++/80780 * cp-gimplify.c (fold_builtin_source_location): Use 2 instead of 0 as last argument to cxx_printable_name. * g++.dg/cpp2a/srcloc1.C (quux): Use __PRETTY_FUNCTION__ instead of function. * g++.dg/cpp2a/srcloc2.C (quux): Likewise. * g++.dg/cpp2a/srcloc15.C (S::S): Likewise. (bar): Likewise. Adjust expected column. * g++.dg/cpp2a/srcloc17.C (S::S): Likewise. (bar): Likewise. Adjust expected column. * testsuite/18_support/source_location/1.cc (main): Adjust for __builtin_source_location using __PRETTY_FUNCTION__-like names instead __FUNCTION__-like. * testsuite/18_support/source_location/consteval.cc (main): Likewise.
2020-12-04Daily bump.GCC Administrator6-1/+420
2020-12-03c++: XFAIL testcase for PR98019Jason Merrill1-0/+1
Apparently it isn't actually fixed on trunk yet, was just passing because of some WIP in my tree. So XFAIL for now. gcc/testsuite/ChangeLog: * g++.dg/cpp2a/concepts-nodiscard1.C: XFAIL.
2020-12-03c++: Fix bootstrap on 32-bit hosts [PR91828]Jason Merrill1-2/+4
Using the releasing_vec op[] with an int index was breaking on 32-bit hosts because of ambiguity with the built-in operator and the conversion function. Since the built-in operator has a ptrdiff_t, this was fine on 64-bit targets where ptrdiff_t is larger than int, but broke on 32-bit targets where it's the same as int, making the conversion for that argument better than the member function. Fixed by changing the member function to also use ptrdiff_t for the index. gcc/cp/ChangeLog: * cp-tree.h (releasing_vec::operator[]): Change parameter type to ptrdiff_t.
2020-12-03Add support for detecting mismatched allocation/deallocation calls.Martin Sebor26-67/+2524
PR c++/90629 - Support for -Wmismatched-new-delete PR middle-end/94527 - Add an __attribute__ that marks a function as freeing an object gcc/ChangeLog: PR c++/90629 PR middle-end/94527 * builtins.c (access_ref::access_ref): Initialize new member. (compute_objsize): Use access_ref::deref. Handle simple pointer assignment. (expand_builtin): Remove handling of the free built-in. (call_dealloc_argno): Same. (find_assignment_location): New function. (fndecl_alloc_p): Same. (gimple_call_alloc_p): Same. (call_dealloc_p): Same. (matching_alloc_calls_p): Same. (warn_dealloc_offset): Same. (maybe_emit_free_warning): Same. * builtins.h (struct access_ref): Declare new member. (maybe_emit_free_warning): Make extern. Make use of access_ref. Handle -Wmismatched-new-delete. * calls.c (initialize_argument_information): Call maybe_emit_free_warning. * doc/extend.texi (attribute malloc): Update. * doc/invoke.texi (-Wfree-nonheap-object): Expand documentation. (-Wmismatched-new-delete): Document new option. (-Wmismatched-dealloc): Document new option. gcc/c-family/ChangeLog: PR c++/90629 PR middle-end/94527 * c-attribs.c (handle_dealloc_attribute): New function. (handle_malloc_attribute): Handle argument forms of attribute. * c.opt (-Wmismatched-dealloc): New option. (-Wmismatched-new-delete): New option. gcc/testsuite/ChangeLog: PR c++/90629 PR middle-end/94527 * g++.dg/asan/asan_test.cc: Fix a bug. * g++.dg/warn/delete-array-1.C: Add expected warning. * g++.old-deja/g++.other/delete2.C: Add expected warning. * g++.dg/warn/Wfree-nonheap-object-2.C: New test. * g++.dg/warn/Wfree-nonheap-object.C: New test. * g++.dg/warn/Wmismatched-new-delete.C: New test. * g++.dg/warn/Wmismatched-dealloc-2.C: New test. * g++.dg/warn/Wmismatched-dealloc.C: New test. * gcc.dg/Wmismatched-dealloc.c: New test. * gcc.dg/analyzer/malloc-1.c: Prune out expected warning. * gcc.dg/attr-malloc.c: New test. * gcc.dg/free-1.c: Adjust text of expected warning. * gcc.dg/free-2.c: Same. * gcc.dg/torture/pr71816.c: Prune out expected warning. * gcc.dg/tree-ssa/pr19831-2.c: Add an expected warning. * gcc.dg/Wfree-nonheap-object-2.c: New test. * gcc.dg/Wfree-nonheap-object-3.c: New test. * gcc.dg/Wfree-nonheap-object.c: New test. libstdc++-v3/ChangeLog: * testsuite/ext/vstring/modifiers/clear/56166.cc: Suppress a false positive warning.
2020-12-03c++: Exported using declsNathan Sidwell2-7/+25
With modules we need to record whethe a (namespace-scope) using decl is exporting the named entities. Record this on the OVERLOAD marking the used decl. gcc/cp/ * cp-tree.h (OVL_EXPORT): New. (class ovl_iterator): Add get_using, exporting_p. * tree.c (ovl_insert): Extend using_or_hidden meaning to include an exported using.
2020-12-03c++: uninstantiated template friendsNathan Sidwell2-1/+20
template friends need to be recognized by module streaming and associated with the befriending class. but their context is that of the friend (a namespace or other class). This adds a flag to mark such templates, and uses their DECL_CHAIN to point at the befriender. gcc/cp * cp-tree.h (DECL_UNINSTANTIATED_TEMPLATE_FRIEND): New. * pt.c (push_template_decl): Set it. (tsubst_friend_function): Clear it.
2020-12-03Go testsuite: update new tests to version in source repoIan Lance Taylor23-59/+50
2020-12-03PR fortran/95342 - ICE in gfc_match_subroutine, at fortran/decl.c:7913Harald Anlauf2-0/+22
Add checks for NULL pointers before dereferencing them. gcc/fortran/ChangeLog: PR fortran/95342 * decl.c (gfc_match_function_decl): Avoid NULL pointer dereference. (gfc_match_subroutine): Likewise. gcc/testsuite/ChangeLog: PR fortran/95342 * gfortran.dg/pr95342.f90: New test.
2020-12-03fix __builtin___clear_cache overrider falloutAlexandre Oliva2-1/+8
Machines that had CLEAR_CACHE_INSN and that would thus issue calls to __clear_cache with the default call expander, would fail on languages that did not set up the __clear_cache builtin. This patch arranges for all languages to set up this builtin. Machines or multilibs that had ptr_mode != Pmode, such as aarch64 with -mabi=ilp32, would fail the RTL mode test of the arguments passed to __clear_cache, because we'd insist on ptr_mode. This patch arranges for Pmode to be accepted as well. for gcc/ChangeLog * tree.c (build_common_builtin_nodes): Declare __builtin___clear_cache for all languages. * builtins.c (maybe_emit_call_builtin___clear_cache): Accept Pmode arguments.
2020-12-03Go testsuite: add a bunch of new tests from source repoIan Lance Taylor112-0/+3339
2020-12-03go-test.exp: add -I. when compiling in directoryIan Lance Taylor1-5/+5
* go.test/go-test.exp (go-gc-tests): Add -I. when building all sources in a directory (errorcheckdir, compiledir, rundir, rundircmpout).
2020-12-03c++: Add testcase for PR98019Jason Merrill1-0/+10
This has already been fixed on trunk, but I don't see a testcase for it. gcc/testsuite/ChangeLog: PR c++/98019 * g++.dg/cpp2a/concepts-nodiscard1.C: New test.
2020-12-03testsuite: update existing Go tests to source repoIan Lance Taylor582-10318/+4741
This updates a bunch of existing Go tests to the contents of the source repo. This does not add any of the newer tests.
2020-12-03RTEMS: Add Cortex-R52 multilibSebastian Huber1-2/+3
gcc/ * config/arm/t-rtems: Add "-mthumb -mcpu=cortex-r52 -mfloat-abi=hard" multilib.
2020-12-03c++: templatey type creationNathan Sidwell3-11/+26
This patch makes a couple of type-creation routines available to modules. That needs to create unbound template parms, and canonical template parms. gcc/cp/ * cp-tree.h (make_unbound_class_template_raw): Declare. (canonical_type_parameter): Declare. * decl.c (make_unbound_class_template_raw): Break out of ... (make_unboud_class_template): ... here. Call it. * pt.c (canonical_type_parameter): Externalize. Refactor & set structural_equality for type parms.
2020-12-03i386: Fix up ix86_md_asm_adjust for TImode [PR98086]Uros Bizjak2-30/+25
ix86_md_asm_adjust assumes that dest_mode can be only [QHSD]Imode and nothing else. The patch rewrites zero-extension part to use convert_to_mode to handle TImode and hypothetically even wider modes. 2020-12-03 Uroš Bizjak <ubizjak@gmail.com> Jakub Jelinek <jakub@redhat.com> gcc/ PR target/98086 * config/i386/i386.c (ix86_md_asm_adjustmd): Rewrite zero-extension part to use convert_to_mode. gcc/testsuite/ PR target/98086 * gcc.target/i386/pr98086.c: New test.
2020-12-03c++: Testcases [PR 98115]Nathan Sidwell2-0/+33
These two testcases provide coverage for 98115, which doesn't trigger on all hosts. PR c++/98115 PR c++/98116 gcc/testsuite/ * g++.dg/template/pr98115.C: New. * g++.dg/template/pr98116.C: New.
2020-12-03compiler: cast comparison function result to expected bool typeIan Lance Taylor3-6/+49
Otherwise cases like type mybool bool var b mybool = [10]string{} == [10]string{} get an incorrect type checking error. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/274446
2020-12-03compiler: defer to middle-end for complex divisionIan Lance Taylor6-2483/+4171
Go used to use slightly different semantics than C99 for complex division, so we used runtime routines to handle the different. The gc compiler has changes its behavior to match C99, so changes ours as well. For golang/go#14644 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/274213
2020-12-03IBM Z: Fix mode in probe_stack patternAndreas Krebbel2-3/+13
The probe pattern uses Pmode but the middle-end wants to emit a word_mode probe check. This - as usual - breaks on Z with -m31 -mzarch were word_mode doesn't match Pmode. gcc/ChangeLog: * config/s390/s390.md ("@probe_stack2<mode>"): Change mode iterator to W. gcc/testsuite/ChangeLog: * gcc.target/s390/stack-clash-4.c: New test.
2020-12-03c++: Fix array type dependency [PR 98107]Nathan Sidwell1-0/+10
I'd missed some paths through build_cplus_array_type, plus, some arrays come via the C-type builder. This propagates dependency in more places and asserts that in the cases where TYPE_DEPENDENT_P_VALID is unset, the type is non-dependent. PR c++/98107 gcc/cp/ * tree.c (build_cplus_array_type): Mark dependency of new variant. (cp_build_qualified_type_real, strip_typedefs): Assert TYPE_DEPENDENT_P_VALID, or not a dependent type.
2020-12-03aarch64: Don't fold svundef* at the gimple levelRichard Sandiford2-11/+12
As the testcase shows, folding svundef*() at the gimple level has the unfortunate side-effect of introducing -Wuninitialized or -Wmaybe-uninitialized warnings. We don't have a testcase that relies on the fold, so the easiest fix seems to be to remove it. gcc/ * config/aarch64/aarch64-sve-builtins-base.cc (svundef_impl::fold): Delete. gcc/testsuite/ * gcc.target/aarch64/sve/acle/general/undef_1.c: New test.
2020-12-03Fix PR middle-end/98099Eric Botcazou2-1/+14
this replaces the ICE by a sorry message for the use of reverse scalar storage order with 128-bit decimal floating-point type on 32-bit targets. gcc/ChangeLog: PR middle-end/98099 * expmed.c (flip_storage_order): In the case of a non-integer mode, sorry out if the integer mode to be used instead is not supported. gcc/testsuite/ChangeLog: * gcc.dg/pr98099.c: New test.
2020-12-03Fix PR middle-end/98082Eric Botcazou2-2/+18
this fixes an ICE introduced by the fix for PR middle-end/97078 where use_register_for_decl was changed to return true at -O0 for a parameter of a thunk. It turns out that we need to do the same for a result in this case. gcc/ChangeLog: PR middle-end/98082 * function.c (use_register_for_decl): Also return true for a result if cfun->tail_call_marked is true. gcc/testsuite/ChangeLog: * g++.dg/cpp2a/pr98082.C: New test.
2020-12-03c++: Add __builtin_bit_cast to implement std::bit_cast [PR93121]Jakub Jelinek22-52/+1264
The following patch adds __builtin_bit_cast builtin, similarly to clang or MSVC which implement std::bit_cast using such an builtin too. It checks the various std::bit_cast requirements, when not constexpr evaluated acts pretty much like VIEW_CONVERT_EXPR of the source argument to the destination type and the hardest part is obviously the constexpr evaluation. I've left out PDP11 handling of those, couldn't figure out how exactly are bitfields laid out there 2020-12-03 Jakub Jelinek <jakub@redhat.com> PR libstdc++/93121 * fold-const.h (native_encode_initializer): Add mask argument defaulted to nullptr. (find_bitfield_repr_type): Declare. (native_interpret_aggregate): Declare. * fold-const.c (find_bitfield_repr_type): New function. (native_encode_initializer): Add mask argument and support for filling it. Handle also some bitfields without integral DECL_BIT_FIELD_REPRESENTATIVE. (native_interpret_aggregate): New function. * gimple-fold.h (clear_type_padding_in_mask): Declare. * gimple-fold.c (struct clear_padding_struct): Add clear_in_mask member. (clear_padding_flush): Handle buf->clear_in_mask. (clear_padding_union): Copy clear_in_mask. Don't error if buf->clear_in_mask is set. (clear_padding_type): Don't error if buf->clear_in_mask is set. (clear_type_padding_in_mask): New function. (gimple_fold_builtin_clear_padding): Set buf.clear_in_mask to false. * doc/extend.texi (__builtin_bit_cast): Document. * c-common.h (enum rid): Add RID_BUILTIN_BIT_CAST. * c-common.c (c_common_reswords): Add __builtin_bit_cast. * cp-tree.h (cp_build_bit_cast): Declare. * cp-tree.def (BIT_CAST_EXPR): New tree code. * cp-objcp-common.c (names_builtin_p): Handle RID_BUILTIN_BIT_CAST. (cp_common_init_ts): Handle BIT_CAST_EXPR. * cxx-pretty-print.c (cxx_pretty_printer::postfix_expression): Likewise. * parser.c (cp_parser_postfix_expression): Handle RID_BUILTIN_BIT_CAST. * semantics.c (cp_build_bit_cast): New function. * tree.c (cp_tree_equal): Handle BIT_CAST_EXPR. (cp_walk_subtrees): Likewise. * pt.c (tsubst_copy): Likewise. * constexpr.c (check_bit_cast_type, cxx_eval_bit_cast): New functions. (cxx_eval_constant_expression): Handle BIT_CAST_EXPR. (potential_constant_expression_1): Likewise. * cp-gimplify.c (cp_genericize_r): Likewise. * g++.dg/cpp2a/bit-cast1.C: New test. * g++.dg/cpp2a/bit-cast2.C: New test. * g++.dg/cpp2a/bit-cast3.C: New test. * g++.dg/cpp2a/bit-cast4.C: New test. * g++.dg/cpp2a/bit-cast5.C: New test.
2020-12-03c++: consteval-defarg1.C test variant for templatesJakub Jelinek1-0/+29
We weren't recognizing a default argument for a consteval member function as being in immediate function context because there was no function parameter scope to look at. The following testcase is an attempt to test it with templates, both non-dependent and dependent consteval calls in both function and class templates, and with r11-5694 it now passes. 2020-12-03 Jakub Jelinek <jakub@redhat.com> * g++.dg/cpp2a/consteval-defarg2.C: New test.
2020-12-03tree-ssa-threadedge.c (record_temporary_equivalences_from_stmts_at_dest): Do ↵Ilya Leoshkevich1-0/+6
not allow __builtin_constant_p. This is the same as commit 70a62009181f ("tree-ssa-threadbackward.c (profitable_jump_thread_path): Do not allow __builtin_constant_p."), but for the old forward threader. gcc/ChangeLog: 2020-12-03 Ilya Leoshkevich <iii@linux.ibm.com> * tree-ssa-threadedge.c (record_temporary_equivalences_from_stmts_at_dest): Do not allow __builtin_constant_p on a threading path.
2020-12-03Fix division by 0 in printf_strlen_execute when dumpingIlya Leoshkevich1-1/+1
gcc/ChangeLog: 2020-12-03 Ilya Leoshkevich <iii@linux.ibm.com> * tree-ssa-strlen.c (printf_strlen_execute): Avoid division by 0.
2020-12-03RISC-V: Canonicalize --with-archKito Cheng3-75/+111
- We would like to canonicalize the arch string for --with-arch for easier handling multilib, so split canonicalization part to a stand along script to shared the logic. gcc/ChangeLog: * config/riscv/multilib-generator (arch_canonicalize): Move code to arch-canonicalize, and call that script to canonicalize arch string. (canonical_order): Move code to arch-canonicalize. (LONG_EXT_PREFIXES): Ditto. (IMPLIED_EXT): Ditto. * config/riscv/arch-canonicalize: New. * config.gcc (riscv*-*-*): Canonicalize --with-arch.
2020-12-03aarch64: Add +flagm to -marchPrzemyslaw Wirkus3-1/+10
New +flagm (Condition flag manipulation) feature option for -march command line option. Please note that FLAGM stays a Armv8.4-A feature but now can be assigned to other architectures or CPUs. gcc/ChangeLog: * config/aarch64/aarch64-option-extensions.def (AARCH64_OPT_EXTENSION): New +flagm option in -march for AArch64. * config/aarch64/aarch64.h (AARCH64_FL_FLAGM): Add new flagm extension bit mask. (AARCH64_FL_FOR_ARCH8_4): Add flagm to Armv8.4-A. * doc/invoke.texi: Update docs with +flagm.
2020-12-03testsuite: Add testcase for already fixed PR [PR98104]Jakub Jelinek1-0/+20
This testcase got broken with r11-3826 and got fixed with r11-5628. 2020-12-03 Jakub Jelinek <jakub@redhat.com> PR c++/98104 * g++.dg/warn/pr98104.C: New test.