public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/44613] Declaring an array with non-constant length inside a switch corrupts stack pointer.
       [not found] <bug-44613-4@http.gcc.gnu.org/bugzilla/>
@ 2011-03-30  9:17 ` yselkowitz at users dot sourceforge.net
  2014-04-04 19:36 ` jason at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 9+ messages in thread
From: yselkowitz at users dot sourceforge.net @ 2011-03-30  9:17 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44613

--- Comment #7 from Yaakov (Cygwin Ports) <yselkowitz at users dot sourceforge.net> 2011-03-30 09:11:43 UTC ---
Isn't this just a case of "jump to case label crosses initialization", which is
now an error?


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/44613] Declaring an array with non-constant length inside a switch corrupts stack pointer.
       [not found] <bug-44613-4@http.gcc.gnu.org/bugzilla/>
  2011-03-30  9:17 ` [Bug c++/44613] Declaring an array with non-constant length inside a switch corrupts stack pointer yselkowitz at users dot sourceforge.net
@ 2014-04-04 19:36 ` jason at gcc dot gnu.org
  2020-04-04  7:23 ` asolokha at gmx dot com
  2021-08-22 22:19 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 9+ messages in thread
From: jason at gcc dot gnu.org @ 2014-04-04 19:36 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44613

--- Comment #9 from Jason Merrill <jason at gcc dot gnu.org> ---
Author: jason
Date: Fri Apr  4 19:36:00 2014
New Revision: 209125

URL: http://gcc.gnu.org/viewcvs?rev=209125&root=gcc&view=rev
Log:
    PR c++/44613
    * semantics.c (add_stmt): Set STATEMENT_LIST_HAS_LABEL.
    * decl.c (cp_finish_decl): Create a new BIND_EXPR before
    instantiating a variable-sized type.

Added:
    trunk/gcc/testsuite/g++.dg/ext/vla15.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/decl.c
    trunk/gcc/cp/semantics.c


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/44613] Declaring an array with non-constant length inside a switch corrupts stack pointer.
       [not found] <bug-44613-4@http.gcc.gnu.org/bugzilla/>
  2011-03-30  9:17 ` [Bug c++/44613] Declaring an array with non-constant length inside a switch corrupts stack pointer yselkowitz at users dot sourceforge.net
  2014-04-04 19:36 ` jason at gcc dot gnu.org
@ 2020-04-04  7:23 ` asolokha at gmx dot com
  2021-08-22 22:19 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 9+ messages in thread
From: asolokha at gmx dot com @ 2020-04-04  7:23 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=44613

Arseny Solokha <asolokha at gmx dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |asolokha at gmx dot com

--- Comment #10 from Arseny Solokha <asolokha at gmx dot com> ---
I believe this PR can be closed.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/44613] Declaring an array with non-constant length inside a switch corrupts stack pointer.
       [not found] <bug-44613-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2020-04-04  7:23 ` asolokha at gmx dot com
@ 2021-08-22 22:19 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-22 22:19 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=44613

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.9.0
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #11 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Fixed.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/44613] Declaring an array with non-constant length inside a switch corrupts stack pointer.
  2010-06-21 15:42 [Bug c++/44613] New: " mark dot haines at openmarket dot com
                   ` (3 preceding siblings ...)
  2010-06-21 16:51 ` manu at gcc dot gnu dot org
@ 2010-07-21 23:45 ` pinskia at gcc dot gnu dot org
  4 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2010-07-21 23:45 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from pinskia at gcc dot gnu dot org  2010-07-21 23:45 -------
It is the gimplification of SWITCH_STMT which is a C++ front-end tree.

Works with the C front-end too.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|middle-end                  |c++


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44613


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/44613] Declaring an array with non-constant length inside a switch corrupts stack pointer.
  2010-06-21 15:42 [Bug c++/44613] New: " mark dot haines at openmarket dot com
                   ` (2 preceding siblings ...)
  2010-06-21 16:47 ` mark dot haines at openmarket dot com
@ 2010-06-21 16:51 ` manu at gcc dot gnu dot org
  2010-07-21 23:45 ` pinskia at gcc dot gnu dot org
  4 siblings, 0 replies; 9+ messages in thread
From: manu at gcc dot gnu dot org @ 2010-06-21 16:51 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1328 bytes --]



------- 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


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/44613] Declaring an array with non-constant length inside a switch corrupts stack pointer.
  2010-06-21 15:42 [Bug c++/44613] New: " mark dot haines at openmarket dot com
  2010-06-21 16:23 ` [Bug c++/44613] " redi at gcc dot gnu dot org
  2010-06-21 16:46 ` manu at gcc dot gnu dot org
@ 2010-06-21 16:47 ` mark dot haines at openmarket dot com
  2010-06-21 16:51 ` manu at gcc dot gnu dot org
  2010-07-21 23:45 ` pinskia at gcc dot gnu dot org
  4 siblings, 0 replies; 9+ messages in thread
From: mark dot haines at openmarket dot com @ 2010-06-21 16:47 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 690 bytes --]



------- Comment #3 from mark dot haines at openmarket dot com  2010-06-21 16:47 -------
(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
switch-crash.cpp:7: warning: ‘saved_stack.1’ is used uninitialized in this
function

The ‘saved_stack.1’ is somewhat suspicious. 


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44613


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/44613] Declaring an array with non-constant length inside a switch corrupts stack pointer.
  2010-06-21 15:42 [Bug c++/44613] New: " mark dot haines at openmarket dot com
  2010-06-21 16:23 ` [Bug c++/44613] " redi at gcc dot gnu dot org
@ 2010-06-21 16:46 ` manu at gcc dot gnu dot org
  2010-06-21 16:47 ` mark dot haines at openmarket dot com
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 9+ messages in thread
From: manu at gcc dot gnu dot org @ 2010-06-21 16:46 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from manu at gcc dot gnu dot org  2010-06-21 16:45 -------
(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!
> 

???


-- 

manu at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |manu at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44613


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/44613] Declaring an array with non-constant length inside a switch corrupts stack pointer.
  2010-06-21 15:42 [Bug c++/44613] New: " mark dot haines at openmarket dot com
@ 2010-06-21 16:23 ` redi at gcc dot gnu dot org
  2010-06-21 16:46 ` manu at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 9+ messages in thread
From: redi at gcc dot gnu dot org @ 2010-06-21 16:23 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from redi at gcc dot gnu dot org  2010-06-21 16:22 -------
(In reply to comment #0)
> The following program compiles with g++ -O3 without errors or warnings

Not with warnings enabled it doesn't!


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44613


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2021-08-22 22:19 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-44613-4@http.gcc.gnu.org/bugzilla/>
2011-03-30  9:17 ` [Bug c++/44613] Declaring an array with non-constant length inside a switch corrupts stack pointer yselkowitz at users dot sourceforge.net
2014-04-04 19:36 ` jason at gcc dot gnu.org
2020-04-04  7:23 ` asolokha at gmx dot com
2021-08-22 22:19 ` pinskia at gcc dot gnu.org
2010-06-21 15:42 [Bug c++/44613] New: " mark dot haines at openmarket dot com
2010-06-21 16:23 ` [Bug c++/44613] " redi at gcc dot gnu dot org
2010-06-21 16:46 ` manu at gcc dot gnu dot org
2010-06-21 16:47 ` mark dot haines at openmarket dot com
2010-06-21 16:51 ` manu at gcc dot gnu dot org
2010-07-21 23:45 ` pinskia at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).