public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/107039] New: GCC not diagnosing UB in constant expression
@ 2022-09-26 8:44 jlame646 at gmail dot com
2022-09-26 9:29 ` [Bug c++/107039] " redi at gcc dot gnu.org
0 siblings, 1 reply; 2+ messages in thread
From: jlame646 at gmail dot com @ 2022-09-26 8:44 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107039
Bug ID: 107039
Summary: GCC not diagnosing UB in constant expression
Product: gcc
Version: 12.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: jlame646 at gmail dot com
Target Milestone: ---
GCC doesn't give diagnostic for the following program while clang and msvc do.
Demo: https://godbolt.org/z/o3K57fjeE
```
struct S
{
int a, b;
};
constexpr void fn( S &s )
{
(&s.b)[-1] = 123;
}
constexpr auto test = ([]{
S s;
fn(s);
}(), 0);
```
There should be a diagnostic for the above code.
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug c++/107039] GCC not diagnosing UB in constant expression
2022-09-26 8:44 [Bug c++/107039] New: GCC not diagnosing UB in constant expression jlame646 at gmail dot com
@ 2022-09-26 9:29 ` redi at gcc dot gnu.org
0 siblings, 0 replies; 2+ messages in thread
From: redi at gcc dot gnu.org @ 2022-09-26 9:29 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107039
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |accepts-invalid
Resolution|--- |DUPLICATE
Status|UNCONFIRMED |RESOLVED
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Dup of PR 82877 I think.
*** This bug has been marked as a duplicate of bug 82877 ***
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-09-26 9:29 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-26 8:44 [Bug c++/107039] New: GCC not diagnosing UB in constant expression jlame646 at gmail dot com
2022-09-26 9:29 ` [Bug c++/107039] " redi 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).