aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2020-11-26[Ada] Add support for 128-bit fixed-point types on 64-bit platformsEric Botcazou147-2350/+7391
gcc/ada/ * Makefile.rtl (GNATRTL_NONTASKING_OBJS): Likewise. (GNATRTL_128BIT_OBJS): Likewise. (GNATRTL_128BIT_PAIRS): Add new 128-bit variants. * cstand.adb (Create_Standard): Create Standard_Integer_128. * doc/gnat_rm/implementation_defined_characteristics.rst: Document new limits on 64-bit platforms in entry for 3.5.9(10). * gnat_rm.texi: Regenerate. * exp_attr.adb: Add with and use clauses for Urealp. (Expand_N_Attribute_Reference) <Attribute_Fore>: Call new routines for decimal fixed-point types and common ordinary fixed-point types. * exp_ch4.adb (Real_Range_Check): Extend conversion trick to all ordinary fixed-point types and use Small_Integer_Type_For. * exp_fixd.adb: Add with and use clauses for Ttypes. (Build_Divide): Add special case for 32-bit values and deal with 128-bit types. (Build_Double_Divide): Deal with 128-bit types. (Build_Double_Divide_Code): Likewise. Do not apply conversions before calling Build_Multiply. (Build_Multiply): Likewise. Add special case for 32-bit values. (Build_Scaled_Divide): Deal with 128-bit types. (Build_Scaled_Divide_Code): Likewise. Fix size computation. Do not apply conversions before calling Build_Multiply. (Do_Multiply_Fixed_Fixed): Minor tweak. (Integer_Literal): Deal with 128-bit values. * exp_imgv.adb (Has_Decimal_Small): Delete. (Expand_Image_Attribute): Call new routines for common ordinary fixed-point types. (Expand_Value_Attribute): Likewise. (Expand_Width_Attribute): Add new expansion for fixed-point types. * freeze.adb (Freeze_Entity): Move error checks for ordinary fixed-point types to... (Freeze_Fixed_Point_Type): ...here. Deal with 128-bit types and adjust limitations for 32-bnt and 64-bit types. * rtsfind.ads (RTU_Id): Add entries for new System_Fore, System_Img, and System_Val units and remove them for obsolete units. (RE_Id): Add entries for Double_Divide128, Scaled_Divide128, the new Fore, Image, Value routines and remove them for obsolete units. (RE_Unit_Table): Likewise. * sem_ch3.adb (Decimal_Fixed_Point_Type_Declaration): Deal with 128-bit types. * stand.ads (Standard_Entity_Type): Add Standard_Integer_128. * uintp.ads (Uint_31): New deferred constant. (Uint_Minus_18): Likewise. (Uint_Minus_31): Likewise. (Uint_Minus_76): Likewise. (Uint_Minus_127): Likewise. * urealp.ads (Ureal_2_31): New function. (Ureal_2_63): Likewise. (Ureal_2_127): Likewise. (Ureal_2_M_127): Likewise. (Ureal_2_10_18): Likewise. (Ureal_M_2_10_18): Likewise. (Ureal_9_10_36): Likewise. (Ureal_M_9_10_36): Likewise. (Ureal_10_76): Likewise. (Ureal_M_10_76): Likewise. (Ureal_10_36): Delete. (Ureal_M_10_36): Likewise. * urealp.adb (UR_2_10_18): New variable. (UR_9_10_36): Likewise. (UR_10_76): Likewise. (UR_M_2_10_18): Likewise. (UR_M_9_10_36): Likewise. (UR_M_10_76): Likewise. (UR_2_31): Likewise. (UR_2_63): Likewise. (UR_2_127): Likewise. (UR_2_M_127): Likewise. (UR_10_36): Delete. (UR_M_10_36): Likewise. (Initialize): Initialize them. (UR_Write): Do not use awkward Ada literal style. (Ureal_2_10_18): New function. (Ureal_9_10_36): Likewise. (Ureal_10_76): Likewise. (Ureal_2_31): Likewise. (Ureal_2_63): Likewise. (Ureal_2_127): Likewise. (Ureal_2_M_127): Likewise. (Ureal_M_2_10_18): Likewise. (Ureal_M_9_10_36): Likewise. (Ureal_10_76): Likewise. (Ureal_M_10_76): Likewise. (Ureal_10_36): Delete. (Ureal_M_10_36): Likewise. * libgnat/a-decima__128.ads: New file. * libgnat/a-tideau.ads, libgnat/a-tideau.adb: Reimplement as generic unit. * libgnat/a-tideio.adb: Reimplement. * libgnat/a-tideio__128.adb: New file. * libgnat/a-tifiau.ads, libgnat/a-tifiau.adb: New generic unit. * libgnat/a-tifiio.adb: Move bulk of implementation to s-imagef and reimplement. * libgnat/a-tifiio__128.adb: New file. * libgnat/a-tiflau.adb (Get): Minor consistency fix. (Gets): Likewise. * libgnat/a-wtdeau.ads, libgnat/a-wtdeau.adb: Reimplement as generic unit. * libgnat/a-wtdeio.adb: Reimplement. * libgnat/a-wtdeio__128.adb: New file. * libgnat/a-wtfiau.ads, libgnat/a-wtfiau.adb: New generic unit. * libgnat/a-wtfiio.adb: Reimplement. * libgnat/a-wtfiio__128.adb: New file. * libgnat/a-ztdeau.ads, libgnat/a-ztdeau.adb: Reimplement as generic unit. * libgnat/a-ztdeio.adb: Reimplement. * libgnat/a-ztdeio__128.adb: New file. * libgnat/a-ztfiau.ads, libgnat/a-ztfiau.adb: New generic unit. * libgnat/a-ztfiio.adb: Reimplement. * libgnat/a-ztfiio__128.adb: New file. * libgnat/g-rannum.adb (Random_Decimal_Fixed): Use a subtype of the appropiate size for the instantiation. (Random_Ordinary_Fixed): Likewise. * libgnat/s-arit32.ads, libgnat/s-arit32.adb: New support unit. * libgnat/s-fode128.ads: New instantiation. * libgnat/s-fode32.ads: Likewise. * libgnat/s-fode64.ads: Likewise. * libgnat/s-fofi128.ads: Likewise. * libgnat/s-fofi32.ads: Likewise. * libgnat/s-fofi64.ads: Likewise. * libgnat/s-fore_d.ads, libgnat/s-fore_d.adb: New generic unit. * libgnat/s-fore_f.ads, libgnat/s-fore_f.adb: Likewise. * libgnat/s-fore.ads, libgnat/s-fore.adb: Rename into... * libgnat/s-forrea.ads, libgnat/s-forrea.adb: ...this. * libgnat/s-imaged.ads, libgnat/s-imaged.adb: New generic unit. * libgnat/s-imagef.ads, libgnat/s-imagef.adb: Likewise, taken from a-tifiio.adb. * libgnat/s-imde128.ads: New instantiation. * libgnat/s-imde32.ads: Likewise. * libgnat/s-imde64.ads: Likewise. * libgnat/s-imfi128.ads: Likewise. * libgnat/s-imfi32.ads: Likewise. * libgnat/s-imfi64.ads: Likewise. * libgnat/s-imgdec.ads, libgnat/s-imgdec.adb: Delete. * libgnat/s-imglld.ads, libgnat/s-imglld.adb: Likewise. * libgnat/s-imgrea.adb (Set_Image_Real): Replace Sign local variable with Minus local variable for the sake of consistency. * libgnat/s-imguti.ads, libgnat/s-imguti.adb: New support unit. * libgnat/s-vade128.ads: New instantiation. * libgnat/s-vade32.ads: Likewise. * libgnat/s-vade64.ads: Likewise. * libgnat/s-vafi128.ads: Likewise. * libgnat/s-vafi32.ads: Likewise. * libgnat/s-vafi64.ads: Likewise. * libgnat/s-valdec.ads, libgnat/s-valdec.adb: Delete. * libgnat/s-vallld.ads, libgnat/s-vallld.adb: Likewise. * libgnat/s-valued.ads, libgnat/s-valued.adb: New generic unit. * libgnat/s-valuef.ads, libgnat/s-valuef.adb: Likewise. * libgnat/s-valuei.adb: Minor rewording. * libgnat/s-valrea.adb: Move bulk of implementation to... * libgnat/s-valuer.ads, libgnat/s-valuer.adb: ...here. New generic unit. * libgnat/system-aix.ads (Max_Mantissa): Adjust. * libgnat/system-darwin-arm.ads (Max_Mantissa): Likewise. * libgnat/system-darwin-ppc.ads (Max_Mantissa): Likewise. * libgnat/system-darwin-x86.ads (Max_Mantissa): Likewise. * libgnat/system-djgpp.ads (Max_Mantissa): Likewise. * libgnat/system-dragonfly-x86_64.ads (Max_Mantissa): Likewise. * libgnat/system-freebsd.ads (Max_Mantissa): Likewise. * libgnat/system-hpux-ia64.ads (Max_Mantissa): Likewise. * libgnat/system-hpux.ads (Max_Mantissa): Likewise. * libgnat/system-linux-alpha.ads (Max_Mantissa): Likewise. * libgnat/system-linux-arm.ads (Max_Mantissa): Likewise. * libgnat/system-linux-hppa.ads (Max_Mantissa): Likewise. * libgnat/system-linux-ia64.ads (Max_Mantissa): Likewise. * libgnat/system-linux-m68k.ads (Max_Mantissa): Likewise. * libgnat/system-linux-mips.ads (Max_Mantissa): Likewise. * libgnat/system-linux-ppc.ads (Max_Mantissa): Likewise. * libgnat/system-linux-riscv.ads (Max_Mantissa): Likewise. * libgnat/system-linux-s390.ads (Max_Mantissa): Likewise. * libgnat/system-linux-sh4.ads (Max_Mantissa): Likewise. * libgnat/system-linux-sparc.ads (Max_Mantissa): Likewise. * libgnat/system-linux-x86.ads (Max_Mantissa): Likewise. * libgnat/system-lynxos178-ppc.ads (Max_Mantissa): Likewise. * libgnat/system-lynxos178-x86.ads (Max_Mantissa): Likewise. * libgnat/system-mingw.ads (Max_Mantissa): Likewise. * libgnat/system-qnx-aarch64.ads (Max_Mantissa): Likewise. * libgnat/system-rtems.ads (Max_Mantissa): Likewise. * libgnat/system-solaris-sparc.ads (Max_Mantissa): Likewise. * libgnat/system-solaris-x86.ads (Max_Mantissa): Likewise. * libgnat/system-vxworks-arm-rtp-smp.ads (Max_Mantissa): Likewise. * libgnat/system-vxworks-arm-rtp.ads (Max_Mantissa): Likewise. * libgnat/system-vxworks-arm.ads (Max_Mantissa): Likewise. * libgnat/system-vxworks-e500-kernel.ads (Max_Mantissa): Likewise. * libgnat/system-vxworks-e500-rtp-smp.ads (Max_Mantissa): Likewise. * libgnat/system-vxworks-e500-rtp.ads (Max_Mantissa): Likewise. * libgnat/system-vxworks-e500-vthread.ads (Max_Mantissa): Likewise. * libgnat/system-vxworks-ppc-kernel.ads (Max_Mantissa): Likewise. * libgnat/system-vxworks-ppc-ravenscar.ads (Max_Mantissa): Likewise. * libgnat/system-vxworks-ppc-rtp-smp.ads (Max_Mantissa): Likewise. * libgnat/system-vxworks-ppc-rtp.ads (Max_Mantissa): Likewise. * libgnat/system-vxworks-ppc-vthread.ads (Max_Mantissa): Likewise. * libgnat/system-vxworks-ppc.ads (Max_Mantissa): Likewise. * libgnat/system-vxworks-x86-kernel.ads (Max_Mantissa): Likewise. * libgnat/system-vxworks-x86-rtp-smp.ads (Max_Mantissa): Likewise. * libgnat/system-vxworks-x86-rtp.ads (Max_Mantissa): Likewise. * libgnat/system-vxworks-x86-vthread.ads (Max_Mantissa): Likewise. * libgnat/system-vxworks-x86.ads (Max_Mantissa): Likewise. * libgnat/system-vxworks7-aarch64-rtp-smp.ads (Max_Mantissa): Likewise. * libgnat/system-vxworks7-aarch64.ads (Max_Mantissa): Likewise. * libgnat/system-vxworks7-arm-rtp-smp.ads (Max_Mantissa): Likewise. * libgnat/system-vxworks7-arm.ads (Max_Mantissa): Likewise. * libgnat/system-vxworks7-e500-kernel.ads (Max_Mantissa): Likewise. * libgnat/system-vxworks7-e500-rtp-smp.ads (Max_Mantissa): Likewise. * libgnat/system-vxworks7-e500-rtp.ads (Max_Mantissa): Likewise. * libgnat/system-vxworks7-ppc-kernel.ads (Max_Mantissa): Likewise. * libgnat/system-vxworks7-ppc-rtp-smp.ads (Max_Mantissa): Likewise. * libgnat/system-vxworks7-ppc-rtp.ads (Max_Mantissa): Likewise. * libgnat/system-vxworks7-ppc64-kernel.ads (Max_Mantissa): Likewise. * libgnat/system-vxworks7-ppc64-rtp-smp.ads (Max_Mantissa): Likewise. * libgnat/system-vxworks7-x86-kernel.ads (Max_Mantissa): Likewise. * libgnat/system-vxworks7-x86-rtp-smp.ads (Max_Mantissa): Likewise. * libgnat/system-vxworks7-x86-rtp.ads (Max_Mantissa): Likewise. * libgnat/system-vxworks7-x86_64-kernel.ads (Max_Mantissa): Likewise. * libgnat/system-vxworks7-x86_64-rtp-smp.ads (Max_Mantissa): Likewise. gcc/testsuite/ * gnat.dg/multfixed.adb: Robustify.
2020-11-26[Ada] Add the remark concerning the use of Image_Ordinary_Fixed_PointLiaiss Merzougue1-0/+3
gcc/ada/ * libgnat/s-imgrea.ads (Image_Ordinary_Fixed_Point): Add a remark concerning the irrelevant use of Inf and -0.0
2020-11-26[Ada] Add support for .c output fileArnaud Charlet1-5/+4
gcc/ada/ * osint-c.adb (Set_Output_Object_File_Name): Add support for .c output file.
2020-11-26[Ada] Reuse Is_Generic_Subprogram where possiblePiotr Trojanek3-11/+5
gcc/ada/ * lib-writ.adb, sem_ch8.adb, sem_prag.adb: Use Is_Generic_Subprogram instead of low-level membership tests.
2020-11-26[Ada] Minor reformatting and a typo fixGary Dismukes2-4/+3
gcc/ada/ * sem_ch6.adb (Analyze_Call_And_Resolve): Reformatted a comment. * sem_prag.adb (Process_Restrictions_Or_Restriction_Warnings): Fixed a typo.
2020-11-26[Ada] Replace warning suppression with assertionPiotr Trojanek1-1/+1
gcc/ada/ * sem_res.adb (Resolve_Membership_Op): Replace pragma Warnings with pragma Assert.
2020-11-26[Ada] Improve error message on illegal prefixed procedure callEd Schonberg1-0/+21
gcc/ada/ * sem_ch6.adb (Analyze_Call_And_Resolve): Add information to the error message on an illegal procedure call, when the illegality is due to the presence of a component of the full view of the target object, as well as a procedure with the same name (See RM 4.1.3 (9.2/3)).
2020-11-26[Ada] Crash on task declaration with Restriction_Warning (No_Tasking)Ed Schonberg1-3/+6
gcc/ada/ * sem_prag.adb (Process_Restrictions_Or_Restriction_Warnings): when the restriction is a configuration pragma and specifies No_Tasking, a global flag is set to reject task declarations, and to prevent the construction of Master entities. The flag must not be set if the pragma is a Restriction_Warning, in which case task declarationns are allowed.
2020-11-26[Ada] Sync wide Ada.String hashing unitsPiotr Trojanek2-9/+11
gcc/ada/ * libgnat/a-stzhas.adb (Wide_Wide_Hash): Instantiate inside a wrapper function. * libgnat/a-stzhas.ads (Wide_Wide_Hash): Likewise; remove wrong comment, because this is indeed a RM unit, as described in Ada RM A.4.8 (1/3).
2020-11-26[Ada] Avoid potentially repeated calls to Prefix in Eval_SlicePiotr Trojanek1-2/+3
gcc/ada/ * sem_eval.adb (Eval_Slice): Refactor repeated calls to Prefix with a local constant (named just like in Resolve_Slice).
2020-11-26[Ada] Warn on slices of the form A (subtype) for all objectsPiotr Trojanek1-1/+1
gcc/ada/ * sem_eval.adb (Eval_Slice): Emit warning not just for constants, but for any objects.
2020-11-26[Ada] Remove duplicated calls to Set_EntityPiotr Trojanek3-4/+2
gcc/ada/ * sem_ch4.adb (Indicate_Name_And_Type): Fix whitespace in comment. * sem_res.adb (Resolve_Call): Remove redundant parens. * sem_util.adb (Set_Entity_With_Checks): Remove extra call to Set_Entity.
2020-11-26[Ada] Memory leak in concatenation with Initialize_ScalarsBob Duff1-0/+9
gcc/ada/ * exp_ch4.adb (Expand_Concatenate): Call Set_No_Initialization on the N_Allocator node that is supposed to allocate on the secondary stack.
2020-11-26[Ada] Reuse Is_Concurrent_Type when detecting protected or task typesPiotr Trojanek4-9/+7
gcc/ada/ * exp_ch13.adb, exp_ch9.adb, sem_ch8.adb, sem_util.adb: Replace a combination of Is_Protected_Type and Is_Task_Type by Is_Concurrent_Type.
2020-11-26[Ada] Constraint_Error in Task_Wrapper and -u0Arnaud Charlet1-6/+5
gcc/ada/ * libgnarl/s-tassta.adb (Task_Wrapper): Fix computation of Pattern_Size.
2020-11-26[Ada] Pass base type to Set_Has_Own_InvariantsBob Duff3-9/+2
gcc/ada/ * freeze.adb (Freeze_Array_Type): Remove propagation of Has_Own_Invariants to the first subtype. This is a no-op, because the current (incorrect) version of Has_Own_Invariants calls Base_Type. * sem_prag.adb, sem_util.adb: Pass the base type to Set_Has_Own_Invariants.
2020-11-26[Ada] Adjust documentation of Aft_Value and Scale_ValueEric Botcazou1-5/+8
gcc/ada/ * einfo.ads (Aft_Value): Adjust documentation. (Scale_Value): Likewise.
2020-11-26[Ada] Incorrect runtime accessibility check on access discriminantJustin Squirek1-1/+1
gcc/ada/ * exp_ch4.adb (Expand_N_Type_Conversion): Use the unexpanded operand when generating accessibility checks.
2020-11-26[Ada] Remove extra whitespace in bounded container Read proceduresPiotr Trojanek3-3/+3
gcc/ada/ * libgnat/a-cbhase.adb (Read): Remove extra whitespace. * libgnat/a-cbmutr.ads (Read): Likewise. * libgnat/a-cborse.adb (Read): Likewise.
2020-11-26[Ada] Reuse Is_Access_Object_Type where possiblePiotr Trojanek3-6/+3
gcc/ada/ * exp_ch7.adb, exp_util.adb, freeze.adb: Rewrite with Is_Access_Object_Type.
2020-11-26[Ada] Simplify checks for library unit pragmasPiotr Trojanek1-34/+3
gcc/ada/ * sem_prag.adb (Check_Valid_Library_Unit_Pragma): Raise exception. (Analyze_Pragma): Remove detection of rewritten pragmas.
2020-11-26[Ada] Add contracts to Ada.Strings.MapsJoffrey Huguet1-21/+158
gcc/ada/ * libgnat/a-strmap.ads: Add preconditions and postconditions to all subprograms.
2020-11-26[Ada] New warning on questionable missing parenthesesYannick Moy1-0/+64
gcc/ada/ * sem_res.adb (Resolve_Equality_Op): Warn when -gnatwq is used (the default) and the problematic case is encountered.
2020-11-26[Ada] Issue advice for error regarding Old/Loop_Entry on unevaluated expr.Yannick Moy1-4/+12
gcc/ada/ * sem_attr.adb (Analyze_Attribute): Issue a continuation message to give proper recommendation here.
2020-11-26[Ada] Correct a typo, plus other minor reformattingGary Dismukes1-4/+4
gcc/ada/ * exp_util.adb (Expand_Subtype_From_Expr): A typo correction, plus other minor reformatting.
2020-11-26[Ada] Spurious error on formal package with overloaded subprogramsEd Schonberg1-0/+10
gcc/ada/ * sem_ch12.adb (Instantiate_Formal_Package): If previous matched entity is overloadable, advance in the list of actuals of the actual package, to prevent an erroneous match of two adjacent overloadable homonyms with the same entity.
2020-11-26[Ada] Compiler crash on named association in return aggregateJustin Squirek1-13/+201
gcc/ada/ * sem_ch6.adb (First_Selector): Utility routine to return the first selector or choice in an association. (Check_Return_Construct_Accessibility): Modify loop to handle named associations when iterating through discriminants.
2020-11-26[Ada] Fix casing of "circular instantiation" errorPiotr Trojanek1-4/+4
gcc/ada/ * sem_ch12.adb: Fix casing from "Instantiation" to "instantiation".
2020-11-26i386: Optimize psubusw compared to 0 into pminuw compared to op0 [PR96906]Jakub Jelinek2-20/+103
The following patch renames VI12_AVX2 iterator to VI12_AVX2_AVX512BW for consistency with some other iterators, as I need VI12_AVX2 without AVX512BW for this change. The real meat is a combiner split which combine can use to optimize psubusw compared to 0 into pminuw compared to op0 (and similarly for psubusb compared to 0 into pminub compared to op0). According to Agner Fog's tables, psubus[bw] and pminu[bw] timings are the same, but the advantage of pminu[bw] is that the comparison doesn't need a zero operand, so e.g. for -msse4.1 it causes changes like - psubusw %xmm1, %xmm0 - pxor %xmm1, %xmm1 + pminuw %xmm0, %xmm1 pcmpeqw %xmm1, %xmm0 and similarly for avx2: - vpsubusb %ymm1, %ymm0, %ymm0 - vpxor %xmm1, %xmm1, %xmm1 - vpcmpeqb %ymm1, %ymm0, %ymm0 + vpminub %ymm1, %ymm0, %ymm1 + vpcmpeqb %ymm0, %ymm1, %ymm0 I haven't done the AVX512{BW,VL} define_split(s), they'll need to match the UNSPEC_PCMP which are used for avx512 comparisons. 2020-11-26 Jakub Jelinek <jakub@redhat.com> PR target/96906 * config/i386/sse.md (VI12_AVX2): Remove V64QI/V32HI modes. (VI12_AVX2_AVX512BW): New mode iterator. (<sse2_avx2>_<plusminus_insn><mode>3<mask_name>, uavg<mode>3_ceil, <sse2_avx2>_uavg<mode>3<mask_name>): Use VI12_AVX2_AVX512BW iterator instead of VI12_AVX2. (*<sse2_avx2>_<plusminus_insn><mode>3<mask_name>): Likewise. (*<sse2_avx2>_uavg<mode>3<mask_name>): Likewise. (*<sse2_avx2>_<plusminus_insn><mode>3<mask_name>): Add a new define_split after this insn. * gcc.target/i386/pr96906-1.c: New test.
2020-11-26C: Do not drop qualifiers in typeof for _Atomic types. [PR65455,PR92935]Martin Uecker3-24/+19
2020-11-25 Martin Uecker <muecker@gwdg.de> gcc/c/ PR c/65455 PR c/92935 * c-parser.c (c_parser_declaration_or_fndef): Remove redundant code to drop qualifiers of _Atomic types for __auto_type. (c_parser_typeof_specifier): Do not drop qualifiers of _Atomic types for __typeof__. gcc/ PR c/65455 PR c/92935 * ginclude/stdatomic.h: Use comma operator to drop qualifiers. gcc/testsuite/ PR c/65455 PR c/92935 * gcc.dg/typeof-2.c: Adapt test.
2020-11-25testsuite: Adjust nextafter and skip profile-info-section on AIX.David Edelsohn3-0/+7
nextafter-2.c builds nextafter-1.c with math.h, but nextafter-1.c provides prototypes for the functions. The prototypes can conflict with the definitions in math.h. This patch omits the prototypes when compiling nextafer-2.c. profile-info-section.c uses the profile-info-section flag that is not valid on AIX, so skip the test on AIX. gcc/testsuite/ChangeLog: * gcc.dg/nextafter-1.c: Omit prototypes if _NEXT_AFTER_2 defined. * gcc.dg/nextafter-2.c: Define _NEXT_AFTER_2. * gcc.dg/profile-info-section.c: Skip on AIX.
2020-11-25[PR97983] LRA: Use the right emit func for putting insn in the destination BB.Vladimir N. Makarov1-7/+7
gcc/ 2020-11-25 Vladimir Makarov <vmakarov@redhat.com> PR bootstrap/97983 * lra.c (lra_process_new_insns): Use emit_insn_before_noloc or emit_insn_after_noloc with the destination BB.
2020-11-26Daily bump.GCC Administrator16-1/+1076
2020-11-25Clean up -Wformat-diag warnings (PR bootstrap/97622, PR bootstrap/94982)Martin Sebor18-37/+109
gcc/c-family/ChangeLog: PR bootstrap/94982 * c-attribs.c (handle_patchable_function_entry_attribute): Avoid -Wformat-diag. gcc/cp/ChangeLog: PR bootstrap/94982 * constraint.cc (debug_argument_list): Avoid -Wformat-diag. * error.c (function_category): Same. (print_template_differences): Same. * logic.cc (debug): Same. * name-lookup.c (lookup_using_decl): Same. * parser.c (maybe_add_cast_fixit): Same. (cp_parser_template_introduction): Same. * typeck.c (access_failure_info::add_fixit_hint): Same. gcc/ChangeLog: PR bootstrap/97622 PR bootstrap/94982 * config/i386/i386-options.c (ix86_valid_target_attribute_inner_p): Avoid -Wformat-diag. * digraph.cc (struct test_edge): Same. * dumpfile.c (dump_loc): Same. (dump_context::begin_scope): Same. * edit-context.c (edited_file::print_diff): Same. (edited_file::print_diff_hunk): Same. * json.cc (object::print): Same. * lto-wrapper.c (merge_and_complain): Same. * reload.c (find_reloads): Same. * tree-diagnostic-path.cc (print_path_summary_as_text): Same. * ubsan.c (ubsan_type_descriptor): Same. gcc/jit/ChangeLog: PR bootstrap/94982 * jit-recording.c (recording::function::dump_to_dot): Avoid -Wformat-diag. (recording::block::dump_to_dot): Same. gcc/testsuite/ChangeLog: PR bootstrap/94982 * c-c++-common/patchable_function_entry-error-3.c: Adjust text of expected warning.
2020-11-25New ipa-modref testcasesJan Hubicka5-0/+87
gcc/testsuite/ChangeLog: * gcc.dg/lto/modref-3_0.c: New test. * gcc.dg/lto/modref-3_1.c: New test. * gcc.dg/lto/modref-4_0.c: New test. * gcc.dg/lto/modref-4_1.c: New test. * gcc.dg/tree-ssa/modref-5.c: New test.
2020-11-25Add EAF_NODIRECTESCAPE flagJan Hubicka4-11/+40
Main limitation of modref is the fact that it does not track anything in memory. This is intentional - I wanted the initial implementation to be cheap. However it also makes it very limited when it comes to detecting noescape especially because it is paranoid about what memory accesses may be used to copy (bits of) pointers. This patch adds EAF_NODIRECTSCAPE that is weaker vairant of EAF_NOESCAPE where we only know that the pointer itself does not escape, but memory pointed to may. This is a lot more reliable to auto-detect that EAF_NOESCAPE and still enables additional optimization. With patch we get nodirectscape flag for b that enables in practice similar optimization as EAF_NOESCAPE for arrays of integers that points nowhere :) gcc/ChangeLog: * gimple.c (gimple_call_arg_flags): Also imply EAF_NODIRECTESCAPE. * tree-core.h (EAF_NODRECTESCAPE): New flag. * tree-ssa-structalias.c (make_indirect_escape_constraint): New function. (handle_rhs_call): Hanlde EAF_NODIRECTESCAPE. * ipa-modref.c (dump_eaf_flags): Print EAF_NODIRECTESCAPE. (deref_flags): Dereference is always EAF_NODIRECTESCAPE. (modref_lattice::init): Also set EAF_NODIRECTESCAPE. (analyze_ssa_name_flags): Pure functions do not affect EAF_NODIRECTESCAPE. (analyze_params): Likewise. (ipa_merge_modref_summary_after_inlining): Likewise. (modref_merge_call_site_flags): Likewise.
2020-11-25Copy arg_flags in duplication hoooks in ipa-modrefJan Hubicka1-1/+5
* ipa-modref.c (modref_summaries::duplicate, modref_summaries_lto::duplicate): Copy arg_flags. (remap_arg_flags): Fix remapping of arg_flags.
2020-11-25PR fortran/85796 - Floating point exception with implied doHarald Anlauf2-2/+17
Catch invalid step=0 in implied do loop within data statements. gcc/fortran/ChangeLog: PR fortran/85796 * resolve.c (traverse_data_list): Fix copy&paste errors; catch step=0 in implied do loop. gcc/testsuite/ChangeLog: PR fortran/85796 * gfortran.dg/pr85796.f90: New test.
2020-11-25Add 'g++.dg/gomp/map-{1,2}.C'Thomas Schwinge4-4/+175
gcc/testsuite/ * g++.dg/gomp/map-1.C: New. * g++.dg/gomp/map-2.C: Likewise. * c-c++-common/gomp/map-1.c: Adjust. * c-c++-common/gomp/map-2.c: Likewise.
2020-11-25Fix templatized C++ OpenACC 'cache' directive ICEsThomas Schwinge7-13/+121
This has been broken forever, whoops... gcc/cp/ * pt.c (tsubst_omp_clauses): Handle 'OMP_CLAUSE__CACHE_'. (tsubst_expr): Handle 'OACC_CACHE'. gcc/testsuite/ * c-c++-common/goacc/cache-1.c: Update. * c-c++-common/goacc/cache-2.c: Likewise. * g++.dg/goacc/cache-1.C: New. * g++.dg/goacc/cache-2.C: Likewise. libgomp/ * testsuite/libgomp.oacc-c++/cache-1.C: New. * testsuite/libgomp.oacc-c-c++-common/cache-1.c: Update.
2020-11-25Improve abs with overflow implementationsStefan Kanthak1-30/+12
libgcc/ * libgcc2.c (absvSI2): Simplify/improve implementation by using builtin_add_overflow. (absvsi2, absvDI2): Likewise.
2020-11-25libstdc++: Remove redundant clock conversions in atomic waitsJonathan Wakely1-16/+24
For the case where a timeout is specified using the system_clock we perform a conversion to the preferred clock (which is either steady_clock or system_clock itself), wait using __cond_wait_until_impl, and then check the time by that clock again to see if it was reached. This is entirely redundant, as we can just call __cond_wait_until_impl directly. It will wait using the specified clock, and there's no need to check the time twice. For the no_timeout case this removes two unnecessary calls to the clock's now() function, and for the timeout case it removes three calls. libstdc++-v3/ChangeLog: * include/bits/atomic_timed_wait.h (__cond_wait_until): Do not perform redundant conversions to the same clock.
2020-11-25libstdc++: Encapsulate __gthread_cond_t as std::__condvarJonathan Wakely5-121/+144
This introduces a new internal utility, std::__condvar, which is a simplified form of std::condition_variable. It has no dependency on <chrono> or std::unique_lock, which allows it to be used in <bits/atomic_wait.h>. This avoids repeating the #ifdef __GTHREAD_COND_INIT preprocessor conditions and associated logic for initializing a __gthread_cond_t correctly. It also encapsulates most of the __gthread_cond_xxx functions as member functions of __condvar. libstdc++-v3/ChangeLog: * include/bits/atomic_timed_wait.h (__cond_wait_until_impl): Do not define when _GLIBCXX_HAVE_LINUX_FUTEX is defined. Use __condvar and mutex instead of __gthread_cond_t and unique_lock<mutex>. (__cond_wait_until): Likewise. Fix test for return value of __cond_wait_until_impl. (__timed_waiters::_M_do_wait_until): Use __condvar instead of __gthread_cond_t. * include/bits/atomic_wait.h: Remove <bits/unique_lock.h> include. Only include <bits/std_mutex.h> if not using futexes. (__platform_wait_max_value): Remove unused variable. (__waiters::lock_t): Use lock_guard instead of unique_lock. (__waiters::_M_cv): Use __condvar instead of __gthread_cond_t. (__waiters::_M_do_wait(__platform_wait_t)): Likewise. (__waiters::_M_notify()): Likewise. Use notify_one() if not asked to notify all. * include/bits/std_mutex.h (__condvar): New type. * include/std/condition_variable (condition_variable::_M_cond) (condition_variable::wait_until): Use __condvar instead of __gthread_cond_t. * src/c++11/condition_variable.cc (condition_variable): Define default constructor and destructor as defaulted. (condition_variable::wait, condition_variable::notify_one) (condition_variable::notify_all): Forward to corresponding member function of __condvar.
2020-11-25libstdc++: Fix testsuite helper functions [PR 97936]Jonathan Wakely7-10/+20
This fixes a race condition in the util/atomic/wait_notify_util.h header used by several tests, which should make the tests work properly. libstdc++-v3/ChangeLog: PR libstdc++/97936 * testsuite/29_atomics/atomic/wait_notify/bool.cc: Re-eneable test. * testsuite/29_atomics/atomic/wait_notify/generic.cc: Likewise. * testsuite/29_atomics/atomic/wait_notify/pointers.cc: Likewise. * testsuite/29_atomics/atomic_flag/wait_notify/1.cc: Likewise. * testsuite/29_atomics/atomic_float/wait_notify.cc: Likewise. * testsuite/29_atomics/atomic_integral/wait_notify.cc: Likewise. * testsuite/util/atomic/wait_notify_util.h: Fix missed notifications by making the new thread wait until the parent thread is waiting on the condition variable.
2020-11-25PR middle-end/97956 - ICE due to type mismatch in pointer_plus_expr during ↵Martin Sebor2-1/+26
memchr folding gcc/ChangeLog: PR middle-end/97956 * gimple-fold.c (gimple_fold_builtin_memchr): Use sizetype for pointer offsets. gcc/testsuite/ChangeLog: PR middle-end/97956 * gcc.dg/memchr-3.c: New test.
2020-11-25libstdc++: Fix missing subsumption in std::iterator_traits [PR 97935]Jonathan Wakely2-6/+67
libstdc++-v3/ChangeLog: PR libstdc++/97935 * include/bits/iterator_concepts.h (__detail::__iter_without_category): New helper concept. (__iterator_traits::__cat): Use __detail::__iter_without_category. * testsuite/24_iterators/associated_types/iterator.traits.cc: New test.
2020-11-25libstdc++: Fix test failure on AIXJonathan Wakely1-0/+2
This fixes a failure on AIX 7.2: FAIL: 17_intro/names.cc (test for excess errors) Excess errors: /home/jwakely/src/gcc/libstdc++-v3/testsuite/17_intro/names.cc:99: error: expected identifier before '(' token /usr/include/sys/var.h:187: error: expected unqualified-id before '{' token /usr/include/sys/var.h:187: error: expected ')' before '{' token /usr/include/sys/var.h:337: error: expected unqualified-id before ';' token /usr/include/sys/var.h:337: error: expected ')' before ';' token libstdc++-v3/ChangeLog: * testsuite/17_intro/names.cc: Do not test 'v' on AIX.
2020-11-25libsanitizer: Add recently added commit to LOCAL_PATCHESMatthew Malcomson1-0/+1
libsanitizer/ChangeLog: * LOCAL_PATCHES: Add one commit.
2020-11-25libsanitizer: Add testsMatthew Malcomson65-13/+1924
Only interesting thing here is that we have to make sure the tagging mechanism is deterministic to avoid flaky tests. gcc/testsuite/ChangeLog: * c-c++-common/ubsan/sanitize-recover-7.c: Update error message format. * lib/asan-dg.exp (asan_link_flags): Implement as a helper function asan_link_flags_1 which asan_link_flags and hwasan_link_flags use. (asan_link_flags_1): Parametrised version of asan_link_flags. * c-c++-common/hwasan/aligned-alloc.c: New test. * c-c++-common/hwasan/alloca-array-accessible.c: New test. * c-c++-common/hwasan/alloca-base-init.c: New test. * c-c++-common/hwasan/alloca-gets-different-tag.c: New test. * c-c++-common/hwasan/alloca-outside-caught.c: New test. * c-c++-common/hwasan/arguments-1.c: New test. * c-c++-common/hwasan/arguments-2.c: New test. * c-c++-common/hwasan/arguments-3.c: New test. * c-c++-common/hwasan/arguments.c: New test. * c-c++-common/hwasan/asan-pr63316.c: New test. * c-c++-common/hwasan/asan-pr70541.c: New test. * c-c++-common/hwasan/asan-pr78106.c: New test. * c-c++-common/hwasan/asan-pr79944.c: New test. * c-c++-common/hwasan/asan-rlimit-mmap-test-1.c: New test. * c-c++-common/hwasan/bitfield-1.c: New test. * c-c++-common/hwasan/bitfield-2.c: New test. * c-c++-common/hwasan/builtin-special-handling.c: New test. * c-c++-common/hwasan/check-interface.c: New test. * c-c++-common/hwasan/halt_on_error-1.c: New test. * c-c++-common/hwasan/handles-poly_int-marked-vars.c: New test. * c-c++-common/hwasan/heap-overflow.c: New test. * c-c++-common/hwasan/hwasan-poison-optimisation.c: New test. * c-c++-common/hwasan/hwasan-thread-access-parent.c: New test. * c-c++-common/hwasan/hwasan-thread-basic-failure.c: New test. * c-c++-common/hwasan/hwasan-thread-clears-stack.c: New test. * c-c++-common/hwasan/hwasan-thread-success.c: New test. * c-c++-common/hwasan/kernel-defaults.c: New test. * c-c++-common/hwasan/large-aligned-0.c: New test. * c-c++-common/hwasan/large-aligned-1.c: New test. * c-c++-common/hwasan/large-aligned-untagging-0.c: New test. * c-c++-common/hwasan/large-aligned-untagging-1.c: New test. * c-c++-common/hwasan/large-aligned-untagging-2.c: New test. * c-c++-common/hwasan/large-aligned-untagging-3.c: New test. * c-c++-common/hwasan/large-aligned-untagging-4.c: New test. * c-c++-common/hwasan/large-aligned-untagging-5.c: New test. * c-c++-common/hwasan/large-aligned-untagging-6.c: New test. * c-c++-common/hwasan/large-aligned-untagging-7.c: New test. * c-c++-common/hwasan/macro-definition.c: New test. * c-c++-common/hwasan/no-sanitize-attribute.c: New test. * c-c++-common/hwasan/param-instrument-mem-intrinsics.c: New test. * c-c++-common/hwasan/param-instrument-reads-and-writes.c: New test. * c-c++-common/hwasan/param-instrument-reads.c: New test. * c-c++-common/hwasan/param-instrument-writes.c: New test. * c-c++-common/hwasan/random-frame-tag.c: New test. * c-c++-common/hwasan/sanity-check-pure-c.c: New test. * c-c++-common/hwasan/setjmp-longjmp-0.c: New test. * c-c++-common/hwasan/setjmp-longjmp-1.c: New test. * c-c++-common/hwasan/stack-tagging-basic-0.c: New test. * c-c++-common/hwasan/stack-tagging-basic-1.c: New test. * c-c++-common/hwasan/stack-tagging-disable.c: New test. * c-c++-common/hwasan/unprotected-allocas-0.c: New test. * c-c++-common/hwasan/unprotected-allocas-1.c: New test. * c-c++-common/hwasan/use-after-free.c: New test. * c-c++-common/hwasan/vararray-outside-caught.c: New test. * c-c++-common/hwasan/vararray-stack-restore-correct.c: New test. * c-c++-common/hwasan/very-large-objects.c: New test. * g++.dg/hwasan/hwasan.exp: New test. * g++.dg/hwasan/rvo-handled.C: New test. * gcc.dg/hwasan/hwasan.exp: New test. * gcc.dg/hwasan/nested-functions-0.c: New test. * gcc.dg/hwasan/nested-functions-1.c: New test. * gcc.dg/hwasan/nested-functions-2.c: New test. * lib/hwasan-dg.exp: New file.
2020-11-25libsanitizer: Add hwasan pass and associated gimple changesMatthew Malcomson12-36/+845
There are four main features to this change: 1) Check pointer tags match address tags. When sanitizing for hwasan we now put HWASAN_CHECK internal functions before memory accesses in the `asan` pass. This checks that a tag in the pointer being used match the tag stored in shadow memory for the memory region being used. These internal functions are expanded into actual checks in the sanopt pass that happens just before expansion into RTL. We use the same mechanism that currently inserts ASAN_CHECK internal functions to insert the new HWASAN_CHECK functions. 2) Instrument known builtin function calls. Handle all builtin functions that we know use memory accesses. This commit uses the machinery added for ASAN to identify builtin functions that access memory. The main differences between the approaches for HWASAN and ASAN are: - libhwasan intercepts much less builtin functions. - Alloca needs to be transformed differently (instead of adding redzones it needs to tag shadow memory and return a tagged pointer). - stack_restore needs to untag the shadow stack between the current position and where it's going. - `noreturn` functions can not be handled by simply unpoisoning the entire shadow stack -- there is no "always valid" tag. (exceptions and things such as longjmp need to be handled in a different way, usually in the runtime). For hardware implemented checking (such as AArch64's memory tagging extension) alloca and stack_restore will need to be handled by hooks in the backend rather than transformation at the gimple level. This will allow architecture specific handling of such stack modifications. 3) Introduce HWASAN block-scope poisoning Here we use exactly the same mechanism as ASAN_MARK to poison/unpoison variables on entry/exit of a block. In order to simply use the exact same machinery we're using the same internal functions until the SANOPT pass. This means that all handling of ASAN_MARK is the same. This has the negative that the naming may be a little confusing, but a positive that handling of the internal function doesn't have to be duplicated for a function that behaves exactly the same but has a different name. gcc/ChangeLog: * asan.c (asan_instrument_reads): New. (asan_instrument_writes): New. (asan_memintrin): New. (handle_builtin_stack_restore): Account for HWASAN. (handle_builtin_alloca): Account for HWASAN. (get_mem_refs_of_builtin_call): Special case strlen for HWASAN. (hwasan_instrument_reads): New. (hwasan_instrument_writes): New. (hwasan_memintrin): New. (report_error_func): Assert not HWASAN. (build_check_stmt): Make HWASAN_CHECK instead of ASAN_CHECK. (instrument_derefs): HWASAN does not tag globals. (instrument_builtin_call): Use new helper functions. (maybe_instrument_call): Don't instrument `noreturn` functions. (initialize_sanitizer_builtins): Add new type. (asan_expand_mark_ifn): Account for HWASAN. (asan_expand_check_ifn): Assert never called by HWASAN. (asan_expand_poison_ifn): Account for HWASAN. (asan_instrument): Branch based on whether using HWASAN or ASAN. (pass_asan::gate): Return true if sanitizing HWASAN. (pass_asan_O0::gate): Return true if sanitizing HWASAN. (hwasan_check_func): New. (hwasan_expand_check_ifn): New. (hwasan_expand_mark_ifn): New. (gate_hwasan): New. * asan.h (hwasan_expand_check_ifn): New decl. (hwasan_expand_mark_ifn): New decl. (gate_hwasan): New decl. (asan_intercepted_p): Always false for hwasan. (asan_sanitize_use_after_scope): Account for HWASAN. * builtin-types.def (BT_FN_PTR_CONST_PTR_UINT8): New. * gimple-fold.c (gimple_build): New overload for building function calls without arguments. (gimple_build_round_up): New. * gimple-fold.h (gimple_build): New decl. (gimple_build): New inline function. (gimple_build_round_up): New decl. (gimple_build_round_up): New inline function. * gimple-pretty-print.c (dump_gimple_call_args): Account for HWASAN. * gimplify.c (asan_poison_variable): Account for HWASAN. (gimplify_function_tree): Remove requirement of SANITIZE_ADDRESS, requiring asan or hwasan is accounted for in `asan_sanitize_use_after_scope`. * internal-fn.c (expand_HWASAN_CHECK): New. (expand_HWASAN_ALLOCA_UNPOISON): New. (expand_HWASAN_CHOOSE_TAG): New. (expand_HWASAN_MARK): New. (expand_HWASAN_SET_TAG): New. * internal-fn.def (HWASAN_ALLOCA_UNPOISON): New. (HWASAN_CHOOSE_TAG): New. (HWASAN_CHECK): New. (HWASAN_MARK): New. (HWASAN_SET_TAG): New. * sanitizer.def (BUILT_IN_HWASAN_LOAD1): New. (BUILT_IN_HWASAN_LOAD2): New. (BUILT_IN_HWASAN_LOAD4): New. (BUILT_IN_HWASAN_LOAD8): New. (BUILT_IN_HWASAN_LOAD16): New. (BUILT_IN_HWASAN_LOADN): New. (BUILT_IN_HWASAN_STORE1): New. (BUILT_IN_HWASAN_STORE2): New. (BUILT_IN_HWASAN_STORE4): New. (BUILT_IN_HWASAN_STORE8): New. (BUILT_IN_HWASAN_STORE16): New. (BUILT_IN_HWASAN_STOREN): New. (BUILT_IN_HWASAN_LOAD1_NOABORT): New. (BUILT_IN_HWASAN_LOAD2_NOABORT): New. (BUILT_IN_HWASAN_LOAD4_NOABORT): New. (BUILT_IN_HWASAN_LOAD8_NOABORT): New. (BUILT_IN_HWASAN_LOAD16_NOABORT): New. (BUILT_IN_HWASAN_LOADN_NOABORT): New. (BUILT_IN_HWASAN_STORE1_NOABORT): New. (BUILT_IN_HWASAN_STORE2_NOABORT): New. (BUILT_IN_HWASAN_STORE4_NOABORT): New. (BUILT_IN_HWASAN_STORE8_NOABORT): New. (BUILT_IN_HWASAN_STORE16_NOABORT): New. (BUILT_IN_HWASAN_STOREN_NOABORT): New. (BUILT_IN_HWASAN_TAG_MISMATCH4): New. (BUILT_IN_HWASAN_HANDLE_LONGJMP): New. (BUILT_IN_HWASAN_TAG_PTR): New. * sanopt.c (sanopt_optimize_walker): Act for hwasan. (pass_sanopt::execute): Act for hwasan. * toplev.c (compile_file): Use `gate_hwasan` function.