public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/23054] New: Segmentation fault when large static array is declared
@ 2005-07-25  2:49 relf at os2 dot ru
  2005-07-25  2:53 ` [Bug c/23054] " pinskia at gcc dot gnu dot org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: relf at os2 dot ru @ 2005-07-25  2:49 UTC (permalink / raw)
  To: gcc-bugs

The following program causes Segmentation fault being compiled with
gcc (GCC) 4.0.1 (Debian 4.0.1-2)

#include <stdio.h>
int main() {
    char A[ 1UL << 24 ];
    A[0] = 0;
    puts("OK");
    return 0;
}

$ gcc test.c
$ ./a.out
Segmentation fault

If array of the same size (16M) is dinamically allocated (e.g., via malloc())
everything works as expected.

debian-amd64 with 4G physical memory here.

-- 
           Summary: Segmentation fault when large static array is declared
           Product: gcc
           Version: 4.0.1
            Status: UNCONFIRMED
          Severity: critical
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: relf at os2 dot ru
                CC: gcc-bugs at gcc dot gnu dot org


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


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

* [Bug c/23054] Segmentation fault when large static array is declared
  2005-07-25  2:49 [Bug c/23054] New: Segmentation fault when large static array is declared relf at os2 dot ru
@ 2005-07-25  2:53 ` pinskia at gcc dot gnu dot org
  2005-07-25  7:39 ` relf at os2 dot ru
  2005-07-25 12:51 ` pinskia at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-07-25  2:53 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-07-25 02:49 -------
This is not a bug.  You are overflowing the stack.  You either can use malloc
or raise the stack limit.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


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


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

* [Bug c/23054] Segmentation fault when large static array is declared
  2005-07-25  2:49 [Bug c/23054] New: Segmentation fault when large static array is declared relf at os2 dot ru
  2005-07-25  2:53 ` [Bug c/23054] " pinskia at gcc dot gnu dot org
@ 2005-07-25  7:39 ` relf at os2 dot ru
  2005-07-25 12:51 ` pinskia at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: relf at os2 dot ru @ 2005-07-25  7:39 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From relf at os2 dot ru  2005-07-25 07:34 -------
(In reply to comment #1)
> This is not a bug.  You are overflowing the stack.

Should it be more intelligent error message like "Stack overflow" ?

-- 


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


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

* [Bug c/23054] Segmentation fault when large static array is declared
  2005-07-25  2:49 [Bug c/23054] New: Segmentation fault when large static array is declared relf at os2 dot ru
  2005-07-25  2:53 ` [Bug c/23054] " pinskia at gcc dot gnu dot org
  2005-07-25  7:39 ` relf at os2 dot ru
@ 2005-07-25 12:51 ` pinskia at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-07-25 12:51 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-07-25 12:36 -------
(In reply to comment #2)
> Should it be more intelligent error message like "Stack overflow" ?
That is still not a GCC bug, report this enhancement to the OS you are using since that is where the 
message is comming from.

-- 


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


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

end of thread, other threads:[~2005-07-25 12:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-07-25  2:49 [Bug c/23054] New: Segmentation fault when large static array is declared relf at os2 dot ru
2005-07-25  2:53 ` [Bug c/23054] " pinskia at gcc dot gnu dot org
2005-07-25  7:39 ` relf at os2 dot ru
2005-07-25 12:51 ` 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).