Bug 86441 - gcc 3.2.2-10 failed to compile glibc when -O3 is used
Summary: gcc 3.2.2-10 failed to compile glibc when -O3 is used
Alias: None
Product: Red Hat Raw Hide
Classification: Retired
Component: gcc
Version: 1.0
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact:
: 86215 88220 (view as bug list)
Depends On:
TreeView+ depends on / blocked
Reported: 2003-03-22 00:27 UTC by hjl
Modified: 2007-04-18 16:52 UTC (History)
3 users (show)

Fixed In Version: 3.2.2-13
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2003-08-05 16:23:20 UTC

Attachments (Terms of Use)
A testcase (178.04 KB, text/plain)
2003-03-22 00:28 UTC, hjl
no flags Details

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

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 *);

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

Note You need to log in before you can comment on or make changes to this bug.