public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/88160] Error: register save offset not a multiple of 4 only with optimize
       [not found] <bug-88160-4@http.gcc.gnu.org/bugzilla/>
@ 2023-07-26  5:17 ` vincent.riviere at freesbee dot fr
  2023-07-26 23:50 ` vincent.riviere at freesbee dot fr
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 4+ messages in thread
From: vincent.riviere at freesbee dot fr @ 2023-07-26  5:17 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88160

Vincent Riviere <vincent.riviere at freesbee dot fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |vincent.riviere at freesbee dot fr

--- Comment #2 from Vincent Riviere <vincent.riviere at freesbee dot fr> ---
I reproduce this bug with GCC 13.1.0 for m68k. It happens when compiling libgcc
with -mcpu=5475 -mshort -O2.

Affected files are:
unwind-dw2.c
unwind-dw2-fde.c
libgcov-driver.c

Workaround: compile with -O1.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug target/88160] Error: register save offset not a multiple of 4 only with optimize
       [not found] <bug-88160-4@http.gcc.gnu.org/bugzilla/>
  2023-07-26  5:17 ` [Bug target/88160] Error: register save offset not a multiple of 4 only with optimize vincent.riviere at freesbee dot fr
@ 2023-07-26 23:50 ` vincent.riviere at freesbee dot fr
  2023-07-27  0:02 ` vincent.riviere at freesbee dot fr
  2023-08-14 10:45 ` admin@tho-otto.de
  3 siblings, 0 replies; 4+ messages in thread
From: vincent.riviere at freesbee dot fr @ 2023-07-26 23:50 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88160

--- Comment #3 from Vincent Riviere <vincent.riviere at freesbee dot fr> ---
There are 2 lightweight workarounds for the OP testcase:
-fno-combine-stack-adjustments
-fno-omit-frame-pointer

$ m68k-elf-gcc -mshort -mcpu=5475 -g -O2 -c test.c
/tmp/ccW6hc6h.s: Assembler messages:
/tmp/ccW6hc6h.s:20: Error: register save offset not a multiple of 4
/tmp/ccW6hc6h.s:21: Error: register save offset not a multiple of 4
/tmp/ccW6hc6h.s:22: Error: register save offset not a multiple of 4

$ m68k-elf-gcc -mshort -mcpu=5475 -g -O2 -c test.c
-fno-combine-stack-adjustments
# OK

$ m68k-elf-gcc -mshort -mcpu=5475 -g -O2 -c test.c -fno-omit-frame-pointer
# OK

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug target/88160] Error: register save offset not a multiple of 4 only with optimize
       [not found] <bug-88160-4@http.gcc.gnu.org/bugzilla/>
  2023-07-26  5:17 ` [Bug target/88160] Error: register save offset not a multiple of 4 only with optimize vincent.riviere at freesbee dot fr
  2023-07-26 23:50 ` vincent.riviere at freesbee dot fr
@ 2023-07-27  0:02 ` vincent.riviere at freesbee dot fr
  2023-08-14 10:45 ` admin@tho-otto.de
  3 siblings, 0 replies; 4+ messages in thread
From: vincent.riviere at freesbee dot fr @ 2023-07-27  0:02 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88160

--- Comment #4 from Vincent Riviere <vincent.riviere at freesbee dot fr> ---
Created attachment 55647
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55647&action=edit
Workaround for compiling libgcc with -mcpu=5475 -mshort

Here is a patch for GCC 13.1.0. It allows libgcc to be compiled with -mcpu=5475
-mshort. As a workaround, it uses -fno-combine-stack-adjustments on the
impacted functions.

__attribute__((optimize("-fno-combine-stack-adjustments")))

Of course, it would be much better to fix the root of the issue.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug target/88160] Error: register save offset not a multiple of 4 only with optimize
       [not found] <bug-88160-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2023-07-27  0:02 ` vincent.riviere at freesbee dot fr
@ 2023-08-14 10:45 ` admin@tho-otto.de
  3 siblings, 0 replies; 4+ messages in thread
From: admin@tho-otto.de @ 2023-08-14 10:45 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88160

Thorsten Otto <admin@tho-otto.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |admin@tho-otto.de

--- Comment #5 from Thorsten Otto <admin@tho-otto.de> ---
Another possible patch would be:

--- a/gcc/config/m68k/m68k.cc    2023-07-27 10:13:04.000000000 +0200
+++ b/gcc/config/m68k/m68k.cc 2023-08-13 08:59:00.959510772 +0200
@@ -712,6 +712,14 @@ m68k_option_override (void)
       else
        m68k_sched_mac = MAC_NO;
     }
+
+  /*
+   * disable -fcombine-stack-adjustments for coldfire/mshort combination,
+   * which generates wrong CFI offsets.
+   * https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88160
+   */
+   if (TARGET_COLDFIRE && TARGET_SHORT && (write_symbols & DWARF2_DEBUG))
+    flag_combine_stack_adjustments = 0;
 }

This is only a workaround, but should prevent the bug.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-08-14 10:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-88160-4@http.gcc.gnu.org/bugzilla/>
2023-07-26  5:17 ` [Bug target/88160] Error: register save offset not a multiple of 4 only with optimize vincent.riviere at freesbee dot fr
2023-07-26 23:50 ` vincent.riviere at freesbee dot fr
2023-07-27  0:02 ` vincent.riviere at freesbee dot fr
2023-08-14 10:45 ` admin@tho-otto.de

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).