Bug List: (This bug is not in your last search results)   Show last search results      Search page      Enter new bug
Bug#: 19345
Product:  
Component:  
Status: RESOLVED
Resolution: FIXED
Assigned To: Alexandre Oliva <aoliva@gcc.gnu.org>
Host:
Reported against  
Priority:  
Severity:  
Target Milestone:  
 
 
Target:
Reporter: Serge Belyshev <belyshev@depni.sinp.msu.ru>
Add CC:
CC:
Remove selected CCs
Build:
URL:
Summary:
Keywords:
Known to work:
Known to fail:

Attachment Description Type Created Size Actions
Create a New Attachment (proposed patch, testcase, etc.) View All

Bug 19345 depends on: Show dependency tree
Show dependency graph
Bug 19345 blocks:

Additional Comments:






View Bug Activity   |   Format For Printing   |   Clone This Bug


Description:   Last confirmed: 2005-03-31 20:28 Opened: 2005-01-09 08:18
inline void bar (char a[], unsigned int l)
{
  asm volatile ("" :: "m" ( *(struct {char x[l];} *) a));
}

void foo (void)
{
  bar (0, 0);
}

------- Comment #1 From Serge Belyshev 2005-01-09 08:23 -------
use '-O1 -g' to reproduce

------- Comment #2 From Andrew Pinski 2005-01-09 15:46 -------
Confirmed.

------- Comment #3 From Andrew Pinski 2005-01-23 16:02 -------
*** Bug 19585 has been marked as a duplicate of this bug. ***

------- Comment #4 From Andrew Pinski 2005-01-26 23:52 -------
This started to happen after 2004-12-11.

------- Comment #5 From Serge Belyshev 2005-01-27 03:00 -------
Caused by this patch:

2005-01-03  Daniel Berlin  <dberlin@dberlin.org>

        Fix PR debug/17924
        Fix PR debug/19191
        * dwarf2out.c (block_ultimate_origin): Follow decl origin if origin
        is a decl.
        * gimple-low.c (mark_blocks_with_used_vars): New function.
        (mark_blocks_with_used_subblocks): Ditto.
        (mark_used_blocks): Ditto.
        (pass_mark_used_blocks): New pass.
        * tree-inline.c: Include debug.h.
        (expand_call_inline): Call outlining_inline_function here.
        * tree-optimize.c (init_tree_optimization_passes): Add
        pass_mark_used_blocks. 
        * tree-pass.h (pass_mark_used_blocks): New.
        * Makefile.in (tree-inline.o): Add debug.h dependency.

------- Comment #6 From Andrew Pinski 2005-01-27 04:25 -------
Patch here: <http://gcc.gnu.org/ml/gcc-patches/2005-01/msg01967.html>.

------- Comment #7 From Jakub Jelinek 2005-02-17 12:21 -------
BTW, this breaks glibc build, so it is quite important to get this fixed
for GCC 4.0 release.

------- Comment #8 From Daniel Berlin 2005-02-17 15:04 -------
(In reply to comment #7)
> BTW, this breaks glibc build, so it is quite important to get this fixed
> for GCC 4.0 release.

There is followup on how to get this fixed after the patch was rejected.
http://gcc.gnu.org/ml/gcc-patches/2005-02/msg00530.html

Unfortunately, i won't have time until at least next saturday (I have a state
bar exam).

The fix should be quite easy to implement if you want to just do it and regtest it.

------- Comment #9 From Andrew Pinski 2005-02-25 01:38 -------
*** Bug 20205 has been marked as a duplicate of this bug. ***

------- Comment #10 From Jakub Jelinek 2005-02-28 09:45 -------
TYPE_NAME (TYPE_MAIN_VARIANT (origin)) on that testcase is NULL, so it doesn't
help match.  Following patch certainly doesn't help.

--- dwarf2out.c.jj      2005-02-27 17:54:15.000000000 +0100
+++ dwarf2out.c 2005-02-28 10:39:37.926034399 +0100
@@ -10496,7 +10496,11 @@ add_abstract_origin_attribute (dw_die_re
       tree fn = origin;

       if (TYPE_P (fn))
-       fn = TYPE_STUB_DECL (fn);
+       {
+         fn = TYPE_STUB_DECL (fn);
+         if (fn == NULL)
+           fn = TYPE_NAME (TYPE_MAIN_VARIANT (origin));
+       }

       fn = decl_function_context (fn);
       if (fn)

------- Comment #11 From CVS Commits 2005-03-11 13:07 -------
Subject: Bug 19345

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-4_0-rhl-branch
Changes by:	jakub@gcc.gnu.org	2005-03-11 13:07:00

Modified files:
	gcc            : ChangeLog dwarf2out.c 
	gcc/cp         : ChangeLog 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/gcc.dg: pr19345.c 

Log message:
	2005-01-26  Daniel Berlin  <dberlin@dberlin.org>
	
	Fix PR debug/19345
	* dwarf2out.c (add_abstract_origin_attribute): TYPE_STUB_DECL is
	not always going to give us a non-NULL result, so guard against that.
	
	* gcc.dg/pr19345.c: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-rhl-branch&r1=2.7592.2.10.2.11&r2=2.7592.2.10.2.12
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/dwarf2out.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-rhl-branch&r1=1.570.4.2&r2=1.570.4.3
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-rhl-branch&r1=1.4648.2.1.2.4&r2=1.4648.2.1.2.5
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-rhl-branch&r1=1.5084.2.9.2.9&r2=1.5084.2.9.2.10
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/pr19345.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-rhl-branch&r1=NONE&r2=1.1.2.1


------- Comment #12 From Mark Mitchell 2005-03-25 03:31 -------
According to Dan, Jason says that TYPE_NAME (TYPE_MAIN_VARIANT (origin)) is
NULL, but should not be, in this test case.

------- Comment #13 From Andrew Pinski 2005-03-26 19:44 -------
*** Bug 20649 has been marked as a duplicate of this bug. ***

------- Comment #14 From Alexandre Oliva 2005-03-31 20:47 -------
Subject: [PR debug/19345] remap TYPE_STUB_DECL during inlining

TYPE_STUB_DECL was NULL in the testcase given in the bug report
because tree inlining failed to remap TYPE_STUB_DECL.  This patch
reverts the patch that hides the problem, that AFAICT was checked in
by accident, and installs a proper (IMHO :-) fix.  Bootstrapping on
amd64-linux-gnu.  Ok to install if it passes regtesting?

Index: gcc/ChangeLog
from  Alexandre Oliva  <aoliva@redhat.com>

	PR debug/19345
	* dwarf2out.c (add_abstract_origin_attribute): Revert accidental?
	check in from 2005-03-03 for debug/20253.
	* tree-inline.c (remap_type): Remap TYPE_STUB_DECL.
	(remap_decl): Insert type decl in map earlier.

Index: gcc/dwarf2out.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/dwarf2out.c,v
retrieving revision 1.576
diff -u -p -r1.576 dwarf2out.c
--- gcc/dwarf2out.c 30 Mar 2005 23:08:17 -0000 1.576
+++ gcc/dwarf2out.c 31 Mar 2005 20:43:20 -0000
@@ -10465,11 +10465,7 @@ add_abstract_origin_attribute (dw_die_re
       if (TYPE_P (fn))
 	fn = TYPE_STUB_DECL (fn);
       
-      /* TYPE_STUB_DECL may have given us a NULL, which decl_function_context
-	 won't like.  */
-      if (fn)	
-	fn = decl_function_context (fn);
-
+      fn = decl_function_context (fn);
       if (fn)
 	dwarf2out_abstract_function (fn);
     }
Index: gcc/tree-inline.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-inline.c,v
retrieving revision 1.175
diff -u -p -r1.175 tree-inline.c
--- gcc/tree-inline.c 30 Mar 2005 21:34:27 -0000 1.175
+++ gcc/tree-inline.c 31 Mar 2005 20:43:22 -0000
@@ -172,6 +172,11 @@ remap_decl (tree decl, inline_data *id)
       /* Make a copy of the variable or label.  */
       tree t = copy_decl_for_inlining (decl, fn, VARRAY_TREE (id->fns, 0));
 
+      /* Remember it, so that if we encounter this local entity again
+	 we can reuse this copy.  Do this early becuase remap_type may
+	 need this decl for TYPE_STUB_DECL.  */
+      insert_decl_map (id, decl, t);
+
       /* Remap types, if necessary.  */
       TREE_TYPE (t) = remap_type (TREE_TYPE (t), id);
       if (TREE_CODE (t) == TYPE_DECL)
@@ -214,9 +219,6 @@ remap_decl (tree decl, inline_data *id)
 	}
 #endif
 
-      /* Remember it, so that if we encounter this local entity
-	 again we can reuse this copy.  */
-      insert_decl_map (id, decl, t);
       return t;
     }
 
@@ -285,6 +287,9 @@ remap_type (tree type, inline_data *id)
       TYPE_NEXT_VARIANT (new) = NULL;
     }
 
+  if (TYPE_STUB_DECL (type))
+    TYPE_STUB_DECL (new) = remap_decl (TYPE_STUB_DECL (type), id);
+
   /* Lazily create pointer and reference types.  */
   TYPE_POINTER_TO (new) = NULL;
   TYPE_REFERENCE_TO (new) = NULL;
Index: gcc/testsuite/ChangeLog
from  Daniel Berlin  <dberlin@dberlin.org>

	* gcc.dg/pr19345.c: New test.

Index: gcc/testsuite/gcc.dg/pr19345.c
===================================================================
RCS file: gcc/testsuite/gcc.dg/pr19345.c
diff -N gcc/testsuite/gcc.dg/pr19345.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gcc/testsuite/gcc.dg/pr19345.c 31 Mar 2005 20:43:37 -0000
@@ -0,0 +1,12 @@
+/* We shouldn't crash trying to produce the inlined structure type die debug info.  */
+/* { dg-do compile } */
+/* { dg-options "-O1 -g" } */
+inline void bar(char a[], unsigned int l)
+{
+  asm volatile ("" :: "m" ( *(struct {char x[l]; } *)a));
+}
+
+void foo(void)
+{
+  bar (0, 0);
+}

-- 
Alexandre Oliva             http://www.ic.unicamp.br/~oliva/
Red Hat Compiler Engineer   aoliva@{redhat.com, gcc.gnu.org}
Free Software Evangelist  oliva@{lsd.ic.unicamp.br, gnu.org}

------- Comment #15 From Daniel Berlin 2005-03-31 21:26 -------
Subject: Re: [PR debug/19345] remap TYPE_STUB_DECL during inlining



On Thu, 31 Mar 2005, Alexandre Oliva wrote:

> TYPE_STUB_DECL was NULL in the testcase given in the bug report
> because tree inlining failed to remap TYPE_STUB_DECL.  This patch
> reverts the patch that hides the problem, that AFAICT was checked in
> by accident,

Did i check it in, or someone else?
If i did it, it was definitely by accident.


------- Comment #16 From Alexandre Oliva 2005-04-01 00:37 -------
Subject: Re: [PR debug/19345] remap TYPE_STUB_DECL during inlining

On Mar 31, 2005, Daniel Berlin <dberlin@dberlin.org> wrote:

> Did i check it in, or someone else?

You did, along with the patch mentioned in the ChangeLog.

> If i did it, it was definitely by accident.

Thanks for the confirmation.


------- Comment #17 From Mark Mitchell 2005-04-01 21:17 -------
Subject: Re: [PR debug/19345] remap TYPE_STUB_DECL during inlining

Alexandre Oliva wrote:
> TYPE_STUB_DECL was NULL in the testcase given in the bug report
> because tree inlining failed to remap TYPE_STUB_DECL.  This patch
> reverts the patch that hides the problem, that AFAICT was checked in
> by accident, and installs a proper (IMHO :-) fix.  Bootstrapping on
> amd64-linux-gnu.  Ok to install if it passes regtesting?

Yes!  This looks very sensible.

Thanks,


------- Comment #18 From CVS Commits 2005-04-02 17:08 -------
Subject: Bug 19345

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	aoliva@gcc.gnu.org	2005-04-02 17:08:08

Modified files:
	gcc            : ChangeLog dwarf2out.c tree-inline.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/gcc.dg: pr19345.c 

Log message:
	gcc/ChangeLog:
	PR debug/19345
	* dwarf2out.c (add_abstract_origin_attribute): Revert accidental
	change checked in along with 2005-03-03's patch for debug/20253.
	* tree-inline.c (remap_type): Remap TYPE_STUB_DECL.
	(remap_decl): Insert type decl in map earlier.
	gcc/testsuite/ChangeLog:
	* gcc.dg/pr19345.c: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.8089&r2=2.8090
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/dwarf2out.c.diff?cvsroot=gcc&r1=1.580&r2=1.581
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/tree-inline.c.diff?cvsroot=gcc&r1=1.177&r2=1.178
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.5269&r2=1.5270
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/pr19345.c.diff?cvsroot=gcc&r1=1.1&r2=1.2


------- Comment #19 From CVS Commits 2005-04-02 17:08 -------
Subject: Bug 19345

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-4_0-branch
Changes by:	aoliva@gcc.gnu.org	2005-04-02 17:08:37

Modified files:
	gcc            : ChangeLog tree-inline.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/gcc.dg: pr19345.c 

Log message:
	gcc/ChangeLog:
	PR debug/19345
	* tree-inline.c (remap_type): Remap TYPE_STUB_DECL.
	(remap_decl): Insert type decl in map earlier.
	gcc/testsuite/ChangeLog:
	* gcc.dg/pr19345.c: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=2.7592.2.116&r2=2.7592.2.117
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/tree-inline.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.170.8.1&r2=1.170.8.2
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.5084.2.89&r2=1.5084.2.90
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/pr19345.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=NONE&r2=1.2.2.1


------- Comment #20 From Alexandre Oliva 2005-04-02 17:09 -------
Fixed

Bug List: (This bug is not in your last search results)   Show last search results      Search page      Enter new bug