From e2fa159e1d59089353cdfb11d52aed3450de2915 Mon Sep 17 00:00:00 2001 From: Jeff Law Date: Sun, 22 Feb 1998 12:26:46 -0700 Subject: [PATCH] com.c (ffecom_arglist_expr_): Crash if non-supplied optional arg isn't passed as an address. * com.c (ffecom_arglist_expr_): Crash if non-supplied optional arg isn't passed as an address. Pass null pointer explicitly, instead of via ffecom routine. If incoming argstring is NULL, substitute pointer to "0". Recognize '0' as ending the usual arg stuff, just like '\0'. * com.c (ffecom_arglist_expr_): Pass null pointers for optional args which aren't supplied. More patches from Craig. From-SVN: r18183 --- gcc/f/ChangeLog | 12 ++++++++++++ gcc/f/com.c | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+) diff --git a/gcc/f/ChangeLog b/gcc/f/ChangeLog index bd3d47d5de4..f63413b0cbe 100644 --- a/gcc/f/ChangeLog +++ b/gcc/f/ChangeLog @@ -46,12 +46,24 @@ Mon Dec 1 19:12:36 1997 Craig Burley * intrin.c (ffeintrin_check_): Fix up indentation a bit more. +Mon Dec 1 16:21:08 1997 Craig Burley + + * com.c (ffecom_arglist_expr_): Crash if non-supplied + optional arg isn't passed as an address. + Pass null pointer explicitly, instead of via ffecom routine. + If incoming argstring is NULL, substitute pointer to "0". + Recognize '0' as ending the usual arg stuff, just like '\0'. + Sun Nov 30 22:22:22 1997 Craig Burley * intdoc.c: Minor fix-ups. * intrin.c (ffeintrin_check_): Fix up indentation a bit. +1997-11-17 Dave Love + + * com.c (ffecom_arglist_expr_): Pass null pointers for optional + args which aren't supplied. Fri Oct 10 13:00:48 1997 Craig Burley diff --git a/gcc/f/com.c b/gcc/f/com.c index 4d8e02611f4..63a8d27fee2 100644 --- a/gcc/f/com.c +++ b/gcc/f/com.c @@ -1093,6 +1093,10 @@ ffecom_arglist_expr_ (char *c, ffebld expr) tree item; bool ptr = FALSE; tree wanted = NULL_TREE; + static char zed[] = "0"; + + if (c == NULL) + c = &zed[0]; while (expr != NULL) { @@ -1185,6 +1189,39 @@ ffecom_arglist_expr_ (char *c, ffebld expr) } } + /* We've run out of args in the call; if the implementation expects + more, supply null pointers for them, which the implementation can + check to see if an arg was omitted. */ + + while (*c != '\0' && *c != '0') + { + if (*c == '&') + ++c; + else + assert ("missing arg to run-time routine!" == NULL); + + switch (*(c++)) + { + case '\0': + case 'a': + case 'c': + case 'd': + case 'e': + case 'f': + case 'i': + case 'j': + break; + + default: + assert ("bad arg string code" == NULL); + break; + } + *plist + = build_tree_list (NULL_TREE, + null_pointer_node); + plist = &TREE_CHAIN (*plist); + } + *plist = trail; return list; -- 2.30.2