Bug 17279 - [3.4 Regression] internal compiler error with 128 bit integers
Summary: [3.4 Regression] internal compiler error with 128 bit integers
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 3.4.1
: P2 normal
Target Milestone: 4.0.0
Assignee: Not yet assigned to anyone
URL:
Keywords: ice-on-invalid-code
Depends on:
Blocks:
 
Reported: 2004-09-02 09:11 UTC by gastineau
Modified: 2005-08-23 02:03 UTC (History)
1 user (show)

See Also:
Host: powerpc-apple-darwin7.5.0
Target: powerpc-apple-darwin7.5.0
Build: powerpc-apple-darwin7.5.0
Known to work:
Known to fail:
Last reconfirmed: 2005-04-18 03:57:06


Attachments
patch which I am testing which should fix the remaining problem (450 bytes, patch)
2004-11-12 03:58 UTC, Andrew Pinski
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description gastineau 2004-09-02 09:11:49 UTC
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.
Comment 1 Joseph S. Myers 2004-09-02 09:20:57 UTC
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.

Comment 2 Andrew Pinski 2004-09-02 17:03:03 UTC
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.
Comment 3 gastineau 2004-09-03 07:59:20 UTC
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 )


Comment 4 Andrew Pinski 2004-11-12 03:37:22 UTC
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.
Comment 5 Andrew Pinski 2004-11-12 03:57:14 UTC
This is a 3.4/4.0 regression as before HOST_WIDE_INT was not 64bits.
Comment 6 Andrew Pinski 2004-11-12 03:58:48 UTC
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.
Comment 7 Andrew Pinski 2004-11-12 04:33:47 UTC
Patch here: <http://gcc.gnu.org/ml/gcc-patches/2004-11/msg00937.html>.
Comment 8 GCC Commits 2004-11-14 18:54:29 UTC
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

Comment 9 Andrew Pinski 2004-11-14 19:03:52 UTC
Fixed on the mainline but a number of things have to be backported to the 3.4 branch to get this fixed.
Comment 10 Andrew Pinski 2005-08-23 02:03:09 UTC
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.