Bug 46637 - [4.6 Regression] SIGSEGV in if_then_else_cond - too deep recursion
Summary: [4.6 Regression] SIGSEGV in if_then_else_cond - too deep recursion
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 4.6.0
: P3 normal
Target Milestone: 4.6.0
Assignee: Jakub Jelinek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-11-24 06:58 UTC by Dmitry Gorbachev
Modified: 2010-11-25 18:12 UTC (History)
1 user (show)

See Also:
Host: i686-pc-linux-gnu-gcc
Target: i686-pc-linux-gnu-gcc
Build: i686-pc-linux-gnu-gcc
Known to work:
Known to fail:
Last reconfirmed: 2010-11-24 13:45:43


Attachments
Preprocessed Linux source file (in bzip2 format) (183.78 KB, application/octet-stream)
2010-11-24 06:58 UTC, Dmitry Gorbachev
Details
Backtrace in GDB (952 bytes, text/plain)
2010-11-24 06:59 UTC, Dmitry Gorbachev
Details
gcc46-pr46637.patch (605 bytes, patch)
2010-11-24 13:45 UTC, Jakub Jelinek
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dmitry Gorbachev 2010-11-24 06:58:56 UTC
Created attachment 22505 [details]
Preprocessed Linux source file (in bzip2 format)

Compile with:

gcc -m32 -msoft-float -mregparm=3 -mpreferred-stack-boundary=2 -fno-strict-aliasing -fno-common -fno-delete-null-pointer-checks -freg-struct-return -ffreestanding -fno-asynchronous-unwind-tables -fno-stack-protector -fno-omit-frame-pointer -fno-optimize-sibling-calls -fno-strict-overflow -fconserve-stack -Os tcp_input.i
Comment 1 Dmitry Gorbachev 2010-11-24 06:59:44 UTC
Created attachment 22506 [details]
Backtrace in GDB
Comment 2 Jakub Jelinek 2010-11-24 10:32:26 UTC
Reducing...
Comment 3 Jakub Jelinek 2010-11-24 12:38:20 UTC
Reduced testcase, fails on x86_64-linux with -m32 and -O{2,s} {,-fno-strict-aliasing}.  Looking into it...

struct S { unsigned s[5]; } *p;

void
foo (int x)
{
  int a = x == 1 ? 4 : 1;
  asm ("" : "+m" (p->s[a]));
  *(unsigned *) p += 1;
}
Comment 4 Jakub Jelinek 2010-11-24 13:45:43 UTC
Created attachment 22510 [details]
gcc46-pr46637.patch

Untested fix.
Comment 5 Jakub Jelinek 2010-11-25 18:01:00 UTC
Author: jakub
Date: Thu Nov 25 18:00:47 2010
New Revision: 167148

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=167148
Log:
	PR middle-end/46637
	* combine.c (try_combine): When substing i2dest for i2src, pass
	1 as last argument even if
	i0_feeds_i1_n && i1_feeds_i2_n && i0dest_in_i0src.

	* gcc.c-torture/compile/pr46637.c: New test.

Added:
    trunk/gcc/testsuite/gcc.c-torture/compile/pr46637.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/combine.c
    trunk/gcc/testsuite/ChangeLog
Comment 6 Jakub Jelinek 2010-11-25 18:12:59 UTC
Fixed.