This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/70651] [6 Regression] ICE on valid code on x86_64-linux-gnu in build_va_arg, at c-family/c-common.c:5728


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70651

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |mpolacek at gcc dot gnu.org

--- Comment #7 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
I'm testing this:

--- a/gcc/c-family/c-common.c
+++ b/gcc/c-family/c-common.c
@@ -5725,7 +5725,12 @@ build_va_arg (location_t loc, tree expr, tree type)
       /* Verify that &ap is still recognized as having va_list type.  */
       tree canon_expr_type
    = targetm.canonical_va_list_type (TREE_TYPE (expr));
-      gcc_assert (canon_expr_type != NULL_TREE);
+      if (canon_expr_type == NULL_TREE)
+   {
+     error_at (loc,
+           "first argument to %<va_arg%> not of type %<va_list%>");
+     return error_mark_node;
+   }

       return build_va_arg_1 (loc, type, expr);
     }
@@ -5793,7 +5798,12 @@ build_va_arg (location_t loc, tree expr, tree type)
       /* Verify that &ap is still recognized as having va_list type.  */
       tree canon_expr_type
    = targetm.canonical_va_list_type (TREE_TYPE (expr));
-      gcc_assert (canon_expr_type != NULL_TREE);
+      if (canon_expr_type == NULL_TREE)
+   {
+     error_at (loc,
+           "first argument to %<va_arg%> not of type %<va_list%>");
+     return error_mark_node;
+   }
     }
   else
     {

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]