Bug 53849 - [4.8 Regression] ICE: in add_referenced_var_1, at tree-dfa.c:567 with -O2 -ftree-parallelize-loops=2 -fno-tree-loop-im
Summary: [4.8 Regression] ICE: in add_referenced_var_1, at tree-dfa.c:567 with -O2 -ft...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 4.8.0
: P3 normal
Target Milestone: 4.8.0
Assignee: Richard Biener
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2012-07-04 06:45 UTC by Zdenek Sojka
Modified: 2012-07-04 12:12 UTC (History)
0 users

See Also:
Host: x86_64-pc-linux-gnu
Target: x86_64-pc-linux-gnu
Build:
Known to work: 4.6.4, 4.7.2
Known to fail: 4.8.0
Last reconfirmed: 2012-07-04 00:00:00


Attachments
reduced testcase (97 bytes, text/x-csrc)
2012-07-04 06:45 UTC, Zdenek Sojka
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Zdenek Sojka 2012-07-04 06:45:37 UTC
Created attachment 27740 [details]
reduced testcase

Compiler output:
$ gcc -O2 -ftree-parallelize-loops=2 -fno-tree-loop-im testcase.c         
testcase.c: In function 'foo':
testcase.c:8:11: internal compiler error: in add_referenced_var_1, at tree-dfa.c:567
     while (--d)
           ^
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

(gdb) bt
#0  fancy_abort (file=0x122de40 "/mnt/svn/gcc-trunk/gcc/tree-dfa.c", line=567, function=0x122e0a0 "add_referenced_var_1")
    at /mnt/svn/gcc-trunk/gcc/diagnostic.c:1010
#1  0x0000000000a240c7 in add_referenced_var_1 (var=0x7ffff6cf11e0, fn=<optimized out>) at /mnt/svn/gcc-trunk/gcc/tree-dfa.c:565
#2  0x0000000000a083d2 in move_stmt_op (tp=0x7ffff6e22020, walk_subtrees=0x7fffffffccac, data=<optimized out>)
    at /mnt/svn/gcc-trunk/gcc/tree-cfg.c:6032
#3  0x0000000000be8b5c in walk_tree_1 (tp=0x7ffff6e22020, func=0xa08200 <move_stmt_op(tree*, int*, void*)>, data=0x7fffffffcf20, pset=0x0, lh=0)
    at /mnt/svn/gcc-trunk/gcc/tree.c:10572
#4  0x0000000000be92f9 in walk_tree_1 (tp=0x7ffff6e0c410, func=0xa08200 <move_stmt_op(tree*, int*, void*)>, data=0x7fffffffcf20, pset=0x0, lh=0)
    at /mnt/svn/gcc-trunk/gcc/tree.c:10828
#5  0x000000000081fc06 in walk_gimple_op (stmt=0x7ffff6e0c3c0, callback_op=0xa08200 <move_stmt_op(tree*, int*, void*)>, wi=0x7fffffffcf20)
    at /mnt/svn/gcc-trunk/gcc/gimple.c:1463
#6  0x000000000081ffed in walk_gimple_stmt (gsi=0x7fffffffcf00, 
    callback_stmt=0xa0e730 <move_stmt_r(gimple_stmt_iterator*, bool*, walk_stmt_info*)>, callback_op=0xa08200 <move_stmt_op(tree*, int*, void*)>, 
    wi=0x7fffffffcf20) at /mnt/svn/gcc-trunk/gcc/gimple.c:1757
#7  0x0000000000a18186 in move_block_to_fn (d=0x7fffffffcf60, update_edge_count_p=<optimized out>, after=<optimized out>, bb=<optimized out>, 
    dest_cfun=0x7ffff6e300a0) at /mnt/svn/gcc-trunk/gcc/tree-cfg.c:6263
#8  move_sese_region_to_fn (dest_cfun=0x7ffff6e300a0, entry_bb=<optimized out>, exit_bb=<optimized out>, orig_block=<optimized out>)
    at /mnt/svn/gcc-trunk/gcc/tree-cfg.c:6551
#9  0x00000000008e4d4b in expand_omp_taskreg (region=0x18dbae0) at /mnt/svn/gcc-trunk/gcc/omp-low.c:3570
#10 0x00000000008e60c8 in expand_omp (region=0x18dbae0) at /mnt/svn/gcc-trunk/gcc/omp-low.c:5598
#11 0x00000000008ef311 in omp_expand_local (head=<optimized out>) at /mnt/svn/gcc-trunk/gcc/omp-low.c:5735
#12 0x0000000000a6f0a6 in gen_parallel_loop (n_threads=<optimized out>, reduction_list=<optimized out>, loop=0x0, niter=<optimized out>)
    at /mnt/svn/gcc-trunk/gcc/tree-parloops.c:1888
#13 parallelize_loops () at /mnt/svn/gcc-trunk/gcc/tree-parloops.c:2210
#14 0x0000000000afeb07 in tree_parallelize_loops () at /mnt/svn/gcc-trunk/gcc/tree-ssa-loop.c:545
#15 0x000000000090c7d5 in execute_one_pass (pass=0x1759040) at /mnt/svn/gcc-trunk/gcc/passes.c:2165
#16 0x000000000090cb95 in execute_pass_list (pass=0x1759040) at /mnt/svn/gcc-trunk/gcc/passes.c:2220
#17 0x000000000090cba7 in execute_pass_list (pass=0x1759580) at /mnt/svn/gcc-trunk/gcc/passes.c:2221
#18 0x000000000090cba7 in execute_pass_list (pass=0x1756ae0) at /mnt/svn/gcc-trunk/gcc/passes.c:2221
#19 0x00000000006b7f98 in expand_function (node=0x7ffff6cef750) at /mnt/svn/gcc-trunk/gcc/cgraphunit.c:1615
#20 0x00000000006b9d74 in expand_all_functions () at /mnt/svn/gcc-trunk/gcc/cgraphunit.c:1720
#21 compile () at /mnt/svn/gcc-trunk/gcc/cgraphunit.c:2018
#22 0x00000000006ba335 in finalize_compilation_unit () at /mnt/svn/gcc-trunk/gcc/cgraphunit.c:2095
#23 0x000000000059bb10 in c_write_global_declarations () at /mnt/svn/gcc-trunk/gcc/c/c-decl.c:10116
#24 0x00000000009f6ff5 in compile_file () at /mnt/svn/gcc-trunk/gcc/toplev.c:564
#25 0x00000000009f8b98 in do_compile () at /mnt/svn/gcc-trunk/gcc/toplev.c:1867
#26 toplev_main (argc=16, argv=0x7fffffffd6b8) at /mnt/svn/gcc-trunk/gcc/toplev.c:1943
#27 0x00007ffff6f052ad in __libc_start_main () from /lib64/libc.so.6
#28 0x000000000057ef11 in _start ()

Tested revisions:
r189246 - crash
4.7 r188682 - OK
4.6 r188682 - OK
Comment 1 Richard Biener 2012-07-04 09:19:53 UTC
Mine.
Comment 2 Richard Biener 2012-07-04 12:09:20 UTC
Author: rguenth
Date: Wed Jul  4 12:09:09 2012
New Revision: 189255

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=189255
Log:
2012-07-04  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/53849
	* tree-cfg.c (move_stmt_op): Only call add_referenced_var
	for duplicated locals.  Use add_referenced_var_1 to avoid
	pushing/popping cfun.

	* gcc.dg/pr53849.c: New testcase.

Added:
    trunk/gcc/testsuite/gcc.dg/pr53849.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-cfg.c
Comment 3 Richard Biener 2012-07-04 12:12:01 UTC
Fixed.