aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite
AgeCommit message (Collapse)AuthorFilesLines
2019-09-19Support extended characters in C/C++ identifiers (PR c/67224)Lewis Hyatt36-0/+644
libcpp/ChangeLog 2019-09-19 Lewis Hyatt <lhyatt@gmail.com> PR c/67224 * charset.c (_cpp_valid_utf8): New function to help lex UTF-8 tokens. * internal.h (_cpp_valid_utf8): Declare. * lex.c (forms_identifier_p): Use it to recognize UTF-8 identifiers. (_cpp_lex_direct): Handle UTF-8 in identifiers and CPP_OTHER tokens. Do all work in "default" case to avoid slowing down typical code paths. Also handle $ and UCN in the default case for consistency. gcc/Changelog 2019-09-19 Lewis Hyatt <lhyatt@gmail.com> PR c/67224 * doc/cpp.texi: Document support for extended characters in identifiers. * doc/cppopts.texi: Likewise. gcc/testsuite/ChangeLog 2019-09-19 Lewis Hyatt <lhyatt@gmail.com> PR c/67224 * c-c++-common/cpp/ucnid-2011-1-utf8.c: New test. * g++.dg/cpp/ucnid-1-utf8.C: New test. * g++.dg/cpp/ucnid-2-utf8.C: New test. * g++.dg/cpp/ucnid-3-utf8.C: New test. * g++.dg/cpp/ucnid-4-utf8.C: New test. * g++.dg/other/ucnid-1-utf8.C: New test. * gcc.dg/cpp/ucnid-1-utf8.c: New test. * gcc.dg/cpp/ucnid-10-utf8.c: New test. * gcc.dg/cpp/ucnid-11-utf8.c: New test. * gcc.dg/cpp/ucnid-12-utf8.c: New test. * gcc.dg/cpp/ucnid-13-utf8.c: New test. * gcc.dg/cpp/ucnid-14-utf8.c: New test. * gcc.dg/cpp/ucnid-15-utf8.c: New test. * gcc.dg/cpp/ucnid-2-utf8.c: New test. * gcc.dg/cpp/ucnid-3-utf8.c: New test. * gcc.dg/cpp/ucnid-4-utf8.c: New test. * gcc.dg/cpp/ucnid-6-utf8.c: New test. * gcc.dg/cpp/ucnid-7-utf8.c: New test. * gcc.dg/cpp/ucnid-9-utf8.c: New test. * gcc.dg/ucnid-1-utf8.c: New test. * gcc.dg/ucnid-10-utf8.c: New test. * gcc.dg/ucnid-11-utf8.c: New test. * gcc.dg/ucnid-12-utf8.c: New test. * gcc.dg/ucnid-13-utf8.c: New test. * gcc.dg/ucnid-14-utf8.c: New test. * gcc.dg/ucnid-15-utf8.c: New test. * gcc.dg/ucnid-16-utf8.c: New test. * gcc.dg/ucnid-2-utf8.c: New test. * gcc.dg/ucnid-3-utf8.c: New test. * gcc.dg/ucnid-4-utf8.c: New test. * gcc.dg/ucnid-5-utf8.c: New test. * gcc.dg/ucnid-6-utf8.c: New test. * gcc.dg/ucnid-7-utf8.c: New test. * gcc.dg/ucnid-8-utf8.c: New test. * gcc.dg/ucnid-9-utf8.c: New test. From-SVN: r275979
2019-09-19Handle [[likely]] on compound-statement.Jason Merrill1-0/+9
I overlooked this case when adding [[likely]] handling to cp_parser_statement. * parser.c (cp_parser_statement): Handle [[likely]] on compound-statement. From-SVN: r275978
2019-09-19[Darwin, PPC, testsuite] Fix pr89313.c fail.Iain Sandoe2-1/+6
Darwin defines '__POWERPC__' rather than '__powerpc__' so check for the upper case version too in order to select the correct register name. gcc/testsuite: 2019-09-19 Iain Sandoe <iain@sandoe.co.uk> * gcc.dg/pr89313.c: Test for __POWERPC__ in addition to __powerpc__ in register name selection. From-SVN: r275977
2019-09-19aarch64: Implement -moutline-atomicsRichard Henderson18-18/+37
* config/aarch64/aarch64.opt (-moutline-atomics): New. * config/aarch64/aarch64.c (aarch64_atomic_ool_func): New. (aarch64_ool_cas_names, aarch64_ool_swp_names): New. (aarch64_ool_ldadd_names, aarch64_ool_ldset_names): New. (aarch64_ool_ldclr_names, aarch64_ool_ldeor_names): New. (aarch64_expand_compare_and_swap): Honor TARGET_OUTLINE_ATOMICS. * config/aarch64/atomics.md (atomic_exchange<ALLI>): Likewise. (atomic_<atomic_op><ALLI>): Likewise. (atomic_fetch_<atomic_op><ALLI>): Likewise. (atomic_<atomic_op>_fetch<ALLI>): Likewise. * doc/invoke.texi: Document -moutline-atomics. testsuite/ * gcc.target/aarch64/atomic-op-acq_rel.c: Use -mno-outline-atomics. * gcc.target/aarch64/atomic-comp-swap-release-acquire.c: Likewise. * gcc.target/aarch64/atomic-op-acquire.c: Likewise. * gcc.target/aarch64/atomic-op-char.c: Likewise. * gcc.target/aarch64/atomic-op-consume.c: Likewise. * gcc.target/aarch64/atomic-op-imm.c: Likewise. * gcc.target/aarch64/atomic-op-int.c: Likewise. * gcc.target/aarch64/atomic-op-long.c: Likewise. * gcc.target/aarch64/atomic-op-relaxed.c: Likewise. * gcc.target/aarch64/atomic-op-release.c: Likewise. * gcc.target/aarch64/atomic-op-seq_cst.c: Likewise. * gcc.target/aarch64/atomic-op-short.c: Likewise. * gcc.target/aarch64/atomic_cmp_exchange_zero_reg_1.c: Likewise. * gcc.target/aarch64/atomic_cmp_exchange_zero_strong_1.c: Likewise. * gcc.target/aarch64/sync-comp-swap.c: Likewise. * gcc.target/aarch64/sync-op-acquire.c: Likewise. * gcc.target/aarch64/sync-op-full.c: Likewise. From-SVN: r275968
2019-09-19Use post-dom info to update if/switch predicateFeng Xue2-0/+52
2019-09-19 Feng Xue <fxue@os.amperecomputing.com> * ipa-fnsummary.c (set_cond_stmt_execution_predicate): Do not compute trivial predicate for condition branch. (set_switch_stmt_execution_predicate): Do not compute trivial predicate for switch case. (compute_bb_predicates): Update predicate based on post-dominating relationship. (analyze_function_body): Calculate post-dominating information. 2019-09-19 Feng Xue <fxue@os.amperecomputing.com> * gcc.dg/ipa/pr91089.c: Add a new function and pattern. From-SVN: r275963
2019-09-19re PR tree-optimization/91812 (GCC ignores volatile modifier)Richard Biener2-0/+31
2019-09-19 Richard Biener <rguenther@suse.de> PR tree-optimization/91812 * tree-ssa-phiprop.c (propagate_with_phi): Do not replace volatile loads. * gcc.dg/torture/pr91812.c: New testcase. From-SVN: r275960
2019-09-19[Ada] Emit DW_AT_GNU_bias with -fgnat-encodings=gdbTom Tromey2-0/+38
Emit DW_AT_GNU_bias with -fgnat-encodings=gdb. gdb implements this, but not the encoded variant. 2019-09-19 Tom Tromey <tromey@adacore.com> gcc/ada/ * gcc-interface/misc.c (gnat_get_type_bias): Return the bias when -fgnat-encodings=gdb. gcc/testsuite/ * gnat.dg/bias1.adb: New testcase. From-SVN: r275958
2019-09-19[Ada] Accept concatentation arguments to pragma AnnotateSteve Baird2-0/+11
In cases where pragma Annotate accepts a string literal as an argument, we now also accept a concatenation of string literals. 2019-09-19 Steve Baird <baird@adacore.com> gcc/ada/ * sem_prag.adb (Preferred_String_Type): A new function. Given an expression, determines whether the preference rules defined for the third-and-later arguments of pragma Annotate suffice to determine the type of the expression. If so, then the preferred type is returned; if not then Empty is returned. Handles concatenations. (Analyze_Pragma): Replace previous code, which dealt only with string literals, with calls to the new Preferred_String_Type function, which also handles concatenations. * doc/gnat_rm/implementation_defined_pragmas.rst: Update documentation for pragma Annotate. * gnat_rm.texi: Regenerate. gcc/testsuite/ * gnat.dg/annotation1.adb: New testcase. From-SVN: r275957
2019-09-19[Ada] Fix bogus "too late" error with nested generics and inliningEric Botcazou6-0/+56
This prevents the compiler from issuing a bogus error about a constant whose full declaration appears too late, if it is declared in a nested generic package and instantiated in another nested instantiation, when the instantiations are done in a unit withed from the main unit and containing an inlined subprogram, and cross-unit inlining is enabled. It turns out that, under these very peculiar conditions, the compiler ends up instantiating the body of the generic package twice, which leads to various semantic errors, in particular for declarations of constants. 2019-09-19 Eric Botcazou <ebotcazou@adacore.com> gcc/ada/ * sem_ch12.adb (Instantiate_Package_Body): Check that the body has not already been instantiated when the body of the parent was being loaded. gcc/testsuite/ * gnat.dg/inline21.adb, gnat.dg/inline21_g.ads, gnat.dg/inline21_h.adb, gnat.dg/inline21_h.ads, gnat.dg/inline21_q.ads: New testcase. From-SVN: r275953
2019-09-19[Ada] Fix bogus visibility error with nested generics and inliningEric Botcazou9-0/+102
This prevents the compiler from issuing a bogus error about the visibility of an operator in an instantiation of a nested generic package which is itself used as an actual of an instantiation of another generic package, when the instantiations are done in a unit withed from the main unit and containing an inlined subprogram, and cross-unit inlining is enabled. In most cases, the compiler does not check the visibility of operators in an instantiation context because this has already been done when the generic package has been analyzed. However, there are exceptions like the actuals of an instantiation of a generic child unit which is done as a compilation unit and the In_Instance predicate has a special check for these cases. This check would incorrectly trigger here and needs to be tightened. 2019-09-19 Eric Botcazou <ebotcazou@adacore.com> gcc/ada/ * sem_util.adb (In_Instance): Test whether the current unit has been analyzed instead of being on the scope stack to detect the case of actuals of an instantiation of a generic child unit done as a compilation unit. gcc/testsuite/ * gnat.dg/inline20.adb, gnat.dg/inline20_g.adb, gnat.dg/inline20_g.ads, gnat.dg/inline20_h.ads, gnat.dg/inline20_i.ads, gnat.dg/inline20_q-io.ads, gnat.dg/inline20_q.ads, gnat.dg/inline20_r.ads: New testcase. From-SVN: r275952
2019-09-19[Ada] Spurious visibility error in generic child unitEd Schonberg5-0/+26
2019-09-19 Ed Schonberg <schonberg@adacore.com> gcc/ada/ * sem_ch7.adb (Install_Parent_Private_Declarations): If a generic child unit is instantiated within a sibling child unit, the analysis of its private part requires that the private part of the ancestor be available, as is done when the context includes an instance of the ancestor. gcc/testsuite/ * gnat.dg/generic2-child.ads, gnat.dg/generic2-io_any.adb, gnat.dg/generic2-io_any.ads, gnat.dg/generic2.ads: New testcase. From-SVN: r275949
2019-09-19[Ada] Allow constants of access type in Global contractsYannick Moy3-0/+22
Now that SPARK supports access types, global constants of access type may appear as outputs of a subprogram, with the meaning that the underlying memory can be modified (see SPARK RM 3.10). 2019-09-19 Yannick Moy <moy@adacore.com> gcc/ada/ * sem_prag.adb (Analyze_Global_In_Decl_Part): Do not issue an error when a constant of an access type is used as output in a Global contract. (Analyze_Depends_In_Decl_Part): Do not issue an error when a constant of an access type is used as output in a Depends contract. gcc/testsuite/ * gnat.dg/global2.adb, gnat.dg/global2.ads: New testcase. From-SVN: r275947
2019-09-19[Ada] Fix run-time segfault with derived access-to-subprogram typeEric Botcazou2-0/+24
This fixes a segfault at run time for the call to a local subprogram through an access value if the type of this access value is derived from an initial access-to-subprogram type and the access value was originally obtained with the initial type. 2019-09-19 Eric Botcazou <ebotcazou@adacore.com> gcc/ada/ * sem_ch3.adb (Build_Derived_Access_Type): If this is an access- to-subprogram type, copy Can_Use_Internal_Rep from the parent. gcc/testsuite/ * gnat.dg/access9.adb: New testcase. From-SVN: r275945
2019-09-19[Ada] Crash on predicate in full view in a generic unitEd Schonberg3-0/+65
This patch fixes a compiler abort on a dynamic predicate applied to the full view of a type in a generic package declaration, when the expression for the predicate is a conditionql expression that contains references to components of the full view of the type. 2019-09-19 Ed Schonberg <schonberg@adacore.com> gcc/ada/ * sem_ch13.adb (Check_Aspect_At_End_Of_Declarations): Simplify handling of expressions in predicates when the context is a generic unit. gcc/testsuite/ * gnat.dg/predicate14.adb, gnat.dg/predicate14.ads: New testcase. From-SVN: r275939
2019-09-19[Ada] Fix spurious type mismatch failure on nested instantiationsEric Botcazou5-0/+63
This fixes a spurious type mismatch failure reported between formal and actual of a call to a subprogram that comes from the instantiation of a child generic unit that itself contains an instantiation of a slibling child generic unit, when the parent is itself a generic unit with private part. The regression was introduced by a recent change made to clear the Is_Generic_Actual_Type on the implicit full view built when a generic package is instantiated on a private type. 2019-09-19 Eric Botcazou <ebotcazou@adacore.com> gcc/ada/ * sem_ch12.adb (Restore_Private_Views): Comment out new code that clear the Is_Generic_Actual_Type also on the full view. gcc/testsuite/ * gnat.dg/generic_inst13.adb, gnat.dg/generic_inst13_pkg-nested_g.ads, gnat.dg/generic_inst13_pkg-ops_g.ads, gnat.dg/generic_inst13_pkg.ads: New testcase. From-SVN: r275935
2019-09-19[Ada] Infinite loop with concatenation and aspectBob Duff2-0/+18
This patch fixes a bug where an array object initialized with a concatenation, and that has an aspect_specification for Alignment, causes the compiler goes into an infinite loop. 2019-09-19 Bob Duff <duff@adacore.com> gcc/ada/ * exp_ch3.adb (Rewrite_As_Renaming): Return False if there are any aspect specifications, because otherwise Insert_Actions blows up. gcc/testsuite/ * gnat.dg/concat3.adb: New testcase. From-SVN: r275934
2019-09-19[Ada] Fix fallout of previous change for bit-packed arraysEric Botcazou2-0/+27
This fixes a regression introduced by the previous change that improved the handling of explicit by-reference mechanism. For the very specific case of a component of a bit-packed array, the front-end still needs to insert a copy around the call because this is where the rewriting into the sequence of mask-and-shifts is done for the code generator. 2019-09-19 Eric Botcazou <ebotcazou@adacore.com> gcc/ada/ * exp_ch6.adb (Add_Simple_Call_By_Copy_Code): Add Bit_Packed_Array parameter and documet it. Always insert a copy if it is set True. (Expand_Actuals): Adjust the calls to Add_Simple_Call_By_Copy_Code. gcc/testsuite/ * gnat.dg/pack26.adb: New testcase. From-SVN: r275933
2019-09-19Extend pass rpad to handle avx512f vcvtusi2ss vcvtusi2ss 538.imagick_r ↵Hongtao Liu2-0/+23
improved... Extend pass rpad to handle avx512f vcvtusi2ss vcvtusi2ss 538.imagick_r improved by 4% with single copy run on SKYLAKE workstation. gcc/ * config/i386/i386.md (*floatuns<SWI48:mode><MODEF:mode>2_avx512): Add avx_partial_xmm_update. gcc/testsuie * gcc.target/i386/pr87007-3.c: New test. From-SVN: r275926
2019-09-18i386: Restore Skylake SImode hard register store costH.J. Lu2-0/+30
On Skylake, we should move integer register to SSE register without going through memory. This patch restores Skylake SImode hard register store cost to 6. gcc/ PR target/90878 * config/i386/x86-tune-costs.h (skylake_cost): Restore SImode hard register store cost to 6. gcc/testsuite/ PR target/90878 * gcc.target/i386/pr90878.c: New test. From-SVN: r275906
2019-09-18i386: Increase Skylake SImode pseudo register store costH.J. Lu2-0/+29
On Skylake, SImode store cost isn't less than half cost of 128-bit vector store. This patch increases Skylake SImode pseudo register store cost to make it the same as QImode and HImode. gcc/ PR target/91446 * config/i386/x86-tune-costs.h (skylake_cost): Increase SImode pseudo register store cost from 3 to 6 to make it the same as QImode and HImode. gcc/testsuite/ PR target/91446 * gcc.target/i386/pr91446.c: New test. From-SVN: r275905
2019-09-18[Ada] Fix spurious alignment warning on simple address clauseEric Botcazou3-0/+29
This eliminates a spurious alignment warning given by the compiler on an address clause when the No_Exception_Propagation restriction is in effect and the -gnatw.x switch is used. In this configuration the address clauses whose expression is itself of the form X'Address would not be sufficiently analyzed and, therefore, the compiler might give false positive warnings. 2019-09-18 Eric Botcazou <ebotcazou@adacore.com> gcc/ada/ * checks.ads (Alignment_Warnings_Record): Add P component. * checks.adb (Apply_Address_Clause_Check): Be prepared to kill the warning also if the clause is of the form X'Address. (Validate_Alignment_Check_Warning): Kill the warning if the clause is of the form X'Address and the alignment of X is compatible. gcc/testsuite/ * gnat.dg/warn31.adb, gnat.dg/warn31.ads: New testcase. From-SVN: r275865
2019-09-18[Ada] Crash on universal case expression in fixed-point divisionEd Schonberg2-0/+32
This patch fixes a compiler abort on a case expression whose alternatives are universal_real constants, when the case expression is an operand in a multiplication or division whose other operand is of a fixed-point type. 2019-09-18 Ed Schonberg <schonberg@adacore.com> gcc/ada/ * sem_res.adb (Set_Mixed_Node_Expression): If a conditional expression has universal_real alternaitves and the context is Universal_Fixed, as when it is an operand in a fixed-point multiplication or division, resolve the expression with a visible fixed-point type, which must be unique. gcc/testsuite/ * gnat.dg/fixedpnt8.adb: New testcase. From-SVN: r275864
2019-09-18[Ada] Crash on aggregate with dscriminant in if-expression as defaultEd Schonberg2-0/+37
This patch fixes a crash on a an aggregate for a discriminated type, when a component of the aggregate is also a discriminated type constrained by a discriminant of the enclosing object, and the default value for the component is a conditional expression that includes references to that outer discriminant. 2019-09-18 Ed Schonberg <schonberg@adacore.com> gcc/ada/ * exp_aggr.adb (Expand_Record_Aggregate, Rewrite_Discriminant): After rewriting a reference to an outer discriminant as a selected component of the enclosing object, analyze the selected component to ensure that the entity of the selector name is properly set. This is necessary when the aggregate appears within an expression that may have been analyzed already. gcc/testsuite/ * gnat.dg/discr58.adb: New testcase. From-SVN: r275862
2019-09-18[Ada] Spurious ineffective use_clause warningJustin Squirek3-0/+20
This patch fixes an issue whereby expansion of post conditions may lead to spurious ineffective use_clause warnings when a use type clause is present in a package specification and a use package clause exists in the package body on the package containing said type. 2019-09-18 Justin Squirek <squirek@adacore.com> gcc/ada/ * sem_ch8.adb (Use_One_Type): Add guard to prevent warning on a reundant use package clause where there is no previous use_clause in the chain. gcc/testsuite/ * gnat.dg/warn30.adb, gnat.dg/warn30.ads: New testcase. From-SVN: r275861
2019-09-18[Ada] Missing accessibility check on discrim assignmentJustin Squirek4-0/+100
This patch fixes an issue whereby assignments from anonymous access descriminants which are part of stand alone objects of anonymous access did not have runtime checks generated based on the accessibility level of the object according to ARM 3.10.2 (12.5/3). 2019-09-18 Justin Squirek <squirek@adacore.com> gcc/ada/ * exp_ch4.adb (Expand_N_Type_Conversion): Add calculation of an alternative operand for the purposes of generating accessibility checks. gcc/testsuite/ * gnat.dg/access8.adb, gnat.dg/access8_pkg.adb, gnat.dg/access8_pkg.ads: New testcase. From-SVN: r275860
2019-09-18[Ada] Fix sharing of expression in array aggregate with others choiceEric Botcazou2-0/+33
This change fixes a long-standing issue in the compiler that is generally silent but may lead to wrong code generation in specific circumstances. When an others choice in an array aggregate spans multiple ranges, the compiler may generate multiple (groups of) assignments for the ranges. The problem is that it internally reuses the original expression for all the ranges, which is problematic if this expression gets rewritten during the processing of one of the ranges and typically causes a new temporary to be shared between different ranges. The solution is to duplicate the original expression for each range. 2019-09-18 Eric Botcazou <ebotcazou@adacore.com> gcc/ada/ * exp_aggr.adb (Build_Array_Aggr_Code): In STEP 1 (c), duplicate the expression and reset the Loop_Actions for each loop generated for an others choice. gcc/testsuite/ * gnat.dg/aggr28.adb: New testcase. From-SVN: r275859
2019-09-18[Ada] Implement AI12-0086's rules for discriminants in aggregatesSteve Baird2-0/+28
In Ada2012, a discriminant value that governs an active variant part in an aggregate had to be static. AI12-0086 relaxes this restriction - if the subtype of the discriminant value is a static subtype all of whose values select the same variant, then that is good enough. 2019-09-18 Steve Baird <baird@adacore.com> gcc/ada/ * sem_util.ads (Interval_Lists): A new visible package. This package is visible because it is also intended for eventual use in Sem_Eval.Subtypes_Statically_Compatible when that function is someday upgraded to handle static predicates correctly. This new package doesn't really need to be visible for now, but it still seems like a good idea. * sem_util.adb (Gather_Components): Implement AI12-0086 via the following strategy. The existing code knows how to take a static discriminant value and identify the corresponding variant; in the newly-permitted case of a non-static value of a static subtype, we arbitrarily select a value of the subtype and find the corresponding variant using the existing code. Subsequently, we check that every other value of the discriminant's subtype corresponds to the same variant; this is done using the newly introduced Interval_Lists package. (Interval_Lists): Provide a body for the new package. gcc/testsuite/ * gnat.dg/ai12_0086_example.adb: New testcase. From-SVN: r275857
2019-09-18[Ada] Ensure that Scan_Real result does not depend on trailing zerosNicolas Roche2-0/+14
Previous change in that procedure to handle overflow issues during scanning removed the special handling for trailing zeros in the decimal part. Beside the absence of overflow during scanning the special handling of these zeros is still necessary. 2019-09-18 Nicolas Roche <roche@adacore.com> gcc/ada/ * libgnat/s-valrea.adb (Scan_Integral_Digits): New procedure. (Scan_Decimal_Digits): New procedure. (As_Digit): New function. (Scan_Real): Use Scan_Integral_Digits and Scan_Decimal_Digits. gcc/testsuite/ * gnat.dg/float_value2.adb: New testcase. From-SVN: r275849
2019-09-18[Ada] Raise exception on call to Expect for a dead processVadim Godunko2-0/+39
Call to Expect for a dead process results in SIGBUS signal on Linux systems. Process_Died exception is raised in this case now. 2019-09-18 Vadim Godunko <godunko@adacore.com> gcc/ada/ * libgnat/g-expect.adb (Expect_Internal): Don't include invalid file descriptors into the set of file descriptors for Poll. Raise Process_Died exception when computed set of file descriptors to monitor is empty. gcc/testsuite/ * gnat.dg/expect4.adb: New testcase. From-SVN: r275847
2019-09-18[Ada] No Storage_Error for an oversized disabled ghost array objectSteve Baird3-0/+18
In some cases where the size computation for an object declaration will unconditionally overflow, the FE generates code to raise Storage_Error at the point of the object declaration (and may generate an associated warning). Don't do this if the object declaration is an ignored (i.e., disabled) ghost declaration. 2019-09-18 Steve Baird <baird@adacore.com> gcc/ada/ * freeze.adb (Freeze_Object_Declaration): Do not call Check_Large_Modular_Array when the object declaration being frozen is an ignored ghost entity. gcc/testsuite/ * gnat.dg/ghost7.adb, gnat.dg/ghost7.ads: New testcase. From-SVN: r275845
2019-09-18[Ada] Fix 32/64bit mistake on SYSTEM_INFO component in s-win32Olivier Hainque2-0/+27
The dwActiveProcessorMask field in a SYSTEM_INFO structure on Windows should be DWORD_PTR, an integer the size of a pointer. In s-win32, it is currently declared as DWORD. This happens to work on 32bit hosts and is wrong on 64bit hosts, causing mishaps in accesses to this component and all the following ones. The proposed correction adds a definition for DWORD_PTR and uses it for dwActiveProcessorMask in System.Win32.SYSTEM_INFO. 2019-09-18 Olivier Hainque <hainque@adacore.com> gcc/ada/ * libgnat/s-win32.ads (DWORD_PTR): New type, pointer size unsigned int. (SYSTEM_INFO): Use it for dwActiveProcessorMask. gcc/testsuite/ * gnat.dg/system_info1.adb: New testcase. From-SVN: r275843
2019-09-18[Ada] Avoid uninitialized variable in bounded containersBob Duff3-0/+16
In function Copy in Ada.Containers.Bounded_Ordered_Sets and other bounded containers packages, remove a possible use of an uninitialized variable. This was not a bug, because the uninitialized variable could be used only if checks are suppressed, and the checks would have failed, leading to erroneous execution. However, it seems more robust this way, and is probably equally efficient, and avoids a warning that is given if checks are suppressed, and the -Wall switch is given, and optimization is turned on. 2019-09-18 Bob Duff <duff@adacore.com> gcc/ada/ * libgnat/a-cbhama.adb, libgnat/a-cbhase.adb, libgnat/a-cbmutr.adb, libgnat/a-cborma.adb, libgnat/a-cborse.adb, libgnat/a-cobove.adb (Copy): Avoid reading the uninitialized variable C in the Checks = False case. Change variable to be a constant. gcc/testsuite/ * gnat.dg/containers1.adb, gnat.dg/containers1.ads: New testcase. From-SVN: r275839
2019-09-18[x86] Tweak testcases for PR82361Richard Sandiford3-12/+19
gcc/testsuite/gcc.target/i386/pr82361-[12].c check whether we can optimise away a 32-to-64-bit zero extension of a 32-bit division or modulus result. Currently this fails for the modulus part of f1 and f2 in pr82361-1.c: /* FIXME: We are still not able to optimize the modulo in f1/f2, only manage one. */ /* { dg-final { scan-assembler-times "movl\t%edx" 2 } } */ pr82361-2.c instead expects no failures: /* Ditto %edx to %rdx zero extensions. */ /* { dg-final { scan-assembler-not "movl\t%edx, %edx" } } */ But we actually get the same zero-extensions for f1 and f2 in pr82361-2.c. The reason they don't trigger a failure is that the RA allocates the asm input for "d" to %rdi rather than %rdx, so we have: movl %rdx, %rdi instead of: movl %rdx, %rdx For the tests to work as expected, I think they have to force "c" and "d" to be %rax and %rdx respectively. We then see the same failure in pr82361-2.c as for pr82361-1.c (but doubled, due to the 8-bit division path). 2019-09-18 Richard Sandiford <richard.sandiford@arm.com> gcc/testsuite/ * gcc.target/i386/pr82361-1.c (f1, f2, f3, f4, f5, f6): Force "c" to be in %rax and "d" to be in %rdx. * gcc.target/i386/pr82361-2.c: Expect 4 instances of "movl\t%edx". From-SVN: r275836
2019-09-17[ARM/FDPIC v6 20/24] [ARM][testsuite] FDPIC: Skip tests using architectures ↵Christophe Lyon33-14/+90
unsupported by FDPIC Since FDPIC currently supports arm and thumb-2 modes only, these tests fail because they enforce an architecture version that doesn't match these restrictions. This patch introduces new values for the arm_arch effective-target (v4t_thumb, v5t_thumb, v5te_thumb, v6_thumb, v6k_thumb, v6z_thumb) as needed, and adds them to the relevant tests. In addition, it adds v4t_arm, v5t_arm, v5te_arm, v6_arm, v6k_arm and v6z_arm to avoid skipping some tests when GCC is configured to generate Thumb code by default. It also adds the corresponding non-thumb effective-target to the tests that were missing it. The existing v4t, v5t, v5te, v6 v6k and v6z effective-targets now force -mfloat-abi=softfp since these thumb-1 targets do not support hard-float anyway. Finally, the patch removes the special case to detect the presence of -marm in the flags, since it makes atomic_loaddi tests unsupported: since the flags in question also include -march, the combination is supported, while -marm alone is not if GCC is configured to target an M-profile CPU. 2019-19-17 Christophe Lyon <christophe.lyon@st.com> * lib/target-supports.exp (check_effective_target_arm_arch_FUNC_ok): Add v4t_arm, v4t_thumb, v5t_arm, v5t_thumb, v5te_arm, v5te_thumb, v6_arm, v6_thumb, v6k_arm, v6k_thumb, v6z_arm, v6z_thumb. Add -mfloat-abi=softfp to v4t, v5t, v5te, v6, v6k, v6z. Remove early exit for -marm. * gcc.target/arm/armv6-unaligned-load-ice.c: Add arm_arch effective-target. * gcc.target/arm/attr-unaligned-load-ice.c: Likewise. * gcc.target/arm/ftest-armv4-arm.c: Likewise. * gcc.target/arm/ftest-armv4t-arm.c: Likewise. * gcc.target/arm/ftest-armv4t-thumb.c: Likewise. * gcc.target/arm/ftest-armv5t-arm.c: Likewise. * gcc.target/arm/ftest-armv5t-thumb.c: Likewise. * gcc.target/arm/ftest-armv5te-arm.c: Likewise. * gcc.target/arm/ftest-armv5te-thumb.c: Likewise. * gcc.target/arm/ftest-armv6-arm.c: Likewise. * gcc.target/arm/ftest-armv6-thumb.c: Likewise. * gcc.target/arm/ftest-armv6k-arm.c: Likewise. * gcc.target/arm/ftest-armv6k-thumb.c: Likewise. * gcc.target/arm/ftest-armv6m-thumb.c: Likewise. * gcc.target/arm/ftest-armv6t2-arm.c: Likewise. * gcc.target/arm/ftest-armv6t2-thumb.c: Likewise. * gcc.target/arm/ftest-armv6z-arm.c: Likewise. * gcc.target/arm/ftest-armv6z-thumb.c: Likewise. * gcc.target/arm/g2.c: Likewise. * gcc.target/arm/macro_defs1.c: Likewise. * gcc.target/arm/pr59858.c: Likewise. * gcc.target/arm/pr65647-2.c: Likewise. * gcc.target/arm/pr79058.c: Likewise. * gcc.target/arm/pr83712.c: Likewise. * gcc.target/arm/pragma_arch_switch_2.c: Likewise. * gcc.target/arm/scd42-1.c: Likewise. * gcc.target/arm/scd42-2.c: Likewise. * gcc.target/arm/scd42-3.c: Likewise. * gcc.c-torture/compile/pr82096.c: Fix arm_arch effective-target. * gcc.target/arm/attr_arm-err.c: Likewise. * gcc.target/arm/di-longlong64-sync-withldrexd.c: Likewise. From-SVN: r275803
2019-09-17PR ipa/91089 - Setup predicate for switch default case in IPAFeng Xue2-0/+67
2019-09-17 Feng Xue <fxue@os.amperecomputing.com> PR ipa/91089 * doc/invoke.texi (ipa-max-switch-predicate-bounds): Document new option. * params.def (PARAM_IPA_MAX_SWITCH_PREDICATE_BOUNDS): New. * ipa-fnsummary.c (set_switch_stmt_execution_predicate): Add predicate for switch default case using range analysis information. 2019-09-17 Feng Xue <fxue@os.amperecomputing.com> PR ipa/91089 * gcc.dg/ipa/pr91089.c: New test. From-SVN: r275802
2019-09-17re PR fortran/91588 (ICE in check_inquiry, at fortran/expr.c:2673)Paul Thomas2-0/+39
2019-09-17 Paul Thomas <pault@gcc.gnu.org> PR fortran/91588 * expr.c (check_inquiry): Remove extended component refs by using symbol pointers. If a function argument is an associate variable with a constant target, copy the target expression in place of the argument expression. Check that the charlen is not NULL before using the string length. (gfc_check_assign): Remove extraneous space. 2019-09-17 Paul Thomas <pault@gcc.gnu.org> PR fortran/91588 * gfortran.dg/associate_49.f90 : New test. From-SVN: r275800
2019-09-17[Ada] Fix rounding of fixed-point arithmetic operationYannick Moy2-0/+24
Fixed-point multiplication, division and conversion may lead to calling the function Double_Divide in s-arit64 runtime unit. In the special case where arguments have the special values X = -2**63 and the absolute value of the product of its other arguments Y*Z = 2**64, the rounded value should be either -1 or 1, but currently Double_Divide returns a quotient of 0. Rounding only applies when Round attribute is called on the arithmetic operation for a decimal fixed-point result, or the result type is integer. This fixes correctly applies rounding away from 0 in that special case. 2019-09-17 Yannick Moy <moy@adacore.com> gcc/ada/ * libgnat/s-arit64.adb (Double_Divide): Correctly handle the special case when rounding. gcc/testsuite/ * gnat.dg/fixedpnt7.adb: New testcase. From-SVN: r275796
2019-09-17[Ada] Raise Constraint_Error in overflow case involving roundingYannick Moy2-0/+28
Function Scaled_Divide in s-arith runtime unit computes the combined multiplication and division of its arguments ((X*Y) / Z). In a very special case where the quotient computed before rounding is 2**64-1, then rounding may lead to undesirable wrap-around, leading to a computed quotient of 0 instead of raising Constraint_Error as expected. This function is only called in the runtime for arithmetic operations involving fixed-point types. Rounding is performed only when the target type is of a decimal fixed-point type, and the attribute 'Round of the type is used to round the result of the arithmetic operation. This fix correctly raises Constraint_Error in this special case. 2019-09-17 Yannick Moy <moy@adacore.com> gcc/ada/ * libgnat/s-arit64.adb (Scaled_Divide): Add protection against undesirable wrap-around. gcc/testsuite/ * gnat.dg/multfixed.adb: New testcase. From-SVN: r275791
2019-09-17[Ada] Avoid to close irrelevant file descriptorsVadim Godunko2-0/+37
'Close' subprogram of GNAT.Expect can close irrelevant file descriptors when 'Expect' was terminated by Process_Died exception and any file open operations was done before call to 'Close'. 2019-09-17 Vadim Godunko <godunko@adacore.com> gcc/ada/ * libgnat/g-expect.ads, libgnat/g-expect.adb (Close_Input): New subprogram. (Get_Command_Output): Call Close_Input to close input stream. (Expect_Internal): Likewise. (Close): Likewise. * libgnat/g-exptty.adb (Close): Likewise. gcc/testsuite/ * gnat.dg/expect3.adb: New testcase. From-SVN: r275781
2019-09-17[Ada] In a generic use Presanalyze_Spec_Expression on PredicatesEd Schonberg3-0/+31
When verifying that the meaning of an aspect has not changed between the freeze point of the entity and the end of the declarations, we analkyze a copy of the expression to verify its conformance to previous analysis. If the expression contains overloaded references, these have to be resolved, which is not done if the expression is only preanalyzed. This applies in particular to expressions in predicates. 2019-09-17 Ed Schonberg <schonberg@adacore.com> gcc/ada/ * sem_ch13.adb (Check_Aspect_At_End_Of_Declarations): In a generic context, for a Predicate aspect, use Preanalyze_Spec_Expression to verify conformance. gcc/testsuite/ * gnat.dg/predicate13.adb, gnat.dg/predicate13.ads: New testcase. From-SVN: r275778
2019-09-17[Ada] Ada 2020: Raise expressions in limited contexts (AI12-0172)Javier Miranda2-0/+62
This patch adds support for the use of raise expressions in more limited contexts (as described in the Ada Isssue AI12-0172). 2019-09-17 Javier Miranda <miranda@adacore.com> gcc/ada/ * exp_ch3.adb (Build_Record_Init_Proc): Do not generate code to adjust the tag component when the record is initialized with a raise expression. * sem_aggr.adb (Valid_Limited_Ancestor): Return True for N_Raise_Expression nodes. (Valid_Ancestor_Type): Return True for raise expressions. * sem_ch3.adb (Analyze_Component_Declaration): Do not report an error when a component is initialized with a raise expression. * sem_ch4.adb (Analyze_Qualified_Expression): Do not report an error when the aggregate has a raise expression. gcc/testsuite/ * gnat.dg/limited4.adb: New testcase. From-SVN: r275776
2019-09-17[Ada] Fix wrong value of 'Size for slices of bit-packed arraysEric Botcazou2-0/+25
This fixes a long-standing issue in the compiler which would return a wrong value for the Size attribute applied to slices of bit-packed arrays whose size is not a multiple of the storage unit. The problem is that the computation was done in the code generator after the bit-packed array had been internally rewritten into an array of bytes, so the Size was always rounded up to the next byte. The computation is now rewritten into the product of the Length and Compnent_Size attribute of the slices before being sent to the code generator. 2019-09-17 Eric Botcazou <ebotcazou@adacore.com> gcc/ada/ * exp_attr.adb (Expand_Size_Attribute): Chain the special cases on the back-end path and rewrite the attribute appled to slices of bit-packed arrays into the product of the Length and the Compoent_Size attributes of the slices. * exp_ch5.adb (Expand_Assign_Array_Bitfield): Use Size attribute directly to compute the bitfield's size. gcc/testsuite/ * gnat.dg/pack25.adb: New testcase. From-SVN: r275769
2019-09-16decl.c (grokdeclarator): Use declspecs->locations and declarator->id_loc in ↵Paolo Carlini10-27/+44
a few error messages. /cp 2019-09-16 Paolo Carlini <paolo.carlini@oracle.com> * decl.c (grokdeclarator): Use declspecs->locations and declarator->id_loc in a few error messages. * pt.c (finish_member_template_decl): Use DECL_SOURCE_LOCATION. (push_template_decl_real): Likewise. /testsuite 2019-09-16 Paolo Carlini <paolo.carlini@oracle.com> * g++.dg/ext/int128-6.C: New. * c-c++-common/pr68107.c: Test location(s). * g++.dg/other/large-size-array.C: Likewise. * g++.dg/template/dtor2.C: Likewise. * g++.dg/template/error9.C: Likewise. * g++.dg/tls/diag-2.C: Likewise. * g++.dg/tls/diag-4.C: Likewise. * g++.dg/tls/diag-5.C: Likewise. * g++.old-deja/g++.pt/memtemp71.C: Likewise. From-SVN: r275759
2019-09-16pr89386.c (foo): Fix return type.Uros Bizjak2-2/+2
* gcc.target/i386/pr89386.c (foo): Fix return type. * gcc.target/i386/pr89386-1.c (foo): Ditto. From-SVN: r275757
2019-09-16Fix PR88784, middle end is missing some optimizations about unsignedLi Jia He13-0/+389
2019-09-16 Li Jia He <helijia@linux.ibm.com> Qi Feng <ffengqi@linux.ibm.com> PR middle-end/88784 * match.pd (x > y && x != XXX_MIN): Optimize into 'x > y'. (x > y && x == XXX_MIN): Optimize into 'false'. (x <= y && x == XXX_MIN): Optimize into 'x == XXX_MIN'. (x < y && x != XXX_MAX): Optimize into 'x < y'. (x < y && x == XXX_MAX): Optimize into 'false'. (x >= y && x == XXX_MAX): Optimize into 'x == XXX_MAX'. (x > y || x != XXX_MIN): Optimize into 'x != XXX_MIN'. (x <= y || x != XXX_MIN): Optimize into 'true'. (x <= y || x == XXX_MIN): Optimize into 'x <= y'. (x < y || x != XXX_MAX): Optimize into 'x != XXX_MAX'. (x >= y || x != XXX_MAX): Optimize into 'true'. (x >= y || x == XXX_MAX): Optimize into 'x >= y'. 2019-09-16 Li Jia He <helijia@linux.ibm.com> Qi Feng <ffengqi@linux.ibm.com> PR middle-end/88784 * gcc.dg/pr88784-1.c: New testcase. * gcc.dg/pr88784-2.c: New testcase. * gcc.dg/pr88784-3.c: New testcase. * gcc.dg/pr88784-4.c: New testcase. * gcc.dg/pr88784-5.c: New testcase. * gcc.dg/pr88784-6.c: New testcase. * gcc.dg/pr88784-7.c: New testcase. * gcc.dg/pr88784-8.c: New testcase. * gcc.dg/pr88784-9.c: New testcase. * gcc.dg/pr88784-10.c: New testcase. * gcc.dg/pr88784-11.c: New testcase. * gcc.dg/pr88784-12.c: New testcase. Co-Authored-By: Qi Feng <ffengqi@linux.ibm.com> From-SVN: r275749
2019-09-16re PR tree-optimization/91756 (g++.dg/lto/alias-3 FAILs)Richard Biener2-0/+35
2019-09-16 Richard Biener <rguenther@suse.de> PR tree-optimization/91756 PR tree-optimization/87132 * tree-ssa-alias.h (enum translate_flags): New. (get_continuation_for_phi): Use it instead of simple bool flag. (walk_non_aliased_vuses): Likewise. * tree-ssa-alias.c (maybe_skip_until): Adjust. (get_continuation_for_phi): When looking across backedges only disallow valueization. (walk_non_aliased_vuses): Adjust. * tree-ssa-sccvn.c (vn_reference_lookup_3): Avoid valueization if requested. * gcc.dg/tree-ssa/ssa-fre-81.c: New testcase. From-SVN: r275747
2019-09-16PR c++/30277 - int-width bit-field promotion.Jason Merrill1-0/+17
Here, if cp_perform_integral_promotions saw that the TREE_TYPE of a bit-field reference was the same as the type it promotes to, it didn't do anything. But then decay_conversion saw that the bit-field reference was unchanged, and converted it to its declared type. So I needed to add something to make it clear that promotion has been done. But then the 33819 change caused trouble by looking through the NOP_EXPR I just added. This was the wrong fix for that bug; I've now fixed that better by recognizing in cp_perform_integral_promotions that we won't promote a bit-field larger than 32 bits, so we should use the declared type. PR c++/33819 - long bit-field promotion. * typeck.c (cp_perform_integral_promotions): Handle large bit-fields properly. Handle 32-bit non-int bit-fields properly. (is_bitfield_expr_with_lowered_type): Don't look through NOP_EXPR. From-SVN: r275746
2019-09-16PR c++/82165 - enum bitfields and operator overloading.Jason Merrill1-0/+36
In this testcase, !f.b0 was failing to call the overloaded operator because TREE_TYPE is the magic bitfield integer type, and we weren't using unlowered_expr_type the way we do in other places. It would be nice if we could give bit-field COMPONENT_REFs their declared type until genericization time... * call.c (build_new_op_1): Use unlowered_expr_type. From-SVN: r275745
2019-09-15PR c++/91740 - ICE with constexpr call and ?: in ARRAY_REF.Marek Polacek2-0/+10
* pt.c (build_non_dependent_expr): Call build_non_dependent_expr for the first operand. * g++.dg/cpp1y/var-templ63.C: New test. From-SVN: r275736
2019-09-152019-09-15 Sandra Loosemore <sandra@codesourcery.com>Sandra Loosemore2-2/+9
gcc/testsuite/ * lib/target-supports.exp (check_effective_target_arm_neon_fp16_hw) (check_effective_target_arm_fp16_hw): Use check_runtime instead of check_runtime_nocache. From-SVN: r275735