In the testcase below, we pretty print the nested type A<int>::B as
A<int>::B<int> because we don't check whether B is itself a class
template before printing the innermost set of template arguments from
B's TEMPLATE_INFO (which in this case belong to A). This patch fixes
this by checking PRIMARY_TEMPLATE_P beforehand.
gcc/cp/ChangeLog:
PR c++/95303
* cxx-pretty-print.c (pp_cxx_unqualified_id): Check
PRIMARY_TEMPLATE_P before printing the innermost template
arguments.
gcc/testsuite/ChangeLog:
PR c++/95303
* g++.dg/concepts/diagnostic14.C: New test.
The code snippet for this test was returning 1 if power10
instructions executed correctly. It should return 0 if the
test passes.
* lib/target-supports.exp (check_power10_hw_available):
Return 0 for passing test.
With C++ module header units it becomes important to distinguish
between macros defined in forced headers (& commandline & builtins)
from those defined in the header file being processed. We weren't
making that easy because we treated the builtins and command-line
locations somewhat file-like, with incrementing line numbers, and
showing them as included from line 1 of the main file. This patch does
3 things:
0) extend the idiom that 'line 0' of a file means 'the file as a whole'
1) builtins and command-line macros are shown as-if included from line zero.
2) when emitting preprocessed output we keep resetting the line number
so that re-reading that preprocessed output will get the same set of
locations for the command line etc.
For instance the new c-c++-common/cpp/line-2.c test, now emits
In file included from <command-line>:
./line-2.h:4:2: error: #error wrong
4 | #error wrong
| ^~~~~
line-2.c:3:11: error: macro "bill" passed 1 arguments, but takes just 0
3 | int bill(1);
| ^
In file included from <command-line>:
./line-2.h:3: note: macro "bill" defined here
3 | #define bill() 2
|
Before it told you about including from <command-line>:31.
the preprocessed output looks like:
...
(There's a new optimization in do_line_marker to stop each of these
line markers causing a new line map. We can simply rewind the
location, and keep using the same line map.)
libcpp/
* directives.c (do_linemarker): Optimize rewinding to line zero.
* files.c (_cpp_stack_file): Start on line zero when about to inject
headers.
(cpp_push_include, cpp_push_default_include): Use highest_line as
the location.
* include/cpplib.h (cpp_read_main_file): Add injecting parm.
* init.c (cpp_read_main_file): Likewise, inform _cpp_stack_file.
* internal.h (enum include_type): Add IT_MAIN_INJECT.
gcc/c-family/
* c-opts.c (c_common_post_options): Add 'injecting' arg to
cpp_read_main_file.
(c_finish_options): Add linemap_line_start calls for builtin and cmd
maps. Force token position to line_table's highest line.
* c-ppoutput.c (print_line_1): Refactor, print line zero.
(cb_define): Always increment source line.
gcc/testsuite/
* c-c++-common/cpp/line-2.c: New.
* c-c++-common/cpp/line-2.h: New.
* c-c++-common/cpp/line-3.c: New.
* c-c++-common/cpp/line-4.c: New.
* c-c++-common/cpp/line-4.h: New.
Make the costs such that they do not exaclty reflect
the actual instructions costs from the manual but make
the codegen emit the code we want it to.
gcc/ChangeLog:
* config/aarch64/aarch64.c (thunderx2t99_regmove_cost,
thunderx2t99_vector_cost): Likewise.
This fixes a condition that caused all negative step DR groups to
be detected as single element interleaving. Such groups are
rejected by interleaving vectorization but miscompiled by SLP
which is fixed by forcing VMAT_STRIDED_SLP for now.
2020-07-07 Richard Biener <rguenther@suse.de>
* tree-vect-data-refs.c (vect_analyze_data_ref_accesses): Fix
group overlap condition to allow negative step DR groups.
* tree-vect-stmts.c (get_group_load_store_type): For
multi element SLP groups force VMAT_STRIDED_SLP when the step
is negative.
* gcc.dg/vect/slp-47.c: New testcase.
* gcc.dg/vect/slp-48.c: Likewise.
gcc/ada/
* freeze.adb (Freeze_Array_Type): Use Ctyp more consistently.
Move code setting the alignment in the non-packed case to...
* layout.adb (Layout_Type): ...here.
gcc/ada/
* sem_ch6.adb (Check_Formal_Subprogram_Conformance): New
subprogram to handle checking without systematically emitting an
error.
(Check_Conformance): Update call to
Check_Formal_Subprogram_Conformance and fix handling of Conforms
and Errmsg parameters.
gcc/ada/
* exp_ch4.adb (Tagged_Membership): Generate a call to
CW_Membership instead of using Build_CW_Membership.
(Expand_N_In): Remove wrong handling of null access types and
corresponding comment.
* exp_intr.adb (Expand_Dispatching_Constructor_Call): Generate a
call to CW_Membership instead of using Build_CW_Membership.
* rtsfind.ads: Add CW_Membership.
* exp_atag.ads, exp_atag.adb (Build_CW_Membership): Removed.
* einfo.ads: Fix typo.
* libgnat/a-tags.ads, libgnat/a-tags.adb (CW_Membership): Moved
back to spec.
gcc/ada/
* exp_ch3.adb (Build_Access_Subprogram_Wrapper_Body): Create
proper subprogram specification for body, using names in the
subprogram declaration but distinct entities.
* exp_ch6.adb (Expand_Call): If this is an indirect call
involving a subprogram wrapper, insert pointer parameter in list
of actuals with a parameter association, not as a positional
parameter.
gcc/ada/
* exp_ch6.adb (Expand_Branch): Verify the original node is a
conditional expression before recursing further.
(Insert_Level_Assign): Transform assertion into an explicit
raise.
gcc/ada/
* checks.ads (Expander Routines): Update the description of the
Do_Range_Check mechanism.
* checks.adb (Selected_Range_Checks): Fix typo.
* exp_ch9.adb: Add with and use clause for Checks.
(Actual_Index_Expression): Generate a range check if requested.
(Entry_Index_Expression): Likewise.
* sem_attr.adb (Resolve_Attribute) <Attribute_Count>: Call
Apply_Scalar_Range_Check instead of Apply_Range_Check.
* sem_ch9.adb (Analyze_Accept_Statement): Likewise.
* sem_res.adb (Resolve_Entry): Likewise, after having set the
actual index type on the prefix of the indexed component.
(Resolve_Indexed_Component): Remove useless conditional construct.
gcc/ada/
* contracts.adb (Analyze_Entry_Or_Subprogram_Contract,
Process_Preconditions_For): Freeze expression that has been
relocated to pragma Precondition, not the expression which is
still in the aspect.
gcc/ada/
* sem_ch6.adb (Check_Conformance): Remove unnecessary (and
wrong) code.
* sem_ch8.adb (Check_Null_Exclusion): Post error at proper
location. Introduce new helper Null_Exclusion_Mismatch and fix
implementation wrt formal subprograms used in generic bodies.
(Analyze_Subprogram_Renaming): Fix missing setting of
Error_Msg_Sloc.
(Analyze_Object_Renaming): Replace "in Anonymous_Access_Kind" by
Is_Anonymous_Access_Type.
* sem_util.adb (Has_Null_Exclusion): Fix handling of
N_Parameter_Specification.
* sem_ch12.adb (Instantiate_Object): Replace "in
Anonymous_Access_Kind" by Is_Anonymous_Access_Type.
gcc/ada/
* doc/gnat_ugn/building_executable_programs_with_gnat.rst
(Validity Checking): Add "p" to the list of switches enabled by
-gnatVa.
* gnat_ugn.texi: Regenerate.
gcc/ada/
* sem_ch13.adb (Analyze_Attribute_Definition_Clause): Add call
to Check_Restriction_No_Specification_Of_Aspect.
* sem_prag.adb (Analyze_Pragma): Likewise.
* restrict.ads (Check_Restriction_No_Specification_Of_Aspect):
Mention possible new node kinds in documentation.
* restrict.adb (Check_Restriction_No_Specification_Of_Aspect):
Retrieve aspect id from different fields if given node is an
N_Pragma or an N_Attribute_Definition_Clause.
gcc/ada/
* contracts.adb (Add_Invariant_And_Predicate_Checks): Relax the
condition for doing invariant checks so that in-mode parameters
of procedures are also checked (required by AI05-0289, and
restricted to procedures by AI12-0044). This is done in a
procedure's nested postconditions procedure.
* exp_ch6.adb (Expand_Actuals): Also perform postcall invariant
checks for in parameters of procedures (but not functions).
Moved invariant-checking code to end of Expand_Actuals
(including the nested function Is_Public_Subp).
gcc/ada/
* exp_spark.adb (Expand_SPARK_N_Attribute_Reference): Add scalar
range checks for 'Update on arrays just like for 'Update on
records.
* sem_attr.adb (Analyze_Array_Component_Update): Do not set
range checks for single-dimensional arrays.
(Resolve_Attribute): Do not set range checks for both single-
and multi- dimensional arrays.
Only '(' and ':' currently terminate file lists in ChangeLog entries
in the ChangeLog parser. This rules out such legitimate entries as:
* filename <CASE>:
* filename [COND]:
This patch extends the ChangeLog parser to recognize these forms.
for contrib/ChangeLog
* gcc-changelog/git_commit.py: Support CASE and COND.
* gcc-changelog/test_patches.txt: Add test.
* gcc-changelog/test_email.py: Add test.
Co-Authored-By: Martin Liska <mliska@suse.cz>
This fixes the sorting of to copy symbols in lto_output introduced
with GCC 10 to not depend on the actual values of the randomness
we append to LTO section names but instead on the order they appear
in the unsorted array.
This fixed observed debug info differences due to tree merging
prevailing different early debug pointers.
2020-07-06 Richard Biener <rguenther@suse.de>
* lto-streamer-out.c (cmp_symbol_files): Use the computed
order map to sort symbols from the same sub-file together.
(lto_output): Compute a map of sub-file to an order number
it appears in the symbol output array.
This makes the formatting in <optional> consistent and also removes
redundant && tokens from template arguments for traits like
is_constructible and is_convertible.
libstdc++-v3/ChangeLog:
* include/std/optional (_Optional_payload_base, _Optional_base)
(optional, __optional_hash_call_base): Adjust whitespace and
other formatting. Remove redundant && tokens on template
arguments to type traits.
The standard rquires that std::make_optional is constrained similarly to
the std::optional constructors, which our implementation fails to do.
As a conforming extension this also adds a noexcept-specifier to each
std::make_optional overload.
libstdc++-v3/ChangeLog:
* include/std/optional (make_optional): Add enable_if
constraints and noexcept-specifier to each overload.
* testsuite/20_util/optional/make_optional-2.cc: New test.
libstdc++-v3/ChangeLog:
PR libstdc++/96036
* include/std/optional (optional): Add noexcept-specifier to
every constructor, assignment operator, emplace function and
dereference operator.
* testsuite/20_util/optional/assignment/noexcept.cc: New test.
* testsuite/20_util/optional/cons/noexcept.cc: New test.
The ABI exception helpers like __throw were being created by first
looking for them, and then adding if not found. Primarily because
libitm wasn't declaring them with the correct exception specifiers. I
fixed libitm a while back, so let's just use push_library_fn and let
the symbol table machinery deal with duplicates. push_library_fn was
making the assumtion there wasn't already a decl available, by always
returning the new decl. Bad things would happen if there was a
duplicate, because duplicate_decls explicitly gcc_frees the new decl.
Fixed by having it return whatever pushdecl returns.
gcc/cp/
* decl.c (push_library_fn): Return the decl pushdecl_toplevel returns.
* except.c (verify_library_fn): Replace with ...
(declare_library_fn_1): ... this fn. Always push the fn.
(declare_library_fn): Call it.
(build_throw): Call declare_library_fn_1.
gcc/testsuite/
* g++.dg/eh/builtin10.C: Adjust expected errors.
* g++.dg/eh/builtin11.C: Likewise.
* g++.dg/eh/builtin5.C: Likewise.
* g++.dg/eh/builtin6.C: Likewise.
* g++.dg/eh/builtin7.C: Likewise.
* g++.dg/eh/builtin9.C: Likewise.
* g++.dg/parse/crash55.C: Likewise.
In SELECT TYPE, the argument may be an incorrectly specified unlimited
polymorphic variable. Avoid a NULL pointer dereference for clean error
recovery.
gcc/fortran/
PR fortran/95980
* match.c (copy_ts_from_selector_to_associate, build_class_sym):
Distinguish between unlimited polymorphic and ordinary variables
to avoid NULL pointer dereference.
* resolve.c (resolve_select_type):
Distinguish between unlimited polymorphic and ordinary variables
to avoid NULL pointer dereference.