It's pretty clear that the operand numbers in the MEM_P() checks are
off by one, perhaps due to a copy-and-paste oversight (unlike in most
other places here we're dealing with two outputs).
gcc/
* config/i386/i386.md (bmi2_umul<mode><dwi>3_1): Correct MEM_P()
arguments.
Without this patch, gnat would use `-gnatw?` as the default option for
some of the default warnings.
gcc/ada/
* erroutc.adb (Get_Warning_Option): Don't consider `?` as a
valid option switch.
This enables better integration with tools that handle GNAT's output.
gcc/ada/
* erroutc.ads (Get_Warning_Option): New function returning the
option responsible for a warning if it exists.
* erroutc.adb (Get_Warning_Option): Likewise.
(Get_Warning_Tag): Rely on Get_Warning_Option when possible.
* errout.adb (Output_JSON_Message): Emit option field.
When implementing structural subprogram variants we ignored them in
expansion of the pragma itself, but not in expansion of a recursive
subprogram call. Now fixed.
gcc/ada/
* exp_ch6.adb (Check_Subprogram_Variant): Ignore structural
variants.
Code cleanup; semantics is unaffected.
gcc/ada/
* osint.adb (Locate_File): Change variable to constant and
initialize it by concatenation of directory, file name and NUL.
The GNAT behaviour regarding the Ada RM requirement to support Address
clauses for imported subprograms was documented twice: in section about
packed types (which was a mistake) and in section about address clauses
(where it belongs).
Cleanup related to the use of packed arrays for bitset operations to
detect uses of uninitialized scalars in GNAT.
gcc/ada/
* doc/gnat_rm/implementation_advice.rst (Packed Types): Remove
duplicated and wrongly placed paragraph.
* gnat_rm.texi: Regenerate.
This enables tools that ingest GNAT's output to properly classify these
messages.
gcc/ada/
* inline.adb (Check_Package_Body_For_Inlining): Add insertion
character.
This caused these warnings not to be tagged with the switch causing
them, which is an issue for tools ingesting GNAT's output.
gcc/ada/
* sem_elab.adb (Process_Conditional_ABE_Access_Taken): Add '.f'
insertion characters.
While cleaning up and modifying code for unreferenced warnings we
removed all calls to Defer_Reference, which was the only routine that
populated the Deferred_References table. Consequently, all the code
related to this table became dead.
gcc/ada/
* lib-xref.ads (Deferred_Reference_Entry, Defer_Reference,
Process_Deferred_References, Has_Deferred_Reference): Remove
client API.
* lib-xref.adb (Deferred_References, Defer_Reference,
Has_Deferred_Reference, Process_Deferred_References): Remove
implementation.
* frontend.adb, sem_ch11.adb, sem_ch5.adb, sem_res.adb,
sem_util.adb, sem_warn.adb: Remove uses of Deferred_References.
This patch fixes a bug whereby if a function body has local objects that
are finalizable, and has a return statement that requires generation of
transient finalizable temps, and there are dynamic-sized objects
requiring pushing/popping the (primary) stack at run time, and the
function body has exception handlers, then incorrect code is
generated. In particular, the transient objects are finalized after they
have been deallocated. This can cause seg faults, corrupted heap, and
the like.
Note that if there are no dynamic-sized objects, then the bug does
not occur, because the back end allocates objects of compile-time-known
size based on where they are referenced, rather than which local
block they are declared in.
This patch relies on the fact that an At_End handler and regular
exception handlers CAN coexist in the same handled statement sequence,
which was not true some years ago.
gcc/ada/
* exp_ch7.adb (Wrap_HSS_In_Block): Do not create a new block in
the case of function bodies. We include all subprogram bodies,
because it's harmless for procedures. We cannot easily avoid
creating this block in ALL cases, because some transformations
of (e.g.) task bodies end up moving some code such that the
wrong exception handlers apply to that code.
(Build_Finalizer_Call): Remove code for creating a new block.
This was unreachable code, given that Wrap_HSS_In_Block has
already done that, but with the above change to
Wrap_HSS_In_Block, this code becomes reachable, and triggers
essentially the same bug.
* exp_ch7.ads: Adjust comment.
This patch corrects an error in the compiler whereby spurious
unreferenced warnings are generated on formal parameters of null generic
subprograms.
These changes also fix the parsing of aspects on formal parameters such
that the aspects now get properly set for all formal parameters in a
parameter list.
gcc/ada/
* par-ch6.adb (P_Formal_Part): Set Aspect_Specifications on all
formals instead of just the last in a formal id list.
* sem_ch6.adb (Analyze_Null_Procedure): Mark expanded null
generic procedures as trivial in order to avoid spurious
unreferenced warnings.
Both the `System.Mmap` and `System.Object_Reader` packages are defining
entities named `Offset` and they are both `use`d at the top of
s-dwalin.adb.
Therefore, the references to `Offset` throughout this file are
ambiguous, and GNAT is supposed to complain. Since it does not for the
moment, we fix the ambiguity by declaring a subtype `Offset` at the top
of the file simply renames `System.Object_Reader.Offset`.
gcc/ada/
* libgnat/s-dwalin.adb: Add a subtype declaration to fix the
ambiguity.
The expression given in a Static_Predicate aspect specification is
required to be predicate-static. The implementation of this compile-time
check was incorrect in some cases. There were problems in both
directions: expressions that are not predicate-static were incorrectly
treated as though they were and vice versa. This led to both accepting
invalid code and to rejecting valid code.
gcc/ada/
* sem_ch13.adb (Is_Predicate_Static): Do not generate warnings
about subexpressions of enclosing expressions. Generate warnings
for predicates that are known to be always true or always false,
except in the case where the predicate is expressed as a Boolean
literal. Deal with non-predicate-static expressions that have
been transformed into predicate-static expressions. Add missing
Is_Type_Ref call to N_Membership_Test case.
The presence of the discriminants prevents the values associated with the
components of the parent type from being put into the sub-aggregate built
for the _Parent component.
gcc/ada/
* exp_aggr.adb (Expand_Record_Aggregate.Build_Back_End_Aggregate):
Skip the discriminants at the start of the component list before
looking for the components inherited from the parent in the case
of a tagged extension.
The left-overs of the old freezing code in Make_DT are now redundant since
the semantic analyzer performs the same task for the 'Access attribute.
gcc/ada/
* exp_disp.adb (Make_DT): Remove remaining freezing code.
There is no need to analyze expression functions that are primitives of a
tagged type for its dispatch table because they will be analyzed at the end
of the current scope.
gcc/ada/
* sem_attr.adb (Resolve_Attribute) <Attribute_Access>: Don't analyze
the body of an expression function in the case of a dispatch table.
Changes in GNATprove (translation to Why3 and provers) result in proofs
being much less automatic, and requiring ghost code to detail
intermediate steps. In some cases, it is better to use the new By
mechanism to prove assertions in steps, as this avoids polluting the
proof context for other proofs. For that reason, add units s-spark.ads
and s-spcuop.ads/b to the runtime sources.
gcc/ada/
* Makefile.rtl: Add new units.
* libgnat/s-aridou.adb (Scaled_Divide): Add ghost code for provers.
* libgnat/s-spcuop.adb: New unit for ghost cut operations.
* libgnat/s-spcuop.ads: New unit for ghost cut operations.
* libgnat/s-spark.ads: New unit.
Mention when security hardening features are available in other
languages.
Expand the strub documentation a little, for clarity and completeness.
Add missing 'aliased' and attribute to variables in strub example.
gcc/ada/
* doc/gnat_rm/security_hardening_features.rst: Mention
availability in other languages when applicable.
(Stack Scrubbing): Associate the attribute with types, expand
some comments, fix the example involving access to variables.
* gnat_rm.texi: Regenerate.
The previous change introduced a backward incompatibility in the handling
of a user-defined "=" operator for a class-wide type of a tagged type: it
would previously hide the predefined "=" operator of the tagged type in
the private case, but it no longer does in this case, while it still does
in the nonprivate case.
This hiding is a non-portability, but is fundamentally what the compiler
implements, instead of the RM rule which requires homographs. The reason
lies in the implementation of the "=" operator in GNAT: internally, there
is not a "=" predefined operator for every nonlimited type, but instead
there is a single, universal "=" predefined operator for all the nonlimited
types. The consequence is that the hiding rule implemented in GNAT for "="
is effectively that a user-declared symmetrical "=" operator returning
boolean hides the predefined "=" operator of any type that is covered by
the user-declared operator.
Whether it is desirable to implement the exact RM rule in GNAT is to be
discussed, but existing code relies on the non-portability and would thus
need to be changed.
gcc/ada/
* sem_ch6.adb (New_Overloaded_Entity): Deal specifically with the
overriding of the "=" operator for tagged types.
When static dispatch tables are built for library-level tagged types, the
primitives (the subprogram themselves) are frozen; that's necessary because
their address is taken. However, their profile, i.e. all the types present
therein, is also frozen, which is not necessary after AI05-019 and is also
inconsistent with the handling of attribute references.
The change also removes a couple of pragma Inline on subprograms that are
too large for inlining to bring any benefit.
gcc/ada/
* exp_ch3.adb (Expand_N_Object_Declaration): Adjust call to Make_DT.
* exp_disp.ads (Building_Static_DT): Remove pragma Inline.
(Building_Static_Secondary_DT): Likewise.
(Convert_Tag_To_Interface): Likewise.
(Make_DT): Remove second parameter.
* exp_disp.adb (Make_DT): Likewise.
(Check_Premature_Freezing): Delete.
Pass Do_Freeze_Profile as False in call to Freeze_Entity.
* freeze.ads (Freezing_Library_Level_Tagged_Type): Delete.
* freeze.adb (Freeze_Profile): Remove obsolete code.
(Freeze_Entity): Tweak comment.
After changes in GNATprove, adapt proof. Simply move an assertion up
before it is first needed here.
gcc/ada/
* libgnat/s-arit32.adb (Scaled_Divide32): Move assertion up.
The internal unit System.Generic_Array_Operations defines only generic
subprograms. Thus, pragma Assertion_Policy inside the spec has no
effect, as each instantiation is only subject to the assertion policy at
the program point of the instantiation. Remove this confusing pragma,
and add the pragma inside each generic body making use of additional
assertions or ghost code, so that running time of instantiations is not
impacted by assertions meant for formal verification.
gcc/ada/
PR ada/105303
* libgnat/s-gearop.adb: Add pragma Assertion_Policy in generic
bodies making use of additional assertions or ghost code.
* libgnat/s-gearop.ads: Remove confusing Assertion_Policy.
As a result of other recent changes, the Convert_To_Return_False flag
is never set. The flag can be therefore be deleted.
gcc/ada/
* exp_ch11.adb (Expand_N_Raise_Expression): Remove
Convert_To_Return_False test.
* gen_il-fields.ads: Remove Convert_To_Return_False field.
* gen_il-gen-gen_nodes.adb: Remove use of
Convert_To_Return_False field.
* sinfo.ads: Remove comment describing Convert_To_Return_False
flag.
This patch adds empty constructors to the functional containers so that
we can use them in expression functions.
gcc/ada/
* libgnat/a-cofuma.ads, libgnat/a-cofuma.adb,
libgnat/a-cofuse.ads, libgnat/a-cofuse.adb,
libgnat/a-cofuve.ads, libgnat/a-cofuve.adb: Add empty
constructors.
Removal of the previous kernel registration scheme unearthed mistakes in
the new one, which were:
- The new kernel registration code relied on the binder expansion phase,
which didn't happen because the registration code was already
generated by the binder.
- The kernel handle passed to CUDA_Register_Function was the first eight
bytes of the code of the host-side procedure representing the kernel
rather than its address.
gcc/ada/
* bindgen.adb (Gen_CUDA_Init): Remove code generating CUDA
definitions.
(Gen_CUDA_Defs): New function, generating definitions
initialized by Gen_CUDA_Init.
(Gen_Output_File_Ada): Call Gen_CUDA_Defs instead of
Gen_CUDA_Init.
(Gen_Adainit): Call Gen_CUDA_Init.
The first part of the following testcase (m1-m3 macros and its use)
regressed with my PR89971 fix, but as the m1,m4-m5 and its use part shows,
the problem isn't new, we can emit a CPP_PADDING token to avoid it from
being adjacent to whatever comes after the __VA_OPT__ (in this case there
is nothing afterwards, true).
In most cases these CPP_PADDING tokens don't matter, all other
callers of cpp_get_token_with_location either ignore CPP_PADDING tokens
completely (e.g. c_lex_with_flags) or they just remember them and
take them into account when printing stuff whether there should be
added whitespace or not (scan_translation_unit + token_streamer::stream).
So, I think we should just ignore CPP_PADDING tokens the same way in
_cpp_parse_expr.
2022-05-27 Jakub Jelinek <jakub@redhat.com>
PR preprocessor/105732
* expr.cc (_cpp_parse_expr): Handle CPP_PADDING by just another
token.
* c-c++-common/cpp/va-opt-10.c: New test.
An empty g++ command line should produce a diagnostic that there are no
inputs. The PR is that currently Darwin produces a dignostic about missing
link items instead - this is because (errnoeously), for this driver, we are
creating a link job for empty command lines.
The problem occurs in four stages:
The g++ driver appends -shared-libgcc to the command line.
The Darwin driver_init code in the backend does not see this (it sees an
empty command line).
When the back end driver code driver sees an empty command line, it does not
add any supplementary flags (e.g. asm-macosx-version-min) - precisely to
avoid anything being claimed as an input_file and therefore triggering a link
line.
Since we do not have a value for asm-macosx-version-min when processing the
driver specs, we unconditionally inject 'multiply_defined suppress' which is
used with shared libgcc (but only intended on very old Darwin). This then
causes the generation of a link job.
The solution, for the present, is to move version-specific link params to the
LINK_SPEC so that they are only processed when a link job has already been
decided.
Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
PR target/105599
gcc/ChangeLog:
* config/darwin.h: Move versions-specific handling of multiply_defined
from SUBTARGET_DRIVER_SELF_SPECS to LINK_SPEC.
This comment had got out of sync with reality, partly due to merging
of patches. Updated to reflect the current implementation.
Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
gcc/ChangeLog:
* config/darwin.h (REAL_LIBGCC_SPEC): Update the comment block
describing this macro.
Several gnatlib* targets perform, with a subshell and sed, the same
GCC_FOR_TARGET pathname transformation that OSCONS_CC performs with
make subst macros. Rename OSCONS_CC to a more general name, and use
it for gnatlib as well.
for gcc/ada/ChangeLog
* gcc-interface/Makefile.in (OSCONS_CC): Rename to...
(GCC_FOR_ADA_RTS): ... this. Adjust users.
(gnatlib): Pass it down as CC.
(gnatlib-shared-default): Likewise.
(gnatlib-shared-win32, gnatlib-shared-darwin): Likewise.
since apparently _aligned_malloc requires freeing with _aligned_free and:
/* Defined if gomp_aligned_alloc doesn't use fallback version
and free can be used instead of gomp_aligned_free. */
#define GOMP_HAVE_EFFICIENT_ALIGNED_ALLOC 1
so the second condition isn't satisfied. For uses inside of the OpenMP
allocators we can still use _aligned_malloc but we need to call _aligned_free
in gomp_aligned_free.
2022-05-28 Jakub Jelinek <jakub@redhat.com>
PR libgomp/105745
* libgomp.h (GOMP_HAVE_EFFICIENT_ALIGNED_ALLOC): Don't define for
defined(HAVE__ALIGNED_MALLOC) case.
* alloc.c (gomp_aligned_alloc): Move defined(HAVE__ALIGNED_MALLOC)
handling as last option before fallback instead of first.
(gomp_aligned_free): For defined(HAVE__ALIGNED_MALLOC) call
_aligned_free.
On Fri, May 27, 2022 at 04:52:17PM +0200, Tobias Burnus wrote:
> The 'TO'/'ENTER' usage is first stored in a linked list – and
> then as attribute to the symbol. I am not sure how to handle it best.
This reminds me I've left the C/C++ FE diagnostics about mixing link and
to/enter on the same variable in separate directives as is, so it always
talked about mixing link and to clauses.
This patch adjusts it, so that if link is first, it talks about the
clause actually used and if link is later, uses to or enter together
in the wording.
2022-05-28 Jakub Jelinek <jakub@redhat.com>
gcc/c/
* c-parser.cc (c_parser_omp_declare_target): If OMP_CLAUSE_LINK was
seen first, use "%<to%>" or "%<enter%>" depending on
OMP_CLAUSE_ENTER_TO of the current clause, otherwise use
"%<to%> or %<enter%>" wording.
gcc/cp/
* parser.cc (handle_omp_declare_target_clause): If OMP_CLAUSE_LINK was
seen first, use "%<to%>" or "%<enter%>" depending on
OMP_CLAUSE_ENTER_TO of the current clause, otherwise use
"%<to%> or %<enter%>" wording.
gcc/testsuite/
* c-c++-common/gomp/declare-target-2.c: Add further tests for mixing of
link and to/enter clauses on separate directives.
We currently check satisfaction in the context of the constrained
declaration (which may be wrong, see PR104111). When checking C<int>
for S<int>, we currently substitute into the lambda in the context of
S<T> (rather than S<int>, which seems wrong if the above isn't wrong), so
the new closure type thinks its context is S<T>, which confuses debug
output. For the moment, let's work around all of this by overriding the
context of the closure.
PR c++/105652
gcc/cp/ChangeLog:
* pt.cc (tsubst_lambda_expr): Don't let a namespace-scope lambda
instantiate into a class-scope lambda.
gcc/testsuite/ChangeLog:
* g++.dg/cpp2a/concepts-lambda20.C: New test.