Go to file
Hristian Kirtchev 75cfda8b4a [Ada] Task-related circularities in Elaboration order v4.0
This patch adds another suggestion to the elaboration order diagnostics.
An elaboration circularity involving a task activation may be resolved
through pragma Restrictions (No_Entry_Calls_In_Elaboration_Code).

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

--  no_entry_calls.txt

pragma Restrictions (No_Entry_Calls_In_Elaboration_Code);

--  a.ads

package A is
   task type Task_Typ is
      entry Start;
   end Task_Typ;

   procedure Proc;
end A;

--  a.adb

with B;

package body A is
   task body Task_Typ is
   begin
      accept Start;
      B.Proc;
   end Task_Typ;

   Elab : Task_Typ;

   procedure Proc is null;
end A;

--  b.ads

package B is
   procedure Proc;
end B;

--  b.adb

with A;

package body B is
   procedure Proc is
   begin
      A.Proc;
   end Proc;
end B;

--  main.adb

with A;

--  +--> A spec               B spec
--  |      ^                  ^ ^
--  |      |        with      | |
--  |  sbb | +----------------+ | sbb
--  |      | |                  |
--  |      | |   Invocation     |
--  |    A body ------------> B body
--  |      ^                  | |
--  |      |     Invocation   | |
--  |      +------------------+ |
--  |                           |
--  |            Invocation     |
--  +---------------------------+
--
--  The cycle is:
--
--    A body --> A body

procedure Main is begin null; end Main;

----------------------------
-- Compilation and output --
----------------------------

$ gnatmake -f -q main.adb -gnatd_F
$ gnatmake -f -q main.adb -gnatec=no_entry_calls.txt
error: Elaboration circularity detected
info:
info:    Reason:
info:
info:      unit "a (body)" depends on its own elaboration
info:
info:    Circularity:
info:
info:      unit "a (body)" invokes a construct of unit "a (body)" at
             elaboration time
info:        path 1:
info:          elaboration of unit "a (body)"
info:          activation of local task declared at "a.ads":2:14
info:          call to subprogram "proc" declared at "b.ads":2:14
info:          call to subprogram "proc" declared at "a.ads":6:14
info:
info:    Suggestions:
info:
info:      use pragma Restrictions (No_Entry_Calls_In_Elaboration_Code)
info:      use the dynamic elaboration model (compiler switch -gnatE)
info:
gnatmake: *** bind failed.

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

gcc/ada/

	* bindo.ads: Move type Precedence_Kind from the private to the
	visible part of the unit.
	* bindo-augmentors.adb: Remove the use of global data as it is
	bad practice.
	(Augment_Library_Graph): Update the parameter profile.
	(Is_Visited, Set_Is_Visited): Remove.
	(Visit_Elaboration_Root, Visit_Elaboration_Roots): Update the
	parameter profile and comment on usage.
	(Visit_Vertex): Likewise.  Also keep track of which invocation
	edge activates a task.
	* bindo-augmentors.ads (Augment_Library_Graph): Update the
	parameter profile and comment on usage.
	* bindo-builders.adb (Create_Forced_Edge,
	Create_Spec_And_Body_Edge, Create_With_Edge): Update the call to
	Add_Edge.
	* bindo-diagnostics.adb: Add with end use clauses for Restrict
	and Rident.
	(Output_Dynamic_Model_Suggestions): Remove.
	(Output_Invocation_Related_Suggestions): New routine.
	(Output_Suggestions): Output all invocation-related suggestions
	together.
	* bindo-elaborators.adb: Remove types Comparator_Ptr and
	Predicate_Ptr.
	(Find_Best_Vertex): Update the parameter profile.
	* bindo-graphs.adb (Activates_Task): New routine.
	(Add_Body_Before_Spec_Edge): Update the call to
	Add_Edge_With_Return.
	(Add_Edge): Update the parameter profile and the call to
	Add_Edge_With_Return.
	(Add_Edge_With_Return): Update the parameter profile and comment
	on usage.
	(At_Least_One_Edge_Satisfies): New routine.
	(Contains_Elaborate_All_Edge): Reimplement.
	(Contains_Static_Successor_Edge, Contains_Task_Activation): New
	routine.
	(Contains_Weak_Static_Successor): Remove.
	(Is_Static_Successor_Edge): New routine.
	* bindo-graphs.ads: Add types LGE_Predicate_Ptr,
	LGV_Comparator_Ptr, and LGV_Predicate_Ptr.  Update type
	Library_Graph_Edge_Attributes to capture whether an invocation
	edge activates a task.  Update the value of
	No_Library_Graph_Edge_Attributes.
	(Activates_Task): Update the parameter profile and comment on
	usage.
	(Contains_Static_Successor_Edge, Contains_Task_Activation): New
	routines.
	(Contains_Weak_Static_Successor): Remove.
	* doc/gnat_ugn/elaboration_order_handling_in_gnat.rst:
	Update the documentation to reflect the new task-related advice.
	* gnat_ugn.texi: Regenerate.

From-SVN: r273286
2019-07-09 07:55:00 +00:00
config Add a build config for bootstrapping at -Og 2019-07-08 06:21:11 +00:00
contrib mklog/91048: Open ~/.mklog in string mode. 2019-07-02 08:54:31 +03:00
fixincludes [Darwin, fixincludes] Fix Darwin9/10 math.h issues. 2019-06-21 19:18:18 +00:00
gcc [Ada] Task-related circularities in Elaboration order v4.0 2019-07-09 07:55:00 +00:00
gnattools PR81878: fix --disable-bootstrap --enable-languages=ada 2018-11-20 00:07:47 +00:00
gotools Makefile.am (check-go-tool): Only chmod check-go-dir if it exists. 2019-05-27 19:21:22 +00:00
include Fix description of 'GOMP_MAP_FIRSTPRIVATE' 2019-06-19 00:14:52 +02:00
INSTALL
intl iconv.m4 (AM_ICONV_LINK): Don't overwrite CPPFLAGS. 2018-11-07 15:41:21 -07:00
libada Update copyright years. 2019-01-01 13:31:55 +01:00
libatomic [NetBSD] Add support for the Arm EABI. 2019-06-14 14:04:20 +00:00
libbacktrace Makefile.am (BUILDTESTS): Remove test_elf, add test_elf_32 and test_elf_64. 2019-05-24 11:55:21 +00:00
libcc1 [C++ PATCH] Using decls 2019-05-21 14:33:24 +00:00
libcpp Remove another bunch of dead assignment. 2019-07-03 08:34:20 +00:00
libdecnumber Update copyright years. 2019-01-01 13:31:55 +01:00
libffi Update GCC to autoconf 2.69, automake 1.15.1 (PR bootstrap/82856). 2018-10-31 17:03:16 +00:00
libgcc PR middle-end/71924 - missing -Wreturn-local-addr returning alloca result 2019-07-08 22:15:42 -06:00
libgfortran Enable full GFortran library for AMD GCN 2019-06-25 11:41:38 +00:00
libgo compiler: optimize 0,1,2-case select statement 2019-07-04 02:20:37 +00:00
libgomp tree-vect-stmts.c (scan_operand_equal_p): Look through MEM_REF with SSA_NAME address of POINTER_PLUS_EXPR. 2019-07-09 00:11:59 +02:00
libhsail-rt Update copyright years. 2019-01-01 13:31:55 +01:00
libiberty cp-demangle.c: Don't define CP_DYNAMIC_ARRAYS if __STDC_NO_VLA__ is non-zero. 2019-05-31 12:25:48 -06:00
libitm Makefile.am (finclude): Remove. 2019-05-03 09:20:04 +02:00
libobjc re PR target/89093 (C++ exception handling clobbers d8 VFP register) 2019-04-23 12:03:41 +02:00
liboffloadmic PR other/16615 [1/5] 2019-01-09 16:37:45 -05:00
libphobos d/dmd: Merge upstream dmd f8e38c001 2019-06-16 07:50:07 +00:00
libquadmath Update copyright years. 2019-01-01 13:31:55 +01:00
libsanitizer Fix sanitizer_common/sanitizer_posix_libcdep.cc compilation on Solaris 11.5 2019-06-26 10:43:08 +00:00
libssp Update copyright years. 2019-01-01 13:31:55 +01:00
libstdc++-v3 Fix recent regression in __atomic_add_dispatch 2019-07-06 22:16:38 +01:00
libvtv Fix testsuite 2019-02-20 08:07:19 -08:00
lto-plugin lto-plugin, removed unused variable 2019-05-15 14:10:27 +00:00
maintainer-scripts crontab: Snapshots from trunk are now GCC 10 related. 2019-05-04 13:28:49 +00:00
zlib Makefile.am (noinst_LTLIBRARIES): Rename libzgcj_convience.la to libz_convenience.la. 2019-01-21 17:23:58 +00:00
.dir-locals.el
.gitattributes
.gitignore
ABOUT-NLS
ar-lib Update GCC to autoconf 2.69, automake 1.15.1 (PR bootstrap/82856). 2018-10-31 17:03:16 +00:00
ChangeLog MAINTAINERS (Write After Approval): Remove myself, already listed in RISC-V port maitainer. 2019-07-08 13:21:21 +00:00
ChangeLog.jit
ChangeLog.tree-ssa
compile
config-ml.in
config.guess Update config.guess, config.sub (PR target/88535) 2019-01-03 11:28:27 +00:00
config.rpath
config.sub Update config.guess, config.sub (PR target/88535) 2019-01-03 11:28:27 +00:00
configure Sync top-level change from gdb 2019-06-15 21:32:03 +00:00
configure.ac Sync top-level change from gdb 2019-06-15 21:32:03 +00:00
COPYING
COPYING3
COPYING3.LIB
COPYING.LIB
COPYING.RUNTIME
depcomp
install-sh
libtool-ldflags
libtool.m4 Update GCC to autoconf 2.69, automake 1.15.1 (PR bootstrap/82856). 2018-10-31 17:03:16 +00:00
lt~obsolete.m4
ltgcc.m4
ltmain.sh
ltoptions.m4
ltsugar.m4
ltversion.m4
MAINTAINERS MAINTAINERS (Write After Approval): Remove myself, already listed in RISC-V port maitainer. 2019-07-08 13:21:21 +00:00
Makefile.def Sync top-level change from gdb 2019-06-15 21:32:03 +00:00
Makefile.in Sync top-level change from gdb 2019-06-15 21:32:03 +00:00
Makefile.tpl re PR lto/85574 (LTO bootstapped binaries differ) 2019-05-02 13:58:47 +00:00
missing
mkdep
mkinstalldirs
move-if-change
multilib.am Update GCC to autoconf 2.69, automake 1.15.1 (PR bootstrap/82856). 2018-10-31 17:03:16 +00:00
README
symlink-tree
test-driver Update GCC to autoconf 2.69, automake 1.15.1 (PR bootstrap/82856). 2018-10-31 17:03:16 +00:00
ylwrap

This directory contains the GNU Compiler Collection (GCC).

The GNU Compiler Collection is free software.  See the files whose
names start with COPYING for copying permission.  The manuals, and
some of the runtime libraries, are under different terms; see the
individual source files for details.

The directory INSTALL contains copies of the installation information
as HTML and plain text.  The source of this information is
gcc/doc/install.texi.  The installation information includes details
of what is included in the GCC sources and what files GCC installs.

See the file gcc/doc/gcc.texi (together with other files that it
includes) for usage and porting information.  An online readable
version of the manual is in the files gcc/doc/gcc.info*.

See http://gcc.gnu.org/bugs/ for how to report bugs usefully.

Copyright years on GCC source files may be listed using range
notation, e.g., 1987-2012, indicating that every year in the range,
inclusive, is a copyrightable year that could otherwise be listed
individually.