public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "mans at mansr dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/54974] New: [ARM] Incorrect placement of constant pools
Date: Thu, 18 Oct 2012 12:58:00 -0000	[thread overview]
Message-ID: <bug-54974-4@http.gcc.gnu.org/bugzilla/> (raw)


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

             Bug #: 54974
           Summary: [ARM] Incorrect placement of constant pools
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: mans@mansr.com


Created attachment 28483
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=28483
Test case

If the following conditions are true, a constant pool is placed too far from an
LDR instruction accessing it:

- Compiling to Thumb2.
- There is no unconditional branch within 4k of the LDR instruction.
- At least one of:
  * The LDR instruction is not at a 4-byte aligned address.
  * There is an instruction boundary 4094 bytes from the value of PC
    at the LDR.

The problem here is twofold:

1. The base address of a PC-relative LDR in Thumb2 is the address of the
   instruction plus 4, rounded down to a multiple of 4.  The calculation
   for the valid range fails to take this rounding into account.

2. The constant pool is (rightly) 4-byte aligned.  When scanning the
   instructions for a suitable location, the possible need for padding
   is not considered.

The problem can be seen by compiling the attached preprocessed source using
flags "-mthumb -march=armv7-a -mfpu=vfpv3-d16 -mfloat-abi=hard -O0 -fPIC".


             reply	other threads:[~2012-10-18 12:58 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-18 12:58 mans at mansr dot com [this message]
2012-10-18 13:01 ` [Bug target/54974] " mans at mansr dot com
2012-10-18 13:20 ` [Bug target/54974] [4.8 Regression] " doko at gcc dot gnu.org
2012-10-18 13:23 ` mikpe at it dot uu.se
2012-10-18 18:09 ` pinskia at gcc dot gnu.org
2012-10-18 19:43 ` mikpe at it dot uu.se
2012-10-19 12:24 ` doko at gcc dot gnu.org
2012-11-28  3:04 ` [Bug target/54974] [4.7/4.8 Regression] [ARM] [thumb] " ramana at gcc dot gnu.org
2012-11-29 10:02 ` mgretton at gcc dot gnu.org
2012-12-03 15:58 ` [Bug target/54974] [4.7 " rguenth at gcc dot gnu.org
2012-12-11 17:36 ` ramana at gcc dot gnu.org
2013-04-11  7:59 ` rguenth at gcc dot gnu.org
2014-06-12 13:19 ` rguenth at gcc dot gnu.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=bug-54974-4@http.gcc.gnu.org/bugzilla/ \
    --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).