public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jakub at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/36189] Invalid movabsq $mycom_@TPOFF-8, %rbp for TLS
Date: Wed, 20 Aug 2008 15:43:00 -0000	[thread overview]
Message-ID: <20080820154204.15489.qmail@sourceware.org> (raw)
In-Reply-To: <bug-36189-87@http.gcc.gnu.org/bugzilla/>



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


  reply	other threads:[~2008-08-20 15:43 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-09 16:25 [Bug target/36189] New: " jakub at gcc dot gnu dot org
2008-08-20 15:43 ` jakub at gcc dot gnu dot org [this message]
2008-08-20 18:26 ` [Bug target/36189] " jakub at gcc dot gnu dot org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080820154204.15489.qmail@sourceware.org \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).