]> git.ipfire.org Git - thirdparty/gcc.git/commit - gcc/ada/sem_eval.adb
[Ada] System'To_Address not always static
authorBob Duff <duff@adacore.com>
Wed, 14 Nov 2018 11:41:36 +0000 (11:41 +0000)
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>
Wed, 14 Nov 2018 11:41:36 +0000 (11:41 +0000)
commit1e3c434fa08b0ee0e4f9b5ce803e282d8832a559
tree53c1e8aff76e28c94f53a22b6ebaf2c960a5812c
parent43018f5892ff43551abad3f339bcb55cf74c89cf
[Ada] System'To_Address not always static

System'To_Address is supposed to be static when its parameter is static.
This patch fixes a bug in which it is considered nonstatic when used as
the initial value of a variable with the Thread_Local_Storage aspect, so
the compiler incorrectly gives an error when initializing such a
variable with System'To_Address (0).

2018-11-14  Bob Duff  <duff@adacore.com>

gcc/ada/

* sem_attr.adb (To_Address): Simplify setting of
Is_Static_Expression. Remove second (unconditional) call to
Set_Is_Static_Expression -- surely it's not static if the
operand is not.  Initialize Static on declaration.  Do not try
to fold 'To_Address, even though it's static.
* exp_attr.adb (To_Address): Preserve Is_Static_Expression.
* sinfo.ads, sem_eval.ads, sem_eval.adb (Is_Static_Expression,
Is_OK_Static_Expression, Raises_Constraint_Error): Simplify
documentation.  There was too much repetition and redundancy.

From-SVN: r266124
gcc/ada/ChangeLog
gcc/ada/exp_attr.adb
gcc/ada/sem_attr.adb
gcc/ada/sem_eval.adb
gcc/ada/sem_eval.ads
gcc/ada/sinfo.ads