This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
optimization/4847: The Optimizer (-O2) mangles the stack on sparc (found in vim60)
- To: gcc-gnats at gcc dot gnu dot org
- Subject: optimization/4847: The Optimizer (-O2) mangles the stack on sparc (found in vim60)
- From: stucki at math dot fu-berlin dot de
- Date: 9 Nov 2001 20:46:10 -0000
- Cc: stucki at math dot fu-berlin dot de, Bram at moolenaar dot net
- Reply-To: stucki at math dot fu-berlin dot de
>Number: 4847
>Category: optimization
>Synopsis: Optimizer on Sparc breaks routine-calls in vim60
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: wrong-code
>Submitter-Id: net
>Arrival-Date: Fri Nov 09 12:56:00 PST 2001
>Closed-Date:
>Last-Modified:
>Originator: Super-User (Stucki)
>Release: 3.0.2
>Organization:
FU-Berlin, FB Math.&Inf., EDV
>Environment:
System: SunOS coxeter 5.8 Generic_108528-10 sun4u sparc SUNW,Ultra-250
Architecture: sun4
host: sparc-sun-solaris2.8
build: sparc-sun-solaris2.8
target: sparc-sun-solaris2.8
configured with: ../gcc-3.0.2/configure --prefix=/import/gcc-3.0.2 --local-prefix=/import/local --enable-libgcj : (reconfigured) ../gcc-3.0.2/configure --prefix=/import/gcc-3.0.2 --with-local-prefix=/import/local --enable-libgcj
>Description:
>How-To-Repeat:
It happenes reproducable (here) if I compile original vim60
with or without patches with eighter gcc 3.0.1 or 3.0.2.
You can try this by running vim's configure as:
(Of course you'll have to replace the '...' :-)
----------------------------------------------------------- snip ---
./configure --prefix=... --with-features=huge \
--with-compiledby=... --disable-perlinterp \
--disable-pythoninterp --disable-tclinterp --disable-rubyinterp \
--disable-cscope --disable-workshop --disable-sniff \
--enable-multibyte --disable-hangulinput --disable-xim \
--disable-fontset --without-x --disable-gui --disable-gtk-check \
--disable-gnome-check --disable-motif-check --disable-athena-check \
--disable-gtktest --without-gnome --disable-gpm
------------------------------------------------------------ snip ---
then run the resulting vim without parameter and enter the command
:g/=/s/x/x/<Return>
and if you recompile message.c with only '-O' the error is gone.
The Variable 'regmatch.regprog' looses its contents during the call
of 'smsg' (message.c:296) at the end of ex_global.c line 4198.
The crash happenes when ex_global is freeing the overwritten
pointer later.
-------------------------- the preprocessor shows 'smsg' as: --------
# 292 "message.c"
int
smsg (char_u *, long, long, long, long, long, long, long, long, long, long);
int
smsg_attr (int, char_u *, long, long, long, long, long, long, long, long, long, long);
int
smsg(s, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10)
char_u *s;
long a1, a2, a3, a4, a5, a6, a7, a8, a9, a10;
{
return smsg_attr(0, s, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10);
}
int
smsg_attr(attr, s, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10)
int attr;
char_u *s;
long a1, a2, a3, a4, a5, a6, a7, a8, a9, a10;
{
sprintf((char *)IObuff, (char *)s, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10);
return msg_attr(IObuff, attr);
}
--------------------------- snip ---------------------------------
>Fix:
compiling the one file (message.c) again with -O instead of -O2
>Release-Note:
>Audit-Trail:
>Unformatted: