From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 8068C385DC00; Wed, 1 Apr 2020 15:55:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8068C385DC00 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1585756551; bh=w1v25iaKipvsvxJEpwoSVwLef39gRYyRxBCHUDdstzY=; h=From:To:Subject:Date:From; b=Z+617MvYGHvZlmQx+p1M9HHdCEAqjsikklaI90C7t724AtiC7b8Z7U9KX1uunT6tp rufDW2N+SpKdKYEZHtweU8SrSxQ0BrKQO7reyKQXwaUiC0P04+GuRHhSggnpMKw0IK TCI6S6VQlSomUbjZVBHPMgsi6Q2JDmEEz40hqKJA= From: "clyon at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/94445] New: gcc.target/arm/cmse/cmse-15.c fails for cortex-m33 Date: Wed, 01 Apr 2020 15:55:51 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 10.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: clyon at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Apr 2020 15:55:51 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D94445 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=3Dthumb --with-cpu=3Dcortex-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 ins= tead of the expected 6. The testcase can then be reduced to: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D 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 (); } =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D 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 genera= ted 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): public unsigned SI size unit-si= ze align:32 warn_if_not_align:0 symtab:0 alias-set -1 canonical-ty= pe 0x7facbe670930> visited var def_stmt GIMPLE_NOP version:2 ptr-info 0x7facbe39c300> The next two times (for secure0/secure2): public unsigned SI size unit-si= ze align:32 warn_if_not_align:0 symtab:0 alias-set -1 canonical-ty= pe 0x7facbe670930> arg:0 visited var def_stmt GIMPLE_NOP version:2 ptr-info 0x7facbe3b5be8>> public unsigned SI size unit-si= ze align:32 warn_if_not_align:0 symtab:0 alias-set -1 canonical-ty= pe 0x7facbe670930> arg:0 visited var def_stmt GIMPLE_NOP version:2 ptr-info 0x7facbe3b8b28>> So in the last two cases, the function being called has an incorrect 'ns_fo= o_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 attrib= ute, 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 appreciate= d.=