public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [C++ PATCH] Fix ICE in cp/error.c (PR c++/77482)
@ 2016-09-05 17:21 Jakub Jelinek
  2016-09-16 20:05 ` Jason Merrill
  0 siblings, 1 reply; 2+ messages in thread
From: Jakub Jelinek @ 2016-09-05 17:21 UTC (permalink / raw)
  To: Jason Merrill; +Cc: gcc-patches

Hi!

The recent concept changes that were also backported to 6.2 break
diagnostics e.g. on the following testcase, sometimes it ICEs during
reporting of the first error, so isn't just a normal low prio error
recovery.  The thing is that on the testcase the VAR_DECL has no
DECL_LANG_SPECIFIC, DECL_DECLARED_CONSTEXPR_P is a lang flag rather than
lang_specific field.  I believe in various places in cp/error.c we check
for *_LANG_SPECIFIC similarly.  In addition, the hunk had formatting issues.

Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for
trunk/6.3?

2016-09-05  Jakub Jelinek  <jakub@redhat.com>

	PR c++/77482
	* error.c (dump_simple_decl): Only check DECL_DECLARED_CONCEPT_P
	if DECL_LANG_SPECIFIC is non-NULL.  Fix up formatting.

	* g++.dg/cpp0x/constexpr-77482.C: New test.

--- gcc/cp/error.c.jj	2016-09-02 18:17:32.000000000 +0200
+++ gcc/cp/error.c	2016-09-05 14:01:43.091770870 +0200
@@ -959,14 +959,13 @@ dump_simple_decl (cxx_pretty_printer *pp
 {
   if (flags & TFF_DECL_SPECIFIERS)
     {
-      if (VAR_P (t)
-	  && DECL_DECLARED_CONSTEXPR_P (t))
-            {
-              if (DECL_DECLARED_CONCEPT_P (t))
-                pp_cxx_ws_string (pp, "concept");
-              else
-		pp_cxx_ws_string (pp, "constexpr");
-            }
+      if (VAR_P (t) && DECL_DECLARED_CONSTEXPR_P (t))
+        {
+	  if (DECL_LANG_SPECIFIC (t) && DECL_DECLARED_CONCEPT_P (t))
+	    pp_cxx_ws_string (pp, "concept");
+	  else
+	    pp_cxx_ws_string (pp, "constexpr");
+	}
       dump_type_prefix (pp, type, flags & ~TFF_UNQUALIFIED_NAME);
       pp_maybe_space (pp);
     }
--- gcc/testsuite/g++.dg/cpp0x/constexpr-77482.C.jj	2016-09-05 13:58:59.609821176 +0200
+++ gcc/testsuite/g++.dg/cpp0x/constexpr-77482.C	2016-09-05 13:58:18.000000000 +0200
@@ -0,0 +1,6 @@
+// PR c++/77482
+// { dg-do compile { target c++11 } }
+
+constexpr auto x;	// { dg-error "declaration\[^\n\r]*has no initializer" }
+extern struct S s;
+constexpr auto y = s;	// { dg-error "has incomplete type" }

	Jakub

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [C++ PATCH] Fix ICE in cp/error.c (PR c++/77482)
  2016-09-05 17:21 [C++ PATCH] Fix ICE in cp/error.c (PR c++/77482) Jakub Jelinek
@ 2016-09-16 20:05 ` Jason Merrill
  0 siblings, 0 replies; 2+ messages in thread
From: Jason Merrill @ 2016-09-16 20:05 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: gcc-patches List

OK.

On Mon, Sep 5, 2016 at 1:17 PM, Jakub Jelinek <jakub@redhat.com> wrote:
> Hi!
>
> The recent concept changes that were also backported to 6.2 break
> diagnostics e.g. on the following testcase, sometimes it ICEs during
> reporting of the first error, so isn't just a normal low prio error
> recovery.  The thing is that on the testcase the VAR_DECL has no
> DECL_LANG_SPECIFIC, DECL_DECLARED_CONSTEXPR_P is a lang flag rather than
> lang_specific field.  I believe in various places in cp/error.c we check
> for *_LANG_SPECIFIC similarly.  In addition, the hunk had formatting issues.
>
> Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for
> trunk/6.3?
>
> 2016-09-05  Jakub Jelinek  <jakub@redhat.com>
>
>         PR c++/77482
>         * error.c (dump_simple_decl): Only check DECL_DECLARED_CONCEPT_P
>         if DECL_LANG_SPECIFIC is non-NULL.  Fix up formatting.
>
>         * g++.dg/cpp0x/constexpr-77482.C: New test.
>
> --- gcc/cp/error.c.jj   2016-09-02 18:17:32.000000000 +0200
> +++ gcc/cp/error.c      2016-09-05 14:01:43.091770870 +0200
> @@ -959,14 +959,13 @@ dump_simple_decl (cxx_pretty_printer *pp
>  {
>    if (flags & TFF_DECL_SPECIFIERS)
>      {
> -      if (VAR_P (t)
> -         && DECL_DECLARED_CONSTEXPR_P (t))
> -            {
> -              if (DECL_DECLARED_CONCEPT_P (t))
> -                pp_cxx_ws_string (pp, "concept");
> -              else
> -               pp_cxx_ws_string (pp, "constexpr");
> -            }
> +      if (VAR_P (t) && DECL_DECLARED_CONSTEXPR_P (t))
> +        {
> +         if (DECL_LANG_SPECIFIC (t) && DECL_DECLARED_CONCEPT_P (t))
> +           pp_cxx_ws_string (pp, "concept");
> +         else
> +           pp_cxx_ws_string (pp, "constexpr");
> +       }
>        dump_type_prefix (pp, type, flags & ~TFF_UNQUALIFIED_NAME);
>        pp_maybe_space (pp);
>      }
> --- gcc/testsuite/g++.dg/cpp0x/constexpr-77482.C.jj     2016-09-05 13:58:59.609821176 +0200
> +++ gcc/testsuite/g++.dg/cpp0x/constexpr-77482.C        2016-09-05 13:58:18.000000000 +0200
> @@ -0,0 +1,6 @@
> +// PR c++/77482
> +// { dg-do compile { target c++11 } }
> +
> +constexpr auto x;      // { dg-error "declaration\[^\n\r]*has no initializer" }
> +extern struct S s;
> +constexpr auto y = s;  // { dg-error "has incomplete type" }
>
>         Jakub

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-09-16 19:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-05 17:21 [C++ PATCH] Fix ICE in cp/error.c (PR c++/77482) Jakub Jelinek
2016-09-16 20:05 ` Jason Merrill

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).