http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55761



             Bug #: 55761

           Summary: process_assignment assumes -1 can be created

    Classification: Unclassified

           Product: gcc

           Version: 4.7.2

            Status: UNCONFIRMED

          Severity: normal

          Priority: P3

         Component: tree-optimization

        AssignedTo: unassig...@gcc.gnu.org

        ReportedBy: pa...@matos-sorge.com





Created attachment 29013

  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29013

breaks GCC4.7.2 x86_64



Hello,



process_assignment in tree-tailcall.c assumes constant -1 can be created in any

mode (that matches all the conditions up until this point) in the line:

*m = build_int_cst (TREE_TYPE (non_ass_var), -1);



If, however, TREE_TYPE of non_ass_var of vector type for example, an ICE

occurs.



The following example breaks my port, x86_64 and probably more:



typedef short V4H __attribute__ ((vector_size (8)));

extern V4H __fp_rep_h (unsigned short B);



V4H

fn1 ()

{

    V4H vuq = __fp_rep_h (0);

    vuq -= __fp_rep_h (1);

    return vuq;

}



In processing assignment vuq = vuq - vuq0; (where vuq0 = __fp_rep_h (1)), we

try to create multiplier -1 with type V4H and that fails in build_int_cst_wide.



We need to check if it's of integral type and only ten apply build_int_cst.

Otherwise we should use fold_build1.



I tested GCC 4.7.2:

$ gcc -O2 baaclc_block.i 

baaclc_block.i: In function 'fn1':

baaclc_block.i:10:1: internal compiler error: in build_int_cst_wide, at

tree.c:1222

Please submit a full bug report,

with preprocessed source if appropriate.

See <http://gcc.gnu.org/bugs.html> for instructions.



$ $ gcc -v

Using built-in specs.

COLLECT_GCC=/tools/oss/packages/x86_64-rhel5/gcc/4.7.2/bin/gcc

COLLECT_LTO_WRAPPER=/tools/oss/packages/x86_64-rhel5/gcc/4.7.2/libexec/gcc/x86_64-unknown-linux-gnu/4.7.2/lto-wrapper

Target: x86_64-unknown-linux-gnu

Configured with: ../../gcc-4.7.2/configure

--prefix=/tools/oss/packages/x86_64-rhel5/gcc/4.7.2 --with-gnu-as

--with-as=/tools/oss/packages/x86_64-rhel5/binutils/default/bin/as

--with-gnu-ld

--with-ld=/tools/oss/packages/x86_64-rhel5/binutils/default/bin/ld

--with-mpc=/tools/oss/packages/x86_64-rhel5/mpc/0.8.1

--with-mpfr=/tools/oss/packages/x86_64-rhel5/mpfr/2.4.2

--with-gmp=/tools/oss/packages/x86_64-rhel5/gmp/4.3.2

--enable-languages=c,c++,objc,fortran --enable-symvers=gnu

Thread model: posix

gcc version 4.7.2 (GCC)

Reply via email to