Bug 46734 - [4.5 Regression] ICE in create_tmp_var, at gimplify.c:505
Summary: [4.5 Regression] ICE in create_tmp_var, at gimplify.c:505
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 4.5.1
: P2 normal
Target Milestone: 4.5.3
Assignee: Martin Jambor
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-12-01 01:00 UTC by Ryan Hill
Modified: 2010-12-21 11:08 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work: 4.4.5
Known to fail: 4.5.0, 4.5.1, 4.5.2, 4.6.0
Last reconfirmed: 2010-12-01 13:58:46


Attachments
segmentAnchorPluckerFeature.i.bz2 (289.24 KB, application/x-bzip2)
2010-12-01 01:00 UTC, Ryan Hill
Details
testcase-mini.i (2.55 KB, text/plain)
2010-12-02 00:29 UTC, Ryan Hill
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ryan Hill 2010-12-01 01:00:44 UTC
Created attachment 22585 [details]
segmentAnchorPluckerFeature.i.bz2

Unfortunately the preprocessed source is from boost and huge.  I'm trying to reduce it.  Both 4.5.1 and current 4.5 branch svn fail.  4.4.5 works.

$ g++ -O2 -m32 -c segmentAnchorPluckerFeature.i
In file included from /mnt/data/LAAS/Libs/jafar/modules/jmath/include/jmath/ublasExtra.hpp:12:0,
                 from /mnt/data/LAAS/Libs/jafar/modules/slam/src/segmentAnchorPluckerFeature.cpp:6:
/usr/include/boost/numeric/ublas/vector_proxy.hpp: In function 'boost::numeric::ublas::vector_range<V> boost::numeric::ublas::vector_range<V>::project(const boost::numeric::ublas::vector_range<V>::range_type&) const [with V = boost::numeric::ublas::vector<double>, boost::numeric::ublas::vector_range<V>::range_type = boost::numeric::ublas::basic_range<>, typename A::difference_type = int, typename A::size_type = unsigned int]':
/usr/include/boost/numeric/ublas/vector_proxy.hpp:62:58: internal compiler error: in create_tmp_var, at gimplify.c:505

$ g++ -v
Using built-in specs.
COLLECT_GCC=/usr/x86_64-unknown-linux-gnu/gcc-bin/4.5.2-pre9999/g++
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-unknown-linux-gnu/4.5.2-pre9999/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: /var/tmp/portage/sys-devel/gcc-4.5.2_pre9999/work/gcc-4.5.2-9999/configure --prefix=/usr --bindir=/usr/x86_64-unknown-linux-gnu/gcc-bin/4.5.2-pre9999 --includedir=/usr/lib/gcc/x86_64-unknown-linux-gnu/4.5.2-pre9999/include --datadir=/usr/share/gcc-data/x86_64-unknown-linux-gnu/4.5.2-pre9999 --mandir=/usr/share/gcc-data/x86_64-unknown-linux-gnu/4.5.2-pre9999/man --infodir=/usr/share/gcc-data/x86_64-unknown-linux-gnu/4.5.2-pre9999/info --with-gxx-include-dir=/usr/lib/gcc/x86_64-unknown-linux-gnu/4.5.2-pre9999/include/g++-v4 --host=x86_64-unknown-linux-gnu --build=x86_64-unknown-linux-gnu --disable-altivec --disable-fixed-point --with-ppl --with-cloog --enable-lto --disable-nls --with-system-zlib --disable-werror --enable-secureplt --enable-multilib --disable-libmudflap --disable-libssp --enable-libgomp --enable-cld --with-python-dir=/share/gcc-data/x86_64-unknown-linux-gnu/4.5.2-pre9999/python --enable-checking=release --disable-libgcj --enable-languages=c,c++ --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --with-bugurl=http://bugs.gentoo.org/ --with-pkgversion='Gentoo SVN'
Thread model: posix
gcc version 4.5.2-pre9999 20101130 (prerelease) rev. 167289 (Gentoo SVN)
Comment 1 Richard Biener 2010-12-01 13:58:46 UTC
Confirmed.

It's ipa-sra:

#9  0x0000000000ccdf3c in sra_ipa_modify_assign (stmt_ptr=0x7fffffffd6e8, 
    gsi=0x7fffffffd6f0, data=0x1e188e0)
    at /space/rguenther/src/svn/gcc-4_5-branch/gcc/tree-sra.c:3990
3990                                                   true, GSI_SAME_STMT);
(gdb) l
3985            new_rhs = *rhs_p;
3986
3987          if (new_rhs)
3988            {
3989              tree tmp = force_gimple_operand_gsi (gsi, new_rhs, true, NULL_TREE,
3990                                                   true, GSI_SAME_STMT);
3991
3992              gimple_assign_set_rhs_from_tree (gsi, tmp);
3993            }
3994
(gdb) call debug_tree (new_rhs)
 <view_convert_expr 0x7ffff02b2600
    type <record_type 0x7fffef7fec78 vector_closure_type sizes-gimplified addressable needs-constructing type_1 type_4 type_5 type_6 BLK
        size <integer_cst 0x7ffff7ed2988 constant 32>
        unit size <integer_cst 0x7ffff7ed2690 constant 4>
...
    arg 0 <indirect_ref 0x7ffff02b25a0
        type <reference_type 0x7fffef81ee70 type <record_type 0x7fffef81eb28 referred_type>
            sizes-gimplified unsigned type_6 SI size <integer_cst 0x7ffff7ed2988 32> unit size <integer_cst 0x7ffff7ed2690 4>
            align 32 symtab 0 alias set -1 canonical type 0x7ffff1bc2c78
            pointer_to_this <pointer_type 0x7fffed698d20>>
       
        arg 0 <parm_decl 0x7fffef2813b8 ISRA.934 type <pointer_type 0x7fffed698d20>
...

TYPE_NEEDS_CONSTRUCTING is set on new_rhs type which means gimplification
will fail to create a temporary.

Somehow fixed on the trunk.
Comment 2 Ryan Hill 2010-12-02 00:29:26 UTC
Created attachment 22596 [details]
testcase-mini.i

FWIW, delta eventually spit this out.
Comment 3 H.J. Lu 2010-12-05 16:47:26 UTC
It was caused by revision 154413:

http://gcc.gnu.org/ml/gcc-cvs/2009-11/msg00634.html

and fixed by revision 161655:

http://gcc.gnu.org/ml/gcc-cvs/2010-07/msg00006.html
Comment 4 Martin Jambor 2010-12-07 13:29:26 UTC
Mine.
Comment 5 Martin Jambor 2010-12-07 13:32:37 UTC
Simple testcase (to be run with -O -fipa-sra):

struct A
{
  int *p;
  A() {p = (int *) -1;}
  ~A() {if (p && p != (int *) -1) *p = 0;}
};

struct B
{
  A a;
  char data[23];
  B() : a() {data[0] = 0;}
};

extern A ga;
extern int *gi;
extern void *gz;
extern B *gb;

static int * __attribute__ ((noinline)) foo (B *b, void *z)
{
  __builtin_memcpy (gz, z, 28);
  ga = b->a;
  return b->a.p;
}

int *bar (B *b, void *z)
{
  gb = b;
  return foo (b, z);
}
Comment 6 Martin Jambor 2010-12-07 13:35:11 UTC
which of course fails on trunk too.
Comment 7 Martin Jambor 2010-12-09 15:11:30 UTC
Author: jamborm
Date: Thu Dec  9 15:11:26 2010
New Revision: 167639

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=167639
Log:
2010-12-09  Martin Jambor  <mjambor@suse.cz>

	PR middle-end/46734
	* tree-sra.c (splice_param_accesses): Check that there are not
	multiple ADDRESSABLE types.

	* testsuite/g++.dg/tree-ssa/pr46734.C: New test.


Added:
    trunk/gcc/testsuite/g++.dg/tree-ssa/pr46734.C
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-sra.c
Comment 8 Richard Biener 2010-12-16 13:03:38 UTC
GCC 4.5.2 is being released, adjusting target milestone.
Comment 9 Martin Jambor 2010-12-21 11:05:52 UTC
Author: jamborm
Date: Tue Dec 21 11:05:49 2010
New Revision: 168109

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=168109
Log:
2010-12-21  Martin Jambor  <mjambor@suse.cz>

	Backport from mainline:
	2010-12-09  Martin Jambor  <mjambor@suse.cz>

	PR middle-end/46734
	* tree-sra.c (splice_param_accesses): Check that there are not
	multiple ADDRESSABLE types.

	* testsuite/g++.dg/tree-ssa/pr46734.C: New test.


Added:
    branches/gcc-4_5-branch/gcc/testsuite/g++.dg/tree-ssa/pr46734.C
Modified:
    branches/gcc-4_5-branch/gcc/ChangeLog
    branches/gcc-4_5-branch/gcc/testsuite/ChangeLog
    branches/gcc-4_5-branch/gcc/tree-sra.c
Comment 10 Martin Jambor 2010-12-21 11:08:32 UTC
Fixed on both trunk and the 4.5 branch now.