This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/44613] Declaring an array with non-constant length inside a switch corrupts stack pointer.
- From: "manu at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 21 Jun 2010 16:51:06 -0000
- Subject: [Bug c++/44613] Declaring an array with non-constant length inside a switch corrupts stack pointer.
- References: <bug-44613-19353@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #4 from manu at gcc dot gnu dot org 2010-06-21 16:51 -------
(In reply to comment #3)
> (In reply to comment #1)
> > (In reply to comment #0)
> > > The following program compiles with g++ -O3 without errors or warnings
> >
> > Not with warnings enabled it doesn't!
> >
>
> Sorry,
>
> g++ -O3 -Wall -Wextra switch-crash.cpp gives:
>
> switch-crash.cpp: In function ?int f(int)?:
> switch-crash.cpp:6: warning: unused variable ?x?
> switch-crash.cpp:10: warning: no return statement in function returning
> non-void
If you add return 0 after the printf, this warning is silenced and it still
crashes (it crashes for me even at -O0).
> switch-crash.cpp:7: warning: ?saved_stack.1? is used uninitialized in this
> function
>
> The ?saved_stack.1? is somewhat suspicious.
It is a bug anyway, because internal variables should never be warned.
--
manu at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Last reconfirmed|0000-00-00 00:00:00 |2010-06-21 16:51:06
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44613