This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: bootstrap/6539: 3.2 bootstrap failure on irix6.5 - fixproto
Kaveh R. Ghazi wrote:-
> I was able to reproduce the error on sparc-solaris2.7 using the same
> input header file and arguments as on irix6.2. So its probably a
> general error given the right inputs. I.e. you should be able to
> reproduce it on your local box. I've uploaded the triggering header
> as an attachment to the PR, it doesn't include any other files..
> Assuming you put it in your homedir, run this:
>
> ./fix-header sys/IP12nvram.h ~/IP12nvram.h ~/IP12nvram.h -D__STDC__=0
> -D__cplusplus -I/caip/u99/ghazi/gcc-testing/build/gcc/include
> -I/usr/include
>
> I get "Segmentation fault (core dumped)" on both irix and solaris2.
Heh, how sad. I could reproduce and this fixed it. Please confirm
it works for you.
Neil.
* cppexp.c (_cpp_expand_op_stack): Set op_limit.
Index: cppexp.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cppexp.c,v
retrieving revision 1.113
diff -u -p -r1.113 cppexp.c
--- cppexp.c 6 May 2002 22:52:58 -0000 1.113
+++ cppexp.c 9 May 2002 21:59:07 -0000
@@ -825,9 +825,11 @@ _cpp_expand_op_stack (pfile)
cpp_reader *pfile;
{
size_t n = (size_t) (pfile->op_limit - pfile->op_stack);
+ size_t new_size = n * 2 + 20;
pfile->op_stack = (struct op *) xrealloc (pfile->op_stack,
- (n * 2 + 20) * sizeof (struct op));
+ new_size * sizeof (struct op));
+ pfile->op_limit = pfile->op_stack + new_size;
return pfile->op_stack + n;
}