Bug 62073 - Segmentation fault with tree vectorize
Summary: Segmentation fault with tree vectorize
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c (show other bugs)
Version: 5.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-08-09 03:57 UTC by Fei Yang
Modified: 2014-08-13 10:12 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Fei Yang 2014-08-09 03:57:44 UTC
1. Testcase generated by Csmith:

struct S0
{
    int f7;
};
struct S0 g_50;
int g_70;
int g_76;

int foo (long long p_56, int * p_57)
{
    int *l_77;
    int l_101;

    for (; g_70;)
    {
        int **l_78 = &l_77;
        if (g_50.f7)
            continue;
        *l_78 = 0;
    }
    for (g_76 = 1; g_76 >= 0; g_76--)
    {
        int *l_90;
        for (l_101 = 4; l_101 >= 0; l_101--)
            if (l_101)
                *l_90 = 0;
            else
            {
                int **l_113 = &l_77;
                *l_113 = p_57;
            }
    }

    return *l_77;
}

2. Compile option and result:
supertux@localhost:~/test> ~/gcc-devel/install/bin/gcc -O1 foo.c -S -ftree-vectorize
foo.c: In function ‘foo’:
foo.c:10:5: internal compiler error: Segmentation fault
 int foo (long long p_56, int * p_57)
     ^
0xbeaed9 crash_signal
	../../trunk/gcc/toplev.c:337
0x773af6 flow_bb_inside_loop_p(loop const*, basic_block_def const*)
	../../trunk/gcc/cfgloop.c:789
0xe40de0 vect_is_simple_reduction_1
	../../trunk/gcc/tree-vect-loop.c:2324
0xe41bc6 vect_force_simple_reduction(_loop_vec_info*, gimple_statement_base*, bool, bool*)
	../../trunk/gcc/tree-vect-loop.c:2617
0xe45eee vect_analyze_scalar_cycles_1
	../../trunk/gcc/tree-vect-loop.c:710
0xe4607c vect_analyze_scalar_cycles
	../../trunk/gcc/tree-vect-loop.c:784
0xe475db vect_analyze_loop_2
	../../trunk/gcc/tree-vect-loop.c:1665
0xe47b92 vect_analyze_loop(loop*)
	../../trunk/gcc/tree-vect-loop.c:1864
0xe5b742 vectorize_loops()
	../../trunk/gcc/tree-vectorizer.c:432
0xd687b0 execute
	../../trunk/gcc/tree-ssa-loop.c:232
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.

3. GCC version:
supertux@localhost:~/test> ~/gcc-devel/install/bin/gcc -v
Using built-in specs.
COLLECT_GCC=/home/supertux/gcc-devel/install/bin/gcc
COLLECT_LTO_WRAPPER=/home/supertux/gcc-devel/install/libexec/gcc/x86_64-suse-linux/4.10.0/lto-wrapper
Target: x86_64-suse-linux
Configured with: ../trunk/configure --build=x86_64-suse-linux --prefix=/home/supertux/gcc-devel/install --enable-languages=c --enable-checking --disable-libmudflap --disable-libssp --with-cpu=generic --disable-bootstrap
Thread model: posix
gcc version 4.10.0 20140809 (experimental) (GCC)
Comment 1 Richard Biener 2014-08-11 11:25:07 UTC
Author: rguenth
Date: Mon Aug 11 11:24:35 2014
New Revision: 213812

URL: https://gcc.gnu.org/viewcvs?rev=213812&root=gcc&view=rev
Log:
2014-08-11  Felix Yang  <fei.yang0953@gmail.com>

	PR tree-optimization/62073
	* tree-vect-loop.c (vect_is_simple_reduction_1): Check that DEF1 has
	a basic block.

	* gcc.dg/vect/pr62073.c: New test.

Added:
    trunk/gcc/testsuite/gcc.dg/vect/pr62073.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-vect-loop.c
Comment 2 Richard Biener 2014-08-11 12:37:16 UTC
Fixed.
Comment 3 Richard Biener 2014-08-13 10:03:47 UTC
Author: rguenth
Date: Wed Aug 13 10:03:15 2014
New Revision: 213901

URL: https://gcc.gnu.org/viewcvs?rev=213901&root=gcc&view=rev
Log:
2014-08-12  Felix Yang  <fei.yang0953@gmail.com>

	PR tree-optimization/62073
	* tree-vect-loop.c (vect_is_simple_reduction_1): Check that DEF1 has
	a basic block.

	* gcc.dg/vect/pr62073.c: New test.

Added:
    branches/gcc-4_9-branch/gcc/testsuite/gcc.dg/vect/pr62073.c
Modified:
    branches/gcc-4_9-branch/gcc/ChangeLog
    branches/gcc-4_9-branch/gcc/testsuite/ChangeLog
    branches/gcc-4_9-branch/gcc/tree-vect-loop.c
Comment 4 Richard Biener 2014-08-13 10:12:22 UTC
Author: rguenth
Date: Wed Aug 13 10:11:49 2014
New Revision: 213904

URL: https://gcc.gnu.org/viewcvs?rev=213904&root=gcc&view=rev
Log:
2014-08-13  Felix Yang  <fei.yang0953@gmail.com>

	PR tree-optimization/62073
	* tree-vect-loop.c (vect_is_simple_reduction_1): Check that DEF1 has
	a basic block.

	* gcc.dg/vect/pr62073.c: New test.

Added:
    branches/gcc-4_8-branch/gcc/testsuite/gcc.dg/vect/pr62073.c
Modified:
    branches/gcc-4_8-branch/gcc/ChangeLog
    branches/gcc-4_8-branch/gcc/testsuite/ChangeLog
    branches/gcc-4_8-branch/gcc/tree-vect-loop.c