Bug 38814 - valgrind returns Invalid write in reserve_phi_args_for_new_edge
Summary: valgrind returns Invalid write in reserve_phi_args_for_new_edge
Status: RESOLVED DUPLICATE of bug 40005
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 4.4.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-01-12 16:30 UTC by Joost VandeVondele
Modified: 2009-06-20 17:37 UTC (History)
2 users (show)

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 Joost VandeVondele 2009-01-12 16:30:05 UTC
version used for testing:

GNU Fortran (GCC) version 4.4.0 20090112 (experimental) [trunk revision 143288] (x86_64-unknown-linux-gnu)
        compiled by GNU C version 4.4.0 20090112 (experimental) [trunk revision 143288], GMP version 4.2.2, MPFR version 2.3.1.


valgrind --tool=memcheck /data03/vondele/gcc_trunk/build/libexec/gcc/x86_64-unknown-linux-gnu/4.4.0/f951 all.f90 -march=k8-sse3 -mcx16 -msahf --param l1-cache-size=64 --param l1-cache-line-size=64 --param l2-cache-size=1024 -mtune=k8 -quiet -dumpbase all.f90 -auxbase all -O3 -version -ffast-math -ftree-vectorize -ffree-form -fintrinsic-modules-path /data03/vondele/gcc_trunk/build/lib/gcc/x86_64-unknown-linux-gnu/4.4.0/finclude -o /tmp/ccIEjF0W.s

==22900==
==22900== Invalid write of size 8
==22900==    at 0x7A028D: reserve_phi_args_for_new_edge (tree-flow-inline.h:299)
==22900==    by 0xAE0332: redirect_edge_succ_nodup (cfg.c:410)
==22900==    by 0x751AC0: gimple_redirect_edge_and_branch (tree-cfg.c:4801)
==22900==    by 0xAF0479: redirect_edge_and_branch (cfghooks.c:323)
==22900==    by 0x75CFBC: cleanup_tree_cfg_bb (tree-cfgcleanup.c:413)
==22900==    by 0x75D71C: cleanup_tree_cfg (tree-cfgcleanup.c:594)
==22900==    by 0x69EE44: execute_function_todo (passes.c:923)
==22900==    by 0x69F06E: execute_todo (passes.c:1025)
==22900==    by 0x69F384: execute_one_pass (passes.c:1302)
==22900==    by 0x69F574: execute_pass_list (passes.c:1328)
==22900==    by 0x69F58C: execute_pass_list (passes.c:1329)
==22900==    by 0x69F58C: execute_pass_list (passes.c:1329)
==22900==  Address 0x200000008 is not stack'd, malloc'd or (recently) free'd
all.f90: In function ‘build_se_core_matrix’:
all.f90:364860: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

the testcase is all.f90 in http://www.pci.unizh.ch/vandevondele/tmp/CP2K_gcc_2007_06.tgz (see also comment #112 in PR29975). 

which unfortunately means it takes a couple of hours to reproduce through valgrind. I started the valgrinded compilation after having a segfault with a normal compilation that I couldn't reproduce in gdb. The latter really is a bit strange, just testing it again, segfaults out of gdb, doesn't segfault within gdb..
Comment 1 Joost VandeVondele 2009-01-12 17:39:51 UTC
things really have a random flavor right now. I have a bt for a segfault from gdb, within a couple of minutes now:

[.... repeats about 4000 times]
#4011 0x000000000049267d in gt_ggc_mx_lang_tree_node (x_p=<value optimized out>) at ./gt-fortran-f95-lang.h:213
#4012 0x00000000004921bf in gt_ggc_mx_lang_tree_node (x_p=<value optimized out>) at ./gt-fortran-f95-lang.h:315
#4013 0x00000000004921b1 in gt_ggc_mx_lang_tree_node (x_p=<value optimized out>) at ./gt-fortran-f95-lang.h:314
#4014 0x0000000000491d51 in gt_ggc_mx_lang_tree_node (x_p=<value optimized out>) at ./gt-fortran-f95-lang.h:471
#4015 0x00000000004921bf in gt_ggc_mx_lang_tree_node (x_p=<value optimized out>) at ./gt-fortran-f95-lang.h:315
#4016 0x00000000004922f1 in gt_ggc_mx_lang_tree_node (x_p=<value optimized out>) at ./gt-fortran-f95-lang.h:291
#4017 0x000000000065d145 in gt_ggc_mx_cgraph_node (x_p=<value optimized out>) at gtype-desc.c:171
#4018 0x000000000065d276 in gt_ggc_m_P11cgraph_node4htab (x_p=<value optimized out>) at gtype-desc.c:2077
#4019 0x0000000000628fbe in ggc_mark_roots () at /data03/vondele/gcc_trunk/gcc/gcc/ggc-common.c:107
#4020 0x00000000004dad48 in ggc_collect () at /data03/vondele/gcc_trunk/gcc/gcc/ggc-page.c:1941

#4021 0x000000000069f115 in execute_todo (flags=34871) at /data03/vondele/gcc_trunk/gcc/gcc/passes.c:1047
#4022 0x000000000069f385 in execute_one_pass (pass=0x10f4da0) at /data03/vondele/gcc_trunk/gcc/gcc/passes.c:1302
#4023 0x000000000069f575 in execute_pass_list (pass=0x10f4da0) at /data03/vondele/gcc_trunk/gcc/gcc/passes.c:1328
#4024 0x000000000069f58d in execute_pass_list (pass=0x10f4860) at /data03/vondele/gcc_trunk/gcc/gcc/passes.c:1329
#4025 0x000000000069f895 in execute_ipa_pass_list (pass=0x10f4800) at /data03/vondele/gcc_trunk/gcc/gcc/passes.c:892
#4026 0x0000000000917ca6 in cgraph_optimize () at /data03/vondele/gcc_trunk/gcc/gcc/cgraphunit.c:1239
#4027 0x0000000000490855 in gfc_be_parse_file (set_yydebug=<value optimized out>)
    at /data03/vondele/gcc_trunk/gcc/gcc/fortran/f95-lang.c:240

#4028 0x0000000000746605 in toplev_main (argc=<value optimized out>, argv=<value optimized out>)
    at /data03/vondele/gcc_trunk/gcc/gcc/toplev.c:970
#4029 0x00007f7d53f33436 in __libc_start_main () from /lib64/libc.so.6
---Type <return> to continue, or q <return> to quit---
#4030 0x0000000000405859 in _start ()
(gdb)

BTW, gcc from 2009-01-09 did not seem to display this issue.
Comment 2 Joost VandeVondele 2009-06-20 17:37:28 UTC
looks like the issue in comment #1 is really just a duplicate of PR40005

*** This bug has been marked as a duplicate of 40005 ***