Hi!

Calling default_conversion on IDENTIFIER_NODE which doesn't even have a type
results in ICEs.  On the other side, if arg is already error_mark_node, we
have already reported an error and there is no point issuing another error.

Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk/4.8?

2013-11-28  Jakub Jelinek  <ja...@redhat.com>

        PR c/59280
        * c-common.c (get_priority): If TREE_VALUE (args) is IDENTIFIER_NODE,
        goto invalid.  If it is error_mark_node, don't issue further
        diagnostics.
testsuite/
        * c-c++-common/pr59280.c: New test.

--- gcc/c-family/c-common.c.jj  2013-11-22 21:03:05.000000000 +0100
+++ gcc/c-family/c-common.c     2013-11-28 18:06:44.796404710 +0100
@@ -7014,6 +7014,10 @@ get_priority (tree args, bool is_destruc
     }
 
   arg = TREE_VALUE (args);
+  if (TREE_CODE (arg) == IDENTIFIER_NODE)
+    goto invalid;
+  if (arg == error_mark_node)
+    return DEFAULT_INIT_PRIORITY;
   arg = default_conversion (arg);
   if (!tree_fits_shwi_p (arg)
       || !INTEGRAL_TYPE_P (TREE_TYPE (arg)))
--- gcc/testsuite/c-c++-common/pr59280.c.jj     2013-11-28 18:09:09.843654172 
+0100
+++ gcc/testsuite/c-c++-common/pr59280.c        2013-11-28 18:10:54.910108073 
+0100
@@ -0,0 +1,4 @@
+/* PR c/59280 */
+/* { dg-do compile } */
+
+void bar (char *) __attribute__((constructor(foo))); /* { dg-error 
"constructor priorities must be integers|was not declared|constructor 
priorities are not supported" } */

        Jakub

Reply via email to