------- Comment #1 from jakub at gcc dot gnu dot org 2008-08-20 15:42 ------- program foo implicit none common /mycom/ arr(1000000000_8:1000000002_8) !$omp threadprivate (/mycom/) integer*8 i real*8 arr do i=1000000000_8,1000000002_8 write(*,*) i arr(i)=0.0d0 enddo end program
is another testcase, now with CONST_INT offset that doesn't even fit into SImode. I've tried to reject TPOFF/DTPOFF which would be rejected by x86_64_immediate_operand also in legitimate_constant_p (they really aren't legitimate, can't be put into .data section nor instructions): --- i386.c.jj6 2007-06-26 13:38:46.000000000 +0200 +++ i386.c 2008-08-20 16:30:19.000000000 +0200 @@ -6130,6 +6130,8 @@ darwin_local_data_pic (rtx disp) bool legitimate_constant_p (rtx x) { + rtx off = NULL_RTX; + switch (GET_CODE (x)) { case CONST: @@ -6139,6 +6141,7 @@ legitimate_constant_p (rtx x) { if (GET_CODE (XEXP (x, 1)) != CONST_INT) return false; + off = XEXP (x, 1); x = XEXP (x, 0); } @@ -6154,10 +6157,24 @@ legitimate_constant_p (rtx x) case UNSPEC_TPOFF: case UNSPEC_NTPOFF: x = XVECEXP (x, 0, 0); + /* GNU ld only handles 32-bit @TPOFF relocation on input. */ + if (TARGET_64BIT + && off + && (INTVAL (off) < 0 + || trunc_int_for_mode (INTVAL (off), + SImode) != INTVAL (off))) + return false; return (GET_CODE (x) == SYMBOL_REF && SYMBOL_REF_TLS_MODEL (x) == TLS_MODEL_LOCAL_EXEC); case UNSPEC_DTPOFF: x = XVECEXP (x, 0, 0); + /* GNU ld only handles 32-bit @DTPOFF relocation on input. */ + if (TARGET_64BIT + && off + && (INTVAL (off) < 0 + || trunc_int_for_mode (INTVAL (off), + SImode) != INTVAL (off))) + return false; return (GET_CODE (x) == SYMBOL_REF && SYMBOL_REF_TLS_MODEL (x) == TLS_MODEL_LOCAL_DYNAMIC); default: but still an instruction with @TPOFF-8 is created and then ICEs during recognition, eventhough both legitimate_constant_p and legitimate_address_p reject it as invalid memory address. Any ideas? In 4.3/trunk this is IMHO a latent issue, the memory reference expansion just reorders the mycom_+(i*8)-8 operations differently. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36189