public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/36189]  New: Invalid movabsq $mycom_@TPOFF-8, %rbp for TLS
@ 2008-05-09 16:25 jakub at gcc dot gnu dot org
  2008-08-20 15:43 ` [Bug target/36189] " jakub at gcc dot gnu dot org
  2008-08-20 18:26 ` jakub at gcc dot gnu dot org
  0 siblings, 2 replies; 3+ messages in thread
From: jakub at gcc dot gnu dot org @ 2008-05-09 16:25 UTC (permalink / raw)
  To: gcc-bugs

program foo
  implicit none
  common /mycom/ arr(2)
!$omp threadprivate (/mycom/)
  integer i
  real*8 arr
  do i=1,2
    write(*,*) i
    arr(i)=0.0d0
  enddo
end program

compiled with -S -O2 -fopenmp with gcc 4.1/4.2 generates invalid:
movabsq $mycom_@TPOFF-8, %rbp

@TPOFF should be used for 32-bit signed immediate though, e.g. movq
$mycom_@TPOFF-8, %rbp is correct.


-- 
           Summary: Invalid movabsq $mycom_@TPOFF-8, %rbp for TLS
           Product: gcc
           Version: 4.2.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jakub at gcc dot gnu dot org
GCC target triplet: x86_64-linux


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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug target/36189] Invalid movabsq $mycom_@TPOFF-8, %rbp for TLS
  2008-05-09 16:25 [Bug target/36189] New: Invalid movabsq $mycom_@TPOFF-8, %rbp for TLS jakub at gcc dot gnu dot org
@ 2008-08-20 15:43 ` jakub at gcc dot gnu dot org
  2008-08-20 18:26 ` jakub at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: jakub at gcc dot gnu dot org @ 2008-08-20 15:43 UTC (permalink / raw)
  To: gcc-bugs



------- 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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug target/36189] Invalid movabsq $mycom_@TPOFF-8, %rbp for TLS
  2008-05-09 16:25 [Bug target/36189] New: Invalid movabsq $mycom_@TPOFF-8, %rbp for TLS jakub at gcc dot gnu dot org
  2008-08-20 15:43 ` [Bug target/36189] " jakub at gcc dot gnu dot org
@ 2008-08-20 18:26 ` jakub at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: jakub at gcc dot gnu dot org @ 2008-08-20 18:26 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from jakub at gcc dot gnu dot org  2008-08-20 18:24 -------
Created an attachment (id=16116)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=16116&action=view)
gcc41-pr36189.patch

This works for me.


-- 


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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-08-20 18:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-05-09 16:25 [Bug target/36189] New: Invalid movabsq $mycom_@TPOFF-8, %rbp for TLS jakub at gcc dot gnu dot org
2008-08-20 15:43 ` [Bug target/36189] " jakub at gcc dot gnu dot org
2008-08-20 18:26 ` jakub at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).