public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/14694] New: [tree-ssa] SEGV in tree-nested.c compiling glibc
@ 2004-03-23 15:25 dnovillo at gcc dot gnu dot org
  2004-03-23 15:27 ` [Bug middle-end/14694] " dnovillo at gcc dot gnu dot org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: dnovillo at gcc dot gnu dot org @ 2004-03-23 15:25 UTC (permalink / raw)
  To: gcc-bugs

When compiling glibc's rtld.c we ICE inside tree-nested.c because we try to
process a global VAR_DECL.  This causes convert_nonlocal_reference to run out of
nesting contexts without finding the declaration.

I'm not sure which glibc version exposes this.  Attached is rtld.i that Uli sent
me.  I presume this comes from current CVS?

Also attached is a proposed patch.  Richard, is this the right fix?  We
explicitly check for DECL_EXTERNAL, but we weren't checking for _NONLOCAL nor
globals.  Bootstrap and testing in progress.

-- 
           Summary: [tree-ssa] SEGV in tree-nested.c compiling glibc
           Product: gcc
           Version: tree-ssa
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: middle-end
        AssignedTo: rth at gcc dot gnu dot org
        ReportedBy: dnovillo at gcc dot gnu dot org
                CC: drepper at redhat dot com,gcc-bugs at gcc dot gnu dot
                    org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14694


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

* [Bug middle-end/14694] [tree-ssa] SEGV in tree-nested.c compiling glibc
  2004-03-23 15:25 [Bug middle-end/14694] New: [tree-ssa] SEGV in tree-nested.c compiling glibc dnovillo at gcc dot gnu dot org
@ 2004-03-23 15:27 ` dnovillo at gcc dot gnu dot org
  2004-03-23 15:28 ` dnovillo at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: dnovillo at gcc dot gnu dot org @ 2004-03-23 15:27 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From dnovillo at gcc dot gnu dot org  2004-03-23 15:26 -------
Proposed patch.


Index: tree-nested.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-nested.c,v
retrieving revision 1.1.2.4
diff -d -u -p -r1.1.2.4 tree-nested.c
--- tree-nested.c       18 Mar 2004 22:43:56 -0000      1.1.2.4
+++ tree-nested.c       23 Mar 2004 15:26:16 -0000
@@ -55,7 +55,7 @@

    The implementation here is much more direct.  Everything that can be
    referenced by an inner function is a member of an explicitly created
-   structure herein called the "nonlocal frame struct".  The incomming
+   structure herein called the "nonlocal frame struct".  The incoming
    static chain for a nested function is a pointer to this struct in
    the parent.  In this way, we settle on known offsets from a known
    base, and so are decoupled from the logic that places objects in the
@@ -717,7 +717,10 @@ convert_nonlocal_reference (tree *tp, in
     {
     case VAR_DECL:
       /* Non-automatic variables are never processed.  */
-      if (TREE_STATIC (t) || DECL_EXTERNAL (t))
+      if (TREE_STATIC (t)
+         || DECL_EXTERNAL (t)
+         || DECL_NONLOCAL (t)
+         || decl_function_context (t) == NULL_TREE)
        break;
       /* FALLTHRU */



-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14694


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

* [Bug middle-end/14694] [tree-ssa] SEGV in tree-nested.c compiling glibc
  2004-03-23 15:25 [Bug middle-end/14694] New: [tree-ssa] SEGV in tree-nested.c compiling glibc dnovillo at gcc dot gnu dot org
  2004-03-23 15:27 ` [Bug middle-end/14694] " dnovillo at gcc dot gnu dot org
@ 2004-03-23 15:28 ` dnovillo at gcc dot gnu dot org
  2004-03-23 16:01 ` pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: dnovillo at gcc dot gnu dot org @ 2004-03-23 15:28 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From dnovillo at gcc dot gnu dot org  2004-03-23 15:28 -------
Created an attachment (id=5979)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=5979&action=view)
Test case


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14694


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

* [Bug middle-end/14694] [tree-ssa] SEGV in tree-nested.c compiling glibc
  2004-03-23 15:25 [Bug middle-end/14694] New: [tree-ssa] SEGV in tree-nested.c compiling glibc dnovillo at gcc dot gnu dot org
  2004-03-23 15:27 ` [Bug middle-end/14694] " dnovillo at gcc dot gnu dot org
  2004-03-23 15:28 ` dnovillo at gcc dot gnu dot org
@ 2004-03-23 16:01 ` pinskia at gcc dot gnu dot org
  2004-03-23 20:12 ` dnovillo at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-03-23 16:01 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-03-23 16:01 -------
Confirmed, here is the reduced source:
extern unsigned int _rtld_local __attribute__ ((visibility ("hidden")));

extern unsigned int _rtld_local
    __attribute__ ((alias ("_rtld_global"), visibility ("hidden")));
unsigned int
_dl_start (void *arg)
{
void
elf_machine_rel ()
{
  unsigned int value = (_rtld_local);
}
}

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|                            |1
           Keywords|                            |ice-on-valid-code
      Known to work|                            |3.4.0
   Last reconfirmed|0000-00-00 00:00:00         |2004-03-23 16:01:10
               date|                            |
   Target Milestone|---                         |tree-ssa


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14694


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

* [Bug middle-end/14694] [tree-ssa] SEGV in tree-nested.c compiling glibc
  2004-03-23 15:25 [Bug middle-end/14694] New: [tree-ssa] SEGV in tree-nested.c compiling glibc dnovillo at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2004-03-23 16:01 ` pinskia at gcc dot gnu dot org
@ 2004-03-23 20:12 ` dnovillo at gcc dot gnu dot org
  2004-03-24  6:28 ` cvs-commit at gcc dot gnu dot org
  2004-03-24  6:30 ` rth at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: dnovillo at gcc dot gnu dot org @ 2004-03-23 20:12 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From dnovillo at gcc dot gnu dot org  2004-03-23 20:12 -------

The patch was incomplete.  We also need similar changes in convert_local_reference.

Index: tree-nested.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-nested.c,v
retrieving revision 1.1.2.4
diff -d -u -p -r1.1.2.4 tree-nested.c
--- tree-nested.c       18 Mar 2004 22:43:56 -0000      1.1.2.4
+++ tree-nested.c       23 Mar 2004 20:11:55 -0000
@@ -55,7 +55,7 @@

    The implementation here is much more direct.  Everything that can be
    referenced by an inner function is a member of an explicitly created
-   structure herein called the "nonlocal frame struct".  The incomming
+   structure herein called the "nonlocal frame struct".  The incoming
    static chain for a nested function is a pointer to this struct in
    the parent.  In this way, we settle on known offsets from a known
    base, and so are decoupled from the logic that places objects in the
@@ -717,7 +717,9 @@ convert_nonlocal_reference (tree *tp, in
     {
     case VAR_DECL:
       /* Non-automatic variables are never processed.  */
-      if (TREE_STATIC (t) || DECL_EXTERNAL (t))
+      if (TREE_STATIC (t)
+         || DECL_EXTERNAL (t)
+         || decl_function_context (t) == NULL_TREE)
        break;
       /* FALLTHRU */

@@ -807,7 +809,9 @@ convert_local_reference (tree *tp, int *
     {
     case VAR_DECL:
       /* Non-automatic variables are never processed.  */
-      if (TREE_STATIC (t) || DECL_EXTERNAL (t))
+      if (TREE_STATIC (t)
+         || DECL_EXTERNAL (t)
+         || decl_function_context (t) == NULL_TREE)
        break;
       /* FALLTHRU */


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14694


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

* [Bug middle-end/14694] [tree-ssa] SEGV in tree-nested.c compiling glibc
  2004-03-23 15:25 [Bug middle-end/14694] New: [tree-ssa] SEGV in tree-nested.c compiling glibc dnovillo at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2004-03-23 20:12 ` dnovillo at gcc dot gnu dot org
@ 2004-03-24  6:28 ` cvs-commit at gcc dot gnu dot org
  2004-03-24  6:30 ` rth at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-03-24  6:28 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-03-24 06:28 -------
Subject: Bug 14694

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	tree-ssa-20020619-branch
Changes by:	rth@gcc.gnu.org	2004-03-24 06:28:37

Modified files:
	gcc            : ChangeLog.tree-ssa c-common.c 
Added files:
	gcc/testsuite/gcc.c-torture/compile: 20040323-1.c 

Log message:
	PR middle-end/14694
	* c-common.c (handle_alias_attribute): Mark aliased variables
	to be TREE_STATIC.
	* gcc.c-torture/compile/20040323-1.c: New.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.tree-ssa.diff?cvsroot=gcc&only_with_tag=tree-ssa-20020619-branch&r1=1.1.2.1291&r2=1.1.2.1292
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-common.c.diff?cvsroot=gcc&only_with_tag=tree-ssa-20020619-branch&r1=1.344.2.64&r2=1.344.2.65
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.c-torture/compile/20040323-1.c.diff?cvsroot=gcc&only_with_tag=tree-ssa-20020619-branch&r1=NONE&r2=1.1.2.1



-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14694


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

* [Bug middle-end/14694] [tree-ssa] SEGV in tree-nested.c compiling glibc
  2004-03-23 15:25 [Bug middle-end/14694] New: [tree-ssa] SEGV in tree-nested.c compiling glibc dnovillo at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2004-03-24  6:28 ` cvs-commit at gcc dot gnu dot org
@ 2004-03-24  6:30 ` rth at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: rth at gcc dot gnu dot org @ 2004-03-24  6:30 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From rth at gcc dot gnu dot org  2004-03-24 06:30 -------
Fixed.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14694


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

end of thread, other threads:[~2004-03-24  6:30 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-03-23 15:25 [Bug middle-end/14694] New: [tree-ssa] SEGV in tree-nested.c compiling glibc dnovillo at gcc dot gnu dot org
2004-03-23 15:27 ` [Bug middle-end/14694] " dnovillo at gcc dot gnu dot org
2004-03-23 15:28 ` dnovillo at gcc dot gnu dot org
2004-03-23 16:01 ` pinskia at gcc dot gnu dot org
2004-03-23 20:12 ` dnovillo at gcc dot gnu dot org
2004-03-24  6:28 ` cvs-commit at gcc dot gnu dot org
2004-03-24  6:30 ` rth at gcc dot gnu dot org

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