The following reply was made to PR c/5448; it has been noted by GNATS. From: Craig Rodrigues To: gcc-gnats@gcc.gnu.org Cc: gcc-bugs@gcc.gnu.org, nobody@gcc.gnu.org Subject: Re: c/5448: gcc emits internal error (unrecognized insn) Date: Tue, 22 Jan 2002 01:37:38 -0500 ----- Forwarded message from Olivier Jolly ----- Delivered-To: rodrigc@gcc.gnu.org Posted-Date: Tue, 22 Jan 2002 07:24:29 +0100 (MET) From: Olivier Jolly To: rodrigc@gcc.gnu.org X-Mailer: Caramail - www.caramail.com X-Originating-IP: [80.11.125.56] Subject: Re[1] c/5448: gcc emits internal error (unrecognized insn) Date: Tue, 22 Jan 2002 07:24:29 GMT+1 > Synopsis: gcc emits internal error (unrecognized insn) > > State-Changed-From-To: open->analyzed > State-Changed-By: rodrigc > State-Changed-When: Mon Jan 21 16:54:04 2002 > State-Changed-Why: > Crash reproduced on gcc 3.0.3 and gcc 3.1 mainline. > > The line which is causing the problem is: > > section[pWrd - sCfgFileLine - 1] = '\0'; > > where the variables are: > char *section; > char *pWrd; > char sCfgFileLine[8192]; > > What exactly are you trying to do in this piece of > code? The compiler should not crash, but this code > looks suspect. thanks for your quick reply, this piece of code is code to recognize section declaration. It follows the following regex : ^\[(.*)\].*$ pWrd is normally a pointer toward the ']' character inside the sCfgFileLine buffer. So, pWrd - sCfgFileLine - 1 should represent the actual size of the inner string, enclosed with brackets since it's the difference of 2 char*. The problematic line then should simply put a '\0' at the end of the freshly (re) allocated section variable. note: the very same expression is used on the line above without problem ( strncpy( section, sCfgFileLine + 1, pWrd - sCfgFileLine - 1);) it's as array index that it causes problem. I hope it will help making gcc even greater. Thanks for all and good luck regards Olivier Jolly ______________________________________________________ BoƮte aux lettres - Caramail - http://www.caramail.com ----- End forwarded message -----