This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/31167] New: ICE wnen using __int128_t on x86_64


The source below is meant to return an int32_t that is the result of "rounding"
the upper 32 bits of an __int128_t, where rounding pays attention to the bits
that have been discarded and the low bit of what is kept.  Since it's an ICE,
the details are probably irrelevant. 

salmonj@drda0003.nyc$ cat brokengcc.cxx
#include <inttypes.h>

int32_t round32hi(const __int128_t &arg){
    const int SHIFT = 96;
    const int mshift = 96;
    const __int128_t M = (~__int128_t(0))<<mshift;
    const __int128_t L = (~M) + 1;
    const __int128_t L1 = __int128_t(L)>>1;
    const __int128_t Mlo = __int128_t(~M)>>1;
    __int128_t vv = arg & M;
    if( (arg & (L1))      // hi bit of discard set
        && ( (arg & Mlo)  // and ( any other bits of discard set
             || (arg & L) ) )   //       or lo bit of keep set )
        vv += L;
    return int32_t(vv>>SHIFT);
}
salmonj@drda0003.nyc$ gcc -v -c -O brokengcc.cxx
Reading specs from
/proj/desres/root/Linux/x86_64/gcc/4.1.2/lib/gcc/x86_64-unknown-linux-gnu/4.1.2/specs
Target: x86_64-unknown-linux-gnu
Configured with: /state/partition1/tmp/tmpwsa5nr/gcc-4.1.2/configure
--enable-languages=c,c++,fortran
--prefix=/proj/desres/root/Linux/x86_64/gcc/4.1.2
Thread model: posix
gcc version 4.1.2

/proj/desres/root/Linux/x86_64/gcc/4.1.2/libexec/gcc/x86_64-unknown-linux-gnu/4.1.2/cc1plus
-quiet -v -D_GNU_SOURCE brokengcc.cxx -quiet -dumpbase brokengcc.cxx -mtune=k8
-auxbase brokengcc -O -version -o /scratch/tmp/ccer1yVv.s
ignoring nonexistent directory
"/proj/desres/root/Linux/x86_64/gcc/4.1.2/lib/gcc/x86_64-unknown-linux-gnu/4.1.2/../../../../x86_64-unknown-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:

/proj/desres/root/Linux/x86_64/gcc/4.1.2/lib/gcc/x86_64-unknown-linux-gnu/4.1.2/../../../../include/c++/4.1.2

/proj/desres/root/Linux/x86_64/gcc/4.1.2/lib/gcc/x86_64-unknown-linux-gnu/4.1.2/../../../../include/c++/4.1.2/x86_64-unknown-linux-gnu

/proj/desres/root/Linux/x86_64/gcc/4.1.2/lib/gcc/x86_64-unknown-linux-gnu/4.1.2/../../../../include/c++/4.1.2/backward
 /usr/local/include
 /proj/desres/root/Linux/x86_64/gcc/4.1.2/include

/proj/desres/root/Linux/x86_64/gcc/4.1.2/lib/gcc/x86_64-unknown-linux-gnu/4.1.2/include
 /usr/include
End of search list.
GNU C++ version 4.1.2 (x86_64-unknown-linux-gnu)
        compiled by GNU C version 3.4.3 20041212 (Red Hat 3.4.3-9.EL4).
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 9975ef1eec7edce53d85d34b86837808
brokengcc.cxx: In function 'int32_t round32hi(const __int128_t&)':
brokengcc.cxx:16: error: unrecognizable insn:
(insn 92 91 50 3 (parallel [
            (set (reg:DI 38 r9 [ vv+8 ])
                (plus:DI (plus:DI (ltu:DI (reg:CC 17 flags)
                            (const_int 0 [0x0]))
                        (reg:DI 38 r9 [ vv+8 ]))
                    (const_int 4294967296 [0x100000000])))
            (clobber (reg:CC 17 flags))
        ]) -1 (nil)
    (nil))
brokengcc.cxx:16: internal compiler error: in extract_insn, at recog.c:2084
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
salmonj@drda0003.nyc$


-- 
           Summary: ICE wnen using __int128_t on x86_64
           Product: gcc
           Version: 4.1.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: john dot salmon at deshaw dot com
 GCC build triplet: x86_64-unknown-linux-gnu
  GCC host triplet: x86_64-unknown-linux-gnu
GCC target triplet: x86_64-unknown-linux-gnu


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]