* ch-lang.c (evaluate_subexp_chill case MULTI_SUBSCRIPT): Error
authorPer Bothner <per@bothner.com>
Tue, 5 Mar 1996 07:48:20 +0000 (07:48 +0000)
committerPer Bothner <per@bothner.com>
Tue, 5 Mar 1996 07:48:20 +0000 (07:48 +0000)
if "function" is pointer to non-function.
Fixes PR chill/9095.

gdb/ChangeLog
gdb/ch-lang.c

index 5dfae3d05227488297f9e6840a4e441523f59eaf..5684a43c1c1a35e07c1b033044c1f3a4be037710 100644 (file)
@@ -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.
index 904dc6b71f43eea425ce25794f2167cd972a4134..5c041d74f71400ade01cc9ba67a3947c90eecda2 100644 (file)
@@ -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);
This page took 0.027653 seconds and 4 git commands to generate.