public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/94445] New: gcc.target/arm/cmse/cmse-15.c fails for cortex-m33
@ 2020-04-01 15:55 clyon at gcc dot gnu.org
2020-04-02 9:58 ` [Bug target/94445] " avieira at gcc dot gnu.org
` (11 more replies)
0 siblings, 12 replies; 13+ messages in thread
From: clyon at gcc dot gnu.org @ 2020-04-01 15:55 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94445
Bug ID: 94445
Summary: gcc.target/arm/cmse/cmse-15.c fails for cortex-m33
Product: gcc
Version: 10.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: clyon at gcc dot gnu.org
Target Milestone: ---
I've noticed that when GCC is configured --target arm-none-abi
--with-mode=thumb --with-cpu=cortex-m33, the cmse-15.c test fails:
FAIL: gcc.target/arm/cmse/cmse-15.c -O2 scan-assembler-times
bl\\s+__gnu_cmse_nonsecure_call 6
FAIL: gcc.target/arm/cmse/cmse-15.c -O3 -g scan-assembler-times
bl\\s+__gnu_cmse_nonsecure_call 6
FAIL: gcc.target/arm/cmse/cmse-15.c -Os scan-assembler-times
bl\\s+__gnu_cmse_nonsecure_call 6
I've looked at the -O2 case, where 8 calls to __gnu_cmse_nonsecure_call instead
of the expected 6.
The testcase can then be reduced to:
=====================================================
typedef int __attribute__ ((cmse_nonsecure_call)) ns_foo_t (void);
typedef int s_bar_t (void);
typedef int (*s_bar_ptr) (void);
int nonsecure0 (ns_foo_t * ns_foo_p)
{
return ns_foo_p ();
}
int secure0 (s_bar_t * s_bar_p)
{
return s_bar_p ();
}
int secure2 (s_bar_ptr s_bar_p)
{
return s_bar_p ();
}
=====================================================
secure0 and secure2 make use of __gnu_cmse_nonsecure_call instead of doing a
normal call.
If I comment out nonsecure0(), then the test passes (only "bx r0" is generated
for secure0/secure2).
With nonsecure0() un-commented as above, I've looked at
arm_function_ok_for_sibcall() which is called 3 times.
The first time (for nonsecure0):
<call_expr 0x7facbe3ac630
[...]
fn <ssa_name 0x7facbe586318
type <pointer_type 0x7facbe670888 type <function_type 0x7facbe670498
ns_foo_t>
public unsigned SI size <integer_cst 0x7facbe57bfd8 32> unit-size
<integer_cst 0x7facbe58e000 4>
align:32 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0x7facbe670930>
visited var <parm_decl 0x7facbe39b180 ns_foo_p>
def_stmt GIMPLE_NOP
version:2
ptr-info 0x7facbe39c300>
The next two times (for secure0/secure2):
<call_expr 0x7facbe3acb10
[...]
fn <nop_expr 0x7facbe3b34a0
type <pointer_type 0x7facbe670888 type <function_type 0x7facbe670498
ns_foo_t>
public unsigned SI size <integer_cst 0x7facbe57bfd8 32> unit-size
<integer_cst 0x7facbe58e000 4>
align:32 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0x7facbe670930>
arg:0 <ssa_name 0x7facbe586900 type <pointer_type 0x7facbe670b28>
visited var <parm_decl 0x7facbe39b200 s_bar_p>
def_stmt GIMPLE_NOP
version:2
ptr-info 0x7facbe3b5be8>>
<call_expr 0x7facbe3ac060
[...]
fn <nop_expr 0x7facbe3ba800
type <pointer_type 0x7facbe670888 type <function_type 0x7facbe670498
ns_foo_t>
public unsigned SI size <integer_cst 0x7facbe57bfd8 32> unit-size
<integer_cst 0x7facbe58e000 4>
align:32 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0x7facbe670930>
arg:0 <ssa_name 0x7facbe586af8 type <pointer_type 0x7facbe6707e0
s_bar_ptr>
visited var <parm_decl 0x7facbe39b280 s_bar_p>
def_stmt GIMPLE_NOP
version:2
ptr-info 0x7facbe3b8b28>>
So in the last two cases, the function being called has an incorrect 'ns_foo_t'
type.
The fact that commenting out nonsecure0 makes the test pass makes me think that
some global state is modified when handling the cmse_nonsecure_call attribute,
but I couldn't find such a problem in arm_handle_cmse_nonsecure_call().
I haven't yet found where that function type is attached to the 'fn' node,
maybe that's where the problem is.
I've also noticed that in the first case 'fn' is an ssa_name, while in the two
other ones, it is a nop_expr.
I've been investigating this for quite some time, so any clue is appreciated.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug target/94445] gcc.target/arm/cmse/cmse-15.c fails for cortex-m33
2020-04-01 15:55 [Bug target/94445] New: gcc.target/arm/cmse/cmse-15.c fails for cortex-m33 clyon at gcc dot gnu.org
@ 2020-04-02 9:58 ` avieira at gcc dot gnu.org
2020-04-02 10:13 ` avieira at gcc dot gnu.org
` (10 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: avieira at gcc dot gnu.org @ 2020-04-02 9:58 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94445
avieira at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |avieira at gcc dot gnu.org
Status|UNCONFIRMED |NEW
Ever confirmed|0 |1
Last reconfirmed| |2020-04-02
--- Comment #1 from avieira at gcc dot gnu.org ---
Hi Christophe,
This looks to me like an issue of not building distinct types for the ns_foo_t
and s_bar_t function types.
When I first wrote this code I tested for this and it was working, so I am
wondering whether changes have been made in the way we create types in the
c-frontend.
I am trying to find out how all this works again, its been a while...
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug target/94445] gcc.target/arm/cmse/cmse-15.c fails for cortex-m33
2020-04-01 15:55 [Bug target/94445] New: gcc.target/arm/cmse/cmse-15.c fails for cortex-m33 clyon at gcc dot gnu.org
2020-04-02 9:58 ` [Bug target/94445] " avieira at gcc dot gnu.org
@ 2020-04-02 10:13 ` avieira at gcc dot gnu.org
2020-04-02 11:12 ` clyon at gcc dot gnu.org
` (9 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: avieira at gcc dot gnu.org @ 2020-04-02 10:13 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94445
--- Comment #2 from avieira at gcc dot gnu.org ---
start_decl seems to be doing the right thing, investigation continues...
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug target/94445] gcc.target/arm/cmse/cmse-15.c fails for cortex-m33
2020-04-01 15:55 [Bug target/94445] New: gcc.target/arm/cmse/cmse-15.c fails for cortex-m33 clyon at gcc dot gnu.org
2020-04-02 9:58 ` [Bug target/94445] " avieira at gcc dot gnu.org
2020-04-02 10:13 ` avieira at gcc dot gnu.org
@ 2020-04-02 11:12 ` clyon at gcc dot gnu.org
2020-04-02 11:42 ` avieira at gcc dot gnu.org
` (8 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: clyon at gcc dot gnu.org @ 2020-04-02 11:12 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94445
--- Comment #3 from Christophe Lyon <clyon at gcc dot gnu.org> ---
I also checked that arm_handle_cmse_nonsecure_call correctly duplicates the
type.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug target/94445] gcc.target/arm/cmse/cmse-15.c fails for cortex-m33
2020-04-01 15:55 [Bug target/94445] New: gcc.target/arm/cmse/cmse-15.c fails for cortex-m33 clyon at gcc dot gnu.org
` (2 preceding siblings ...)
2020-04-02 11:12 ` clyon at gcc dot gnu.org
@ 2020-04-02 11:42 ` avieira at gcc dot gnu.org
2020-04-02 11:43 ` avieira at gcc dot gnu.org
` (7 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: avieira at gcc dot gnu.org @ 2020-04-02 11:42 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94445
--- Comment #4 from avieira at gcc dot gnu.org ---
Yeah...
So far I have checked that 'gimplify_call_expr' creates the right gimple, and
up until 'gimplify_modify_expr' I can verify it does by using
gimple_call_fntype .
Though at expansion time, the 'gimple_call_fntype (stmt)' of '_5 = s_bar_p_2(D)
(); [tail call]' now has the attribute ...
So it must go wrong somewhere between gimplification and expansion, but that's
a big window and dump files won't help us :(
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug target/94445] gcc.target/arm/cmse/cmse-15.c fails for cortex-m33
2020-04-01 15:55 [Bug target/94445] New: gcc.target/arm/cmse/cmse-15.c fails for cortex-m33 clyon at gcc dot gnu.org
` (3 preceding siblings ...)
2020-04-02 11:42 ` avieira at gcc dot gnu.org
@ 2020-04-02 11:43 ` avieira at gcc dot gnu.org
2020-04-02 12:33 ` avieira at gcc dot gnu.org
` (6 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: avieira at gcc dot gnu.org @ 2020-04-02 11:43 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94445
--- Comment #5 from avieira at gcc dot gnu.org ---
Yeah...
So far I have checked that 'gimplify_call_expr' creates the right gimple, and
up until 'gimplify_modify_expr' I can verify it does by using
gimple_call_fntype .
Though at expansion time, the 'gimple_call_fntype (stmt)' of '_5 = s_bar_p_2(D)
(); [tail call]' now has the attribute ...
So it must go wrong somewhere between gimplification and expansion, but that's
a big window and dump files won't help us :(
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug target/94445] gcc.target/arm/cmse/cmse-15.c fails for cortex-m33
2020-04-01 15:55 [Bug target/94445] New: gcc.target/arm/cmse/cmse-15.c fails for cortex-m33 clyon at gcc dot gnu.org
` (4 preceding siblings ...)
2020-04-02 11:43 ` avieira at gcc dot gnu.org
@ 2020-04-02 12:33 ` avieira at gcc dot gnu.org
2020-04-02 14:03 ` [Bug ipa/94445] " marxin at gcc dot gnu.org
` (5 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: avieira at gcc dot gnu.org @ 2020-04-02 12:33 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94445
--- Comment #6 from avieira at gcc dot gnu.org ---
I have also identified that this only goes wrong in O2 or higher. And it
happens sometime between tailcall optimization pass 1 and 2. But there's loads
of passes in between.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug ipa/94445] gcc.target/arm/cmse/cmse-15.c fails for cortex-m33
2020-04-01 15:55 [Bug target/94445] New: gcc.target/arm/cmse/cmse-15.c fails for cortex-m33 clyon at gcc dot gnu.org
` (5 preceding siblings ...)
2020-04-02 12:33 ` avieira at gcc dot gnu.org
@ 2020-04-02 14:03 ` marxin at gcc dot gnu.org
2020-04-03 7:05 ` cvs-commit at gcc dot gnu.org
` (4 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-04-02 14:03 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94445
Martin Liška <marxin at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Component|target |ipa
Target Milestone|--- |10.0
Assignee|clyon at gcc dot gnu.org |marxin at gcc dot gnu.org
Status|NEW |ASSIGNED
--- Comment #7 from Martin Liška <marxin at gcc dot gnu.org> ---
It's ICF issue and I've got a patch for it.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug ipa/94445] gcc.target/arm/cmse/cmse-15.c fails for cortex-m33
2020-04-01 15:55 [Bug target/94445] New: gcc.target/arm/cmse/cmse-15.c fails for cortex-m33 clyon at gcc dot gnu.org
` (6 preceding siblings ...)
2020-04-02 14:03 ` [Bug ipa/94445] " marxin at gcc dot gnu.org
@ 2020-04-03 7:05 ` cvs-commit at gcc dot gnu.org
2020-04-03 7:07 ` marxin at gcc dot gnu.org
` (3 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-04-03 7:05 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94445
--- Comment #8 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Martin Liska <marxin@gcc.gnu.org>:
https://gcc.gnu.org/g:55a7380213a5c16120d5c674fb42b38a3d796b57
commit r10-7530-g55a7380213a5c16120d5c674fb42b38a3d796b57
Author: Martin Liska <mliska@suse.cz>
Date: Fri Apr 3 09:05:06 2020 +0200
ICF: compare type attributes for gimple_call_fntypes.
PR ipa/94445
* ipa-icf-gimple.c (func_checker::compare_gimple_call):
Compare type attributes for gimple_call_fntypes.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug ipa/94445] gcc.target/arm/cmse/cmse-15.c fails for cortex-m33
2020-04-01 15:55 [Bug target/94445] New: gcc.target/arm/cmse/cmse-15.c fails for cortex-m33 clyon at gcc dot gnu.org
` (7 preceding siblings ...)
2020-04-03 7:05 ` cvs-commit at gcc dot gnu.org
@ 2020-04-03 7:07 ` marxin at gcc dot gnu.org
2020-04-03 10:34 ` cvs-commit at gcc dot gnu.org
` (2 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-04-03 7:07 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94445
Martin Liška <marxin at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |NEW
Known to fail| |8.4.0, 9.3.0
Known to work| |10.0
--- Comment #9 from Martin Liška <marxin at gcc dot gnu.org> ---
Fixed on master, I'll backport that.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug ipa/94445] gcc.target/arm/cmse/cmse-15.c fails for cortex-m33
2020-04-01 15:55 [Bug target/94445] New: gcc.target/arm/cmse/cmse-15.c fails for cortex-m33 clyon at gcc dot gnu.org
` (8 preceding siblings ...)
2020-04-03 7:07 ` marxin at gcc dot gnu.org
@ 2020-04-03 10:34 ` cvs-commit at gcc dot gnu.org
2020-04-03 10:37 ` cvs-commit at gcc dot gnu.org
2020-04-03 10:39 ` marxin at gcc dot gnu.org
11 siblings, 0 replies; 13+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-04-03 10:34 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94445
--- Comment #10 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-9 branch has been updated by Martin Liska
<marxin@gcc.gnu.org>:
https://gcc.gnu.org/g:69df6742cb4e15fba5ee074629a78811e61f044d
commit r9-8447-g69df6742cb4e15fba5ee074629a78811e61f044d
Author: Martin Liska <mliska@suse.cz>
Date: Fri Apr 3 12:33:41 2020 +0200
Backport 55a7380213a5c16120d5c674fb42b38a3d796b57
Backport from mainline
2020-04-03 Martin Liska <mliska@suse.cz>
PR ipa/94445
* ipa-icf-gimple.c (func_checker::compare_gimple_call):
Compare type attributes for gimple_call_fntypes.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug ipa/94445] gcc.target/arm/cmse/cmse-15.c fails for cortex-m33
2020-04-01 15:55 [Bug target/94445] New: gcc.target/arm/cmse/cmse-15.c fails for cortex-m33 clyon at gcc dot gnu.org
` (9 preceding siblings ...)
2020-04-03 10:34 ` cvs-commit at gcc dot gnu.org
@ 2020-04-03 10:37 ` cvs-commit at gcc dot gnu.org
2020-04-03 10:39 ` marxin at gcc dot gnu.org
11 siblings, 0 replies; 13+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-04-03 10:37 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94445
--- Comment #11 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-8 branch has been updated by Martin Liska
<marxin@gcc.gnu.org>:
https://gcc.gnu.org/g:33c5b217cbc7562238f96a29393f6ca8fb97482a
commit r8-10161-g33c5b217cbc7562238f96a29393f6ca8fb97482a
Author: Martin Liska <mliska@suse.cz>
Date: Fri Apr 3 12:36:31 2020 +0200
Backport 55a7380213a5c16120d5c674fb42b38a3d796b57
Backport from mainline
2020-04-03 Martin Liska <mliska@suse.cz>
PR ipa/94445
* ipa-icf-gimple.c (func_checker::compare_gimple_call):
Compare type attributes for gimple_call_fntypes.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug ipa/94445] gcc.target/arm/cmse/cmse-15.c fails for cortex-m33
2020-04-01 15:55 [Bug target/94445] New: gcc.target/arm/cmse/cmse-15.c fails for cortex-m33 clyon at gcc dot gnu.org
` (10 preceding siblings ...)
2020-04-03 10:37 ` cvs-commit at gcc dot gnu.org
@ 2020-04-03 10:39 ` marxin at gcc dot gnu.org
11 siblings, 0 replies; 13+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-04-03 10:39 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94445
Martin Liška <marxin at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|NEW |RESOLVED
Known to fail|8.4.0, 9.3.0 |
Known to work| |8.4.1, 9.3.1
--- Comment #12 from Martin Liška <marxin at gcc dot gnu.org> ---
Fixed on active branches.
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2020-04-03 10:39 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-01 15:55 [Bug target/94445] New: gcc.target/arm/cmse/cmse-15.c fails for cortex-m33 clyon at gcc dot gnu.org
2020-04-02 9:58 ` [Bug target/94445] " avieira at gcc dot gnu.org
2020-04-02 10:13 ` avieira at gcc dot gnu.org
2020-04-02 11:12 ` clyon at gcc dot gnu.org
2020-04-02 11:42 ` avieira at gcc dot gnu.org
2020-04-02 11:43 ` avieira at gcc dot gnu.org
2020-04-02 12:33 ` avieira at gcc dot gnu.org
2020-04-02 14:03 ` [Bug ipa/94445] " marxin at gcc dot gnu.org
2020-04-03 7:05 ` cvs-commit at gcc dot gnu.org
2020-04-03 7:07 ` marxin at gcc dot gnu.org
2020-04-03 10:34 ` cvs-commit at gcc dot gnu.org
2020-04-03 10:37 ` cvs-commit at gcc dot gnu.org
2020-04-03 10:39 ` marxin 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).