aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPer Bothner <per@bothner.com>1996-03-05 07:48:20 +0000
committerPer Bothner <per@bothner.com>1996-03-05 07:48:20 +0000
commit02e6e53d84b82102c7d86e0fe8d97f514231ba8f (patch)
treeb077d16d714e5b435eeb4dfd48d9ad8ac7daa7e3
parent4b295517860a57dc015c3d29da52c0d80b074c2a (diff)
downloadgdb-02e6e53d84b82102c7d86e0fe8d97f514231ba8f.zip
gdb-02e6e53d84b82102c7d86e0fe8d97f514231ba8f.tar.gz
gdb-02e6e53d84b82102c7d86e0fe8d97f514231ba8f.tar.bz2
* ch-lang.c (evaluate_subexp_chill case MULTI_SUBSCRIPT): Error
if "function" is pointer to non-function. Fixes PR chill/9095.
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/ch-lang.c17
2 files changed, 13 insertions, 9 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 5dfae3d..5684a43 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+Mon Mar 4 23:44:16 1996 Per Bothner <bothner@kalessin.cygnus.com>
+
+ * ch-lang.c (evaluate_subexp_chill case MULTI_SUBSCRIPT): Error
+ if "function" is pointer to non-function.
+
Mon Mar 4 17:47:03 1996 Stan Shebs <shebs@andros.cygnus.com>
* top.c (print_gdb_version): Update copyright year.
diff --git a/gdb/ch-lang.c b/gdb/ch-lang.c
index 904dc6b..5c041d7 100644
--- a/gdb/ch-lang.c
+++ b/gdb/ch-lang.c
@@ -423,6 +423,10 @@ evaluate_subexp_chill (expect_type, exp, pos, noside)
switch (TYPE_CODE (type))
{
case TYPE_CODE_PTR:
+ type = check_typedef (TYPE_TARGET_TYPE (type));
+ if (!type || TYPE_CODE (type) || TYPE_CODE_FUNC)
+ error ("reference value used as function");
+ /* ... fall through ... */
case TYPE_CODE_FUNC:
/* It's a function call. */
if (noside == EVAL_AVOID_SIDE_EFFECTS)
@@ -433,16 +437,11 @@ evaluate_subexp_chill (expect_type, exp, pos, noside)
argvec = (value_ptr *) alloca (sizeof (value_ptr) * (nargs + 2));
argvec[0] = arg1;
tem = 1;
- if (type && TYPE_CODE (type) == TYPE_CODE_PTR)
- type = check_typedef (TYPE_TARGET_TYPE (type));
- if (type && TYPE_CODE (type) == TYPE_CODE_FUNC)
+ for (; tem <= nargs && tem <= TYPE_NFIELDS (type); tem++)
{
- for (; tem <= nargs && tem <= TYPE_NFIELDS (type); tem++)
- {
- argvec[tem]
- = evaluate_subexp_chill (TYPE_FIELD_TYPE (type, tem-1),
- exp, pos, noside);
- }
+ argvec[tem]
+ = evaluate_subexp_chill (TYPE_FIELD_TYPE (type, tem-1),
+ exp, pos, noside);
}
for (; tem <= nargs; tem++)
argvec[tem] = evaluate_subexp_with_coercion (exp, pos, noside);