aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/simplify.c
diff options
context:
space:
mode:
authorSteven G. Kargl <kargl@gcc.gnu.org>2016-08-27 15:38:55 +0000
committerSteven G. Kargl <kargl@gcc.gnu.org>2016-08-27 15:38:55 +0000
commit741b52b54f3b7332b3199a5bd3af12acf0901c13 (patch)
tree4615b33c636ea77b984f41a11584c75bc505e9db /gcc/fortran/simplify.c
parent4aebb4e4a6444400c9592484dab9336754e185e3 (diff)
downloadgcc-741b52b54f3b7332b3199a5bd3af12acf0901c13.zip
gcc-741b52b54f3b7332b3199a5bd3af12acf0901c13.tar.gz
gcc-741b52b54f3b7332b3199a5bd3af12acf0901c13.tar.bz2
re PR fortran/77372 (ICE in simplify_ieee_selected_real_kind, at fortran/simplify.c:7049)
2016-08-27 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/77372 simplify.c (simplify_ieee_selected_real_kind): Check for NULL pointers. 2016-08-27 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/77372 gfortran.dg/pr77372.f90: New test. From-SVN: r239795
Diffstat (limited to 'gcc/fortran/simplify.c')
-rw-r--r--gcc/fortran/simplify.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/gcc/fortran/simplify.c b/gcc/fortran/simplify.c
index 8096a92..6e6566d 100644
--- a/gcc/fortran/simplify.c
+++ b/gcc/fortran/simplify.c
@@ -7044,9 +7044,17 @@ gfc_simplify_compiler_version (void)
gfc_expr *
simplify_ieee_selected_real_kind (gfc_expr *expr)
{
- gfc_actual_arglist *arg = expr->value.function.actual;
- gfc_expr *p = arg->expr, *q = arg->next->expr,
- *rdx = arg->next->next->expr;
+ gfc_actual_arglist *arg;
+ gfc_expr *p = NULL, *q = NULL, *rdx = NULL;
+
+ arg = expr->value.function.actual;
+ p = arg->expr;
+ if (arg->next)
+ {
+ q = arg->next->expr;
+ if (arg->next->next)
+ rdx = arg->next->next->expr;
+ }
/* Currently, if IEEE is supported and this module is built, it means
all our floating-point types conform to IEEE. Hence, we simply handle