public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/113687] New: -Warray-bounds is not emitted inside class method
@ 2024-01-31 19:32 nmmm at nmmm dot nu
  2024-01-31 19:42 ` [Bug c++/113687] " pinskia at gcc dot gnu.org
  2024-02-01  7:43 ` rguenth at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: nmmm at nmmm dot nu @ 2024-01-31 19:32 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 113687
           Summary: -Warray-bounds is not emitted inside class method
           Product: gcc
           Version: 13.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: nmmm at nmmm dot nu
  Target Milestone: ---

No warning -Warray-bounds is shown when code is inside class method, defined
inside the class body or outside if they are inline or constexpr.

struct S{
    int p(){
        int x[2] = {0, 0};

        return x[3]; // no warning shown
    }

    static int ps(){
        int x[2] = {0, 0};

        return x[3]; // no warning shown
    }

    int ps2inl();
    int ps2();
};

inline int S::ps2inl(){
    int x[2] = {0, 0};

    return x[3]; // no warning shown
}

int S::ps2(){
    int x[2] = {0, 0};

    return x[3]; // warning shown correctly
}

int f(){
    int x[2] = {0, 0};

    return x[3]; // warning shown correctly
}

int main(){
}

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

end of thread, other threads:[~2024-02-01  7:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-31 19:32 [Bug c++/113687] New: -Warray-bounds is not emitted inside class method nmmm at nmmm dot nu
2024-01-31 19:42 ` [Bug c++/113687] " pinskia at gcc dot gnu.org
2024-02-01  7:43 ` rguenth 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).