aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2020-06-18[Ada] Small cleanup in constraint checking code for allocatorsEric Botcazou2-63/+58
2020-06-18 Eric Botcazou <ebotcazou@adacore.com> gcc/ada/ * exp_ch4.adb (Expand_Allocator_Expression): Apply constraint and predicate checks for the qualified expression on entry, followed by constraint and predicate checks for the allocator itself, and return early if this results in a static error. (Expand_N_Allocator): Do not do the same here. Instead apply constraint and predicate checks for arrays in the subtype indication case. * exp_ch5.adb (Expand_N_Assignment_Statement): Do not apply range checks to allocators here.
2020-06-18[Ada] Crash in tagged type constructor with task componentsJavier Miranda6-25/+66
2020-06-18 Javier Miranda <miranda@adacore.com> gcc/ada/ * exp_ch6.adb (BIP_Suffix_Kind, Is_Build_In_Place_Entity): Move declarations... * exp_ch6.ads: Here. * exp_util.adb (Is_Secondary_Stack_BIP_Func_Call): Do not rely on the name of the scope to locate the extra formal BIPalloc since they are copied when the pointer type associated with dispatching calls is built; rely on routines Is_Build_In_Place_Entity and BIP_Suffix_Kind. * exp_disp.adb (Expand_Dispatching_Call): Set the scope of the first extra formal of the internally built pointer type. * sem_ch3.adb (Derive_Subprogram): Do not inherit extra formals from a limited interface parent since limitedness is not inherited in such case (AI-419) and this affects the extra formals. * sprint.adb (Write_Itype): Output extra formals of subprogram types.
2020-06-18[Ada] Update output of verbose error summaryGhjuvan Lacambre2-18/+64
2020-06-18 Ghjuvan Lacambre <lacambre@adacore.com> gcc/ada/ * errout.adb (Write_Error_Summary): Display number of warnings treated as errors. * errutil.ads: Update comment.
2020-06-18[Ada] Small cleanup in the attribute code of the expanderEric Botcazou2-34/+34
2020-06-18 Eric Botcazou <ebotcazou@adacore.com> gcc/ada/ * exp_attr.adb (Analyze_Attribute) <Asm_{In,Out}put>: Alphabetize. <Component_Size>: Add check for universal integer attribute. <Aft>, <Bit_Order>, <Definite>, <Max_Alignment_For_Allocation>, <Scalar_Storage_Order>: Raise Program_Error on them. * sem_attr.adb (Eval_Attribute) <Component_Size>: Add comment on the packed array case.
2020-06-18[Ada] Implement AI12-0032 fixes for 'Old attribute accessibilitySteve Baird2-0/+27
2020-06-18 Steve Baird <baird@adacore.com> gcc/ada/ * sem_util.adb (Object_Access_Level): Treat a 'Old attribute reference like an aggregate in determining its static accessibility level; after the evaluation of the relevant post-condition, the implicitly declared constant associated with an Old attribute reference ceases to exist. Similarly for Loop_Entry attribute. * exp_ch6.adb (Expand_Call_Helper): For an attribute reference that is expanded into a reference to an implicitly declared constant (e.g., a 'Old or 'Loop_Entry attribute), compute the dynamic accessibility level of that constant by looking at the declaration of the constant (as opposed to looking at the attribute reference).
2020-06-18[Ada] No Default_Initial_Condition check when declaring an imported objectSteve Baird1-0/+1
2020-06-18 Steve Baird <baird@adacore.com> gcc/ada/ * exp_ch3.adb (Expand_N_Object_Declaration): Do not generate a default initial condition check for the declaration of an imported object.
2020-06-18[Ada] Add support for XDR streaming in the default runtimeArnaud Charlet13-167/+428
2020-06-18 Arnaud Charlet <charlet@adacore.com> gcc/ada/ * Makefile.rtl: Add s-statxd.o. * bindgen.adb (Gen_Adainit): Add support for XDR_Stream. * bindusg.adb (Display): Add mention of -xdr. * gnatbind.adb: Process -xdr switch. * init.c (__gl_xdr_stream): New. * opt.ads (XDR_Stream): New. * libgnat/s-stratt__xdr.adb: Rename to... * libgnat/s-statxd.adb: this and adjust. * libgnat/s-statxd.ads: New. * libgnat/s-stratt.ads, libgnat/s-stratt.adb: Choose between default and XDR implementation at runtime. * libgnat/s-ststop.ads: Update comments. * doc/gnat_rm/implementation_advice.rst: Update doc on XDR streaming. * gnat_rm.texi: Regenerate.
2020-06-18[Ada] Fix host/target confusion for attribute To_AddressEric Botcazou1-3/+3
2020-06-18 Eric Botcazou <ebotcazou@adacore.com> gcc/ada/ * sem_attr.adb (Analyze_Attribute) <To_Address>: Use the address size of the target instead of the host when checking the value of a static expression. Also use standard idiom for exponentiation.
2020-06-18[Ada] Add second warning for convention C_Variadic_nEric Botcazou1-0/+10
2020-06-18 Eric Botcazou <ebotcazou@adacore.com> gcc/ada/ * sem_prag.adb (Process_Convention): Give a warning on C_Variadic_n being applied to a subprogram with exactly n parameters.
2020-06-18[Ada] Profile mismatch between C and Ada functionsArnaud Charlet10-60/+60
2020-06-18 Arnaud Charlet <charlet@adacore.com> gcc/ada/ * libgnarl/s-osinte__linux.ads, libgnat/g-io.adb, libgnat/g-socket.adb, libgnat/g-socthi.adb, libgnat/g-socthi.ads, libgnat/g-socthi__vxworks.adb, libgnat/g-socthi__vxworks.ads, libgnat/g-sothco.ads, libgnat/s-io.adb, libgnat/a-except.adb: Fix function profile mismatch with imported C functions.
2020-06-18[Ada] Minor cleanup in Expand_Call_HelperEric Botcazou1-18/+6
2020-06-18 Eric Botcazou <ebotcazou@adacore.com> gcc/ada/ * exp_ch6.adb (Expand_Call_Helper): Remove superfluous calls to Relocate_Node and merge calls to Analyze and Resolve in a couple of places. Do not attempt to generate a range check for an actual parameter against the formal's type of a derived subprogram after generating a conversion to the formal's type of the parent subprogram.
2020-06-18[Ada] Improve compile-time evaluation of value rangesEric Botcazou3-615/+667
2020-06-18 Eric Botcazou <ebotcazou@adacore.com> gcc/ada/ * checks.adb (Compute_Range_For_Arithmetic_Op): New procedure to compute a range for an arithmetical operation extracted from... (Minimize_Eliminate_Overflows): ...here. Call it. (Determine_Range_Cache_O): New cache for Original_Node nodes. (Determine_Range): Call Compute_Range_For_Arithmetic_Op for all arithmetic expressions. Use Attribute_Id in lieu of Attribute_Name for attributes. Add handling for Range_Length alongside Length. Add specific handling for Alignment, Bit, First_Bit, Last_Bit, Max_Size_In_Storage_Elements, Position, Bit_Position, Component_Size, Object_Size, Size, Value_Size, Descriptor_Size. (Enable_Overflow_Check): Omit the check for Abs and Minus if the operand cannot be the largest negative number. (Selected_Length_Checks): Use Pos for Number_Dimensions. * exp_attr.adb (Expand_N_Attribute_Reference): Move compile-time handling of Bit_Position, Descriptor_Size, First_Bit, Last_Bit and Position to... * sem_attr.adb (Eval_Attribute): ...here. Move up Alignment for objects and use Compile_Time_Known_Attribute in this case too.
2020-06-18[Ada] Do not treat pragma Compile_Time_Warning as error even with -gnatweGhjuvan Lacambre9-858/+949
2020-06-18 Ghjuvan Lacambre <lacambre@adacore.com> gcc/ada/ * erroutc.ads: Declare new Is_Compile_Time_Msg boolean, add new Compile_Time_Pragma field to Error_Msg_Object type. (Count_Compile_Time_Pragma_Warnings): New function. * erroutc.adb (Count_Compile_Time_Pragma_Warnings): New function. (Compilation_Errors): Take Compile_Time warnings into account when tallying Errors/Warnings. * errout.ads (Error_Msg): New procedure. * errout.adb (Error_Msg): New procedure. (Error_Msg_Internal): Set new Compile_Time_Pragma field in Error_Msg_Object. * errutil.adb (Error_Msg): Set new Compile_Time_Pragma field in Error_Msg_Object. * sem_prag.adb (Validate_Compile_Time_Warning_Or_Error): Pass True to new Error_Msg procedure. * doc/gnat_rm/implementation_defined_pragmas.rst: Update doc for the Compile_Time_Warning pragma. * gnat_rm.texi: Regenerate. * opt.ads: Update comment.
2020-06-18[Ada] Suppress CodePeer message on possible uninitialized variableArnaud Charlet1-2/+2
2020-06-18 Arnaud Charlet <charlet@adacore.com> gcc/ada/ * sem_ch4.adb (Check_Compatible_Profiles): Add explicit initialization.
2020-06-18[Ada] Fix failed assertion on a slice indexed by a subtype_indicationPiotr Trojanek1-0/+4
2020-06-18 Piotr Trojanek <trojanek@adacore.com> gcc/ada/ * checks.adb (Generate_Index_Checks): Handle N_Subtype_Indication returned from Scalar_Range.
2020-06-18[Ada] Cleanups in code related to static expressionsPiotr Trojanek3-15/+14
2020-06-18 Piotr Trojanek <trojanek@adacore.com> gcc/ada/ * checks.adb, sem_ch3.adb: Minor refactorings. * sem_eval.adb (Eval_Qualified_Expression): Fix reference to RM rule in comment; only set a local variable Hex in the branch where it is used.
2020-06-18[Ada] Avoid forced loading of System.Priority in CodePeer modePiotr Trojanek1-1/+1
2020-06-18 Piotr Trojanek <trojanek@adacore.com> gcc/ada/ * sem_eval.adb (Check_Non_Static_Context): Use Is_RTE.
2020-06-18[Ada] ACATS 4.1L - B452002 - Wrong universal access "=" rulesArnaud Charlet5-99/+291
2020-06-18 Arnaud Charlet <charlet@adacore.com> gcc/ada/ * sem_ch4.adb (Find_Equality_Types.Check_Access_Object_Types): New function, used to implement RM 4.5.2 (9.6/2). (Find_Equality_Types.Check_Compatible_Profiles): New function, used to implement RM 4.5.2(9.7/2). (Find_Equality_Types.Reference_Anonymous_Access_Type): New function. (Find_Equality_Types.Try_One_Interp): Fix handling of anonymous access types which was accepting both too much and too little. Remove accumulated special and incomplete cases for instantiations, replaced by Has_Compatible_Type. (Analyze_Overloaded_Selected_Component): Use Is_Anonymous_Access_Type instead of Ekind_In. * sem_res.adb: Code cleanup and bug fix: use Is_Anonymous_Access_Type instead of Ekind_In. Relax checking of anonymous access parameter when universal_access "=" is involved. * sem_type.adb: Likewise. (Find_Unique_Type): Move code from here... (Specific_Type): ...to here. Also add missing handling of access to class wide types. * einfo.ads, einfo.adb (Is_Access_Object_Type): New.
2020-06-18[Ada] AI12-0293-1 Implement storage streamsBob Duff7-1/+483
2020-06-18 Bob Duff <duff@adacore.com> gcc/ada/ * libgnat/a-strsto.ads, libgnat/a-ststbo.adb, libgnat/a-ststbo.ads, libgnat/a-ststun.adb, libgnat/a-ststun.ads: New files, containing packages Ada.Streams.Storage, Ada.Streams.Storage.Bounded, and Ada.Streams.Storage.Unbounded. * impunit.adb, Makefile.rtl: Add new file names.
2020-06-18[Ada] Missing error on aspects Input and OutputJavier Miranda1-23/+10
2020-06-18 Javier Miranda <miranda@adacore.com> gcc/ada/ * sem_ch13.adb (Has_Good_Profile): Enforce strictness in the check. Required to detect wrong profiles for Input and Output. (Analyze_Stream_TSS_Definition): Minor enhancement in the text of the error for class-wide attributes.
2020-06-18[Ada] Small adjustment to Get_Integer_Type functionEric Botcazou1-9/+11
2020-06-18 Eric Botcazou <ebotcazou@adacore.com> gcc/ada/ * exp_attr.adb (Get_Integer_Type): Pick an unsigned type based on the Esize of the base type of the input type.
2020-06-18[Ada] Fix invalid expression sharing in Expand_Array_EqualityEric Botcazou1-9/+8
2020-06-18 Eric Botcazou <ebotcazou@adacore.com> gcc/ada/ * exp_ch4.adb (Expand_Array_Equality): For the optimization of the 2-element case, build new expression lists for the indices.
2020-06-18[Ada] Properly test for Protected_Body_SubprogramRichard Kenner1-2/+1
2020-06-18 Richard Kenner <kenner@adacore.com> gcc/ada/ * sem_util.adb (Enclosing_Subprogram): No longer need Convention_Protected.
2020-06-18[Ada] The definition of constants in declare expressions is an interfering ↵Claire Dross1-0/+1
context 2020-06-18 Claire Dross <dross@adacore.com> gcc/ada/ * sem_util.adb (Is_OK_Volatile_Context): Return False on definitions of constants declared in declare expressions.
2020-06-18[Ada] List aspect Relaxed_Initialization in GNAT RMPiotr Trojanek3-531/+568
2020-06-18 Piotr Trojanek <trojanek@adacore.com> gcc/ada/ * doc/gnat_rm/implementation_defined_aspects.rst (Relaxed_Initialization): New implementation-defined aspect. * doc/gnat_rm/implementation_defined_attributes.rst (Initialized): New implementation-defined attribute. * gnat_rm.texi: Regenerate.
2020-06-18[Ada] Crash in tagged type constructor with task componentsJavier Miranda3-4/+42
2020-06-18 Javier Miranda <miranda@adacore.com> gcc/ada/ * exp_disp.adb (Expand_Dispatching_Call): Add missing decoration of attribute Extra_Accessibility_Of_Result. * freeze.adb (Check_Extra_Formals): No check required if expansion is disabled; Adding check on Extra_Accessibilty_Of_Result. (Freeze_Subprogram): Fix decoration of Extra_Accessibility_Of_Result. * sem_ch3.adb (Derive_Subprogram): Fix decoration of Extra_Accessibility_Of_Result
2020-06-18[Ada] Small improvement to Optimize_Length_ComparisonEric Botcazou1-2/+3
2020-06-18 Eric Botcazou <ebotcazou@adacore.com> gcc/ada/ * exp_ch4.adb (Optimize_Length_Comparison): Accept 32-bit values in the full unsigned range.
2020-06-18Add missing check for gassign.Martin Liska1-2/+3
gcc/ChangeLog: * tree-vect-generic.c (expand_vector_condition): Check for gassign before inspecting RHS.
2020-06-18gcc-changelog: fix Backported from timestamp.Martin Liska1-1/+5
contrib/ChangeLog: * gcc-changelog/git_commit.py: Fix Backported from timestamp when use_commit_ts=True is used.
2020-06-18Daily bump.GCC Administrator10-1/+757
2020-06-18[OpenMP, gimplifier] 'inform' after 'error' diagnosticThomas Schwinge22-53/+54
This is not a thorough review of the code, just a few cases I noticed while scanning 'gcc/gimplify.c' for "enclosing". gcc/ * gimplify.c (omp_notice_threadprivate_variable) (omp_default_clause, omp_notice_variable): 'inform' after 'error' diagnostic. Adjust all users. gcc/testsuite/ * c-c++-common/gomp/default-1.c: Update. * c-c++-common/gomp/defaultmap-3.c: Likewise. * c-c++-common/gomp/order-4.c: Likewise. * g++.dg/gomp/parallel-2.C: Likewise. * g++.dg/gomp/predetermined-1.C: Likewise. * g++.dg/gomp/sharing-1.C: Likewise. * gcc.dg/gomp/appendix-a/a.24.1.c: Likewise. * gcc.dg/gomp/parallel-2.c: Likewise. * gcc.dg/gomp/pr44085.c: Likewise. * gcc.dg/gomp/sharing-1.c: Likewise. * gcc.dg/gomp/vla-1.c: Likewise. * gfortran.dg/gomp/appendix-a/a.24.1.f90: Likewise. * gfortran.dg/gomp/crayptr3.f90: Likewise. * gfortran.dg/gomp/pr33439.f90: Likewise. * gfortran.dg/gomp/pr44036-1.f90: Likewise. * gfortran.dg/gomp/pr44085.f90: Likewise. * gfortran.dg/gomp/pr44536.f90: Likewise. * gfortran.dg/gomp/pr94672.f90: Likewise. * gfortran.dg/gomp/sharing-1.f90: Likewise. * gfortran.dg/gomp/sharing-2.f90: Likewise. * gfortran.dg/gomp/sharing-3.f90: Likewise.
2020-06-18Add 'dg-do run' to 'libgomp.fortran/use_device_ptr-optional-3.f90' [PR94848]Thomas Schwinge1-0/+1
Fix-up for r279858/commit f760c0c77fe350616da9dbeaea16442b0acfb09c "Fortran] OpenMP/OpenACC – fix more issues with OPTIONAL". With offloading enabled, we then saw: PASS: libgomp.fortran/use_device_ptr-optional-3.f90 -O0 (test for excess errors) PASS: libgomp.fortran/use_device_ptr-optional-3.f90 -O0 execution test PASS: libgomp.fortran/use_device_ptr-optional-3.f90 -O1 (test for excess errors) PASS: libgomp.fortran/use_device_ptr-optional-3.f90 -O1 execution test FAIL: libgomp.fortran/use_device_ptr-optional-3.f90 -O2 (test for excess errors) UNRESOLVED: libgomp.fortran/use_device_ptr-optional-3.f90 -O2 compilation failed to produce executable FAIL: libgomp.fortran/use_device_ptr-optional-3.f90 -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions (test for excess errors) UNRESOLVED: libgomp.fortran/use_device_ptr-optional-3.f90 -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions compilation failed to produce executable FAIL: libgomp.fortran/use_device_ptr-optional-3.f90 -O3 -g (test for excess errors) UNRESOLVED: libgomp.fortran/use_device_ptr-optional-3.f90 -O3 -g compilation failed to produce executable FAIL: libgomp.fortran/use_device_ptr-optional-3.f90 -Os (test for excess errors) UNRESOLVED: libgomp.fortran/use_device_ptr-optional-3.f90 -Os compilation failed to produce executable ... due to: /tmp/cciVc43I.o:(.gnu.offload_vars+0x10): undefined reference to `A.12.4064' [...] ..., but after the recent PR94848, PR95551 changes, that problem is now gone. libgomp/ PR lto/94848 * testsuite/libgomp.fortran/use_device_ptr-optional-3.f90: Add 'dg-do run'.
2020-06-18hurd: libgcc unwinding support over signal trampolinesSamuel Thibault2-1/+114
libgcc/ * config.host (md_unwind_header) <i[34567]86-*-gnu*>: Set to 'i386/gnu-unwind.h' * config/i386/gnu-unwind.h: New file. Signed-off-by: Thomas Schwinge <thomas@codesourcery.com>
2020-06-17libstdc++: Avoid stack overflow in std::vector (PR 94540)Jonathan Wakely6-16/+200
The std::__uninitialized_default_n algorithm used by std::vector creates an initial object as a local variable then copies that into the destination range. If the object is too large for the stack this crashes. We should create the first object directly into the destination and then copy it from there. This doesn't fix the bug for C++98, because in that case the initial value is created as a default argument of the vector constructor i.e. in the user's code, not inside libstdc++. We can't prevent that. PR libstdc++/94540 * include/bits/stl_uninitialized.h (__uninitialized_default_1<true>): Construct the first value at *__first instead of on the stack. (__uninitialized_default_n_1<true>): Likewise. Improve comments on several of the non-standard algorithms. * testsuite/20_util/specialized_algorithms/uninitialized_default/94540.cc: New test. * testsuite/20_util/specialized_algorithms/uninitialized_default_n/94540.cc: New test. * testsuite/20_util/specialized_algorithms/uninitialized_value_construct/94540.cc: New test. * testsuite/20_util/specialized_algorithms/uninitialized_value_construct_n/94540.cc: New test. * testsuite/23_containers/vector/cons/94540.cc: New test.
2020-06-17[HSA] Avoid ICE when "HSA does not implement indirect calls"Thomas Schwinge2-4/+29
Made apparent by recent commit dc703151d4f4560e647649506d5b4ceb0ee11e90 "openmp: Implement discovery of implicit declare target to clauses": +FAIL: libgomp.c/target-39.c (internal compiler error) +FAIL: libgomp.c/target-39.c (test for excess errors) +UNRESOLVED: libgomp.c/target-39.c compilation failed to produce executable This is in a '--enable-offload-targets=[...],hsa' build, with '-foffload=hsa' enabled (by default). during GIMPLE pass: hsagen source-gcc/libgomp/testsuite/libgomp.c/target-39.c: In function ‘main._omp_fn.0.hsa.0’: source-gcc/libgomp/testsuite/libgomp.c/target-39.c:23:11: internal compiler error: Segmentation fault 23 | #pragma omp target map(from:err) | ^~~ [...] GDB: Program received signal SIGSEGV, Segmentation fault. fndecl_built_in_p (node=0x0, name=BUILT_IN_PREFETCH) at [...]/source-gcc/gcc/tree.h:6267 6267 return (fndecl_built_in_p (node, BUILT_IN_NORMAL) (gdb) bt #0 fndecl_built_in_p (node=0x0, name=BUILT_IN_PREFETCH) at [...]/source-gcc/gcc/tree.h:6267 #1 0x0000000000b19739 in gen_hsa_insns_for_call (stmt=stmt@entry=0x7ffff693b200, hbb=hbb@entry=0x2b152c0) at [...]/source-gcc/gcc/hsa-gen.c:5304 #2 0x0000000000b1aca7 in gen_hsa_insns_for_gimple_stmt (stmt=0x7ffff693b200, hbb=hbb@entry=0x2b152c0) at [...]/source-gcc/gcc/hsa-gen.c:5770 #3 0x0000000000b1bd21 in gen_body_from_gimple () at [...]/source-gcc/gcc/hsa-gen.c:5999 #4 0x0000000000b1dbd2 in generate_hsa (kernel=<optimized out>) at [...]/source-gcc/gcc/hsa-gen.c:6596 #5 0x0000000000b1de66 in (anonymous namespace)::pass_gen_hsail::execute (this=0x2a2aac0) at [...]/source-gcc/gcc/hsa-gen.c:6680 #6 0x0000000000d06f90 in execute_one_pass (pass=pass@entry=0x2a2aac0) at [...]/source-gcc/gcc/passes.c:2502 [...] (gdb) up #1 0x0000000000b19739 in gen_hsa_insns_for_call (stmt=stmt@entry=0x7ffff693b200, hbb=hbb@entry=0x2b152c0) at /home/thomas/tmp/source/gcc/build/track-slim-omp/source-gcc/gcc/hsa-gen.c:5304 5304 if (fndecl_built_in_p (function_decl, BUILT_IN_PREFETCH)) (gdb) print function_decl $1 = (tree) 0x0 (gdb) list 5299 if (!gimple_call_builtin_p (stmt, BUILT_IN_NORMAL)) 5300 { 5301 tree function_decl = gimple_call_fndecl (stmt); 5302 /* Prefetch pass can create type-mismatching prefetch builtin calls which 5303 fail the gimple_call_builtin_p test above. Handle them here. */ 5304 if (fndecl_built_in_p (function_decl, BUILT_IN_PREFETCH)) 5305 return; 5306 5307 if (function_decl == NULL_TREE) 5308 { The problem is present already since 2016-11-23 commit 56b1c60e412fcf1245b4780871553cbdebb956a3 (r242761) "Merge from HSA branch to trunk", and the fix obvious enough. gcc/ * hsa-gen.c (gen_hsa_insns_for_call): Move 'function_decl == NULL_TREE' check earlier. gcc/testsuite/ * c-c++-common/gomp/hsa-indirect-call-1.c: New file.
2020-06-17Fix typo in attribute access example.Forrest Timour1-1/+1
Fix typo in documentation example of access function attribute where the ref-indices should be one-indexed instead of zero-indexed. gcc/ChangeLog: * doc/extend.texi (attribute access): Fix a typo.
2020-06-17libstdc++: Fix tests for uninitialized_value_construct_nJonathan Wakely2-46/+12
In my recent r11-1460 commit the tests had been "improved" before commit, and no longer exercised the code paths changed by the patch. This restores what I originally tested, so that the tests fail before the r11-1460 change and pass after it. * testsuite/20_util/specialized_algorithms/uninitialized_default_n/sizes.cc: Replace Value type with int so trivial code path is used. * testsuite/20_util/specialized_algorithms/uninitialized_value_construct_n/sizes.cc: Likewise.
2020-06-17libstdc++: Handle non-integral sizes in std::uninitialized_fill_nJonathan Wakely4-9/+224
The std::uninitialized_fill_n algorithm uses sd::fill_n for trivial types, but that algorithm has a stronger requirement that the Size parameter is convertible to an integral type. As the new test shows, there are types which are valid for std::uninitialized_fill_n but which produce a different result when converted to an integral type, or cannot be converted at all. Only use the std::fill_n optimization when the Size type is already an integral type. The std::__uninitialized_default_n extension has the same problem, and so does C++17's std::uninitialized_value_construct_n which uses it. * include/bits/stl_uninitialized.h (uninitialized_fill_n): Only use std::fill_n when the size is an integral type. (__uninitialized_default_n): Likewise. * testsuite/20_util/specialized_algorithms/uninitialized_default_n/sizes.cc: New test. * testsuite/20_util/specialized_algorithms/uninitialized_fill_n/sizes.cc: New test. * testsuite/20_util/specialized_algorithms/uninitialized_value_construct_n/sizes.cc: New test.
2020-06-17c++: Fix bogus "does not declare anything" warning (PR 66159)Jonathan Wakely2-2/+10
G++ gives a bogus warning for 'struct A; using B = struct ::A;' complaining that the elaborated-type-specifier doesn't declare anything. That's true, but it's not trying to declare struct ::A, just refer to it unambiguously. Do not emit the warning unless we're actually parsing a declaration. gcc/cp/ChangeLog: PR c++/66159 * parser.c (cp_parser_elaborated_type_specifier): Do not warn unless in a declaration. gcc/testsuite/ChangeLog: PR c++/66159 * g++.dg/warn/forward-inner.C: Check alias-declaration using elaborated-type-specifier.
2020-06-17vect: CSE for bump and offset in strided load/store operations.Kaipeng Zhou2-12/+22
Every time "vect_get_strided_load_store_ops" is called, new bump and offset variables and a series of stmts are created. And IVOPTs is not able to eliminate them. The patch use "cse_and_gimplify_to_preheader" to CSE them. 2020-06-17 Bin Cheng <bin.cheng@linux.alibaba.com> Kaipeng Zhou <zhoukaipeng3@huawei.com> PR tree-optimization/95199 * tree-vect-stmts.c: Eliminate common stmts for bump and offset in strided load/store operations and remove redundant code. 2020-06-17 Bin Cheng <bin.cheng@linux.alibaba.com> Kaipeng Zhou <zhoukaipeng3@huawei.com> PR tree-optimization/95199 * gcc.target/aarch64/sve/pr95199.c: New test.
2020-06-17c++: implicit operator== adjustments from P2002.Jason Merrill4-103/+128
P2002R1, adopted at the February C++ meeting, made several refinements to the wording for operator<=>. This implements clarifications in how the implicit operator== is declared: as a duplicate of the operator<=>, with only the return type and name changed. To that end I factored out the declaration copying from build_clone. gcc/cp/ChangeLog: * cp-tree.h (copy_fndecl_with_name): Declare. * class.c (copy_fndecl_with_name): Split out from... (build_clone): ...here. (add_implicitly_declared_members): Add op== to TYPE_FIELDS. * method.c (implicitly_declare_fn): Use copy_fndecl_with_name. gcc/testsuite/ChangeLog: * g++.dg/cpp2a/spaceship-synth9.C: New test.
2020-06-17c++: Add test for C++20 NB comment CA107.Jason Merrill1-0/+33
We already implemented this, but it's good to have a test. gcc/testsuite/ChangeLog: * g++.dg/cpp2a/concepts-ca107.C: New test.
2020-06-17c++: Fix consteval operator handling.Jason Merrill2-1/+12
We were crashing trying to find the CALL_EXPR in the result of a call to a consteval operator. gcc/cp/ChangeLog: * call.c (build_new_op_1): Don't look for a CALL_EXPR when calling a consteval function. gcc/testsuite/ChangeLog: * g++.dg/cpp2a/consteval17.C: New test.
2020-06-17c++: Treat in-class default/delete as definitions.Jason Merrill5-16/+37
We were complaining about a constrained defaulted non-template friend in a template class because funcdef_flag wasn't set. grokdeclarator would set it for default/delete, but grokfield wasn't passing the 'initialized' values needed. Fixing that revealed some errors in existing tests that we weren't diagnosing. Since we accepted them for so long, I'm reducing the error to a pedwarn to ease compiler upgrade. gcc/cp/ChangeLog: * decl2.c (grokfield): Pass SD_DEFAULTED and SD_DELETED. * decl.c (duplicate_decls): Reduce error for delete after earlier declaration to pedwarn. gcc/testsuite/ChangeLog: * g++.dg/cpp0x/pr62101.C: Expect error. * g++.dg/cpp0x/pr80259.C: Expect error. * g++.dg/cpp2a/concepts-friend8.C: New test.
2020-06-17c-family: check qualifiers of arguments to __atomic built-ins (PR 95378)Jonathan Wakely2-0/+152
Currently the __atomic_{load,store,exchange,compare_exchange} built-ins will happily store values through pointers to const, or use pointers to volatile as the input and output arguments. This patch ensures that any pointer that will be written through does not point to a const object, and only the pointer to the atomic variable can be volatile. This differs slightly from Clang, which allows the third argument to __atomic_exchange (the one that is used to return the old value) to be volatile if and only if the first argument is volatile. That doesn't seem useful. For C++ emit errors, but for C use pedwarns that are controlled by -Wincompatible-pointer-types. gcc/c-family/ChangeLog: * c-common.c (get_atomic_generic_size): Check cv-qualifiers in pointer arguments. gcc/testsuite/ChangeLog: * c-c++-common/pr95378.c: New test.
2020-06-17recog: Tweak insn_gen_fn::operator() definitionRichard Sandiford2-2/+7
Fixes a “left operand of comma has no effect” warning that some were seeing. Also fixes a spurious ellipsis that Jonathan Wakely pointed out. 2020-06-17 Richard Sandiford <richard.sandiford@arm.com> gcc/ * coretypes.h (first_type): New alias template. * recog.h (insn_gen_fn::operator()): Use it instead of a decltype. Remove spurious “...” and split the function type out into a typedef.
2020-06-17IBM Z: Prevent mach optimization on doloop patternsAndreas Krebbel2-2/+30
s390_fix_long_loop_prediction is used in machine dependent reorg. There we use single_set to distingiush between conditional jumps and branch on count patterns. However, single_set returns a non-NULL value also for PARALLELs in case one of the SETs is dead. 2020-06-17 Andreas Krebbel <krebbel@linux.ibm.com> gcc/ * config/s390/s390.c (s390_fix_long_loop_prediction): Exit early for PARALLELs. gcc/testsuite/ * gcc.target/s390/20200617.c: New test.
2020-06-17Use SLP_TREE_VECTYPE consistentlyRichard Biener2-10/+17
This assigns SLP_TREE_VECTYPE to all SLP nodes and uses it when analyzing def operands. It does not deal with mismatches between SLP_TREE_VECTYPE and STMT_VINFO_VECTYPE yet - those cases are still rejected until I get to clean up the interaction with data reference groups. 2020-06-17 Richard Biener <rguenther@suse.de> * tree-vect-slp.c (vect_build_slp_tree_1): Set the passed in *vectype parameter. (vect_build_slp_tree_2): Set SLP_TREE_VECTYPE from what vect_build_slp_tree_1 computed. (vect_analyze_slp_instance): Set SLP_TREE_VECTYPE. (vect_slp_analyze_node_operations_1): Use the SLP node vector type. (vect_schedule_slp_instance): Likewise. * tree-vect-stmts.c (vect_is_simple_use): Take the vector type from SLP_TREE_VECTYPE.
2020-06-17c++: ICE with IMPLICIT_CONV_EXPR in array subscript [PR95508]Marek Polacek4-1/+33
Since r10-7096 convert_like, when called in a template, creates an IMPLICIT_CONV_EXPR when we're converting to/from array type. In this test, we have e[f], and we're converting f (of type class A) to int, so convert_like in build_new_op_1 created the IMPLICIT_CONV_EXPR that got into cp_build_array_ref which calls maybe_constant_value. My patch above failed to adjust this spot to call fold_non_dependent_expr instead, which can handle codes like I_C_E in a template. Fixed by using a new function maybe_fold_non_dependent_expr, which, if the expr can't be evaluated to a constant, returns the original expression. gcc/cp/ChangeLog: PR c++/95508 * constexpr.c (maybe_fold_non_dependent_expr): New. * cp-tree.h (maybe_fold_non_dependent_expr): Declare. * typeck.c (cp_build_array_ref): Call maybe_fold_non_dependent_expr instead of maybe_constant_value. gcc/testsuite/ChangeLog: PR c++/95508 * g++.dg/template/conv16.C: New test.
2020-06-17Fix use of inaccessible member in pr85503.C [PR95716]Patrick Palka1-0/+1
The recent PR41437 fix exposed a latent use of an inaccessible member in the below testcase. gcc/testsuite/ChangeLog: PR testsuite/95716 * g++.dg/ext/pr85503.C: Give ai::cv public access.