platform/upstream/gcc.git
5 years ago[Ada] Fix scopes for local variables in task/protected bodies
Ed Schonberg [Tue, 9 Jul 2019 07:53:35 +0000 (07:53 +0000)]
[Ada] Fix scopes for local variables in task/protected bodies

No impact on compilation with GCC.

2019-07-09  Ed Schonberg  <schonberg@adacore.com>

gcc/ada/

* sem_util.adb (Scope_Within_Or_Same): Handle properly task
bodies and protected bodies, so that local variables within have
their proper scopes after these constructs have been rewritten
during expansion. This patch resembles but is not identical to
the code in Scope_Within.

From-SVN: r273269

5 years ago[Ada] Set Dynamic_Elaboration_Checks to True in CodePeer mode
Arnaud Charlet [Tue, 9 Jul 2019 07:53:30 +0000 (07:53 +0000)]
[Ada] Set Dynamic_Elaboration_Checks to True in CodePeer mode

2019-07-09  Arnaud Charlet  <charlet@adacore.com>

gcc/ada/

* gnat1drv.adb (Adjust_Global_Switches): Set
Dynamic_Elaboration_Checks to True in CodePeer mode.

From-SVN: r273268

5 years ago[Ada] Issue error on illegal ownership in SPARK
Yannick Moy [Tue, 9 Jul 2019 07:53:26 +0000 (07:53 +0000)]
[Ada] Issue error on illegal ownership in SPARK

Check for declaration of global variables prior to use in the ownership
checking for SPARK.

There is no impact on compilation.

2019-07-09  Yannick Moy  <moy@adacore.com>

gcc/ada/

* sem_spark.adb (Get_Perm_Or_Tree): Issue an error when
encountering unknown global variable.

From-SVN: r273267

5 years ago[Ada] Fix ownership checking for pointers in SPARK
Yannick Moy [Tue, 9 Jul 2019 07:53:21 +0000 (07:53 +0000)]
[Ada] Fix ownership checking for pointers in SPARK

Checking of the readable status of sub-expressions occurring in the
target path of an assignment should occur before the right-hand-side is
moved or borrowed or observed.

There is no impact on compilation.

2019-07-09  Yannick Moy  <moy@adacore.com>

gcc/ada/

* sem_spark.adb (Check_Expression): Change signature to take an
Extended_Checking_Mode, for handling read permission checking of
sub-expressions in an assignment.
(Check_Parameter_Or_Global): Adapt to new behavior of
Check_Expression for mode Assign.
(Check_Safe_Pointers): Do not analyze generic bodies.
(Check_Assignment): Separate checking of the target of an
assignment.

From-SVN: r273266

5 years ago[Ada] Make -gnatRj output strictly conforming JSON
Eric Botcazou [Tue, 9 Jul 2019 07:53:16 +0000 (07:53 +0000)]
[Ada] Make -gnatRj output strictly conforming JSON

This changes the -gnatRj output from a concatenation of entities to an
array of entities, thus making it strictly conforming JSON and easier to
be parsed by means of GNATColl or Python.

2019-07-09  Eric Botcazou  <ebotcazou@adacore.com>

gcc/ada/

* repinfo.ads (JSON format): Adjust.
* repinfo.adb (Need_Blank_Line): Rename to...
(Need_Separator): ...this.
(Blank_Line): Rename to...
(Write_Separator): ...this and add JSON specific handling.
(List_Array_Info): Adjust to above renaming.
(List_Object_Info): Likewise.
(List_Record_Info): Likewise.
(List_Subprogram_Info): Likewise.
(List_Type_Info): Likewise.
(List_Entities): Do not set Need_Blank_Line.
(List_Rep_Info): Set Need_Separator and add JSON specific
handling. Output a single JSON stream in the  normal case.

From-SVN: r273265

5 years ago[Ada] Update -fdump-ada-spec documentation
Arnaud Charlet [Tue, 9 Jul 2019 07:53:11 +0000 (07:53 +0000)]
[Ada] Update -fdump-ada-spec documentation

2019-07-09  Arnaud Charlet  <charlet@adacore.com>

gcc/ada/

* doc/gnat_ugn/the_gnat_compilation_model.rst: Update doc on
-fdump-ada-spec now that we generate Ada 2012.
* gnat_ugn.texi: Regenerate.

From-SVN: r273264

5 years agoRemove usage of ZSTD_CLEVEL_DEFAULT define.
Martin Liska [Tue, 9 Jul 2019 07:41:39 +0000 (09:41 +0200)]
Remove usage of ZSTD_CLEVEL_DEFAULT define.

2019-07-09  Martin Liska  <mliska@suse.cz>

* lto-compress.c (lto_normalized_zstd_level): Do not use
ZSTD_CLEVEL_DEFAULT as it is not default in old releases
of libzstd.  One can use 0 as a default compression level.

From-SVN: r273263

5 years agoEnhance documentation of -fprofile-note option.
Martin Liska [Tue, 9 Jul 2019 07:41:19 +0000 (09:41 +0200)]
Enhance documentation of -fprofile-note option.

2019-07-09  Martin Liska  <mliska@suse.cz>

* doc/invoke.texi: Add link from -fprofile-dir option.
Use better wording for 'gcno filename'.

From-SVN: r273262

5 years agoPR middle-end/71924 - missing -Wreturn-local-addr returning alloca result
Martin Sebor [Tue, 9 Jul 2019 04:15:42 +0000 (04:15 +0000)]
PR middle-end/71924 - missing -Wreturn-local-addr returning alloca result

PR middle-end/71924 - missing -Wreturn-local-addr returning alloca result
PR middle-end/90549 - missing -Wreturn-local-addr maybe returning an address of a local array plus offset

gcc/ChangeLog:

PR middle-end/71924
PR middle-end/90549
* gimple-ssa-isolate-paths.c (isolate_path): Add attribute.  Update
comment.
(args_loc_t): New type.
(args_loc_t, locmap_t): same.
(diag_returned_locals): New function.
(is_addr_local): Same.
(handle_return_addr_local_phi_arg, warn_return_addr_local): Same.
(find_implicit_erroneous_behavior): Call warn_return_addr_local_phi_arg.
(find_explicit_erroneous_behavior): Call warn_return_addr_local.

gcc/testsuite/ChangeLog:

PR middle-end/71924
PR middle-end/90549
* gcc.c-torture/execute/return-addr.c: New test.
* gcc.dg/Wreturn-local-addr-2.c: New test.
* gcc.dg/Wreturn-local-addr-4.c: New test.
* gcc.dg/Wreturn-local-addr-5.c: New test.
* gcc.dg/Wreturn-local-addr-6.c: New test.
* gcc.dg/Wreturn-local-addr-7.c: New test.
* gcc.dg/Wreturn-local-addr-8.c: New test.
* gcc.dg/Wreturn-local-addr-9.c: New test.
* gcc.dg/Wreturn-local-addr-10.c: New test.
* gcc.dg/Walloca-4.c: Handle expected warnings.
* gcc.dg/pr41551.c: Same.
* gcc.dg/pr59523.c: Same.
* gcc.dg/tree-ssa/pr88775-2.c: Same.
* gcc.dg/tree-ssa/alias-37.c: Same.
* gcc.dg/winline-7.c: Same.

From-SVN: r273261

5 years agoDaily bump.
GCC Administrator [Tue, 9 Jul 2019 00:16:23 +0000 (00:16 +0000)]
Daily bump.

From-SVN: r273260

5 years agotree-vect-stmts.c (scan_operand_equal_p): Look through MEM_REF with SSA_NAME address...
Jakub Jelinek [Mon, 8 Jul 2019 22:11:59 +0000 (00:11 +0200)]
tree-vect-stmts.c (scan_operand_equal_p): Look through MEM_REF with SSA_NAME address of POINTER_PLUS_EXPR.

* tree-vect-stmts.c (scan_operand_equal_p): Look through MEM_REF
with SSA_NAME address of POINTER_PLUS_EXPR.  Handle MULT_EXPR
and casts in offset when different, both through gimple stmts
and through trees.  Rewritten using loops to minimize code duplication
for each operand.

* g++.dg/vect/simd-6.cc: Replace xfail with target x86.
* g++.dg/vect/simd-9.cc: Likewise.

* testsuite/libgomp.c++/scan-13.C: Replace xfail with target x86.
* testsuite/libgomp.c++/scan-16.C: Likewise.

From-SVN: r273249

5 years agore PR c++/91110 (ICE: tree check: expected class 'type', have 'exceptional' (error_ma...
Jakub Jelinek [Mon, 8 Jul 2019 22:08:27 +0000 (00:08 +0200)]
re PR c++/91110 (ICE: tree check: expected class 'type', have 'exceptional' (error_mark) in cp_omp_mappable_type_1, at cp/decl2.c:1421)

PR c++/91110
* decl2.c (cp_omp_mappable_type_1): Don't emit any note for
error_mark_node type.

* g++.dg/gomp/pr91110.C: New test.

From-SVN: r273248

5 years agoemit-rtl.c (set_insn_locations): New function moved from...
Eric Botcazou [Mon, 8 Jul 2019 21:37:33 +0000 (21:37 +0000)]
emit-rtl.c (set_insn_locations): New function moved from...

* emit-rtl.c (set_insn_locations): New function moved from...
* function.c (set_insn_locations): ...here.
* ira-emit.c (emit_moves): Propagate location of the first instruction
to the inserted move instructions.
* reg-stack.c (compensate_edge): Set the location if the sequence is
inserted on the edge.
* rtl.h (set_insn_locations): Declare.

From-SVN: r273247

5 years agors6000: Ignore GFXOPT (and GPOPT) for choosing machine
Segher Boessenkool [Mon, 8 Jul 2019 21:14:33 +0000 (23:14 +0200)]
rs6000: Ignore GFXOPT (and GPOPT) for choosing machine

The function rs6000_machine_from_flags chooses what .machine string to
used based on the rs6000_isa_flags flags.  For that it checks for each
ISA level if something for its ISA_*_MASKS is selected.

This does not work for GFXOPT and GPOPT: these are set as flags in
ISA_2_5_MASKS_SERVER, but they aren't actually new there, they just
are not selected by default for older ISAs (they were optional).

This patch makes OPTION_MASK_PPC_GFXOPT and OPTION_MASK_PPC_GPOPT not
influence the .machine selection.

* config/rs6000/rs6000.c (rs6000_machine_from_flags): Ignore
OPTION_MASK_PPC_GFXOPT and OPTION_MASK_PPC_GPOPT for selecting the
.machine string.

From-SVN: r273246

5 years agors6000: Add testcase for PR88233
Segher Boessenkool [Mon, 8 Jul 2019 20:38:46 +0000 (22:38 +0200)]
rs6000: Add testcase for PR88233

This testcase tests that with -mcpu=power8 we do not generate any
mtvsr* instructions, and we do the copy with {l,st}xvd2x.

gcc/testsuite/
PR rtl-optimization/88233
* gcc.target/powerpc/pr88233.c: New testcase.

From-SVN: r273245

5 years agosubreg: Add -fsplit-wide-types-early (PR88233)
Segher Boessenkool [Mon, 8 Jul 2019 17:35:12 +0000 (19:35 +0200)]
subreg: Add -fsplit-wide-types-early (PR88233)

Currently the second lower-subreg pass is run right before RA.  This
is much too late to be very useful.  At least for targets that do not
have RTL patterns for operations on multi-register modes it is a lot
better to split patterns earlier, before combine and all related
passes.

This adds an option -fsplit-wide-types-early that does that, and
enables it by default for rs6000.

PR rtl-optimization/88233
* common.opt (fsplit-wide-types-early): New option.
* common/config/rs6000/rs6000-common.c
(rs6000_option_optimization_table): Add OPT_fsplit_wide_types_early for
OPT_LEVELS_ALL.
* doc/invoke.texi (Optimization Options): Add -fsplit-wide-types-early.
* lower-subreg.c (pass_lower_subreg2::gate): Add test for
flag_split_wide_types_early.
(pass_data_lower_subreg3): New.
(pass_lower_subreg3): New.
(make_pass_lower_subreg3): New.
* passes.def (pass_lower_subreg2): Move after the loop passes.
(pass_lower_subreg3): New, inserted where pass_lower_subreg2 was.
* tree-pass.h (make_pass_lower_subreg2): Move up, to its new place in
the pass pipeline; its previous place is taken by ...
(make_pass_lower_subreg3): ... this.

From-SVN: r273240

5 years agoTurn of ipa-ra in builtins test (PR91059)
Wilco Dijkstra [Mon, 8 Jul 2019 17:02:35 +0000 (17:02 +0000)]
Turn of ipa-ra in builtins test (PR91059)

The gcc.c-torture/execute/builtins/lib directory contains a reimplementation
of many C library string functions, which causes non-trivial register allocation
bugs with LTO and static linked libraries.  To fix this long-standing test
issue, turn off ipa-ra which avoids the register corruption across calls.  All
builtin torture tests now pass on aarch64-none-elf.  Committed as obvious.

    testsuite/
PR testsuite/91059
PR testsuite/78529
* gcc.c-torture/execute/builtins/builtins.exp: Add -fno-ipa-ra.

From-SVN: r273238

5 years agoS/390: Define shift_truncation_mask.
Robin Dapp [Mon, 8 Jul 2019 14:42:49 +0000 (14:42 +0000)]
S/390: Define shift_truncation_mask.

Define s390_shift_truncation_mask to allow the optabs optimization

    sh = (64 - sh)
 -> sh = -sh

for a rotation operation.

gcc/ChangeLog:

2019-07-08  Robin Dapp  <rdapp@linux.ibm.com>

* config/s390/s390.c (s390_shift_truncation_mask): Define.
(TARGET_SHIFT_TRUNCATION_MASK): Define.

gcc/testsuite/ChangeLog:

2019-07-08  Robin Dapp  <rdapp@linux.ibm.com>

* gcc.target/s390/rotate-truncation-mask.c: New test.

From-SVN: r273237

5 years agoS/390: Rework shift count handling.
Robin Dapp [Mon, 8 Jul 2019 14:40:48 +0000 (14:40 +0000)]
S/390: Rework shift count handling.

Add s390_valid_shift_count to determine the validity of a
shift-count operand.  This is used to replace increasingly
complex substitutions that should have allowed address-style
shift-count handling, an and mask as well as no-op subregs
on the operand.

gcc/ChangeLog:

2019-07-08  Robin Dapp  <rdapp@linux.ibm.com>

        * config/s390/constraints.md: Add new jsc constraint.
        * config/s390/predicates.md: New predicates.
        * config/s390/s390-protos.h (s390_valid_shift_count): New function.
        * config/s390/s390.c (s390_valid_shift_count): New function.
        (print_shift_count_operand): Use s390_valid_shift_count.
        (print_operand): Likewise.
        * config/s390/s390.md: Use new predicate.
        * config/s390/subst.md: Remove addr_style_op and masked_op substs.
        * config/s390/vector.md: Use new predicate.

2019-07-08  Robin Dapp  <rdapp@linux.ibm.com>

        * gcc.target/s390/combine-rotate-modulo.c: New test.
        * gcc.target/s390/combine-shift-rotate-add-mod.c: New test.
        * gcc.target/s390/vector/combine-shift-vec.c: New test.

From-SVN: r273236

5 years agoMAINTAINERS (Write After Approval): Remove myself, already listed in RISC-V port...
Kito Cheng [Mon, 8 Jul 2019 13:21:21 +0000 (13:21 +0000)]
MAINTAINERS (Write After Approval): Remove myself, already listed in RISC-V port maitainer.

2019-07-08  Kito Cheng  <kito.cheng@sifive.com>

* MAINTAINERS (Write After Approval): Remove myself, already listed in
RISC-V port maitainer.

From-SVN: r273235

5 years agore PR tree-optimization/91108 (Fails to pun through unions)
Richard Biener [Mon, 8 Jul 2019 11:46:26 +0000 (11:46 +0000)]
re PR tree-optimization/91108 (Fails to pun through unions)

2019-07-08  Richard Biener  <rguenther@suse.de>

PR tree-optimization/91108
* tree-ssa-sccvn.c: Include builtins.h.
(vn_reference_lookup_3): Use only alignment constraints to
verify same-valued store disambiguation.

* gcc.dg/tree-ssa/ssa-fre-61.c: Adjust back.
* gcc.dg/tree-ssa/ssa-fre-78.c: New testcase.

From-SVN: r273232

5 years agoAvoid clash with system header declaration.
Joern Rennecke [Mon, 8 Jul 2019 11:17:22 +0000 (11:17 +0000)]
Avoid clash with system header declaration.

* testsuite/gcc.dg/vect/slp-reduc-sad.c (uint32_t):
Remove unused declaration.

From-SVN: r273231

5 years agoRISC-V: Fix splitter for 32-bit AND on 64-bit target.
Jim Wilson [Mon, 8 Jul 2019 10:47:42 +0000 (03:47 -0700)]
RISC-V: Fix splitter for 32-bit AND on 64-bit target.

Fixes github.com/riscv/riscv-gcc issue #161.  We were accidentally using
BITS_PER_WORD to compute shift counts when we should have been using the
bitsize of the operand modes.  This was wrong when we had an SImode shift
and a 64-bit target.

Andrew Waterman  <andrew@sifive.com>
gcc/
* config/riscv/riscv.md (lshrsi3_zero_extend_3+1): Use operands[1]
bitsize instead of BITS_PER_WORD.
gcc/testsuite/
* gcc.target/riscv/shift-shift-2.c: Add one more test.

From-SVN: r273230

5 years agoRevert r254460 (collect2 LTO for AIX).
Martin Liska [Mon, 8 Jul 2019 09:53:02 +0000 (11:53 +0200)]
Revert r254460 (collect2 LTO for AIX).

2019-07-08  Martin Liska  <mliska@suse.cz>

* collect2.c (defined): Revert to before r254460.
(scan_prog_file): Revert to before r254460.

From-SVN: r273229

5 years agore PR c++/65143 ([C++11] missing devirtualization for virtual base in "final" classes)
Paolo Carlini [Mon, 8 Jul 2019 09:51:07 +0000 (09:51 +0000)]
re PR c++/65143 ([C++11] missing devirtualization for virtual base in  "final" classes)

2019-07-08  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/65143
* g++.dg/tree-ssa/final2.C: New.
* g++.dg/tree-ssa/final3.C: Likewise.

From-SVN: r273228

5 years agoMAINTAINERS (Write After Approval): Fix the list sorted by surname.
Kito Cheng [Mon, 8 Jul 2019 09:16:08 +0000 (09:16 +0000)]
MAINTAINERS (Write After Approval): Fix the list sorted by surname.

2019-07-08  Kito Cheng  <kito.cheng@sifive.com>

* MAINTAINERS (Write After Approval): Fix the list sorted by surname.

From-SVN: r273227

5 years ago[Ada] Small overhaul in Repinfo unit
Eric Botcazou [Mon, 8 Jul 2019 08:15:05 +0000 (08:15 +0000)]
[Ada] Small overhaul in Repinfo unit

This creates a List_Type_Info procedure to deal with type entities other
than arrays and records at top level and a List_Common_Type_Info
procedure to handle the common part between them.  No functional
changes.

2019-07-08  Eric Botcazou  <ebotcazou@adacore.com>

gcc/ada/

* repinfo.adb (List_Common_Type_Info): New procedure extracted
from...
(List_Type_Info): ...here.  Call it for the common information,
start with a blank line and output the linker section at the
end, if any.
(List_Mechanisms): Rename to...
(List_Subprogram_Info): ...this.
(List_Array_Info): Call List_Common_Type_Info.
(List_Entities): Adjust to above change and renaming.
(List_Record_Info): Call List_Common_Type_Info.

From-SVN: r273226

5 years ago[Ada] GNAT.Serial_Communications: simplify the Serial_Port structure
Dmitriy Anisimkov [Mon, 8 Jul 2019 08:14:59 +0000 (08:14 +0000)]
[Ada] GNAT.Serial_Communications: simplify the Serial_Port structure

2019-07-08  Dmitriy Anisimkov  <anisimko@adacore.com>

gcc/ada/

* libgnat/g-sercom.ads
(Serial_Port_Descriptor): New type.
(Serial_Port): Add a comment, make it hold a
Serial_Port_Descriptor.
(To_Ada, To_C): New procedures.
(Port_Data, Port_Data_Access): Remove types.
* libgnat/g-sercom.adb (To_Ada): New stub.
* libgnat/g-sercom__linux.adb, libgnat/g-sercom__mingw.adb:
Update implementations accordingly.
* s-oscons-tmplt.c: Bind Serial_Port_Descriptor to
System.Win32.HANDLE on Windows, and to Interfaces.C.int on
Linux. Add "Interfaces.C." prefix for other basic integer type
bindings.
* xoscons.adb (Output_Info): Remove the "Interfaces.C." prefix
for subtypes generation.

From-SVN: r273225

5 years ago[Ada] GNAT RM: Update documentation on No_Exceptions restriction
Arnaud Charlet [Mon, 8 Jul 2019 08:14:55 +0000 (08:14 +0000)]
[Ada] GNAT RM: Update documentation on No_Exceptions restriction

2019-07-08  Arnaud Charlet  <charlet@adacore.com>

gcc/ada/

* doc/gnat_rm/standard_and_implementation_defined_restrictions.rst:
Update documentation on No_Exceptions restriction.
* gnat_rm.texi: Regenerate.

From-SVN: r273224

5 years ago[Ada] Os_Lib: do not call __gnat_kill for Invalid_Pid
Dmitriy Anisimkov [Mon, 8 Jul 2019 08:14:50 +0000 (08:14 +0000)]
[Ada] Os_Lib: do not call __gnat_kill for Invalid_Pid

2019-07-08  Dmitriy Anisimkov  <anisimko@adacore.com>

gcc/ada/

* libgnat/s-os_lib.adb: Do not call __gnat_kill for Invalid_Pid.

From-SVN: r273223

5 years ago[Ada] Remove dead code from Enclosing_Package_Or_Subprogram routine
Piotr Trojanek [Mon, 8 Jul 2019 08:14:46 +0000 (08:14 +0000)]
[Ada] Remove dead code from Enclosing_Package_Or_Subprogram routine

Calls to Scope always return unique entities, i.e. package/subprogram
and not their bodies, so there is no need to expect them.

Cleanup only; semantics unaffected. (This routine was only used in CCG
and GNATprove backends anyway.)

2019-07-08  Piotr Trojanek  <trojanek@adacore.com>

gcc/ada/

* sem_util.adb (Enclosing_Package_Or_Subprogram): Do not expect
package and subprogram bodies.

From-SVN: r273222

5 years ago[Ada] Remove documentation of ignored GNATpp switch
Bob Duff [Mon, 8 Jul 2019 08:14:41 +0000 (08:14 +0000)]
[Ada] Remove documentation of ignored GNATpp switch

2019-07-08  Bob Duff  <duff@adacore.com>

gcc/ada/

* doc/gnat_ugn/gnat_utility_programs.rst: Remove documentation
of ignored GNATpp switch.

From-SVN: r273221

5 years ago[Ada] In-place initialization for Initialize_Scalars
Hristian Kirtchev [Mon, 8 Jul 2019 08:14:36 +0000 (08:14 +0000)]
[Ada] In-place initialization for Initialize_Scalars

Update the documentation of pragma Initialize_Scalars in the GNAT
Reference Manual.

2019-07-08  Hristian Kirtchev  <kirtchev@adacore.com>

gcc/ada/

* doc/gnat_rm/implementation_defined_pragmas.rst:
Update the documentation of pragma Initialize_Scalars.
* gnat_rm.texi: Regenerate.

From-SVN: r273220

5 years ago[Ada] Wrong evaluation of membership test
Javier Miranda [Mon, 8 Jul 2019 08:14:32 +0000 (08:14 +0000)]
[Ada] Wrong evaluation of membership test

The code generated by the compiler erroneously evaluates to True
membership tests when their left operand is a a class-wide interface
object and the right operand is a tagged type that implements such
interface type.

2019-07-08  Javier Miranda  <miranda@adacore.com>

gcc/ada/

* exp_ch4.adb (Tagged_Membership): Fix regression silently
introduced in r260738 that erroneouslusy causes the evaluation
to True of the membership test when the left operand of the
membership test is a class-wide interface object and the right
operand is a type that implements such interface type.

gcc/testsuite/

* gnat.dg/interface10.adb: New testcase.

From-SVN: r273219

5 years ago[Ada] Assertion failure on validity check for Address
Hristian Kirtchev [Mon, 8 Jul 2019 08:14:27 +0000 (08:14 +0000)]
[Ada] Assertion failure on validity check for Address

This patch corrects the verification of 'Address clauses to avoid
processing a clause where the prefix of the attribute is a generic
formal object.

2019-07-08  Hristian Kirtchev  <kirtchev@adacore.com>

gcc/ada/

* sem_ch13.adb (Analyze_Attribute_Definition_Clause): Do not
register an address clause when its prefix denotes a generic
formal object.

gcc/testsuite/

* gnat.dg/addr13.adb, gnat.dg/addr13.ads: New testcase.

From-SVN: r273218

5 years ago[Ada] Diagnostics for Elaboration order v4.0
Hristian Kirtchev [Mon, 8 Jul 2019 08:14:22 +0000 (08:14 +0000)]
[Ada] Diagnostics for Elaboration order v4.0

This patch adds a missing case to the output of cycle diagnostics here a
transition from an Elaborate_Body pair may reach a destination which is
in the context of an active Elaborate_All.

2019-07-08  Hristian Kirtchev  <kirtchev@adacore.com>

gcc/ada/

* bindo-diagnostics.adb (Diagnose_Cycle): Capture the presence
of an Elaborate_All edge before iterating over the edges of the
cycle.
(Output_Elaborate_Body_Transition): Update the parameter profile
and the comment on usage. Add a missing case where the edge is
within the context of an Elaborate_All.
(Output_Transition): Update the call to
Output_Elaborate_Body_Transition.
* bindo-graphs.ads, bindo-graphs.adb
(Contains_Elaborate_All_Edge): New routine.

From-SVN: r273217

5 years ago[Ada] Set dummy Etype for the fake __HEAP entity in GNATprove
Piotr Trojanek [Mon, 8 Jul 2019 08:14:15 +0000 (08:14 +0000)]
[Ada] Set dummy Etype for the fake __HEAP entity in GNATprove

GNATprove represents reads and writes via pointers as operations on a
fake __HEAP entity. This entity already had various properties set to
dummy values (e.g. Scope set to Standard_Standard), so that it can be
processed like other entities without crashing and not special-cased
everywhere. Now it also has a dummy Etype, so it can be processed with
Is_Single_Concurrent_Object.

The modified code is only executed by GNATprove; frontend is not
affected.

2019-07-08  Piotr Trojanek  <trojanek@adacore.com>

gcc/ada/

* lib-xref-spark_specific.adb (Create_Heap): Set dummy Etype for
the fake __HEAP entity.

From-SVN: r273216

5 years ago[Ada] Suppress warnings on memory representation in CodePeer mode
Daniel Mercier [Mon, 8 Jul 2019 08:14:11 +0000 (08:14 +0000)]
[Ada] Suppress warnings on memory representation in CodePeer mode

2019-07-08  Daniel Mercier  <mercier@adacore.com>

gcc/ada/

* gnat1drv.adb: Suppress warnings on memory representation in
CodePeer compiler mode.

From-SVN: r273215

5 years ago[Ada] Remove dependency on Win32 GDI (Graphical Interface)
Nicolas Roche [Mon, 8 Jul 2019 08:14:06 +0000 (08:14 +0000)]
[Ada] Remove dependency on Win32 GDI (Graphical Interface)

CommandLineToArgvW drags a dependency on SHELL32.DLL and thus GDI32.DLL.
By loading GDI32.DLL some default GDI objects are allocated. On some
Windows versions this cause the use of a lock on the graphical interface
during process termination. This can impact parallelism significantly as
termination of processes is serialized.

2019-07-08  Nicolas Roche  <roche@adacore.com>

gcc/ada/

* rtinit.c (__gnat_runtime_initialize): Remove dependency on
CommandLineToArgvW.

From-SVN: r273214

5 years ago[Ada] New port for x86_64-vx7
Doug Rupp [Mon, 8 Jul 2019 08:14:01 +0000 (08:14 +0000)]
[Ada] New port for x86_64-vx7

2019-07-08  Doug Rupp  <rupp@adacore.com>

gcc/ada/

* Makefile.rtl: Handle vxworks7r2 in x86_64 and x86 vxworks7.

From-SVN: r273213

5 years ago[Ada] Use g-sercom__linux.adb for all Linuxes
Dmitriy Anisimkov [Mon, 8 Jul 2019 08:13:57 +0000 (08:13 +0000)]
[Ada] Use g-sercom__linux.adb for all Linuxes

2019-07-08  Dmitriy Anisimkov  <anisimko@adacore.com>

gcc/ada/

* Makefile.rtl: Use g-sercom__linux.adb for all linuxes.

From-SVN: r273212

5 years ago[Ada] Do not erase precise type on fixed-point real literal
Yannick Moy [Mon, 8 Jul 2019 08:13:52 +0000 (08:13 +0000)]
[Ada] Do not erase precise type on fixed-point real literal

Real literals of fixed-point type are expected to keep their precise
fixed-point type in GNATprove. This is now correctly enforced.

There is no impact on compilation.

2019-07-08  Yannick Moy  <moy@adacore.com>

gcc/ada/

* expander.adb (Expand): Do not reset Analyzed flag always.
* sem_eval.adb (Fold_Ureal): Mark node as analyzed.

From-SVN: r273211

5 years ago[Ada] Crash on timed entry call with a delay given by a type conversion
Ed Schonberg [Mon, 8 Jul 2019 08:13:48 +0000 (08:13 +0000)]
[Ada] Crash on timed entry call with a delay given by a type conversion

This patch fixes a compiler crash in the compiler on a timed entry call
whose delay expression is a type conversion, when FLoat_Overflow checks
are enabled.

2019-07-08  Ed Schonberg  <schonberg@adacore.com>

gcc/ada/

* exp_ch9.adb (Expand_N_Timed_Entry_Call): Do not insert twice
the assignment statement that computes the delay value, to
prevent improper tree sharing when the value is a type
conversion and Float_Overflow checks are enabled.

gcc/testsuite/

* gnat.dg/entry1.adb, gnat.dg/entry1.ads: New testcase.

From-SVN: r273210

5 years ago[Ada] New algorithm for Elaboration order v4.0
Hristian Kirtchev [Mon, 8 Jul 2019 08:13:43 +0000 (08:13 +0000)]
[Ada] New algorithm for Elaboration order v4.0

This patch introduces several changes to the new elaboration order
mechanism:

   * The concept of "strong" and "weak" edges is introduced. Strong
     edges are the byproduct of language-defined relations between
     units, such as with clauses. Weak edges are the byproduct of
     specilative invocations at elaboration time, which may or may not
     take place depending on control flow.

   * The elaboration order algorithm has been heavily modified to make
     use of the strong and weak edges, and operate on units compiled
     with different elaboration models.

   * The elaboration order algorithm employs the following logic:

        - Maintain two sets of vertices, one for all elaborable
          vertices, and one for all waiting vertices.

        - Pick the best elaborable vertex, and elaborate its component.

        - If no such elaborable vertex is available, pick the best
          weakly elaborable vertex whose unit has been compiled with the
          dynamic model, and elaborate its component.

        - If no such weakly elaborable vertex is available, then either
          all vertices were already elaborated, or the graph contains a
          cycle.

     The elaboration of a component employs the same logic, with an
     added step where all successors of some predecessor currently being
     elaborated are notified that they have one fewer predecessor to
     wait on. This may cause certain successors to become elaborable, in
     which case they are moved from the set of waiting vertices to the
     set of elaborable vertices.

   * Three new GNATbind debug switches are introduced, -d_a, -d_b, and
     -d_e, to eliminate the effects of pragmas Elaborate_All,
     Elaborate_Body, and Elaborate respectively.

   * The section on terminology is updated to include new entries.

2019-07-08  Hristian Kirtchev  <kirtchev@adacore.com>

gcc/ada/

* bindo.adb: Update the section on terminology to include new
concepts.  Update the section on switches to include new
entries.
* bindo.ads: Add type Precedence_Kind.
* bindo-builders.adb: Add with and use clauses for Debug and
Bindo.Validators.  Add use clauses for
Bindo.Validators.Invocation_Graph_Validators and
Bindo.Validators.Library_Graph_Validators.
(Build_Invocation_Graph): Validate the graph immediately after
it was built.
(Build_Library_Graph): Update the parameter profile. The
creation of the graph is now elaboration model-agnostic.
Validate the graph immediately after it was built.
(Create_With_Edge): Create regular with edges for Elaborate and
Elaborate_All edges when the appropriate debug switches are in
effect.
* bindo-builders.ads (Build_Library_Graph): Update the parameter
profile.
* bindo-diagnostics.adb (Diagnose_Cycle): Track the presence of
an Elaborate_All edge throughout the inspection of the cycle's
edges.
(Output_Dynamic_Model_Suggestions): Output the suggestion only
when the cycle contains at least one weak edge where the
successor was statically elaborated.
(Output_Elaborate_Body_Transition, Output_Forced_Transition,
Output_With_Transition): Update the assertions.
* bindo-elaborators.adb: Remove use clauses for
Bindo.Validators.Invocation_Graph_Validators and
Bindo.Validators.Library_Graph_Validators.  Remove strings
Add_To_All_Candidates_Msg and Add_To_Comp_Candidates_Msg.
Remove type String_Ptr.
(Add_Vertex, Add_Vertex_If_Elaborable, Create_All_Candidates_Set
Create_Component_Candidates_Set): Remove.
(Create_Component_Vertex_Sets, Create_Vertex_Sets): New routine.
(Elaborate_Component): Update the parameter profile and the
comment on usage.  Reimplement the elaboration of a component.
The algorithm will now attempt to elaborate as many vertices
possible. If this is not possible, and a weakly elaborable
vertex is available use unit was compiled using the dynamic
model, the algorithm will elaborate it.
(Elaborate_Library_Graph): Reimplement the elaboration of the
graph. The algorithm will now attempt to elaborate as many
vertices along with their components as possible. If this is not
possible, and a weakly elaborable vertex is available use unit
was compiled using the dynamic model, the algorithm will
elaborate it along with its component.
(Elaborate_Units): Merge with the functionality of
Elaborate_Units_Common.
(Elaborate_Units_Common, Elaborate_Units_Dynamic,
Elaborate_Units_Static): Remove.
(Elaborate_Vertex): Update the parameter profile and the comment
on usage.  Reimplemented.
(Find_Best_Candidate): Remove.
(Find_Best_Elaborable_Vertex, Find_Best_Vertex,
Find_Best_Weakly_Elaborable_Vertex, Has_Elaborable_Body,
Insert_Elaborable_Successor, Insert_Vertex): New routines.
(Is_Better_Candidate): Remove.
(Is_Better_Elaborable_Vertex,
Is_Better_Weakly_Elaborable_Vertex,
Is_Suitable_Elaborable_Vertex,
Is_Suitable_Weakly_Elaborable_Vertex): New routines.
(Trace_Candidate_Vertices): Remove.
(Trace_Component): Output the number of strong and weak
predecessors.
(Trace_Unelaborated_Vertices): Remove.
(Trace_Vertex): Output the number of strong and weak
predecessors.
(Trace_Vertices): New routine.
(Update_Successor, Update_Successors): Update the parameter
profile and the comment on usage.
* bindo-graphs.adb: Remove type Precedence_Kind.
(Add_Edge_With_Return): Update the increment of pending
predecessors.
(Add_Vertex): Provide default values for strong and weak
predecessors.
(Complementary_Vertex): Move the initial declaration to the
spec. Update the parameter profile and the comment on usage.
(Contains_Weak_Static_Successor): New routine.
(Create): Update the parameter profile. The creation of the
graph is now elaboration model-agnostic.
(Decrement_Pending_Predecessors): Update the parameter profile
and the comment on usage. Reimplemented.
(Delete_Edge): Update the decrement of pending predecesors.
(Has_Elaborate_Body): Do not treat a vertex as being subject to
Elaborate_Body when a debug switch is in effect.
(Increment_Pending_Predecessors): Update the parameter profile
and the comment on usage. Reimplemented.
(Is_Elaborable_Component): Reimplemented.
(Is_Elaborable_Vertex): Move the initial declaration to the
spec.  Reimplemented.
(Is_Elaborate_Body_Pair): New routine.
(Is_Dynamically_Elaborated): Update the parameter profile.
Reimplemented.
(Is_Weakly_Elaborable_Vertex): New routine.
(Pending_Predecessors): Removed.
(Pending_Predecessors_For_Elaboration,
Pending_Strong_Predecessors, Pending_Weak_Predecessors,
Update_Pending_Predecessors): New routines.
(Update_Pending_Predecessors_Of_Components): Update the
increment of pending predecessors.
* bindo-graphs.ads: Update the components of type
Component_Attributes.  Update the components of type
Library_Graph_Attributes.  Update the components of type
Library_Graph_Vertex_Attributes.  Update the initialization of
No_Component_Attributes.  Update the initialization of
No_Library_Graph_Vertex_Attributes.
(Complementary_Vertex, Contains_Weak_Static_Successor): New
routines.
(Create): Update the parameter profile and the comment on usage.
(Decrement_Pending_Predecessors, Is_Dynamically_Elaborated):
Update the parameter profile and the comment on usage.
(Is_Elaborate_Body_Pair, Is_Weakly_Elaborable_Vertex): New
routines.
(Pending_Predecessors): Removed.
(Pending_Predecessors_For_Elaboration,
Pending_Strong_Predecessors, Pending_Weak_Predecessors): New
routines.
* bindo-writers.adb (Write_Components): Moved from the spec.
(Write_Component): Output the strong and weak predecessors.
(Write_Library_Graph): Output the components as part of the
graph.
(Write_Library_Graph_Vertex): Output the strong and weak
predecessors.
* bindo-writers.ads (Write_Components): Moved to the body.
* debug.adb: Add and document new GNATbind switches -d_a, -d_b,
-d_e.
* bindo-validators.adb: Minor reformattings.

From-SVN: r273209

5 years ago[Ada] More data rates supported on Linux
Bob Duff [Mon, 8 Jul 2019 08:13:38 +0000 (08:13 +0000)]
[Ada] More data rates supported on Linux

This patch adds additional data rates to the GNAT.Serial_Communications
package (Linux version).

2019-07-08  Bob Duff  <duff@adacore.com>

gcc/ada/

* libgnat/g-sercom.ads, libgnat/g-sercom__linux.adb (Data_Rate):
Support additional data rates.

From-SVN: r273208

5 years ago[Ada] Arrange not to set DECL_ARTIFICIAL on elab procs
Olivier Hainque [Mon, 8 Jul 2019 08:13:34 +0000 (08:13 +0000)]
[Ada] Arrange not to set DECL_ARTIFICIAL on elab procs

Unlike, say, clones created internally by the compiler, elab procs
materialize specific user code and flagging them artificial now takes
elab code away from gcov's analysis, a regression compared to previous
releases.

On the testcase below:

package Gcov_Q is
   function F (X : Integer) return Integer is (X + 1);
end;

with Gcov_Q;
package Gcov_P is
   Y : Integer := Gcov_Q.F (X => 1);
end;

with Gcov_P;
procedure Gcov_Test is
begin
   if Gcov_P.Y /= 2 then
      raise Program_Error;
   end if;
end;

After compiling with:

  gnatmake -f -g gcov_test.adb \
    -cargs -ftest-coverage -fprofile-arcs \
    -largs -fprofile-generate

and executing with

  ./gcov_test

We expect

   gcov gcov_p

to produce a gcov_p.ads.gcov report.

2019-07-08  Olivier Hainque  <hainque@adacore.com>

gcc/ada/

* gcc-interface/trans.c (Compilation_Unit_to_gnu): Don't request
DECL_ARTIFICIAL_P on elab proc declarations.

From-SVN: r273207

5 years ago[Ada] Fix crash on extension of private type with -gnatRj
Eric Botcazou [Mon, 8 Jul 2019 08:13:30 +0000 (08:13 +0000)]
[Ada] Fix crash on extension of private type with -gnatRj

This fixes a crash (or an assertion failure) during the processing done
for -gnatRj on the declaration of an extension of a private type.
Generally speaking, extension declarations are delicate in this context
because the front-end does not duplicate the structure of the parent
type, so the processing required to output the structural layout needs
to go up to the declaration of the parent type, which may or may not be
available or usable.

The change also makes the processing more robust by falling back to the
flat layout if the declaration of the parent type cannot be processed.

2019-07-08  Eric Botcazou  <ebotcazou@adacore.com>

gcc/ada/

* repinfo.adb (List_Record_Info): Declare Incomplete_Layout and
Not_In_Extended_Main local exceptions.
(List_Structural_Record_Layout): For an extension, raise the
former if the parent subtype has not been built and the latter
if it is not declared in the main source unit.  Fall back to the
flat layout if either exception has been raised.

From-SVN: r273206

5 years ago[Ada] Semantics of Delete for fixed strings
Ed Schonberg [Mon, 8 Jul 2019 08:13:25 +0000 (08:13 +0000)]
[Ada] Semantics of Delete for fixed strings

This patch corrects a bug in the implementation of Delete in an unusual
boundary case: the RM describes the semantics of Delete as equivalent to
that of Replace_String with a null argument. As a result, deleting a
null string that starts past the end of its argument is a noop and must
not raise Index_Error.

2019-07-08  Ed Schonberg  <schonberg@adacore.com>

gcc/ada/

* libgnat/a-strfix.adb (Delete): The RM describes the semantics
of Delete as equivalent to that of Replace_String with a null
argument. As a result, deleting a null string that starts past
the end of its argument is a noop and must not raise
Index_Error.

gcc/testsuite/

* gnat.dg/fixed_delete.adb: New testcase.

From-SVN: r273205

5 years ago[Ada] Crash in interface derivation with null primitive
Javier Miranda [Mon, 8 Jul 2019 08:13:20 +0000 (08:13 +0000)]
[Ada] Crash in interface derivation with null primitive

The frontend crashes processing the derivation of a tagged type whose
ultimate ancestor is an interface type I1 that has a null primitive,
implements another interface I2 derived from I2, and does not override
the null primitive.

2019-07-08  Javier Miranda  <miranda@adacore.com>

gcc/ada/

* exp_disp.adb (Register_Primitive): When registering a
primitive in the secondary dispatch table, handle primitive
inherited through several levels of type derivation (required to
properly handle inherited 'null' primitive).

gcc/testsuite/

* gnat.dg/interface9.adb, gnat.dg/interface9_root-child.ads,
gnat.dg/interface9_root.ads: New testcase.

From-SVN: r273204

5 years ago[Ada] Document handling of preprocessor directives in GNATpp
Bob Duff [Mon, 8 Jul 2019 08:13:16 +0000 (08:13 +0000)]
[Ada] Document handling of preprocessor directives in GNATpp

2019-07-08  Bob Duff  <duff@adacore.com>

gcc/ada/

* doc/gnat_ugn/gnat_utility_programs.rst: Document handling of
preprocessor directives in GNATpp.

From-SVN: r273203

5 years ago[Ada] Code reorganization
Javier Miranda [Mon, 8 Jul 2019 08:13:11 +0000 (08:13 +0000)]
[Ada] Code reorganization

This patch performs a code reorganization of the implementation of
pragma Compile_Time_Error. No functional change.

No test required.

2019-07-08  Javier Miranda  <miranda@adacore.com>

gcc/ada/

* gnat1drv.adb (Post_Compilation_Validation_Checks:
Validate_Compile_Time_Warning_Errors is now located in sem_prag
(instead of sem_ch13).
* sem_ch13.ads (Validate_Compile_Time_Warning_Error,
Validate_Compile_Time_Warning_Errors): Move to sem_prag.
* sem_ch13.adb
(Compile_Time_Warnings_Errors): Move to sem_prag.
(Initialize): Remove initialization of table
Compile_Time_Warning_Errors.
(Validate_Compile_Time_Warning_Error,
Validate_Compile_Time_Warning_Errors): Move to sem_prag.
* sem_prag.ads (Validate_Compile_Time_Warning_Errors): New
procedure.
* sem_prag.adb (Initialize): Initialize table
Compile_Time_Warning_Errors.

From-SVN: r273202

5 years ago[Ada] Crash on named actual in postcondition for generic subprogram
Ed Schonberg [Mon, 8 Jul 2019 08:13:04 +0000 (08:13 +0000)]
[Ada] Crash on named actual in postcondition for generic subprogram

This patch fixes a crash on compiling the postcondtion for a generic
subprogram, when the postcondition is a call with both positional and
named parameter associations.

2019-07-08  Ed Schonberg  <schonberg@adacore.com>

gcc/ada/

* sem_ch13.adb (Analyze_Aspect_Specifications): For a
pre/postcondition of a generic subprogram declaration, do not
use Relocate_Node on the aspect expression to construct the
corresponding attribute specification, to prevent tree anomalies
when the expression is a call with named actual parameters.

gcc/testsuite/

* gnat.dg/predicate9.adb: New testcase.

From-SVN: r273201

5 years ago[Ada] Spurious error reported by pragma Compile_Time_Error
Javier Miranda [Mon, 8 Jul 2019 08:13:00 +0000 (08:13 +0000)]
[Ada] Spurious error reported by pragma Compile_Time_Error

The compiler may trigger spurious errors on pragmas Compile_Time_Error
and Compile_Time_Warning when their boolean expression computes the size
of a type. After this patch the following test compiles fine.

with Interfaces; use Interfaces;
package Types is
   type Arr is array (1 .. 6) of Unsigned_8
     with Size      => 48,
          Alignment => 1;

   type Rec is record
      Comp_1 : Unsigned_32;
      Comp_2 : Unsigned_16;
   end record
     with Size      => 48,
          Alignment => 1;
end Types;

with Types; use Types;
package Main is
   pragma Compile_Time_Error
     (Arr'Size  = 12, "ERROR: Arr'Size is 48, not 12");
   pragma Compile_Time_Error
     (Arr'Size  = 48, "OK: Arr");
   pragma Compile_Time_Error
     (Arr'Size /= 48, "ERROR: Arr'Size is 48");

   pragma Compile_Time_Error
     (Rec'Size  = 34, "ERROR: Rec'Size is 48, not 34");
   pragma Compile_Time_Error
     (Rec'Size  = 48, "OK: Rec");
   pragma Compile_Time_Error
     (Rec'Size /= 48, "ERROR: Rec'Size is 48");
end Main;

Command: gcc -c main.ads
 Output: main.ads:7:07: OK: Arr
         main.ads:14:07: OK: Rec

2019-07-08  Javier Miranda  <miranda@adacore.com>

gcc/ada/

* sem_attr.adb (Analyze_Attribute [Attribute_Size]): For pragmas
used to report user defined compile time warning or errors
handle 'Size for types with known static RM size.

From-SVN: r273200

5 years ago[Ada] Crash on Image and Value attributes
Justin Squirek [Mon, 8 Jul 2019 08:12:55 +0000 (08:12 +0000)]
[Ada] Crash on Image and Value attributes

This patch fixes an issue whereby the creation of an enumeration within
package where Default_Scalar_Storage_Order is in effect may lead to a
crash when the attributes Image or Value are applied to objects of said
type or the type directly.

2019-07-08  Justin Squirek  <squirek@adacore.com>

gcc/ada/

* exp_imgv.adb (Build_Enumeration_Image_Tables): Default SSO for
the building of image tables.
(Expand_Image_Attribute): Minor cleanup.

gcc/testsuite/

* gnat.dg/sso16.adb: New testcase.

From-SVN: r273199

5 years ago[Ada] GNAT.Sockets: remove default level in Get/Set_Socket_Option
Dmitriy Anisimkov [Mon, 8 Jul 2019 08:12:51 +0000 (08:12 +0000)]
[Ada] GNAT.Sockets: remove default level in Get/Set_Socket_Option

2019-07-08  Dmitriy Anisimkov  <anisimko@adacore.com>

gcc/ada/

* libgnat/g-socket.ads, libgnat/g-socket.adb: Improve
documentation.
(Get_Socket_Option, Set_Socket_Option): Remove default value for
the Level formal.

From-SVN: r273198

5 years ago[Ada] Spurious visibility error on dynamic_predicate aspect in generic
Ed Schonberg [Mon, 8 Jul 2019 08:12:46 +0000 (08:12 +0000)]
[Ada] Spurious visibility error on dynamic_predicate aspect in generic

This patch fixes a spurious error when verifying that the visibility of
the expression of an aspect has not changed between the freeze point of
the entity to which it applies, and the end of the enclosing declarative
part. If the entity is a composite type its components must be made
directly visible for the analysis of the expression. In a generic
context this must be done explicitly at the end of the declarative part.

2019-07-08  Ed Schonberg  <schonberg@adacore.com>

gcc/ada/

* sem_ch13.adb (Check_Aspect_At_End_Of_Declarations): For an
unanalized aspect in a generic context that has not been
analyzed yet, if the aspect applies to a type, place the type on
the scope stack to make its components visible, before checking
conformance with the version of the expression analyzed at the
freeze point.

gcc/testsuite/

* gnat.dg/predicate8.adb, gnat.dg/predicate8_pkg.adb,
gnat.dg/predicate8_pkg.ads: New testcase.

From-SVN: r273197

5 years agoAdd myself to MAINTAINERS (Write After Approval)
Kito Cheng [Mon, 8 Jul 2019 07:31:21 +0000 (07:31 +0000)]
Add myself to MAINTAINERS (Write After Approval)

From-SVN: r273195

5 years agore PR tree-optimization/83518 (Missing optimization: useless instructions should...
Richard Biener [Mon, 8 Jul 2019 07:09:24 +0000 (07:09 +0000)]
re PR tree-optimization/83518 (Missing optimization: useless instructions should be dropped)

2019-07-08  Richard Biener  <rguenther@suse.de>

PR tree-optimization/83518
* tree-ssa-sccvn.c: Include splay-tree.h.
(struct pd_range, struct pd_data): New.
(struct vn_walk_cb_data): Add data to track partial definitions.
(vn_walk_cb_data::~vn_walk_cb_data): New.
(vn_walk_cb_data::push_partial_def): New.
(pd_tree_alloc, pd_tree_dealloc, pd_range_compare): New.
(vn_reference_lookup_2): When partial defs are registered give up.
(vn_reference_lookup_3): Track partial defs for memset and
constructor zeroing and for defs from constants.

* gcc.dg/tree-ssa/ssa-fre-73.c: New testcase.
* gcc.dg/tree-ssa/ssa-fre-74.c: Likewise.
* gcc.dg/tree-ssa/ssa-fre-75.c: Likewise.
* gcc.dg/tree-ssa/ssa-fre-76.c: Likewise.
* g++.dg/tree-ssa/pr83518.C: Likewise.

From-SVN: r273194

5 years agoAdd a build config for bootstrapping at -Og
Richard Sandiford [Mon, 8 Jul 2019 06:21:11 +0000 (06:21 +0000)]
Add a build config for bootstrapping at -Og

Although BOOT_CFLAGS can be used to bootstrap with -Og, having a
dedicated build config is sometimes more convenient.

2019-07-08  Richard Sandiford  <richard.sandiford@arm.com>

config/
* bootstrap-Og.mk: New file.

gcc/
* doc/install.texi (bootstrap-Og): Document.

From-SVN: r273193

5 years agoMake guality.h handle Yama restricted ptrace mode
Richard Sandiford [Mon, 8 Jul 2019 06:21:05 +0000 (06:21 +0000)]
Make guality.h handle Yama restricted ptrace mode

guality.exp is silently skipped on Linux systems with
kernel.yama.ptrace_scope=1 because gdb fails to attach to the
sanity check test.  This patch uses PR_SET_PTRACER (where available)
to avoid this.

prctl was apparently added in Linux 2.1.57, so I don't think we
need any tests other than __linux for the #include.

2019-07-08  Richard Sandiford  <richard.sandiford@arm.com>

gcc/testsuite/
* gcc.dg/guality/guality.h: Include <sys/prctl.h> on Linux targets.
(main): Use PR_SET_PTRACER where available.

From-SVN: r273192

5 years ago[riscv] Fix ambiguous .md attribute uses
Richard Sandiford [Mon, 8 Jul 2019 06:20:55 +0000 (06:20 +0000)]
[riscv] Fix ambiguous .md attribute uses

This patch is part of a series that fixes ambiguous attribute
uses in .md files, i.e. cases in which attributes didn't use
<ITER:ATTR> to specify an iterator, and in which <ATTR> could
have different values depending on the iterator chosen.

No behavioural change -- produces the same code as before.

2019-07-08  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
* config/riscv/pic.md (*local_pic_load_s<mode>)
(*local_pic_load_u<mode>): Explicitly specify the mode iterator
referenced by <mode>, giving...
(*local_pic_load_s<SUBX:mode>, *local_pic_load_u<SUBX:mode>): ...these.
* config/riscv/riscv.md (*sge<u>_<X:mode><GPR:mode>)
(*slt<u>_<X:mode><GPR:mode>, *sle<u>_<X:mode><GPR:mode>): Explicitly
use <X:MODE> for the mode attribute.

From-SVN: r273191

5 years agoDaily bump.
GCC Administrator [Mon, 8 Jul 2019 00:16:22 +0000 (00:16 +0000)]
Daily bump.

From-SVN: r273190

5 years agore PR tree-optimization/91090 (A suspicious code in tree-ssa-dom.c)
Jeff Law [Sun, 7 Jul 2019 18:42:45 +0000 (12:42 -0600)]
re PR tree-optimization/91090 (A suspicious code in tree-ssa-dom.c)

        PR tree-optimization/91090
        * tree-ssa-dom.c (simplify_stmt_for_jump_threading): Fix logic error
        in handling of ranges to simplify switch statements.

From-SVN: r273184

5 years agors6000: Delete Ffre
Segher Boessenkool [Sun, 7 Jul 2019 16:37:36 +0000 (18:37 +0200)]
rs6000: Delete Ffre

It is unused.

* config/rs6000/rs6000.md (Ffre): Delete.

From-SVN: r273182

5 years ago[Darwin] Make a final check on PIC options.
Iain Sandoe [Sun, 7 Jul 2019 16:34:15 +0000 (16:34 +0000)]
[Darwin] Make a final check on PIC options.

Final check on PCI options; for Darwin these are not dependent on the PIE
ones, although PIE does require PIC to support it.  Specifically, for Darwin,
"fPIC fno-PIE" should result in the same as "-fno-PIE -fPIC".

2019-07-07  Iain Sandoe  <iain@sandoe.co.uk>

* config/darwin.c (darwin_override_options): Make a final check on PIC
options.

From-SVN: r273181

5 years ago[Darwin] Don't jam symbol stubs on for kernel code.
Iain Sandoe [Sun, 7 Jul 2019 16:29:32 +0000 (16:29 +0000)]
[Darwin] Don't jam symbol stubs on for kernel code.

For PPC Darwin, we need the JBSR long jump code to be enabled when generating
kernel code.  Now we have that handled in rs6000.c, we can drop the conflated
setting in the common code.  Symbol stubs are not generated for any X86 case.

2019-07-07  Iain Sandoe  <iain@sandoe.co.uk>

* config/darwin.c (darwin_override_options): Don't jam symbol stubs
on for kernel code.

From-SVN: r273180

5 years agore PR fortran/91077 (Wrong indexing when using a pointer)
Paul Thomas [Sun, 7 Jul 2019 10:53:37 +0000 (10:53 +0000)]
re PR fortran/91077 (Wrong indexing when using a pointer)

2019-07-07  Paul Thomas  <pault@gcc.gnu.org>

PR fortran/91077
* trans-array.c (gfc_conv_scalarized_array_ref) Delete code
that gave symbol backend decl for subref arrays and deferred
length variables.

2019-07-07  Paul Thomas  <pault@gcc.gnu.org>

PR fortran/91077
* gfortran.dg/pointer_array_11.f90 : New test.

From-SVN: r273176

5 years agoPR91068: Fix MIPS fallout from IRA matched operand changes
Richard Sandiford [Sun, 7 Jul 2019 09:49:24 +0000 (09:49 +0000)]
PR91068: Fix MIPS fallout from IRA matched operand changes

PR91068 is a case in which we have (ignoring non-LRA alternatives):

  [(set (match_operand:SI 0 "register_operand" "=l,d?")
(plus:SI (mult:SI (match_operand:SI 1 "register_operand" "d,d")
  (match_operand:SI 2 "register_operand" "d,d"))
 (match_operand:SI 3 "register_operand" "0,d")))
   (clobber (match_scratch:SI 4 "=X,l"))
   (clobber (match_scratch:SI 5 "=X,&d"))]

where the first alternative is one instruction but the second is two.
This is very similar to the case that my recent IRA patches were
supposed to help.  The crucial difference is that the cheap
alternative requires a single-register class while the expensive
alternative uses general registers.

This makes a difference when one of operand 0 or 3 can naturally be
allocated to LO but the other can't.  If IRA makes that allocation,
both alternatives require one reload of equal cost and so the first
alternative clearly wins.

However, if we say that tying operands 0 and 3 saves the cost of a full
move, then all other things being equal, IRA will prefer to allocate
both registers to the same GPR.  The registers will then naturally
fit the second alternative.

This has a more drastic effect in the MIPS case than it should because
using the GPR alternative is much more expensive there than it appears
to the RA.  But that's really a separate problem and something we were
able to live with before my IRA patch.

What makes tying less useful here is the fact that the tied register is
a single-register class.  I think in those circumstances it's better not
to use tied operands at all and instead use "l" for the inputs.
Allocating the input to LO, and allocating the output to LO, then depend
naturally on class costs.  If we decide to allocate at least one of them
to LO, we'll use the cheap alternative, otherwise we'll (correctly) use
the expensive alternative.  This effectively restores the situation
before my IRA patch, but this time making the preference on the input
register more explicit.

I originally wrote the patterns in the early days of IRA, and certainly
well before LRA.  I think they were largely influened by reload rather
than RA proper (see the comment above *mul_acc_si, which is all about
the reload behaviour).  LRA copes with the two-"l" case just fine.

The patch may well cause problems for -mno-lra, but I think we should
cull that option anyway.

2019-07-07  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
PR target/91068
* config/mips/mips.md (*mul_acc_si, *mul_acc_si_r3900, *macc)
(*msac, *msac_using_macc, *mul_sub_si): Use "l" for input operands
instead of matching them to "l" output operands.

From-SVN: r273175

5 years agoFix uninitialised use in mips_split_move
Richard Sandiford [Sun, 7 Jul 2019 09:49:14 +0000 (09:49 +0000)]
Fix uninitialised use in mips_split_move

While testing the fix for PR91068, I hit an rtl checking failure
while building newlib.  mips_split_move was decomposing an address that
happened to be symbolic and then tried to access the REGNO of the base
register field, which wasn't initialised but which by chance pointed to
valid memory.

2019-07-07  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
* config/mips/mips.c (mips_split_move): Zero-initialize addr
and check whether addr.reg is nonnull before using it.

From-SVN: r273174

5 years agoDaily bump.
GCC Administrator [Sun, 7 Jul 2019 00:16:21 +0000 (00:16 +0000)]
Daily bump.

From-SVN: r273173

5 years agoomp-low.c (lower_rec_input_clauses): For lastprivate clauses in ctx->for_simd_scan_ph...
Jakub Jelinek [Sat, 6 Jul 2019 21:58:01 +0000 (23:58 +0200)]
omp-low.c (lower_rec_input_clauses): For lastprivate clauses in ctx->for_simd_scan_phase simd copy the outer var to...

* omp-low.c (lower_rec_input_clauses): For lastprivate clauses in
ctx->for_simd_scan_phase simd copy the outer var to the privatized
variable(s).  For conditional lastprivate look through outer
GIMPLE_OMP_SCAN context.
(lower_omp_1): For conditional lastprivate look through outer
GIMPLE_OMP_SCAN context.

* testsuite/libgomp.c/scan-19.c: New test.
* testsuite/libgomp.c/scan-20.c: New test.

From-SVN: r273169

5 years agoomp-low.c (struct omp_context): Rename combined_into_simd_safelen0 member to combined...
Jakub Jelinek [Sat, 6 Jul 2019 21:56:46 +0000 (23:56 +0200)]
omp-low.c (struct omp_context): Rename combined_into_simd_safelen0 member to combined_into_simd_safelen1.

* omp-low.c (struct omp_context): Rename combined_into_simd_safelen0
member to combined_into_simd_safelen1.
(lower_rec_input_clauses, lower_omp_1): Adjust uses.
(lower_lastprivate_clauses): Likewise.  For conditional lastprivate
clauses if ctx->combined_into_simd_safelen1 put statements after the
predicate conditionalized block rather than into it.

From-SVN: r273168

5 years agoFix recent regression in __atomic_add_dispatch
Jonathan Wakely [Sat, 6 Jul 2019 21:16:38 +0000 (22:16 +0100)]
Fix recent regression in __atomic_add_dispatch

* include/ext/atomicity.h (__exchange_and_add, __atomic_add): Replace
throw() with _GLIBCXX_NOTHROW.
(__atomic_add_dispatch): Return after performing atomic increment.

From-SVN: r273167

5 years ago[s390] Fix ambiguous .md attribute uses
Richard Sandiford [Sat, 6 Jul 2019 08:26:44 +0000 (08:26 +0000)]
[s390] Fix ambiguous .md attribute uses

This patch is part of a series that fixes ambiguous attribute
uses in .md files, i.e. cases in which attributes didn't use
<ITER:ATTR> to specify an iterator, and in which <ATTR> could
have different values depending on the iterator chosen.

The vx-builtins.md part changes the choice of <mode> from the
implicit <VFCMP:mode> to an explicit <VF_HW:mode> (i.e. from the
mode of the comparison result to the mode of the operands being
compared).  That seemed like the intended behaviour given later
patterns like vec_cmpeq<mode>_cc.

The use of BFP in the s390.md LNDFR pattern looks like a typo,
since the operand to (abs ...) has to have the same mode as the result.
The only effect before this series was to create some extra variants
that would never match, making it harmless apart from very minor code
bloat.

2019-07-06  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
* config/s390/s390.md (*negabs<FP:mode>2_nocc): Use FP for
operand 1.
* config/s390/vx-builtins.md (*vec_cmp<insn_cmp><mode>_cconly):
Make the choice of <mode> explicit, giving...
(*vec_cmp<insn_cmp><VF_HW:mode>_cconly): ...this.

From-SVN: r273162

5 years ago[i386] Fix ambiguous .md attribute uses
Richard Sandiford [Sat, 6 Jul 2019 08:26:33 +0000 (08:26 +0000)]
[i386] Fix ambiguous .md attribute uses

This patch is part of a series that fixes ambiguous attribute
uses in .md files, i.e. cases in which attributes didn't use
<ITER:ATTR> to specify an iterator, and in which <ATTR> could
have different values depending on the iterator chosen.

No behavioural change except for dropping the unused *andnot<mode>3_bcst
permutations.

2019-07-06  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
* config/i386/i386.md (*fop_<X87MODEF:mode>_3_i387)
(l<rounding_insn><MODEF:mode><SWI48:mode>2): Fix ambiguous uses
of .md attributes.
* config/i386/sse.md (*avx512pf_gatherpf<mode>sf_mask)
(*avx512pf_gatherpf<mode>df_mask, *avx512pf_scatterpf<mode>sf_mask)
(*avx512pf_scatterpf<mode>df_mask, *avx2_gathersi<mode>)
(*avx2_gathersi<mode>_2, *avx2_gatherdi<mode>)
(*avx2_gatherdi<mode>_2, *avx2_gatherdi<mode>_3): Likewise.
(*avx2_gatherdi<mode>_4, *avx512f_gathersi<mode>): Likewise.
(*avx512f_gathersi<mode>_2, *avx512f_gatherdi<mode>): Likewise.
(*avx512f_gatherdi<mode>_2, *avx512f_scattersi<mode>): Likewise.
(*avx512f_scatterdi<mode>): Likewise.
(*andnot<mode>3_bcst): Fix VI/VI48_AVX512VL typo.

From-SVN: r273161

5 years ago[h8300] Fix ambiguous .md attribute uses
Richard Sandiford [Sat, 6 Jul 2019 08:26:11 +0000 (08:26 +0000)]
[h8300] Fix ambiguous .md attribute uses

This patch is part of a series that fixes ambiguous attribute
uses in .md files, i.e. cases in which attributes didn't use
<ITER:ATTR> to specify an iterator, and in which <ATTR> could
have different values depending on the iterator chosen.

No behavioural change -- produces the same code as before.

2019-07-06  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
* config/h8300/h8300.md (*push1_h8300hs_<mode>): Explicitly
specify the mode iterator referenced by <mode>, giving...
(*push1_h8300hs_<QHI:mode>): ...this.

From-SVN: r273160

5 years ago[amdgcn] Fix ambiguous .md attribute uses
Richard Sandiford [Sat, 6 Jul 2019 08:26:02 +0000 (08:26 +0000)]
[amdgcn] Fix ambiguous .md attribute uses

This patch is part of a series that fixes ambiguous attribute
uses in .md files, i.e. cases in which attributes didn't use
<ITER:ATTR> to specify an iterator, and in which <ATTR> could
have different values depending on the iterator chosen.

I think this is a genuine bugfix for the case in which the 1REG_MODE
and 1REG_ALT are different, since previously we would use the 1REG_MODE
for both the comparison and the select, even though the operands being
compared are 1REG_ALT rather than 1REG_MODE.

2019-07-06  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
* config/gcn/gcn-valu.md
(vcond<VEC_1REG_MODE:mode><VEC_1REG_ALT:mode>): Use
gen_vec_cmp<VEC_1REG_ALT:mode>di rather than (implicitly)
gen_vec_cmp<VEC_1REG_MODE:mode>di.  Explicitly use
gen_vcond_mask_<VEC_1REG_MODE:mode>di.
(vcond<VEC_1REG_MODE:mode><VEC_1REG_ALT:mode>_exec): Likewise,
but using the _exec comparison patterns.
(vcondu<VEC_1REG_INT_MODE:mode><VEC_1REG_INT_ALT:mode>): Use
gen_vec_cmp<VEC_1REG_INT_ALT:mode>di rather than (implicitly)
gen_vec_cmp<VEC_1REG_INT_MODE:mode>di.  Explicitly use
gen_vcond_mask_<VEC_1REG_INT_MODE:mode>di.
(vcondu<VEC_1REG_INT_MODE:mode><VEC_1REG_INT_ALT:mode>_exec): Likewise,
but using the _exec comparison patterns.

From-SVN: r273159

5 years ago[arm] Fix ambiguous .md attribute uses
Richard Sandiford [Sat, 6 Jul 2019 08:25:26 +0000 (08:25 +0000)]
[arm] Fix ambiguous .md attribute uses

This patch is part of a series that fixes ambiguous attribute
uses in .md files, i.e. cases in which attributes didn't use
<ITER:ATTR> to specify an iterator, and in which <ATTR> could
have different values depending on the iterator chosen.

I think this is a genuine bugfix for Thumb-1, since previously the
LDREX width was taken from the SImode success result rather than the
memory mode:

-#define HAVE_atomic_compare_and_swapt1qi_1 ((TARGET_HAVE_LDREX && TARGET_HAVE_MEMORY_BARRIER) && (TARGET_THUMB1))
-#define HAVE_atomic_compare_and_swapt1hi_1 ((TARGET_HAVE_LDREX && TARGET_HAVE_MEMORY_BARRIER) && (TARGET_THUMB1))
-#define HAVE_atomic_compare_and_swapt1di_1 ((TARGET_HAVE_LDREX && TARGET_HAVE_MEMORY_BARRIER) && (TARGET_THUMB1))
+#define HAVE_atomic_compare_and_swapt1qi_1 ((TARGET_HAVE_LDREXBH && TARGET_HAVE_MEMORY_BARRIER) && (TARGET_THUMB1))
+#define HAVE_atomic_compare_and_swapt1hi_1 ((TARGET_HAVE_LDREXBH && TARGET_HAVE_MEMORY_BARRIER) && (TARGET_THUMB1))
+#define HAVE_atomic_compare_and_swapt1di_1 ((TARGET_HAVE_LDREXD && ARM_DOUBLEWORD_ALIGN \
+       && TARGET_HAVE_MEMORY_BARRIER) && (TARGET_THUMB1))

The same goes for the predicate and constraints in
@atomic_compare_and_swapt1di_1, which previously used the
SI values from the success result.

2019-07-06  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
* config/arm/sync.md
(@atomic_compare_and_swap<CCSI:arch><NARROW:mode>_1): Use
<NARROW:sync_predtab> instead of (implicitly) <CCSI:sync_predtab>.
(@atomic_compare_and_swap<CCSI:arch><SIDI:mode>_1): Likewise
<SIDI:sync_predtab>.  Use <SIDI:cas_cmp_operand> and
<SIDI:cas_cmp_str>.

From-SVN: r273158

5 years agoomp-low.c (struct omp_context): Add for_simd_scan_phase member.
Jakub Jelinek [Sat, 6 Jul 2019 07:53:48 +0000 (09:53 +0200)]
omp-low.c (struct omp_context): Add for_simd_scan_phase member.

* omp-low.c (struct omp_context): Add for_simd_scan_phase member.
(maybe_lookup_ctx): Add forward declaration.
(omp_find_scan): Likewise.  Walk into body of simd if composited
with worksharing loop.
(scan_omp_simd_scan): New function.
(scan_omp_1_stmt): Call it.
(lower_rec_simd_input_clauses): Don't create rvar nor rvar2 if
ctx->for_simd_scan_phase.
(lower_rec_input_clauses): Do much less work for inscan reductions
in ctx->for_simd_scan_phase is_simd regions.
(lower_omp_scan): Set is_simd also on simd constructs composited
with worksharing loop, unless ctx->for_simd_scan_phase.  Never emit
a sorry message.  Don't change GIMPLE_OMP_SCAN stmts into nops and
emit their body after in simd constructs composited with worksharing
loop.
(lower_omp_for_scan): Handle worksharing loop composited with simd.

* c-c++-common/gomp/scan-4.c: Don't expect sorry message.

* testsuite/libgomp.c/scan-11.c: New test.
* testsuite/libgomp.c/scan-12.c: New test.
* testsuite/libgomp.c/scan-13.c: New test.
* testsuite/libgomp.c/scan-14.c: New test.
* testsuite/libgomp.c/scan-15.c: New test.
* testsuite/libgomp.c/scan-16.c: New test.
* testsuite/libgomp.c/scan-17.c: New test.
* testsuite/libgomp.c/scan-18.c: New test.
* testsuite/libgomp.c++/scan-9.C: New test.
* testsuite/libgomp.c++/scan-10.C: New test.
* testsuite/libgomp.c++/scan-11.C: New test.
* testsuite/libgomp.c++/scan-12.C: New test.
* testsuite/libgomp.c++/scan-13.C: New test.
* testsuite/libgomp.c++/scan-14.C: New test.
* testsuite/libgomp.c++/scan-15.C: New test.
* testsuite/libgomp.c++/scan-16.C: New test.

From-SVN: r273157

5 years agore PR tree-optimization/91096 (Openmp vector max reduction incorrect)
Jakub Jelinek [Sat, 6 Jul 2019 07:50:44 +0000 (09:50 +0200)]
re PR tree-optimization/91096 (Openmp vector max reduction incorrect)

PR tree-optimization/91096
* gcc.dg/vect/vect-simd-10.c (FLT_MIN_VALUE): Define.
(bar, main): Use it instead of -__builtin_inff ().
* gcc.dg/vect/vect-simd-14.c (FLT_MIN_VALUE): Define.
(bar, main): Use it instead of -__builtin_inff ().

From-SVN: r273156

5 years agoomp-low.c (omp_find_scan): Make static.
Jakub Jelinek [Sat, 6 Jul 2019 07:49:59 +0000 (09:49 +0200)]
omp-low.c (omp_find_scan): Make static.

* omp-low.c (omp_find_scan): Make static.
(lower_omp_for_scan): Fix order of merge arguments in input phase of
the second loop, var2 represents the first partial sum and so needs
to go before rprivb[ivar].

From-SVN: r273155

5 years agoDaily bump.
GCC Administrator [Sat, 6 Jul 2019 00:16:36 +0000 (00:16 +0000)]
Daily bump.

From-SVN: r273154

5 years agore PR c++/67184 (Missed optimization with C++11 final specifier)
Jakub Jelinek [Fri, 5 Jul 2019 20:51:44 +0000 (22:51 +0200)]
re PR c++/67184 (Missed optimization with C++11 final specifier)

PR c++/67184
PR c++/69445
* call.c (build_new_method_call_1): Remove set but not used variable
binfo.

From-SVN: r273149

5 years ago[Darwin.PPC] Remove dead code.
Iain Sandoe [Fri, 5 Jul 2019 18:26:26 +0000 (18:26 +0000)]
[Darwin.PPC] Remove dead code.

TARGET_LINK_STACK is unused on Darwin, and only relevant to a processor on
which the port was never released.

2019-07-05  Iain Sandoe  <iain@sandoe.co.uk>

* config/rs6000/rs6000-logue.c: Remove unused code.

From-SVN: r273148

5 years agoPR c++/67184 (again)
Paolo Carlini [Fri, 5 Jul 2019 18:03:05 +0000 (18:03 +0000)]
PR c++/67184 (again)

/cp
2019-07-05  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/67184 (again)
PR c++/69445
* call.c (build_over_call): Devirtualize user-defined operators
coming from a base too.
(build_new_method_call_1): Do not devirtualize here.

/testsuite
2019-07-05  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/67184 (again)
PR c++/69445
* g++.dg/other/final4.C: New.

From-SVN: r273147

5 years ago* tree-ssa-loop-manip.c (create_iv): Add missing guard for gsi_end_p.
Eric Botcazou [Fri, 5 Jul 2019 17:38:28 +0000 (17:38 +0000)]
* tree-ssa-loop-manip.c (create_iv): Add missing guard for gsi_end_p.

From-SVN: r273145

5 years agoFix ODR violations in code using <ext/atomicity.h>
Jonathan Wakely [Fri, 5 Jul 2019 16:10:47 +0000 (17:10 +0100)]
Fix ODR violations in code using <ext/atomicity.h>

Because the inline versions of __exchange_and_add and __atomic_add are
also marked static, they cannot be used from templates or other inline
functions without ODR violations. This change gives them external
linkage, but adds the always_inline attribute.

     * include/ext/atomicity.h [_GLIBCXX_ATOMIC_BUILTINS] (__atomic_add)
     (__exchange_and_add): Replace static specifier with always_inline
     attribute.
     (__exchange_and_add_single, __atomic_add_single): Likewise.
     (__exchange_and_add_dispatch, __atomic_add_dispatch): Likewise. Also
     combine !__gthread_active_p() and !__GTHREADS branches.

From-SVN: r273144

5 years agoTweak error message for mapped parameters.
Andrew Stubbs [Fri, 5 Jul 2019 16:00:46 +0000 (16:00 +0000)]
Tweak error message for mapped parameters.

2019-07-05  Andrew Stubbs  <ams@codesourcery.com>

gcc/fortran/
* openmp.c (resolve_omp_clauses): Add custom error messages for
parameters in map clauses.

From-SVN: r273143

5 years agoDR 1813 PR c++/83374 - __is_standard_layout wrong for a class with repeated bases.
Marek Polacek [Fri, 5 Jul 2019 14:45:30 +0000 (14:45 +0000)]
DR 1813 PR c++/83374 - __is_standard_layout wrong for a class with repeated bases.

DR 1813
PR c++/83374 - __is_standard_layout wrong for a class with repeated bases.
* class.c (check_bases): Set CLASSTYPE_NON_STD_LAYOUT for a class if
CLASSTYPE_REPEATED_BASE_P is true.

* g++.dg/ext/is_std_layout3.C: New test.
* g++.dg/ext/is_std_layout4.C: New test.

From-SVN: r273139

5 years ago[PATCH][GCC][AARCH64] PR target/90712 Fix gcc.dg/rtl/aarch64/subs_adds_sp.c regression
Sam Tebbs [Fri, 5 Jul 2019 13:16:55 +0000 (13:16 +0000)]
[PATCH][GCC][AARCH64] PR target/90712 Fix gcc.dg/rtl/aarch64/subs_adds_sp.c regression

gcc/
2019-07-05  Sam Tebbs  <sam.tebbs@arm.com>

PR target/90712
* aarch64/aarch64.c (aarch64_post_cfi_startproc): Replace thunk check
with a frame laid out check.

From-SVN: r273138

5 years agotree-ssa-sccvn.c (vn_reference_lookup_3): Valueize RHS when comparing against a store...
Richard Biener [Fri, 5 Jul 2019 12:53:19 +0000 (12:53 +0000)]
tree-ssa-sccvn.c (vn_reference_lookup_3): Valueize RHS when comparing against a store with possibly the same value.

2019-07-05  Richard Biener  <rguenther@suse.de>

* tree-ssa-sccvn.c (vn_reference_lookup_3): Valueize RHS
when comparing against a store with possibly the same value.

* gcc.dg/tree-ssa/ssa-fre-77.c: New testcase.

From-SVN: r273136

5 years agore PR tree-optimization/91091 ([missed optimization] Missing optimization in unaliase...
Richard Biener [Fri, 5 Jul 2019 12:50:45 +0000 (12:50 +0000)]
re PR tree-optimization/91091 ([missed optimization] Missing optimization in unaliased pointers)

2019-07-05  Richard Biener  <rguenther@suse.de>

PR tree-optimization/91091
* tree-ssa-alias.h (get_continuation_for_phi): Add tbaa_p parameter.
(walk_non_aliased_vuses): Likewise.
* tree-ssa-alias.c (maybe_skip_until): Pass down tbaa_p.
(get_continuation_for_phi): New tbaa_p parameter and pass
it down.
(walk_non_aliased_vuses): Likewise.
* ipa-prop.c (determine_known_aggregate_parts): Adjust.
* tree-ssa-pre.c (translate_vuse_through_block): Likewise.
* tree-ssa-scopedtables.c (avail_exprs_stack::lookup_avail_expr):
Likewise.
* tree-ssa-sccvn.c (struct vn_walk_cb_data): Add tbaa_p flag.
(adjust_offsets_for_equal_base_address): New function.
(vn_reference_lookup_3): Use it to catch more base equivalences.
Handle and pass down tbaa_p flag.
(vn_reference_lookup_pieces): Adjust.
(vn_reference_lookup): Remove alias-set altering, instead pass
down false as tbaa_p.

* gcc.dg/tree-ssa/pr91091-2.c: New testcase.
* gcc.dg/tree-ssa/ssa-fre-70.c: Likewise.
* gcc.dg/tree-ssa/ssa-fre-71.c: Likewise.
* gcc.dg/tree-ssa/ssa-fre-72.c: Likewise.

From-SVN: r273135

5 years agore PR tree-optimization/91091 ([missed optimization] Missing optimization in unaliase...
Richard Biener [Fri, 5 Jul 2019 12:48:42 +0000 (12:48 +0000)]
re PR tree-optimization/91091 ([missed optimization] Missing optimization in unaliased pointers)

2019-07-05  Richard Biener  <rguenther@suse.de>

PR tree-optimization/91091
* tree-ssa-sccvn.c (vn_reference_lookup_3): Overlap of
accesses can happen with -fno-strict-aliasing.

* gcc.dg/tree-ssa/pr91091-1.c: New testcase.
* gcc.dg/tree-ssa/ssa-fre-61.c: Adjust.

From-SVN: r273134

5 years agotree-ssa-alias.c (alias_stats): Add nonoverlapping_component_refs_since_match_p_must_...
Jan Hubicka [Fri, 5 Jul 2019 09:25:45 +0000 (11:25 +0200)]
tree-ssa-alias.c (alias_stats): Add nonoverlapping_component_refs_since_match_p_must_overlap.

* tree-ssa-alias.c (alias_stats): Add
nonoverlapping_component_refs_since_match_p_must_overlap.
(dump_alias_stats): Print it.
(nonoverlapping_component_refs_since_match_p): Add early exit.
(nonoverlapping_component_refs_p): Do not account early exit.

From-SVN: r273133

5 years agoexcept.c (emit_to_new_bb_before): Make sure to put a location on SEQ.
Eric Botcazou [Fri, 5 Jul 2019 08:39:13 +0000 (08:39 +0000)]
except.c (emit_to_new_bb_before): Make sure to put a location on SEQ.

* except.c (emit_to_new_bb_before): Make sure to put a location on SEQ.
* tree-eh.c (replace_goto_queue_1) <GIMPLE_GOTO>: Propagate location.
(emit_eh_dispatch): Delete.
(lower_catch): Emit the eh_dispatch manually and set the location of
the first catch statement onto it.
(lower_eh_filter): Emit the eh_dispatch manually and set location.
(lower_eh_dispatch): Propagate location.
* tree-outof-ssa.c (set_location_for_edge): Handle EH edges specially.
(eliminate_build): Likewise.

From-SVN: r273132

5 years agotree-cfg.c (gimple_make_forwarder_block): Propagate location info on phi nodes if...
Eric Botcazou [Fri, 5 Jul 2019 08:28:36 +0000 (08:28 +0000)]
tree-cfg.c (gimple_make_forwarder_block): Propagate location info on phi nodes if possible.

* tree-cfg.c (gimple_make_forwarder_block): Propagate location info on
phi nodes if possible.
* tree-scalar-evolution.c (final_value_replacement_loop): Propagate
location info on the newly created statement.
* tree-ssa-loop-manip.c (create_iv): Propagate location info on the
newly created increment if needed.

From-SVN: r273131

5 years ago[Ada] Incorrect accessibility check
Justin Squirek [Fri, 5 Jul 2019 07:03:58 +0000 (07:03 +0000)]
[Ada] Incorrect accessibility check

This patch fixes an issue whereby anonymous access result types were
treated as having the same accessibility level as typed results instead
of having the level determined by the "master of the call" as per RM
3.10.2 (10).

------------
-- Source --
------------

--  main.adb

with Pack_12; use Pack_12;
with Pack_05; use Pack_05;

procedure Main is
   Obj : aliased Integer;
begin
   Test_Alloc
     (new Rec_T'(Disc => Id_A (Obj'Access))); --  OK

   Id_A (Obj'Access).all := 0;                --  OK
   Id_B (Obj'Access).all := 0;                --  OK
   Id_C (Obj'Access).all := 0;                --  ERROR
end Main;

--  pack_12.ads

pragma Ada_2012;

with Ada.Unchecked_Conversion;

package Pack_12 is
   function Id_A (I : access Integer)
     return access Integer
     is (I);

   type Obj_Ptr is access all Integer;

   function Id_C (I : access Integer)
     return Obj_Ptr
     is (I.all'Access);

   type Rec_T (Disc : access Integer) is null record;

   procedure Test_Alloc (Access_Param : access Rec_T);
end Pack_12;

--  pack_12.adb

package body Pack_12 is
   Dummy : Integer;

   procedure Test_Alloc (Access_Param : access Rec_T) is
   begin
      Dummy := Access_Param.Disc.all;
   end Test_Alloc;
end Pack_12;

--  pack_05.ads

pragma Ada_2005;

with Pack_12; use Pack_12;

package Pack_05 is
   function Id_B (I : access Integer)
     return access Integer
     renames Id_A;
end Pack_05;

-----------------
-- Compilation --
-----------------

$ gnatmake -q main.adb
$ main
raised PROGRAM_ERROR : pack_12.ads:14 accessibility check failed

2019-07-05  Justin Squirek  <squirek@adacore.com>

gcc/ada/

* checks.adb (Apply_Accessibility_Check): Add logic to fetch the
function result accessibility level if one is required within
the generated check.
* exp_ch6.adb (Needs_Result_Accessibility_Level): Modify
controlling elsif block to handle more cases such as anonymous
access results and disable checking for coextensions.

From-SVN: r273130

5 years ago[Ada] Compiler loop on illegal nested accept statement
Ed Schonberg [Fri, 5 Jul 2019 07:03:54 +0000 (07:03 +0000)]
[Ada] Compiler loop on illegal nested accept statement

This patch fixes a "Compilation abandoned" message in a compiler built
with assertions, or a compiler loop otherwise, when an accept statement
contains an illegal accept statement for the same entry.

Compiling accept_in_accept.adb must yield:

accept_in_accept.adb:12:13:
          duplicate accept statement for same entry (RM 9.5.2 (15))

----
procedure accept_in_accept is

   task a_in_a is
      entry a (i : Integer);
   end a_in_a;

   task body a_in_a is
   begin
      select
         accept a (i : Integer) do
            null;
            accept a (i : integer) do
              null;
            end a;
         end a;
      or
         terminate;
      end select;
   end a_in_a;

begin
   a_in_a.a (1);
end accept_in_accept;

2019-07-05  Ed Schonberg  <schonberg@adacore.com>

gcc/ada/

* sem_ch9.adb (Analyze_Accept_Statement): If this is an illegal
accept statement for an enclosing entry abandon analysis to
prevent scope mismatches and potential infinite loops in
compiler.

From-SVN: r273129

5 years ago[Ada] Stabilization of Elaboration order v4.0
Hristian Kirtchev [Fri, 5 Jul 2019 07:03:49 +0000 (07:03 +0000)]
[Ada] Stabilization of Elaboration order v4.0

This patch introduces several changes to the new elaboration order
mechanism:

   * Instantiations processed in the context of invocation graph
     encoding now yield a relation which is later transformed into an
     invocation edge. This ensures that the unit where the instantiation
     resides properly depends on the unit where the body of the generic
     is.

   * The diagnostics of cycles that involve invocation edges now use a
     set to avoid infinite recursion when visiting paths that represent
     recursive code.

   * Various diagnostics that suggest the use of switches have been
     updated to indicate which tool the switches apply to.

   * Bindo can now output the dependencies of various units that specify
     why a predecessor unit must be elaborated prior to a successor
     unit. This functionality implements binder switch -e (output
     complete list of elaboration order dependencies).

   * The output of the elaboration order is now identical to that
     emitted by Binde.

   * The nature of the invocation graph encoding is now recorded in the
     ALI record rather than the Unit record of a unit. This ensures that
     both the spec and body share the same encoding kind.

   * A section on debugging elaboration order issues is now available in
     Bindo.

2019-07-05  Hristian Kirtchev  <kirtchev@adacore.com>

gcc/ada/

* ali.adb (For_Each_Invocation_Construct,
For_Each_Invocation_Relation): New version.
(Scan_ALI): Initialize field Invocation_Graph_Encoding.
(Set_Invocation_Graph_Encoding): Update the setting of the
invocation graph encoding.
* ali.ads: Move field Invocation_Graph_Encoding from Unit_Record
to ALI_Record because the encoding applies to the whole ALI,
rather than one of the units (spec or body) for which the ALI
file was created.
(For_Each_Invocation_Construct, For_Each_Invocation_Relation):
New version.
* bindo.adb: Update the section on switches.  Complete the
section of debugging elaboration order issues.
(Find_Elaboration_Order): Prepare the routine for the switch
from the old to the new elaboration order mechanism.
* bindo-diagnostics.adb (Find_And_Output_Invocation_Paths):
Manage a visited set used by Visit_Vertex.
(Output_All_Cycles_Suggestions,
Output_Dynamic_Model_Suggestions): Clarify the nature of the
suggested switch.
(Output_Elaborate_Body_Transition): Update the diagnostic to
emit a better message.
(Output_Forced_Suggestions, Output_Full_Encoding_Suggestions):
Clarify the nature of the suggested switch.
(Visit_Vertex): Update the parameter profile to add a set of
invokers visited during the transition. This set prevents
infinite exploration of the graph in case the invocations are
recursive.
* bindo-elaborators.adb: Add a use clause for
Bindo.Writers.Dependency_Writers.
(Elaborate_Units_Common): Output the library graph after it has
been augmented with invocation edges. Output just the components
instead of outputting the whole library graph again.
(Elaborate_Units_Dynamic, Elaborate_Units_Static): Output the
dependencies as expressed in the library graph.
* bindo-units.adb (Invocation_Graph_Encoding): Update the
extraction of the invocation graph encoding.
* bindo-writers.adb: Add with and use clauses for Binderr and
Butil.
(palgc, plgc): New debug routine.
(Write_Components): Moved to the spec. Add a header for the
output.
(Write_Dependencies, Write_Dependencies_Of_Vertex,
Write_Dependency_Edge): New routine.
(Write_Elaboration_Order): Update the logic to follow the format
of Binde's order output.
(Write_Library_Graph): Do not output the components every time
the graph is written.
(Write_Unit): Output the invocation graph encoding of the unit.
Output the invocation constructs and relations for the unit
only.
* bindo-writers.ads (Write_Components): Moved from the body.
(Write_Dependencies): New routine.
* bindusg.adb: Prepare the routine for the switch from the old
to the new elaboration order mechanism.
* debug.adb: Binder switch -d_O is now not associated with any
functionality.
* einfo.adb (Is_Elaboration_Target): The attribute applies to
packages, as specified by the comment on the attribute usage.
* opt.ads: Add a global flag which controls the choice between
the new and the legacy elaboration order mechanism.
* sem_elab.adb: Add Package_Target to type Target_Kind.
(Build_Elaborate_Body_Procedure, Build_Elaborate_Procedure,
Build_Elaborate_Spec_Procedure, Check_Elaboration_Scenarios,
Check_SPARK_Model_In_Effect): Use Main_Unit_Entity to obtain the
entity of the main unit.
(Create_Package_Rep): New routine.
(Create_Target_Rep): Add processing for packages.
(Declaration_Placement_Of_Node, Has_Prior_Elaboration): Use
Main_Unit_Entity to obtain the entity of the main
 unit.
(Invocation_Graph_Recording_OK): Prepare the routine for the
switch from the old to the new elaboration order mechanism.
(Main_Unit_Entity): New routine.
(Meet_Elaboration_Requirement,
Process_Conditional_ABE_Variable_Reference): Use
Main_Unit_Entity to obtain the entity of the main unit.
(Process_Invocation_Instantiation): New routine.
(Process_Invocation_Scenario): Add processing for
instantiations.
* switch-b.adb (Scan_Binder_Switches): Prepare the routine for
the switch from the old to the new elaboration order mechanism.

From-SVN: r273128

5 years ago[Ada] Add contracts to Ada.Text_IO for SPARK
Joffrey Huguet [Fri, 5 Jul 2019 07:03:44 +0000 (07:03 +0000)]
[Ada] Add contracts to Ada.Text_IO for SPARK

This change removes the warnings returned when using Ada.Text_IO library
in SPARK. An abstract state and global contracts were added to modelize
the action of Text_IO procedures and function on the memory and the
files.

2019-07-05  Joffrey Huguet  <huguet@adacore.com>

gcc/ada/

* libgnat/a-textio.adb: Add abstract state refinment.
* libgnat/a-textio.ads: Add File_System abstract state.  Add
global contracts, contract cases, preconditions and
postconditions to procedures and functions.
(Set_Input, Set_Output, Set_Error, Standard_Input,
Standard_Output, Standard_Error, Current_Input, Current_Output,
Current_Error): Turn SPARK_Mode off.
(Get_Line): Turn SPARK_Mode off on Get_Line functions.
* libgnat/a-tideio.ads, libgnat/a-tienio.ads,
libgnat/a-tifiio.ads, libgnat/a-tiflio.ads,
libgnat/a-tiinio.ads, libgnat/a-timoio.ads: Add global
contracts, contract cases, preconditions and postconditions to
procedures and functions.

From-SVN: r273127