* Fix PR67639
@ 2015-12-18 18:38 Bernd Schmidt
2015-12-21 19:39 ` Jeff Law
0 siblings, 1 reply; 5+ messages in thread
From: Bernd Schmidt @ 2015-12-18 18:38 UTC (permalink / raw)
To: GCC Patches
[-- Attachment #1: Type: text/plain, Size: 847 bytes --]
In an earlier fix, the following change was made in varasm.c for invalid
register variables:
--- trunk/gcc/varasm.c 2014/08/26 14:59:59 214525
+++ trunk/gcc/varasm.c 2014/08/26 17:06:31 214526
@@ -1371,6 +1371,11 @@ make_decl_rtl (tree decl)
/* As a register variable, it has no section. */
return;
}
+ /* Avoid internal errors from invalid register
+ specifications. */
+ SET_DECL_ASSEMBLER_NAME (decl, NULL_TREE);
+ DECL_HARD_REGISTER (decl) = 0;
+ return;
}
As seen in PR67639, this makes the IL inconsistent and triggers another
internal error where we expect to see an SSA_NAME instead of a VAR_DECL.
The following patch extends the above slightly, by also setting
DECL_EXTERNAL to pretend that the erroneous variable is actually a global.
Bootstrapped and tested on x86_64-linux, ok?
Bernd
[-- Attachment #2: 67639.diff --]
[-- Type: text/x-patch, Size: 1138 bytes --]
PR middle-end/67639
* varasm.c (make_decl_rtl): Mark invalid register vars as
DECL_EXTERNAL.
testsuite/
PR middle-end/67639
* c-c++-common/pr67639.c: New test.
Index: gcc/testsuite/c-c++-common/pr67639.c
===================================================================
--- gcc/testsuite/c-c++-common/pr67639.c (revision 0)
+++ gcc/testsuite/c-c++-common/pr67639.c (working copy)
@@ -0,0 +1,8 @@
+/* { dg-do compile } */
+void
+foo (int p)
+{
+ int t;
+ register long x asm ("rhubarb") = p; /* { dg-error "register name" } */
+ __asm ("" : "=r" (t), "=r" (t), "=r" (t), "=r" (x) : "0" (x));
+}
Index: gcc/varasm.c
===================================================================
--- gcc/varasm.c (revision 231653)
+++ gcc/varasm.c (working copy)
@@ -1420,6 +1420,9 @@ make_decl_rtl (tree decl)
specifications. */
SET_DECL_ASSEMBLER_NAME (decl, NULL_TREE);
DECL_HARD_REGISTER (decl) = 0;
+ /* Also avoid SSA inconsistencies by pretending this is an external
+ decl now. */
+ DECL_EXTERNAL (decl) = 1;
return;
}
/* Now handle ordinary static variables and functions (in memory).
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Fix PR67639
2015-12-18 18:38 Fix PR67639 Bernd Schmidt
@ 2015-12-21 19:39 ` Jeff Law
2016-02-08 14:26 ` Bernd Schmidt
0 siblings, 1 reply; 5+ messages in thread
From: Jeff Law @ 2015-12-21 19:39 UTC (permalink / raw)
To: Bernd Schmidt, GCC Patches
On 12/18/2015 11:38 AM, Bernd Schmidt wrote:
> In an earlier fix, the following change was made in varasm.c for invalid
> register variables:
>
> --- trunk/gcc/varasm.c 2014/08/26 14:59:59 214525
> +++ trunk/gcc/varasm.c 2014/08/26 17:06:31 214526
> @@ -1371,6 +1371,11 @@ make_decl_rtl (tree decl)
> /* As a register variable, it has no section. */
> return;
> }
> + /* Avoid internal errors from invalid register
> + specifications. */
> + SET_DECL_ASSEMBLER_NAME (decl, NULL_TREE);
> + DECL_HARD_REGISTER (decl) = 0;
> + return;
> }
>
> As seen in PR67639, this makes the IL inconsistent and triggers another
> internal error where we expect to see an SSA_NAME instead of a VAR_DECL.
>
> The following patch extends the above slightly, by also setting
> DECL_EXTERNAL to pretend that the erroneous variable is actually a global.
>
> Bootstrapped and tested on x86_64-linux, ok?
OK.
jeff
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Fix PR67639
2015-12-21 19:39 ` Jeff Law
@ 2016-02-08 14:26 ` Bernd Schmidt
2016-02-08 16:05 ` Jeff Law
2016-02-09 14:44 ` Matthias Klose
0 siblings, 2 replies; 5+ messages in thread
From: Bernd Schmidt @ 2016-02-08 14:26 UTC (permalink / raw)
To: Jeff Law, Bernd Schmidt, GCC Patches
On 12/21/2015 08:39 PM, Jeff Law wrote:
> On 12/18/2015 11:38 AM, Bernd Schmidt wrote:
>> In an earlier fix, the following change was made in varasm.c for invalid
>> register variables:
>>
>> --- trunk/gcc/varasm.c 2014/08/26 14:59:59 214525
>> +++ trunk/gcc/varasm.c 2014/08/26 17:06:31 214526
>> @@ -1371,6 +1371,11 @@ make_decl_rtl (tree decl)
>> /* As a register variable, it has no section. */
>> return;
>> }
>> + /* Avoid internal errors from invalid register
>> + specifications. */
>> + SET_DECL_ASSEMBLER_NAME (decl, NULL_TREE);
>> + DECL_HARD_REGISTER (decl) = 0;
>> + return;
>> }
>>
>> As seen in PR67639, this makes the IL inconsistent and triggers another
>> internal error where we expect to see an SSA_NAME instead of a VAR_DECL.
>>
>> The following patch extends the above slightly, by also setting
>> DECL_EXTERNAL to pretend that the erroneous variable is actually a
>> global.
>>
>> Bootstrapped and tested on x86_64-linux, ok?
> OK.
Turns out 65702 is a dup and this should go into gcc-5 as well. Ok to
backport?
Bernd
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Fix PR67639
2016-02-08 14:26 ` Bernd Schmidt
@ 2016-02-08 16:05 ` Jeff Law
2016-02-09 14:44 ` Matthias Klose
1 sibling, 0 replies; 5+ messages in thread
From: Jeff Law @ 2016-02-08 16:05 UTC (permalink / raw)
To: Bernd Schmidt, Bernd Schmidt, GCC Patches
On 02/08/2016 07:26 AM, Bernd Schmidt wrote:
> On 12/21/2015 08:39 PM, Jeff Law wrote:
>> On 12/18/2015 11:38 AM, Bernd Schmidt wrote:
>>> In an earlier fix, the following change was made in varasm.c for invalid
>>> register variables:
>>>
>>> --- trunk/gcc/varasm.c 2014/08/26 14:59:59 214525
>>> +++ trunk/gcc/varasm.c 2014/08/26 17:06:31 214526
>>> @@ -1371,6 +1371,11 @@ make_decl_rtl (tree decl)
>>> /* As a register variable, it has no section. */
>>> return;
>>> }
>>> + /* Avoid internal errors from invalid register
>>> + specifications. */
>>> + SET_DECL_ASSEMBLER_NAME (decl, NULL_TREE);
>>> + DECL_HARD_REGISTER (decl) = 0;
>>> + return;
>>> }
>>>
>>> As seen in PR67639, this makes the IL inconsistent and triggers another
>>> internal error where we expect to see an SSA_NAME instead of a VAR_DECL.
>>>
>>> The following patch extends the above slightly, by also setting
>>> DECL_EXTERNAL to pretend that the erroneous variable is actually a
>>> global.
>>>
>>> Bootstrapped and tested on x86_64-linux, ok?
>> OK.
>
> Turns out 65702 is a dup and this should go into gcc-5 as well. Ok to
> backport?
Yes.
Thanks,
jeff
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Fix PR67639
2016-02-08 14:26 ` Bernd Schmidt
2016-02-08 16:05 ` Jeff Law
@ 2016-02-09 14:44 ` Matthias Klose
1 sibling, 0 replies; 5+ messages in thread
From: Matthias Klose @ 2016-02-09 14:44 UTC (permalink / raw)
To: Bernd Schmidt, Jeff Law, Bernd Schmidt, GCC Patches
On 08.02.2016 15:26, Bernd Schmidt wrote:
> On 12/21/2015 08:39 PM, Jeff Law wrote:
>> On 12/18/2015 11:38 AM, Bernd Schmidt wrote:
>>> In an earlier fix, the following change was made in varasm.c for invalid
>>> register variables:
>>>
>>> --- trunk/gcc/varasm.c 2014/08/26 14:59:59 214525
>>> +++ trunk/gcc/varasm.c 2014/08/26 17:06:31 214526
>>> @@ -1371,6 +1371,11 @@ make_decl_rtl (tree decl)
>>> /* As a register variable, it has no section. */
>>> return;
>>> }
>>> + /* Avoid internal errors from invalid register
>>> + specifications. */
>>> + SET_DECL_ASSEMBLER_NAME (decl, NULL_TREE);
>>> + DECL_HARD_REGISTER (decl) = 0;
>>> + return;
>>> }
>>>
>>> As seen in PR67639, this makes the IL inconsistent and triggers another
>>> internal error where we expect to see an SSA_NAME instead of a VAR_DECL.
>>>
>>> The following patch extends the above slightly, by also setting
>>> DECL_EXTERNAL to pretend that the erroneous variable is actually a
>>> global.
>>>
>>> Bootstrapped and tested on x86_64-linux, ok?
>> OK.
>
> Turns out 65702 is a dup and this should go into gcc-5 as well. Ok to backport?
ChangeLog entry is not backported.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2016-02-09 14:44 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-18 18:38 Fix PR67639 Bernd Schmidt
2015-12-21 19:39 ` Jeff Law
2016-02-08 14:26 ` Bernd Schmidt
2016-02-08 16:05 ` Jeff Law
2016-02-09 14:44 ` Matthias Klose
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).