aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Squirek <squirek@adacore.com>2020-04-30 16:04:26 -0400
committerPierre-Marie de Rodat <derodat@adacore.com>2020-06-19 04:17:22 -0400
commit650abc2c93ab2e599df3053c8556e70de003dd79 (patch)
tree76d7ddf794b24fe2e9b2fad4f1cafd5f52edbc38
parenta6d7dfbbb2f1fe25e040a31f17c03d292b5b5b61 (diff)
downloadgcc-650abc2c93ab2e599df3053c8556e70de003dd79.zip
gcc-650abc2c93ab2e599df3053c8556e70de003dd79.tar.gz
gcc-650abc2c93ab2e599df3053c8556e70de003dd79.tar.bz2
[Ada] Spurious condition warning on type conversion in return
2020-06-19 Justin Squirek <squirek@adacore.com> gcc/ada/ * sem_warn.adb (Warn_On_Known_Condition): Add general sanity check that asserts the original source node being checked contains an entity. If not, it could be the result of special case expansion for type conversions.
-rw-r--r--gcc/ada/sem_warn.adb1
1 files changed, 1 insertions, 0 deletions
diff --git a/gcc/ada/sem_warn.adb b/gcc/ada/sem_warn.adb
index fe9c467..97d8a94 100644
--- a/gcc/ada/sem_warn.adb
+++ b/gcc/ada/sem_warn.adb
@@ -3520,6 +3520,7 @@ package body Sem_Warn is
if Constant_Condition_Warnings
and then Is_Known_Branch
and then Comes_From_Source (Orig)
+ and then Nkind (Orig) in N_Has_Entity
and then not In_Instance
then
-- Don't warn if comparison of result of attribute against a constant