[Ada] Crash on improper pragma Weak_External
authorEd Schonberg <schonberg@adacore.com>
Mon, 1 Jul 2019 13:37:11 +0000 (13:37 +0000)
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>
Mon, 1 Jul 2019 13:37:11 +0000 (13:37 +0000)
commitd8f8b16648d012d68ccb148a808c9a404960ea20
tree94968be63058385a8167d7cccdbab83574357188
parent9d8aaa4e00958418c01a4aee5a08261108eaf997
[Ada] Crash on improper pragma Weak_External

This patch adds a guard on the use of pragma Weak_External. This pragma
affects link-time addresses of entities, and does not apply to types.
Previous to this patch the compiler would abort on a misuse of the
pragma.

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

gcc/ada/

* sem_prag.adb (Analyze_Pragma, case Weak_External): Pragma only
applies to entities with run-time addresses, not to types.

gcc/testsuite/

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

From-SVN: r272876
gcc/ada/ChangeLog
gcc/ada/sem_prag.adb
gcc/testsuite/ChangeLog
gcc/testsuite/gnat.dg/weak3.adb [new file with mode: 0644]
gcc/testsuite/gnat.dg/weak3.ads [new file with mode: 0644]