This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/77372] ICE in simplify_ieee_selected_real_kind, at fortran/simplify.c:7049
- From: "kargl at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 24 Aug 2016 19:36:45 +0000
- Subject: [Bug fortran/77372] ICE in simplify_ieee_selected_real_kind, at fortran/simplify.c:7049
- Auto-submitted: auto-generated
- References: <bug-77372-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77372
--- Comment #2 from kargl at gcc dot gnu.org ---
Thous shalt dereference NULL pointers.
Index: simplify.c
===================================================================
--- simplify.c (revision 239737)
+++ simplify.c (working copy)
@@ -7044,9 +7044,19 @@ 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;
+ if (arg->expr)
+ p = arg->expr;
+ if (arg->next)
+ {
+ if (arg->next->expr)
+ q = arg->next->expr;
+ if (arg->next->next && arg->next->next->expr)
+ 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