[Bug middle-end/118411] asm goto in large function miscompiles with "Error: bad immediate value for offset" in ARM mode

2025-01-11 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118411

Andrew Pinski  changed:

   What|Removed |Added

  Known to work||15.0

--- Comment #7 from Andrew Pinski  ---
(In reply to Mathieu Desnoyers from comment #5)
> I confirm that the proposed fix applied on gcc-14.2.0 fixes the issue when
> compiling the the reproducer with "-marm".

Thanks for the confirmation.

> 
> Note that this issue is not recent, this fix may need to be backported to
> older compiler versions.

Yes it has been a bug since asm goto was introduced. It was missed that
jump_insn could have been an asm. Now we have future prove it for others too.

Fixed so far on the trunk, I will be going to backport it to the open branches
in a few weeks.

[Bug middle-end/118411] asm goto in large function miscompiles with "Error: bad immediate value for offset" in ARM mode

2025-01-11 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118411

--- Comment #6 from GCC Commits  ---
The trunk branch has been updated by Andrew Pinski :

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

commit r15-6826-gc1729df6ec1eff4815a9cdd71392691ce21da028
Author: Andrew Pinski 
Date:   Fri Jan 10 20:04:09 2025 -0800

final: Fix get_attr_length for asm goto [PR118411]

The problem is for inline-asm goto, the outer rtl insn type
is a jump_insn and get_attr_length does not handle ASM specially
unlike if the outer rtl insn type was just insn.

This fixes the issue by adding support for both CALL_INSN and JUMP_INSN
with asm.

OK? Bootstrapped and tested on x86_64-linux-gnu.

PR middle-end/118411

gcc/ChangeLog:

* final.cc (get_attr_length_1): Handle asm for CALL_INSN
and JUMP_INSNs.

Signed-off-by: Andrew Pinski 

[Bug middle-end/118411] asm goto in large function miscompiles with "Error: bad immediate value for offset" in ARM mode

2025-01-11 Thread mathieu.desnoyers at efficios dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118411

--- Comment #5 from Mathieu Desnoyers  
---
(In reply to Andrew Pinski from comment #2)
> Created attachment 60101 [details]
> try this patch
> 
> This patch should fix get_attr_length_1 for the inline-asm goto.

I confirm that the proposed fix applied on gcc-14.2.0 fixes the issue when
compiling the the reproducer with "-marm".

Note that this issue is not recent, this fix may need to be backported to older
compiler versions.

Thanks!

[Bug middle-end/118411] asm goto in large function miscompiles with "Error: bad immediate value for offset" in ARM mode

2025-01-11 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118411

Andrew Pinski  changed:

   What|Removed |Added

   Keywords||patch
URL||https://gcc.gnu.org/piperma
   ||il/gcc-patches/2025-January
   ||/673330.html

--- Comment #4 from Andrew Pinski  ---
Patch posted:
https://gcc.gnu.org/pipermail/gcc-patches/2025-January/673330.html

[Bug middle-end/118411] asm goto in large function miscompiles with "Error: bad immediate value for offset" in ARM mode

2025-01-10 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118411

Andrew Pinski  changed:

   What|Removed |Added

   Assignee|unassigned at gcc dot gnu.org  |pinskia at gcc dot 
gnu.org
 Status|NEW |ASSIGNED

--- Comment #3 from Andrew Pinski  ---
Mine.

[Bug middle-end/118411] asm goto in large function miscompiles with "Error: bad immediate value for offset" in ARM mode

2025-01-10 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118411

--- Comment #2 from Andrew Pinski  ---
Created attachment 60101
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=60101&action=edit
try this patch

This patch should fix get_attr_length_1 for the inline-asm goto.

[Bug middle-end/118411] asm goto in large function miscompiles with "Error: bad immediate value for offset" in ARM mode

2025-01-10 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118411

Andrew Pinski  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
 Ever confirmed|0   |1
   Last reconfirmed||2025-01-11
  Component|target  |middle-end

--- Comment #1 from Andrew Pinski  ---
Confirmed.

The issue is get_attr_length_1 does not handle ASM goto.