*BSD News Article 14089


Return to BSD News archive

Path: sserve!newshost.anu.edu.au!munnari.oz.au!spool.mu.edu!darwin.sura.net!gatech!howland.reston.ans.net!noc.near.net!uunet!pipex!marble.uknet.ac.uk!uknet!cf-cm!paul
From: paul@isl.cf.ac.uk (Paul)
Newsgroups: comp.os.386bsd.bugs
Subject: Gcc 2.3.3 bug ?
Message-ID: <1993Apr6.154454.22346@cm.cf.ac.uk>
Date: 6 Apr 93 15:44:51 GMT
Sender: news@cm.cf.ac.uk (Network News System)
Organization: /usr/local/lib/rn/organisation
Lines: 50

I was trying to port someone elses program to 386bsd but I kept getting
seg. violations which I finally tracked down to an array declaration.
After a little playing around I narrowed the problem down to the
following test program.

main()
{  
    long int Domain_Class[253][229][2];

}

Can't be simpler really :-)

The disass of this is as follows:

0x71 in main () (breaks.c line 2)
2       (breaks.c)
(gdb) disass
Dump of assembler code from 0x68 to 0x78:
0x68 <main>:    pushl  %ebp
0x69 <main+1>:  movl   %esp,%ebp
0x6b <main+3>:  subl   $0x71288,%esp
0x71 <main+9>:  call   0xf8
0x76 <main+14>: leave  
0x77 <main+15>: ret    
End of assembler dump.

Now by changing the second array dim to 228, the seg trap dissappears
and the disass is 

Bpt 1, main () (works.c line 5)
5       }
(gdb) disass
Dump of assembler code from 0x68 to 0x78:
0x68 <main>:    pushl  %ebp
0x69 <main+1>:  movl   %esp,%ebp
0x6b <main+3>:  subl   $0x70aa0,%esp
0x71 <main+9>:  call   0xf8
0x76 <main+14>: leave  
0x77 <main+15>: ret    
End of assembler dump.

I tried this with gcc-2.3.2 on a sparc and the problem never arose.

I'll start looking into it but does anyone have any ideas, seems like
it's probably a generic i386 problem with gcc-2.3.3.
-- 
  Paul Richards, University of Wales, College Cardiff

  Internet: paul@isl.cf.ac.uk