public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libgcc/111372] New: libgcc: RISCV C++ exception handling stack usage grew in 13.1
@ 2023-09-11 16:11 alexey.lapshin at espressif dot com
  2023-09-11 16:21 ` [Bug libgcc/111372] " pinskia at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: alexey.lapshin at espressif dot com @ 2023-09-11 16:11 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 111372
           Summary: libgcc: RISCV C++ exception handling stack usage grew
                    in 13.1
           Product: gcc
           Version: 13.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libgcc
          Assignee: unassigned at gcc dot gnu.org
          Reporter: alexey.lapshin at espressif dot com
                CC: juzhe.zhong at rivai dot ai
  Target Milestone: ---

Created attachment 55877
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55877&action=edit
0001-libgcc-reduce-DWARF_FRAME_REGISTERS-to-use-only-base-registers.patch

After vector registers were added (commit
31380d4b7925912b9c34afe8cdb8dffe6cd50b94) c++ exception handling stack
consumption grew too large.
(GCC 12.2) ~1700 bytes vs (GCC 13.2) ~2800 bytes of stack required. This issue
may be critical for embedded projects that use C++.

As a temporary solution, I have patched gcc (see attached file).


It seems better to define macros (FIRST_PSEUDO_REGISTER, FIXED_REGISTERS...)
depending on "vector" extension is set or not. This would also prevent future
bugs.

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

* [Bug libgcc/111372] libgcc: RISCV C++ exception handling stack usage grew in 13.1
  2023-09-11 16:11 [Bug libgcc/111372] New: libgcc: RISCV C++ exception handling stack usage grew in 13.1 alexey.lapshin at espressif dot com
@ 2023-09-11 16:21 ` pinskia at gcc dot gnu.org
  2023-09-11 16:24 ` pinskia at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-09-11 16:21 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Alexey from comment #0) 
> It seems better to define macros (FIRST_PSEUDO_REGISTER, FIXED_REGISTERS...)
> depending on "vector" extension is set or not. This would also prevent
> future bugs.

Except that is broken if you mix code that uses and does not use vectors.
Especially when the vector extension does not need to be compiled in libgcc ...

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

* [Bug libgcc/111372] libgcc: RISCV C++ exception handling stack usage grew in 13.1
  2023-09-11 16:11 [Bug libgcc/111372] New: libgcc: RISCV C++ exception handling stack usage grew in 13.1 alexey.lapshin at espressif dot com
  2023-09-11 16:21 ` [Bug libgcc/111372] " pinskia at gcc dot gnu.org
@ 2023-09-11 16:24 ` pinskia at gcc dot gnu.org
  2023-09-11 16:31 ` [Bug target/111372] " alexey.lapshin at espressif dot com
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-09-11 16:24 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Alexey from comment #0)
> It seems better to define macros (FIRST_PSEUDO_REGISTER, FIXED_REGISTERS...)
> depending on "vector" extension is set or not. This would also prevent
> future bugs.

Also that especially does not work with LTO where some functions can have
vectors enabled and some don't and a lot of the RTL code does not really get
reinitialized with those kind of differences ...

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

* [Bug target/111372] libgcc: RISCV C++ exception handling stack usage grew in 13.1
  2023-09-11 16:11 [Bug libgcc/111372] New: libgcc: RISCV C++ exception handling stack usage grew in 13.1 alexey.lapshin at espressif dot com
  2023-09-11 16:21 ` [Bug libgcc/111372] " pinskia at gcc dot gnu.org
  2023-09-11 16:24 ` pinskia at gcc dot gnu.org
@ 2023-09-11 16:31 ` alexey.lapshin at espressif dot com
  2023-09-11 22:26 ` juzhe.zhong at rivai dot ai
  2023-09-14  6:26 ` kito at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: alexey.lapshin at espressif dot com @ 2023-09-11 16:31 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Alexey <alexey.lapshin at espressif dot com> ---
Ok, but it's better to have configure option or something else just for
toolchains that definitely do not use vector extension

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

* [Bug target/111372] libgcc: RISCV C++ exception handling stack usage grew in 13.1
  2023-09-11 16:11 [Bug libgcc/111372] New: libgcc: RISCV C++ exception handling stack usage grew in 13.1 alexey.lapshin at espressif dot com
                   ` (2 preceding siblings ...)
  2023-09-11 16:31 ` [Bug target/111372] " alexey.lapshin at espressif dot com
@ 2023-09-11 22:26 ` juzhe.zhong at rivai dot ai
  2023-09-14  6:26 ` kito at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: juzhe.zhong at rivai dot ai @ 2023-09-11 22:26 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from JuzheZhong <juzhe.zhong at rivai dot ai> ---
I am not familiar with this stuff.
I would like to see whether kito has good suggestions.

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

* [Bug target/111372] libgcc: RISCV C++ exception handling stack usage grew in 13.1
  2023-09-11 16:11 [Bug libgcc/111372] New: libgcc: RISCV C++ exception handling stack usage grew in 13.1 alexey.lapshin at espressif dot com
                   ` (3 preceding siblings ...)
  2023-09-11 22:26 ` juzhe.zhong at rivai dot ai
@ 2023-09-14  6:26 ` kito at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: kito at gcc dot gnu.org @ 2023-09-14  6:26 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Kito Cheng <kito at gcc dot gnu.org> ---
> Ok, but it's better to have configure option or something else just
> for toolchains that definitely do not use vector extension

I can understand that there would be such a demand in the embedded world, but
that's not critical issue, so this won't get high priority to most RISC-V GCC
developer, it would be appreciate if you could send a patch for that.

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

end of thread, other threads:[~2023-09-14  6:26 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-11 16:11 [Bug libgcc/111372] New: libgcc: RISCV C++ exception handling stack usage grew in 13.1 alexey.lapshin at espressif dot com
2023-09-11 16:21 ` [Bug libgcc/111372] " pinskia at gcc dot gnu.org
2023-09-11 16:24 ` pinskia at gcc dot gnu.org
2023-09-11 16:31 ` [Bug target/111372] " alexey.lapshin at espressif dot com
2023-09-11 22:26 ` juzhe.zhong at rivai dot ai
2023-09-14  6:26 ` kito at gcc dot gnu.org

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