[Bug inline-asm/98847] Miscompilation with c++17, templates, and register keyword

2021-09-11 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98847

Andrew Pinski  changed:

   What|Removed |Added

   Target Milestone|--- |8.5

[Bug inline-asm/98847] Miscompilation with c++17, templates, and register keyword

2021-04-22 Thread programmerjake at gmail dot com via 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!!

[Bug inline-asm/98847] Miscompilation with c++17, templates, and register keyword

2021-04-22 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98847

Jakub Jelinek  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  ---
Fixed.

[Bug inline-asm/98847] Miscompilation with c++17, templates, and register keyword

2021-04-22 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98847

--- Comment #10 from CVS Commits  ---
The releases/gcc-8 branch has been updated by Jakub Jelinek
:

https://gcc.gnu.org/g:712ffc0ad150aadfa5b91f493075e88fd050189f

commit r8-10878-g712ffc0ad150aadfa5b91f493075e88fd050189f
Author: Jakub Jelinek 
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  

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)

[Bug inline-asm/98847] Miscompilation with c++17, templates, and register keyword

2021-04-20 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98847

--- Comment #9 from CVS Commits  ---
The releases/gcc-9 branch has been updated by Jakub Jelinek
:

https://gcc.gnu.org/g:ef5db37cc4e80b229502bea7d6e2daa95ad6f805

commit r9-9412-gef5db37cc4e80b229502bea7d6e2daa95ad6f805
Author: Jakub Jelinek 
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  

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)

[Bug inline-asm/98847] Miscompilation with c++17, templates, and register keyword

2021-02-01 Thread programmerjake at gmail dot com via 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!

[Bug inline-asm/98847] Miscompilation with c++17, templates, and register keyword

2021-01-29 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98847

--- Comment #7 from CVS Commits  ---
The releases/gcc-10 branch has been updated by Jakub Jelinek
:

https://gcc.gnu.org/g:cf93f94b3498f3925895fb0bbfd4b64232b9987a

commit r10-9323-gcf93f94b3498f3925895fb0bbfd4b64232b9987a
Author: Jakub Jelinek 
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  

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.

[Bug inline-asm/98847] Miscompilation with c++17, templates, and register keyword

2021-01-28 Thread krebbel at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98847

Andreas Krebbel  changed:

   What|Removed |Added

 CC||krebbel at gcc dot gnu.org

--- Comment #6 from Andreas Krebbel  ---
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

[Bug inline-asm/98847] Miscompilation with c++17, templates, and register keyword

2021-01-28 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98847

--- Comment #5 from CVS Commits  ---
The master branch has been updated by Jakub Jelinek :

https://gcc.gnu.org/g:6bb207b468da36d9d99c63409dc4098514759c90

commit r11-6958-g6bb207b468da36d9d99c63409dc4098514759c90
Author: Jakub Jelinek 
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  

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.

[Bug inline-asm/98847] Miscompilation with c++17, templates, and register keyword

2021-01-27 Thread programmerjake at gmail dot com via 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

[Bug inline-asm/98847] Miscompilation with c++17, templates, and register keyword

2021-01-27 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98847

Jakub Jelinek  changed:

   What|Removed |Added

 CC||jakub at gcc dot gnu.org

--- Comment #3 from Jakub Jelinek  ---
Created attachment 50066
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50066=edit
gcc11-pr98847.patch

Untested fix.

[Bug inline-asm/98847] Miscompilation with c++17, templates, and register keyword

2021-01-27 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98847

--- Comment #2 from Andrew Pinski  ---
I think this is a dup of bug 33661.

[Bug inline-asm/98847] Miscompilation with c++17, templates, and register keyword

2021-01-26 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98847

Richard Biener  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  ---
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.