This is the mail archive of the gcc-prs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: c/8387: [3.3 regression] -finline-limit behavior changed; newinlining flags need doc


The following reply was made to PR c/8387; it has been noted by GNATS.

From: Steven Bosscher <s.bosscher@student.tudelft.nl>
To: garloff@suse.de, gcc-bugs@gcc.gnu.org, gcc-gnats@gcc.gnu.org,
	pfeifer@dbai.tuwien.ac.at, dalej@apple.com, nobody@gcc.gnu.org,
	gcc-prs@gcc.gnu.org
Cc: Josef Zlomek <zlomj9am@artax.karlin.mff.cuni.cz>
Subject: Re: c/8387: [3.3 regression] -finline-limit behavior changed; new
	inlining flags need doc
Date: 11 Feb 2003 22:54:51 +0100

 Op di 11-02-2003, om 21:14 schreef Steven Bosscher:
 > This also happens on -O1 -fpic on i586-pc-linux-gnu.  It disappears when
 > I comment out "flag_crossjumping = 1;" in toplev.c, so this bug probably
 > is somewhere in cleanup_cfg()
 > 
 > Greetz
 > Steven
 > 
 
 Yup, crossjumping or cfgcleanup after crossjumping seems to be the cause
 of this.
 
 For this code for example, the problem is that a whole jump table for
 one of the switch statements is wiped out 
 
 ---- 8< ----
 int *g;
 
 int main (void)
 {
   switch (*g)
     {
     case 0:
       {
         switch (*g)
           {
           case 0: *g = 1; break;
           case 1:
           case 2: *g = 1; break;
           case 3:
           case 4: *g = 1; break;
           }
         break;
       }
     case 1:
       {
         switch (*g)
           {
           case 0: *g = 1; break;
           case 1:
           case 2: *g = 1; break;
           case 3:
           case 4: *g = 1; break;
           }
       }
     }
   return 0;
 }
 ---- 8< ----
 steven# gcc-3.4 -v   
 Reading specs from /opt/experimental/lib/gcc-lib/i586-pc-linux-gnu/3.4/specs
 Configured with: ../gcc-trunk/configure --disable-nls --with-gnu-as --with-gnu-ld --prefix=/opt/experimental --program-suffix=-3.4 --enable-languages=c
 Thread model: posix
 gcc version 3.4 20030211 (experimental)
 steven# gcc-3.4 c7887_PR.c -O -fpic -save-temps
 c7887_PR.o: In function `main':
 c7887_PR.o(.text+0x3b): undefined reference to `.L10'
 collect2: ld returned 1 exit status
 
 Look at a piece of the assembly diff:
 
 
 .L3:					.L3:
 movl	g@GOT(%ecx), %eax		movl	g@GOT(%ecx), %eax
 movl	(%eax), %eax			movl	(%eax), %eax
 cmpl	$4, (%eax)			cmpl	$4, (%eax)
 ja	.L2				ja	.L2
 movl	(%eax), %eax			movl	(%eax), %eax
 leal	.L10@GOTOFF(%ecx), %edx		leal	.L10@GOTOFF(%ecx), %edx
 jmp	.L19			     |	movl	(%edx,%eax,4), %eax
 				     >	addl	%ecx, %eax
 				     >	jmp	*%eax
 				     >	.section	.rodata
 				     >	.align 4
 				     >	.align 4
 				     >	.L10:
 				     >	.long	.L5@GOTOFF
 				     >	.long	.L7@GOTOFF
 				     >	.long	.L7@GOTOFF
 				     >	.long	.L9@GOTOFF
 				     >	.long	.L9@GOTOFF
 				     >	.text
 				     >	.L5:
 				     >	movl	g@GOT(%ecx), %eax
 				     >	movl	(%eax), %eax
 				     >	movl	$1, (%eax)
 				     >	jmp	.L2
 				     >	.L7:
 				     >	movl	g@GOT(%ecx), %eax
 				     >	movl	(%eax), %eax
 				     >	movl	$1, (%eax)
 				     >	jmp	.L2
 				     >	.L9:
 				     >	movl	g@GOT(%ecx), %eax
 				     >	movl	(%eax), %eax
 				     >	movl	$1, (%eax)
 				     >	jmp	.L2
 .L11:					.L11:
 movl	g@GOT(%ecx), %eax		movl	g@GOT(%ecx), %eax
 movl	(%eax), %eax			movl	(%eax), %eax
 cmpl	$4, (%eax)			cmpl	$4, (%eax)
 ja	.L2				ja	.L2
 movl	(%eax), %eax			movl	(%eax), %eax
 leal	.L18@GOTOFF(%ecx), %edx		leal	.L18@GOTOFF(%ecx), %edx
 .L19:				     <
 movl	(%edx,%eax,4), %eax		movl	(%edx,%eax,4), %eax
 
 The label that's missing refers to the jump table, but it's gone...
 
 This is for the first select block with five cases.  The second block
 results in a jumptable to 5 identical labels with crossjumping enabled.
 
 To me this is black magic :-)  Hope it helps somebody to fix this bug.
 
 Greetz
 Steven
 
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]