* [Bug inline-asm/98847] Miscompilation with c++17, templates, and register keyword
2021-01-27 5:22 [Bug inline-asm/98847] New: Miscompilation with c++17, templates, and register keyword programmerjake at gmail dot com
@ 2021-01-27 7:56 ` rguenth at gcc dot gnu.org
2021-01-27 8:17 ` pinskia at gcc dot gnu.org
` (11 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-01-27 7:56 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98847
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Known to fail| |10.2.1, 11.0
Status|UNCONFIRMED |NEW
Ever confirmed|0 |1
Keywords| |wrong-code
Last reconfirmed| |2021-01-27
--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
It works fine with the simple example below (and the asm spec gets silently
ignored if you remove the register keyword)
int main()
{
register int edx asm("edx");
return edx;
}
and I don't get any diagnostics for this case. Your example gets the
diagnostic
and the bogus behavior though.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug inline-asm/98847] Miscompilation with c++17, templates, and register keyword
2021-01-27 5:22 [Bug inline-asm/98847] New: Miscompilation with c++17, templates, and register keyword programmerjake at gmail dot com
2021-01-27 7:56 ` [Bug inline-asm/98847] " rguenth at gcc dot gnu.org
@ 2021-01-27 8:17 ` pinskia at gcc dot gnu.org
2021-01-27 10:05 ` jakub at gcc dot gnu.org
` (10 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-01-27 8:17 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98847
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I think this is a dup of bug 33661.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug inline-asm/98847] Miscompilation with c++17, templates, and register keyword
2021-01-27 5:22 [Bug inline-asm/98847] New: Miscompilation with c++17, templates, and register keyword programmerjake at gmail dot com
2021-01-27 7:56 ` [Bug inline-asm/98847] " rguenth at gcc dot gnu.org
2021-01-27 8:17 ` pinskia at gcc dot gnu.org
@ 2021-01-27 10:05 ` jakub at gcc dot gnu.org
2021-01-27 16:07 ` programmerjake at gmail dot com
` (9 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-01-27 10:05 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98847
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org
--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 50066
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50066&action=edit
gcc11-pr98847.patch
Untested fix.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug inline-asm/98847] Miscompilation with c++17, templates, and register keyword
2021-01-27 5:22 [Bug inline-asm/98847] New: Miscompilation with c++17, templates, and register keyword programmerjake at gmail dot com
` (2 preceding siblings ...)
2021-01-27 10:05 ` jakub at gcc dot gnu.org
@ 2021-01-27 16:07 ` programmerjake at gmail dot com
2021-01-28 15:14 ` cvs-commit at gcc dot gnu.org
` (8 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: programmerjake at gmail dot com @ 2021-01-27 16:07 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98847
--- Comment #4 from programmerjake at gmail dot com ---
(In reply to Jakub Jelinek from comment #3)
> Created attachment 50066 [details]
> gcc11-pr98847.patch
>
> Untested fix.
That will probably also fix bug #98846
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug inline-asm/98847] Miscompilation with c++17, templates, and register keyword
2021-01-27 5:22 [Bug inline-asm/98847] New: Miscompilation with c++17, templates, and register keyword programmerjake at gmail dot com
` (3 preceding siblings ...)
2021-01-27 16:07 ` programmerjake at gmail dot com
@ 2021-01-28 15:14 ` cvs-commit at gcc dot gnu.org
2021-01-28 15:29 ` krebbel at gcc dot gnu.org
` (7 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-01-28 15:14 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98847
--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:
https://gcc.gnu.org/g:6bb207b468da36d9d99c63409dc4098514759c90
commit r11-6958-g6bb207b468da36d9d99c63409dc4098514759c90
Author: Jakub Jelinek <jakub@redhat.com>
Date: Thu Jan 28 16:13:11 2021 +0100
c++: Fix up handling of register ... asm ("...") vars in templates
[PR33661, PR98847]
As the testcase shows, for vars appearing in templates, we don't attach
the asm spec string to the pattern decls, nor pass it back to
cp_finish_decl
during instantiation.
The following patch does that.
2021-01-28 Jakub Jelinek <jakub@redhat.com>
PR c++/33661
PR c++/98847
* decl.c (cp_finish_decl): For register vars with asmspec in
templates
call set_user_assembler_name and set DECL_HARD_REGISTER.
* pt.c (tsubst_expr): When instantiating DECL_HARD_REGISTER vars,
pass asmspec_tree to cp_finish_decl.
* g++.target/i386/pr98847.C: New test.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug inline-asm/98847] Miscompilation with c++17, templates, and register keyword
2021-01-27 5:22 [Bug inline-asm/98847] New: Miscompilation with c++17, templates, and register keyword programmerjake at gmail dot com
` (4 preceding siblings ...)
2021-01-28 15:14 ` cvs-commit at gcc dot gnu.org
@ 2021-01-28 15:29 ` krebbel at gcc dot gnu.org
2021-01-29 19:20 ` cvs-commit at gcc dot gnu.org
` (6 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: krebbel at gcc dot gnu.org @ 2021-01-28 15:29 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98847
Andreas Krebbel <krebbel at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |krebbel at gcc dot gnu.org
--- Comment #6 from Andreas Krebbel <krebbel at gcc dot gnu.org> ---
Thanks for fixing this. When I had a look at it in 2015 I found that template
instantiation explicitly zeroes out the asm name. Solution for me was to
prevent that for hard reg decls. Not sure what approach is preferable here:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=33661#c13
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug inline-asm/98847] Miscompilation with c++17, templates, and register keyword
2021-01-27 5:22 [Bug inline-asm/98847] New: Miscompilation with c++17, templates, and register keyword programmerjake at gmail dot com
` (5 preceding siblings ...)
2021-01-28 15:29 ` krebbel at gcc dot gnu.org
@ 2021-01-29 19:20 ` cvs-commit at gcc dot gnu.org
2021-02-01 20:42 ` programmerjake at gmail dot com
` (5 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-01-29 19:20 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98847
--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Jakub Jelinek
<jakub@gcc.gnu.org>:
https://gcc.gnu.org/g:cf93f94b3498f3925895fb0bbfd4b64232b9987a
commit r10-9323-gcf93f94b3498f3925895fb0bbfd4b64232b9987a
Author: Jakub Jelinek <jakub@redhat.com>
Date: Thu Jan 28 16:13:11 2021 +0100
c++: Fix up handling of register ... asm ("...") vars in templates
[PR33661, PR98847]
As the testcase shows, for vars appearing in templates, we don't attach
the asm spec string to the pattern decls, nor pass it back to
cp_finish_decl
during instantiation.
The following patch does that.
2021-01-28 Jakub Jelinek <jakub@redhat.com>
PR c++/33661
PR c++/98847
* decl.c (cp_finish_decl): For register vars with asmspec in
templates
call set_user_assembler_name and set DECL_HARD_REGISTER.
* pt.c (tsubst_expr): When instantiating DECL_HARD_REGISTER vars,
pass asmspec_tree to cp_finish_decl.
* g++.target/i386/pr98847.C: New test.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug inline-asm/98847] Miscompilation with c++17, templates, and register keyword
2021-01-27 5:22 [Bug inline-asm/98847] New: Miscompilation with c++17, templates, and register keyword programmerjake at gmail dot com
` (6 preceding siblings ...)
2021-01-29 19:20 ` cvs-commit at gcc dot gnu.org
@ 2021-02-01 20:42 ` programmerjake at gmail dot com
2021-04-20 23:31 ` cvs-commit at gcc dot gnu.org
` (4 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: programmerjake at gmail dot com @ 2021-02-01 20:42 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98847
--- Comment #8 from programmerjake at gmail dot com ---
Can the fix for this be backported to gcc 8 and 9 too? Thanks!
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug inline-asm/98847] Miscompilation with c++17, templates, and register keyword
2021-01-27 5:22 [Bug inline-asm/98847] New: Miscompilation with c++17, templates, and register keyword programmerjake at gmail dot com
` (7 preceding siblings ...)
2021-02-01 20:42 ` programmerjake at gmail dot com
@ 2021-04-20 23:31 ` cvs-commit at gcc dot gnu.org
2021-04-22 16:50 ` cvs-commit at gcc dot gnu.org
` (3 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-04-20 23:31 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98847
--- Comment #9 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-9 branch has been updated by Jakub Jelinek
<jakub@gcc.gnu.org>:
https://gcc.gnu.org/g:ef5db37cc4e80b229502bea7d6e2daa95ad6f805
commit r9-9412-gef5db37cc4e80b229502bea7d6e2daa95ad6f805
Author: Jakub Jelinek <jakub@redhat.com>
Date: Thu Jan 28 16:13:11 2021 +0100
c++: Fix up handling of register ... asm ("...") vars in templates
[PR33661, PR98847]
As the testcase shows, for vars appearing in templates, we don't attach
the asm spec string to the pattern decls, nor pass it back to
cp_finish_decl
during instantiation.
The following patch does that.
2021-01-28 Jakub Jelinek <jakub@redhat.com>
PR c++/33661
PR c++/98847
* decl.c (cp_finish_decl): For register vars with asmspec in
templates
call set_user_assembler_name and set DECL_HARD_REGISTER.
* pt.c (tsubst_expr): When instantiating DECL_HARD_REGISTER vars,
pass asmspec_tree to cp_finish_decl.
* g++.target/i386/pr98847.C: New test.
(cherry picked from commit cf93f94b3498f3925895fb0bbfd4b64232b9987a)
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug inline-asm/98847] Miscompilation with c++17, templates, and register keyword
2021-01-27 5:22 [Bug inline-asm/98847] New: Miscompilation with c++17, templates, and register keyword programmerjake at gmail dot com
` (8 preceding siblings ...)
2021-04-20 23:31 ` cvs-commit at gcc dot gnu.org
@ 2021-04-22 16:50 ` cvs-commit at gcc dot gnu.org
2021-04-22 17:10 ` jakub at gcc dot gnu.org
` (2 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-04-22 16:50 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98847
--- Comment #10 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-8 branch has been updated by Jakub Jelinek
<jakub@gcc.gnu.org>:
https://gcc.gnu.org/g:712ffc0ad150aadfa5b91f493075e88fd050189f
commit r8-10878-g712ffc0ad150aadfa5b91f493075e88fd050189f
Author: Jakub Jelinek <jakub@redhat.com>
Date: Thu Jan 28 16:13:11 2021 +0100
c++: Fix up handling of register ... asm ("...") vars in templates
[PR33661, PR98847]
As the testcase shows, for vars appearing in templates, we don't attach
the asm spec string to the pattern decls, nor pass it back to
cp_finish_decl
during instantiation.
The following patch does that.
2021-01-28 Jakub Jelinek <jakub@redhat.com>
PR c++/33661
PR c++/98847
* decl.c (cp_finish_decl): For register vars with asmspec in
templates
call set_user_assembler_name and set DECL_HARD_REGISTER.
* pt.c (tsubst_expr): When instantiating DECL_HARD_REGISTER vars,
pass asmspec_tree to cp_finish_decl.
* g++.dg/opt/pr98847.C: New test.
(cherry picked from commit cf93f94b3498f3925895fb0bbfd4b64232b9987a)
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug inline-asm/98847] Miscompilation with c++17, templates, and register keyword
2021-01-27 5:22 [Bug inline-asm/98847] New: Miscompilation with c++17, templates, and register keyword programmerjake at gmail dot com
` (9 preceding siblings ...)
2021-04-22 16:50 ` cvs-commit at gcc dot gnu.org
@ 2021-04-22 17:10 ` jakub at gcc dot gnu.org
2021-04-22 19:01 ` programmerjake at gmail dot com
2021-09-11 14:29 ` pinskia at gcc dot gnu.org
12 siblings, 0 replies; 14+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-04-22 17:10 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98847
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |FIXED
Assignee|unassigned at gcc dot gnu.org |jakub at gcc dot gnu.org
--- Comment #11 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Fixed.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug inline-asm/98847] Miscompilation with c++17, templates, and register keyword
2021-01-27 5:22 [Bug inline-asm/98847] New: Miscompilation with c++17, templates, and register keyword programmerjake at gmail dot com
` (10 preceding siblings ...)
2021-04-22 17:10 ` jakub at gcc dot gnu.org
@ 2021-04-22 19:01 ` programmerjake at gmail dot com
2021-09-11 14:29 ` pinskia at gcc dot gnu.org
12 siblings, 0 replies; 14+ messages in thread
From: programmerjake at gmail dot com @ 2021-04-22 19:01 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98847
--- Comment #12 from programmerjake at gmail dot com ---
(In reply to Jakub Jelinek from comment #11)
> Fixed.
Thanks!!
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug inline-asm/98847] Miscompilation with c++17, templates, and register keyword
2021-01-27 5:22 [Bug inline-asm/98847] New: Miscompilation with c++17, templates, and register keyword programmerjake at gmail dot com
` (11 preceding siblings ...)
2021-04-22 19:01 ` programmerjake at gmail dot com
@ 2021-09-11 14:29 ` pinskia at gcc dot gnu.org
12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-09-11 14:29 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98847
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |8.5
^ permalink raw reply [flat|nested] 14+ messages in thread