]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: re PR middle-end/13448 (gcc 3.3.2, internal error when -O3 and trying to...
authorGabriel Dos Reis <gdr@cs.tamu.edu>
Fri, 12 Mar 2004 22:43:29 +0000 (22:43 +0000)
committerGabriel Dos Reis <gdr@gcc.gnu.org>
Fri, 12 Mar 2004 22:43:29 +0000 (22:43 +0000)
        Backport
        2004-02-27  Mark Mitchell  <mark@codesourcery.com>
        PR middle-end/13448
        * c-tree.h (readonly_warning): Rename to ...
        (readonly_error): ... this.
        * c-typeck.c (build_unary_op): Adjust accordingly.
        (readonly_warning): Rename to ...
        (readonly_error): ... this and issue errors, not warnings.
        (build_modify_expr): Call readonly_error, not
        readonly_warning.
        (c_expand_asm_operands): Likewise.
        * tree-inline.c (optimize_inline_calls): Do not inline
        functions after errors have occurred.

From-SVN: r79409

gcc/ChangeLog
gcc/c-tree.h
gcc/c-typeck.c
gcc/tree-inline.c

index 41e9e8128528d7f4a478e6579425d96ae3512cfd..267d953a1c8313c95dc7fd5fada6b821ddbd714f 100644 (file)
@@ -1,3 +1,18 @@
+2004-03-12  Gabriel Dos Reis  <gdr@cs.tamu.edu>
+
+       Backport
+       2004-02-27  Mark Mitchell  <mark@codesourcery.com>
+       PR middle-end/13448
+       * c-tree.h (readonly_warning): Rename to ...
+       (readonly_error): ... this.
+       * c-typeck.c (build_unary_op): Adjust accordingly.
+       (readonly_warning): Rename to ...
+       (readonly_error): ... this and issue errors, not warnings.
+       (build_modify_expr): Call readonly_error, not readonly_warning.
+       (c_expand_asm_operands): Likewise.
+       * tree-inline.c (optimize_inline_calls): Do not inline
+       functions after errors have occurred.
+
 2004-03-12  Philip Blundell  <philb@gnu.org>
 
        PR target/10730
index 159c235224e230fc94b48cc47b1789dd49edd910..1e7b3cc061a98ed43b3c57c85986befd7a81f2a8 100644 (file)
@@ -270,7 +270,7 @@ extern tree build_external_ref                      PARAMS ((tree, int));
 extern tree parser_build_binary_op              PARAMS ((enum tree_code,
                                                         tree, tree));
 extern int c_tree_expr_nonnegative_p           PARAMS ((tree));
-extern void readonly_warning                   PARAMS ((tree, const char *));
+extern void readonly_error                     PARAMS ((tree, const char *));
 extern tree build_conditional_expr              PARAMS ((tree, tree, tree));
 extern tree build_compound_expr                 PARAMS ((tree));
 extern tree c_cast_expr                                PARAMS ((tree, tree));
index 25731f716ebe5f65bed94a15c6ab64595b653ce8..e50ce5b100ae57e6260245abbd34faa8d712b372 100644 (file)
@@ -2968,10 +2968,10 @@ build_unary_op (code, xarg, flag)
 
        /* Report a read-only lvalue.  */
        if (TREE_READONLY (arg))
-         readonly_warning (arg, 
-                           ((code == PREINCREMENT_EXPR
-                             || code == POSTINCREMENT_EXPR)
-                            ? "increment" : "decrement"));
+         readonly_error (arg, 
+                          ((code == PREINCREMENT_EXPR
+                            || code == POSTINCREMENT_EXPR)
+                           ? "increment" : "decrement"));
 
        if (TREE_CODE (TREE_TYPE (arg)) == BOOLEAN_TYPE)
          val = boolean_increment (code, arg);
@@ -3252,23 +3252,23 @@ pedantic_lvalue_warning (code)
 /* Warn about storing in something that is `const'.  */
 
 void
-readonly_warning (arg, msgid)
+readonly_error (arg, msgid)
      tree arg;
      const char *msgid;
 {
   if (TREE_CODE (arg) == COMPONENT_REF)
     {
       if (TYPE_READONLY (TREE_TYPE (TREE_OPERAND (arg, 0))))
-       readonly_warning (TREE_OPERAND (arg, 0), msgid);
+       readonly_error (TREE_OPERAND (arg, 0), msgid);
       else
-       pedwarn ("%s of read-only member `%s'", _(msgid),
-                IDENTIFIER_POINTER (DECL_NAME (TREE_OPERAND (arg, 1))));
+       error ("%s of read-only member `%s'", _(msgid),
+               IDENTIFIER_POINTER (DECL_NAME (TREE_OPERAND (arg, 1))));
     }
   else if (TREE_CODE (arg) == VAR_DECL)
-    pedwarn ("%s of read-only variable `%s'", _(msgid),
-            IDENTIFIER_POINTER (DECL_NAME (arg)));
+    error ("%s of read-only variable `%s'", _(msgid),
+           IDENTIFIER_POINTER (DECL_NAME (arg)));
   else
-    pedwarn ("%s of read-only location", _(msgid));
+    error ("%s of read-only location", _(msgid));
 }
 \f
 /* Mark EXP saying that we need to be able to take the
@@ -3955,7 +3955,7 @@ build_modify_expr (lhs, modifycode, rhs)
       || ((TREE_CODE (lhstype) == RECORD_TYPE
           || TREE_CODE (lhstype) == UNION_TYPE)
          && C_TYPE_FIELDS_READONLY (lhstype)))
-    readonly_warning (lhs, "assignment");
+    readonly_error (lhs, "assignment");
 
   /* If storing into a structure or union member,
      it has probably been given type `int'.
@@ -7037,7 +7037,7 @@ c_expand_asm_operands (string, outputs, inputs, clobbers, vol, filename, line)
              || ((TREE_CODE (type) == RECORD_TYPE
                   || TREE_CODE (type) == UNION_TYPE)
                  && C_TYPE_FIELDS_READONLY (type)))
-           readonly_warning (o[i], "modification by `asm'");
+           readonly_error (o[i], "modification by `asm'");
        }
     }
 
index 4dc7e67f5faf12cfc8e0002a7e068b23fc4538cf..43d35c3843de8f634a05e61090d7aaf8b0fd8efc 100644 (file)
@@ -35,6 +35,7 @@ Boston, MA 02111-1307, USA.  */
 #include "hashtab.h"
 #include "splay-tree.h"
 #include "langhooks.h"
+#include "diagnostic.h"
 
 /* This should be eventually be generalized to other languages, but
    this would require a shared function-as-trees infrastructure.  */
@@ -1442,6 +1443,13 @@ optimize_inline_calls (fn)
   inline_data id;
   tree prev_fn;
 
+
+  /* There is no point in performing inlining if errors have already
+     occurred -- and we might crash if we try to inline invalid
+     code.  */
+  if (errorcount || sorrycount)
+    return;
+        
   /* Clear out ID.  */
   memset (&id, 0, sizeof (id));