public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug inline-asm/101354] New: [11/12 regression] naked function mishandled - store optimized away
@ 2021-07-06 22:33 2-gnu at 0x2c dot org
  2021-07-06 22:36 ` [Bug ipa/101354] " pinskia at gcc dot gnu.org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: 2-gnu at 0x2c dot org @ 2021-07-06 22:33 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 101354
           Summary: [11/12 regression] naked function mishandled - store
                    optimized away
           Product: gcc
           Version: 11.0
               URL: https://godbolt.org/z/4T4x8eb4f
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: inline-asm
          Assignee: unassigned at gcc dot gnu.org
          Reporter: 2-gnu at 0x2c dot org
  Target Milestone: ---

Stores are optimized away when a pointer is passed to a naked function.

Discovered in Nordic nRF5-SDK (17.0.2), which uses such a construct to
implement syscalls.

Minimal example:

__attribute__((naked))
//// switching to O0 will make it work
//__attribute__((optimize("O0")))
static void extfun_ptr(int *a) {
    __asm volatile("");
}

void fun() {
    int v;
    v = 1;
    extfun_ptr(&v); // &v is never initialized
}

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

end of thread, other threads:[~2023-10-20 16:31 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-06 22:33 [Bug inline-asm/101354] New: [11/12 regression] naked function mishandled - store optimized away 2-gnu at 0x2c dot org
2021-07-06 22:36 ` [Bug ipa/101354] " pinskia at gcc dot gnu.org
2021-07-07  6:48 ` rguenth at gcc dot gnu.org
2021-07-07  6:50 ` rguenth at gcc dot gnu.org
2021-07-12  4:17 ` marxin at gcc dot gnu.org
2021-07-28  7:07 ` rguenth at gcc dot gnu.org
2021-08-13 14:04 ` cvs-commit at gcc dot gnu.org
2022-01-17 14:04 ` [Bug ipa/101354] [11 " rguenth at gcc dot gnu.org
2022-01-17 14:06 ` marxin at gcc dot gnu.org
2022-01-18 13:27 ` cvs-commit at gcc dot gnu.org
2022-01-18 13:27 ` marxin at gcc dot gnu.org
2023-10-20 16:31 ` pinskia 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).