Bug 86441

Summary: gcc 3.2.2-10 failed to compile glibc when -O3 is used
Product: [Retired] Red Hat Raw Hide Reporter: hjl
Component: gccAssignee: Jakub Jelinek <jakub>
Status: CLOSED RAWHIDE QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 1.0CC: jorton, mitr, roland
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: 3.2.2-13 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2003-08-05 16:23:20 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
A testcase none

Description hjl 2003-03-22 00:27:14 UTC
I got

# /usr/gcc-3.2-redhat-8/bin/gcc -S -O3 -g foo.i
foo.i:4617: internal error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://bugzilla.redhat.com/bugzilla/> for instructions.

Comment 1 hjl 2003-03-22 00:28:31 UTC
Created attachment 90692 [details]
A testcase

Comment 2 hjl 2003-03-28 16:13:07 UTC
It also affects x86. When -O3 is used, the build finished. But the debug
information is bogus:

# gdb build-i686-linux.old/elf/ld-linux.so.2
 
 
dlopen failed on 'libthread_db.so.1' - /lib/tls/libthread_db.so.1: undefined
symbol: ps_get_thread_area
GDB will not be able to debug pthreads.
 
GNU gdb 2003-03-04-cvs
Copyright 2003 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i686-pc-linux-gnu"...
(gdb) r
Starting program: /export/build/gnu/glibc/build-i686-linux.old/elf/ld-linux.so.2  
Die: DW_TAG_formal_parameter (abbrev = 30, offset = 3958)
        has children: FALSE
        attributes:
                DW_AT_name (DW_FORM_string) string: "sym"
                DW_AT_decl_file (DW_FORM_data1) constant: 2
                DW_AT_decl_line (DW_FORM_data2) constant: 365
                DW_AT_type (DW_FORM_ref4) constant: 2598
Dwarf Error: Cannot find type of die [in module
/export/build/gnu/glibc/build-i686-linux.old/elf/ld-linux.so.2]
(gdb)

I believe it is the same problem as ia64. The only difference is cc1 doesn't
die when the corrupted memory is accessed.



Comment 3 Jakub Jelinek 2003-03-28 16:53:48 UTC
I guess it might be related to what I'm debugging ATM:
/* ICE if run in efence.  */
/* { dg-do compile } */
/* { dg-options "-O3 -g" } */

typedef int T;
int bar (T *, const char *);

int
foo (const char *x)
{
  auto inline int try (T *y);
  static T t;

  inline int try (T *y)
    {
      return bar (y, x);
    }

  return try (&t);
}

Can you try commenting out remove_children call in dwarf2out.c (gen_subprogram_die)?
I'm still trying to understand why some DIEs are at compile_unit level and some
are at subroutine level only.

Comment 4 hjl 2003-03-28 17:29:45 UTC
The call to remove_children is the cause of the whole problem. It frees
a die which is still referenced by the call to add_AT_die_ref from
modified_type_die. On ia64, cc1 dies because memory corruption. But on x86,
bogus debug info is generated.

Comment 5 Elena Zannoni 2003-04-07 21:56:02 UTC
*** Bug 86215 has been marked as a duplicate of this bug. ***

Comment 6 Elena Zannoni 2003-04-07 21:58:21 UTC
*** Bug 88220 has been marked as a duplicate of this bug. ***