public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Fix dwarf2out ICE (PR debug/65771)
@ 2015-04-16 21:11 Jakub Jelinek
  2015-04-16 23:45 ` [PATCH] Improve debug info generation for TLS + const " Jakub Jelinek
  2015-04-17  7:25 ` [PATCH] Fix dwarf2out ICE " Richard Biener
  0 siblings, 2 replies; 4+ messages in thread
From: Jakub Jelinek @ 2015-04-16 21:11 UTC (permalink / raw)
  To: Jason Merrill; +Cc: gcc-patches

Hi!

As mentioned in the PR, on the following testcase we ICE, because for
  # DEBUG D#2 => b
  # DEBUG D#1 => a[D#2].t
  # DEBUG c => D#1
during expansion we get the a[D#2].t added as MEM_EXPR of a MEM, and because
we can't mem_loc_descriptor that MEM (I'll post separately a trunk only
patch that fixes that in this case, but generally not all MEMs can be
represented in debug info), we try harder and try to use MEM_EXPR in
loc_list_from_tree, but that one ICEs on DEBUG_EXPR_DECL.  There is nothing
we can do for those at this point, debug_exprs are only useful to
var-tracking, so returning NULL is the only thing we can do for those.

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

2015-04-16  Jakub Jelinek  <jakub@redhat.com>

	PR debug/65771
	* dwarf2out.c (loc_list_from_tree): Return NULL
	for DEBUG_EXPR_DECL.

	* gcc.dg/debug/pr65771.c: New test.

--- gcc/dwarf2out.c.jj	2015-04-16 16:51:52.000000000 +0200
+++ gcc/dwarf2out.c	2015-04-16 16:57:28.866134980 +0200
@@ -14642,6 +14642,7 @@ loc_list_from_tree (tree loc, int want_a
 
     case TARGET_MEM_REF:
     case SSA_NAME:
+    case DEBUG_EXPR_DECL:
       return NULL;
 
     case COMPOUND_EXPR:
--- gcc/testsuite/gcc.dg/debug/pr65771.c.jj	2015-04-16 17:00:23.811328842 +0200
+++ gcc/testsuite/gcc.dg/debug/pr65771.c	2015-04-16 17:00:13.000000000 +0200
@@ -0,0 +1,15 @@
+/* PR debug/65771 */
+/* { dg-do link } */
+/* { dg-require-effective-target tls } */
+
+struct S { int s; int t; };
+__thread struct S a[10];
+int b;
+
+int
+main ()
+{
+  int c = a[b].t;
+  (void) c;
+  return 0;
+}

	Jakub

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

end of thread, other threads:[~2015-04-17 14:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-16 21:11 [PATCH] Fix dwarf2out ICE (PR debug/65771) Jakub Jelinek
2015-04-16 23:45 ` [PATCH] Improve debug info generation for TLS + const " Jakub Jelinek
2015-04-17 14:04   ` Jason Merrill
2015-04-17  7:25 ` [PATCH] Fix dwarf2out ICE " Richard Biener

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).