ICE with -freorder-blocks in `remove_unncessary_notes', at emit-rtl.c:2778

Andreas Jaeger aj@suse.de
Thu Apr 27 08:33:00 GMT 2000


I've tried to use -freorder-blocks for compiling glibc with the
current gcc version and got an ICE.  I've removed all uneccessary stuff
from the preprocessed file and append it below.  Without
-freorder-blocks I don't see this problem.

The ICE is:
/opt/gcc-2.96.test/lib/gcc-lib/i686-pc-linux-gnu/2.96/cc1 init-first.i -mcpu=pentiumpro -quiet -dumpbase init-first.c -mpentiumpro -momit-leaf-frame-pointer -g -O3 -Wall -Winline -Wno-format -Wstrict-prototypes -Wwrite-strings -version -freorder-blocks -fstrict-aliasing -fkeep-inline-functions -o init-first.s
GNU C version 2.96 20000425 (experimental) (i686-pc-linux-gnu) compiled by GNU C version 2.96 20000425 (experimental).
init-first.i: In function `init':
init-first.i:173: Internal compiler error in `remove_unncessary_notes', at emit-rtl.c:2778
Please submit a full bug report.
See <URL: http://www.gnu.org/software/gcc/bugs.html > for instructions.

gdb reveals:
GNU C version 2.96 20000425 (experimental) (i686-pc-linux-gnu) compiled by GNU C version 2.96 20000425 (experimental).

Breakpoint 2, fancy_abort (file=0x821fb88 "/cvs/gcc/gcc/emit-rtl.c", line=2778, 
    function=0x821ff74 "remove_unncessary_notes") at /cvs/gcc/gcc/rtl.c:1261
1261      if (function == NULL)
(gdb) bt
#0  fancy_abort (file=0x821fb88 "/cvs/gcc/gcc/emit-rtl.c", line=2778, 
    function=0x821ff74 "remove_unncessary_notes") at /cvs/gcc/gcc/rtl.c:1261
#1  0x80b12b6 in remove_unncessary_notes () at /cvs/gcc/gcc/emit-rtl.c:2778
#2  0x815188f in final_start_function (first=0x40115380, file=0x829d950, optimize=3)
    at /cvs/gcc/gcc/final.c:1651
#3  0x804d4c5 in rest_of_compilation (decl=0x40111f80) at /cvs/gcc/gcc/toplev.c:3610
#4  0x81fd9a1 in finish_function (nested=0) at /cvs/gcc/gcc/c-decl.c:6499
#5  0x81ee86a in yyparse () at c-parse.y:313
#6  0x804ba22 in compile_file (name=0x4010b230 "init-first.i") at /cvs/gcc/gcc/toplev.c:2401
#7  0x804ed29 in main (argc=21, argv=0xbffff684) at /cvs/gcc/gcc/toplev.c:4688
(gdb) up
#1  0x80b12b6 in remove_unncessary_notes () at /cvs/gcc/gcc/emit-rtl.c:2778
2778            abort ();
(gdb) l
2773          /* By now, all notes indicating lexical blocks should have
2774             NOTE_BLOCK filled in.  */
2775          if ((NOTE_LINE_NUMBER (insn) == NOTE_INSN_BLOCK_BEG
2776               || NOTE_LINE_NUMBER (insn) == NOTE_INSN_BLOCK_END)
2777              && NOTE_BLOCK (insn) == NULL_TREE)
2778            abort ();
2779
2780          /* Remove NOTE_INSN_DELETED notes.  */
2781          if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_DELETED)
2782            remove_insn (insn);
(gdb) p insn
$1 = 0x40121ae0
(gdb) pt insn
 <(null) 0x40121ae0
Program received signal SIGSEGV, Segmentation fault.
print_node (file=0x400fae80, prefix=0x8216f98 "type", node=0x1eb, indent=4)
    at /cvs/gcc/gcc/print-tree.c:191
warning: Source file is more recent than executable.

191       class = TREE_CODE_CLASS (TREE_CODE (node));
The program being debugged stopped while in a function called from GDB.
When the function (debug_tree) is done executing, GDB will silently
stop (instead of continuing to evaluate the expression containing
the function call).
(gdb) p *insn
$2 = {code = NOTE, mode = VOIDmode, jump = 0, call = 0, unchanging = 0, volatil = 0, in_struct = 0, 
  used = 0, integrated = 0, frame_related = 0, fld = {{rtwint = 491, rtint = 491, rtuint = 491, 
      rtstr = 0x1eb <Address 0x1eb out of bounds>, rtx = 0x1eb, rtvec = 0x1eb, rttype = 491, 
      rt_addr_diff_vec_flags = {min_align = 235, base_after_vec = 1, min_after_vec = 0, 
        max_after_vec = 0, min_after_base = 0, max_after_base = 0, offset_unsigned = 0, 0, 
        scale = 0}, rt_cselib = 0x1eb, rtbit = 0x1eb, rttree = 0x1eb, bb = 0x1eb}}}



Here's the preprocessed source file (simplified from csu/init-first.c
in glibc):
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
typedef unsigned int size_t;
typedef int __ssize_t;			 

extern void __libc_fatal (__const char *__message)
     __attribute__ ((__noreturn__));
     
typedef __ssize_t ssize_t;

extern int __open (__const char *__file, int __oflag, ...)  ;
extern int __close (int __fd)  ;
extern ssize_t __read (int __fd, void *__buf, size_t __nbytes)  ;
extern char **__environ;
extern int __libc_enable_secure;

typedef unsigned int fpu_control_t __attribute__ ((__mode__ (__HI__)));
extern fpu_control_t __fpu_control; 
extern void __setfpucw (fpu_control_t);

struct __sysctl_args {
	int *name;
	int nlen;
	void *oldval;
	size_t *oldlenp;
	void *newval;
	size_t newlen;
	unsigned long __unused[4];
};

enum
{
	CTL_KERN=1	 
};
enum
{
	KERN_OSRELEASE=2
};

extern int sysctl (int *__name, int __nlen, void *__oldval,
		   size_t *__oldlenp, void *__newval, size_t __newlen)  ;
extern void __libc_init_secure (void);
extern void __libc_init (int, char **, char **);
extern void __libc_global_ctors (void);

 
static void init (int, char **, char **) __attribute__ ((unused));

 
extern int __sysctl (int *name, int nlen, void *oldval, size_t *oldlenp,
		     void *newval, size_t newlen);

extern int _dl_starting_up;
asm (".weak "  "_dl_starting_up");

extern fpu_control_t _dl_fpu_control;
extern int _dl_fpu_control_set;

 

int __libc_multiple_libcs = 1;

 

int __libc_argc;
char **__libc_argv;


static void
init (int argc, char **argv, char **envp)
{
  extern void __getopt_clean_environment (char **);
   


  int *dummy_addr = &_dl_starting_up;

  __libc_multiple_libcs = dummy_addr && !_dl_starting_up;

   
  if (!__libc_multiple_libcs)
    {
       


      if (0 > 0)
	{
	  static const int sysctl_args[] = { CTL_KERN, KERN_OSRELEASE };
	  char buf[64];
	  size_t reslen = sizeof (buf);
	  unsigned int version;
	  int parts;
	  char *cp;

	   
	  if (__sysctl ((int *) sysctl_args,
			sizeof (sysctl_args) / sizeof (sysctl_args[0]),
			buf, &reslen, ((void *)0), 0) < 0)
	    {
	       

	      int fd = __open ("/proc/sys/kernel/osrelease", 00);
	      if (fd == -1
		  || (reslen = __read (fd, buf, sizeof (buf))) <= 0)
		 

		__libc_fatal ("FATAL: cannot determine library version\n");

	      __close (fd);
	    }
	  buf[(((reslen)<( sizeof (buf) - 1))?(reslen):( sizeof (buf) - 1))] = '\0';

	   

	  version = 0;
	  parts = 0;
	  cp = buf;
	  while ((*cp >= '0') && (*cp <= '9'))
	    {
	      unsigned int here = *cp++ - '0';

	      while ((*cp >= '0') && (*cp <= '9'))
		{
		  here *= 10;
		  here += *cp++ - '0';
		}

	      ++parts;
	      version <<= 8;
	      version |= here;

	      if (*cp++ != '.')
		 
		break;
	    }

	  if (parts < 3)
	    version <<= 8 * (3 - parts);

	   
	  if (version < 0)
	     
	    __libc_fatal ("FATAL: kernel too old\n");
	}

	__setfpucw (__fpu_control);
    }
  __libc_argc = argc;
  __libc_argv = argv;
  __environ = envp;
  __libc_init_secure ();
  __libc_init (argc, argv, envp);
  __getopt_clean_environment (envp);

}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


My system: glibc 2.1.3, Linux 2.3.48, i686.

Andreas
-- 
 Andreas Jaeger
  SuSE Labs aj@suse.de
   private aj@arthur.rhein-neckar.de


More information about the Gcc-bugs mailing list