New problems with gcc-2.8.0 based code - NOW FIXED!

Manfred Hollstein manfred@s-direktnet.de
Thu Jan 1 10:02:00 GMT 1998


On , 30 December 1997, 18:50:24, ak@muc.de wrote:

 > I remember a bugfix between egcs 1.0 and 1.0.1 so that it treats 
 > __asm__ statements without output operands always as volatile. The Linux
 > kernel depends on this behaviour. If gcc 2.8.0 doesn't have this bugfix
 > it could be the cause for your problems.
 > 

After the  discussion  about __volatile__  __asm__ statements  I  just
added Jeffrey Law's patch to gcc-2.8.0-971225:

Mon Dec 15 08:48:24 1997  Jeffrey A Law  (law@cygnus.com)

	* stmt.c (expand_asm_operands): If an ASM has no outputs, then treat
	it as volatile.

diff --context --recursive --show-c-function -x *.o -x *.info* -x *.html* -x *.elc -x *.dvi -x *.orig -x *~ -x version.el gcc-2.8.0.orig/gcc/stmt.c gcc-2.8.0/gcc/stmt.c
*** gcc-2.8.0.orig/gcc/stmt.c	Tue Dec  9 01:07:38 1997
--- gcc-2.8.0/gcc/stmt.c	Wed Dec 31 23:42:54 1997
*************** expand_asm_operands (string, outputs, in
*** 1421,1426 ****
--- 1421,1430 ----
    /* The insn we have emitted.  */
    rtx insn;
  
+   /* An ASM with no outputs needs to be treated as volatile.  */
+   if (noutputs == 0)
+     vol = 1;
+ 
    if (output_bytecode)
      {
        error ("`asm' is invalid when generating bytecode");

rebuilt and installed the compiler. I then used this compiler to built
linux-2.1.76 once  again and I'm  still getting the same boot failures
(16 times the _same_ Oops's from boot to reboot):

 Unable to handle kernel NULL pointer dereference at virtual address 00000018 
 current->tss.cr3 = 00101000, ^_r3 = 00101000 
 *pde = 00000000 
 Oops: 0000 
 CPU:    0 
 EIP:    0010:[<kfree+12b/1cd>] 
 EFLAGS: 00010002 
 eax: 00000100   ebx: c02f52c0   ecx: 00000000   edx: c0221000 
 esi: c3e79800   edi: 00000202   ebp: c3e79800   esp: c3e25f88 
 ds: 0018   es: 0018   ss: 0018 
 Process modutils (pid: 25, process nr: 8, stackpage=c3e25000) 
 Stack: c3e24000 c3e887c0 00000400 00000021 c011b96d c009cda0 c011b99d c3e79800  
        c3e24000 ffffffff fffffffc 00000000 c011c14c 00000000 c0109f1a 00000000  
        00000000 400d2c44 ffffffff fffffffc 00000000 00000001 0000002b 0000002b  
 Call Trace: [<do_exit+1f7/29b>] [<do_exit+227/29b>] [<sys_waitpid>] [<system_call+3a/40>]
 Code: c01275d9 <kfree+12b/1cd>  2b 69 18       	subl   0x18(%ecx),%ebp
 Code: c01275dc <kfree+12e/1cd>  89 e8          	movl   %ebp,%eax
 Code: c01275de <kfree+130/1cd>  31 d2          	xorl   %edx,%edx
 Code: c01275e0 <kfree+132/1cd>  f7 73 08       	divl   0x8(%ebx),%eax
 Code: c01275e9 <kfree+13b/1cd>  8b 51 04       	movl   0x4(%ecx),%edx
 Code: c01275ec <kfree+13e/1cd>  8d 14 82       	leal   (%edx,%eax,4),%edx
 Code: c01275ef <kfree+141/1cd>  89 54 24 10    	movl   %edx,0x10(%esp,1)


Another   problem has been   shown   by  several  test programs   from
libg++-2.8.0b6.5.   As an   example,  try to    compile the  following
snippet:

/* File: t002.cc
 * Compiled by gcc-2.8.0-971225 using
 *		optimization
 *	  _and_ -funroll-all-loops
 *	  _and_	-g
 * results in an `Internal compiler error'.  */

#include <String.h>
#include <Regex.h>
#include <iostream.h>

int main (void)
{
	String z = "This string\thas\nfive words";
	String w[10];
	int nw = split (z, w, 10, RXwhite);

	for (int i = 0; i < nw; ++i)
	{
		cout << "z[" << i << "] = \"" << w[i] << "\"" << endl;
	}

	return 0;
}

$ gcc -v
Reading specs from /tools/gnu/lib/gcc-lib/i586-linux-gnulibc1/2.8.0/specs
gcc version 2.8.0
$ uname -a
Linux saturn 2.0.33 #7 Mon Dec 29 13:09:29 MET 1997 i586 unknown
$ gcc -O -funroll-all-loops -g -S t002.cc
t002.cc: In function `int main()':
t002.cc:17: Internal compiler error.
t002.cc:17: Please submit a full bug report to `bug-g++@prep.ai.mit.edu'.

Omitting either `-funroll-all-loops' or `-g' works, though.

If you need the expanded .ii file send me an e-mail.

And you guys from the gcc2 mailing  list, please add my e-mail address
to the To: or Cc: fields explicitly, as I  still couldn't get onto the
mailing list :-(

Manfred



More information about the Gcc mailing list