diff mbox

[AArch64,TLSIE,2/2] Implement TLS IE for tiny model

Message ID n99k2r1o3j1.fsf@arm.com
State New
Headers show

Commit Message

Jiong Wang Oct. 5, 2015, 1:19 p.m. UTC
James Greenhalgh writes:

> Hi Jiong,
>
> I was looking at another bug and in the process of auditing our code
> spotted an issue with this patch from back in June...
>
> On Fri, Jun 19, 2015 at 10:15:38AM +0100, Jiong Wang wrote:
>> diff --git a/gcc/config/aarch64/aarch64.md b/gcc/config/aarch64/aarch64.md
>> index 8b061ba..be9da5b 100644
>> --- a/gcc/config/aarch64/aarch64.md
>> +++ b/gcc/config/aarch64/aarch64.md
>> +(define_insn "tlsie_tiny_sidi"
>> +  [(set (match_operand:DI 0 "register_operand" "=&r")
>> +	(zero_extend:DI
>> +          (unspec:SI [(match_operand 1 "aarch64_tls_ie_symref" "S")
>> +		      (match_operand:DI 2 "register_operand" "r")
>> +		      ]
>> +		      UNSPEC_GOTTINYTLS)))]
>> +  ""
>> +  "ldr\\t%w0, %L1\;add\\t%<w>0, %<w>0, %<w>2"
>
> Here, you have no iterators, so the <w> will never be replaced. Consequently,
> you are likely to hit an ICE if this pattern is ever used.
>
> I presume you intended this to say
>
>   "ldr\\t%w0, %L1\;add\\t%w0, %w0, %w2"
>
> If so, consider that change preapproved.

Thanks, yes, it's a hiding bug which might be triggered under ILP32 mode
only.

committed below patch after bootstrap & regression tls* testcases OK.


2015-10-05 James Greenhalgh <james.greenhalgh@arm.com>
           Jiong Wang  <jiong.wang@arm.com>

gcc/
  * config/aarch64/aarch64.md (tlsie_tiny_sidi): Replace "<w>" with "w".

Comments

Marcus Shawcroft Oct. 6, 2015, 11:07 a.m. UTC | #1
On 5 October 2015 at 14:19, Jiong Wang <jiong.wang@arm.com> wrote:

> 2015-10-05 James Greenhalgh <james.greenhalgh@arm.com>
>            Jiong Wang  <jiong.wang@arm.com>
>
> gcc/
>   * config/aarch64/aarch64.md (tlsie_tiny_sidi): Replace "<w>" with "w".
>

How about a test case?
/Marcus
diff mbox

Patch

diff --git a/gcc/config/aarch64/aarch64.md b/gcc/config/aarch64/aarch64.md
index 74522f8..208f58f 100644
--- a/gcc/config/aarch64/aarch64.md
+++ b/gcc/config/aarch64/aarch64.md
@@ -4738,7 +4738,7 @@ 
 		      ]
 		      UNSPEC_GOTTINYTLS)))]
   ""
-  "ldr\\t%w0, %L1\;add\\t%<w>0, %<w>0, %<w>2"
+  "ldr\\t%w0, %L1\;add\\t%w0, %w0, %w2"
   [(set_attr "type" "multiple")
    (set_attr "length" "8")]
 )