arithmetic operations on 128 bit integers (TI mode) on Apple G5 computers with macos X 10.3.5 produce internal compiler error. The program (buggcc341.c) is : void main (void) { typedef unsigned __uint128_t __attribute__ (( __mode__ (__TI__))); __uint128_t x,a,w; x=a*w+a-w/a; } The intermediaire file (buggcc341.i) is : # 1 "buggcc341.c" # 1 "<built-in>" # 1 "<command line>" # 1 "buggcc341.c" void main (void) { typedef unsigned __uint128_t __attribute__ (( __mode__ (__TI__))); __uint128_t x,a,w; x=a*w+a-w/a; } Description of the execution of gcc $ /Volumes/WORK/gastin/gcc341/bin/gcc -v -save-temps buggcc341.c Reading specs from /Volumes/WORK/gastin/gcc341/lib/gcc/powerpc-apple-darwin7.5.0/3.4.1/specs Configured with: ./configure --prefix=/Volumes/WORK/gastin/gcc341 Thread model: posix gcc version 3.4.1 /Volumes/WORK/gastin/gcc341/libexec/gcc/powerpc-apple-darwin7.5.0/3.4.1/cc1 -E -quiet -v -D__DYNAMIC__ buggcc341.c -fPIC -o buggcc341.i ignoring nonexistent directory "/usr/local/include" ignoring nonexistent directory "/Volumes/WORK/gastin/gcc341/lib/gcc/powerpc-apple-darwin7.5.0/ 3.4.1/../../../../powerpc-apple-darwin7.5.0/include" #include "..." search starts here: #include <...> search starts here: /Volumes/WORK/gastin/gcc341/include /Volumes/WORK/gastin/gcc341/lib/gcc/powerpc-apple-darwin7.5.0/3.4.1/include /usr/include End of search list. /Volumes/WORK/gastin/gcc341/libexec/gcc/powerpc-apple-darwin7.5.0/3.4.1/cc1 -fpreprocessed buggcc341.i -fPIC -quiet -dumpbase buggcc341.c -auxbase buggcc341 -version -o buggcc341.s GNU C version 3.4.1 (powerpc-apple-darwin7.5.0) compiled by GNU C version 3.3 20030304 (Apple Computer, Inc. build 1666). GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096 buggcc341.c: In function `main': buggcc341.c:2: warning: return type of 'main' is not `int' buggcc341.c:5: internal compiler error: in expand_mult, at expmed.c:2654 Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://gcc.gnu.org/bugs.html> for instructions.
Subject: Re: New: internal compiler error with 128 bit integers On Thu, 2 Sep 2004, amgastineau at yahoo dot fr wrote: > typedef unsigned __uint128_t __attribute__ (( __mode__ (__TI__))); On the platforms where such types might actually work, GCC provides built-in __int128_t and __uint128_t typedefs. But: (a) In any case, GCC should not give an internal compiler error. (b) These types are never currently extended integer types within the meaning of C99 (see the documentation of implementation-defined behavior on mainline), although they may act quite similarly to such types.
Hmm, I think this is a regression but I could be wrong, the problem is that we semi-support TI mode on powerpc-darwin but only -mpowerpc64. Why I said semi is because we don't impement the libgcc part of the functions which would be easy to add.
If I compile the option -mpowerpc64, gcc compiles my code. If I compile without the option -mpowerpc64, gcc reports an internal error (instead of reporting an error on the type __int128_t )
Fixed in 3.4.3, we reject it: t.c: In function 'main': t.c:3: error: unable to emulate 'TI' But if we don't do the typedef we still get an error: t.c:4: internal compiler error: in expand_mult, at expmed.c:3001 Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://gcc.gnu.org/bugs.html> for instructions.
This is a 3.4/4.0 regression as before HOST_WIDE_INT was not 64bits.
Created attachment 7525 [details] patch which I am testing which should fix the remaining problem Patch which I am going to test which should fix the problem even we don't do an explicit typedef in the code.
Patch here: <http://gcc.gnu.org/ml/gcc-patches/2004-11/msg00937.html>.
Subject: Bug 17279 CVSROOT: /cvs/gcc Module name: gcc Changes by: pinskia@gcc.gnu.org 2004-11-14 18:54:19 Modified files: gcc : ChangeLog c-common.c Log message: 2004-11-14 Andrew Pinski <pinskia@physics.uc.edu> PR c/17279 * c-common.c (c_common_nodes_and_builtins): Ask the back-end if we support TImode before adding __int128_t and __uint128_t types. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.6335&r2=2.6336 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-common.c.diff?cvsroot=gcc&r1=1.585&r2=1.586
Fixed on the mainline but a number of things have to be backported to the 3.4 branch to get this fixed.
This is invalid code and I have no interesting in back porting the whole infrastructure to 3.4.x so I am closing as fixed for 4.0.0.