aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Squirek <squirek@adacore.com>2020-04-30 16:04:26 -0400
committerGiuliano Belinassi <giuliano.belinassi@usp.br>2020-08-17 13:14:09 -0300
commitda79ec2dc16ffdc2d4bb720e17577f1bd1b9a884 (patch)
tree5f60328f383c3539d6722d719fd63e9999419af5
parenta2b595369128e24c26b812cf29f1a906f1666715 (diff)
downloadgcc-da79ec2dc16ffdc2d4bb720e17577f1bd1b9a884.zip
gcc-da79ec2dc16ffdc2d4bb720e17577f1bd1b9a884.tar.gz
gcc-da79ec2dc16ffdc2d4bb720e17577f1bd1b9a884.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