public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug other/31827]  New: limits-exprparen.c: Pid 2297 received a SIGSEGV for stack growth failure
@ 2007-05-04 23:03 danglin at gcc dot gnu dot org
  2007-05-07  1:29 ` [Bug other/31827] " pinskia at gcc dot gnu dot org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: danglin at gcc dot gnu dot org @ 2007-05-04 23:03 UTC (permalink / raw)
  To: gcc-bugs

Executing on host: /test/gnu/gcc/objdir/gcc/xgcc -B/test/gnu/gcc/objdir/gcc/  
-
O0  -w -fno-show-column -c  -o limits-exprparen.o
/test/gnu/gcc/gcc/gcc/testsuit
e/gcc.c-torture/compile/limits-exprparen.c    (timeout = 300)
^M
Pid 2297 received a SIGSEGV for stack growth failure.^M
Possble causes: insufficient memory or swap space,^M
or stack size exceeded maxssiz. ^M
xgcc: Internal error: Segmentation fault (program cc1)

Fails at all optimizations.

-bash-2.05b$ ./xgcc -B./ -v
Reading specs from ./specs
Target: hppa64-hp-hpux11.11
Configured with: ../gcc/configure --with-gnu-as --with-as=/opt/gnu64/bin/as
--with-ld=/usr/ccs/bin/ld --enable-shared --disable-nls
--with-local-prefix=/opt/gnu64 --prefix=/opt/gnu64/gcc/gcc-4.3.0
--host=hppa64-hp-hpux11.11 --enable-threads=posix --disable-libmudflap
--with-gmp=/opt/gnu64/gcc/gcc-4.3.0
--enable-languages=c,c++,fortran,objc,obj-c++,java
Thread model: posix
gcc version 4.3.0 20070503 (experimental)


-- 
           Summary: limits-exprparen.c: Pid 2297 received a SIGSEGV for
                    stack growth failure
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: other
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: danglin at gcc dot gnu dot org
 GCC build triplet: hppa64-hp-hpux11.11
  GCC host triplet: hppa64-hp-hpux11.11
GCC target triplet: hppa64-hp-hpux11.11


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


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

* [Bug other/31827] limits-exprparen.c: Pid 2297 received a SIGSEGV for stack growth failure
  2007-05-04 23:03 [Bug other/31827] New: limits-exprparen.c: Pid 2297 received a SIGSEGV for stack growth failure danglin at gcc dot gnu dot org
@ 2007-05-07  1:29 ` pinskia at gcc dot gnu dot org
  2007-05-23 21:19 ` sje at cup dot hp dot com
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-05-07  1:29 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2007-05-07 02:29 -------
I see this also on powerpc64 with a cross to spu-elf.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pinskia at gcc dot gnu dot
                   |                            |org
  GCC build triplet|hppa64-hp-hpux11.11         |
 GCC target triplet|hppa64-hp-hpux11.11         |


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


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

* [Bug other/31827] limits-exprparen.c: Pid 2297 received a SIGSEGV for stack growth failure
  2007-05-04 23:03 [Bug other/31827] New: limits-exprparen.c: Pid 2297 received a SIGSEGV for stack growth failure danglin at gcc dot gnu dot org
  2007-05-07  1:29 ` [Bug other/31827] " pinskia at gcc dot gnu dot org
@ 2007-05-23 21:19 ` sje at cup dot hp dot com
  2007-05-23 23:53 ` dave at hiauly1 dot hia dot nrc dot ca
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: sje at cup dot hp dot com @ 2007-05-23 21:19 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from sje at cup dot hp dot com  2007-05-23 22:19 -------
I am not sure what, if anything, we should do with this bug report.  The
compiler is working as designed, the test case has a very large number of
nested parenthesis which causes the parser to recurse over and over as it
parses through the expression.  If you have enough stack space (and swap space)
the test seems to compile fine in a reasonable amount of time.  If you run out
of stack space or run out of swap space then the test fails.

This test runs fine on my IA64 HP-UX and Linux boxes and on my HPPA HP-UX boxes
where I have increased the stack size.  If I change the test case to do more
nesting, I can get it to fail.


-- 

sje at cup dot hp dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |sje at cup dot hp dot com


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


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

* [Bug other/31827] limits-exprparen.c: Pid 2297 received a SIGSEGV for stack growth failure
  2007-05-04 23:03 [Bug other/31827] New: limits-exprparen.c: Pid 2297 received a SIGSEGV for stack growth failure danglin at gcc dot gnu dot org
  2007-05-07  1:29 ` [Bug other/31827] " pinskia at gcc dot gnu dot org
  2007-05-23 21:19 ` sje at cup dot hp dot com
@ 2007-05-23 23:53 ` dave at hiauly1 dot hia dot nrc dot ca
  2008-12-29  7:27 ` pinskia at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: dave at hiauly1 dot hia dot nrc dot ca @ 2007-05-23 23:53 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from dave at hiauly1 dot hia dot nrc dot ca  2007-05-24 00:53 -------
Subject: Re:  limits-exprparen.c: Pid 2297 received a SIGSEGV for stack growth
failure

> This test runs fine on my IA64 HP-UX and Linux boxes and on my HPPA HP-UX boxes
> where I have increased the stack size.  If I change the test case to do more
> nesting, I can get it to fail.

For the record, these are the limits on the machine where I saw
the failure:

-bash-2.05b$ ulimit -a
core file size        (blocks, -c) 2097151
data seg size         (kbytes, -d) 786432
file size             (blocks, -f) unlimited
max memory size       (kbytes, -m) unlimited
open files                    (-n) 256
pipe size          (512 bytes, -p) 16
stack size            (kbytes, -s) 16384
cpu time             (seconds, -t) unlimited
max user processes            (-u) 76
virtual memory        (kbytes, -v) unlimited

I believe the stack size limit is double the default value.  The machine
has 7 GB of memory, so I doubt swap is an issue.

It's my personal belief that nesting routines to great depths
is bad design.  It makes debugging nearly impossible.  It's
possible we are hurt on hppa64 because the argument pointer isn't
a fixed register and this prevents the sibcall optimization
from occurring.

Dave


-- 


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


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

* [Bug middle-end/31827] limits-exprparen.c: Pid 2297 received a SIGSEGV for stack growth failure
  2007-05-04 23:03 [Bug other/31827] New: limits-exprparen.c: Pid 2297 received a SIGSEGV for stack growth failure danglin at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2008-12-29  7:27 ` pinskia at gcc dot gnu dot org
@ 2008-12-29  7:27 ` pinskia at gcc dot gnu dot org
  2009-07-23  6:53 ` ubizjak at gmail dot com
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-12-29  7:27 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from pinskia at gcc dot gnu dot org  2008-12-29 07:24 -------
Confirmed.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
          Component|other                       |middle-end
     Ever Confirmed|0                           |1
           Keywords|                            |ice-on-valid-code
   Last reconfirmed|0000-00-00 00:00:00         |2008-12-29 07:24:07
               date|                            |


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


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

* [Bug other/31827] limits-exprparen.c: Pid 2297 received a SIGSEGV for stack growth failure
  2007-05-04 23:03 [Bug other/31827] New: limits-exprparen.c: Pid 2297 received a SIGSEGV for stack growth failure danglin at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2007-05-23 23:53 ` dave at hiauly1 dot hia dot nrc dot ca
@ 2008-12-29  7:27 ` pinskia at gcc dot gnu dot org
  2008-12-29  7:27 ` [Bug middle-end/31827] " pinskia at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-12-29  7:27 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from pinskia at gcc dot gnu dot org  2008-12-29 07:23 -------
*** Bug 38605 has been marked as a duplicate of this bug. ***


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |howarth at nitro dot med dot
                   |                            |uc dot edu


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


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

* [Bug middle-end/31827] limits-exprparen.c: Pid 2297 received a SIGSEGV for stack growth failure
  2007-05-04 23:03 [Bug other/31827] New: limits-exprparen.c: Pid 2297 received a SIGSEGV for stack growth failure danglin at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2008-12-29  7:27 ` [Bug middle-end/31827] " pinskia at gcc dot gnu dot org
@ 2009-07-23  6:53 ` ubizjak at gmail dot com
  2009-11-03 10:23 ` bonzini at gnu dot org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: ubizjak at gmail dot com @ 2009-07-23  6:53 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from ubizjak at gmail dot com  2009-07-23 06:52 -------
This happens also with default settings on CentOS 5.3 x86_64 and F11 x86_64,
current mainline gcc-4.5.0.


-- 

ubizjak at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ubizjak at gmail dot com
      Known to fail|                            |4.5.0


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


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

* [Bug middle-end/31827] limits-exprparen.c: Pid 2297 received a SIGSEGV for stack growth failure
  2007-05-04 23:03 [Bug other/31827] New: limits-exprparen.c: Pid 2297 received a SIGSEGV for stack growth failure danglin at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2009-07-23  6:53 ` ubizjak at gmail dot com
@ 2009-11-03 10:23 ` bonzini at gnu dot org
  2009-11-03 12:23 ` bonzini at gnu dot org
  2009-11-03 18:59 ` bonzini at gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: bonzini at gnu dot org @ 2009-11-03 10:23 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from bonzini at gnu dot org  2009-11-03 10:23 -------
Part of the problem is that for each open parenthesis we go through

c_parser_postfix_expression
c_parser_expression
c_parser_expr_no_commas
c_parser_conditional_expression
c_parser_binary_expression
c_parser_cast_expression
c_parser_unary_expression

and back to c_parser_postfix_expression.  c_parser_binary_expression has a
_huge_ stack impact, this should be fixed.


-- 

bonzini at gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |bonzini at gnu dot org
                   |dot org                     |
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2008-12-29 07:24:07         |2009-11-03 10:23:32
               date|                            |


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


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

* [Bug middle-end/31827] limits-exprparen.c: Pid 2297 received a SIGSEGV for stack growth failure
  2007-05-04 23:03 [Bug other/31827] New: limits-exprparen.c: Pid 2297 received a SIGSEGV for stack growth failure danglin at gcc dot gnu dot org
                   ` (6 preceding siblings ...)
  2009-11-03 10:23 ` bonzini at gnu dot org
@ 2009-11-03 12:23 ` bonzini at gnu dot org
  2009-11-03 18:59 ` bonzini at gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: bonzini at gnu dot org @ 2009-11-03 12:23 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from bonzini at gnu dot org  2009-11-03 12:23 -------
Created an attachment (id=18953)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=18953&action=view)
patch to fix the bug

The attached patches together reduce the stack usage of expression parsing by
~30%.  On a 64-bit machine with 8 MB the parsing now fails after 10300
recursions instead of 7100.

This still means that one pair of parentheses consumes about 100 words on the
stack.


-- 


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


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

* [Bug middle-end/31827] limits-exprparen.c: Pid 2297 received a SIGSEGV for stack growth failure
  2007-05-04 23:03 [Bug other/31827] New: limits-exprparen.c: Pid 2297 received a SIGSEGV for stack growth failure danglin at gcc dot gnu dot org
                   ` (7 preceding siblings ...)
  2009-11-03 12:23 ` bonzini at gnu dot org
@ 2009-11-03 18:59 ` bonzini at gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: bonzini at gnu dot org @ 2009-11-03 18:59 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from bonzini at gnu dot org  2009-11-03 18:58 -------
The patch is not enough for mainline because some functions have a bigger stack
frame.  With the patch, mainline aborts after 9827 recursive calls.


-- 

bonzini at gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ra


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


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

end of thread, other threads:[~2009-11-03 18:59 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-05-04 23:03 [Bug other/31827] New: limits-exprparen.c: Pid 2297 received a SIGSEGV for stack growth failure danglin at gcc dot gnu dot org
2007-05-07  1:29 ` [Bug other/31827] " pinskia at gcc dot gnu dot org
2007-05-23 21:19 ` sje at cup dot hp dot com
2007-05-23 23:53 ` dave at hiauly1 dot hia dot nrc dot ca
2008-12-29  7:27 ` pinskia at gcc dot gnu dot org
2008-12-29  7:27 ` [Bug middle-end/31827] " pinskia at gcc dot gnu dot org
2009-07-23  6:53 ` ubizjak at gmail dot com
2009-11-03 10:23 ` bonzini at gnu dot org
2009-11-03 12:23 ` bonzini at gnu dot org
2009-11-03 18:59 ` bonzini at 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).