aboutsummaryrefslogtreecommitdiff
path: root/gcc
AgeCommit message (Collapse)AuthorFilesLines
2022-01-29Track the cratenum for the respective canonical pathPhilip Herron3-19/+33
This means we can get the crate name to squash the warning in the V0 symbol mangling scheme.
2022-01-29This updates our handling of canonical paths to contain the crate-namePhilip Herron14-230/+749
In the name resolver there are two types of canonical-path object. 1. The relative canonical path to a type for name resolution 2. The full canonical-path including the crate-name (this-was-missing) The lack of the crate-name being present in the canonical-path meant the symbol mangling system was required to append it where apropriate but this was going to be too messy to handle all cases. Such as module blocks containing impl blocks requires a prefix::<impl crate::path>::item and similarly for trait impl blocks. This patch updates the name-resolution system to build up the canonical-path of items along side the relative type-paths at the same time this needs to be done as it is not possible to resolve the canonical path in the toplevel scan for all names within the crate when it comes to impl/trait-impl blocks as they may be declared after the block so this needs to be done at the same time as the normal name resolution mechanisms. The patch here means the name-manglers no longer need to care about the crate names of any item which is key for when we need to call functions in other crates.
2022-01-29Refactor Mangling API crate name should be part of the CanonicalPathPhilip Herron3-30/+50
The CanonicalPath of an item such as a function at the moment does not contain the associated crate name but it will eventually. This also updates the legacy mangling to be even more conformant. Qualified paths such as: <A as B> are meant to actually start with _$LT$ and spaces are $u20$.
2022-01-29Add helpers to access each segment of the canonical pathPhilip Herron1-0/+11
2022-01-29Change default crate name to examplePhilip Herron1-1/+1
2022-01-29Merge #899bors[bot]8-11/+98
899: Add -frust-cfg=value option for adding config options r=philberty a=philberty This adds the initial support for config expansion on custom config values it need support for parsing options such as feature=test with apropriate error handling withing Session::handle_cfg_option(const std::string&). This also applies the mark_for_strip checks only on AST::Functions and will need applied to the rest of the crate in #872. Addresses #889 Co-authored-by: Philip Herron <philip.herron@embecosm.com>
2022-01-29Merge #897 #898bors[bot]2-1/+7
897: Remove unused include r=philberty a=philberty We no longer need the tree within the type modules. 898: Add deref_mut lang_item mappings r=philberty a=philberty This does not add support for deref_mut lang-items it just adds the mappings so we can track the lang_item. Co-authored-by: Philip Herron <philip.herron@embecosm.com>
2022-01-28Add -frust-cfg=value option for adding config optionsPhilip Herron8-11/+98
This adds the initial support for config expansion on custom config values it need support for parsing options such as feature=test with apropriate error handling withing Session::handle_cfg_option(const std::string&). This also applies the mark_for_strip checks only on AST::Functions and will need applied to the rest of the crate in #872. Addresses #889
2022-01-27Add deref_mut lang_item mappingsPhilip Herron1-0/+7
2022-01-27Remove unused includePhilip Herron1-1/+0
2022-01-25Merge #892bors[bot]2-2/+76
892: Remove bad assertion when resolving segments r=philberty a=philberty When resolving segments in a path generics ones can match types in othe impl blocks which will not be compiled yet so this assertion is bad. Fixes #862 Co-authored-by: Philip Herron <philip.herron@embecosm.com>
2022-01-25Remove bad assertion when resolving segmentsPhilip Herron2-2/+76
When resolving segments in a path generics ones can match types in othe impl blocks which will not be compiled yet so this assertion is bad. Fixes #862
2022-01-24Remove hack to handle forward declared itemsPhilip Herron7-158/+163
We used to use a compile_fns flag as a method to handle the case of code such as: ```rust fn foo() { bar() } fn bar() { } ``` The compile_fns flag when set to false would allow us to do a toplevel scan to compile the initial fndecl prototype of the functions as a method of handling the case of the call to bar() within the body of foo. The backend is setup now that we can 'query_compile' by compiling the item as required with a cache if we have already done so.
2022-01-24Update GCC/Rust files per 'contrib/update-copyright.py --this-year' [#764]Thomas Schwinge192-192/+192
2022-01-24Merge commit '490e23032baaece71f2ec09fa1805064b150fbc2' [#247]Thomas Schwinge10946-269734/+525978
2022-01-22MethodResolution should respect the autoderef cyclePhilip Herron25-690/+1002
Autoderef includes calling into the deref operator overloads so for example. ```rust pub trait Deref { type Target; fn deref(&self) -> &Self::Target; } impl<T> Deref for &T { type Target = T; fn deref(&self) -> &T { *self } } struct Bar(i32); impl Bar { fn foobar(self) -> i32 { self.0 } } struct Foo<T>(T); impl<T> Deref for Foo<T> { type Target = T; fn deref(&self) -> &Self::Target { &self.0 } } fn main() { let bar = Bar(123); let foo: Foo<&Bar> = Foo(&bar); let foobar: i32 = foo.foobar(); } ``` So you can see here we have a nested structure of Foo<&Bar> and Foo is a generic structure, and we have a method call of foo.foobar(). This is an interesting case of method resolution showing how rust allows for multiple dereference to find the apropriate method of foobar. So in this method call expression foo is of type Foo<&Bar> the generic structure is a covariant Reference Type (&) of the structure Bar. The method foobar has a receiver type of a simple Bar being passed by value. So in order for this function to be called the method resolution system has an algorithm of: - reciever = Foo<&Bar> - Find all methods named foobar - try and match the receiver (self) with this reciever - so that means we have Foo<&Bar> vs Bar which does not match - Go back to the start and try by taking an immutable refernece - &Foo<&Bar> does not match Bar - Go back to the start and try by taking a mutable reference - &mut Foo<&Bar> does not match Bar - Try and dereference the original receiver Foo<&Bar> - Do we have the deref lang item defined - if yes resolve the method by the same mechanism for Foo<&Bar> for deref - Get the result type of this function which is &&Bar do the dereference - Now we have &Bar and a new adjustment for the original receiver - Try and match &Bar to the foobar method reciever of Bar - Try taking an immutable reference &&Bar - Try taking a mutable reference &mut &Bar - Try and deref &Bar we have the generic implementation of deref for &T - Call this derefernece like before to get down to Bar - Now try Bar on the foobar reciever Bar and it matches We have now resolved the method with two dereference adjustments so the function call becomes: ``` void main () { i32 D.110; const struct bar; const struct foo; const i32 foobar; try { bar.0 = 123; foo.0 = &bar; RUSTTMP.3 = <Foo as Deref>::deref<&Bar> (&foo); RUSTTMP.5 = <&T as Deref>::deref<Bar> (RUSTTMP.3); foobar = Bar::foobar (*RUSTTMP.5); } finally { bar = {CLOBBER}; foo = {CLOBBER}; } } ``` Obviously GCC will optimize this with -O2 so that it does not require function calls but the gimple will show us what is actually going on. As far as I am aware rustc pre-optimizes this regardless of optimizations being turned on or not, these lang item functions are easily inlineable so it makes more sense to me to let GCC's middle-end take care of this for us. This is a big patch and very difficult to split up as it reimplements our method resolution system. Fixes #884
2022-01-21Merge #883bors[bot]11-95/+44
883: Extract AsyncConstStatus to be a shared enum between AST and HIR r=philberty a=philberty This allows us to reuse the same enum and fix the uninitilized warning as it has already been setup before hand in the AST. Fixes #875 Co-authored-by: Philip Herron <philip.herron@embecosm.com>
2022-01-21Merge #885bors[bot]2-12/+5
885: Improve error message for failure in Method resolution r=philberty a=philberty Use the locus for the method name segment and print its name as part of the error message improves the quality of the error handling in the method resolution. Fixes #861 Co-authored-by: Philip Herron <philip.herron@embecosm.com>
2022-01-21Merge #880bors[bot]1-2/+8
880: Covariant types should respect the get_name r=philberty a=philberty This changes the Reference and Pointer types to respect the get_name convention this means the canonical name for functions with their respective substitutions string is properly formatted. Co-authored-by: Philip Herron <philip.herron@embecosm.com>
2022-01-21Improve error message for failure in Method resolutionPhilip Herron2-12/+5
Use the locus for the method name segment and print its name as part of the error message improves the quality of the error handling in method resolution. Fixes #861
2022-01-21Merge #881 #882bors[bot]5-2/+49
881: Add TraitItemKind to HIR TraitItems r=philberty a=philberty This allows us to safely switch and cast between the items without the need for visitors. 882: Add Mappings::iterate_trait_items helper r=philberty a=philberty This helper is part of a larger PR into fixing our implementation of MethodResolution Co-authored-by: Philip Herron <philip.herron@embecosm.com>
2022-01-21Extract AsyncConstStatus to be a shared enum between AST and HIRPhilip Herron11-95/+44
This allows us to reuse the same enum and fix the uninitilized warning as it has already been setup before hand in the AST. Fixes #875
2022-01-21Add Mappings::iterate_trait_items helperPhilip Herron2-0/+22
2022-01-21Add TraitItemKind to HIR TraitItemsPhilip Herron3-2/+27
This allows us to safely switch and cast between the items without the need for visitors.
2022-01-21Covariant types should respect the get_name to pretty print the ir symbolsPhilip Herron1-2/+8
2022-01-20Record correct location when compiling ADT typesDavid Faust2-1/+15
When compiling ADTTypes, the wrong HirId was being used for location lookup. This produced an issue where the gimple dump would not write type names for struct and union types, because they were mistaken for built-in types. Also add new test testsuite/rust/compile/torture/struct_decl.rs. Fixes: #877
2022-01-17Enable -Wuninitialized + -ftrivial-auto-var-init for address taken variables.Qing Zhao5-60/+141
With -ftrivial-auto-var-init, the address taken auto variable is replaced with a temporary variable during gimplification, and the original auto variable might be eliminated by compiler optimization completely. As a result, the current uninitialized warning analysis cannot get enough information from the IR, therefore the uninitialized warnings for address taken variable cannot be issued based on the current implemenation of -ftrival-auto-var-init. For more info please refer to: https://gcc.gnu.org/pipermail/gcc-patches/2021-August/577431.html In order to improve this situation, we can improve uninitialized analysis for address taken auto variables with -ftrivial-auto-var-init as following: for the following stmt: _1 = .DEFERRED_INIT (4, 2, &"alt_reloc"[0]); if (_1 != 0) The original variable DECL has been eliminated from the IR, all the necessary information that is needed for reporting the warnings for DECL can be acquired from the call to .DEFERRED_INIT. A. the name string of DECL from the 3rd parameter of the call; B. the location of the DECL from the location of the call; C. the call can also be used to hold the information on whether the warning has been issued or not to suppress warning messages when needed; The current testing cases for uninitialized warnings + -ftrivial-auto-var-init are adjusted to reflect the fact that we can issue warnings for address taken variables. gcc/ChangeLog: 2022-01-17 qing zhao <qing.zhao@oracle.com> * tree-ssa-uninit.c (warn_uninit): Delete the 4th parameter. Handle .DEFERRED_INIT call with an anonymous SSA_NAME specially. (check_defs): Handle .DEFERRED_INIT call with an anonymous SSA_NAME specially. (warn_uninit_phi_uses): Delete the 4th actual when call warn_uninit. (warn_uninitialized_vars): Likewise. (warn_uninitialized_phi): Likewise. gcc/testsuite/ChangeLog: 2022-01-17 qing zhao <qing.zhao@oracle.com> * gcc.dg/auto-init-uninit-16.c (testfunc): Delete xfail to reflect the fact that address taken variable can be warned. * gcc.dg/auto-init-uninit-34.c (warn_scalar_1): Likewise. (warn_scalar_2): Likewise. * gcc.dg/auto-init-uninit-37.c (T1): Likewise. (T2): Likewise. * gcc.dg/auto-init-uninit-B.c (baz): Likewise.
2022-01-17c++: Fix cp_genericize_target_expr for TARGET_EXPRs created for global ↵Jakub Jelinek2-2/+30
initialization [PR104031] The following patch is miscompiled, cp_genericize_target_expr expects that for the constant part split_nonconstant_init will emit an INIT_EXPR that will initialize it, but that doesn't happen and instead we get DECL_INITIAL on the TARGET_EXPR_SLOT that isn't initialized anywhere in the IL. The problem is that the TARGET_EXPR has been created while current_function_decl was NULL, it is inside a global var initializer. That means the build_local_temp created VAR_DECL has NULL DECL_CONTEXT. Later on when genericizing the ssdf (current_function_decl is already non-NULL), the new cp_genericize_target_expr is called and during split_nonconstant_init it checks is_local_temp, but that due to the NULL DECL_CONTEXT returns false. DECL_CONTEXT is set only later on during gimplification. The following patch fixes it by setting DECL_CONTEXT also inside of cp_genericize_target_expr, which fixes the testcase. But if there are better spots to do that, please let me know... 2022-01-17 Jakub Jelinek <jakub@redhat.com> PR c++/104031 * cp-gimplify.c (cp_genericize_target_expr): Set DECL_CONTEXT of TARGET_EXPR_SLOT to current_function_decl if it was NULL. * g++.dg/cpp1y/pr104031.C: New test.
2022-01-17diagnostic: avoid repeating include pathJason Merrill4-4/+40
When a sequence of diagnostic messages bounces back and forth repeatedly between two includes, as with #include <map> std::map<const char*, const char*> m ("123", "456"); The output is quite a bit longer than necessary because we dump the include path each time it changes. I'd think we could print the include path once for each header file, and then expect that the user can look earlier in the output if they're wondering. gcc/ChangeLog: * diagnostic.h (struct diagnostic_context): Add includes_seen. * diagnostic.c (diagnostic_initialize): Initialize it. (diagnostic_finish): Clean it up. (includes_seen): New function. (diagnostic_report_current_module): Use it. gcc/testsuite/ChangeLog: * c-c++-common/cpp/line-2.c: Only expect includes once. * c-c++-common/cpp/line-3.c: Likewise.
2022-01-17OpenMP: allow requires dynamic_allocatorsAndrew Stubbs4-4/+5
There's no need to reject the dynamic_allocators requires directive because we actually do support the feature, and it doesn't have to actually "do" anything. gcc/c/ChangeLog: * c-parser.c (c_parser_omp_requires): Don't "sorry" dynamic_allocators. gcc/cp/ChangeLog: * parser.c (cp_parser_omp_requires): Don't "sorry" dynamic_allocators. gcc/fortran/ChangeLog: * openmp.c (gfc_match_omp_requires): Don't "sorry" dynamic_allocators. gcc/testsuite/ChangeLog: * gfortran.dg/gomp/requires-8.f90: Reinstate dynamic allocators requirement.
2022-01-17middle-end/101292 - invalid memory access with warning controlRichard Biener2-2/+6
The warning control falls into the C++ trap of using a reference to old hashtable contents for a put operation which can end up re-allocating that before reading from the old freed referenced to source. Fixed by introducing a temporary. 2022-01-17 Richard Biener <rguenther@suse.de> PR middle-end/101292 * diagnostic-spec.c (copy_warning): Make sure to not reference old hashtable content on possible resize. * warning-control.cc (copy_warning): Likewise.
2022-01-17Change kind of integer literal to fix a testcase.Hafiz Abid Qadeer1-1/+1
As Thomas reported in https://gcc.gnu.org/pipermail/gcc-patches/2022-January/588448.html a test added in my recent allocate clause patch fails on m32. It was due to default kind for integer matching c_intptr_t for m32. I have now changed it to 0_1 so that always integer with kind=1 is used. gcc/testsuite/ChangeLog: * gfortran.dg/gomp/allocate-2.f90: Change 0 to 0_1.
2022-01-17widening_mul, i386: Improve spaceship expansion on x86 [PR103973]Jakub Jelinek52-26/+1220
C++20: #include <compare> auto cmp4way(double a, double b) { return a <=> b; } expands to: ucomisd %xmm1, %xmm0 jp .L8 movl $0, %eax jne .L8 .L2: ret .p2align 4,,10 .p2align 3 .L8: comisd %xmm0, %xmm1 movl $-1, %eax ja .L2 ucomisd %xmm1, %xmm0 setbe %al addl $1, %eax ret That is 3 comparisons of the same operands. The following patch improves it to just one comparison: comisd %xmm1, %xmm0 jp .L4 seta %al movl $0, %edx leal -1(%rax,%rax), %eax cmove %edx, %eax ret .L4: movl $2, %eax ret While a <=> b expands to a == b ? 0 : a < b ? -1 : a > b ? 1 : 2 where the first comparison is equality and this shouldn't raise exceptions on qNaN operands, if the operands aren't equal (which includes unordered cases), then it immediately performs < or > comparison and that raises exceptions even on qNaNs, so we can just perform a single comparison that raises exceptions on qNaN. As the 4 different cases are encoded as ZF CF PF 1 1 1 a unordered b 0 0 0 a > b 0 1 0 a < b 1 0 0 a == b we can emit optimal sequence of comparions, first jp for the unordered case, then je for the == case and finally jb for the < case. The patch pattern recognizes spaceship-like comparisons during widening_mul if the spaceship optab is implemented, and replaces those comparisons with comparisons of .SPACESHIP ifn which returns -1/0/1/2 based on the comparison. This seems to work well both for the case of just returning the -1/0/1/2 (when we have just a common successor with a PHI) or when the different cases are handled with various other basic blocks. The testcases cover both of those cases, the latter with different function calls in those. 2022-01-17 Jakub Jelinek <jakub@redhat.com> PR target/103973 * tree-cfg.h (cond_only_block_p): Declare. * tree-ssa-phiopt.c (cond_only_block_p): Move function to ... * tree-cfg.c (cond_only_block_p): ... here. No longer static. * optabs.def (spaceship_optab): New optab. * internal-fn.def (SPACESHIP): New internal function. * internal-fn.h (expand_SPACESHIP): Declare. * internal-fn.c (expand_PHI): Formatting fix. (expand_SPACESHIP): New function. * tree-ssa-math-opts.c (optimize_spaceship): New function. (math_opts_dom_walker::after_dom_children): Use it. * config/i386/i386.md (spaceship<mode>3): New define_expand. * config/i386/i386-protos.h (ix86_expand_fp_spaceship): Declare. * config/i386/i386-expand.c (ix86_expand_fp_spaceship): New function. * doc/md.texi (spaceship@var{m}3): Document. * gcc.target/i386/pr103973-1.c: New test. * gcc.target/i386/pr103973-2.c: New test. * gcc.target/i386/pr103973-3.c: New test. * gcc.target/i386/pr103973-4.c: New test. * gcc.target/i386/pr103973-5.c: New test. * gcc.target/i386/pr103973-6.c: New test. * gcc.target/i386/pr103973-7.c: New test. * gcc.target/i386/pr103973-8.c: New test. * gcc.target/i386/pr103973-9.c: New test. * gcc.target/i386/pr103973-10.c: New test. * gcc.target/i386/pr103973-11.c: New test. * gcc.target/i386/pr103973-12.c: New test. * gcc.target/i386/pr103973-13.c: New test. * gcc.target/i386/pr103973-14.c: New test. * gcc.target/i386/pr103973-15.c: New test. * gcc.target/i386/pr103973-16.c: New test. * gcc.target/i386/pr103973-17.c: New test. * gcc.target/i386/pr103973-18.c: New test. * gcc.target/i386/pr103973-19.c: New test. * gcc.target/i386/pr103973-20.c: New test. * g++.target/i386/pr103973-1.C: New test. * g++.target/i386/pr103973-2.C: New test. * g++.target/i386/pr103973-3.C: New test. * g++.target/i386/pr103973-4.C: New test. * g++.target/i386/pr103973-5.C: New test. * g++.target/i386/pr103973-6.C: New test. * g++.target/i386/pr103973-7.C: New test. * g++.target/i386/pr103973-8.C: New test. * g++.target/i386/pr103973-9.C: New test. * g++.target/i386/pr103973-10.C: New test. * g++.target/i386/pr103973-11.C: New test. * g++.target/i386/pr103973-12.C: New test. * g++.target/i386/pr103973-13.C: New test. * g++.target/i386/pr103973-14.C: New test. * g++.target/i386/pr103973-15.C: New test. * g++.target/i386/pr103973-16.C: New test. * g++.target/i386/pr103973-17.C: New test. * g++.target/i386/pr103973-18.C: New test. * g++.target/i386/pr103973-19.C: New test. * g++.target/i386/pr103973-20.C: New test.
2022-01-17Bump gcc/BASE-VER to 12.0.1 now that we are in stage4.Richard Biener1-1/+1
2021-01-17 Richard Biener <rguenther@suse.de> * BASE-VER: Bump to 12.0.1.
2022-01-17Fortran: remove new files introduced by mistakeFrancois-Xavier Coudert1-42/+0
These two files were introduced by mistake in 86e3b476d5defaa79c94d40b76cbeec21cd02e5f gcc/testsuite/ChangeLog: * gfortran.dg/ieee/signaling_3.f90: Remove file. libgfortran/ChangeLog: * ieee/issignaling_fallback.h: Remove file.
2022-01-17Make the tests working.Martin Liska2-3/+3
gcc/testsuite/ChangeLog: * g++.dg/uninit-pred-loop-1_b.C: Fix invalid warnings. * g++.dg/uninit-pred-loop-1_c.C: Likewise.
2022-01-17Rename test-cases that are not executed.Martin Liska4-0/+0
gcc/testsuite/ChangeLog: * g++.dg/uninit-pred-loop-1_a.cc: Moved to... * g++.dg/uninit-pred-loop-1_a.C: ...here. * g++.dg/uninit-pred-loop-1_b.cc: Moved to... * g++.dg/uninit-pred-loop-1_b.C: ...here. * g++.dg/uninit-pred-loop-1_c.cc: Moved to... * g++.dg/uninit-pred-loop-1_c.C: ...here. * g++.dg/uninit-pred-loop_1.cc: Moved to... * g++.dg/uninit-pred-loop_1.C: ...here.
2022-01-17Add check_effective_target_pytest3.Martin Liska2-5/+16
gcc/testsuite/ChangeLog: * lib/gcov.exp: Use check_effective_target_pytest3. * lib/target-supports.exp: Add check_effective_target_pytest3.
2022-01-17Start using check-MAINTAINERS.py instead of legacy maintainers-verify.sh.Martin Liska2-7/+23
contrib/ChangeLog: * maintainers-verify.sh: Removed. gcc/testsuite/ChangeLog: * gcc.src/maintainers.exp: Start using check-MAINTAINERS.py. * lib/target-supports.exp: Add check_effective_target_python3.
2022-01-17Fix test warnings.Martin Liska1-10/+12
PR testsuite/104035 gcc/testsuite/ChangeLog: * g++.dg/torture/pr57993-2.C: Fix warnings.
2022-01-16rs6000: Use known constant for GET_MODE_NUNITS and similarKewen Lin2-29/+12
This patch is to clean up some codes with GET_MODE_UNIT_SIZE or GET_MODE_NUNITS, which can use known constants or just be removed. Note that Carl Love helped to confirm altivec_vreveti2 introduced in r12-1341 is useless and can be removed. gcc/ChangeLog: * config/rs6000/altivec.md (altivec_vreveti2): Remove. * config/rs6000/vsx.md (*vsx_extract_si, *vsx_extract_si_<uns>float_df, *vsx_extract_si_<uns>float_<mode>, *vsx_insert_extract_v4sf_p9): Use known constant values to simplify code.
2022-01-17rs6000: Split pattern for TI to V1TI move [PR103124]Haochen Gui2-0/+28
This patch defines a new split pattern for TI to V1TI move. The pattern concatenates two subreg:DI of a TI to a V2DI. With the pattern, the subreg pass can do register split for TI when there is a TI to V1TI move. gcc/ PR target/103124 * config/rs6000/vsx.md (split pattern for TI to V1TI move): Defined. gcc/testsuite/ PR target/103124 * gcc.target/powerpc/pr103124.c: New testcase.
2022-01-17Daily bump.GCC Administrator3-1/+70
2022-01-17Fortran: xfail signaling NaN testcases on x87Francois-Xavier Coudert3-4/+50
The ABI for x87 and x86-32 is not suitable for passing around signaling NaNs in the way IEEE expects. See for example discussion in https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57484 gcc/testsuite/ChangeLog: * gfortran.dg/ieee/signaling_1.f90: xfail on x87. * gfortran.dg/ieee/signaling_2.f90: xfail on x87.
2022-01-16Fortran: allow IEEE_VALUE to correctly return signaling NaNsFrancois-Xavier Coudert3-4/+86
I moved the library implementation of IEEE_VALUE in libgfortran from Fortran to C code, which gives us access to GCC's built-ins for NaN generation (both quiet and signalling). It will be perform better than the current Fortran implementation. libgfortran/ChangeLog: PR fortran/82207 * mk-kinds-h.sh: Add values for TINY. * ieee/ieee_arithmetic.F90: Call C helper functions for IEEE_VALUE. * ieee/ieee_helper.c: New functions ieee_value_helper_N for each floating-point type. gcc/testsuite/ChangeLog: PR fortran/82207 * gfortran.dg/ieee/ieee_10.f90: Do not create signaling NaNs. * gfortran.dg/ieee/signaling_2.f90: New test. * gfortran.dg/ieee/signaling_2_c.c: New file.
2022-01-16libstdc++: Ignore deprecated warnings [PR104037]Jonathan Wakely1-0/+1
The std::pointer_to_binary_function utility was deprecated in C++11 and removed in C++17. Libstdc++ has started to warn about using it, so suppress the warnings for this test. gcc/testsuite/ChangeLog: PR testsuite/104037 * g++.old-deja/g++.robertl/eb43.C: Ad -Wno-deprecated.
2022-01-16testsuite: Enrich tests with variants failing on the branch.Mikael Morin6-4/+20
Backporting the fix for pr103789 on the 11 branch revealed a lack of test coverage for the tests provided with that fix. Indeed, the tests use the KIND argument of the respective intrinsics only with keyword arguments. This adds variants with non-keyword arguments. The tests enriched this way fail on the branch if the fix is cherry-picked straightforwardly. The fix will have to be tweaked slightly there. PR fortran/103789 PR fortran/87711 PR fortran/97896 gcc/testsuite/ChangeLog: * gfortran.dg/index_5.f90: Enrich test with usages of INDEX with a non-keyword KIND argument. * gfortran.dg/len_trim.f90: Same for LEN_TRIM. * gfortran.dg/maskl_1.f90: Same for MASKL. * gfortran.dg/maskr_1.f90: Same for MASKR. * gfortran.dg/scan_3.f90: Same for SCAN. * gfortran.dg/verify_3.f90: Same for VERIFY.
2022-01-16[i386] GLC tuning: Break false dependency for dest register.wwwhhhyyy10-8/+427
For GoldenCove micro-architecture, force insert zero-idiom in asm template to break false dependency of dest register for several insns. The related insns are: VPERM/D/Q/PS/PD VRANGEPD/PS/SD/SS VGETMANTSS/SD/SH VGETMANDPS/PD - mem version only VPMULLQ VFMULCSH/PH VFCMULCSH/PH gcc/ChangeLog: * config/i386/i386.h (TARGET_DEST_FALSE_DEP_FOR_GLC): New macro. * config/i386/sse.md (<avx512>_<complexopname>_<mode><maskc_name><round_name>): Insert zero-idiom in output template when attr enabled, set new attribute to true for non-mask/maskz insn. (avx512fp16_<complexopname>sh_v8hf<mask_scalarc_name><round_scalarcz_name>): Likewise. (avx512dq_mul<mode>3<mask_name>): Likewise. (<avx2_avx512>_permvar<mode><mask_name>): Likewise. (avx2_perm<mode>_1<mask_name>): Likewise. (avx512f_perm<mode>_1<mask_name>): Likewise. (avx512dq_rangep<mode><mask_name><round_saeonly_name>): Likewise. (avx512dq_ranges<mode><mask_scalar_name><round_saeonly_scalar_name>): Likewise. (<avx512>_getmant<mode><mask_name><round_saeonly_name>): Likewise. (avx512f_vgetmant<mode><mask_scalar_name><round_saeonly_scalar_name>): Likewise. * config/i386/subst.md (mask3_dest_false_dep_for_glc_cond): New subst_attr. (mask4_dest_false_dep_for_glc_cond): Likewise. (mask6_dest_false_dep_for_glc_cond): Likewise. (mask10_dest_false_dep_for_glc_cond): Likewise. (maskc_dest_false_dep_for_glc_cond): Likewise. (mask_scalar4_dest_false_dep_for_glc_cond): Likewise. (mask_scalarc_dest_false_dep_for_glc_cond): Likewise. * config/i386/x86-tune.def (X86_TUNE_DEST_FALSE_DEP_FOR_GLC): New DEF_TUNE enabled for m_SAPPHIRERAPIDS and m_ALDERLAKE gcc/testsuite/ChangeLog: * gcc.target/i386/avx2-dest-false-dep-for-glc.c: New test. * gcc.target/i386/avx512dq-dest-false-dep-for-glc.c: Ditto. * gcc.target/i386/avx512f-dest-false-dep-for-glc.c: Ditto. * gcc.target/i386/avx512fp16-dest-false-dep-for-glc.c: Ditto. * gcc.target/i386/avx512fp16vl-dest-false-dep-for-glc.c: Ditto. * gcc.target/i386/avx512vl-dest-false-dep-for-glc.c: Ditto.
2022-01-16Daily bump.GCC Administrator5-1/+129
2022-01-15Add -Wdangling-pointer [PR63272].Martin Sebor18-61/+2043
Resolves: PR c/63272 - GCC should warn when using pointer to dead scoped variable with in the same function gcc/c-family/ChangeLog: PR c/63272 * c.opt (-Wdangling-pointer): New option. gcc/ChangeLog: PR c/63272 * diagnostic-spec.c (nowarn_spec_t::nowarn_spec_t): Handle -Wdangling-pointer. * doc/invoke.texi (-Wdangling-pointer): Document new option. * gimple-ssa-warn-access.cc (pass_waccess::clone): Set new member. (pass_waccess::check_pointer_uses): New function. (pass_waccess::gimple_call_return_arg): New function. (pass_waccess::gimple_call_return_arg_ref): New function. (pass_waccess::check_call_dangling): New function. (pass_waccess::check_dangling_uses): New function overloads. (pass_waccess::check_dangling_stores): New function. (pass_waccess::check_dangling_stores): New function. (pass_waccess::m_clobbers): New data member. (pass_waccess::m_func): New data member. (pass_waccess::m_run_number): New data member. (pass_waccess::m_check_dangling_p): New data member. (pass_waccess::check_alloca): Check m_early_checks_p. (pass_waccess::check_alloc_size_call): Same. (pass_waccess::check_strcat): Same. (pass_waccess::check_strncat): Same. (pass_waccess::check_stxcpy): Same. (pass_waccess::check_stxncpy): Same. (pass_waccess::check_strncmp): Same. (pass_waccess::check_memop_access): Same. (pass_waccess::check_read_access): Same. (pass_waccess::check_builtin): Call check_pointer_uses. (pass_waccess::warn_invalid_pointer): Add arguments. (is_auto_decl): New function. (pass_waccess::check_stmt): New function. (pass_waccess::check_block): Call check_stmt. (pass_waccess::execute): Call check_dangling_uses, check_dangling_stores. Empty m_clobbers. * passes.def (pass_warn_access): Invoke pass two more times. gcc/testsuite/ChangeLog: PR c/63272 * g++.dg/warn/Wfree-nonheap-object-6.C: Disable valid warnings. * g++.dg/warn/ref-temp1.C: Prune expected warning. * gcc.dg/uninit-pr50476.c: Expect a new warning. * c-c++-common/Wdangling-pointer-2.c: New test. * c-c++-common/Wdangling-pointer-3.c: New test. * c-c++-common/Wdangling-pointer-4.c: New test. * c-c++-common/Wdangling-pointer-5.c: New test. * c-c++-common/Wdangling-pointer-6.c: New test. * c-c++-common/Wdangling-pointer.c: New test. * g++.dg/warn/Wdangling-pointer-2.C: New test. * g++.dg/warn/Wdangling-pointer.C: New test. * gcc.dg/Wdangling-pointer-2.c: New test. * gcc.dg/Wdangling-pointer.c: New test.