Go to file
Ed Schonberg 728fedc29c [Ada] Compiler fails to reject illegal store of anonymous_access_to_subprogram
GNAT properly rejects an attempt to assign an access_to_subprogram formal
to a local variable, according to accessibiiity rules. This patch forces the
same behavior on the use of such a formal in an object declaration.

Compiling store_anon.adb must yield:

  store_anon.adb:7:35: illegal attempt to store anonymous access to subprogram
  store_anon.adb:7:35: value has deeper accessibility than any master
   (RM 3.10.2 (13))
 store_anon.adb:7:35: use named access type for "P" instead of access parameter

----
package Store_Anon is
   procedure Store (P : not null access procedure);

   procedure Invoke;
end Store_Anon;
----
package body Store_Anon is
   type P_Ptr is access procedure;

   Stored : P_Ptr;

   procedure Store (P : not null access procedure) is
      Illegal : constant P_Ptr := P;
   begin -- Store
      Stored := Illegal;
   end Store;

   procedure Invoke is
      -- Empty
   begin -- Invoke
      Stored.all;
   end Invoke;
end Store_Anon;

2018-05-23  Ed Schonberg  <schonberg@adacore.com>

gcc/ada/

	* sem_ch3.adb (Analyze_Object_Declaration): If expression is an
	anonymous_access_to_ subprogram formal, apply a conversion to force an
	accsssibility check that will fail statically, enforcing 3.10.2 (13).

From-SVN: r260576
2018-05-23 10:22:03 +00:00
config
contrib
fixincludes
gcc [Ada] Compiler fails to reject illegal store of anonymous_access_to_subprogram 2018-05-23 10:22:03 +00:00
gnattools
gotools
include
INSTALL
intl
libada
libatomic
libbacktrace
libcc1
libcpp line-map.c (linemap_init): Use placement new. 2018-05-17 19:28:34 -04:00
libdecnumber
libffi
libgcc RISC-V: Add RV32E support. 2018-05-18 15:53:55 -07:00
libgfortran
libgo
libgomp re PR fortran/85841 ([F2018] reject deleted features) 2018-05-21 22:48:59 +02:00
libhsail-rt
libiberty
libitm PR c++/58407 - deprecated implicit copy ops. 2018-05-18 16:02:48 -04:00
libmpx
libobjc
liboffloadmic
libquadmath
libsanitizer
libssp
libstdc++-v3 Add support for opening file streams from wide character strings 2018-05-21 18:18:35 +01:00
libvtv
lto-plugin
maintainer-scripts
zlib
.dir-locals.el
.gitattributes
.gitignore
ABOUT-NLS
ChangeLog * MAINTAINERS (loop-optimizer): Add myself. 2018-05-22 08:26:50 +00:00
ChangeLog.jit
ChangeLog.tree-ssa
compile
config-ml.in
config.guess
config.rpath
config.sub
configure
configure.ac
COPYING
COPYING3
COPYING3.LIB
COPYING.LIB
COPYING.RUNTIME
depcomp
install-sh
libtool-ldflags
libtool.m4
lt~obsolete.m4
ltgcc.m4
ltmain.sh
ltoptions.m4
ltsugar.m4
ltversion.m4
MAINTAINERS * MAINTAINERS (loop-optimizer): Add myself. 2018-05-22 08:26:50 +00:00
Makefile.def
Makefile.in
Makefile.tpl
missing
mkdep
mkinstalldirs
move-if-change
README
symlink-tree
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.