Age | Commit message (Collapse) | Author | Files | Lines |
|
A minimal expansion of fixedpoint operations is needed for GNATprove, because
the subsequent resolution of type conversion relies on this expansion being
done.
gcc/ada/ChangeLog:
* exp_ch4.adb (Fixup_Universal_Fixed_Operation): Move to spec.
* exp_ch4.ads (Fixup_Universal_Fixed_Operation): Move from body.
* exp_spark.adb (Expand_SPARK): Call a fixup expansion routine.
|
|
The compiler crashes on compiling a return statement of a function whose result
type has a component whose type is specified with Relaxed_Finalization. The
compiler was attempting to retrieve a nonexistent BIP_Collection extra formal
from the enclosing function, which may not exist in the case of result types
with Relaxed_Finalization.
gcc/ada/ChangeLog:
* exp_ch3.adb (Build_Heap_Or_Pool_Allocator): Test not Has_Relaxed_Finalization
as a guard against retrieving BIP_Collection formal (and related code).
|
|
The frontend reports a warning when no component of an untagged
record type U is a record type, and the type C of some of its
components has defined its user-defined equality operator "=".
The warning is reported because it may be surprising that, following
RM 4.5.2 (24/3), the predefined "=" of the component type C takes
precedence over its user-defined "=" when objects of the record
type R are compared.
gcc/ada/ChangeLog:
* exp_ch3.adb (Build_Untagged_Record_Equality): Report the
warning when no component of an untagged record type U is a
record type, and the type C of some of its components has
defined its user-defined equality operator "=".
* exp_ch4.adb (Expand_Composite_Equality): Report the warning
calling Warn_On_Ignored_Equality_Operator.
* sem_warn.ads (Warn_On_Ignored_Equality_Operator): New subprogram.
* sem_warn.adb (Warn_On_Ignored_Equality_Operator): Factorize code
reporting the warning.
|
|
gcc/ada/ChangeLog:
* libgnat/a-ngelfu.adb: conditional computation of X^2
|
|
The package System.Case_Utilities provides some subprograms that do not make
use of the secondary stack and some that do. When compiling in a context
where no secondary stack support is provided, this makes the entire package
unusable (and similarly for any other package that withs this package).
Split the package into two packages named Case_Utilities_NSS and Case_Utilities
(NSS is for "no secondary stack"). The first package declares the
subprograms that do not need secondary stack support. The second package
declares the remaining subprograms, as well as renamings of everything declared
in the first part. A client that continues to reference Case_Utilities is
largely unaffected by this change. But if we change a client to reference
Case_Utilities_NSS instead, that removes an obstacle that would otherwise
prevent using that client unit in a no-secondary-stack-support environment.
We then make that change to the body of package System.Val_Util.
gcc/ada/ChangeLog:
* Makefile.rtl: Add entry for new unit's object file.
* libgnat/s-casuti.adb: Remove bodies of subprograms that were moved
to the new unit.
* libgnat/s-casuti.ads: Replace (with renamings) declarations for
subprograms that moved to the new unit.
* libgnat/s-cautns.adb: Body for new unit (a new source file).
* libgnat/s-cautns.ads: Spec for new unit (a new source file).
* libgnat/s-valuti.adb: Use the new unit instead of the old one.
* gcc-interface/Make-lang.in: Add entries for new unit's object file.
* gcc-interface/Makefile.in: Likewise.
|
|
The compiler fails with an error or Assert_Failure when calling
an instantiation of Unchecked_Deallocation that has been instantiated
with a constrained subtype of a discriminated protected type.
gcc/ada/ChangeLog:
* sem_ch3.adb (Constrain_Corresponding_Record): Inherit Class_Wide_Type on the
created constrained subtype.
|
|
gcc/ada/ChangeLog:
* doc/gnat_ugn/building_executable_programs_with_gnat.rst: add
GNAT LLVM explicit selection in GPR file
* gnat_ugn.texi: Regenerate.
|
|
Unlike RTE, RTU_Entity alone does not cause the unit to be loaded.
gcc/ada/ChangeLog:
* exp_ch7.adb (Shift_Address_For_Descriptor): Add dummy variable
to make sure that System_Storage_Elements is loaded.
|
|
This extension adds "continue" as a nonreserved keyword, and this is the
first occurrence of a nonreserved keyword in GNAT, which causes this
patch to add unusual overload resolution code.
New node kinds are introduced, but since they are entirely transformed
into existing constructs during expansion, back ends that don't turn off
expansion do not need to be updated.
gcc/ada/ChangeLog:
* doc/gnat_rm/gnat_language_extensions.rst: Document new extension.
* gen_il-fields.ads (Opt_Field_Enum): Add new fields.
* gen_il-types.ads (N_Loop_Flow_Statement, N_Continue_Statement): New
node kinds.
* gen_il-gen-gen_nodes.adb (N_Loop_Flow_Statement): New abstract node
kind.
(N_Continue_Statement): New node kind.
(N_Exit_Statement): Reparent below N_Loop_Flow_Statement.
* sinfo.ads (N_Continue_Statement): Add description.
* sinfo-utils.ads (Loop_Flow_Keyword): New function.
* sinfo-utils.adb (Loop_Flow_Keyword): New function.
* gen_il-gen-gen_entities.adb (E_Loop): Add new field.
* einfo.ads (Continue_Mark): Document new field.
* sprint.adb (Sprint_Node_Actual): Update for new node kind.
* snames.ads-tmpl: Add new keyword.
* par-ch5.adb (P_Continue_Statement, Parse_Loop_Flow_Statement): New
functions.
(P_Sequence_Of_Statements): Handle continue statements.
(P_Exit_Statement): Use Parse_Loop_Flow_Statement.
* sem.adb (Analyze): Handle new node kind.
* sem_ch5.adb (Analyze_Loop_Flow_Statement): New function.
(Analyze_Continue_Statement): New procedure.
(Analyze_Exit_Statement): Use new Analyze_Loop_Flow_Statement function.
* sem_ch5.ads (Analyze_Continue_Statement): New procedure.
* expander.adb (Expand): Handle new node kind.
* exp_ch5.ads (Expand_N_Continue_Statement): New procedure.
* exp_ch5.adb (Expand_Loop_Flow_Statement): New procedure.
(Expand_N_Continue_Statement): New procedure.
(Expand_N_Exit_Statement): Use new Expand_Loop_Flow_Statement
procedure.
(Build_Formal_Container_Iteration): Always reuse original loop entity.
* gnat_rm.texi: Regenerate.
|
|
Such output was unnecessary, and in some cases harmful.
In particular, we generate renamings in the expanded
code for protected types, with internally-generated names,
which could be confusing to the user. In addition, in the
JSON output (-gnatR2j), these generated renamings could have
duplicate source locatations, which confused SPARK.
gcc/ada/ChangeLog:
* repinfo.adb (List_Entities):
Disable output in case of object renamings.
|
|
gcc/ada/ChangeLog:
* libgnat/s-valuen.ads: Correct comment.
|
|
__gnat_install_handler calls strncmp when __HANDLE_VXSIM_SC is
defined, so string.h needs to be included, and gcc-14 enforces this
requirement.
gcc/ada/ChangeLog:
* init.c: Include string.h.
|
|
We support Ada 2012 fully. The chapter is out of date
and would serve no purpose if it was up to date.
gcc/ada/ChangeLog:
* doc/gnat_rm.rst: remove ref to 2012 chapter
* doc/gnat_rm/about_this_guide.rst: remove ref to 2012 chapter
* doc/gnat_rm/compatibility_and_porting_guide.rst: update list of
supported versions
* doc/gnat_rm/implementation_of_ada_2012_features.rst: delete
* doc/gnat_rm/specialized_needs_annexes.rst: update list of
supported versions
* gnat_rm.texi: Regenerate.
|
|
gcc/ada/ChangeLog:
* doc/gnat_rm/implementation_advice.rst: remove GLADE
* doc/gnat_rm/implementation_defined_characteristics.rst: remove GLADE
* doc/gnat_rm/specialized_needs_annexes.rst: remove GLADE
* doc/gnat_rm/the_gnat_library.rst: remove GLADE
* gnat_rm.texi: Regenerate.
|
|
Several adaint.c functions call alloca, but vxworks doesn't declare
it. Use the GCC builtin.
gcc/ada/ChangeLog:
* adaint.c [__vxworks] (alloca): Redirect to builtin.
|
|
These errors hinder analysis of non-GNAT code and are not useful to the
user as CodePeer does not care about alignment.
gcc/ada/ChangeLog:
* freeze.adb (Freeze_Record_Type): Check for CodePeer_Mode.
|
|
When rewriting N_Subprogram_Instantiation into wrapper packages we must move
the original aspect specifications to the wrapper packages, as otherwise they
will be only accessible via Original_Node. This is similar to how we move
aspect specifications for expression functions and many other constructs.
gcc/ada/ChangeLog:
* sem_ch12.adb (Analyze_Subprogram_Instantiation): Move aspects when
instantiating subprogram as a library unit.
|
|
The subexpressions this patch removes were clearly useless given the
test for "No (Scheme)" in a preceding condition.
gcc/ada/ChangeLog:
* exp_ch5.adb (Expand_N_Loop_Statement): Remove useless subexpressions.
|
|
gcc/ada/ChangeLog:
* doc/gnat_ugn/gnat_and_program_execution.rst: Add the
documentation about benefits of using sanitizers in
mixed-language applications.
* gnat_ugn.texi: Regenerate.
|
|
There are multiple scenarios where warnings can be turned into
errors. However internally they should always be handled the
same way and we should not rely on additional counters and variables
to handle the different behaviours.
These different types of converted warnings have however been
emitted differently historically. This information is stored in
the Warn_Err attribute which now stores the reason for the conversion
so that the printers know how to handle those scenarios.
Based on the reason these warnings are printed in different ways:
* If converted by pragma Warning_As_Error then it should print the
message with an error prefix and a [warning-as-error] tag.
* If it is a run time warning converted by -gnatwE then the message
should be printed with just an error prefix.
* if the warning was converted by -gnatwe then the message should be
printed with a warning prefix.
gcc/ada/ChangeLog:
* atree.ads (Compile_Time_Pragma_Warnings): Removed.
* errout.adb (Initialize): Remove initialization for
Compile_Time_Pragma_Warnings.
(Error_Msg_Internal): Use Warning_As_Error_Kind in the
Error_Msg_Object. Set its value based on the reason the
warning was changed to an error.
(Write_JSON_Span): Adjust the code for Warn_Err.
(Output_Messages): Update the calculation for actual warnings
and errors by just using Warnings_Treated_As_Errors.
(Set_Msg_Text): Simply mark that we are dealing with a
run time message here. Move the code for the Warning_Mode to
Error_Msg_Internal.
* erroutc-pretty_emitter.adb (Write_Error_Msg_Line): Adjust the code
for Warn_Err. Use the Warn_As_Err_Tag token.
* erroutc.adb (Compilation_Errors): Simplify the implementation so
that it only checks for errors and warnings treated as errors.
(Decrease_Error_Msg_Count): Remove the count for
Compile_Time_Pragma_Warnings.
(dmsg): Adjust the code for changes to Warn_Err.
(Increase_Error_Msg_Count): Likewise and remove the count for
Compile_Time_Pragma_Warnings.
(Output_Msg_Text): Warnings converted to error by the
Warning_As_Error pragma and -gnatwE now use the error prefix
in their messages but only warnings changed by the pragma get
the [warning-as-error] tag.
(Output_Text_Within): Adjust the variable name for
Is_Runtime_Raise_Msg.
(Write_Error_Summary): Adjust printing of warnings so that it
just uses the counts for Warnings_Detected and
Warnings_Treated_As_Errors.
* erroutc.ads (Is_Runtime_Raise): renamed to Is_Runtime_Raise_Msg.
(Warning_As_Error_Kind): New type for marking the warning message
is treated as an error which also captures the reason for the
change. Historically each of the reasons will have a different way
of displaying the warning message.
(Error_Msg_Object.Warn_Err): Change type to Warning_As_Error_Kind.
(Kind_To_String): Warnings treated as errors originating from
the pragma or -gnatwE will return error where as warnings
originating from -gnatwe will return warning.
(Compilation_Errors): Update the documentation.
(Warn_As_Err_Tag): Constant string to be used when printing warnings
as errors.
* errutil.adb (Error_Msg): Adjust the code for Warn_Err.
|
|
Dynamically allocated objects of a constrained subtype of an unconstrained
array type with a controlled component type have not been properly finalized
since the first rewrite of the finalization machinery more than a decade
ago. The reason is that the Finalize_Address routine is that of the base
type, which is unconstrained, and thus requires the bounds, which are not
present for the subtype in the allocation.
This is fixed by setting Is_Constr_Array_Subt_With_Bounds for allocators the
same way it is set for object declarations. The rest is just refactoring.
gcc/ada/ChangeLog:
* exp_ch7.adb (Shift_Address_For_Descriptor): New function.
(Make_Address_For_Finalize): Call above function.
(Make_Finalize_Address_Stmts): Likewise.
* exp_util.ads (Is_Constr_Array_Subt_Of_Unc_With_Controlled): New
predicate.
* exp_util.adb (Is_Constr_Array_Subt_Of_Unc_With_Controlled): Ditto.
(Remove_Side_Effects): Call above predicate.
* sem_ch3.adb (Analyze_Object_Declaration): Likewise.
* sem_ch4.adb (Analyze_Allocator): Allocate the bounds by setting
Is_Constr_Array_Subt_With_Bounds when appropriate.
|
|
The compiler rejects performing a dispatching call using the
prefix notation when the prefix of the call is a mutably
tagged class-wide type object.
gcc/ada/ChangeLog:
* sem_ch4.adb (Try_Object_Operation): Handle mutably tagged
class-wide type prefix.
|
|
gcc/ada/ChangeLog:
* errout.adb (Error_Msg_Internal): Use the new
Warning_Treated_As_Error function.
* erroutc.adb (Get_Warning_Option): Add new version of this
function that operates on the Error_Msg_Object directly instead
of the Error_Id. Update the existing function to call the new
version interanlly.
(Get_Warning_Tag): Likewise.
(Warning_Treated_As_Error): Add a new method that combines the
checks for the error message itself and its tag.
* erroutc.ads (Get_Warning_Option): Add new spec.
(Get_Warning_Option): Likewise.
(Get_Warning_Option): Likewise.
|
|
Use a live counter Compile_Time_Pragma_Warnings to keep track of
those messages instead of using a method to count them in the end.
gcc/ada/ChangeLog:
* atree.ads: Add Compile_Time_Pragma_Warnings for counting
compile time warnings.
* errout.adb (Initialize): Initialize Compile_Time_Pragma_Warnings.
(Output_Messages): Use Compile_Time_Pragma_Warnings instead of
Count_Compile_Time_Pragma_Warnings.
* erroutc.adb (Compilation_Errors): Likewise.
(Count_Compile_Time_Pragma_Warnings): Removed.
(Decrease_Error_Msg_Count): Update Compile_Time_Pragma_Warnings.
(Increase_Error_Msg_Count): Likewise.
(Write_Error_Summary): Use Compile_Time_Pragma_Warnings instead of
Count_Compile_Time_Pragma_Warnings.
* erroutc.ads (Count_Compile_Time_Pragma_Warnings): Removed.
|
|
gcc/ada/ChangeLog:
* errout.adb (Delete_Warning_And_Continuations): Use
Decrease_Error_Msg_Count to update the message counts.
(Delete_Warning): Likewise.
(To_Be_Removed): Likewise.
|
|
gcc/ada/ChangeLog:
* errout.adb (Remove_Warning_Messages): Mark removed messages as
deleted.
* erroutc.adb (Purge_Messages): Likewise.
|
|
gcc/ada/ChangeLog:
* frontend.adb (Frontend): do not override GNATprove's setting for
Warn_On_Non_Local_Exception
|
|
The assignment sets the Etype of a node to itsef.
gcc/ada/ChangeLog:
* sem_ch4.adb (Analyze_Allocator): Do not set Etype to itself.
|
|
The bug had been present for dynamically allocated objects since the first
rewrite of the finalization machinery more than a decade ago, and was then
propagated to statically declared objects by the recent rewrite.
gcc/ada/ChangeLog:
* exp_util.adb (Finalize_Address): Do not go to the root type for
array types.
|
|
They are used to minimize the error after every operation, but they can be
eliminated by increasing the precision of the input value, which avoids the
unwanted effects of multiple roundings.
gcc/ada/ChangeLog:
* libgnat/s-valuer.ads (System.Value_R): Remove Round parameter.
(Scan_Raw_Real): Replace Extra with Extra2 and adjust the comment.
(Value_Raw_Real): Likewise.
* libgnat/s-valuer.adb (Round_Extra): Delete.
(Scan_Decimal_Digits): Replace Extra with Extra2 and adjust the
implementation.
(Scan_Integral_Digits): Replace Extra with Extra2 and Extra_Rounded
with Extra2_Filled and adjust the implementation.
(Scan_Raw_Real): Replace Extra with Extra2 and adjust the
implementation.
(Value_Raw_Real): Likewise.
* libgnat/s-valrea.adb (Impl): Remove actual for Round formal.
* libgnat/s-valued.adb (Impl): Likewise.
(Integer_to_Decimal): Replace Extra with Extra2 and adjust the
implementation. Rename Unsigned_To_Signed to To_Signed.
(Scan_Decimal): Replace Extra with Extra2 and adjust the
implementation.
(Value_Decimal): Likewise.
* libgnat/s-valuef.adb (Impl): Remove actual for Round formal.
(Integer_to_Fixed): Replace Extra with Extra2 and adjust the
implementation. Rename Unsigned_To_Signed to To_Signed. Only
round the last scaled divide operation.
(Scan_Fixed): Replace Extra with Extra2 and adjust the
implementation.
(Value_Fixed): Likewise.
|
|
This patch rephrases some code in System.Value_R to make it easier to
read.
gcc/ada/ChangeLog:
* libgnat/s-valuer.adb (Scan_Decimal_Digits, Scan_Integral_Digits):
Minor rephrasing.
|
|
gcc/ada/ChangeLog:
* sem_ch5.adb (Analyze_Loop_Parameter_Specification): Set ekind
earlier.
|
|
The generic finalization machinery and the finalization machinery for
transient objects disagree on which controlled objects should be finalized
indirectly, i.e. through an access value: the former only considers return
objects of (selected) function calls, whereas the latter considers all
objects designated by a reference, which means that it must be careful
about not finalizing them twice.
The discrepancy does not seem to cause problems in practice, but is awkward
and creates additional work for the finalization machinery for transient
objects, as well as code duplication.
gcc/ada/ChangeLog:
* exp_util.ads (Is_Finalizable_Access): New predicate.
(Is_Non_BIP_Func_Call): Delete.
(Is_Secondary_Stack_BIP_Func_Call): Likewise.
* exp_util.adb (Is_Finalizable_Access): New predicate.
(Initialized_By_Aliased_BIP_Func_Call): Delete.
(Initialized_By_Reference): Likewise.
(Is_Aliased): Only consider the nontransient object serviced by
the transient scope.
(Is_Part_Of_BIP_Return_Statement): Minor tweak.
(Is_Finalizable_Transient): Remove calls to Initialized_By_Reference
and Initialized_By_Aliased_BIP_Func_Call.
Call Is_Finalizable_Access for access objects.
(Is_Non_BIP_Func_Call): Delete.
(Is_Secondary_Stack_BIP_Func_Call): Likewise.
(Requires_Cleanup_Actions): Call Is_Finalizable_Access for access
objects.
(Side_Effect_Free): Return True for N_Reference.
* exp_ch7.adb (Build_Finalizer.Process_Declarations): Call
Is_Finalizable_Access for access objects.
|
|
This regression has been introduced by the rewrite of the finalization
machinery, which now requires a specific handling of constrained array
types with controlled component and an unconstrained first subtype.
gcc/ada/ChangeLog:
* exp_util.adb (Is_Expression_Of_Func_Return): New predicate.
(Is_Related_To_Func_Return): Call Is_Expression_Of_Func_Return.
(Remove_Side_Effects): Generate a temporary for a function call
that returns a constrained array type with controlled component
and an unconstrained first subtype.
|
|
When using obsolete frontend inlining (switch -gnatN), we must always rewrite
the procedure call into a single block node. Otherwise, the copy-back of
parameters passed by-copy is inserted before the inlined procedure body, which
causes wrong code to be generated.
gcc/ada/ChangeLog:
* inline.adb (Rewrite_Procedure_Call): Replace with a simple rewriting
of procedure call into a single block node, i.e. remove broken
optimization.
* sem_util.adb (Next_Actual): Adapt GNATprove-specific code that peeks
into inlined calls.
|
|
Mapping of calls to primitive functions in Pre/Post'Class aspects
inherited by derived types was only testing against controlling formals
of the parent subprogram. This lead to missing some calls, because formals
could be rewritten to that of the derived subprogram before the test
happens.
gcc/ada/ChangeLog:
* exp_util.adb (Is_Controlling_Formal_Ref): test scope against
derived subprogram as well.
|
|
Subprogram Compilation_Errors is used to check whether any
errors have been detected during the compilation process. It
relies on Total_Errors_Detected and Warnings_Treated_As_Errors
counts. Total_Erros_Detected are updated immidiatelly after
the error objects have been created. Warnings_Treated_As_Errors
were updated only when the messages are being printed.
This leads to a situation where we do not have the correct count
of Warnings_Treated_As_Errors unless the errors have been printed.
gcc/ada/ChangeLog:
* errout.adb (Error_Msg_Internal): Relocate Warn_As_Err propagation
to Increase_Error_Msg_Counti.
(Delete_Warning_And_Continuations): Update
Warnings_Treated_As_Errors count.
(Delete_Warning): Likewise.
(To_Be_Removed): Likewise.
* erroutc.adb (Increase_Error_Msg_Count): Count warnings treated
as errors here and perform the propagation of this property to
the parent message.
(Output_Msg_Text): Remove counting of warnings as errors from
here.
(Decrease_Error_Msg_Count): Update Warnings_Treated_As_Errors
count.
|
|
Calling "debug (const tree_node *ptr)" does nothing. Change it to
call debug_tree so that we can do this in gdb:
(gdb) whatis type
type = const_tree
(gdb) call debug (type)
<real_type 0x7fffe982f2a0 float sizes-gimplified SF
size <integer_cst 0x7fffe98204e0 type <integer_type 0x7fffe98280a8 bitsizetype> constant 32>
unit-size <integer_cst 0x7fffe98204f8 type <integer_type 0x7fffe9828000 sizetype> constant 4>
align:32 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type 0x7fffe982f2a0 precision:32
pointer_to_this <pointer_type 0x7fffe982f930>>
(gdb)
PR debug/120902
* print-tree.cc (debug with const tree_node *): Call debug_tree
instead of debug.
Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
|
|
This patch partially handled PR118592.
This patch builds upon r16-710-g591d3d02664c7b and r16-711-g89935d56f768b4. It
introduces middle-end optimizations, such as constant folding, for our
trigonometric pi-based function built-ins.
gcc/ChangeLog:
* fold-const-call.cc (fold_const_call_ss): Constant fold for
single arg pi-based trigonometric builtins.
(fold_const_call_sss): Constant fold for double arg pi-based
trigonometric builtins.
* fold-const.cc (negate_mathfn_p): asinpi/atanpi is odd func.
(tree_call_nonnegative_warnv_p): acospi always non-neg,
asinpi/atanpi non-neg iff arg non-neg.
* tree-call-cdce.cc (can_test_argument_range): Add acospi/asinpi.
(edom_only_function): Add acospi/asinpi/cospi/sinpi.
(get_no_error_domain): Add acospi/asinpi.
gcc/testsuite/ChangeLog:
* lib/target-supports.exp (foldable_pi_based_trigonometry): New
effective target.
* gcc.dg/torture/builtin-math-9.c: New test.
Signed-off-by: Yuao Ma <c8ef@outlook.com>
|
|
dfp.exp tests for dfprt before deciding whether to default to run or
compile, and the PR120631 tests override that without checking for
dfprt. Rework them to avoid attempting to link and run programs
when dfp runtime support isn't available.
for gcc/testsuite/ChangeLog
PR middle-end/120631
* gcc.dg/dfp/pr120631.c: Drop overrider of dg-do default action.
* gcc.dg/dfp/bitint-9.c: Likewise.
* gcc.dg/dfp/bitint-10.c: Likewise.
|
|
|
|
Update linemap filename before location in both parsers. Rely on
parser to update linemap. Lexer maintains location. Various small
syntax corrections and extensions.
PR cobol/120772
PR cobol/120779
PR cobol/120790
PR cobol/120791
PR cobol/120794
gcc/cobol/ChangeLog:
* gcobc: Supply -fPIC for shared objects.
* genapi.cc (linemap_add): Delete empty macro.
(parser_enter_file): Do not call linemap_add.
(parser_leave_file): Same.
* gengen.cc (location_from_lineno): Remove function.
* lexio.cc (parse_replacing_term): Allow empty term.
(cdftext::process_file): Always append to output.
(cdftext::segment_line): Output #line directives.
* lexio.h (struct span_t): Count lines in span.
* parse.y: Revamp REPOSITORY, and minor syntax extensions.
* parse_ante.h (input_file_status_notify): Update linemap filename before location.
(intrinsic_token_of): Declare.
(parser_move_carefully): Support MOVE pointer.
* parse_util.h (intrinsic_token_of): New function.
* scan.l: New EOF logic, accept NOT=, own yylloc and yylineno.
* scan_ante.h (class enter_leave_t): Do not store newline count.
(cdf_location_set): Remove declaration.
(ydfltype_of): New function.
(update_location): Accept location parameter.
(reset_location): New function.
(YY_USER_ACTION): Use update_location().
(YY_USER_INIT): Update CDF location.
(verify_ws): New function.
(wait_for_the_child): Removed.
* symbols.h (cobol_fileline_set): return line number.
* util.cc (valid_move): Use range-based for loop.
(struct input_file_t): Remove line_map pointer.
(class unique_stack): New peek() member function.
(cobol_lineno_save): Rename to overload cobol_lineno().
(cobol_lineno): Replaces cobol_lineno_save().
(cobol_filename): Return void.
(location_from_lineno): New function used by genapi.cc.
(cdf_location_set): Remove.
(matched_length): No change.
(cobol_fileline_set): Return line number.
(fisspace): Remove extra semicolon.
(fisprint): Same.
* util.h (cobol_filename_restore): Return void.
(cobol_lineno_save): Remove declaration.
(cobol_lineno): Declare.
|
|
ext-dce's actions
I've gone back and forth of these problems multiple times. We have two passes,
ext-dce and combine which eliminate extensions using totally different
mechanisms.
ext-dce looks for cases where the state of upper bits in an object aren't
observable and if they aren't observable, then eliminates extensions which set
those bits.
combine looks for cases where we know the state of the upper bits and can prove
an extension is just setting those bits to their prior value. Combine also
looks for cases where the precise extension isn't really important, just the
knowledge that the upper bits are zero or sign extended from a narrower mode
is needed.
Combine relies heavily on the SUBREG_PROMOTED_VAR state to do its job. If the
actions of ext-dce (or any other pass for that matter) make
SUBREG_PROMOTED_VAR's state inconsistent with combine's expectations, then
combine can end up generating incorrect code.
--
When ext-dce eliminates an extension and turns it into a subreg copy (without
any known SUBREG_PROMOTED_VAR state). Since we can no longer guarantee the
destination object has any known extension state, we scurry around and wipe
SUBREG_PROMOTED_VAR state for the destination object.
That's fine and dandy, but ultimately insufficient. Consider if the
destination of the optimized extension was used as a source in a simple copy
insn. Furthermore assume that the destination of that copy is used within a
SUBREG expression with SUBREG_PROMOTED_VAR set. ext-dce's actions have
clobbered the SUBREG_PROMOTED_VAR state on the destination of that copy, albeit
indirectly.
This patch addresses this problem by taking the set of pseudos directly
impacted by ext-dce's actions and expands that set by building a transitive
closure for pseudos connected via copies. We then scurry around finding
SUBREG_PROMOTED_VAR state to wipe for everything in that expanded set of
pseudos. Voila, everything just works.
--
The other approach here would be to further expand the liveness sets inside
ext-dce. That's a simpler path forward, but ultimately regresses the quality
of codes we do care about.
One good piece of news is that with the transitive closure bits in place, we
can eliminate a bit of the live set expansion we had in place for
SUBREG_PROMOTED_VAR objects.
--
So let's take one case of the 5 that have been reported.
In ext-dce we have this insn:
> (insn 29 27 30 3 (set (reg:DI 134 [ al_lsm.9 ])
> (zero_extend:DI (subreg:HI (reg:DI 162) 0))) "j.c":17:17 552 {*zero_extendhidi2_bitmanip}
> (expr_list:REG_DEAD (reg:DI 162)
> (nil)))
There are reachable uses of (reg 134):
> (insn 49 47 52 6 (set (mem/c:HI (lo_sum:DI (reg/f:DI 186)
> (symbol_ref:DI ("al") [flags 0x86] <var_decl 0x7ffff73c2da8 al>)) [2 al+0 S2 A16])
> (subreg/s/v:HI (reg:DI 134 [ al_lsm.9 ]) 0)) 279 {*movhi_internal}
> (expr_list:REG_DEAD (reg/f:DI 186)
> (nil)))Obviously safe if we were to remove the extension.
> (insn 52 49 53 6 (set (reg:DI 176)
> (and:DI (reg:DI 134 [ al_lsm.9 ])
> (const_int 5 [0x5]))) "j.c":21:12 106 {*anddi3}
> (expr_list:REG_DEAD (reg:DI 134 [ al_lsm.9 ])
> (nil)))
> (insn 53 52 56 6 (set (reg:SI 177 [ _8 ])
> (zero_extend:SI (subreg:HI (reg:DI 176) 0))) "j.c":21:12 551 {*zero_extendhisi2_bitmanip}
> (expr_list:REG_DEAD (reg:DI 176)
> (nil))) Safe to remove the extension as we only read the low 16 bits from the destination register (reg 176) in insn 53.
> (insn 27 26 29 3 (set (reg:DI 162)
> (sign_extend:DI (plus:SI (subreg/s/v:SI (reg:DI 134 [ al_lsm.9 ]) 0)
> (const_int 1 [0x1])))) "j.c":17:17 8 {addsi3_extended}
> (expr_list:REG_DEAD (reg:DI 134 [ al_lsm.9 ])
> (nil)))
> (insn 29 27 30 3 (set (reg:DI 134 [ al_lsm.9 ])
> (zero_extend:DI (subreg:HI (reg:DI 162) 0))) "j.c":17:17 552 {*zero_extendhidi2_bitmanip}
> (expr_list:REG_DEAD (reg:DI 162)
> (nil)))
Again, not as obvious as the first case, but we only read the low 16 bits from
(reg 162) in insn 29. So those upper bits in (reg 134) don't matter.
> (insn 26 92 27 3 (set (reg:DI 144 [ ivtmp.17 ])
> (reg:DI 134 [ al_lsm.9 ])) 277 {*movdi_64bit}
> (nil))
> (insn 30 29 31 3 (set (reg:DI 135 [ al.2_3 ])
> (sign_extend:DI (subreg/s/v:HI (reg:DI 144 [ ivtmp.17 ]) 0))) "j.c":17:9 558 {*extendhidi2_bitmanip}
> (expr_list:REG_DEAD (reg:DI 144 [ ivtmp.17 ])
> (nil)))Also safe in isolation. But worth noting that if we remove the extension at insn 29, then the promoted status on (reg:DI 144) in insn 30 is no longer valid.
Setting aside the promoted state of (reg:DI 144) at insn 30 for a minute, let's
look into combine.
> (insn 26 92 27 3 (set (reg:DI 144 [ ivtmp.17 ])
> (reg:DI 134 [ al_lsm.9 ])) 277 {*movdi_64bit}
> (nil)) [ ... ]
> (insn 30 29 31 3 (set (reg:DI 135 [ al.2_3 ])
> (sign_extend:DI (subreg/s/v:HI (reg:DI 144 [ ivtmp.17 ]) 0))) "j.c":17:9 558 {*extendhidi2_bitmanip}
> (expr_list:REG_DEAD (reg:DI 144 [ ivtmp.17 ])
> (nil)))
> (jump_insn 31 30 32 3 (set (pc)
> (if_then_else (eq (reg:DI 135 [ al.2_3 ])
> (const_int 0 [0]))
> (label_ref:DI 41)
> (pc))) "j.c":4:55 371 {*branchdi}
> (int_list:REG_BR_PROB 536870913 (nil))
> -> 41)
Combine will do its thing on insns 30/31. Essentially the sign extension is
not necessary in this context, assuming the promoted subreg status in insn 30
-- the equality test doesn't really care about the kind of extension, just
knowing the value is extended is enough to safely elide the extension.
And now we've come to the crux the problem. That promotion state needs to be
adjusted. The new ext-dce code will see that copy at insn 26 and add (reg 144)
to the set of registers that need promotion state wiped. And everything is
happy after that.
The other cases are similar in nature.
--
This has been bootstrapped and regression tested on x86_64 and aarch64.
Variants have bootstrapped & regression tested on several other platforms and
it's survived testing on the crosses as well.
Pushing to the trunk...
PR rtl-optimization/120242
PR rtl-optimization/120627
PR rtl-optimization/120736
PR rtl-optimization/120813
gcc/
* ext-dce.cc (ext_dce_process_uses): Remove some cases where we
unnecessarily expanded live sets for promoted subregs.
(expand_changed_pseudos): New function.
(reset_subreg_promoted_p): Use it.
gcc/testsuite/
* gcc.dg/torture/pr120242.c: New test.
* gcc.dg/torture/pr120627.c: Likewise.
* gcc.dg/torture/pr120736.c: Likewise.
* gcc.dg/torture/pr120813.c: Likewise.
|
|
Fixes incorrect SP-addresses used in CFA notes for the stack probes
unrelative to the frame's top. It applied to the RISC-V targets code
generation when the stack-clash protection is enabled.
PR target/120714
gcc/ChangeLog:
* config/riscv/riscv.cc (riscv_allocate_and_probe_stack_space):
Fix SP-addresses in REG_CFA_DEF_CFA notes for stack-clash case.
gcc/testsuite/ChangeLog:
* gcc.target/riscv/pr120714.c: New test.
|
|
Modernization; no functional change intended.
gcc/analyzer/ChangeLog:
* access-diagram.cc: Use nullptr rather than NULL where
appropriate.
* analyzer-language.cc: Likewise.
* analyzer-language.h: Likewise.
* analyzer-logging.h: Likewise.
* analyzer-pass.cc: Likewise.
* analyzer.cc: Likewise.
* bounds-checking.cc: Likewise.
* call-details.cc: Likewise.
* call-string.cc: Likewise.
* call-string.h: Likewise.
* call-summary.cc: Likewise.
* checker-event.cc: Likewise.
* common.h: Likewise.
* constraint-manager.cc: Likewise.
* constraint-manager.h: Likewise.
* diagnostic-manager.cc: Likewise.
* engine.cc: Likewise.
* exploded-graph.h: Likewise.
* function-set.cc: Likewise
* infinite-recursion.cc: Likewise
* inlining-iterator.h: Likewise
* kf.cc: Likewise
* known-function-manager.cc: Likewise
* pending-diagnostic.cc: Likewise
* program-point.cc: Likewise
* program-point.h: Likewise
* program-state.cc: Likewise
* program-state.h: Likewise
* record-layout.cc: Likewise
* region-model-asm.cc: Likewise
* region-model-manager.cc: Likewise
* region-model-manager.h: Likewise
* region-model-reachability.cc: Likewise
* region-model.cc: Likewise
* region-model.h: Likewise
* region.cc: Likewise
* region.h: Likewise
* sm-fd.cc: Likewise
* sm-malloc.cc: Likewise
* sm-pattern-test.cc: Likewise
* sm-signal.cc: Likewise
* sm-taint.cc: Likewise
* sm.cc: Likewise
* sm.h: Likewise
* state-purge.cc: Likewise
* state-purge.h: Likewise
* store.cc: Likewise
* store.h: Likewise
* supergraph.cc: Likewise
* supergraph.h: Likewise
* svalue.cc: Likewise
* svalue.h: Likewise
* varargs.cc: Likewise
Signed-off-by: David Malcolm <dmalcolm@redhat.com>
|
|
Modernization; no functional change intended.
gcc/ChangeLog:
* diagnostic-color.cc: Use nullptr rather than NULL.
* diagnostic-format-sarif.cc: Likewise.
* diagnostic-format-text.cc: Likewise.
* diagnostic-macro-unwinding.cc: Likewise.
* diagnostic-path-output.cc: Likewise.
* diagnostic-path.cc: Likewise.
* diagnostic-show-locus.cc: Likewise.
* diagnostic-spec.cc: Likewise.
* diagnostic.cc: Likewise.
* lazy-diagnostic-path.cc: Likewise.
* simple-diagnostic-path.cc: Likewise.
* tree-diagnostic-client-data-hooks.cc: Likewise.
Signed-off-by: David Malcolm <dmalcolm@redhat.com>
|
|
Modernization; no functional change intended.
gcc/analyzer/ChangeLog:
* checker-event.cc (function_entry_event::get_meaning): Convert
diagnostic_event::meaning enums to enum class.
(cfg_edge_event::get_meaning): Likewise.
(call_event::get_meaning): Likewise.
(return_event::get_meaning): Likewise.
(start_consolidated_cfg_edges_event::get_meaning): Likewise.
(inlined_call_event::get_meaning): Likewise.
(warning_event::get_meaning): Likewise.
* sm-fd.cc (fd_diagnostic::get_meaning_for_state_change):
Likewise.
* sm-file.cc (file_diagnostic::get_meaning_for_state_change):
Likewise.
* sm-malloc.cc (malloc_diagnostic::get_meaning_for_state_change):
Likewise.
* sm-sensitive.cc
(exposure_through_output_file::get_meaning_for_state_change):
Likewise.
* sm-taint.cc (taint_diagnostic::get_meaning_for_state_change):
Likewise.
* varargs.cc
(va_list_sm_diagnostic::get_meaning_for_state_change): Likewise.
gcc/ChangeLog:
* diagnostic-format-sarif.cc
(sarif_builder::maybe_make_kinds_array): Convert
diagnostic_event::meaning enums to enum class.
* diagnostic-path-output.cc (path_label::get_text): Likewise.
* diagnostic-path.cc
(diagnostic_event::meaning::maybe_get_verb_str): Likewise.
(diagnostic_event::meaning::maybe_get_noun_str): Likewise.
(diagnostic_event::meaning::maybe_get_property_str): Likewise.
* diagnostic-path.h (diagnostic_event::verb): Likewise.
(diagnostic_event::noun): Likewise.
(diagnostic_event::property): Likewise.
(diagnostic_event::meaning): Likewise.
gcc/testsuite/ChangeLog:
* gcc.dg/plugin/analyzer_gil_plugin.cc
(gil_diagnostic::get_meaning_for_state_change): Convert
diagnostic_event::meaning enums to enum class.
Signed-off-by: David Malcolm <dmalcolm@redhat.com>
|
|
The "json" output format for diagnostics was deprecated in GCC 15, with
advice to users seeking machine-readable diagnostics from GCC to use
SARIF instead.
This patch eliminates it from GCC 16, simplifying the diagnostics
subsystem somewhat.
Note that the Ada frontend seems to have its own implementation of this
in errout.adb (Output_JSON_Message), and documented in
gnat_ugn.texi. This patch does not touch Ada.
gcc/ChangeLog:
* Makefile.in (OBJS-libcommon): Drop diagnostic-format-json.o.
* common.opt (fdiagnostics-format=): Drop
"json|json-stderr|json-file".
(diagnostics_output_format): Drop values "json", "json-stderr",
and "json-file".
* diagnostic-format-json.cc: Delete file.
* diagnostic-format.h
(diagnostic_output_format_init_json_stderr): Delete.
(diagnostic_output_format_init_json_file): Delete.
* diagnostic.cc (diagnostic_output_format_init): Delete cases for
DIAGNOSTICS_OUTPUT_FORMAT_JSON_STDERR and
DIAGNOSTICS_OUTPUT_FORMAT_JSON_FILE.
* diagnostic.h (DIAGNOSTICS_OUTPUT_FORMAT_JSON_STDERR): Delete.
(DIAGNOSTICS_OUTPUT_FORMAT_JSON_FILE): Delete.
* doc/invoke.texi: Remove references to json output format.
* doc/ux.texi: Likewise.
* selftest-run-tests.cc (selftest::run_tests): Drop call to
deleted selftest::diagnostic_format_json_cc_tests.
* selftest.h (selftest::diagnostic_format_json_cc_tests): Delete.
gcc/testsuite/ChangeLog:
* c-c++-common/analyzer/out-of-bounds-diagram-1-json.c: Deleted test.
* c-c++-common/diagnostic-format-json-1.c: Deleted test.
* c-c++-common/diagnostic-format-json-2.c: Deleted test.
* c-c++-common/diagnostic-format-json-3.c: Deleted test.
* c-c++-common/diagnostic-format-json-4.c: Deleted test.
* c-c++-common/diagnostic-format-json-5.c: Deleted test.
* c-c++-common/diagnostic-format-json-file-1.c: Deleted test.
* c-c++-common/diagnostic-format-json-stderr-1.c: Deleted test.
* c-c++-common/pr106133.c: Deleted test.
* g++.dg/pr90462.C: Deleted test.
* gcc.dg/plugin/diagnostic-test-paths-3.c: Deleted test.
* gcc.dg/plugin/plugin.exp (plugin_test_list): Remove deleted
test.
* gfortran.dg/diagnostic-format-json-1.F90: Deleted test.
* gfortran.dg/diagnostic-format-json-2.F90: Deleted test.
* gfortran.dg/diagnostic-format-json-3.F90: Deleted test.
* gfortran.dg/diagnostic-format-json-pr105916.F90: Deleted test.
Signed-off-by: David Malcolm <dmalcolm@redhat.com>
|
|
When -fauto-profile-inlining was added it was documented, but
common.opt.urls wasn't regenerated.
Fixes: aaf55e09b3d9 ("Add -fauto-profile-inlining")
gcc/ChangeLog:
* common.opt.urls: Regenerate.
|
|
The variable is set only at the top level.
gcc/ada/
PR ada/120106
* Make-generated.in (GNATMAKE_FOR_BUILD): Define.
|