public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/108919] New: pure nested function may clobber its static chain pointer in windowed ABI on xtensa
@ 2023-02-24 8:52 jcmvbkbc at gcc dot gnu.org
2023-02-25 14:04 ` [Bug target/108919] " cvs-commit at gcc dot gnu.org
2023-02-25 14:08 ` jcmvbkbc at gcc dot gnu.org
0 siblings, 2 replies; 3+ messages in thread
From: jcmvbkbc at gcc dot gnu.org @ 2023-02-24 8:52 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108919
Bug ID: 108919
Summary: pure nested function may clobber its static chain
pointer in windowed ABI on xtensa
Product: gcc
Version: 13.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: jcmvbkbc at gcc dot gnu.org
Target Milestone: ---
Created attachment 54525
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54525&action=edit
test.c
The following gfortran tests fail on windowed ABI xtensa target, but pass on
call0 ABI:
gfortran.dg/character_workout_1.f90 -O[123s] execution test
gfortran.dg/character_workout_4.f90 -O[123s] execution test
E.g. gfortran.dg/character_workout_1.f90 -O1 ends with the message 'STOP 209'.
This happens because in these tests pure nested functions are generated for
subroutines achar_cm and achar_am and the fwprop1 pass removes static chain
pointer initialization between the calls to these functions:
.L143:
addi a3, sp, 108
movi a4, 0xd4
add.n a4, sp, a4
addi a8, sp, -20
s32i.n a4, a8, 0
movi.n a11, 7
mov.n a10, a3
call8 achar_cm.21
movi.n a11, 7
mov.n a10, a3
call8 achar_am.15
Windowed ABI for xtensa specifies that the static chain is passed on the stack,
at offset -20 from the called function's CFA, i.e. outside the caller's stack
frame. This location may be overwritten if the called function makes function
calls that exceed certain depth.
The issue may be reproduced with the attached small test case.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug target/108919] pure nested function may clobber its static chain pointer in windowed ABI on xtensa
2023-02-24 8:52 [Bug target/108919] New: pure nested function may clobber its static chain pointer in windowed ABI on xtensa jcmvbkbc at gcc dot gnu.org
@ 2023-02-25 14:04 ` cvs-commit at gcc dot gnu.org
2023-02-25 14:08 ` jcmvbkbc at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-02-25 14:04 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108919
--- Comment #1 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Max Filippov <jcmvbkbc@gcc.gnu.org>:
https://gcc.gnu.org/g:461d3c84a0e5ad045ee54631901cc953d6befa20
commit r13-6342-g461d3c84a0e5ad045ee54631901cc953d6befa20
Author: Max Filippov <jcmvbkbc@gmail.com>
Date: Wed Feb 22 14:17:11 2023 -0800
gcc: xtensa: fix PR target/108919
gcc/
PR target/108919
* config/xtensa/xtensa-protos.h
(xtensa_prepare_expand_call): Rename to xtensa_expand_call.
* config/xtensa/xtensa.cc (xtensa_prepare_expand_call): Rename
to xtensa_expand_call.
(xtensa_expand_call): Emit the call and add a clobber expression
for the static chain to it in case of windowed ABI.
* config/xtensa/xtensa.md (call, call_value, sibcall)
(sibcall_value): Call xtensa_expand_call and complete expansion
right after that call.
gcc/testsuite/
* gcc.target/xtensa/pr108919.c: New test.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug target/108919] pure nested function may clobber its static chain pointer in windowed ABI on xtensa
2023-02-24 8:52 [Bug target/108919] New: pure nested function may clobber its static chain pointer in windowed ABI on xtensa jcmvbkbc at gcc dot gnu.org
2023-02-25 14:04 ` [Bug target/108919] " cvs-commit at gcc dot gnu.org
@ 2023-02-25 14:08 ` jcmvbkbc at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: jcmvbkbc at gcc dot gnu.org @ 2023-02-25 14:08 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108919
jcmvbkbc at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|UNCONFIRMED |RESOLVED
--- Comment #2 from jcmvbkbc at gcc dot gnu.org ---
Fix is committed to the master.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-02-25 14:08 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-24 8:52 [Bug target/108919] New: pure nested function may clobber its static chain pointer in windowed ABI on xtensa jcmvbkbc at gcc dot gnu.org
2023-02-25 14:04 ` [Bug target/108919] " cvs-commit at gcc dot gnu.org
2023-02-25 14:08 ` jcmvbkbc 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).